|
From: Alexandre F. <ale...@us...> - 2005-10-08 02:08:23
|
Update of /cvsroot/twin-e/twin-e/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30838/src Modified Files: input.c mainSDL.c osystem.h Log Message: Add toggle FullScreen with F12 key. Index: input.c =================================================================== RCS file: /cvsroot/twin-e/twin-e/src/input.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** input.c 28 Jun 2005 21:55:47 -0000 1.13 --- input.c 8 Oct 2005 02:08:15 -0000 1.14 *************** *** 18,22 **** #include "lba.h" ! #include <SDL/SDL.h> void readKeyboard(void) --- 18,22 ---- #include "lba.h" ! #include "SDL/SDL.h" void readKeyboard(void) *************** *** 197,201 **** case SDLK_F12: { ! fkeys = 12; // F12 break; } --- 197,202 ---- case SDLK_F12: { ! // fkeys = 12; // F12 ! osystem_fullScreen(); break; } Index: mainSDL.c =================================================================== RCS file: /cvsroot/twin-e/twin-e/src/mainSDL.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** mainSDL.c 28 Jun 2005 21:55:48 -0000 1.36 --- mainSDL.c 8 Oct 2005 02:08:15 -0000 1.37 *************** *** 566,569 **** --- 566,615 ---- } + void osystem_FlaPCXCrossFade(SDL_Surface *image) + { + int i; + SDL_Surface *backupSurface; + SDL_Surface *newSurface; + SDL_Surface *tempSurface; + Uint32 rmask, gmask, bmask, amask; + + #if SDL_BYTEORDER == SDL_BIG_ENDIAN + rmask = 0xff000000; + gmask = 0x00ff0000; + bmask = 0x0000ff00; + amask = 0x000000ff; + #else + rmask = 0x000000ff; + gmask = 0x0000ff00; + bmask = 0x00ff0000; + amask = 0xff000000; + #endif + + backupSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, 640, 480, 32, rmask, gmask, bmask, 0); + newSurface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCALPHA, 640, 480, 32, rmask, gmask, bmask, 0); + + SDL_SetColors(sdl_screen, image->format->palette->colors, 0, 256); + + SDL_BlitSurface(sdl_screen, NULL, backupSurface, NULL); + SDL_BlitSurface(tempSurface, NULL, newSurface, NULL); + + for (i = 0; i < 8; i++) + { + SDL_BlitSurface(backupSurface, NULL, surfaceTable[i], NULL); + SDL_SetAlpha(newSurface,SDL_SRCALPHA | SDL_RLEACCEL, i * 32); + SDL_BlitSurface(newSurface, NULL, surfaceTable[i], NULL); + SDL_BlitSurface(surfaceTable[i], NULL, sdl_screen, NULL); + SDL_UpdateRect(sdl_screen, 0, 0, 0, 0); + SDL_Delay(20); + } + + SDL_BlitSurface(newSurface, NULL, sdl_screen, NULL); + SDL_UpdateRect(sdl_screen, 0, 0, 0, 0); + + SDL_FreeSurface(backupSurface); + SDL_FreeSurface(newSurface); + SDL_FreeSurface(tempSurface); + } + void osystem_set320x200Mode( boolean mode ) { *************** *** 598,602 **** --- 644,669 ---- } + void osystem_fullScreen() + { + SDL_FreeSurface(sdl_screen); + sdl_screen = 0; + + fullscreen = 1 - fullscreen; + + if (fullscreen == 0) + { + sdl_screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE); + SDL_SetColors(sdl_screen, palette, 0, 256); + SDL_ShowCursor(1); + } + else + { + sdl_screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE|SDL_FULLSCREEN); + SDL_SetColors(sdl_screen, palette, 0, 256); + SDL_ShowCursor(0); + } + requestBackgroundRedraw = 1; + } #endif Index: osystem.h =================================================================== RCS file: /cvsroot/twin-e/twin-e/src/osystem.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** osystem.h 18 Nov 2004 23:06:04 -0000 1.17 --- osystem.h 8 Oct 2005 02:08:15 -0000 1.18 *************** *** 17,20 **** --- 17,22 ---- */ + #include "SDL.h" + /* class OSystem *************** *** 29,32 **** --- 31,35 ---- void osystem_delay(int time); void osystem_crossFade(char *buffer, char *palette); + void osystem_FlaPCXCrossFade(SDL_Surface *image); void osystem_fadeBlackToWhite(); void osystem_updateImage(); *************** *** 49,52 **** --- 52,57 ---- void osystem_set320x200Mode(boolean mode); + void osystem_fullScreen(); + ////////////////// |