![]() |
Meteor2D
dev internal
Meteor is a lightweight 2D game engine.
|
Spatial Entity is the base entity for all types present in scene. This entity keeps track of spatial data within a scene. new instance when not given a parent, will sit at the root of the active scene. More...
#include <spatial.h>

Public Member Functions | |
| MSpatialEntity () | |
| Default constructor, instantiates at root level. | |
| MSpatialEntity (MSpatialEntity *parent) | |
| Parameterised constructor. | |
| SVector2 | getPosition () |
| SVector2 | getLocalPosition () |
| void | setLocalPosition (float x, float y) |
| Sets local position of the entity. | |
| void | setLocalPosition (SVector2 pos) |
| Sets local position of the entity. | |
| float | getRotation () |
| float | getLocalRotation () |
| void | setLocalRotation (float localRotation) |
| Sets local rotation of the entity in x-axis. | |
| SVector2 | getLocalScale () |
| void | setLocalScale (float x, float y) |
| Sets local scale. | |
| void | setLocalScale (SVector2 scale) |
| brief Sets local scale | |
| MSpatialEntity * | getParent () |
| std::vector< MSpatialEntity * > * | getChildren () |
| void | addChild (MSpatialEntity *entity) |
| Adds a child to this entity. | |
| void | removeChild (MSpatialEntity *entity) |
| Remove a child from this entity. | |
| template<typename T > | |
| T * | find (std::string name) |
| Recursively searches for a SpatialEntity within this sub-tree. | |
| virtual void | onStart () |
| virtual void | onUpdate (float deltaTime) |
| virtual void | onExit () |
Public Member Functions inherited from meteor::MEntity | |
| virtual bool | equals (MEntity *other) |
| Checks equality between two entities. | |
| std::string | getName () |
| void | setName (std::string name) |
| Sets name of entity. | |
| virtual std::string | toString () |
| Get this object as a string. | |
Protected Member Functions | |
| void | updatePositions () |
| void | updateRotations () |
| void | updateScale () |
| void | updateChildren (float deltaTime) |
Protected Attributes | |
| SVector2 | localPosition |
| SVector2 | localScale |
| SVector2 | position |
| float | rotation |
| float | localRotation |
| MSpatialEntity * | parent = NULL |
| std::vector< MSpatialEntity * > * | children = NULL |
Protected Attributes inherited from meteor::MEntity | |
| std::string | name |
Spatial Entity is the base entity for all types present in scene. This entity keeps track of spatial data within a scene. new instance when not given a parent, will sit at the root of the active scene.
| meteor::MSpatialEntity::MSpatialEntity | ( | MSpatialEntity * | parent | ) |
Parameterised constructor.
| parent | Parent entity for this child. |
| void meteor::MSpatialEntity::addChild | ( | MSpatialEntity * | entity | ) |
Adds a child to this entity.
| entity | Child to add. |
|
inline |
Recursively searches for a SpatialEntity within this sub-tree.
| T | type of Entity to return, needs to be child of SpatialEntity. |
| name | Name of entity to search for. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| void meteor::MSpatialEntity::removeChild | ( | MSpatialEntity * | entity | ) |
Remove a child from this entity.
| entity | Child to remove. |
|
inline |
Sets local position of the entity.
| x | x-component of the position |
| y | y-component of the position |
|
inline |
Sets local position of the entity.
| pos | position as a Vector2 |
|
inline |
Sets local rotation of the entity in x-axis.
| localRotation | rotation in x-axis (0-360); |
|
inline |
Sets local scale.
| x | x-component of the scale |
| y | y-component of the scale |
|
inline |
brief Sets local scale
| scale | Scale as a Vector2 |