-
Notifications
You must be signed in to change notification settings - Fork 0
/
TextureManager.h
26 lines (22 loc) · 989 Bytes
/
TextureManager.h
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
#ifndef TEXTUREMANAGER_H
#define TEXTUREMANAGER_H
#include <SDL2/SDL_image.h>
#include <map>
class TextureManager
{
private:
std::map<std::string, SDL_Texture*> m_textureMap;
static TextureManager* s_pInstance;
TextureManager() {}
public:
bool load(std::string fileName, std::string id, SDL_Renderer* pRenderer);
bool textureExists(const std::string& id);
void draw(std::string id, int x, int y, int width, int height, SDL_Renderer* pRenderer, SDL_RendererFlip filp = SDL_FLIP_NONE);
void drawFrame(std::string id, int x, int y, int width, int height, int currentRow, int currentFrame, SDL_Renderer* pRenderer, SDL_RendererFlip flip = SDL_FLIP_NONE);
void drawTile(std::string id, int margin, int spacing, int x, int y, int width, int height, int currentRow, int currentFrame, SDL_Renderer *pRenderer);
static TextureManager* instance();
void clearFromTextureMap(std::string id);
};
//defining singleton.
typedef TextureManager TheTextureManager;
#endif //TEXTUREMANAGER_H