Brunot
Loading...
Searching...
No Matches
GameObject Class Referenceabstract

the base class for the engine, most things inherit from this. More...

#include <GameObject.h>

Inheritance diagram for GameObject:
[legend]
Collaboration diagram for GameObject:
[legend]

Classes

class  Key
 a Key class to be used as a key when holding GameObjects (or unique pointers to game objects) in <key, value> datasets More...

Public Member Functions

 GameObject (std::string typeName, gobj::Type parentType, gobj::Type type)
 constructor for gameobject.
virtual ~GameObject ()
 destructor for GameObject.
 GameObject (const GameObject &other)
 Copy Constructor.
auto operator= (const GameObject &other) -> GameObject &
 copy assignment operator
 GameObject (GameObject &&other) noexcept
 Move constructor.
auto operator= (GameObject &&other) noexcept -> GameObject &
 Move assignment operator.
virtual auto clone () const -> std::unique_ptr< GameObject >=0
 makes a copy a GameObject even if it's held polymorphically
virtual auto update (float dt) -> void
 called once every frame.
virtual auto endWindow () -> void=0
 currently unused, but intended to but was assumed to be necessary for a proper ImGui editor
virtual auto render () -> void
 called every frame after update has been called for every object.
virtual auto load (Stream &stream) -> void=0
 Implementations will load the state of a GameObject from a th::Json Object.
virtual auto save (Stream &stream) const -> void=0
 Implementations will load the state of a GameObject to a th::Json object.
virtual auto destroy () -> void
 Marks an GameObject to be destroyed.
virtual auto showMenu () -> void
 Called before update each frame, for calling ImGui editor code relevant to the gameObject.
virtual auto onEnterEngine () -> void
 hook that is called when a GameObject enters the Engine tree.
virtual auto for_each (std::function< void(GameObject &)> func) -> void
 applies a function to every child.
virtual auto for_each (std::function< void(const GameObject &)> func) const -> void
 applies a const function to every child.
virtual auto getParent () const -> GameObject *
 Gets the parent of a GameObject.
virtual auto parentTo (GameObject *newParent) -> bool
 Sets the GameObject as a child of another GameObject.
auto getInternalParent () const -> GameObject *
 returns the actual owning parent of the GameObject
virtual auto addChild (std::unique_ptr< GameObject > newChild) -> bool
 Adds a child to a GameObject.
virtual auto getKey () const -> Key
 Generates a unique Key that corresponds to the GameObject.
auto destroyed () const -> bool
auto getUUID () const -> gobj::UUID
auto isUUID (gobj::UUID compareUUID) const -> bool
auto getName () const -> const std::string &
 Gets the type of the object as a string.
auto getNickname () const -> const std::string &
 Gets the nickname (custom, writable name) of a GameObject.
void calculateFormattedName () const
auto getFormattedName () const -> const std::string &
 combines a GameObjects Type, Nickname, and UUID into one string, for use with logging.
auto nameEquals (const std::string &compareString) const -> bool
 check whether a GameObjects typeName is equivilent to a given string.
auto isType (gobj::Type otherType) const -> bool
 check whether the GameObject is the same as a given type.
auto getObjectType () const -> gobj::Type
 gets the internal type of the GameObject, as an enum
auto setNickname (const std::string &newNickname) -> void
 sets the GameObjects nickname.
auto updates () const -> bool
auto renders () const -> bool
auto receivesMessages () const -> bool
auto isActive () const -> bool
virtual auto setShouldUpdate (const bool _shouldUpdate) -> void
 set whether the GameObject should update every frame, and whether all of it's children should update every frame
virtual auto setShouldRender (const bool _shouldRender) -> void
 set whether the GameObject should render every frame, and whether all of it's children should render every frame
virtual auto setShouldReceiveMessages (const bool _shouldReceiveMessages) -> void
 set whether the GameObject should Receive Messags, and whether all of it's children should receive messages
auto setActive (const bool shouldBeActive) -> void
 set the GameObject should update, render, and receive messages

