summaryrefslogtreecommitdiff
path: root/texturesdl.cpp
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2010-02-27 23:48:41 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2010-02-27 23:48:41 +0100
commit77361abc13c02469d41af5d937adf517ac5326b9 (patch)
tree2d2fa8316867349413764dee21eade239fe8d8ce /texturesdl.cpp
parentb353185ff989e2dd058284dc5b1a6d5d6197bcbd (diff)
Added SDL_image based texture loader.
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);
+}