Show legacy render area when changing window size. (OpenGL mode)
[mercenary-reloaded.git] / src / mercenary / main.c
index 5d61b5c..1fa655a 100644 (file)
@@ -112,7 +112,7 @@ static uint8_t *help_osd[3] = { NULL, NULL, NULL };
 static uint8_t *info_osd = NULL;
 static int help_view = 1;
 static int help_views = 0;
-static int32_t osd_timer = 0;
+static int32_t osd_timer = 0, border_timer = 0;
 #ifdef HAVE_OVR
 #define SCREEN_WIDTH   1344
 #define SCREEN_HEIGHT  800
@@ -375,6 +375,8 @@ static void resize_window(int width, int height)
 {
        window_width = width;
        window_height = height;
+       border_timer = ticks_sdl() + 1500;
+       osd_info("", "window resized");
 }
 
 #ifdef HAVE_OVR
@@ -801,6 +803,18 @@ static void main_loop(void)
                                        if (osd_timer - (int32_t)ticks_sdl() < 0)
                                                osd_timer = 0;
                                }
+#ifndef HAVE_OVR
+                               /* draw border around legacy render area */
+                               if (border_timer) {
+                                       opengl_render_color(1.0, 0.0, 0.0, 1.0);
+                                       opengl_render_line(160, -68, 256, 160, 68, 256, 0.0);
+                                       opengl_render_line(-160, -68, 256, -160, 68, 256, 0.0);
+                                       opengl_render_line(-160, 68, 256, 160, 68, 256, 0.0);
+                                       opengl_render_line(-160, -68, 256, 160, -68, 256, 0.0);
+                                       if (border_timer - (int32_t)ticks_sdl() < 0)
+                                               border_timer = 0;
+                               }
+#endif
                        }
                        /* setup viewport for legacy image and render image, if enabled */
                        /* also render legacy, if render_improved failed due to not (yet) available items */
@@ -1106,6 +1120,7 @@ static void keyboard_sdl(int down, enum keycode keycode)
                                config_fov = FOV_JOLLY;
                        }
                        osd_info("Benson size", (config_benson_size == 0.5) ? "half" : "normal");
+                       border_timer = ticks_sdl() + 1500;
                        break;
                case KEYCODE_i:
                        if (!intro_skipped)
@@ -1160,6 +1175,7 @@ static void keyboard_sdl(int down, enum keycode keycode)
                                else
                                        sprintf(text, "%.2f (default)", config_fov);
                                osd_info("FOV", text);
+                               border_timer = ticks_sdl() + 1500;
                        }
 #endif
                        break;