Public Attributes

friend Entity
friend Node
friend ChildrenHandeler
friend Engine

Protected Member Functions

auto setInternalParent (GameObject *parent) -> bool
 sets the internal parent of a GameObject directly, avoiding abstractions provided by ParentTo().
auto getGameObjectJson () const -> json
 Used for serializing GameObjects.
auto setGameObjectJson (const json &stream) -> void
 used for deserializing GameObjects
virtual auto getChildren () const -> std::shared_ptr< std::vector< GameObject * > >
 gets a vector of a GameObjects public (i.e.
auto checkAddToSceneHook () -> void
 Determine if the GameObject was recently added to the engine, and if it was, call onEngineEnter.

Private Member Functions

virtual auto onUpdate (float dt) -> void=0
 called once every frame.
virtual auto onRender () -> void=0
 called every frame after update has been called for every object.

Private Attributes

const gobj::UUID uuid
 a unique ID for each GameObject
bool isDestroyed
 whether the GameObject has been destroyed, and if it should be deleted at the end of the frame.
gobj::Type parentType
gobj::Type type
 What type this GameObject is, for type checking, and safe casts.
GameObjectinternalParent
 The GameObject that owns and manages this GameObject.
RenderLayer renderLayer
 Currently unused, the z layer an GameObject will be drawn on.
bool shouldUpdate = true
 whether the GameObject and it's children updates
bool shouldRender = true
 whether the GameObject and it's children render
bool shouldReceiveMessages = true
 whether the GameObject and it's children receive messages
bool inEngine = false
 whether the GameObject is current in the Engine, underneath SceneManager
std::string typeName
 the typeName of a GameObject.
std::string nickname
 the nickname of a GameObject is used to identify in the editor.
std::string formattedName
 the combined name of the GameObject.

Detailed Description

the base class for the engine, most things inherit from this.

an abstract class

Author
Aidan Hartman (aidan.nosp@m..har.nosp@m.tman@.nosp@m.digi.nosp@m.pen.e.nosp@m.du) base implementation
Marcelo Escamilla (marce.nosp@m.lo.e.nosp@m.scamm.nosp@m.illa.nosp@m.@digi.nosp@m.pen..nosp@m.edu) JSON serialization
Date
2024/09/11

Constructor & Destructor Documentation

◆ GameObject() [1/3]

GameObject::GameObject ( std::string typeName,
gobj::Type parentType,
gobj::Type type )

constructor for gameobject.

should only ever be called by derived classes

Parameters
typeNamethe permenant typeName of the object, not unique
parentTypethe type this GameObject should be a child of
typethe type this GameObject is

◆ ~GameObject()

GameObject::~GameObject ( )
virtual

destructor for GameObject.

removes all messages a GameObject is subscribed to

Here is the call graph for this function:

◆ GameObject() [2/3]

GameObject::GameObject ( const GameObject & other)

Copy Constructor.

Parameters
otherGameObject to copy
Here is the call graph for this function:

◆ GameObject() [3/3]

GameObject::GameObject ( GameObject && other)
noexcept

Move constructor.

move operator for gameobject.

Parameters
otherGameObject to move

moves all data, other is left in invalid state. parent pointer and typeName are moved, everything else is copies

Parameters
other
Here is the call graph for this function:

Member Function Documentation

◆ addChild()

auto GameObject::addChild ( std::unique_ptr< GameObject > newChild) ->bool
nodiscardvirtual

Adds a child to a GameObject.

Default implementation is to fail, as not all GameObjects have children (e.g. System, Component) Technically this is bad OOP but that's okay right??? This makes the most sense with the current system.

In the case of Node, this adds a child GameObject (other than node), not a child node, unless it is a Node

Parameters
newChild
Returns
true if addChild succeeded, false if it failed.

Reimplemented in Entity, Node, Root, and sys::SceneManager.

Here is the call graph for this function:

◆ calculateFormattedName()

auto GameObject::calculateFormattedName ( ) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkAddToSceneHook()

auto GameObject::checkAddToSceneHook ( ) ->void
protected

Determine if the GameObject was recently added to the engine, and if it was, call onEngineEnter.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clone()

virtual auto GameObject::clone ( ) const->std::unique_ptr< GameObject >
pure virtual

makes a copy a GameObject even if it's held polymorphically

Warning
When overriding this function, make sure to set the parents object to this
Returns
a unique_ptr to a new stack allocated object that is a copy of the object

Implemented in ActionProxy, Background, Board, Button, Card, ChildrenHandeler< C >, ChildrenHandeler< Component >, ChildrenHandeler< Node >, Collider, ConfirmDestructiveActionScene, CreditsScene, Deck, Entity, MainMenuScene, MainScene, Menu, MenuPosition, NewComponentStub, Node, OptionsScene, PauseScene, Physics, Player, Root, Scene, Selector, SplashScreenScene, Sprite, sys::ActionList, sys::AudioSystem, sys::ColliderSystem, sys::DebugDraw, sys::Editor, sys::Input, sys::Messaging, sys::newSystemStub, sys::OpenGL, sys::SceneManager, sys::Scoring, sys::TestRunner, Table, Transform, TutorialScene, and WinScreenScene.

Here is the call graph for this function:

◆ destroy()

auto GameObject::destroy ( ) ->void
virtual

Marks an GameObject to be destroyed.

The GameObject will be actually removed when it is updated next

Reimplemented in Entity.

Here is the caller graph for this function:

◆ destroyed()

auto GameObject::destroyed ( ) const->bool
nodiscard

◆ endWindow()

virtual auto GameObject::endWindow ( ) ->void
pure virtual

currently unused, but intended to but was assumed to be necessary for a proper ImGui editor

Implemented in ActionProxy, Background, Board, Button, Card, ChildrenHandeler< C >, ChildrenHandeler< Component >, ChildrenHandeler< Node >, Collider, ConfirmDestructiveActionScene, CreditsScene, Deck, Entity, MainMenuScene, MainScene, Menu, MenuPosition, NewComponentStub, Node, OptionsScene, PauseScene, Physics, Player, Root, Scene, Selector, SplashScreenScene, Sprite, sys::ActionList, sys::AudioSystem, sys::ColliderSystem, sys::DebugDraw, sys::Editor, sys::Input, sys::Messaging, sys::newSystemStub, sys::OpenGL, sys::SceneManager, sys::Scoring, sys::TestRunner, Table, Transform, TutorialScene, and WinScreenScene.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ for_each() [1/2]

auto GameObject::for_each ( std::function< void(const GameObject &)> func) const->void
virtual

applies a const function to every child.

applies to internal children, not public children. (this means that entities will only update their components, not their child entities)

Parameters
funca function that takes a C reference, and does some operation using it

Reimplemented in ChildrenHandeler< C >, Entity, and Node.

Here is the call graph for this function:

◆ for_each() [2/2]

auto GameObject::for_each ( std::function< void(GameObject &)> func) ->void
virtual

applies a function to every child.

applies to internal children, not public children. (this means that entities will only update their components, not their child entities)

Parameters
funca function that takes a GameObject reference, and does some operation on it

Reimplemented in ChildrenHandeler< C >, Entity, and Node.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getChildren()

auto GameObject::getChildren ( ) const->std::shared_ptr< std::vector< GameObject * > >
protectedvirtual

gets a vector of a GameObjects public (i.e.

Entity s Entity and Component children)

Returns
a shared pointer to a vector of GameObject pointers, pointing to ALL of a GameObjects Public Children

Reimplemented in ChildrenHandeler< C >, ChildrenHandeler< Component >, ChildrenHandeler< Node >, Component, Entity, and Node.

Here is the call graph for this function:

◆ getFormattedName()

auto GameObject::getFormattedName ( ) const->conststd::string &
nodiscard

combines a GameObjects Type, Nickname, and UUID into one string, for use with logging.

The string will be formatted "type::nickname::uuid"

Returns
a string formatted for logging
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getGameObjectJson()

auto GameObject::getGameObjectJson ( ) const->json
protected

Used for serializing GameObjects.

Warning
this function's implementation needs to be updated when more member functions are added to GameObject
Returns
a json object for all of the data of the GameObject

◆ getInternalParent()

auto GameObject::getInternalParent ( ) const->GameObject *
nodiscard

returns the actual owning parent of the GameObject

Warning
Don't use this unless getParent() doesn't return the correct parent. This is only intended to be used by the "Backend" of the Engine.
See also
getParent()
Returns
a pointer to the object that owns this GameObject
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getKey()

auto GameObject::getKey ( ) const->Key
nodiscardvirtual

Generates a unique Key that corresponds to the GameObject.

Unique per GameObject, not per call. Virtual so that GameObjects with subtypes (like System s and Component s) can override it to return a Key with a subtype.

Returns
A GameObject::Key, which can be used to sort GameObjects

Reimplemented in Component, and System.

Here is the caller graph for this function:

◆ getName()

auto GameObject::getName ( ) const->conststd::string &
nodiscard

Gets the type of the object as a string.

Returns
the typename of the GameObject
Here is the caller graph for this function:

◆ getNickname()

auto GameObject::getNickname ( ) const->conststd::string &
nodiscard

Gets the nickname (custom, writable name) of a GameObject.

Returns
the Nickname of the GameObject
Here is the caller graph for this function:

◆ getObjectType()

auto GameObject::getObjectType ( ) const->gobj::Type
nodiscard

gets the internal type of the GameObject, as an enum

Returns
the internal type
Here is the caller graph for this function:

◆ getParent()

auto GameObject::getParent ( ) const->GameObject *
virtual

Gets the parent of a GameObject.

Implementations differs depending on what the GameObject is, but using getParent will do the same thing for all GameObjects: get whatever is higher up than the GameObject on the Node tree.

The default implementation calls getInternalParent(), but many classes override this for more complex parent requirements, like with Entity, or Node

Returns
a raw pointer to the parent of the object

Reimplemented in System.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getUUID()

auto GameObject::getUUID ( ) const->gobj::UUID
nodiscard
Here is the caller graph for this function:

◆ isActive()

auto GameObject::isActive ( ) const->bool
nodiscard
Returns
whether the GameObject updates, renders, and receives messages
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isType()

auto GameObject::isType ( gobj::Type otherType) const->bool
nodiscard

check whether the GameObject is the same as a given type.

This check otherType against an internal Enum, so that type can be checked to ensure safe casting.

Parameters
otherTypethe enum of the type to compare against
Returns
whether the GameObjects type is the same as otherType
Here is the caller graph for this function:

◆ isUUID()

auto GameObject::isUUID ( gobj::UUID compareUUID) const->bool
nodiscard

◆ load()

virtual auto GameObject::load ( Stream & stream) ->void
pure virtual

Implementations will load the state of a GameObject from a th::Json Object.

Unimplemented in GameObject

Parameters
streamth::Json Object

Implemented in ActionProxy, Background, Board, Button, Card, ChildrenHandeler< C >, ChildrenHandeler< Component >, ChildrenHandeler< Node >, Collider, ConfirmDestructiveActionScene, CreditsScene, Deck, Entity, MainMenuScene, MainScene, Menu, MenuPosition, NewComponentStub, Node, OptionsScene, PauseScene, Physics, Player, Root, Scene, Selector, SplashScreenScene, Sprite, sys::ActionList, sys::AudioSystem, sys::ColliderSystem, sys::DebugDraw, sys::Editor, sys::Input, sys::Messaging, sys::newSystemStub, sys::OpenGL, sys::SceneManager, sys::Scoring, sys::TestRunner, Table, Transform, TutorialScene, and WinScreenScene.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nameEquals()

auto GameObject::nameEquals ( const std::string & compareString) const->bool
nodiscard

check whether a GameObjects typeName is equivilent to a given string.

this function is provided as a utility function, since most cases where the TypeName is accessed is just to compare

Parameters
compareStringa string to compare against
Returns
whether the TypeName and compare string are equivelent

◆ onEnterEngine()

virtual auto GameObject::onEnterEngine ( ) ->void
inlinevirtual

hook that is called when a GameObject enters the Engine tree.

The hook is called immedietly after a gameobject's parent is called. Functionality may not be correct if an object was removed from the engine then re-added

Reimplemented in Board, Button, ChildrenHandeler< C >, ChildrenHandeler< Component >, ChildrenHandeler< Node >, Collider, Entity, MainMenuScene, MainScene, Menu, Node, OptionsScene, Scene, SplashScreenScene, sys::ColliderSystem, sys::OpenGL, and Table.

Here is the caller graph for this function:

◆ onRender()

virtual auto GameObject::onRender ( ) ->void
privatepure virtual

called every frame after update has been called for every object.

Generally used for rendering an object to the screen, when applicable. Unimplemented in GameObject

Implemented in ActionProxy, Background, Board, Button, Card, ChildrenHandeler< C >, ChildrenHandeler< Component >, ChildrenHandeler< Node >, Collider, ConfirmDestructiveActionScene, CreditsScene, Deck, Entity, MainMenuScene, MainScene, Menu, MenuPosition, NewComponentStub, Node, OptionsScene, PauseScene, Physics, Player, Root, Scene, Selector, SplashScreenScene, Sprite, sys::ActionList, sys::AudioSystem, sys::ColliderSystem, sys::DebugDraw, sys::Editor, sys::Input, sys::Messaging, sys::newSystemStub, sys::OpenGL, sys::SceneManager, sys::Scoring, sys::TestRunner, Table, Transform, TutorialScene, and WinScreenScene.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ onUpdate()

virtual auto GameObject::onUpdate ( float dt) ->void
privatepure virtual

called once every frame.

Generally used for timers, movement, condition checks, etc. Unimplemented in GameObject

Parameters
dtthe time in seconds that has elapsed

Implemented in ActionProxy, Background, Board, Button, Card, ChildrenHandeler< C >, ChildrenHandeler< Component >, ChildrenHandeler< Node >, Collider, ConfirmDestructiveActionScene, CreditsScene, Deck, Entity, MainMenuScene, MainScene, Menu, MenuPosition, NewComponentStub, Node, OptionsScene, PauseScene, Physics, Player, Root, Scene, Selector, SplashScreenScene, Sprite, sys::ActionList, sys::AudioSystem, sys::ColliderSystem, sys::DebugDraw, sys::Editor, sys::Input, sys::Messaging, sys::newSystemStub, sys::OpenGL, sys::SceneManager, sys::Scoring, sys::TestRunner, Table, Transform, TutorialScene, and WinScreenScene.

Referenced by onUpdate(), and update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/2]

