CoriEngine
Loading...
Searching...
No Matches
Cori::World::Scene Class Reference

A scene in a game world. More...

#include <Scene.hpp>

Inheritance diagram for Cori::World::Scene:
Collaboration diagram for Cori::World::Scene:

Public Member Functions

 ~Scene ()
Entity CreateBlankEntity ()
template<typename... T>
Entity CreateEntity (const std::string &name)
void DestroyEntity (Entity entity)
std::expected< void, Core::CoriError<> > AddEntityToCache (const Entity entity, const Utility::StringHash32 key)
std::expected< Entity, Core::CoriError<> > GetEntityFromCache (const Utility::StringHash32 key)
void RemoveEntityFromCache (const Utility::StringHash32 key)
template<typename... T>
std::expected< Entity, Core::CoriError<> > FindEntity (const std::string &name)
template<typename... T>
auto StaticView ()
template<typename... T, typename... ExcludeT>
auto StaticView (Exclude< ExcludeT... >)
DynamicEntityView DynamicView ()
template<typename T, typename... Args>
T & AddContextComponent (Args &&... args)
template<typename T>
T & GetContextComponent ()
template<typename T>
const T & GetContextComponent () const
template<typename T>
bool HasContextComponent () const
template<typename T>
void RemoveContextComponent ()
template<typename T, typename... Args>
requires IsSystem<T>
void RegisterSystem (Args &&... args)
template<typename T>
requires IsSystem<T>
void UnregisterSystem ()
template<typename T>
requires IsSystem<T>
std::expected< std::weak_ptr< T >, Core::CoriError<> > GetSystem ()
Graphics::CameraControllerGetCameraController ()
const Graphics::CameraControllerGetCameraController () const
std::string_view GetName () const
uint32_t GetSceneID () const
void BeginRender ()
void EndRender ()

Protected Member Functions

bool OnBind ()
bool OnUnbind ()
void OnUpdate (Core::GameTimer &gameTimer)
void OnTickUpdate (Core::GameTimer &gameTimer)
void OnImGuiRender (Core::GameTimer &gameTimer)

Static Protected Member Functions

static std::shared_ptr< SceneCreate (std::string name)

Protected Attributes

entt::registry m_Registry

Friends

class SceneHandle
class SceneManager

Detailed Description

A scene in a game world.

You can have several scenes loaded at the same time, but you can only have one scene bound per layer. Use SceneHandle to interact with a scene, don't try to use Scene directly.

Definition at line 20 of file Scene.hpp.

Constructor & Destructor Documentation

◆ ~Scene()

Cori::World::Scene::~Scene ( )

Definition at line 19 of file Scene.cpp.

Member Function Documentation

◆ AddContextComponent()

template<typename T, typename... Args>
T & Cori::World::Scene::AddContextComponent ( Args &&... args)
inline

Definition at line 83 of file Scene.hpp.

◆ AddEntityToCache()

std::expected< void, Core::CoriError<> > Cori::World::Scene::AddEntityToCache ( const Entity entity,
const Utility::StringHash32 key )

Definition at line 31 of file Scene.cpp.

Here is the call graph for this function:

◆ BeginRender()

void Cori::World::Scene::BeginRender ( )

Definition at line 93 of file Scene.cpp.

Here is the call graph for this function:

◆ Create()

std::shared_ptr< Scene > Cori::World::Scene::Create ( std::string name)
staticnodiscardprotected

Definition at line 9 of file Scene.cpp.

◆ CreateBlankEntity()

Entity Cori::World::Scene::CreateBlankEntity ( )

Definition at line 24 of file Scene.cpp.

Here is the call graph for this function:

◆ CreateEntity()

template<typename... T>
Entity Cori::World::Scene::CreateEntity ( const std::string & name)
inline

Definition at line 27 of file Scene.hpp.

Here is the call graph for this function:

◆ DestroyEntity()

void Cori::World::Scene::DestroyEntity ( Entity entity)

Definition at line 61 of file Scene.cpp.

Here is the call graph for this function:

◆ DynamicView()

DynamicEntityView Cori::World::Scene::DynamicView ( )
inlinenodiscard

Definition at line 72 of file Scene.hpp.

◆ EndRender()

void Cori::World::Scene::EndRender ( )

Definition at line 97 of file Scene.cpp.

Here is the call graph for this function:

◆ FindEntity()

