]> git.localhorst.tv Git - l2e.git/blob - src/map/Entity.h
added Entity class
[l2e.git] / src / map / Entity.h
1 /*
2  * Entity.h
3  *
4  *  Created on: Sep 29, 2012
5  *      Author: holy
6  */
7
8 #ifndef MAP_ENTITY_H_
9 #define MAP_ENTITY_H_
10
11 #include "../geometry/Vector.h"
12 #include "../graphics/fwd.h"
13 #include "../graphics/Animation.h"
14
15 #include <functional>
16 #include <SDL.h>
17
18 namespace map {
19
20 class Entity {
21
22 public:
23         Entity();
24         ~Entity() { }
25
26 public:
27         geometry::Vector<float> &Position() { return position; }
28         const geometry::Vector<float> &Position() const { return position; }
29
30         geometry::Vector<float> &Velocity() { return velocity; }
31         const geometry::Vector<float> &Velocity() const { return velocity; }
32
33         void SetSprite(const graphics::Sprite *s) { sprite = s; }
34         graphics::AnimationRunner &Animation() { return animation; }
35         const graphics::AnimationRunner &Animation() const { return animation; }
36
37         void Update(float deltaT);
38
39         void Render(SDL_Surface *, const geometry::Vector<int> &offset) const;
40
41 private:
42         const graphics::Sprite *sprite;
43         graphics::AnimationRunner animation;
44         geometry::Vector<float> position;
45         geometry::Vector<float> velocity;
46
47 };
48
49 }
50
51 #endif /* MAP_ENTITY_H_ */