The following program will cause a segmentation fault:
#include <SDL.h>
SDL_Surface *screen;
Uint32 darkgray;
const SDL_Rect r={10,10,10,10};
int quit=0;
void init_SDL()
{
if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr,
“Couldn’t initialize SDL: %s\n”,
SDL_GetError());
exit(1);
}
atexit(SDL_Quit);
/* Initialize the display */
screen = SDL_SetVideoMode(800, 600, 0,
SDL_SWSURFACE|SDL_ANYFORMAT);
if ( screen == NULL ) {
fprintf(stderr, “Couldn’t set video mode: %s\n”,
SDL_GetError());
exit(1);
}
}
int main(int argc, char *argv[])
{
init_SDL();
darkgray=SDL_MapRGB(screen->format,100,100,100);
SDL_FillRect(screen, &r, darkgray);
SDL_UpdateRect(screen, 0,0,0,0);
while (1) SDL_Delay(10);
}
Is this behavoir normal?
Why doesn’t the documentation warn about this?
Thanks
Alessandro.______________________________________________________________________
Yahoo! Mail: 6MB di spazio gratuito, 30MB per i tuoi allegati, l’antivirus, il filtro Anti-spam
http://it.yahoo.com/mail_it/foot/?http://it.mail.yahoo.com/