From: Holger Schemel Date: Sat, 5 Aug 2006 00:17:06 +0000 (+0200) Subject: rnd-20060805-2-src X-Git-Tag: 3.2.1^2~22 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=b31ff3c0c04be6739743c4e79c95f7c233f998bc;p=rocksndiamonds.git rnd-20060805-2-src * added key shortcut "Alt + Enter" to toggle fullscreen mode at any time --- diff --git a/ChangeLog b/ChangeLog index 2911205b..daab85cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ confused with the "Insert" key for jumping to the last editor cascade block in the element list) * added Rocks'n'Diamonds icon for use as window icon to SDL version + * added key shortcut "Alt + Enter" to toggle fullscreen mode at any time 2006-08-01 * added selection of preferred fullscreen mode to setup / graphics menu diff --git a/src/conftime.h b/src/conftime.h index c6479221..7f64cebd 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-08-05 00:42]" +#define COMPILE_DATE_STRING "[2006-08-05 02:13]" diff --git a/src/events.c b/src/events.c index 6b501408..4bb6192d 100644 --- a/src/events.c +++ b/src/events.c @@ -687,6 +687,16 @@ void HandleKey(Key key, int key_status) if (key_status == KEY_RELEASED) return; + if (key == KSYM_Return && GetKeyModState() & KMOD_Alt && + video.fullscreen_available) + { + setup.fullscreen = !setup.fullscreen; + + ToggleFullscreenIfNeeded(); + + return; + } + if (game_status == GAME_MODE_PLAYING && AllPlayersGone && (key == KSYM_Return || key == setup.shortcut.toggle_pause)) { diff --git a/src/screens.c b/src/screens.c index adcb8b8e..cc395c8f 100644 --- a/src/screens.c +++ b/src/screens.c @@ -229,38 +229,6 @@ void DrawHeadline() DrawTextSCentered(MENU_TITLE2_YPOS, FONT_TITLE_2, PROGRAM_COPYRIGHT_STRING); } -static void ToggleFullscreenIfNeeded() -{ - if (setup.fullscreen != video.fullscreen_enabled || - setup.fullscreen_mode != video.fullscreen_mode_current) - { - /* save old door content */ - BlitBitmap(backbuffer, bitmap_db_door, - DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1); - - if (setup.fullscreen && video.fullscreen_enabled) - { - /* keep fullscreen mode, but change screen mode */ - video.fullscreen_mode_current = setup.fullscreen_mode; - video.fullscreen_enabled = FALSE; - } - - /* toggle fullscreen */ - ChangeVideoModeIfNeeded(setup.fullscreen); - setup.fullscreen = video.fullscreen_enabled; - - /* redraw background to newly created backbuffer */ - BlitBitmap(graphic_info[IMG_GLOBAL_BORDER].bitmap, backbuffer, - 0,0, WIN_XSIZE,WIN_YSIZE, 0,0); - - /* restore old door content */ - BlitBitmap(bitmap_db_door, backbuffer, - DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY); - - redraw_mask = REDRAW_ALL; - } -} - static int getLastLevelButtonPos() { return 10; diff --git a/src/tools.c b/src/tools.c index 5313f930..f7a3011e 100644 --- a/src/tools.c +++ b/src/tools.c @@ -6037,3 +6037,33 @@ void PlayMenuMusic() PlayMusic(music); } + +void ToggleFullscreenIfNeeded() +{ + if (setup.fullscreen != video.fullscreen_enabled || + setup.fullscreen_mode != video.fullscreen_mode_current) + { + Bitmap *tmp_backbuffer = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH); + + /* save backbuffer content which gets lost when toggling fullscreen mode */ + BlitBitmap(backbuffer, tmp_backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0); + + if (setup.fullscreen && video.fullscreen_enabled) + { + /* keep fullscreen mode, but change screen mode */ + video.fullscreen_mode_current = setup.fullscreen_mode; + video.fullscreen_enabled = FALSE; + } + + /* toggle fullscreen */ + ChangeVideoModeIfNeeded(setup.fullscreen); + setup.fullscreen = video.fullscreen_enabled; + + /* restore backbuffer content from temporary backbuffer backup bitmap */ + BlitBitmap(tmp_backbuffer, backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0); + + FreeBitmap(tmp_backbuffer); + + redraw_mask = REDRAW_ALL; + } +} diff --git a/src/tools.h b/src/tools.h index f77a594a..a06527ae 100644 --- a/src/tools.h +++ b/src/tools.h @@ -170,4 +170,6 @@ void PlayMenuSoundStereo(int, int); void PlayMenuSoundIfLoop(); void PlayMenuMusic(); +void ToggleFullscreenIfNeeded(); + #endif /* TOOLS_H */