comparison ppl.c @ 179:b29c9a2fbeb5

Add full screen switching to PPL via 'f' key, and various other improvements.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 06 Oct 2012 12:28:53 +0300
parents dfe7e392ea7e
children 9024d249e47a
comparison
equal deleted inserted replaced
178:63ff0fb944cd 179:b29c9a2fbeb5
40 *optFontFilename = "c64font.png"; 40 *optFontFilename = "c64font.png";
41 int optOutFormat = JSS_AUDIO_S16, 41 int optOutFormat = JSS_AUDIO_S16,
42 optOutChannels = 2, 42 optOutChannels = 2,
43 optOutFreq = 48000, 43 optOutFreq = 48000,
44 optMuteOChannels = -1, 44 optMuteOChannels = -1,
45 optStartOrder = -1; 45 optStartOrder = 0;
46 BOOL optUsePlayTime = FALSE; 46 BOOL optUsePlayTime = FALSE;
47 size_t optPlayTime; 47 size_t optPlayTime;
48 48
49 49
50 DMOptArg optList[] = 50 DMOptArg optList[] =
225 } 225 }
226 226
227 227
228 BOOL dmInitializeVideo() 228 BOOL dmInitializeVideo()
229 { 229 {
230 SDL_FreeSurface(engine.screen);
231
230 engine.screen = SDL_SetVideoMode( 232 engine.screen = SDL_SetVideoMode(
231 engine.optScrWidth, engine.optScrHeight, engine.optScrDepth, 233 engine.optScrWidth, engine.optScrHeight, engine.optScrDepth,
232 engine.optVFlags | SDL_RESIZABLE | SDL_SWSURFACE | SDL_HWPALETTE); 234 engine.optVFlags | SDL_RESIZABLE | SDL_SWSURFACE | SDL_HWPALETTE);
233 235
234 if (engine.screen == NULL) 236 if (engine.screen == NULL)
653 goto error_exit; 655 goto error_exit;
654 } 656 }
655 657
656 jvmSetCallback(engine.dev, jmpExec, engine.plr); 658 jvmSetCallback(engine.dev, jmpExec, engine.plr);
657 jmpSetModule(engine.plr, engine.mod); 659 jmpSetModule(engine.plr, engine.mod);
658 jmpPlayOrder(engine.plr, 0); 660 jmpPlayOrder(engine.plr, optStartOrder);
659 jvmSetGlobalVol(engine.dev, 100); 661 jvmSetGlobalVol(engine.dev, 100);
660 662
661 // Initialize video 663 // Initialize video
662 if (!dmInitializeVideo()) 664 if (!dmInitializeVideo())
663 goto error_exit; 665 goto error_exit;
726 JSS_UNLOCK(engine.plr); 728 JSS_UNLOCK(engine.plr);
727 JSS_UNLOCK(engine.dev); 729 JSS_UNLOCK(engine.dev);
728 force = TRUE; 730 force = TRUE;
729 break; 731 break;
730 732
733 case SDLK_f:
734 engine.optVFlags ^= SDL_FULLSCREEN;
735 if (!dmInitializeVideo())
736 goto error_exit;
737 break;
738
731 default: 739 default:
732 break; 740 break;
733 } 741 }
734 742
735 break; 743 break;
780 788
781 if (force) 789 if (force)
782 { 790 {
783 dmFillRect(engine.screen, 5, 5 + 12, engine.screen->w, 5 + 12 + 10, col.boxBg); 791 dmFillRect(engine.screen, 5, 5 + 12, engine.screen->w, 5 + 12 + 10, col.boxBg);
784 dmDrawBMTextQ(engine.screen, font, DMD_TRANSPARENT, 5, 5 + 12, 792 dmDrawBMTextQ(engine.screen, font, DMD_TRANSPARENT, 5, 5 + 12,
785 "Tempo: %3d | Speed: %3d | Row: %3d | Order: %3d/%3d | Pattern: %3d/%3d", 793 "Tempo: %3d | Speed: %3d | Row: %3d/%-3d | Order: %3d/%-3d | Pattern: %3d/%-3d",
786 engine.plr->tempo, engine.plr->speed, engine.plr->row, 794 engine.plr->tempo, engine.plr->speed,
795 engine.plr->row, engine.plr->pattern->nrows,
787 engine.plr->order, engine.mod->norders, 796 engine.plr->order, engine.mod->norders,
788 engine.plr->npattern, engine.mod->npatterns); 797 engine.plr->npattern, engine.mod->npatterns);
789 } 798 }
790 799
791 if (force || currTick - prevTick >= (engine.pauseFlag ? 100 : 20)) 800 if (force || currTick - prevTick >= (engine.pauseFlag ? 100 : 20))