diff options
Diffstat (limited to 'gamestate.h')
| -rw-r--r-- | gamestate.h | 51 |
1 files changed, 43 insertions, 8 deletions
| diff --git a/gamestate.h b/gamestate.h index 727c8f1..c36bcee 100644 --- a/gamestate.h +++ b/gamestate.h | |||
| @@ -2,20 +2,55 @@ | |||
| 2 | #define GAMESTATE_H | 2 | #define GAMESTATE_H |
| 3 | 3 | ||
| 4 | class GameState : public State { | 4 | class 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 | }; | ||
| 26 | |||
| 27 | struct Info { | ||
| 28 | int playerx, playery; | ||
| 29 | Level level; | ||
| 30 | }; | ||
| 31 | |||
| 32 | class Board | ||
| 33 | { | ||
| 34 | private: | ||
| 35 | bool blocks[WIDTH][HEIGHT]; | ||
| 36 | void incrementIfNeighbor(int x, int y, bool temp[WIDTH][HEIGHT], int* tick); | ||
| 37 | GameState::Info* info; | ||
| 38 | |||
| 39 | public: | ||
| 40 | Board(); | ||
| 41 | Board(GameState::Info* info); | ||
| 42 | bool isObstructed(int x, int y); | ||
| 43 | void render(SDL_Surface* screen); | ||
| 44 | void tick(); | ||
| 45 | }; | ||
| 46 | |||
| 5 | private: | 47 | private: |
| 6 | Uint32 player_color; | 48 | Uint32 player_color; |
| 7 | int playerx, playery; | ||
| 8 | bool newGame; | 49 | bool newGame; |
| 9 | bool doneMaking; | 50 | bool doneMaking; |
| 10 | Level level; | 51 | Info info; |
| 11 | Board board; | 52 | Board board; |
| 12 | void move(int x, int y); | 53 | void move(int x, int y); |
| 13 | |||
| 14 | public: | ||
| 15 | GameState(); | ||
| 16 | void input(SDLKey key); | ||
| 17 | void tick(); | ||
| 18 | void render(SDL_Surface* screen); | ||
| 19 | }; | 54 | }; |
| 20 | 55 | ||
| 21 | #endif | 56 | #endif |
