Hi all,
I have some code like this:
screen = SDL_SetVideoMode(640, 480, 16, SDL_HWSURFACE | SDL_ANYFORMAT |
SDL_DOUBLEBUF);
/* … then I call a function with this code: */
SDL_Surface *image;
SDL_Rect dest;
/* draw white background */
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0xFF,
0xFF, 0xFF));
/* load_image() is wrapper around SDL_LoadBMP() */
if (!(image = load_image("logo.bmp")))
exit(1);
/* center image */
dest.x = (screen->w - image->w)/2;
dest.y = (screen->h - image->h)/2;
dest.w = image->w;
dest.h = image->h;
SDL_BlitSurface(image, NULL, screen, &dest);
SDL_Flip(screen);
SDL_FreeSurface(image);
/* after calling that function i call: */
SDL_Delay(3000);
Sometimes the image shows up but sometimes it doesn’t. (I could not find
a pattern for this behaviour but it usually doesn’t show up when run it
just after compiling)
Am I doing anything wrong?
TIA–
Luis Oliveira
luismbo at netcabo.pt