]> git.localhorst.tv Git - l2e.git/blob - src/map/Entity.h
check blocking flags of tiles in map state
[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         enum Orientation {
28                 ORIENTATION_NORTH = 0,
29                 ORIENTATION_EAST = 1,
30                 ORIENTATION_SOUTH = 2,
31                 ORIENTATION_WEST = 3,
32         };
33
34 public:
35         geometry::Vector<float> &Position() { return position; }
36         const geometry::Vector<float> &Position() const { return position; }
37
38         geometry::Vector<float> &Velocity() { return velocity; }
39         const geometry::Vector<float> &Velocity() const { return velocity; }
40
41         void SetSprite(const graphics::Sprite *s) { sprite = s; }
42         graphics::AnimationRunner &Animation() { return animation; }
43         const graphics::AnimationRunner &Animation() const { return animation; }
44
45         void SetOrientation(Orientation);
46         Orientation GetOrientation() const { return orientation; }
47         void SetSpeed(float);
48
49         bool TileLock(int width, int height) const;
50
51         void Update(float deltaT);
52
53         void Render(SDL_Surface *, const geometry::Vector<int> &offset) const;
54
55 private:
56         void UpdateVelocity();
57
58 private:
59         const graphics::Sprite *sprite;
60         graphics::AnimationRunner animation;
61         geometry::Vector<float> position;
62         geometry::Vector<float> velocity;
63         Orientation orientation;
64         float speed;
65
66 };
67
68 }
69
70 #endif /* MAP_ENTITY_H_ */