Annwvyn::AnnLevelManager Class Reference

Class that take care of switching between different levels dynamically and clearing the memory afterwards. More...

#include <AnnLevelManager.hpp>

Inheritance diagram for Annwvyn::AnnLevelManager:
Collaboration diagram for Annwvyn::AnnLevelManager:

Public Member Functions

 AnnLevelManager ()
 Construct LevelManager. More...
 
 ~AnnLevelManager ()
 Destroy the level manager. More...
 
void switchToLevel (AnnLevelID levelId)
 
void switchToLevel (AnnLevelPtr level)
 
void addLevel (AnnLevelPtr level)
 
template<class LevelType , class... Args>
decltype(auto) addLevel (Args &&... args)
 Uitility overload to easilly create and add levels at the same time. More...
 
void switchToFirstLoadedLevel ()
 Jump to the first level that was loaded into the engine. More...
 
void switchToLastLoadedLevel ()
 Jump to the first level that was loaded into the engine. More...
 
void update () override
 Run level logic. More...
 
void unloadCurrentLevel ()
 Unload the level currently running. More...
 
AnnLevelPtr getLastLoadedLevel ()
 Retrieve the last loaded level pointer. More...
 
AnnLevelPtr getFirstLoadedLevel ()
 Retrieve the first loaded level pointer. More...
 
AnnLevelPtr getLevelByIndex (AnnLevelID id)
 Retrieve the idth loaded level pointer. More...
 
AnnLevelPtr getCurrentLevel () const
 Get the current level. More...
 
void addToCurrentLevel (AnnGameObjectPtr obj) const
 Add an orphan object to the current level. More...
 
void removeFromCurrentLevel (AnnGameObjectPtr obj) const
 Remove an object from the current level (make it orphan) More...
 
- Public Member Functions inherited from Annwvyn::AnnSubSystem
 AnnSubSystem (const std::string &systemName)
 Construct a SubSystem. More...
 
virtual ~AnnSubSystem ()
 Destruct a SubSystem. More...
 

Private Attributes

std::vector< AnnLevelPtrloadedLevels
 List of levels. More...
 
AnnLevelPtr current
 Address to the currently running level. More...
 
bool jumpRequested
 Will jumpt to a level at next update. More...
 
AnnLevelID jumpTo
 Level to switchToLevel to at next update. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Annwvyn::AnnSubSystem
virtual bool needUpdate ()
 To be called by AnnEngine : Return if the subsystem wants to be updated. More...
 
- Protected Attributes inherited from Annwvyn::AnnSubSystem
std::string name
 Name of the subsystem. More...
 

Detailed Description

Class that take care of switching between different levels dynamically and clearing the memory afterwards.

Definition at line 20 of file AnnLevelManager.hpp.

Constructor & Destructor Documentation

◆ AnnLevelManager()

AnnLevelManager::AnnLevelManager ( )

Construct LevelManager.

Definition at line 11 of file AnnLevelManager.cpp.

◆ ~AnnLevelManager()

AnnLevelManager::~AnnLevelManager ( )

Destroy the level manager.

Definition at line 19 of file AnnLevelManager.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ addLevel() [1/2]

void Annwvyn::AnnLevelManager::addLevel ( AnnLevelPtr  level)

Add a level to the level manager

Parameters
leveladdress of a subclass instance of AnnLevel

◆ addLevel() [2/2]

template<class LevelType , class... Args>
decltype(auto) Annwvyn::AnnLevelManager::addLevel ( Args &&...  args)
inline

Uitility overload to easilly create and add levels at the same time.

Definition at line 43 of file AnnLevelManager.hpp.

◆ addToCurrentLevel()

void AnnLevelManager::addToCurrentLevel ( AnnGameObjectPtr  obj) const

Add an orphan object to the current level.

Definition at line 100 of file AnnLevelManager.cpp.

◆ getCurrentLevel()

std::shared_ptr< AnnLevel > AnnLevelManager::getCurrentLevel ( ) const

Get the current level.

Definition at line 114 of file AnnLevelManager.cpp.

◆ getFirstLoadedLevel()

std::shared_ptr< AnnLevel > AnnLevelManager::getFirstLoadedLevel ( )

Retrieve the first loaded level pointer.

Definition at line 89 of file AnnLevelManager.cpp.

◆ getLastLoadedLevel()

std::shared_ptr< AnnLevel > AnnLevelManager::getLastLoadedLevel ( )

Retrieve the last loaded level pointer.

Definition at line 84 of file AnnLevelManager.cpp.

Here is the caller graph for this function:

◆ getLevelByIndex()

std::shared_ptr< AnnLevel > AnnLevelManager::getLevelByIndex ( AnnLevelID  id)

Retrieve the idth loaded level pointer.

Definition at line 94 of file AnnLevelManager.cpp.

◆ removeFromCurrentLevel()

void AnnLevelManager::removeFromCurrentLevel ( AnnGameObjectPtr  obj) const

Remove an object from the current level (make it orphan)

Definition at line 106 of file AnnLevelManager.cpp.

◆ switchToFirstLoadedLevel()

void AnnLevelManager::switchToFirstLoadedLevel ( )

Jump to the first level that was loaded into the engine.

Definition at line 61 of file AnnLevelManager.cpp.

Here is the call graph for this function:

◆ switchToLastLoadedLevel()

void AnnLevelManager::switchToLastLoadedLevel ( )

Jump to the first level that was loaded into the engine.

Definition at line 66 of file AnnLevelManager.cpp.

Here is the call graph for this function:

◆ switchToLevel() [1/2]

void AnnLevelManager::switchToLevel ( AnnLevelID  levelId)

Jump to an index referenced level

Parameters
levelIdIndex of the level in the order they have been declared

Definition at line 25 of file AnnLevelManager.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ switchToLevel() [2/2]

void Annwvyn::AnnLevelManager::switchToLevel ( AnnLevelPtr  level)

Jump to a pointer referenced level

Parameters
leveladdress of a subclass instance of AnnLevel

◆ unloadCurrentLevel()

void AnnLevelManager::unloadCurrentLevel ( )

Unload the level currently running.

Definition at line 78 of file AnnLevelManager.cpp.

Here is the caller graph for this function:

◆ update()

void AnnLevelManager::update ( )
overridevirtual

Run level logic.

Reimplemented from Annwvyn::AnnSubSystem.

Definition at line 71 of file AnnLevelManager.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ current

AnnLevelPtr Annwvyn::AnnLevelManager::current
private

Address to the currently running level.

Definition at line 85 of file AnnLevelManager.hpp.

◆ jumpRequested

bool Annwvyn::AnnLevelManager::jumpRequested
private

Will jumpt to a level at next update.

Definition at line 88 of file AnnLevelManager.hpp.

◆ jumpTo

AnnLevelID Annwvyn::AnnLevelManager::jumpTo
private

Level to switchToLevel to at next update.

Definition at line 91 of file AnnLevelManager.hpp.

◆ loadedLevels

std::vector<AnnLevelPtr> Annwvyn::AnnLevelManager::loadedLevels
private

List of levels.

Definition at line 82 of file AnnLevelManager.hpp.


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