summaryrefslogtreecommitdiff
path: root/texturesdl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'texturesdl.cpp')
-rwxr-xr-xtexturesdl.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/texturesdl.cpp b/texturesdl.cpp
new file mode 100755
index 0000000..ea7d9ac
--- /dev/null
+++ b/texturesdl.cpp
@@ -0,0 +1,16 @@
+#include <iostream>
+#include <stdexcept>
+#include <SDL_image/SDL_image.h>
+#include "texturesdl.h"
+
+TextureSDL::TextureSDL(const char* filename) {
+ SDL_Surface* image = IMG_Load(filename);
+
+ width = image->w;
+ height = image->h;
+ data = (unsigned char*)image->pixels;
+
+ build();
+
+ SDL_FreeSurface(image);
+}