X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgame%2Fentity.cpp;h=3c507a312bcb3e73d5d3500c246c0ab14c01a79f;hb=a5be9fabc4c8fb153f2176dfce93874d699f32a0;hp=95ad686b056266c99be89266a5005c7e6941c7d8;hpb=248d62f7240d342982ade65a510be912b867fe49;p=libs%2Fgame.git diff --git a/source/game/entity.cpp b/source/game/entity.cpp index 95ad686..3c507a3 100644 --- a/source/game/entity.cpp +++ b/source/game/entity.cpp @@ -1,15 +1,27 @@ #include "entity.h" #include "component.h" -#include "stage.h" +#include "root.h" +#include "transform.h" using namespace std; namespace Msp::Game { -Entity::Entity(Handle p): +Entity::Entity(Handle p, TransformTag): parent(p) { } +Entity::Entity(Handle p, const TransformValues &tv): + parent(p), + transform(this) +{ + transform->set_values(tv); +} + +// Hide ~Owned from the header +Entity::~Entity() +{ } + void Entity::add_component(Handle comp) { if(comp->get_entity().get()!=this) @@ -36,4 +48,10 @@ void Entity::remove_child(Handle child) erase(children, child); } +Stage &Entity::get_stage() +{ + Handle root = get_root(); + return dynamic_cast(*root).get_stage(); +} + } // namespace Msp::Game