rnd-20060805-2-src
authorHolger Schemel <info@artsoft.org>
Sat, 5 Aug 2006 00:17:06 +0000 (02:17 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:52:38 +0000 (10:52 +0200)
* added key shortcut "Alt + Enter" to toggle fullscreen mode at any time

ChangeLog
src/conftime.h
src/events.c
src/screens.c
src/tools.c
src/tools.h

index 2911205b673eba2eb455ab1f74dadcf8a50dcdeb..daab85ccb0b20735b914f03e3fb4ee702612ef84 100644 (file)
--- 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
index c6479221693a4dae211167bc5d9cc5bec4586362..7f64cebd2a51d4baf0ef4f81d36fb44346fec79d 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2006-08-05 00:42]"
+#define COMPILE_DATE_STRING "[2006-08-05 02:13]"
index 6b501408b892bec896f7de108d3e11d9a8805d2e..4bb6192d9d023b1c502628a65d08ab6348b0f76c 100644 (file)
@@ -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))
   {
index adcb8b8e4d300ae9a916888e66ca9148cc813214..cc395c8fdfff1334e95d91e8d1579e5561e05a70 100644 (file)
@@ -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;
index 5313f9307671d36c7b05a87a29cf0def29bc0c9d..f7a3011e0e1b4a71882de655a283fa444bf46e41 100644 (file)
@@ -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;
+  }
+}
index f77a594acf99ef1da2b5670b47e8a1ca022a696c..a06527ae27e864b0b1fba9d9818f553e6ff58e39 100644 (file)
@@ -170,4 +170,6 @@ void PlayMenuSoundStereo(int, int);
 void PlayMenuSoundIfLoop();
 void PlayMenuMusic();
 
+void ToggleFullscreenIfNeeded();
+
 #endif /* TOOLS_H */