Nox Engine
 
Loading...
Searching...
No Matches
Scene Struct Referenceabstract

An abstract class representing a distinct part of the game, like a main menu or a level. More...

#include <Scene.h>

Collaboration diagram for Scene:
Collaboration graph

Public Member Functions

 Scene (std::string name, int buildIndex, bool isPanel, bool isLocking, int layer)
 Constructs a Scene.
 
virtual void init ()=0
 Pure virtual function for scene-specific initialization logic.
 
virtual void update ()=0
 Pure virtual function for scene-specific update logic.
 
virtual void reload ()=0
 Pure virtual function to reset the scene to its initial state.
 
virtual void reloadWithState ()=0
 Pure virtual function to reload the scene while preserving some state (e.g., UI state).
 
virtual void handleEvents (SDL_Event &event)=0
 Pure virtual function to handle scene-specific SDL events.
 
virtual void draw ()=0
 Pure virtual function for scene-specific drawing logic.
 
void addEntityToScene (Entity &entity)
 Registers an entity as belonging to this scene.
 
void removeEntityFromScene (Entity *entity)
 Removes an entity from this scene's management.
 
bool existsInScene (Entity *entity)
 Checks if a specific entity is part of this scene.
 
void clearScene ()
 Removes all entities from the scene.
 
void enableScene ()
 Activates all entities within the scene.
 
void disableScene ()
 Deactivates all entities within the scene.
 
const boolgetIsPanel () const
 Gets whether the scene is a UI panel.
 
const boolgetIsLocking () const
 Gets whether the scene locks updates on lower layers.
 

Public Attributes

std::string name
 The unique name of the scene.
 
int buildIndex
 The index of the scene for sequential loading.
 
int layer
 The rendering layer, for handling multiple active scenes (e.g., UI panels).
 
bool mouseButtonPressed
 

Detailed Description

An abstract class representing a distinct part of the game, like a main menu or a level.

Manages a collection of entities that exist within it.

Constructor & Destructor Documentation

◆ Scene()

Scene::Scene ( std::string  name,
int  buildIndex,
bool  isPanel,
bool  isLocking,
int  layer 
)

Constructs a Scene.

Parameters
nameThe unique name of the scene.
buildIndexThe scene's build index.
isPanelTrue if this scene is a UI panel that can overlay other scenes.
isLockingTrue if this scene should prevent updates in scenes on lower layers.
layerThe rendering and update layer.

Member Function Documentation

◆ addEntityToScene()

void Scene::addEntityToScene ( Entity entity)

Registers an entity as belonging to this scene.

Parameters
entityThe entity to add.

◆ existsInScene()

bool Scene::existsInScene ( Entity entity)

Checks if a specific entity is part of this scene.

Parameters
entityThe entity to check for.
Returns
True if the entity is in the scene, false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getIsLocking()

const bool & Scene::getIsLocking ( ) const

Gets whether the scene locks updates on lower layers.

Returns
True if the scene is a locking scene.
Here is the caller graph for this function:

◆ getIsPanel()

const bool & Scene::getIsPanel ( ) const

Gets whether the scene is a UI panel.

Returns
True if the scene is a panel.
Here is the caller graph for this function:

◆ handleEvents()

virtual void Scene::handleEvents ( SDL_Event event)
pure virtual

Pure virtual function to handle scene-specific SDL events.

Parameters
eventThe SDL_Event to process.
Here is the caller graph for this function:

◆ removeEntityFromScene()

void Scene::removeEntityFromScene ( Entity entity)

Removes an entity from this scene's management.

Parameters
entityThe entity to remove.
Here is the call graph for this function:

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