X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FOpenGL_Windows.cpp;h=8208d60b2f2968e1b8cf958d0b298acdbeca934b;hb=21a5795e0a42a3a0a91148f7c0f9f6cfe78b1235;hp=15a71f327276818069a4cdaa280385533152c5d9;hpb=13744c4559f89a66a6353823c4c90ed03ac20555;p=lugaru.git diff --git a/Source/OpenGL_Windows.cpp b/Source/OpenGL_Windows.cpp index 15a71f3..8208d60 100644 --- a/Source/OpenGL_Windows.cpp +++ b/Source/OpenGL_Windows.cpp @@ -276,6 +276,7 @@ static int _argc = 0; static char **_argv = NULL; #endif +#ifdef _WIN32 bool cmdline(const char *cmd) { for (int i = 1; i < _argc; i++) @@ -289,6 +290,21 @@ bool cmdline(const char *cmd) return false; } +#else +bool cmdline(const char *cmd) +{ + for (int i = 1; i < _argc; i++) + { + char *arg = _argv[i]; + while (*arg == '-') + arg++; + if (strcasecmp(arg, cmd) == 0) + return true; + } + + return false; +} +#endif // -------------------------------------------------------------------------- @@ -1744,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, '.'); @@ -1758,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 { @@ -1908,6 +1941,7 @@ png_done: } +#ifdef _WIN32 static bool save_image(const char *file_name) { char *ptr = strrchr((char *)file_name, '.'); @@ -1920,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)