29 lines
530 B
C++
29 lines
530 B
C++
#ifndef __OPENGLPLAYGROUND_IMAGEPROVIDER_HH__
|
|
#define __OPENGLPLAYGROUND_IMAGEPROVIDER_HH__
|
|
|
|
#include <memory>
|
|
#include <unordered_map>
|
|
#include <string>
|
|
#include <mutex>
|
|
|
|
#include <SDL2/SDL.h>
|
|
|
|
#include "common.hh"
|
|
#include "Singleton.hh"
|
|
|
|
class ImageProvider : public Singleton<ImageProvider> {
|
|
private:
|
|
ImageProvider();
|
|
friend class Singleton<ImageProvider>;
|
|
|
|
public:
|
|
SDL_Surface* getImage(std::string const& name);
|
|
|
|
void cleanup();
|
|
|
|
private:
|
|
std::unordered_map<std::string, SDLSurfaceUPtr> imageCache_;
|
|
};
|
|
|
|
#endif
|