]> git.jsancho.org Git - lugaru.git/blobdiff - Source/ImageIO.cpp
Got rid of global texture var. Calling load_image directly
[lugaru.git] / Source / ImageIO.cpp
index c8dffe511d1537a9e21b771db0f2185dee8e56c3..affcb8c58c29d40cc1a9dc2a96cfedac9b7cb020 100644 (file)
@@ -1,5 +1,6 @@
 /*
 Copyright (C) 2003, 2010 - Wolfire Games
+Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file)
 
 This file is part of Lugaru.
 
@@ -27,7 +28,6 @@ along with Lugaru.  If not, see <http://www.gnu.org/licenses/>.
 #include "Game.h"
 #include "ImageIO.h"
 
-extern ImageRec texture;
 extern bool visibleloading;
 
 /* These two are needed for screenshot */
@@ -38,9 +38,15 @@ static bool load_png(const char * fname, ImageRec & tex);
 static bool load_jpg(const char * fname, ImageRec & tex);
 static bool save_screenshot_png(const char * fname);
 
-bool upload_image(const char* fileName)
+ImageRec::ImageRec()
 {
-    return load_image(fileName, texture);
+    data = ( GLubyte* )malloc( 1024 * 1024 * 4 );
+}
+
+ImageRec::~ImageRec()
+{
+    free(data);
+    data = NULL;
 }
 
 bool load_image(const char *file_name, ImageRec &tex)