1
0
Fork 0
mirror of https://github.com/k4zmu2a/SpaceCadetPinball.git synced 2025-09-07 16:50:15 +02:00

Added user settings persistence.

Using ImGui .ini writer.
This commit is contained in:
Muzychenko Andrey 2021-09-16 10:57:46 +03:00
parent af5a70785e
commit 8bae7a5b05
12 changed files with 158 additions and 227 deletions

View file

@ -5,7 +5,6 @@ struct optionsStruct
{
int Sounds;
int Music;
int Average;
int FullScreen;
int Players;
int LeftFlipperKey;
@ -28,26 +27,26 @@ struct optionsStruct
class options
{
public:
static optionsStruct Options;
static void init();
static void uninit();
static void path_init(LPCSTR regPath);
static void path_uninit();
static int get_int(LPCSTR optPath, LPCSTR lpValueName, int defaultValue);
static void set_int(LPCSTR optPath, LPCSTR lpValueName, int data);
static void get_string(LPCSTR optPath, LPCSTR lpValueName, LPSTR dst, LPCSTR defaultValue, int iMaxLength);
static void set_string(LPCSTR optPath, LPCSTR lpValueName, LPCSTR value);
static int get_int(LPCSTR lpValueName, int defaultValue);
static void set_int(LPCSTR lpValueName, int data);
static std::string get_string(LPCSTR lpValueName, LPCSTR defaultValue);
static void set_string(LPCSTR lpValueName, LPCSTR value);
static void toggle(uint32_t uIDCheckItem);
static void update_resolution_menu();
static void init_resolution();
static void keyboard();
static optionsStruct Options;
private:
static LPCSTR OptionsRegPath;
static LPSTR OptionsRegPathCur;
static LPCSTR path(LPCSTR regPath);
static void path_free();
static winhelp_entry keymap_help[18];
static short vk_list[28];
static std::map<std::string, std::string> settings;
static void MyUserData_ReadLine(ImGuiContext* ctx, ImGuiSettingsHandler* handler, void* entry, const char* line);
static void* MyUserData_ReadOpen(ImGuiContext* ctx, ImGuiSettingsHandler* handler, const char* name);
static void MyUserData_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf);
static const std::string& GetSetting(const std::string& key, const std::string& value);
static void SetSetting(const std::string& key, const std::string& value);
};