]> git.tdb.fi Git - libs/game.git/blobdiff - source/game/entity.cpp
Add a transform component and propagation system
[libs/game.git] / source / game / entity.cpp
index 055c8d63d4dde384c6f3e4cead73b770a76b8c79..8f56f670cb50de28c68876c64f12a9405c6c3278 100644 (file)
@@ -1,15 +1,27 @@
 #include "entity.h"
 #include "component.h"
 #include "root.h"
+#include "transform.h"
 
 using namespace std;
 
 namespace Msp::Game {
 
-Entity::Entity(Handle<Entity> p):
+Entity::Entity(Handle<Entity> p, TransformTag):
        parent(p)
 { }
 
+Entity::Entity(Handle<Entity> p, const TransformValues &tv):
+       parent(p),
+       transform(*this)
+{
+       transform->set_values(tv);
+}
+
+// Hide ~Owned<Transform> from the header
+Entity::~Entity()
+{ }
+
 void Entity::add_component(Handle<Component> comp)
 {
        if(comp->get_entity().get()!=this)