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
|
class TextureManager
{
public:
~TextureManager() {}
static TextureManager* Instance();
bool load(std::string fileName, std::string id,
SDL_Renderer* pRenderer);
//draw
void draw(std::string id, int x, int y, int width, int height,
SDL_Renderer* pRenderer, SDL_RendererFlip flip = SDL_FLIP_NONE);
//drawframe
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);
private:
TextureManager() {}
std::map<std::string, SDL_Texture*> m_textureMap;
static TextureManager* s_pInstance;
};
typedef TextureManager TheTextureManager;
|