--- /dev/null
+/*
+ * Entity.cpp
+ *
+ * Created on: Sep 29, 2012
+ * Author: holy
+ */
+
+#include "Entity.h"
+
+namespace map {
+
+Entity::Entity()
+: sprite(0) {
+
+}
+
+
+void Entity::Update(float deltaT) {
+ position += velocity * deltaT;
+}
+
+
+void Entity::Render(SDL_Surface *dest, const geometry::Vector<int> &offset) const {
+ if (animation.Running()) {
+ animation.DrawCenterBottom(dest, offset + position);
+ } else {
+ sprite->DrawCenterBottom(dest, offset + position);
+ }
+}
+
+}
--- /dev/null
+/*
+ * Entity.h
+ *
+ * Created on: Sep 29, 2012
+ * Author: holy
+ */
+
+#ifndef MAP_ENTITY_H_
+#define MAP_ENTITY_H_
+
+#include "../geometry/Vector.h"
+#include "../graphics/fwd.h"
+#include "../graphics/Animation.h"
+
+#include <functional>
+#include <SDL.h>
+
+namespace map {
+
+class Entity {
+
+public:
+ Entity();
+ ~Entity() { }
+
+public:
+ geometry::Vector<float> &Position() { return position; }
+ const geometry::Vector<float> &Position() const { return position; }
+
+ geometry::Vector<float> &Velocity() { return velocity; }
+ const geometry::Vector<float> &Velocity() const { return velocity; }
+
+ void SetSprite(const graphics::Sprite *s) { sprite = s; }
+ graphics::AnimationRunner &Animation() { return animation; }
+ const graphics::AnimationRunner &Animation() const { return animation; }
+
+ void Update(float deltaT);
+
+ void Render(SDL_Surface *, const geometry::Vector<int> &offset) const;
+
+private:
+ const graphics::Sprite *sprite;
+ graphics::AnimationRunner animation;
+ geometry::Vector<float> position;
+ geometry::Vector<float> velocity;
+
+};
+
+}
+
+#endif /* MAP_ENTITY_H_ */