hx3d  1
2D/3D Simple Game Framework
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
hx3d::ecs::Node Class Reference

Base node to use in a SceneGraph or an Engine. More...

#include <node.hpp>

Public Member Functions

 Node (const std::string name)
 Create a named Node. Should not be used directly. More...
 
template<class T , class... Args>
Ptr< T > createChild (SceneGraph &sg, const std::string name, Args...args)
 Create a new child Node, using the SceneGraph. More...
 
template<class T >
Ptr< T > getChild (const std::string name)
 Get one child. More...
 
void removeChild (SceneGraph &sg, const std::string name)
 Remove a child, using the SceneGraph. More...
 
graphics::Transform getFullTransform ()
 Get the game object full transform. More...
 
std::string getPath ()
 Get the game object full path from the root. More...
 
void destroy (SceneGraph &sg)
 Destroy the node. More...
 
unsigned int getChildCount ()
 Get the recursive child count. More...
 
std::string getName ()
 Get the node name. More...
 
virtual void draw (graphics::BaseBatch &batch)
 Draw the node. More...
 
virtual void update (const float delta)
 Update the node. More...
 
- Public Member Functions inherited from hx3d::ecs::Entity
 Entity (const unsigned int id)
 Construct an entity with a unique id. More...
 
unsigned int getId () const
 Get the entity ID. More...
 
void setId (const unsigned int id)
 Change the entity ID. More...
 

Public Attributes

graphics::Transform transform
 Current transform.
 

Protected Member Functions

bool childNameExists (const std::string name)
 Test if the object have a child. More...
 

Protected Attributes

std::string _name
 Current name.
 
Ptr< Node_parent
 Parent node.
 
std::vector< Ptr< Node > > _children
 Children nodes.
 

Detailed Description

Base node to use in a SceneGraph or an Engine.

Definition at line 42 of file node.hpp.

Constructor & Destructor Documentation

hx3d::ecs::Node::Node ( const std::string  name)

Create a named Node. Should not be used directly.

To create a Node, use a SceneGraph.

See also
SceneGraph::create
SceneGraph::createAtRoot
Parameters
nameName

Definition at line 26 of file node.cpp.

Member Function Documentation

bool hx3d::ecs::Node::childNameExists ( const std::string  name)
protected

Test if the object have a child.

Parameters
nameName
Returns
True/False

Definition at line 92 of file node.cpp.

template<class T , class... Args>
Ptr< T > hx3d::ecs::Node::createChild ( SceneGraph sg,
const std::string  name,
Args...  args 
)

Create a new child Node, using the SceneGraph.

Parameters
sgSceneGraph
nameName
argsArguments
Returns
Node

Definition at line 27 of file node.inl.hpp.

void hx3d::ecs::Node::destroy ( SceneGraph sg)

Destroy the node.

Parameters
sgSceneGraph

Definition at line 76 of file node.cpp.

void hx3d::ecs::Node::draw ( graphics::BaseBatch batch)
virtual

Draw the node.

Parameters
batchBatch

Definition at line 72 of file node.cpp.

template<class T >
Ptr< T > hx3d::ecs::Node::getChild ( const std::string  name)

Get one child.

Parameters
nameName
Returns
Node

Definition at line 33 of file node.inl.hpp.

unsigned int hx3d::ecs::Node::getChildCount ( )

Get the recursive child count.

Returns
Child count

Definition at line 80 of file node.cpp.

graphics::Transform hx3d::ecs::Node::getFullTransform ( )

Get the game object full transform.

Returns
Full transform;

Definition at line 30 of file node.cpp.

std::string hx3d::ecs::Node::getName ( )

Get the node name.

Returns
Name

Definition at line 68 of file node.cpp.

std::string hx3d::ecs::Node::getPath ( )

Get the game object full path from the root.

Returns
Path

Definition at line 48 of file node.cpp.

void hx3d::ecs::Node::removeChild ( SceneGraph sg,
const std::string  name 
)

Remove a child, using the SceneGraph.

Parameters
sgSceneGraph
nameName

Definition at line 38 of file node.cpp.

void hx3d::ecs::Node::update ( const float  delta)
virtual

Update the node.

Parameters
deltaDelta time

Definition at line 74 of file node.cpp.


The documentation for this class was generated from the following files: