4 * Created on: Sep 29, 2012
8 #ifndef MAP_MAPSTATE_H_
9 #define MAP_MAPSTATE_H_
13 #include "../app/State.h"
14 #include "../geometry/Vector.h"
15 #include "../graphics/Camera.h"
25 explicit MapState(Map *);
26 virtual ~MapState() { }
29 virtual void EnterState(app::Application &ctrl, SDL_Surface *screen);
30 virtual void ExitState(app::Application &ctrl, SDL_Surface *screen);
31 virtual void ResumeState(app::Application &ctrl, SDL_Surface *screen);
32 virtual void PauseState(app::Application &ctrl, SDL_Surface *screen);
33 virtual void Resize(int width, int height);
35 virtual void HandleEvents(const app::Input &);
36 virtual void UpdateWorld(float deltaT);
37 virtual void Render(SDL_Surface *);
40 void AddEntity(Entity *e) { entities.push_back(e); }
41 void ControlEntity(Entity *e) { controlled = e; camera.SetTarget(&e->Position()); }
43 void SetWalkingSpeed(float s) { walkingSpeed = s; }
46 static bool ZCompare(const Entity *lhs, const Entity *rhs);
48 bool CheckBlocking() const;
54 void UpdateFollower(Entity &);
55 void StopFollowers(Entity &);
64 app::Timer<float> moveTimer;
65 geometry::Vector<float> tempTarget;
66 geometry::Vector<int> lastLock;
67 graphics::Camera camera;
68 std::vector<Entity *> entities;
77 #endif /* MAP_MAPSTATE_H_ */