summary refs log tree commit diff stats
path: root/gamestate.h
diff options
context:
space:
mode:
Diffstat (limited to 'gamestate.h')
-rw-r--r--gamestate.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/gamestate.h b/gamestate.h new file mode 100644 index 0000000..7d9d798 --- /dev/null +++ b/gamestate.h
@@ -0,0 +1,59 @@
1#ifndef GAMESTATE_H
2#define GAMESTATE_H
3
4class GameState : public State {
5 public:
6 GameState();
7 void input(SDLKey key);
8 void tick();
9 void render(SDL_Surface* screen);
10
11 class Level
12 {
13 private:
14 int level;
15 Uint32 alive[5];
16 Uint32 dead[5];
17
18 public:
19 Level();
20 int getLevel();
21 int getLevelGroup();
22 bool checkSquare(int x, int y);
23 Uint32 getAliveColor();
24 Uint32 getDeadColor();
25 void incrementLevel();
26 };
27
28 struct Info {
29 int playerx, playery;
30 Level level;
31 bool doneMaking;
32 };
33
34 class Board
35 {
36 private:
37 bool blocks[WIDTH][HEIGHT];
38 void incrementIfNeighbor(int x, int y, bool temp[WIDTH][HEIGHT], int* tick);
39 GameState::Info* info;
40 int gens;
41
42 public:
43 Board();
44 Board(GameState::Info* info);
45 bool isObstructed(int x, int y);
46 void render(SDL_Surface* screen);
47 void tick();
48 };
49
50 private:
51 Uint32 player_color;
52 Uint32 event_color;
53 bool newGame;
54 Info info;
55 Board board;
56 void move(int x, int y);
57};
58
59#endif