Represents a level in the game engine.
More...
#include <Level.h>
|
| | Level (std::string pTitle="Scene") |
| | Constructs a new level with the given title.
|
| |
|
| ~Level () |
| | Destroys the level and cleans up resources.
|
| |
| virtual void | Load ()=0 |
| | Loads the level. Must be implemented by derived classes.
|
| |
| void | SetManager (RendererGL *pRenderer, Physics *pPhysics, LevelManager *pManager) |
| | Sets the renderer, physics, and manager for the level.
|
| |
| void | OpenLevel (const std::string &pLevelName) |
| | Opens a new level by name.
|
| |
| bool | LineTrace (Vector3 start, Vector3 direction, float maxDistance, raycastHit &hit, bool debugPersistant=false, Actor *self=nullptr) |
| | Performs a line trace (raycast) in the level.
|
| |
|
void | InternalUpdate () |
| | Internal update function called by the engine.
|
| |
| virtual void | Close ()=0 |
| | Closes the level. Must be implemented by derived classes.
|
| |
|
void | Unload () |
| | Unloads the level and cleans up resources.
|
| |
| template<typename T , typename... Args> |
| T * | AddActor (Args &&... args) |
| | Adds an actor of type T to the level.
|
| |
| template<typename T > |
| void | DestroyActor (Actor *pActor) |
| | Removes an actor from the level.
|
| |
| template<typename T > |
| std::vector< T * > | GetAllActorOfType () |
| | Gets all actors of a specific type.
|
| |
| template<typename T > |
| T * | GetActorOfType () |
| | Gets the first actor of a specific type.
|
| |
| RendererGL & | GetRenderer () const |
| | Gets the renderer for the level.
|
| |
| Physics & | GetPhysics () const |
| | Gets the physics system for the level.
|
| |
|
|
static Level * | ActiveScene |
| | Pointer to the currently active scene.
|
| |
|
| virtual void | Update ()=0 |
| | Updates the level. Must be implemented by derived classes.
|
| |
|
|
std::string | mTitle |
| | The title of the scene.
|
| |
|
RendererGL * | mRenderer |
| | The renderer used for drawing the scene.
|
| |
|
Physics * | mPhysics |
| | The physics system used in the level.
|
| |
|
LevelManager * | mManager |
| | The manager responsible for this level.
|
| |
|
std::unordered_map< size_t, std::vector< Actor * > > | mActors |
| | Map of actors categorized by their type.
|
| |
|
std::vector< Actor * > | mPendingActors |
| | List of actors pending to be added to the level.
|
| |
|
std::vector< Actor * > | mDeadActors |
| | List of actors pending to be removed from the level.
|
| |
Represents a level in the game engine.
◆ Level()
| Level::Level |
( |
std::string | pTitle = "Scene" | ) |
|
Constructs a new level with the given title.
- Parameters
-
| pTitle | The title of the scene. |
◆ AddActor()
template<typename T , typename... Args>
| T * clt::Level::AddActor |
( |
Args &&... | args | ) |
|
|
inline |
Adds an actor of type T to the level.
- Template Parameters
-
| T | The type of actor to add. |
| Args | Constructor arguments for the actor. |
- Parameters
-
| args | Arguments to forward to the actor's constructor. |
- Returns
- Pointer to the newly created actor.
◆ Close()
| virtual void clt::Level::Close |
( |
| ) |
|
|
pure virtual |
◆ DestroyActor()
template<typename T >
| void clt::Level::DestroyActor |
( |
Actor * | pActor | ) |
|
|
inline |
Removes an actor from the level.
- Template Parameters
-
| T | The type of actor to remove. |
- Parameters
-
| pActor | Pointer to the actor to be removed. |
◆ GetActorOfType()
template<typename T >
| T * clt::Level::GetActorOfType |
( |
| ) |
|
|
inline |
Gets the first actor of a specific type.
- Template Parameters
-
| T | The type of actor to retrieve. |
- Returns
- Pointer to the first actor of type T, or nullptr if none found.
◆ GetAllActorOfType()
template<typename T >
| std::vector< T * > clt::Level::GetAllActorOfType |
( |
| ) |
|
|
inline |
Gets all actors of a specific type.
- Template Parameters
-
| T | The type of actors to retrieve. |
- Returns
- A vector of pointers to actors of type T.
◆ GetPhysics()
| Physics & clt::Level::GetPhysics |
( |
| ) |
const |
|
inline |
Gets the physics system for the level.
- Returns
- Reference to the physics system.
◆ GetRenderer()
Gets the renderer for the level.
- Returns
- Reference to the renderer.
◆ LineTrace()
| bool Level::LineTrace |
( |
Vector3 | start, |
|
|
Vector3 | direction, |
|
|
float | maxDistance, |
|
|
raycastHit & | hit, |
|
|
bool | debugPersistant = false, |
|
|
Actor * | self = nullptr ) |
Performs a line trace (raycast) in the level.
- Parameters
-
| start | The starting point of the trace. |
| direction | The direction of the trace. |
| maxDistance | The maximum distance for the trace. |
| hit | The result of the raycast. |
| debugPersistant | Whether to persist debug visualization. |
| self | The actor to ignore during the trace. |
- Returns
- True if something was hit, false otherwise.
◆ Load()
| virtual void clt::Level::Load |
( |
| ) |
|
|
pure virtual |
◆ OpenLevel()
| void Level::OpenLevel |
( |
const std::string & | pLevelName | ) |
|
Opens a new level by name.
- Parameters
-
| pLevelName | The name of the level to open. |
◆ SetManager()
Sets the renderer, physics, and manager for the level.
- Parameters
-
| pRenderer | Pointer to the renderer. |
| pPhysics | Pointer to the physics system. |
| pManager | Pointer to the level manager. |
◆ Update()
| virtual void clt::Level::Update |
( |
| ) |
|
|
protectedpure virtual |
The documentation for this class was generated from the following files:
- D:/DEV JEUX/2025/CPP/Opengl/ClutterEngineOpenGL/ClutterEngine/Engine/Core/Levels/Level.h
- D:/DEV JEUX/2025/CPP/Opengl/ClutterEngineOpenGL/ClutterEngine/Engine/Core/Levels/Level.cpp