mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-01 02:41:48 +00:00
[wpigui] Add support for imgui config flags
This commit is contained in:
@@ -115,7 +115,8 @@ void gui::DestroyContext() {
|
||||
gContext = nullptr;
|
||||
}
|
||||
|
||||
bool gui::Initialize(const char* title, int width, int height) {
|
||||
bool gui::Initialize(const char* title, int width, int height,
|
||||
ImGuiConfigFlags configFlags) {
|
||||
gContext->title = title;
|
||||
gContext->width = width;
|
||||
gContext->height = height;
|
||||
@@ -138,6 +139,7 @@ bool gui::Initialize(const char* title, int width, int height) {
|
||||
ImGui::CreateContext();
|
||||
ImPlot::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.ConfigFlags |= configFlags;
|
||||
|
||||
// Hook ini handler to save settings
|
||||
ImGuiSettingsHandler iniHandler;
|
||||
@@ -297,9 +299,10 @@ void gui::Main() {
|
||||
PlatformRenderFrame();
|
||||
gContext->isPlatformRendering = false;
|
||||
|
||||
auto& io = ImGui::GetIO();
|
||||
|
||||
// custom saving
|
||||
if (gContext->saveSettings) {
|
||||
auto& io = ImGui::GetIO();
|
||||
if (io.WantSaveIniSettings) {
|
||||
gContext->saveSettings(false);
|
||||
io.WantSaveIniSettings = false; // reset flag
|
||||
|
||||
@@ -30,8 +30,10 @@ void DestroyContext();
|
||||
* @param title main application window title
|
||||
* @param width main application window width
|
||||
* @param height main application window height
|
||||
* @param configFlags ImGui configuration flags
|
||||
*/
|
||||
bool Initialize(const char* title, int width, int height);
|
||||
bool Initialize(const char* title, int width, int height,
|
||||
ImGuiConfigFlags configFlags = ImGuiConfigFlags_None);
|
||||
|
||||
/**
|
||||
* Runs main GUI loop. On some OS'es this must be called from the main thread.
|
||||
|
||||
Reference in New Issue
Block a user