summary refs log tree commit diff stats
path: root/src/mapview.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mapview.h')
-rw-r--r--src/mapview.h65
1 files changed, 0 insertions, 65 deletions
diff --git a/src/mapview.h b/src/mapview.h deleted file mode 100644 index 505ab25..0000000 --- a/src/mapview.h +++ /dev/null
@@ -1,65 +0,0 @@
1#ifndef MAPVIEW_H
2#define MAPVIEW_H
3
4#include <list>
5#include "state.h"
6#include "mob.h"
7#include "map.h"
8
9using namespace::std;
10
11const int TILE_WIDTH = 8;
12const int TILE_HEIGHT = 8;
13const int GAME_WIDTH = 320;
14const int GAME_HEIGHT = 200;
15const int MAP_WIDTH = GAME_WIDTH/TILE_WIDTH;
16const int MAP_HEIGHT = GAME_HEIGHT/TILE_HEIGHT;
17
18const int FRAMES_PER_SECOND = 60;
19const double SECONDS_PER_FRAME = 1.0 / FRAMES_PER_SECOND;
20
21enum direction_t {
22 up, left, down, right
23};
24
25typedef struct {
26 int axis;
27 int lower;
28 int upper;
29 int type;
30} collision_t;
31
32class MapView : public State {
33 public:
34 MapView(Map* start, int x, int y);
35 ~MapView();
36 void loadMap(Map* m);
37 void input(int key, int action);
38 void tick();
39 void render(Texture* tex);
40
41 private:
42 void add_collision(int axis, int lower, int upper, direction_t dir, int type);
43 void check_collisions(mob_t* mob, int x_next, int y_next);
44
45 list<collision_t> left_collisions;
46 list<collision_t> right_collisions;
47 list<collision_t> up_collisions;
48 list<collision_t> down_collisions;
49
50 Texture* bg = NULL;
51 Texture* chara;
52 Texture* tiles;
53
54 bool holding_left = false;
55 bool holding_right = false;
56 bool holding_down = false;
57 bool holding_up = false;
58 mob_t* player;
59
60 Map* curMap;
61
62 int animFrame = 0;
63};
64
65#endif