rnd-20140108-1-src
[rocksndiamonds.git] / src / screens.c
index fe3b75ea65a03251a9f55a5d2537211242667356..1a37d1882977e562bf661b8e2600f97b5bd79a2a 100644 (file)
@@ -38,6 +38,8 @@
 #define MAX_INFO_MODES                 8
 
 /* screens on the setup screen */
+/* (must match GFX_SPECIAL_ARG_SETUP_* values as defined in src/main.h) */
+/* (should also match corresponding entries in src/conf_gfx.c) */
 #define SETUP_MODE_MAIN                        0
 #define SETUP_MODE_GAME                        1
 #define SETUP_MODE_EDITOR              2
@@ -4161,8 +4163,8 @@ static void execSetupEditor()
 
 static void execSetupGraphics()
 {
-
-  if (video.fullscreen_available && screen_modes == NULL)
+  // if (screen_modes == NULL && video.fullscreen_available)
+  if (screen_modes == NULL && video.fullscreen_modes != NULL)
   {
     int i;
 
@@ -4210,7 +4212,8 @@ static void execSetupGraphics()
       video.fullscreen_available = FALSE;
   }
 
-  if (video.fullscreen_available)
+  // if (video.fullscreen_available)
+  if (screen_mode_current != NULL)
   {
     setup.fullscreen_mode = screen_mode_current->identifier;
 
@@ -4321,6 +4324,7 @@ static void execSetupGraphics()
   DrawSetupScreen();
 }
 
+#if !defined(PLATFORM_ANDROID)
 #if defined(TARGET_SDL2)
 static void execSetupChooseWindowSize()
 {
@@ -4344,6 +4348,7 @@ static void execSetupChooseScreenMode()
   DrawSetupScreen();
 }
 #endif
+#endif
 
 static void execSetupChooseScrollDelay()
 {
@@ -4693,6 +4698,7 @@ static struct TokenInfo setup_info_editor[] =
 
 static struct TokenInfo setup_info_graphics[] =
 {
+#if !defined(PLATFORM_ANDROID)
   { TYPE_SWITCH,       &setup.fullscreen,      "Fullscreen:"           },
 #if defined(TARGET_SDL2)
   { TYPE_ENTER_LIST,   execSetupChooseWindowSize, "Window Scaling:"    },
@@ -4701,6 +4707,7 @@ static struct TokenInfo setup_info_graphics[] =
   { TYPE_ENTER_LIST,   execSetupChooseScreenMode, "Fullscreen Mode:"   },
   { TYPE_STRING,       &screen_mode_text,      ""                      },
 #endif
+#endif
 #if 0
   { TYPE_SWITCH,       &setup.scroll_delay,    "Scroll Delay:"         },
 #endif
@@ -6083,8 +6090,39 @@ void DrawSetupScreen()
 
 void RedrawSetupScreenAfterFullscreenToggle()
 {
+#if 0
+  if (setup_mode == SETUP_MODE_GRAPHICS ||
+      setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE)
+  {
+    if (window_sizes != NULL)
+    {
+      /* set current window size value to configured window size value */
+      window_size_current =
+       getTreeInfoFromIdentifier(window_sizes,
+                                 i_to_a(setup.window_scaling_percent));
+
+      /* if that fails, set current window size to reliable default value */
+      if (window_size_current == NULL)
+       window_size_current =
+         getTreeInfoFromIdentifier(window_sizes,
+                                   i_to_a(STD_WINDOW_SCALING_PERCENT));
+
+      /* if that also fails, set current window size to first available value */
+      if (window_size_current == NULL)
+       window_size_current = window_sizes;
+    }
+
+    setup.window_scaling_percent = atoi(window_size_current->identifier);
+
+    /* needed for displaying window size text instead of identifier */
+    window_size_text = window_size_current->name;
+
+    DrawSetupScreen();
+  }
+#else
   if (setup_mode == SETUP_MODE_GRAPHICS)
     DrawSetupScreen();
+#endif
 }
 
 void HandleSetupScreen(int mx, int my, int dx, int dy, int button)