light/modules/app/public/application.hpp

45 lines
920 B
C++
Raw Normal View History

2025-07-05 13:28:41 +03:30
#pragma once
namespace lt::app {
2025-07-05 13:28:41 +03:30
class ISystem;
2025-07-05 13:28:41 +03:30
2025-07-07 15:13:05 +03:30
extern Scope<class Application> create_application();
/** The main application class.
* Think of this like an aggregate of systems, you register systems through this interface.
* Then they'll tick every "application frame".
*/
2025-07-05 16:07:51 +03:30
class Application
2025-07-05 13:28:41 +03:30
{
public:
Application(const Application &) = delete;
2025-07-05 16:07:51 +03:30
2025-07-07 15:13:05 +03:30
Application(Application &&) = delete;
auto operator=(const Application &) -> Application & = delete;
auto operator=(Application &&) -> Application & = delete;
2025-07-05 13:28:41 +03:30
virtual ~Application() = default;
2025-07-11 00:24:44 +03:30
void game_loop();
2025-07-05 13:28:41 +03:30
void register_system(Ref<app::ISystem> system);
2025-07-07 15:13:05 +03:30
void unregister_system(Ref<app::ISystem> system);
2025-07-05 13:28:41 +03:30
protected:
Application() = default;
2025-07-05 13:28:41 +03:30
private:
std::vector<Ref<app::ISystem>> m_systems;
2025-07-11 00:56:57 +03:30
std::vector<Ref<app::ISystem>> m_systems_to_be_unregistered;
std::vector<Ref<app::ISystem>> m_systems_to_be_registered;
2025-07-05 13:28:41 +03:30
};
} // namespace lt::app