Hi
Is there any global define to know if the program is compiling
under Linux or Windows (gcc or mingw32). Something like:
#ifdef SOMETHING
do_something
#endif
The objective is define a PATH SEPARATOR (under Linux, “/”, under
Windows “\”), so that I can load images in the correct way for
each OS. (maybe is there a portable function to build paths
such as python’s os.buildpath()?)
Another question is mingw32 related. I have a small game running
perfectly under Linux. I installed mingw32+directx_headers+sdl+
sdl_image and compiled a small demo/intro I wrote under Linux.
It worked. Then I tried to compile my game, and it compiled.
BUT when I ran it, it crashed saying that compressed bmp
files were not allowed in SDL_LoadBMP (and those are THE SAME
BMP FILES THAT I’m using under Linux). I loaded all under GIMP
and saved them with no compression, and the windows version
still says the same (I’m talking about 1 800x600 image and 20
70x96 cards for a card game). Then I replaced SDM_LoadBMP for
IMG_Load (and used SDL_image) and converted all the bmp files
to PNG files. The following is quite strange: all the images
are card-0.png to card-20.png, so the code is:
for( i=0; i<NUM_CARDS; i++ )
{
sprintf( path, “card-%d.png”, i );
Temp = IMG_Load(path);
if( Temp != NULL )
{
gfxcards[i] = SDL_DisplayFormat(Temp);
SDL_FreeSurface(Temp);
}
else
{
fprintf(stderr, “Couldn’t load %s\n”, path );
exit(-1);
}
}
If I run this code, it loads EXACTLY 15 images (not the full 20)
and gives a nice error with Couldn’t load card-15.png. Then I
though that maybe card-15.png was different of the rest, so I just
copied card-0.png (that loads perfectly) as card-15, 16, 17, 18, 19
and 20. I run and I get the same results, It only loads 15 cards.
Is this a bug or a fault on my code?
And a final question: I drop SDL.dll in the directory of my program
(the executable asks for it if it’s not present), but I don’t know
if I need to include in the same directory png.dll, zlib.dll,
and sdl_image.dll, as the program does not ask for them directly
(Although I’ve included them).
Any idea of all above?
PS: I never know compiling under Windows was so kind of torture
CU!–
Refranero: “M?s vale crond en mano que Administrador de Tareas colgado.”
_O)
NoP / Compiler | @Santiago_Romero - ICQ #98602813 /\
Linux Debian 2.2 | http://escomposlinux.org/sromero - #74.821 _V