From 863a45f071bccb15af5933e4cffb1994067be302 Mon Sep 17 00:00:00 2001 From: Yuki Nishidate Date: Sun, 14 Jul 2024 18:12:35 +0900 Subject: [PATCH] Support default imgui.ini --- include/reactive/App.hpp | 4 +++- src/App.cpp | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/reactive/App.hpp b/include/reactive/App.hpp index bd222fd..6c85759 100644 --- a/include/reactive/App.hpp +++ b/include/reactive/App.hpp @@ -62,7 +62,9 @@ struct AppCreateInfo { ArrayProxy layers; ArrayProxy extensions; + // UI UIStyle style = UIStyle::Vulkan; + const char* imguiIniFile = nullptr; }; class App { @@ -97,7 +99,7 @@ class App { ArrayProxy requiredExtensions, bool vsync); - void initImGui(UIStyle style); + void initImGui(UIStyle style, const char* imguiIniFile); void listSurfaceFormats(); diff --git a/src/App.cpp b/src/App.cpp index 1076644..d89b798 100644 --- a/src/App.cpp +++ b/src/App.cpp @@ -19,7 +19,7 @@ App::App(const AppCreateInfo& createInfo) { Window::init(createInfo.width, createInfo.height, createInfo.title, createInfo.windowResizable); Window::setAppPointer(this); initVulkan(createInfo.layers, createInfo.extensions, createInfo.vsync); - initImGui(createInfo.style); + initImGui(createInfo.style, createInfo.imguiIniFile); } void App::run() { @@ -306,12 +306,15 @@ void setImGuiStyle(UIStyle style) { // clang-format on } -void App::initImGui(UIStyle style) { +void App::initImGui(UIStyle style, const char* imguiIniFile) { // Setup Dear ImGui context IMGUI_CHECKVERSION(); ImGui::CreateContext(); ImGuiIO& io = ImGui::GetIO(); io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; + if (imguiIniFile) { + io.IniFilename = imguiIniFile; + } setImGuiStyle(style); // Setup Platform/Renderer backends