auto GameObject::operator= ( const GameObject & other) ->GameObject &

copy assignment operator

copy assignment operator for gameobject, used by derived classes

Parameters
otherGameObject to copy
Returns
Parameters
other
Returns
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [2/2]

auto GameObject::operator= ( GameObject && other) ->GameObject &
noexcept

Move assignment operator.

move operator for gameobject.

Parameters
otherGameObject to move
Returns
reference to the GameObject moved to

moves all data, other is left in invalid state. parent pointer and typeName are moved, everything else is copies

Parameters
other
Here is the call graph for this function:

◆ parentTo()

auto GameObject::parentTo ( GameObject * newParent) ->bool
nodiscardvirtual

Sets the GameObject as a child of another GameObject.

calls setInternalParent() by default, but can be overriden by GameObjects complicated parent requirements, like Entity. Validates pointer and requires type to be valid

Parameters
newParentthe GameObject that this GameObject will be a child of
Returns
whether parenting succeeded

calls setInternalParent() by default, can be overriden by complicated parent requirements, like Entity. Validates pointer and requires type to be valid

Parameters
newParentthe GameObject to parent to
Returns
whether parenting succeeded

Reimplemented in ActionProxy, and Transform.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ receivesMessages()

auto GameObject::receivesMessages ( ) const->bool
nodiscard
Returns
whether the GameObject receives messages
Here is the caller graph for this function:

