43#pragma region Ctors dtors and assignments
49 explicit Node(std::unique_ptr<GameObject> gamobj);
60#pragma region overloaded functions
65 auto
update(
float dt) ->
void override;
66 auto
onUpdate(
float dt) ->
void override;
71 auto render() ->
void override;
77 auto save(
Stream& stream)
const ->
void override;
133#pragma region node_functions
141 template <
typename type>
144 assert(
data->isType(typeId));
145 return static_cast<type*
>(&(*data));
155 template <
typename type>
158 assert(
data->isType(typeId));
159 return std::unique_ptr<type>(
dynamic_cast<type*
>(
data.release()));
174 auto
add(std::unique_ptr<
Node> child) ->
bool;
211 auto
pop() -> std::unique_ptr<
Node>;
219#pragma region GetItrFunctions
220 template <
typename T>
231#pragma region NodeIterator
232#define NodeIteratorImplemented 0
233#if NodeIteratorImplemented
240 static_assert(std::bidirectional_iterator<Itr>);
sys::Json Stream
Definition AudioObject.h:20
The class containing Json implemenation for building components.
the base class for the engine, most things inherit from this.
nlohmann::json json
Definition Json.cpp:19
the base class for the engine, most things inherit from this.
Definition GameObject.h:77
friend ChildrenHandeler
Definition GameObject.h:87
friend Node
Definition GameObject.h:86
GameObject(std::string typeName, gobj::Type parentType, gobj::Type type)
constructor for gameobject.
Definition GameObject.cpp:23
gobj::Type type
What type this GameObject is, for type checking, and safe casts.
Definition GameObject.h:490
Manages the heirarchical structure between Systems and Entities.
Definition Node.h:41
auto deRegisterRecursively() const -> void
Tell Messaging to remove all messages to this Node, it's data, and all of it's children,...
Definition Node.cpp:467
auto getParent() const -> Node *override
Definition Node.cpp:344
auto GetData(gobj::Type typeId) const -> type *
Gets a pointer to the data held by a node.
Definition Node.h:142
Node(Node &&other) noexcept=delete
auto onEnterEngine() -> void override
hook that is called when a GameObject enters the Engine tree.
Definition Node.cpp:315
auto onUpdate(float dt) -> void override
called once every frame.
Definition Node.cpp:298
auto moveParent() -> void
Holds the ImGui functionality for moving a node to a different parent in the Engine tree.
Definition Node.cpp:245
auto findDirect(const std::function< bool(GameObject &)> &predicate) -> GameObject *
Finds a GameObject somewhere in the nodes direct children.
Definition Node.cpp:449
std::unique_ptr< GameObject > data
Definition Node.h:266
auto setShouldReceiveMessages(const bool _shouldReceiveMessages) -> void override
set whether the Node, its data, and its children should receiveMessages
Definition Node.cpp:379
auto onRender() -> void override
called every frame after update has been called for every object.
Definition Node.cpp:311
auto showMenu() -> void override
Called before update each frame, for calling ImGui editor code relevant to the gameObject.
Definition Node.cpp:102
friend auto from_json(const json &j, Node &n) -> void
Definition Node.cpp:506
auto setShouldUpdate(const bool _shouldUpdate) -> void override
set whether the Node, its data, and its children should update every frame
Definition Node.cpp:361
auto add(std::unique_ptr< Node > child) -> bool
Gives a node a new Child node.
Definition Node.cpp:393
auto for_each(std::function< void(GameObject &)> func) -> void override
applies a function to every child.
Definition Node.cpp:321
auto addChild(std::unique_ptr< GameObject > newChild) -> bool override
Adds a child to a Node.
Definition Node.cpp:349
auto GetChildren() const
Definition Node.cpp:528
ChildrenHandeler< Node > children
Definition Node.h:267
auto pop() -> std::unique_ptr< Node >
removes this Node from it's parent, handing ownership to the caller
Definition Node.cpp:490
auto ExtractData(gobj::Type typeId) -> std::unique_ptr< type >
removes the data from the node, and relenquishes ownership of it.
Definition Node.h:156
auto load(Stream &stream) -> void override
Implementations will load the state of a GameObject from a th::Json Object.
Definition Node.cpp:331
auto setShouldRender(const bool _shouldRender) -> void override
set whether the Node, its data, and its children should render every frame
Definition Node.cpp:370
auto dataItr() -> GameObject *
Definition Node.h:221
auto operator=(const Node &other) -> Node &
Definition Node.cpp:45
auto getChildren() const -> std::shared_ptr< std::vector< GameObject * > > override
gets a vector of a GameObjects public (i.e.
Definition Node.cpp:515
auto isDescendantOf(const Node *potentialParent) const -> bool
helper function to determine if a node is a descendant of another node.
Definition Node.cpp:228
auto save(Stream &stream) const -> void override
Implementations will load the state of a GameObject to a th::Json object.
Definition Node.cpp:339
auto dragAndDrop() -> void
wrapper function around the drag and drop source functionality in ImGui.
Definition Node.cpp:210
auto endWindow() -> void override
currently unused, but intended to but was assumed to be necessary for a proper ImGui editor
Definition Node.h:68
Node(std::unique_ptr< GameObject > gamobj)
Definition Node.cpp:27
auto dataType() const -> gobj::Type
Definition Node.cpp:404
auto update(float dt) -> void override
called once every frame.
Definition Node.cpp:284
auto render() -> void override
called every frame after update has been called for every object.
Definition Node.cpp:302
auto clone() const -> std::unique_ptr< GameObject > override
makes a copy a GameObject even if it's held polymorphically
Definition Node.cpp:97
void dragTarget()
Definition Node.cpp:183
auto getDataAsGameObj() const -> GameObject *
gives a GameObject* to the data held by the node.
Definition Node.cpp:388
friend auto to_json(json &j, const Node &n) -> void
Definition Node.cpp:495
auto find(const std::function< bool(GameObject &)> &predicate) -> GameObject *
Finds a GameObject somewhere in the nodes lower (children, grandchildren, etc.) than the node.
Definition Node.cpp:413
auto operator=(Node &&other) noexcept -> Node &=delete
namespace for things relating to GameObject, other than GameObject itself
Definition Entity.h:229
Type
Definition GameObject.h:45