1 #pragma once
2 
3 #include <filesystem>
4 #include <memory>
5 #include <string>
6 #include <vector>
7 
8 #include <hex/helpers/utils.hpp>
9 #include <hex/views/view.hpp>
10 
11 struct GLFWwindow;
12 struct ImGuiSettingsHandler;
13 
14 namespace hex {
15 
16     class Window {
17     public:
18         Window(int &argc, char **&argv);
19         ~Window();
20 
21         void loop();
22 
23         friend void *ImHexSettingsHandler_ReadOpenFn(ImGuiContext *ctx, ImGuiSettingsHandler *, const char *);
24         friend void ImHexSettingsHandler_ReadLine(ImGuiContext*, ImGuiSettingsHandler *handler, void *, const char* line);
25         friend void ImHexSettingsHandler_ApplyAll(ImGuiContext *ctx, ImGuiSettingsHandler *handler);
26         friend void ImHexSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler *handler, ImGuiTextBuffer *buf);
27 
28         bool setFont(const std::filesystem::path &font_path);
29 
30         void initPlugins();
31         void deinitPlugins();
32     private:
33         void frameBegin();
34         void frameEnd();
35 
36         void drawWelcomeScreen();
37 
38         void initGLFW();
39         void initImGui();
40         void deinitGLFW();
41         void deinitImGui();
42 
43         GLFWwindow* m_window = nullptr;
44 
45         float m_globalScale = 1.0f, m_fontScale = 1.0f;
46         bool m_fpsVisible = false;
47         bool m_demoWindowOpen = false;
48 
49         static inline std::tuple<int, int> s_currShortcut = { -1, -1 };
50 
51         std::list<std::string> m_recentFiles;
52     };
53 
54 }