◆ render()

auto GameObject::render ( ) ->void
virtual

called every frame after update has been called for every object.

Generally used for rendering an object to the screen, when applicable. override to ensure proper rendering of children that may be active calls onRender for implementation by concrete classes make sure you call GameObject::Update() when overriding

Reimplemented in ChildrenHandeler< C >, ChildrenHandeler< Component >, ChildrenHandeler< Node >, Entity, and Node.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ renders()

auto GameObject::renders ( ) const->bool
nodiscard
Returns
whether the GameObject renders
Here is the caller graph for this function:

◆ save()

virtual auto GameObject::save ( Stream & stream) const->void
pure virtual

Implementations will load the state of a GameObject to a th::Json object.

Unimplemented in GameObject

Parameters
streamth::Json Object

Implemented in ActionProxy, Background, Board, Button, Card, ChildrenHandeler< C >, ChildrenHandeler< Component >, ChildrenHandeler< Node >, Collider, ConfirmDestructiveActionScene, CreditsScene, Deck, Entity, MainMenuScene, MainScene, Menu, MenuPosition, NewComponentStub, Node, OptionsScene, PauseScene, Physics, Player, Root, Scene, Selector, SplashScreenScene, Sprite, sys::ActionList, sys::AudioSystem, sys::ColliderSystem, sys::DebugDraw, sys::Editor, sys::Input, sys::Messaging, sys::newSystemStub, sys::OpenGL, sys::SceneManager, sys::Scoring, sys::TestRunner, Table, Transform, TutorialScene, and WinScreenScene.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setActive()

