engine::Scene class

Abstract base class for all scenes in a game.

The client inherits from this to create specific screens (Menu, Levels, etc).

Constructors, destructors, conversion operators

Scene(const std::string& name)
Constructs a new Scene.
~Scene() defaulted virtual
Virtual destructor.

Public functions

void OnAttach() virtual
Called when the scene is added to the manager (e.g., loading assets).
void OnDetach() virtual
Called when the scene is removed from the manager (e.g., clearing assets).
void OnUpdate(float delta_time_seconds) virtual
Called every frame for logic updates.
void OnRender() virtual
Called every frame for drawing calls.
auto OnInput() -> bool virtual
Called by the application when an input event occurs.
auto name() const -> const std::string&
Gets the debug name of the scene.

Protected variables

std::string debug_name_
The debug name of the scene.

Function documentation

engine::Scene::Scene(const std::string& name)

Constructs a new Scene.

Parameters
name The debug name of the scene.

void engine::Scene::OnUpdate(float delta_time_seconds) virtual

Called every frame for logic updates.

Parameters
delta_time_seconds The time elapsed since the last frame, in seconds.

bool engine::Scene::OnInput() virtual

Called by the application when an input event occurs.

Returns true if the event was "handled" and shouldn't propagate.

const std::string& engine::Scene::name() const

Gets the debug name of the scene.

Returns The debug name.