-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTextureManager.h
30 lines (27 loc) · 951 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
27
28
29
30
#ifndef GUARD_TEXTUREMANAGER_H
#define GUARD_TEXTUREMANAGER_H
#include <map>
#include <string>
#include "SDL.h"
class TextureManager
{
public:
static TextureManager* Instance(){
if (!s_pInstance)
{
s_pInstance = new TextureManager();
}
return s_pInstance;
}
bool load(std::string fileName, std::string id, SDL_Renderer* pRenderer);
void drawImage(std::string id, int x, int y, int width, int height, SDL_Renderer* prenderer, SDL_RendererFlip flip = SDL_FLIP_NONE);
void drawFrame(std::string id, int x, int y, int width, int height,
int currentRow, int currentFrame, SDL_Renderer* pRenderer, int margin = 0, 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);
private:
TextureManager(){}
static TextureManager* s_pInstance;
std::map<std::string, SDL_Texture*> m_textureMap;
};
#endif