4#include <meteorutils/typehelpers.h>
5#include<meteorutils/vector2d.h>
6#include<entities/entity.h>
41 inline void setLocalPosition(
float x,
float y) { localPosition.x = x; localPosition.y = y; updatePositions(); }
60 inline void setLocalRotation(
float localRotation) { this->localRotation = localRotation; }
70 inline void setLocalScale(
float x,
float y) { localScale.x = x; localScale.y = y; }
84 inline std::vector<MSpatialEntity*>*
getChildren() {
return children; }
107 if (this->name == name)
111 if (children->size() <= 0)
115 for (
auto child : *children) {
119 auto res = child->find<T>(name);
123 auto isValidInstance = instanceof<T>((T*)res);
125 if (res != NULL && isValidInstance)
133 virtual void onStart();
134 virtual void onUpdate(
float deltaTime);
135 virtual void onExit();
144 std::vector<MSpatialEntity*>* children = NULL;
146 void updatePositions();
147 void updateRotations();
150 void updateChildren(
float deltaTime);
An Entity is the base class for all data and behaviour oriented objects in meteor....
Definition entity.h:9
Spatial Entity is the base entity for all types present in scene. This entity keeps track of spatial ...
Definition spatial.h:15
void setLocalScale(SVector2 scale)
brief Sets local scale
Definition spatial.h:75
void setLocalPosition(SVector2 pos)
Sets local position of the entity.
Definition spatial.h:46
SVector2 getLocalPosition()
Definition spatial.h:35
void removeChild(MSpatialEntity *entity)
Remove a child from this entity.
std::vector< MSpatialEntity * > * getChildren()
Definition spatial.h:84
void setLocalScale(float x, float y)
Sets local scale.
Definition spatial.h:70
float getRotation()
Definition spatial.h:51
MSpatialEntity()
Default constructor, instantiates at root level.
Definition spatial.h:20
SVector2 getLocalScale()
Definition spatial.h:64
void addChild(MSpatialEntity *entity)
Adds a child to this entity.
SVector2 getPosition()
Definition spatial.h:31
MSpatialEntity(MSpatialEntity *parent)
Parameterised constructor.
float getLocalRotation()
Definition spatial.h:55
MSpatialEntity * getParent()
Definition spatial.h:80
void setLocalPosition(float x, float y)
Sets local position of the entity.
Definition spatial.h:41
void setLocalRotation(float localRotation)
Sets local rotation of the entity in x-axis.
Definition spatial.h:60
T * find(std::string name)
Recursively searches for a SpatialEntity within this sub-tree.
Definition spatial.h:104
A structure representing a 2D Vector.
Definition vector2d.h:11