12 void start(
int width,
int height,
const char *title,
bool use_vsync,
AppState &app_state) {
13 m_app_state = &app_state;
14 m_thread = std::thread([width, height, title, use_vsync,
this ] {
15 ResourceManager::init();
16 initialize(width, height, title, use_vsync);
22 if (m_thread.joinable()) {
28 void initialize(
int width,
int height,
const char *title,
bool use_vsync);
30 while (!m_glfw.windowShouldClose() && !m_app_state->shouldQuit()) {
33 m_app_state->signalQuit();
40 void fillFrame(
float r = 0,
float g = 0,
float b = 0,
float a = 1);
42 void toggleDemoWindow();
43 void updateMousePosition() {
44 m_mousePos.first = ImGui::GetMousePos().x;
45 m_mousePos.second = ImGui::GetMousePos().y;
47 [[nodiscard]]
const std::pair<float, float> &getMousePosition()
const {
return m_mousePos; }
48 static ImTextureID loadTextureFromResources(
const std::string &filename);
51 void drawMainMenuBar();
52 void drawDemoWindow();
53 void drawLostPieces();
59 bool m_justCreatedGame =
false;
64 std::array<ImTextureID, Piece::mask()> pieceTextures;
66 std::pair<float, float> m_mousePos;
69 std::pair<float, float> m_lastHoldedPiecePosition = {0, 0};
71 double m_lastTime = 0;
72 double m_deltaTime = 0;
73 double m_currentTime = 0;
74 bool m_showDemoWindow =
false;