2025-07-05 13:28:41 +03:30
|
|
|
#pragma once
|
|
|
|
|
2025-07-26 18:01:27 +03:30
|
|
|
namespace lt::app {
|
2025-07-05 13:28:41 +03:30
|
|
|
|
2025-07-26 18:01:27 +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();
|
|
|
|
|
2025-07-26 18:01:27 +03:30
|
|
|
/** 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
|
|
|
|
2025-07-26 18:01:27 +03:30
|
|
|
virtual ~Application() = default;
|
2025-07-11 00:24:44 +03:30
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
void game_loop();
|
2025-07-05 13:28:41 +03:30
|
|
|
|
2025-07-26 18:01:27 +03:30
|
|
|
void register_system(Ref<app::ISystem> system);
|
2025-07-07 15:13:05 +03:30
|
|
|
|
2025-07-26 18:01:27 +03:30
|
|
|
void unregister_system(Ref<app::ISystem> system);
|
2025-07-05 13:28:41 +03:30
|
|
|
|
|
|
|
protected:
|
2025-07-26 18:01:27 +03:30
|
|
|
Application() = default;
|
2025-07-05 13:28:41 +03:30
|
|
|
|
|
|
|
private:
|
2025-07-26 18:01:27 +03:30
|
|
|
std::vector<Ref<app::ISystem>> m_systems;
|
2025-07-11 00:56:57 +03:30
|
|
|
|
2025-07-26 18:01:27 +03:30
|
|
|
std::vector<Ref<app::ISystem>> m_systems_to_be_removed;
|
2025-07-05 13:28:41 +03:30
|
|
|
};
|
|
|
|
|
|
|
|
|
2025-07-26 18:01:27 +03:30
|
|
|
} // namespace lt::app
|