CitroFlex3ds 0.1
CitroFlex3DS is a lightweight game engine designed specifically for Nintendo 3DS homebrew development. It provides a simple framework for creating games and applications.
 
Loading...
Searching...
No Matches
Scene::Scene Class Reference

Base class for managing game scenes Handles objects, updates, etc... More...

#include <Scene.hpp>

Inheritance diagram for Scene::Scene:
ConsoleScene Level1Scene Level2Scene

Public Member Functions

 Scene (const std::string &sceneName)
 Constructor.
 
virtual ~Scene ()=default
 Virtual destructor.
 
const std::string & GetName () const
 Get scene name.
 
bool CanExitWithKey () const
 Check if scene can be exited with a key.
 
void SetCanExitWithKey (bool value)
 Set if scene can be exited with a key.
 
SceneManager * GetSceneManager () const
 Get scene manager.
 
void SetSceneManager (SceneManager *manager)
 Set scene manager.
 
void SetInputManager (Input::InputManager *manager)
 Set input manager for scene and all elements.
 
void AddElement (Objects::Object *element)
 Add new element to scene.
 
virtual void Update ()
 Updates scene and all elements.
 
void RemoveElement (size_t index)
 Remove element at specified index.
 
void RemoveElementByInstance (Objects::Object *element)
 Remove specific element instance.
 
int GetElementIndex (Objects::Object *element) const
 Get index of specific element.
 
std::vector< Objects::Object * > GetElements () const
 Get all elements in scene.
 
Objects::Object * GetElement (size_t index) const
 Get element at specific index.
 
u32 GetBackgroundColor () const
 Get background color.
 
void SetBackgroundColor (u32 newColor)
 Set background color.
 
virtual void OnLoad ()
 Called when scene is loaded.
 
virtual void OnUnload ()
 Called when scene is unloaded.
 

Protected Attributes

std::vector< Objects::Object * > elements
 List of objects in the scene.
 
bool isLoaded = false
 Flag indicating if scene is loaded.
 
std::string name
 Unique name of the scene.
 
bool canExit = false
 Flag indicating if scene can be exited.
 
SceneManager * sceneManager = nullptr
 Pointer to scene manager.
 
Input::InputManager * inputManager = nullptr
 Pointer to input manager.
 
u32 backgroundColor = Colors::clrBlack
 Background color of the scene.
 

Detailed Description

Base class for managing game scenes Handles objects, updates, etc...

Constructor & Destructor Documentation

◆ Scene()

Scene::Scene::Scene ( const std::string & sceneName)
inline

Constructor.

Parameters
sceneNameUnique name for the scene

Member Function Documentation

◆ AddElement()

void Scene::Scene::AddElement ( Objects::Object * element)

Add new element to scene.

Parameters
elementPointer to object to add

◆ CanExitWithKey()

bool Scene::Scene::CanExitWithKey ( ) const
inline

Check if scene can be exited with a key.

Returns
True if scene can be exited

◆ GetBackgroundColor()

u32 Scene::Scene::GetBackgroundColor ( ) const
inline

Get background color.

Returns
Current background color

◆ GetElement()

Objects::Object * Scene::Scene::GetElement ( size_t index) const
inline

Get element at specific index.

Parameters
indexIndex of element
Returns
Pointer to object at index

◆ GetElementIndex()

int Scene::Scene::GetElementIndex ( Objects::Object * element) const

Get index of specific element.

Parameters
elementPointer to element to find
Returns
Index of element or -1 if not found

◆ GetElements()

std::vector< Objects::Object * > Scene::Scene::GetElements ( ) const
inline

Get all elements in scene.

Returns
Vector of object pointers

◆ GetName()

const std::string & Scene::Scene::GetName ( ) const
inline

Get scene name.

Returns
Const reference to scene name

◆ GetSceneManager()

SceneManager * Scene::Scene::GetSceneManager ( ) const
inline

Get scene manager.

Returns
Pointer to current scene manager

◆ OnLoad()

virtual void Scene::Scene::OnLoad ( )
inlinevirtual

Called when scene is loaded.

Reimplemented in ConsoleScene, Level1Scene, and Level2Scene.

◆ RemoveElement()

void Scene::Scene::RemoveElement ( size_t index)

Remove element at specified index.

Parameters
indexIndex of element to remove

◆ RemoveElementByInstance()

void Scene::Scene::RemoveElementByInstance ( Objects::Object * element)

Remove specific element instance.

Parameters
elementPointer to element to remove

◆ SetBackgroundColor()

void Scene::Scene::SetBackgroundColor ( u32 newColor)
inline

Set background color.

Parameters
newColorNew background color

◆ SetCanExitWithKey()

void Scene::Scene::SetCanExitWithKey ( bool value)
inline

Set if scene can be exited with a key.

Parameters
valueNew exit permission value

◆ SetInputManager()

void Scene::Scene::SetInputManager ( Input::InputManager * manager)

Set input manager for scene and all elements.

Parameters
managerPointer to input manager

◆ SetSceneManager()

void Scene::Scene::SetSceneManager ( SceneManager * manager)
inline

Set scene manager.

Parameters
managerPointer to scene manager

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