39 {
"renders", p.renders},
40 {
"updates", p.updates},
41 {
"messages", p.messages}
48 j.at(
"renders").get_to(p.renders);
49 j.at(
"updates").get_to(p.updates);
50 j.at(
"messages").get_to(p.messages);
61#pragma region static_functions
75 static auto LoadScene(std::unique_ptr<Node> scene) -> void;
81 static auto LoadScene(
const std::string& name) -> void;
98#pragma region overridden_functions
102 return std::make_unique<SceneManager>(*
this);
109 auto onUpdate(
float dt) ->
void override;
115 auto load(
const Stream& stream) ->
void override;
116 auto save(
Stream& stream)
const ->
void override;
118 [[nodiscard(
"adding child may fail")]]
auto addChild(std::unique_ptr<GameObject> newChild) ->
bool override;
123#pragma region SceneManager_functions
130 auto loadScene(std::unique_ptr<Node> scene) -> void;
136 auto loadScene(
const std::string& name) -> void;
150#pragma region messaging_functions
158#pragma region member_variables
164#pragma region helper_functions
168 std::vector<Scene*>::iterator::value_type scene) -> void;
181#pragma region static_variables
sys::Json Stream
Definition AudioObject.h:20
nlohmann::json json
Definition Json.cpp:19
the base class for the engine, most things inherit from this.
Definition GameObject.h:77
GameObject(std::string typeName, gobj::Type parentType, gobj::Type type)
constructor for gameobject.
Definition GameObject.cpp:23
Manages the heirarchical structure between Systems and Entities.
Definition Node.h:41
Type
Definition System.h:20
@ SceneManager
Definition System.h:34
System(const std::string &typeName, Type systemType)
Definition System.cpp:75
auto clone() const -> std::unique_ptr< GameObject > override
makes a copy a GameObject even if it's held polymorphically
Definition SceneManager.h:100
auto saveScene(Stream &stream) const -> void
Definition SceneManager.cpp:288
friend Scene
Definition SceneManager.h:59
auto linkMessages() -> void
Definition SceneManager.cpp:187
auto toAllSceneChildren(Scene *parent, std::function< void(Scene *)> func) -> void
apply a function to all children of a specific scene
Definition SceneManager.cpp:230
auto operator=(SceneManager &&other) noexcept -> SceneManager &=default
default move assingment operator
static auto LoadScene(std::unique_ptr< Node > scene) -> void
loads a scene by taking the scene directly
Definition SceneManager.cpp:40
auto pushCorrectState(const Scene &sceneToKeep, SceneState newState, SceneState keepSceneState, std::vector< Scene * >::iterator::value_type scene) -> void
Helper function for pushStateToOtherScenes.
Definition SceneManager.cpp:217
auto pushStateToOtherScenes(const Scene &sceneToKeep, SceneState othersState, SceneState keepSceneState) -> void
Definition SceneManager.cpp:239
auto registerScene(Scene &scene) -> void
Definition SceneManager.cpp:277
auto systemShowMenu() -> void override
Specific systems should override this function to show their specific menu for the system.
Definition SceneManager.cpp:62
std::vector< Scene * > scenes
Definition SceneManager.h:160
SceneManager()
Definition SceneManager.cpp:50
auto load(const Stream &stream) -> void override
Implementations will load the state of a GameObject from a th::Json Object.
Definition SceneManager.cpp:102
auto loadScene(std::unique_ptr< Node > scene) -> void
loads a scene by taking the scene directly
Definition SceneManager.cpp:170
auto onUpdate(float dt) -> void override
called once every frame.
Definition SceneManager.cpp:93
SceneManager(const SceneManager &other)=default
default copy ctor b/c this is a singleton
auto addChild(std::unique_ptr< GameObject > newChild) -> bool override
loads a scene
Definition SceneManager.cpp:135
auto popAllScenes(const Scene &sceneToKeep) -> void
Definition SceneManager.cpp:253
auto endWindow() -> void override
currently unused, but intended to but was assumed to be necessary for a proper ImGui editor
Definition SceneManager.h:111
auto operator=(const SceneManager &other) -> SceneManager &=default
default copy assignment operator b/c this is a singleton, so we can shallow copy
auto save(Stream &stream) const -> void override
Implementations will load the state of a GameObject to a th::Json object.
Definition SceneManager.cpp:107
static auto getEnum() -> Type
function required by all systems
Definition SceneManager.h:66
auto deregisterScene(Scene &scene) -> void
Definition SceneManager.cpp:282
auto onRender() -> void override
called every frame after update has been called for every object.
Definition SceneManager.cpp:98
auto getCurrentScene() const -> GameObject *
Definition SceneManager.cpp:265
auto removeOldScene(GameObject *oldScene) const -> void
remove the old root node, as well as call onSceneExit()
Definition SceneManager.cpp:112
SceneManager(SceneManager &&other) noexcept=default
default move ctor
~SceneManager() override=default
auto receiveResetKeyPressed(const Message *message) -> Message
Definition SceneManager.cpp:196
the type of elements in a basic_json container
Definition GameObject.h:32
Definition SceneManager.h:24
state updates
Definition SceneManager.h:33
state messages
Definition SceneManager.h:34
friend auto from_json(const json &j, SceneState &p) -> void
Definition SceneManager.h:46
state
Definition SceneManager.h:26
@ F
Definition SceneManager.h:28
@ T
Definition SceneManager.h:27
@ noEffect
Definition SceneManager.h:29
state renders
Definition SceneManager.h:32
friend auto to_json(json &j, const SceneState &p) -> void
Definition SceneManager.h:36