-
Notifications
You must be signed in to change notification settings - Fork 0
/
TextureManager.h
25 lines (21 loc) · 945 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
#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);
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