[wpigui] Add option to reset UI on exit (#3463)

Also add wpiutil as a dependency for wpigui.
This commit is contained in:
Prateek Machiraju
2021-06-27 01:48:54 -04:00
committed by GitHub
parent a371235b0d
commit d29acc90a2
5 changed files with 13 additions and 1 deletions

View File

@@ -15,6 +15,7 @@
#include <imgui_internal.h>
#include <implot.h>
#include <stb_image.h>
#include <wpi/fs.h>
#include "wpigui_internal.h"
@@ -290,6 +291,11 @@ void gui::Main() {
ImPlot::DestroyContext();
ImGui::DestroyContext();
// Delete the save file if requested.
if (gContext->resetOnExit) {
fs::remove(fs::path{gContext->iniPath});
}
glfwDestroyWindow(gContext->window);
glfwTerminate();
}
@@ -466,6 +472,8 @@ void gui::EmitViewMenu() {
}
ImGui::EndMenu();
}
ImGui::MenuItem("Reset UI on Exit?", nullptr, &gContext->resetOnExit);
ImGui::EndMenu();
}
}