2020-11-10 15:26:38 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <concepts>
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "views/view.hpp"
|
|
|
|
|
|
|
|
struct GLFWwindow;
|
|
|
|
|
|
|
|
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)...));
|
2020-11-10 15:26:38 +01:00
|
|
|
|
|
|
|
return static_cast<T*>(this->m_views.back());
|
|
|
|
}
|
|
|
|
|
2020-11-15 15:49:21 +01:00
|
|
|
public:
|
|
|
|
float m_globalScale = 1.0f, m_fontScale = 1.0f;
|
|
|
|
|
2020-11-10 15:26:38 +01:00
|
|
|
private:
|
|
|
|
void frameBegin();
|
|
|
|
void frameEnd();
|
|
|
|
|
|
|
|
void initGLFW();
|
|
|
|
void initImGui();
|
|
|
|
void deinitGLFW();
|
|
|
|
void deinitImGui();
|
|
|
|
|
|
|
|
GLFWwindow* m_window;
|
|
|
|
std::vector<View*> m_views;
|
2020-11-11 09:22:55 +01:00
|
|
|
bool m_fpsVisible = false;
|
2020-11-23 22:23:06 +01:00
|
|
|
bool m_demoWindowOpen = false;
|
2020-11-11 14:41:44 +01:00
|
|
|
|
|
|
|
static inline std::tuple<int, int> s_currShortcut = { -1, -1 };
|
2020-11-10 15:26:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|