auto GameObject::setActive ( const bool shouldBeActive) ->void

set the GameObject should update, render, and receive messages

Parameters
shouldBeActivewhether the GameObject should be active
Here is the call graph for this function:

◆ setGameObjectJson()

auto GameObject::setGameObjectJson ( const json & stream) ->void
protected

used for deserializing GameObjects

Warning
this function's implementation needs to be updated when more member functions are added to GameObjecet
Parameters
streama json object with all the data of the GameObject
Here is the call graph for this function:

◆ setInternalParent()

auto GameObject::setInternalParent ( GameObject * parent) ->bool
protected

sets the internal parent of a GameObject directly, avoiding abstractions provided by ParentTo().

It also type checks to make sure the parent is valid

Warning
Don't use this, it will overwrite the parent of an object, and will break anything that has to do with Nodes
Parameters
parentthe new parent
Returns
whether adding the parent succeeded

sets the actual parent object, don't call this function unless parentTo() is overriden and you need to directly set the parent (like in entity's implementation of parentTo

Parameters
parentthe GameObject to parent to
Returns
whether the parent is valid and succeeded
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setNickname()

auto GameObject::setNickname ( const std::string & newNickname) ->void

sets the GameObjects nickname.

Nicknames are non-unique, and user defined. helpful for making Entities more readable nickname should start lowercase, so that they don't conflict with Type names (of components especially)

