From 822e75ec45821d848b53d74571be9fa994bd99f1 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sun, 12 Jan 2020 01:37:53 -0800 Subject: [PATCH] Simulator GUI: Handle save file having window size=0 (#2260) This should never happen, but if it does, it's not recoverable without either deleting imgui.ini or editing it manually. --- simulation/halsim_gui/src/main/native/cpp/HALSimGui.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/simulation/halsim_gui/src/main/native/cpp/HALSimGui.cpp b/simulation/halsim_gui/src/main/native/cpp/HALSimGui.cpp index 79df3dfb05..e630e00362 100644 --- a/simulation/halsim_gui/src/main/native/cpp/HALSimGui.cpp +++ b/simulation/halsim_gui/src/main/native/cpp/HALSimGui.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2019 FIRST. All Rights Reserved. */ +/* Copyright (c) 2019-2020 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ @@ -301,6 +301,12 @@ bool HALSimGui::Initialize() { // Set initial window settings glfwWindowHint(GLFW_MAXIMIZED, gWindowMaximized ? GLFW_TRUE : GLFW_FALSE); + if (gWindowWidth == 0 || gWindowHeight == 0) { + gWindowWidth = 1280; + gWindowHeight = 720; + gWindowLoadedWidthHeight = false; + } + float windowScale = 1.0; if (!gWindowLoadedWidthHeight) { glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);