template<typename... T>
std::expected< Entity, Core::CoriError<> > Cori::World::Scene::FindEntity ( const std::string & name)
inlinenodiscard

Definition at line 49 of file Scene.hpp.

◆ GetCameraController() [1/2]

Graphics::CameraController & Cori::World::Scene::GetCameraController ( )
inlinenodiscard

Definition at line 158 of file Scene.hpp.

◆ GetCameraController() [2/2]

const Graphics::CameraController & Cori::World::Scene::GetCameraController ( ) const
inlinenodiscard

Definition at line 162 of file Scene.hpp.

◆ GetContextComponent() [1/2]

template<typename T>
T & Cori::World::Scene::GetContextComponent ( )
inlinenodiscard

Definition at line 88 of file Scene.hpp.

Here is the call graph for this function:

◆ GetContextComponent() [2/2]

template<typename T>
const T & Cori::World::Scene::GetContextComponent ( ) const
inlinenodiscard

Definition at line 96 of file Scene.hpp.

Here is the call graph for this function:

◆ GetEntityFromCache()

std::expected< Entity, Core::CoriError<> > Cori::World::Scene::GetEntityFromCache ( const Utility::StringHash32 key)
nodiscard

Definition at line 41 of file Scene.cpp.

◆ GetName()

std::string_view Cori::World::Scene::GetName ( ) const
inlinenodiscard

Definition at line 166 of file Scene.hpp.

◆ GetSceneID()

uint32_t Cori::World::Scene::GetSceneID ( ) const
inlinenodiscard

Definition at line 170 of file Scene.hpp.

◆ GetSystem()

template<typename T>
requires IsSystem<T>
std::expected< std::weak_ptr< T >, Core::CoriError<> > Cori::World::Scene::GetSystem ( )
inline

Definition at line 150 of file Scene.hpp.

◆ HasContextComponent()

template<typename T>
bool Cori::World::Scene::HasContextComponent ( ) const
inlinenodiscard

Definition at line 104 of file Scene.hpp.

◆ OnBind()

bool Cori::World::Scene::OnBind ( )
nodiscardprotected

Definition at line 101 of file Scene.cpp.

◆ OnImGuiRender()

void Cori::World::Scene::OnImGuiRender ( Core::GameTimer & gameTimer)
protected

Definition at line 87 of file Scene.cpp.

◆ OnTickUpdate()

void Cori::World::Scene::OnTickUpdate ( Core::GameTimer & gameTimer)
protected

Definition at line 81 of file Scene.cpp.

◆ OnUnbind()

bool Cori::World::Scene::OnUnbind ( )
nodiscardprotected

Definition at line 105 of file Scene.cpp.

◆ OnUpdate()

void Cori::World::Scene::OnUpdate ( Core::GameTimer & gameTimer)
protected

Definition at line 71 of file Scene.cpp.

◆ RegisterSystem()

template<typename T, typename... Args>
requires IsSystem<T>
void Cori::World::Scene::RegisterSystem ( Args &&... args)
inline

Definition at line 114 of file Scene.hpp.

◆ RemoveContextComponent()

template<typename T>
void Cori::World::Scene::RemoveContextComponent ( )
inline

Definition at line 109 of file Scene.hpp.

◆ RemoveEntityFromCache()

void Cori::World::Scene::RemoveEntityFromCache ( const Utility::StringHash32 key)

Definition at line 52 of file Scene.cpp.

Here is the call graph for this function:

◆ StaticView() [1/2]

template<typename... T>
auto Cori::World::Scene::StaticView ( )
inlinenodiscard

Definition at line 61 of file Scene.hpp.

◆ StaticView() [2/2]

template<typename... T, typename... ExcludeT>
auto Cori::World::Scene::StaticView ( Exclude< ExcludeT... > )
inlinenodiscard

Definition at line 67 of file Scene.hpp.

◆ UnregisterSystem()

template<typename T>
requires IsSystem<T>
void Cori::World::Scene::UnregisterSystem ( )
inline

Definition at line 142 of file Scene.hpp.

◆ SceneHandle

friend class SceneHandle
friend

Definition at line 180 of file Scene.hpp.

◆ SceneManager

friend class SceneManager
friend

Definition at line 181 of file Scene.hpp.

Member Data Documentation

◆ m_Registry

entt::registry Cori::World::Scene::m_Registry
protected

Definition at line 193 of file Scene.hpp.


The documentation for this class was generated from the following files: