summaryrefslogtreecommitdiff
path: root/intensemarcus.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'intensemarcus.cpp')
-rw-r--r--intensemarcus.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/intensemarcus.cpp b/intensemarcus.cpp
new file mode 100644
index 0000000..c866a1a
--- /dev/null
+++ b/intensemarcus.cpp
@@ -0,0 +1,24 @@
+#include "intensemarcus.h"
+
+/* SDL_Surface loads an image from a file, and
+ converts it into the same format as the
+ display, for faster blitting. */
+SDL_Surface *loadImage(std::string filename) {
+ // Image as it is loaded
+ SDL_Surface* raw = NULL;
+
+ // Image converted into same format as display
+ SDL_Surface* image = NULL;
+
+ raw = IMG_Load(filename.c_str());
+
+ if(raw != NULL) {
+ // Convert the image, using the PNG's alpha channel
+ image = SDL_DisplayFormatAlpha(raw);
+
+ // Free raw image
+ SDL_FreeSurface(raw);
+ }
+
+ return image;
+}