Jagguar Game Engine

Loading...
Searching...
No Matches
ResourceManager.hpp
1#ifndef RESOURCE_MANAGER_HPP
2#define RESOURCE_MANAGER_HPP
3
4#if defined(LINUX) || defined(MINGW)
5 #include <SDL2/SDL.h>
6#else // This works for Mac
7 #include <SDL.h>
8#endif
9
10#include <unordered_map>
11#include <string>
12
17 class ResourceManager{
18 private:
23 ResourceManager(); // Private Singleton
24 ResourceManager(ResourceManager const&); // Avoid copy constructor
25 void operator=(ResourceManager const&); // Don't allow assignment.
26
27 std::unordered_map<std::string, SDL_Surface*> surfaces;
28
29 public:
35 static ResourceManager &GetInstance();
36
43 SDL_Surface* LoadResource(std::string image_filename);
44
45 // TODO SPRINT 1 (April 5): Create LoadResource overload for audio files
46
54 SDL_Surface* GetResource(std::string key);
55
59 int StartUp();
60
64 int ShutDown();
65};
66
67#endif
ResourceManager
Definition: ResourceManager.hpp:17
ResourceManager::StartUp
int StartUp()
ResourceManager::ResourceManager
ResourceManager()
Definition: ResourceManager.cpp:12
ResourceManager::LoadResource
SDL_Surface * LoadResource(std::string image_filename)
Definition: ResourceManager.cpp:22
ResourceManager::GetResource
SDL_Surface * GetResource(std::string key)
Definition: ResourceManager.cpp:36
ResourceManager::GetInstance
static ResourceManager & GetInstance()
Definition: ResourceManager.cpp:16
ResourceManager::ShutDown
int ShutDown()
Definition: ResourceManager.cpp:40