1 #ifndef IMAGE_MANAGER_HPP
2 #define IMAGE_MANAGER_HPP
39 int imgFlags = IMG_INIT_PNG;
40 if (!(IMG_Init(imgFlags) & imgFlags))
42 SDL_LogError(SDL_LOG_CATEGORY_RENDER,
"Couldn't start image manager");
46 fileMap.emplace(
"ball",
"./Assets/images/ballGrey.png");
47 fileMap.emplace(
"blue_rect",
"./Assets/images/element_blue_rectangle.png");
48 fileMap.emplace(
"green_rect",
"./Assets/images/element_green_rectangle.png");
49 fileMap.emplace(
"grey_rect",
"./Assets/images/element_grey_rectangle.png");
50 fileMap.emplace(
"purple_rect",
"./Assets/images/element_purple_rectangle.png");
51 fileMap.emplace(
"red_rect",
"./Assets/images/element_red_rectangle.png");
52 fileMap.emplace(
"yellow_rect",
"./Assets/images/element_yellow_rectangle.png");
53 fileMap.emplace(
"paddle",
"./Assets/images/paddleRed.png");
62 std::shared_ptr<TextureWrapper>
Load(
const std::string &path)
64 SDL_Texture* img = IMG_LoadTexture(ren, path.c_str());
68 printf(
"%s\n", IMG_GetError());
73 SDL_Log(
"Allocated image memory for %s", path.c_str());
74 std::shared_ptr<SDL_Texture> surface = std::shared_ptr<SDL_Texture>(img, SDL_DestroyTexture);
75 return std::make_shared<TextureWrapper>(surface);
84 printf(
"Constructing image manager\n");
void operator=(ImageManager const &) = delete
don't allow assignment
std::map< std::string, std::string > fileMap
stores location of resources
Definition: ResourceManager.hpp:156
int startUp(SDL_Renderer *in)
Definition: ImageManager.hpp:37
std::shared_ptr< TextureWrapper > Load(const std::string &path)
Definition: ImageManager.hpp:62
int shutDown()
Definition: ResourceManager.hpp:69
int shutDown()
Definition: ImageManager.hpp:25
static ImageManager & instance()
Definition: ImageManager.hpp:16
Definition: ResourceManager.hpp:62
Definition: ImageManager.hpp:10