AnnLevelManager.hpp
Go to the documentation of this file.
1 
8 #pragma once
9 
10 #include <vector>
11 #include "AnnLevel.hpp"
12 #include "AnnSubsystem.hpp"
13 #include "AnnGameObject.hpp"
14 
15 namespace Annwvyn
16 {
17  using AnnLevelID = size_t;
18 
21  {
22  public:
25 
27  ~AnnLevelManager();
28 
31  void switchToLevel(AnnLevelID levelId);
32 
35  void switchToLevel(AnnLevelPtr level);
36 
39  void addLevel(AnnLevelPtr level);
40 
42  template <class LevelType, class... Args>
43  decltype(auto) addLevel(Args&&... args)
44  {
45  auto level = std::make_shared<LevelType>(args...);
46  addLevel(level);
47  return level;
48  }
49 
51  void switchToFirstLoadedLevel();
52 
54  void switchToLastLoadedLevel();
55 
57  void update() override;
58 
60  void unloadCurrentLevel();
61 
63  AnnLevelPtr getLastLoadedLevel();
64 
66  AnnLevelPtr getFirstLoadedLevel();
67 
69  AnnLevelPtr getLevelByIndex(AnnLevelID id);
70 
72  AnnLevelPtr getCurrentLevel() const;
73 
75  void addToCurrentLevel(AnnGameObjectPtr obj) const;
76 
78  void removeFromCurrentLevel(AnnGameObjectPtr obj) const;
79 
80  private:
83 
86 
89 
92  };
93 
95 }
Namespace containing the totality of Annwvyn components.
Definition: AnnGetter.cpp:8
bool jumpRequested
Will jumpt to a level at next update.
Class that take care of switching between different levels dynamically and clearing the memory afterw...
Pure virtual class that represent a level AnnLevelManager class only handle object that derive from t...
size_t AnnLevelID
std::vector< AnnLevelPtr > loadedLevels
List of levels.
Parent class of all Annwvyn SubSystem.
AnnLevelPtr current
Address to the currently running level.
#define AnnDllExport
Definition: systemMacro.h:24
AnnLevelID jumpTo
Level to switchToLevel to at next update.
Game Object class.