diff --git a/src/Application.cpp b/src/Application.cpp index f5e41ad..321fa32 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -1075,4 +1075,10 @@ auto Application::is_key_released(uint32_t key) const -> bool return !m_key_state[key] && m_key_state_previous[key]; } +auto Application::the() -> Application & +{ + static Application self {}; + return self; +} + } // namespace Lunar diff --git a/src/Application.h b/src/Application.h index 224eeda..2a3578b 100644 --- a/src/Application.h +++ b/src/Application.h @@ -38,6 +38,8 @@ struct Application { auto is_key_pressed(uint32_t key) const -> bool; auto is_key_released(uint32_t key) const -> bool; + static auto the() -> Application &; + private: auto init_input() -> void; auto init_test_meshes() -> void; diff --git a/src/main.cpp b/src/main.cpp index af3ffba..d67a8d8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,7 +1,3 @@ #include "src/Application.h" -auto main() -> int -{ - Lunar::Application app {}; - app.run(); -} +auto main() -> int { Lunar::Application::the().run(); }