Files
sophia/engine/include/sophia/scene.hpp
T
2026-09-25 22:59:01 -07:00

38 lines
887 B
C++

#pragma once
#include <entt/entt.hpp>
#include <string>
namespace sophia {
class Entity;
class SceneRenderer; // !TEMP remove this
class Scene {
public:
Scene();
~Scene();
// Every entity gets a TagComponent (named `name`) and a TransformComponent.
Entity createEntity(const std::string& name = {});
void destroyEntity(Entity entity);
/** Calls `fn(Entity)` for every live entity. Defined in entity.hpp. */
template <typename Fn>
void forEachEntity(Fn&& fn);
// The camera a render request uses when it doesn't name one. Null until
// set.
entt::entity getActiveCamera() const { return activeCamera; }
void setActiveCamera(entt::entity camera) { activeCamera = camera; }
private:
friend class Entity;
friend class SceneRenderer; // !TEMP remove this
entt::registry registry;
entt::entity activeCamera = entt::null;
};
} // namespace sophia