]> git.jsancho.org Git - lugaru.git/blobdiff - Source/OpenGL_Windows.cpp
Renamed old Makefile, updated .hgignore, and made changes to png functions to remove...
[lugaru.git] / Source / OpenGL_Windows.cpp
index a37cdda07b671cc376182fc44b44374f951f3e86..7fbeb494e423053f40bb92037ef9eae2f931f84e 100644 (file)
@@ -1,10 +1,29 @@
+/*
+Copyright (C) 2003, 2010 - Wolfire Games
+
+This file is part of Lugaru.
+
+Lugaru is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+*/
+
 
 #ifdef WIN32
 #include <vld.h>
 #endif
 
-#include "Game.h"
-
 #ifndef USE_DEVIL
 #  ifdef WIN32
 #    define USE_DEVIL
     #include "IL/il.h"
     #include "IL/ilu.h"
     #include "IL/ilut.h"
+       #include "Game.h"
 #else
-    // just use libpng and libjpg directly; it's lighter-weight and easier
-    //  to manage the dependencies on Linux...
-    extern "C" {
-        #include "png.h"
-        #include "jpeglib.h"
-    }
+
+       #include <zlib.h>
+       #include <png.h>
+       #include <jpeglib.h>
+       #include "Game.h"
     static bool load_image(const char * fname, TGAImageRec & tex);
     static bool load_png(const char * fname, TGAImageRec & tex);
     static bool load_jpg(const char * fname, TGAImageRec & tex);
@@ -247,7 +266,7 @@ bool cmdline(const char *cmd)
         char *arg = _argv[i];
         while (*arg == '-')
             arg++;
-        if (stricmp(arg, cmd) == 0)
+        if (strcasecmp(arg, cmd) == 0)
             return true;
     }
 
@@ -1501,7 +1520,7 @@ char *calcBaseDir(const char *argv0)
     char *retval;
     char *envr;
 
-    char *ptr = strrchr(argv0, '/');
+    char *ptr = strrchr((char *)argv0, '/');
     if (strchr(argv0, '/'))
     {
         retval = strdup(argv0);
@@ -2555,12 +2574,12 @@ int main(int argc, char **argv)
 #if !USE_DEVIL
 static bool load_image(const char *file_name, TGAImageRec &tex)
 {
-    char *ptr = strrchr(file_name, '.');
+    char *ptr = strrchr((char *)file_name, '.');
     if (ptr)
     {
-        if (stricmp(ptr+1, "png") == 0)
+        if (strcasecmp(ptr+1, "png") == 0)
             return load_png(file_name, tex);
-        else if (stricmp(ptr+1, "jpg") == 0)
+        else if (strcasecmp(ptr+1, "jpg") == 0)
             return load_jpg(file_name, tex);
     }
 
@@ -2660,7 +2679,7 @@ static bool load_png(const char *file_name, TGAImageRec &tex)
     png_init_io(png_ptr, fp);
     png_read_png(png_ptr, info_ptr,
                  PNG_TRANSFORM_STRIP_16 | PNG_TRANSFORM_PACKING,
-                 png_voidp_NULL);
+                 NULL);
     png_get_IHDR(png_ptr, info_ptr, &width, &height,
                  &bit_depth, &color_type, &interlace_type, NULL, NULL);
 
@@ -2710,7 +2729,7 @@ static bool load_png(const char *file_name, TGAImageRec &tex)
     retval = true;
 
 png_done:
-    png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
+    png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
     if (fp)
         fclose(fp);
     return (retval);
@@ -2719,10 +2738,10 @@ png_done:
 
 static bool save_image(const char *file_name)
 {
-    char *ptr = strrchr(file_name, '.');
+    char *ptr = strrchr((char *)file_name, '.');
     if (ptr)
     {
-        if (stricmp(ptr+1, "png") == 0)
+        if (strcasecmp(ptr+1, "png") == 0)
             return save_png(file_name);
     }