Parameters
newNicknamethe new nickname
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setShouldReceiveMessages()

auto GameObject::setShouldReceiveMessages ( const bool _shouldReceiveMessages) ->void
virtual

set whether the GameObject should Receive Messags, and whether all of it's children should receive messages

Parameters
_shouldReceiveMessageswhether the GameObject should receive messages

Reimplemented in ChildrenHandeler< C >, ChildrenHandeler< Component >, ChildrenHandeler< Node >, Entity, and Node.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setShouldRender()

auto GameObject::setShouldRender ( const bool _shouldRender) ->void
virtual

set whether the GameObject should render every frame, and whether all of it's children should render every frame

Parameters
_shouldRenderwhether the GameObject should Render

Reimplemented in ChildrenHandeler< C >, ChildrenHandeler< Component >, ChildrenHandeler< Node >, Entity, and Node.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setShouldUpdate()

auto GameObject::setShouldUpdate ( const bool _shouldUpdate) ->void
virtual

set whether the GameObject should update every frame, and whether all of it's children should update every frame

Parameters
_shouldUpdatewhether the object should update

Reimplemented in ChildrenHandeler< C >, ChildrenHandeler< Component >, ChildrenHandeler< Node >, Entity, and Node.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ showMenu()

virtual auto GameObject::showMenu ( ) ->void
inlinevirtual

