Skip to content

Commit

Permalink
Support default imgui.ini
Browse files Browse the repository at this point in the history
  • Loading branch information
yknishidate committed Jul 14, 2024
1 parent 00d66e0 commit 863a45f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion include/reactive/App.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ struct AppCreateInfo {
ArrayProxy<Layer> layers;
ArrayProxy<Extension> extensions;

// UI
UIStyle style = UIStyle::Vulkan;
const char* imguiIniFile = nullptr;
};

class App {
Expand Down Expand Up @@ -97,7 +99,7 @@ class App {
ArrayProxy<Extension> requiredExtensions,
bool vsync);

void initImGui(UIStyle style);
void initImGui(UIStyle style, const char* imguiIniFile);

void listSurfaceFormats();

Expand Down
7 changes: 5 additions & 2 deletions src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 863a45f

Please sign in to comment.