diff options
Diffstat (limited to 'board.cpp')
-rw-r--r-- | board.cpp | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/board.cpp b/board.cpp deleted file mode 100644 index 8af0015..0000000 --- a/board.cpp +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | #include "includes.h" | ||
2 | |||
3 | Board::Board() | ||
4 | { | ||
5 | Board(Level()); | ||
6 | } | ||
7 | |||
8 | Board::Board(Level level) | ||
9 | { | ||
10 | int x,y; | ||
11 | for (y=0;y<HEIGHT;y++) | ||
12 | { | ||
13 | for (x=0;x<WIDTH;x++) | ||
14 | { | ||
15 | if (level.checkSquare(x, y)) | ||
16 | { | ||
17 | blocks[x][y] = rand() % 2; | ||
18 | } else { | ||
19 | blocks[x][y] = false; | ||
20 | } | ||
21 | } | ||
22 | } | ||
23 | } | ||
24 | |||
25 | bool Board::isObstructed(int x, int y) | ||
26 | { | ||
27 | return blocks[x][y]; | ||
28 | } | ||
29 | |||
30 | void Board::render(SDL_Surface* screen, Level level) | ||
31 | { | ||
32 | SDL_Rect block; | ||
33 | block.w = 16; | ||
34 | block.h = 16; | ||
35 | |||
36 | int x,y; | ||
37 | |||
38 | for (y=0;y<HEIGHT;y++) | ||
39 | { | ||
40 | for (x=0;x<WIDTH;x++) | ||
41 | { | ||
42 | block.x = x*16; | ||
43 | block.y = y*16; | ||
44 | |||
45 | SDL_FillRect(screen, &block, (blocks[x][y] ? level.getAliveColor() : level.getDeadColor())); | ||
46 | } | ||
47 | } | ||
48 | } | ||