diff options
Diffstat (limited to 'gamestate.cpp')
| -rw-r--r-- | gamestate.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
| diff --git a/gamestate.cpp b/gamestate.cpp index fd115f8..d1c17b2 100644 --- a/gamestate.cpp +++ b/gamestate.cpp | |||
| @@ -1,11 +1,13 @@ | |||
| 1 | #include "includes.h" | 1 | #include "includes.h" |
| 2 | 2 | ||
| 3 | GameState::GameState(SDL_PixelFormat* fmt) | 3 | GameState::GameState() |
| 4 | { | 4 | { |
| 5 | player_color = SDL_MapRGB(fmt, 255, 255, 0); | 5 | player_color = getColor(255, 255, 0); |
| 6 | 6 | ||
| 7 | newGame = true; | 7 | newGame = true; |
| 8 | doneMaking = false; | 8 | doneMaking = false; |
| 9 | |||
| 10 | level = Level(); | ||
| 9 | } | 11 | } |
| 10 | 12 | ||
| 11 | void GameState::input(SDLKey key) | 13 | void GameState::input(SDLKey key) |
| @@ -32,14 +34,17 @@ void GameState::input(SDLKey key) | |||
| 32 | break; | 34 | break; |
| 33 | } | 35 | } |
| 34 | } | 36 | } |
| 37 | } | ||
| 35 | 38 | ||
| 39 | void GameState::tick() | ||
| 40 | { | ||
| 36 | if (newGame) | 41 | if (newGame) |
| 37 | { | 42 | { |
| 38 | playerx = 1; | 43 | playerx = 1; |
| 39 | playery = 1; | 44 | playery = 1; |
| 40 | board = Board(); | 45 | board = Board(level); |
| 41 | newGame = false; | 46 | newGame = false; |
| 42 | doneMaking = false; | 47 | doneMaking = true; |
| 43 | } | 48 | } |
| 44 | } | 49 | } |
| 45 | 50 | ||
| @@ -55,7 +60,7 @@ void GameState::move(int x, int y) | |||
| 55 | 60 | ||
| 56 | void GameState::render(SDL_Surface* screen) | 61 | void GameState::render(SDL_Surface* screen) |
| 57 | { | 62 | { |
| 58 | board.render(screen); | 63 | board.render(screen, level); |
| 59 | 64 | ||
| 60 | SDL_Rect block; | 65 | SDL_Rect block; |
| 61 | block.x = playerx*16; | 66 | block.x = playerx*16; |
