Class Scene#

Class Documentation#

class Scene#

Public Functions

Scene() noexcept = default#

Constructor.

~Scene() noexcept = default#

Destructor.

consteval Scene(const Scene&) = delete#

Copy constructor.

Scene(Scene&&) noexcept = default#

Move constructor.

consteval Scene &operator=(const Scene&) = delete#

Copy assignment operator.

Scene &operator=(Scene&&) noexcept = default#

Move assignment operator.

Entity CreateEntity(const std::string &name = std::string())#

Create a new entity with the given name.

Parameters:

name – Name for the entity.

Returns:

Newly created entity.

void DestroyEntity(Entity entity)#

Destroy the given entity from the scene.

Parameters:

entityEntity to destroy.

void OnRuntimeStart()#

Function to call on run time start.

void OnRuntimeStop()#

Function to call on run time stop.

void OnTickRuntime(const TRAP::Utils::TimeStep &deltaTime)#

Function to call on run time for each tick.

Parameters:

deltaTime – Delta time for fixed tick rate.

void OnUpdateRuntime(Utils::TimeStep deltaTime)#

Function to call on run time for each frame.

Parameters:

deltaTime – Delta time between frames.

void OnUpdateEditor(Utils::TimeStep deltaTime, Graphics::EditorCamera &camera)#

Function to call in TRAP-Editor for each frame while not in run mode.

Remark

Headless mode: This function is not available in headless mode.

void OnTick(const TRAP::Utils::TimeStep &deltaTime)#
void OnViewportResize(u32 width, u32 height)#

Function to call on viewport resize.

Parameters:
  • width – New viewport width.

  • height – New viewport height.

void DuplicateEntity(Entity entity)#

Duplicate the given entity. Create a new entity and copies all components from the given entity.

Parameters:

entityEntity to duplicate.

Entity GetPrimaryCameraEntity()#

Retrieve the primary camera entity for the scene.

Note

If no camera was found a null entity is returned instead.

Returns:

Primary camera entity.

template<typename ...Components>
inline auto GetAllEntitiesWithComponents()#

Retrieve all entities that contain the given components.

Template Parameters:

Components – Components to retrieve.

Returns:

Found entities with requested components.

Public Static Functions

static TRAP::Ref<Scene> Copy(const Ref<Scene> &other)#

Create a copy of the given scene.

Note

Copied scene entities unique identifiers don’t match those of the original scene!

Parameters:

otherScene to copy.

Returns:

Copied scene.