light/modules/ecs/public/scene.hpp

45 lines
798 B
C++
Raw Normal View History

2025-07-05 13:28:41 +03:30
#pragma once
2025-07-11 01:16:52 +03:30
#include <ecs/components/transform.hpp>
#include <ecs/uuid.hpp>
2025-07-05 13:28:41 +03:30
#include <entt/entt.hpp>
2025-07-11 00:05:48 +03:30
namespace lt {
2025-07-05 13:28:41 +03:30
class Entity;
class Framebuffer;
class Scene
{
public:
void on_create();
2025-07-05 13:28:41 +03:30
void on_update(float deltaTime);
2025-07-05 16:07:51 +03:30
void on_render(const Ref<Framebuffer> &targetFrameBuffer = nullptr);
2025-07-05 13:28:41 +03:30
2025-07-06 14:02:50 +03:30
auto create_entity(
2025-07-05 13:28:41 +03:30
const std::string &name,
const TransformComponent &transform = TransformComponent()
2025-07-06 14:02:50 +03:30
) -> Entity;
2025-07-05 13:28:41 +03:30
2025-07-06 14:02:50 +03:30
auto get_entity_by_tag(const std::string &tag) -> Entity;
2025-07-05 13:28:41 +03:30
private:
2025-07-05 16:07:51 +03:30
friend class Entity;
2025-07-06 14:02:50 +03:30
2025-07-05 16:07:51 +03:30
friend class SceneSerializer;
2025-07-06 14:02:50 +03:30
2025-07-05 16:07:51 +03:30
friend class SceneHierarchyPanel;
entt::registry m_registry;
2025-07-06 14:02:50 +03:30
auto create_entity_with_uuid(
2025-07-05 13:28:41 +03:30
const std::string &name,
UUID uuid,
const TransformComponent &transform = TransformComponent()
2025-07-06 14:02:50 +03:30
) -> Entity;
2025-07-05 13:28:41 +03:30
};
2025-07-11 00:05:48 +03:30
} // namespace lt