TurtleBrains  0.3.5
High quality, portable, C++ framework for rapid 2D game development.
TurtleBrains::Core::Node Class Reference
Inheritance diagram for TurtleBrains::Core::Node:
TurtleBrains::Core::Noncopyable

Public Types

enum class  ChildIndexType : uint16
 
using ChildIndex = TypedInteger< ChildIndexType >
 
using ConstChildContainerAccessor = OtherTypedRange< ChildIndex, const Node & >
 
using ChildContainerAccessor = OtherTypedRange< ChildIndex, Node & >
 

Public Member Functions

 Node (const NodeKey &nodeKey=NodeKey::Invalid())
 
bool HasParent (void) const
 
NodeGetParent (void) const
 
void ClearChildren (void)
 
ChildIndex AddChild (const NodeKey &nodeKey=NodeKey::Invalid(), const String &name="")
 
ChildIndex AddChild (std::unique_ptr< Node > &&childNode)
 
ChildIndex AddChild (Node &childNode)
 
const ChildIndex GetNumberOfChildren (void) const
 
const NodeGetChild (const ChildIndex childIndex) const
 
NodeGetChild (const ChildIndex childIndex)
 
ConstChildContainerAccessor AllChildren (void) const
 
ChildContainerAccessor AllChildren (void)
 
NodeImplementation::NodeHierarchyAccessor< const NodeRecurseTree (const NodeKey &nodeKey, Recursive recursive=Recursive::Yes) const
 
NodeImplementation::NodeHierarchyAccessor< const NodeRecurseTree (Recursive recursive=Recursive::Yes) const
 
NodeImplementation::NodeHierarchyAccessor< NodeRecurseTree (const NodeKey &nodeKey, Recursive recursive=Recursive::Yes)
 
NodeImplementation::NodeHierarchyAccessor< NodeRecurseTree (Recursive recursive=Recursive::Yes)
 
const NodeFindChildByName (const String &childName, Recursive recursive=Recursive::No) const
 
NodeFindChildByName (const String &childName, Recursive recursive=Recursive::No)
 
const NodeFindChildByKey (const NodeKey &childNodeKey, Recursive recursive=Recursive::No) const
 
NodeFindChildByKey (const NodeKey &childNodeKey, Recursive recursive=Recursive::No)
 
ChildIndex FindChildIndexByName (const String &childName) const
 
ChildIndex FindChildIndexByKey (const NodeKey &childNodeKey) const
 
void RemoveAllComponents (void)
 
ComponentAddComponent (ComponentPointer &&component)
 
template<typename ComponentType >
ComponentType * AddComponent (void)
 
const ComponentGetComponent (const ComponentKey &componentKey) const
 
ComponentGetComponent (const ComponentKey &componentKey)
 
const ComponentGetComponentByType (const ComponentTypeKey &componentTypeKey) const
 
ComponentGetComponentByType (const ComponentTypeKey &componentTypeKey)
 
template<typename ComponentType >
const ComponentType * GetComponent (void) const
 
template<typename ComponentType >
ComponentType * GetComponent (void)
 
template<typename ComponentType >
const std::vector< const ComponentType * > GetComponents (void) const
 
template<typename ComponentType >
std::vector< ComponentType * > GetComponents (void)
 
size_t GetNumberOfComponents (void) const
 
const ComponentGetComponent (const size_t componentIndex) const
 
ComponentGetMutableComponent (const size_t componentIndex)
 
bool IsActive (void) const
 
bool IsActiveSelf (void) const
 
void SetActive (const bool active)
 
const StringGetName (void) const
 
void SetName (const String &name)
 
const NodeKeyGetKey (void) const
 
const tbMath::Matrix4GetObjectToWorld (void) const
 
void SetObjectToWorld (const tbMath::Matrix4 &objectToWorld)
 
const tbMath::Matrix4GetObjectToParent (void) const
 
void SetObjectToParent (const tbMath::Matrix4 &objectToParent)
 
tbMath::Vector3 GetPosition (void) const
 
tbMath::Vector3 GetLocalPosition (void) const
 
tbMath::Vector3 GetRight (void) const
 
tbMath::Vector3 GetUp (void) const
 
tbMath::Vector3 GetForward (void) const
 
tbMath::Vector3 GetScale (const Space space=Space::Local) const
 
void SetScale (const tbMath::Vector3 &localScale)
 
tbMath::Matrix3 GetOrientation (const Space space=Space::Local) const
 
void Rotate (const tbMath::Vector3 &eulerAngles, const Space space=Space::Local)
 
void Translate (const tbMath::Vector3 &amount, const Space space=Space::Local)
 
void Simulate (void)
 
void Update (const float deltaTime)
 
void Render (void) const
 

Static Public Member Functions

static constexpr ChildIndex InvalidChild (void)
 

Protected Member Functions

virtual void OnAwake (void)
 
virtual void OnDestroy (void)
 
virtual void OnActivate (void)
 
virtual void OnDeactivate (void)
 
virtual void OnSimulate (void)
 
virtual void OnUpdate (const float deltaTime)
 
virtual void OnRender (void) const
 

Member Function Documentation

◆ AddChild()

ChildIndex TurtleBrains::Core::Node::AddChild ( Node childNode)
Note
Like other AddGraphic/AddThing functions the version taking a reference will not manage the object,

◆ HasParent()

bool TurtleBrains::Core::Node::HasParent ( void  ) const
inline

Child/Parent Stuffs

◆ RemoveAllComponents()

void TurtleBrains::Core::Node::RemoveAllComponents ( void  )

Component Stuffs

◆ SetActive()

void TurtleBrains::Core::Node::SetActive ( const bool  active)
Note
Active / Enabled states are currently completely ignoring any parent/child chains. So a child may be active/enabled even without the parent being active/enabled. This obviously goes against the future plans, so, tread lightly!
Can not make the Node/object active when a parent above is not active. Will call OnActivate() or OnDeactive() only if the current state of the Node changed.