![]() |
galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
|
Scene saving/loading, pushing, popping, creating. Also manages entities. More...
#include <SceneManager.hpp>
Public Member Functions | |
SceneManager () noexcept | |
Constructor. | |
virtual | ~SceneManager () noexcept |
Destructor. | |
std::shared_ptr< Scene > | create (const std::string &scene) |
Create scene in engine. | |
void | set (const std::string &scene) |
Clears all from stack and sets as active. | |
void | push (const std::string &scene) |
Push a scene onto the top of stack. | |
void | pop () |
Remove scene on top of stack. | |
void | pop_all () |
Pop all scenes. | |
std::shared_ptr< Scene > | top () noexcept |
Get top scene. | |
void | update () |
Process events and updates. | |
void | render () |
Render scenes. | |
void | load_app (const std::string &appdata_file) |
Load app data file into scene manager. | |
void | save_app (const std::string &file) |
Save all active scenes and sub data within those scenes. | |
void | clear () |
Deletes all scene data. | |
bool | empty () const noexcept |
Are there any scenes. | |
nlohmann::json | serialize () override |
Serializes object. | |
void | deserialize (const nlohmann::json &json) override |
Deserializes from object. | |
![]() | |
virtual | ~Serializable () |
Destructor. | |
virtual Serializable & | operator= (Serializable &&)=default |
Move assignment operator. | |
virtual Serializable & | operator= (const Serializable &)=default |
Copy assignment operator. | |
Private Attributes | |
ankerl::unordered_dense::map< std::uint64_t, std::shared_ptr< Scene > > | m_scenes |
Scene storage. | |
std::vector< std::shared_ptr< Scene > > | m_stack |
Active scenes. | |
core::Registry | m_registry |
Entity data. | |
Additional Inherited Members | |
![]() | |
Serializable () | |
Constructor. | |
Scene saving/loading, pushing, popping, creating. Also manages entities.
Definition at line 21 of file SceneManager.hpp.
|
noexcept |
Constructor.
Definition at line 27 of file SceneManager.cpp.
|
virtualnoexcept |
Destructor.
Definition at line 31 of file SceneManager.cpp.
std::shared_ptr< Scene > galaxy::scene::SceneManager::create | ( | const std::string & | scene | ) |
Create scene in engine.
scene | Scene name. |
Definition at line 36 of file SceneManager.cpp.
void galaxy::scene::SceneManager::set | ( | const std::string & | scene | ) |
Clears all from stack and sets as active.
scene | Scene name. |
Definition at line 51 of file SceneManager.cpp.
void galaxy::scene::SceneManager::push | ( | const std::string & | scene | ) |
Push a scene onto the top of stack.
scene | Scene name. |
Definition at line 57 of file SceneManager.cpp.
void galaxy::scene::SceneManager::pop | ( | ) |
Remove scene on top of stack.
Definition at line 64 of file SceneManager.cpp.
void galaxy::scene::SceneManager::pop_all | ( | ) |
Pop all scenes.
Definition at line 73 of file SceneManager.cpp.
|
nodiscardnoexcept |
Get top scene.
Definition at line 81 of file SceneManager.cpp.
void galaxy::scene::SceneManager::update | ( | ) |
Process events and updates.
Definition at line 86 of file SceneManager.cpp.
void galaxy::scene::SceneManager::render | ( | ) |
Render scenes.
Definition at line 94 of file SceneManager.cpp.
void galaxy::scene::SceneManager::load_app | ( | const std::string & | appdata_file | ) |
Load app data file into scene manager.
Will remove any other loaded scenes and adjust the currently loaded scene.
appdata_file | Zlib + Base64 encoded json data file. Should have .galaxy extension. |
Definition at line 102 of file SceneManager.cpp.
void galaxy::scene::SceneManager::save_app | ( | const std::string & | file | ) |
Save all active scenes and sub data within those scenes.
file | File to save data to. |
Definition at line 151 of file SceneManager.cpp.
void galaxy::scene::SceneManager::clear | ( | ) |
Deletes all scene data.
Definition at line 185 of file SceneManager.cpp.
|
nodiscardnoexcept |
Are there any scenes.
Definition at line 192 of file SceneManager.cpp.
|
nodiscardoverridevirtual |
Serializes object.
Implements galaxy::fs::Serializable.
Definition at line 197 of file SceneManager.cpp.
|
overridevirtual |
Deserializes from object.
json | Json object to retrieve data from. |
Implements galaxy::fs::Serializable.
Definition at line 222 of file SceneManager.cpp.
|
private |
Scene storage.
Definition at line 132 of file SceneManager.hpp.
|
private |
Active scenes.
Definition at line 137 of file SceneManager.hpp.
|
private |
Entity data.
Definition at line 142 of file SceneManager.hpp.