2020-11-10 14:26:38 +00: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 20:31:04 +00:00
|
|
|
T* addView(Args&& ... args) {
|
|
|
|
this->m_views.emplace_back(new T(std::forward<Args>(args)...));
|
2020-11-10 14:26:38 +00:00
|
|
|
|
|
|
|
return static_cast<T*>(this->m_views.back());
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void frameBegin();
|
|
|
|
void frameEnd();
|
|
|
|
|
|
|
|
void initGLFW();
|
|
|
|
void initImGui();
|
|
|
|
void deinitGLFW();
|
|
|
|
void deinitImGui();
|
|
|
|
|
|
|
|
GLFWwindow* m_window;
|
|
|
|
std::vector<View*> m_views;
|
2020-11-11 08:22:55 +00:00
|
|
|
bool m_fpsVisible = false;
|
2020-11-11 13:41:44 +00:00
|
|
|
|
|
|
|
static inline std::tuple<int, int> s_currShortcut = { -1, -1 };
|
2020-11-10 14:26:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|