Called before update each frame, for calling ImGui editor code relevant to the gameObject.

virtual because we might need to destroy other things too, like parent node for entity Has a empty definition in GameObject, so it may be overriden, but doesn't have to be.

Reimplemented in ChildrenHandeler< C >, ChildrenHandeler< Component >, ChildrenHandeler< Node >, Component, Entity, Node, Root, sys::Scoring, and System.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update()

auto GameObject::update ( float dt) ->void
virtual

called once every frame.

Generally used for timers, movement, condition checks, etc. calls onUpdate for implementation by concrete classes. override to properly call children make sure you call GameObject::Update() when overriding

Parameters
dtthe time in seconds that has elapsed

Reimplemented in ChildrenHandeler< C >, ChildrenHandeler< Component >, ChildrenHandeler< Node >, Entity, and Node.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updates()

auto GameObject::updates ( ) const->bool
nodiscard
Returns
whether the GameObject updates
Here is the caller graph for this function:

Member Data Documentation

◆ ChildrenHandeler

friend GameObject::ChildrenHandeler

◆ Engine

friend GameObject::Engine

◆ Entity

friend GameObject::Entity

◆ formattedName

std::string GameObject::formattedName
mutableprivate

the combined name of the GameObject.

NAME::NICKNAME::UUID

◆ inEngine

bool GameObject::inEngine = false
private

whether the GameObject is current in the Engine, underneath SceneManager

◆ internalParent

GameObject* GameObject::internalParent
private

The GameObject that owns and manages this GameObject.

This is sometime different from the parent in the Node tree

◆ isDestroyed

bool GameObject::isDestroyed
private

whether the GameObject has been destroyed, and if it should be deleted at the end of the frame.

◆ nickname

std::string GameObject::nickname
private

the nickname of a GameObject is used to identify in the editor.

give a specific name to the object. The nickname should start lowercase, to avoid conflicting with typenames.

◆ Node

friend GameObject::Node

◆ parentType

gobj::Type GameObject::parentType
private

◆ renderLayer

RenderLayer GameObject::renderLayer
private

Currently unused, the z layer an GameObject will be drawn on.

◆ shouldReceiveMessages

bool GameObject::shouldReceiveMessages = true
private

whether the GameObject and it's children receive messages

◆ shouldRender

bool GameObject::shouldRender = true
private

whether the GameObject and it's children render

◆ shouldUpdate

bool GameObject::shouldUpdate = true
private

whether the GameObject and it's children updates

◆ type

gobj::Type GameObject::type
private

What type this GameObject is, for type checking, and safe casts.

◆ typeName

std::string GameObject::typeName
private

the typeName of a GameObject.

defaults to whatever the concrete class is (set by concrete class in constructor)

Warning
for some GameObjects, the typeName is used as a type for serialization, so to have custom names for objects, it may be required to add another member variable
Todo
: make string in gameobjects const

◆ uuid

const gobj::UUID GameObject::uuid
private

a unique ID for each GameObject


The documentation for this class was generated from the following files:
  • /home/egrazil/sites/Brunot/The House/source/Framework/GameObject.h
  • /home/egrazil/sites/Brunot/The House/source/Framework/GameObject.cpp