test(surface): add & fix unit tests fix(surface): bugs refactor(surface): minor refactors & some edge-case handling
58 lines
1.3 KiB
C++
58 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <app/system.hpp>
|
|
#include <ecs/entity.hpp>
|
|
#include <ecs/scene.hpp>
|
|
#include <surface/components.hpp>
|
|
|
|
namespace lt::surface {
|
|
|
|
class System: public app::ISystem
|
|
{
|
|
public:
|
|
[[nodiscard]] System(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
|
|
{
|
|
}
|
|
|
|
auto tick() -> bool override;
|
|
|
|
static void set_title(ecs::Entity surface_entity, std::string_view new_title);
|
|
|
|
void set_size(ecs::Entity surface_entity, const math::uvec2 &new_size);
|
|
|
|
void set_v_sync(ecs::Entity surface_entity, bool vsync);
|
|
|
|
void set_visibility(ecs::Entity surface_entity, bool visible);
|
|
|
|
void add_event_listener(ecs::Entity surface_entity, SurfaceComponent::EventCallback callback);
|
|
|
|
private:
|
|
void on_surface_construct(entt::registry ®istry, entt::entity entity);
|
|
|
|
void on_surface_update(entt::registry ®istry, entt::entity entity);
|
|
|
|
void on_surface_destroy(entt::registry ®istry, entt::entity entity);
|
|
|
|
void ensure_component_sanity(const SurfaceComponent &component);
|
|
|
|
Ref<ecs::Registry> m_registry;
|
|
};
|
|
|
|
|
|
} // namespace lt::surface
|