Write ImGui config to an appropriate folder instead of the current one.

This commit is contained in:
2025-03-02 18:41:27 +01:00
parent f51dd5b437
commit 7a18cce60c
3 changed files with 99 additions and 1 deletions

View File

@@ -7,6 +7,7 @@
#include <cstdint>
#include <functional>
#include <fmt/format.h>
#include <mijin/virtual_filesystem/stacked.hpp>
#include <SDL3/SDL.h>
namespace raid
@@ -33,6 +34,8 @@ private:
SDL_Window* mWindow = nullptr;
SDL_GLContext mGLContext = nullptr;
mijin::StackedFileSystemAdapter mFS;
using glClear_fn_t = void (*)(std::uint32_t);
using glClearColor_fn_t = void (*)(float, float, float, float);
@@ -46,6 +49,7 @@ public:
protected:
virtual void render() = 0;
virtual std::string getFolderName() = 0;
virtual void handleMessage(const Message& message);
virtual void handleSDLEvent(const SDL_Event& event);
@@ -106,6 +110,8 @@ private:
bool initImGui();
void cleanup();
void handleSDLEvents();
void loadImGuiConfig();
void saveImGuiConfig();
};
using render_cb_t = std::function<void()>;
@@ -115,6 +121,7 @@ struct QuickAppOptions
{
render_cb_t render;
} callbacks;
std::string folderName = "raid";
};
class QuickApp : public Application
@@ -124,6 +131,7 @@ private:
public:
void init(QuickAppOptions options);
void render() override;
std::string getFolderName() override;
};
[[nodiscard]]