-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSprite.h
More file actions
37 lines (31 loc) · 718 Bytes
/
Sprite.h
File metadata and controls
37 lines (31 loc) · 718 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once
#include <unordered_map>
#include "lib/leetlib.h"
#include "Singleton.h"
class Sprite
{
private:
void* texture = nullptr;
public:
Sprite(const char* const path)
{
this->texture = LoadSprite(path);
}
operator void* () const
{
return texture;
}
};
// It loads letters (a-z), numbers (0-9), invaders (little and big) and the bullet
class Sprites : public Singleton<Sprites>
{
friend Singleton<Sprites>;
public:
const Sprite enemy = "gfx/invaders/little.png";
const Sprite player = "gfx/invaders/big.png";
const Sprite bullet = "gfx/bullet.png";
std::unordered_map<char, Sprite> alphabet;
void loadSprites();
private:
Sprites();
};