35 Stage(
const std::string& new_scene_name, std::unique_ptr<game::core::Scene>
scene);
46 [[nodiscard]]
const std::shared_ptr<game::core::Scene> &
scene()
const;
51 [[nodiscard]]
const std::map<std::string, std::shared_ptr<game::core::Scene>> &
scenes()
const;
59 void replaceWithNewScene(
const std::string& old_scene_name,
const std::string& new_scene_name, std::shared_ptr<Scene>
scene);
93 std::shared_ptr<game::core::Scene>
scene_;
99 std::map<std::string, std::shared_ptr<game::core::Scene>>
scenes_;
Stage is used to manage scenes. The Stage automatically draws all Actor objects of a scene if they ar...
std::map< std::string, std::shared_ptr< game::core::Scene > > scenes_
This maps stores all referenced scenes. They can be addressed by their names.
std::shared_ptr< game::core::Scene > next_scene_
Pointer to the next scene to be active. The switch will happen when Update() is called the next time.
void replaceWithNewScene(const std::string &old_scene_name, const std::string &new_scene_name, std::shared_ptr< Scene > scene)
Inserts a new scene into scenes_, sets next_scene_ to the new scene and removes the scene identified ...
const std::map< std::string, std::shared_ptr< game::core::Scene > > & scenes() const
void Draw()
Draws all visible actors of the active scene. Then calls the Draw() method of the active scene.
const std::shared_ptr< game::core::Scene > & scene() const
std::shared_ptr< game::core::Scene > scene_
Active scene object.
void switchToScene(const std::string &new_scene_name)
Sets next_scene_ to the scene identified by new_scene_name.
Stage & operator=(const Stage &)=delete
void switchToNewScene(const std::string &new_scene_name, std::shared_ptr< Scene > scene)
Inserts a new scene into scenes_ and sets next_scene_ to the new scene.
void Update()
Changes the active scene if next_scene_ is set. Then calls the update() method of the scene.
void replaceWithExistingScene(const std::string &old_scene_name, const std::string &new_scene_name)
Sets next_scene_ to the existing scene identified by new_scene_name and removes the scene identified ...
Stage(const game::core::Stage &stage)=delete