66 lines
1.7 KiB
C++
66 lines
1.7 KiB
C++
export module surface.system;
|
|
export import :components;
|
|
import app.system;
|
|
import ecs.registry;
|
|
import math.vec2;
|
|
import surface.requests;
|
|
import memory.reference;
|
|
import std;
|
|
|
|
namespace lt::surface {
|
|
|
|
export class System: public app::ISystem
|
|
{
|
|
public:
|
|
[[nodiscard]] System(memory::Ref<ecs::Registry> registry);
|
|
|
|
~System() override;
|
|
|
|
System(System &&) = default;
|
|
|
|
System(const System &) = delete;
|
|
|
|
auto operator=(System &&) -> System & = default;
|
|
|
|
auto operator=(const System &) -> System & = delete;
|
|
|
|
void on_register() override;
|
|
|
|
void on_unregister() override;
|
|
|
|
void create_surface_component(ecs::EntityId entity, SurfaceComponent::CreateInfo info);
|
|
|
|
void tick(app::TickInfo tick) override;
|
|
|
|
[[nodiscard]] auto get_last_tick_result() const -> const app::TickResult & override
|
|
{
|
|
return m_last_tick_result;
|
|
}
|
|
|
|
private:
|
|
void on_surface_destruct(ecs::Registry ®istry, ecs::EntityId entity);
|
|
|
|
void handle_requests(SurfaceComponent &surface);
|
|
|
|
void handle_events(SurfaceComponent &surface);
|
|
|
|
void modify_title(SurfaceComponent &surface, const ModifyTitleRequest &request);
|
|
|
|
void modify_resolution(SurfaceComponent &surface, const ModifyResolutionRequest &request);
|
|
|
|
void modify_position(SurfaceComponent &surface, const ModifyPositionRequest &request);
|
|
|
|
void modify_visiblity(SurfaceComponent &surface, const ModifyVisibilityRequest &request);
|
|
|
|
void modify_position(ecs::EntityId surface_entity, const math::ivec2 &new_size);
|
|
|
|
void modify_position(ecs::EntityId surface_entity, const math::uvec2 &new_size);
|
|
|
|
void set_visibility(ecs::EntityId surface_entity, bool visible);
|
|
|
|
memory::Ref<ecs::Registry> m_registry;
|
|
|
|
app::TickResult m_last_tick_result;
|
|
};
|
|
|
|
} // namespace lt::surface
|