Brunot
Loading...
Searching...
No Matches
Root.h
Go to the documentation of this file.
1// File: Root.h
2// Description: The data the root Node points at. Engine may use this to get access to the tree.
3// Author(s): Aidan Hartman (aidan.hartman@digipen.edu) Base implementation
4// Bryley Elder (bryley.elder@digipen.edu) Fixed implementation errors
5// Marcelo Escamilla (marcelo.escamilla@digipen.edu) Fixed implementation errors
6// 2025 / 10 / 11
7// (C) Digipen 2025
8// Engine.h
9// ____ __ __ __
10// /\__ _\/\ \ /\ \/\ \
11// \/_/\ \/\ \ \___ __ \ \ \_\ \ ___ __ __ ____ __
12// \ \ \ \ \ _ `\ /'__`\ \ \ _ \ / __`\/\ \/\ \ /',__\ /'__`\
13// \ \ \ \ \ \ \ \/\ __/ \ \ \ \ \/\ \L\ \ \ \_\ \/\__, `\/\ __/
14// \ \_\ \ \_\ \_\ \____\ \ \_\ \_\ \____/\ \____/\/\____/\ \____\
15// \/_/ \/_/\/_/\/____/ \/_/\/_/\/___/ \/___/ \/___/ \/____/
16#pragma once
18
19class System;
20
21class Root : public GameObject
22{
23public:
25 : GameObject("Root", gobj::Type::Node, gobj::Type::Root)
26 {
27 }
28
29 Root(const Root& other) = delete;
30 Root(Root&& other) = delete;
31 auto operator=(const Root& other) -> Root& = delete;
32 auto operator=(Root&& other) noexcept -> Root& = delete;
33
34 auto clone() const -> std::unique_ptr<GameObject> override;
35
36 auto showMenu() -> void override
37 {
38 }; // for debug ImGUI
39 auto onUpdate(float dt) -> void override;
40
41 auto endWindow() -> void override
42 {
43 }; // for debug ImGUI
44 auto onRender() -> void override;
45 auto load(Stream& stream) -> void override;
46 auto save(Stream& stream) const -> void override;
47 [[nodiscard("adding child may fail")]] auto addChild(std::unique_ptr<GameObject> newChild) -> bool override;
48
49
54 auto setup() -> void;
55
56private:
57 template <std::derived_from<System> Sys>
58 auto startSystem() -> void;
59};
sys::Json Stream
Definition AudioObject.h:20
the base class for the engine, most things inherit from this.
friend Node
Definition GameObject.h:86
GameObject(std::string typeName, gobj::Type parentType, gobj::Type type)
constructor for gameobject.
Definition GameObject.cpp:23
auto clone() const -> std::unique_ptr< GameObject > override
makes a copy a GameObject even if it's held polymorphically
Definition Root.cpp:31
auto endWindow() -> void override
currently unused, but intended to but was assumed to be necessary for a proper ImGui editor
Definition Root.h:41
auto onRender() -> void override
called every frame after update has been called for every object.
Definition Root.cpp:41
auto operator=(Root &&other) noexcept -> Root &=delete
auto showMenu() -> void override
Called before update each frame, for calling ImGui editor code relevant to the gameObject.
Definition Root.h:36
auto setup() -> void
setup the systems needed for the game.
Definition Root.cpp:79
Root(const Root &other)=delete
auto load(Stream &stream) -> void override
Implementations will load the state of a GameObject from a th::Json Object.
Definition Root.cpp:45
Root(Root &&other)=delete
auto save(Stream &stream) const -> void override
Implementations will load the state of a GameObject to a th::Json object.
Definition Root.cpp:49
auto startSystem() -> void
template function for adding systems safely to the root/engine, with logging
Definition Root.cpp:66
auto addChild(std::unique_ptr< GameObject > newChild) -> bool override
Adds a child to a GameObject.
Definition Root.cpp:53
auto operator=(const Root &other) -> Root &=delete
Root()
Definition Root.h:24
auto onUpdate(float dt) -> void override
called once every frame.
Definition Root.cpp:36
Definition System.h:17
namespace for things relating to GameObject, other than GameObject itself
Definition Entity.h:229