--- /dev/null
+/*
+ * MapState.cpp
+ *
+ * Created on: Sep 29, 2012
+ * Author: holy
+ */
+
+#include "MapState.h"
+
+#include "Map.h"
+#include "../app/Application.h"
+#include "../app/Input.h"
+
+using app::Application;
+using app::Input;
+using geometry::Vector;
+
+namespace map {
+
+MapState::MapState(const Map *map)
+: map(map)
+, tempTarget(20, 20)
+, camera(100, 100, &tempTarget) {
+
+}
+
+
+void MapState::EnterState(Application &ctrl, SDL_Surface *screen) {
+ camera.Resize(screen->w, screen->h);
+}
+
+void MapState::ExitState(Application &ctrl, SDL_Surface *screen) {
+
+}
+
+void MapState::ResumeState(Application &ctrl, SDL_Surface *screen) {
+ camera.Resize(screen->w, screen->h);
+}
+
+void MapState::PauseState(Application &ctrl, SDL_Surface *screen) {
+
+}
+
+void MapState::Resize(int width, int height) {
+ camera.Resize(width, height);
+}
+
+
+void MapState::HandleEvents(const Input &input) {
+
+}
+
+void MapState::UpdateWorld(float deltaT) {
+
+}
+
+void MapState::Render(SDL_Surface *screen) {
+ Vector<int> offset(camera.CalculateOffset());
+ map->Render(screen, offset);
+}
+
+}
--- /dev/null
+/*
+ * MapState.h
+ *
+ * Created on: Sep 29, 2012
+ * Author: holy
+ */
+
+#ifndef MAP_MAPSTATE_H_
+#define MAP_MAPSTATE_H_
+
+#include "fwd.h"
+#include "../app/State.h"
+#include "../geometry/Vector.h"
+#include "../graphics/Camera.h"
+
+namespace map {
+
+class MapState
+: public app::State {
+
+public:
+ explicit MapState(const Map *);
+ virtual ~MapState() { }
+
+public:
+ virtual void EnterState(app::Application &ctrl, SDL_Surface *screen);
+ virtual void ExitState(app::Application &ctrl, SDL_Surface *screen);
+ virtual void ResumeState(app::Application &ctrl, SDL_Surface *screen);
+ virtual void PauseState(app::Application &ctrl, SDL_Surface *screen);
+ virtual void Resize(int width, int height);
+
+ virtual void HandleEvents(const app::Input &);
+ virtual void UpdateWorld(float deltaT);
+ virtual void Render(SDL_Surface *);
+
+private:
+ const Map *map;
+ geometry::Vector<int> tempTarget;
+ graphics::Camera camera;
+
+};
+
+}
+
+#endif /* MAP_MAPSTATE_H_ */