Browse Source

Settings: Initializing ImGuiSettingsWindow so external users don't end up with uncleared data. Exposed MarkIniSettingsDirty() in imgui_internal.h

pull/1414/merge
omar 7 years ago
parent
commit
f3ec608c19
  1. 7
      imgui.cpp
  2. 4
      imgui_internal.h

7
imgui.cpp

@ -2725,6 +2725,13 @@ static void SaveIniSettingsToMemory(ImVector<char>& out_buf)
out_buf.swap(buf.Buf); out_buf.swap(buf.Buf);
} }
void ImGui::MarkIniSettingsDirty()
{
ImGuiContext& g = *GImGui;
if (g.SettingsDirtyTimer <= 0.0f)
g.SettingsDirtyTimer = g.IO.IniSavingRate;
}
static void MarkIniSettingsDirty(ImGuiWindow* window) static void MarkIniSettingsDirty(ImGuiWindow* window)
{ {
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;

4
imgui_internal.h

@ -378,6 +378,8 @@ struct ImGuiSettingsWindow
ImVec2 Pos; ImVec2 Pos;
ImVec2 Size; ImVec2 Size;
bool Collapsed; bool Collapsed;
ImGuiSettingsWindow() { Name = NULL; Id = 0; Pos = Size = ImVec2(0,0); Collapsed = false; }
}; };
struct ImGuiSettingsHandler struct ImGuiSettingsHandler
@ -801,6 +803,8 @@ namespace ImGui
IMGUI_API void Initialize(); IMGUI_API void Initialize();
IMGUI_API void MarkIniSettingsDirty();
IMGUI_API void SetActiveID(ImGuiID id, ImGuiWindow* window); IMGUI_API void SetActiveID(ImGuiID id, ImGuiWindow* window);
IMGUI_API void ClearActiveID(); IMGUI_API void ClearActiveID();
IMGUI_API void SetHoveredID(ImGuiID id); IMGUI_API void SetHoveredID(ImGuiID id);

Loading…
Cancel
Save