summaryrefslogtreecommitdiff
path: root/src/resources/resourcemanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/resourcemanager.cpp')
-rw-r--r--src/resources/resourcemanager.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 26899d77..1c1eb5db 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -26,6 +26,7 @@
#include <cassert>
#include <sstream>
#include <physfs.h>
+#include <SDL_image.h>
#include "image.h"
#include "music.h"
@@ -297,3 +298,19 @@ ResourceManager::loadTextFile(const std::string &fileName)
free(fileContents);
return lines;
}
+
+SDL_Surface*
+ResourceManager::loadSDLSurface(const std::string& filename)
+{
+ int fileSize;
+ void *buffer = loadFile(filename, fileSize);
+ SDL_Surface *tmp = NULL;
+
+ if (buffer) {
+ SDL_RWops *rw = SDL_RWFromMem(buffer, fileSize);
+ tmp = IMG_Load_RW(rw, 1);
+ ::free(buffer);
+ }
+
+ return tmp;
+}