1
0
mirror of synced 2024-11-19 05:17:12 +01:00
ImHex/include/window.hpp

52 lines
1.4 KiB
C++
Raw Normal View History

#pragma once
#include <concepts>
#include <memory>
#include <vector>
#include "views/view.hpp"
struct GLFWwindow;
struct ImGuiSettingsHandler;
namespace hex {
class Window {
public:
Window();
~Window();
void loop();
template<std::derived_from<View> T, typename ... Args>
2020-11-10 21:31:04 +01:00
T* addView(Args&& ... args) {
this->m_views.emplace_back(new T(std::forward<Args>(args)...));
return static_cast<T*>(this->m_views.back());
}
friend void *ImHexSettingsHandler_ReadOpenFn(ImGuiContext *ctx, ImGuiSettingsHandler *, const char *);
friend void ImHexSettingsHandler_ReadLine(ImGuiContext*, ImGuiSettingsHandler *handler, void *, const char* line);
friend void ImHexSettingsHandler_ApplyAll(ImGuiContext *ctx, ImGuiSettingsHandler *handler);
friend void ImHexSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler *handler, ImGuiTextBuffer *buf);
private:
void frameBegin();
void frameEnd();
void initGLFW();
void initImGui();
void deinitGLFW();
void deinitImGui();
GLFWwindow* m_window;
std::vector<View*> m_views;
float m_globalScale = 1.0f, m_fontScale = 1.0f;
2020-11-11 09:22:55 +01:00
bool m_fpsVisible = false;
bool m_demoWindowOpen = false;
2020-11-11 14:41:44 +01:00
static inline std::tuple<int, int> s_currShortcut = { -1, -1 };
};
}