I’m having trouble using SDL_SetVideoMode a second time. A very
simplified test case follows. I’m using windows 2000. What happens is I
see a 640x480 windows, then it goes to 800x600 fullscreen and crashes
before anything is displayed. Exit code is -11. Could anyone tell me
what I’m doing wrong? Thanks.
stdout.txt:
Video mode set to 800x600x32.
1
2
stderr.txt:
Fatal signal: Segmentation Fault (SDL Parachute Deployed)
testcase.cpp:
#include <stdio.h>
#include <stdlib.h>
#include “SDL.h”
SDL_Surface *screen;
int main(int argc, char *argv[])
{
if ( SDL_Init(SDL_INIT_EVERYTHING) < 0 ) {
fprintf(stderr, “Couldn’t initialize SDL: %s\n”, SDL_GetError());
exit(1);
}
atexit(SDL_Quit);
if ((screen = SDL_SetVideoMode(640, 480, 8,
SDL_SWSURFACE|SDL_ANYFORMAT)) == NULL ) {
fprintf(stderr, “Couldn’t set 640x480x8 video mode: %s\n”,
SDL_GetError());
exit(1);
}
if ((screen = SDL_SetVideoMode(800, 600, 32,
SDL_FULLSCREEN|SDL_HWSURFACE|SDL_DOUBLEBUF|SDL_OPENGL)) == NULL) {
fprintf(stderr, “Couldn’t set video mode 800x600x32. %s\n”,
SDL_GetError());
exit(1);
}
printf(“Video mode set to 800x600x32.\n”);
printf("1\n");
SDL_Rect rect;
rect.x=0;
rect.y=24;
rect.w=22;
rect.h=24;
SDL_FillRect(screen, &rect, SDL_MapRGB(screen->format,255,0,0));
printf("2\n");
SDL_UpdateRect(screen, 0,24, 22, 24);
printf("\nsuccess!\n");
exit( 0 );
}=====
Dave Brondsema
dave at brondsema.net
http://www.brondsema.net
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/