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

Responsible for creating and managing scenes, has full lifetime control of the existing scenes. More...

#include <SceneManager.hpp>

Classes

struct  Data

Static Public Member Functions

static std::expected< SceneHandle, Core::CoriError<> > CreateScene (const std::string &name)
 Creates a scene with the specified name and adds it to the cache.
static std::expected< SceneHandle, Core::CoriError<> > GetScene (const std::string &name)
 Retries the scene with the specified name from the cache.
static std::expected< SceneHandle, Core::CoriError<> > GetScene (const std::string_view name)
 Retries the scene with the specified name from the cache.
static std::expected< SceneHandle, Core::CoriError<> > GetHandle (const uint32_t sceneID)
 Allows you to get SceneHandle if all you know is scene id.
static std::expected< void, Core::CoriError<> > DestroyScene (const std::string &name)
 Destroys a scene with the specified name.

Detailed Description

Responsible for creating and managing scenes, has full lifetime control of the existing scenes.

Definition at line 13 of file SceneManager.hpp.

Member Function Documentation

◆ CreateScene()

std::expected< SceneHandle, Core::CoriError<> > Cori::World::SceneManager::CreateScene ( const std::string & name)
staticnodiscard

Creates a scene with the specified name and adds it to the cache.

Parameters
nameName of the scene to create.

Duplicate scene names are illegal.

Returns
Expected object with a non owning handle to the created scene on success or a CoriError<> on failure.

Definition at line 68 of file SceneManager.cpp.

Here is the call graph for this function:

◆ DestroyScene()

std::expected< void, Core::CoriError<> > Cori::World::SceneManager::DestroyScene ( const std::string & name)
staticnodiscard

Destroys a scene with the specified name.

Parameters
nameName of the scene to delete.
Returns
Expected object with void on success or CoriError<> on failure.

Definition at line 92 of file SceneManager.cpp.

◆ GetHandle()

std::expected< SceneHandle, Core::CoriError<> > Cori::World::SceneManager::GetHandle ( const uint32_t sceneID)
staticnodiscard

Allows you to get SceneHandle if all you know is scene id.

Each scene is assigned an ID at creation, entities have this ID and you can ask an entity what scene is it from, it will give you the owner scene id, you can "convert" this scene id into a useful handle here.

Parameters
sceneIDID of the scene to get a handle for.
Returns
Expected object with SceneHandle on success, CoriError on failure.

Definition at line 52 of file SceneManager.cpp.

◆ GetScene() [1/2]

std::expected< SceneHandle, Core::CoriError<> > Cori::World::SceneManager::GetScene ( const std::string & name)
staticnodiscard

Retries the scene with the specified name from the cache.

Parameters
nameName of the scene to retrieve from cache.
Returns
Expected object with a non owning handle to the created scene on success or a CoriError<> on failure.

Definition at line 36 of file SceneManager.cpp.

◆ GetScene() [2/2]

std::expected< SceneHandle, Core::CoriError<> > Cori::World::SceneManager::GetScene ( const std::string_view name)
staticnodiscard

Retries the scene with the specified name from the cache.

Parameters
nameName of the scene to retrieve from cache.
Returns
Expected object with a non owning handle to the created scene on success or a CoriError<> on failure.

Definition at line 44 of file SceneManager.cpp.


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