4 * Created on: Sep 29, 2012
8 #ifndef MAP_MAPSTATE_H_
9 #define MAP_MAPSTATE_H_
13 #include "../app/State.h"
14 #include "../common/fwd.h"
15 #include "../geometry/Vector.h"
16 #include "../graphics/Camera.h"
26 explicit MapState(common::GameConfig *, Map *);
27 virtual ~MapState() { }
30 virtual void EnterState(app::Application &ctrl, SDL_Surface *screen);
31 virtual void ExitState(app::Application &ctrl, SDL_Surface *screen);
32 virtual void ResumeState(app::Application &ctrl, SDL_Surface *screen);
33 virtual void PauseState(app::Application &ctrl, SDL_Surface *screen);
34 virtual void Resize(int width, int height);
36 virtual void HandleEvents(const app::Input &);
37 virtual void UpdateWorld(float deltaT);
38 virtual void Render(SDL_Surface *);
41 void AddEntity(Entity *e) { entities.push_back(e); }
42 void ControlEntity(Entity *e) { controlled = e; camera.SetTarget(&e->Position()); }
44 void SetWalkingSpeed(float s) { walkingSpeed = s; }
46 void Transition(Map *, const geometry::Vector<int> &coordinates);
49 static bool ZCompare(const Entity *lhs, const Entity *rhs);
55 bool CheckBlocking(const geometry::Vector<int> &position, Entity::Orientation direction) const;
61 void UpdateFollower(Entity &);
62 void StopFollowers(Entity &);
67 bool CheckLockTrigger();
68 bool CheckMoveTrigger();
69 void RunTrigger(Trigger &);
72 common::GameConfig *game;
73 app::Application *ctrl;
77 app::Timer<float> moveTimer;
78 geometry::Vector<int> lastLock;
79 graphics::Camera camera;
80 std::vector<Entity *> entities;
92 #endif /* MAP_MAPSTATE_H_ */