55 lines
1.0 KiB
C++
55 lines
1.0 KiB
C++
/*
|
|
* ResourceManager.h
|
|
*
|
|
* Created on: Nov 7, 2016
|
|
* Author: tibi
|
|
*/
|
|
|
|
#ifndef STORAGE_RESOURCEMANAGER_H_
|
|
#define STORAGE_RESOURCEMANAGER_H_
|
|
|
|
#include <vector>
|
|
#include <map>
|
|
|
|
#include <SDL2/SDL.h>
|
|
#include <SDL2/SDL_image.h>
|
|
#include <SDL2/SDL_ttf.h>
|
|
|
|
namespace farmlands
|
|
{
|
|
namespace storage
|
|
{
|
|
class ResourceManager
|
|
{
|
|
public:
|
|
ResourceManager();
|
|
virtual ~ResourceManager();
|
|
|
|
void loadMainMenu();
|
|
void loadGame(SDL_Renderer* renderer);
|
|
|
|
TTF_Font* font(const char* name, int pointSize);
|
|
TTF_Font* font(int id, int pointSize);
|
|
int fontId(const char* name);
|
|
|
|
SDL_Texture* texture(const char* name);
|
|
SDL_Texture* texture(int id);
|
|
int textureId(const char* name);
|
|
|
|
private:
|
|
void loadTextures(SDL_Renderer* renderer);
|
|
|
|
typedef int FontId;
|
|
|
|
std::map<FontId, TTF_Font*> m_fontCache;
|
|
std::map<std::string, int> m_fontIdCache;
|
|
|
|
std::vector<SDL_Surface*> m_surfaces;
|
|
std::vector<SDL_Texture*> m_textures;
|
|
};
|
|
|
|
} /* namespace storage */
|
|
} /* namespace farmlands */
|
|
|
|
#endif /* STORAGE_RESOURCEMANAGER_H_ */
|