[wpigui] Add platform-specific preferences save

This commit is contained in:
Prateek Machiraju
2020-12-05 21:04:02 -05:00
committed by Peter Johnson
parent 751dea32ae
commit 2c5668af46
4 changed files with 34 additions and 1 deletions

View File

@@ -8,6 +8,7 @@
#pragma once
#include <functional>
#include <string>
#include <imgui.h>
@@ -123,6 +124,15 @@ void SetStyle(Style style);
*/
void SetClearColor(ImVec4 color);
/**
* Configures a save file (.ini) in a platform specific location. On Windows,
* the .ini is saved in %APPDATA%; on macOS the .ini is saved in
* ~/Library/Preferences; on Linux the .ini is stored in $XDG_CONFIG_HOME or
* ~/.config if the former is not defined. This must be called before
* gui::Initialize().
*/
void ConfigurePlatformSaveFile(const std::string& name);
/**
* Emits a View menu (e.g. for a main menu bar) that allows setting of
* style and zoom. Internally starts with ImGui::BeginMenu("View").

View File

@@ -56,6 +56,8 @@ struct Context : public SavedSettings {
int fontScale = 2; // updated by main loop
std::vector<Font> fonts;
std::string iniPath = "imgui.ini";
};
extern Context* gContext;