]> git.localhorst.tv Git - l2e.git/blob - src/map/MapState.cpp
added application state for map
[l2e.git] / src / map / MapState.cpp
1 /*
2  * MapState.cpp
3  *
4  *  Created on: Sep 29, 2012
5  *      Author: holy
6  */
7
8 #include "MapState.h"
9
10 #include "Map.h"
11 #include "../app/Application.h"
12 #include "../app/Input.h"
13
14 using app::Application;
15 using app::Input;
16 using geometry::Vector;
17
18 namespace map {
19
20 MapState::MapState(const Map *map)
21 : map(map)
22 , tempTarget(20, 20)
23 , camera(100, 100, &tempTarget) {
24
25 }
26
27
28 void MapState::EnterState(Application &ctrl, SDL_Surface *screen) {
29         camera.Resize(screen->w, screen->h);
30 }
31
32 void MapState::ExitState(Application &ctrl, SDL_Surface *screen) {
33
34 }
35
36 void MapState::ResumeState(Application &ctrl, SDL_Surface *screen) {
37         camera.Resize(screen->w, screen->h);
38 }
39
40 void MapState::PauseState(Application &ctrl, SDL_Surface *screen) {
41
42 }
43
44 void MapState::Resize(int width, int height) {
45         camera.Resize(width, height);
46 }
47
48
49 void MapState::HandleEvents(const Input &input) {
50
51 }
52
53 void MapState::UpdateWorld(float deltaT) {
54
55 }
56
57 void MapState::Render(SDL_Surface *screen) {
58         Vector<int> offset(camera.CalculateOffset());
59         map->Render(screen, offset);
60 }
61
62 }