- [NEW] Càrrega d'habitacions
- [NEW] Càrrega unificada d'imatges
This commit is contained in:
17
source/images.cpp
Normal file
17
source/images.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "images.h"
|
||||
#include <map>
|
||||
|
||||
namespace images
|
||||
{
|
||||
std::map<std::string, draw::surface*> images;
|
||||
|
||||
draw::surface *getImage(std::string filename)
|
||||
{
|
||||
auto item = images.find(filename);
|
||||
if (item != images.end()) return item->second;
|
||||
|
||||
draw::surface *image = draw::loadSurface(filename.c_str());
|
||||
images[filename] = image;
|
||||
return image;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user