summary refs log tree commit diff stats
path: root/gamestate.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2009-06-18 16:24:02 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2009-06-18 16:24:02 -0400
commit10ccc825777c7ce8797fc58e1484dd93f19368cf (patch)
tree75333f5f5abc653a621e442129613fd4fdade8c1 /gamestate.cpp
downloadmazeoflife-10ccc825777c7ce8797fc58e1484dd93f19368cf.tar.gz
mazeoflife-10ccc825777c7ce8797fc58e1484dd93f19368cf.tar.bz2
mazeoflife-10ccc825777c7ce8797fc58e1484dd93f19368cf.zip
Created base
Diffstat (limited to 'gamestate.cpp')
-rw-r--r--gamestate.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/gamestate.cpp b/gamestate.cpp new file mode 100644 index 0000000..dac5272 --- /dev/null +++ b/gamestate.cpp
@@ -0,0 +1,35 @@
1#include "includes.h"
2
3GameState::GameState(SDL_PixelFormat* fmt)
4{
5 int x,y;
6 for (y=0;y<HEIGHT;y++)
7 {
8 for (x=0;x<WIDTH;x++)
9 {
10 blocks[x][y] = false;
11 }
12 }
13
14 on = SDL_MapRGB(fmt, 0, 0, 0);
15 off = SDL_MapRGB(fmt, 255, 255, 255);
16}
17
18void GameState::render(SDL_Surface* screen)
19{
20 int x,y;
21
22 for (y=0;y<HEIGHT;y++)
23 {
24 for (x=0;x<WIDTH;x++)
25 {
26 SDL_Rect block;
27 block.x = x*16;
28 block.y = y*16;
29 block.w = 16;
30 block.h = 16;
31
32 SDL_FillRect(screen, &block, (blocks[x][y] ? on : off));
33 }
34 }
35}