test/threadwin.c
changeset 5123 dc0dfdd58f27
parent 4429 faa9fc8e7f67
child 5535 96594ac5fd1a
equal deleted inserted replaced
5122:0ec550f04bbc 5123:dc0dfdd58f27
   239     init_flags = SDL_INIT_VIDEO;
   239     init_flags = SDL_INIT_VIDEO;
   240     video_bpp = 8;
   240     video_bpp = 8;
   241     video_flags = SDL_SWSURFACE;
   241     video_flags = SDL_SWSURFACE;
   242     parsed = 1;
   242     parsed = 1;
   243     while (parsed) {
   243     while (parsed) {
   244         /* If the threaded option is enabled, and the SDL library hasn't
   244         if ((argc >= 2) && (strcmp(argv[1], "-fullscreen") == 0)) {
   245            been compiled with threaded events enabled, then the mouse and
       
   246            keyboard won't respond.
       
   247          */
       
   248         if ((argc >= 2) && (strcmp(argv[1], "-threaded") == 0)) {
       
   249             init_flags |= SDL_INIT_EVENTTHREAD;
       
   250             argc -= 1;
       
   251             argv += 1;
       
   252             printf("Running with threaded events\n");
       
   253         } else if ((argc >= 2) && (strcmp(argv[1], "-fullscreen") == 0)) {
       
   254             video_flags |= SDL_FULLSCREEN;
   245             video_flags |= SDL_FULLSCREEN;
   255             argc -= 1;
   246             argc -= 1;
   256             argv += 1;
   247             argv += 1;
   257         } else if ((argc >= 3) && (strcmp(argv[1], "-bpp") == 0)) {
   248         } else if ((argc >= 3) && (strcmp(argv[1], "-bpp") == 0)) {
   258             video_bpp = atoi(argv[2]);
   249             video_bpp = atoi(argv[2]);
   318     SDL_UnlockSurface(screen);
   309     SDL_UnlockSurface(screen);
   319     SDL_UpdateRect(screen, 0, 0, 0, 0);
   310     SDL_UpdateRect(screen, 0, 0, 0, 0);
   320 
   311 
   321     /* Loop, waiting for QUIT */
   312     /* Loop, waiting for QUIT */
   322     while (!done) {
   313     while (!done) {
   323         if (!(init_flags & SDL_INIT_EVENTTHREAD)) {
   314         SDL_PumpEvents();
   324             SDL_PumpEvents();   /* Needed when event thread is off */
   315 
   325         }
       
   326         if (SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, SDL_QUIT, SDL_QUIT)) {
   316         if (SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, SDL_QUIT, SDL_QUIT)) {
   327             done = 1;
   317             done = 1;
   328         }
   318         }
   329         /* Give up some CPU so the events can accumulate */
   319         /* Give up some CPU so the events can accumulate */
   330         SDL_Delay(20);
   320         SDL_Delay(20);