From 71045152800ab0cc0dce6ec70dba9d7f9bb9dab5 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Thu, 18 Jun 2009 17:20:59 -0400 Subject: Started Board class --- board.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 board.cpp (limited to 'board.cpp') diff --git a/board.cpp b/board.cpp new file mode 100644 index 0000000..ca0af83 --- /dev/null +++ b/board.cpp @@ -0,0 +1,46 @@ +#include "includes.h" + +Board::Board() +{ + int x,y; + for (y=0;y 10 && x < 20 && y > 10 && y < 20) + { + blocks[x][y] = rand() % 2; + } else { + blocks[x][y] = false; + } + } + } + + on = getColor(0, 0, 0); + off = getColor(255, 255, 255); +} + +bool Board::isObstructed(int x, int y) +{ + return blocks[x][y]; +} + +void Board::render(SDL_Surface* screen) +{ + SDL_Rect block; + block.w = 16; + block.h = 16; + + int x,y; + + for (y=0;y