summaryrefslogtreecommitdiff
path: root/engine/texturesdl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engine/texturesdl.cpp')
-rw-r--r--engine/texturesdl.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/engine/texturesdl.cpp b/engine/texturesdl.cpp
new file mode 100644
index 0000000..8e112ef
--- /dev/null
+++ b/engine/texturesdl.cpp
@@ -0,0 +1,17 @@
+#include <iostream>
+#include <stdexcept>
+#include <SDL/SDL_image.h>
+#include "texturesdl.h"
+
+TextureSDL::TextureSDL(const char* filename) {
+ SDL_Surface* image = IMG_Load(filename);
+
+ width = image->w;
+ height = image->h;
+ byte_per_pixel = image->format->BytesPerPixel;
+ data = (unsigned char*)image->pixels;
+
+ build();
+
+ SDL_FreeSurface(image);
+}