From 21a5795e0a42a3a0a91148f7c0f9f6cfe78b1235 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Thu, 13 May 2010 02:51:26 -0500 Subject: [PATCH] More fixes to 'OpenGL_Windows.cpp' to work on Linux and Windows --- Source/OpenGL_Windows.cpp | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/Source/OpenGL_Windows.cpp b/Source/OpenGL_Windows.cpp index ddf9408..8208d60 100644 --- a/Source/OpenGL_Windows.cpp +++ b/Source/OpenGL_Windows.cpp @@ -284,7 +284,7 @@ bool cmdline(const char *cmd) char *arg = _argv[i]; while (*arg == '-') arg++; - if (strcasecmp(arg, cmd) == 0) + if (stricmp(arg, cmd) == 0) return true; } @@ -298,7 +298,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; } @@ -1760,6 +1760,7 @@ int main(int argc, char **argv) #if !USE_DEVIL +#ifdef _WIN32 static bool load_image(const char *file_name, TGAImageRec &tex) { char *ptr = strrchr((char *)file_name, '.'); @@ -1774,6 +1775,22 @@ static bool load_image(const char *file_name, TGAImageRec &tex) STUBBED("Unsupported image type"); return false; } +#else +static bool load_image(const char *file_name, TGAImageRec &tex) +{ + char *ptr = strrchr((char *)file_name, '.'); + if (ptr) + { + if (strcasecmp(ptr+1, "png") == 0) + return load_png(file_name, tex); + else if (strcasecmp(ptr+1, "jpg") == 0) + return load_jpg(file_name, tex); + } + + STUBBED("Unsupported image type"); + return false; +} +#endif struct my_error_mgr { @@ -1924,6 +1941,7 @@ png_done: } +#ifdef _WIN32 static bool save_image(const char *file_name) { char *ptr = strrchr((char *)file_name, '.'); @@ -1936,6 +1954,20 @@ static bool save_image(const char *file_name) STUBBED("Unsupported image type"); return false; } +#else +static bool save_image(const char *file_name) +{ + char *ptr = strrchr((char *)file_name, '.'); + if (ptr) + { + if (strcasecmp(ptr+1, "png") == 0) + return save_png(file_name); + } + + STUBBED("Unsupported image type"); + return false; +} +#endif static bool save_png(const char *file_name) -- 2.39.2