1 #ifndef SPRITE_MANAGER_HPP
2 #define SPRITE_MANAGER_HPP
30 fileMap.emplace(
"character_dark_blue",
"./Assets/sprites/character_dark_blue.bmp");
31 fileMap.emplace(
"character_blue",
"./Assets/sprites/character_blue.bmp");
32 fileMap.emplace(
"sprite",
"./Assets/sprites/sprite.bmp");
33 fileMap.emplace(
"ghost_left",
"./Assets/sprites/ghost_left.bmp");
34 fileMap.emplace(
"ghost_right",
"./Assets/sprites/ghost_right.bmp");
43 std::shared_ptr<Sprite>
Load(
const std::string &path)
46 std::shared_ptr<SDL_Surface> surface = std::shared_ptr<SDL_Surface>(SDL_LoadBMP(path.data()), SDL_FreeSurface);
50 SDL_Log(
"Failed to allocate surface");
55 SDL_Log(
"Allocated a bunch of memory to create identical game character");
58 std::shared_ptr<Sprite> s = std::make_shared<Sprite>();
59 s->spriteSheet = surface;
60 s->texture = std::shared_ptr<SDL_Texture>(SDL_CreateTextureFromSurface(ren, surface.get()), SDL_DestroyTexture);
std::shared_ptr< Sprite > Load(const std::string &path)
Definition: SpriteManager.hpp:43
std::map< std::string, std::string > fileMap
stores location of resources
Definition: ResourceManager.hpp:156
int startUp(SDL_Renderer *in)
Definition: SpriteManager.hpp:27
static SpriteManager & instance()
Definition: SpriteManager.hpp:16
Definition: ResourceManager.hpp:62
Definition: SpriteManager.hpp:10