git repos / saland

commit 70ff0e3b

Poul Sander · 2024-10-19 20:34
70ff0e3b5279089938c496a55b0eb6d7eb0bf43e patch · browse files
parent 172ff70c285dd7831a71f5342246cf97cea3392b

Store imgui placements

Changed files

M src/saland.cpp before
diff --git a/src/saland.cpp b/src/saland.cpp index 8e573a6..354879e 100644 --- a/src/saland.cpp +++ b/src/saland.cpp
@@ -219,8 +219,6 @@ void RunGameState(sago::GameStateInterface& state ) {
ImGui::NewFrame();
state.Draw(globalData.screen);
ImGui::Render();
- ImGuiIO& io = ImGui::GetIO();
- io.IniFilename = NULL;
ImGui_ImplSDLRenderer2_RenderDrawData( ImGui::GetDrawData(), globalData.screen );
//While using Dear ImGui we do not draw the mouse ourself. This is gone: globalData.mouse.Draw(globalData.screen, SDL_GetTicks(), globalData.mousex, globalData.mousey);
@@ -434,6 +432,11 @@ void runGame() {
//SDL_RenderSetLogicalSize(globalData.screen, globalData.xsize, globalData.ysize);
InitImGui(win, globalData.screen, globalData.xsize, globalData.ysize);
+ ImGuiIO& io = ImGui::GetIO();
+ io.IniFilename = nullptr;
+ std::string imgui_inifile = getPathToSaveFiles() + "/imgui.ini";
+ ImGui::LoadIniSettingsFromDisk(imgui_inifile.c_str());
+
globalData.ysize = globalData.ysize;
sago::SagoDataHolder holder(globalData.screen);
@@ -466,6 +469,8 @@ void runGame() {
RunGameState(m);
}
+ ImGui::SaveIniSettingsToDisk(imgui_inifile.c_str());
+
SDL_DestroyRenderer(globalData.screen);
SDL_DestroyWindow(win);