Skip to content

Commit

Permalink
Simulator GUI: Handle save file having window size=0
Browse files Browse the repository at this point in the history
This should never happen, but if it does, it's not recoverable without
either deleting imgui.ini or editing it manually.
  • Loading branch information
PeterJohnson committed Jan 12, 2020
1 parent 108ddfa commit df00da1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion simulation/halsim_gui/src/main/native/cpp/HALSimGui.cpp
Original file line number Diff line number Diff line change
@@ -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. */
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit df00da1

Please sign in to comment.