Version of Robotron arcade game using LPC1768, a Gameduino shield, a serial EEPROM (for high scores), two microswitch joysticks and two buttons plus a box to put it in. 20 levels of mayhem.
Dependencies: 25LCxxx_SPI CommonTypes Gameduino mbed
Diff: FieldGrid.cpp
- Revision:
- 15:d8ea0c7b7e64
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FieldGrid.cpp Sat Jun 15 15:05:19 2013 +0000 @@ -0,0 +1,41 @@ +/* + * SOURCE FILE : FieldGrid.cpp + * + * Definition of class FieldGrid. + * This is a grid of rectangles used for fields on a form or whatever. + * + */ + +#include "FieldGrid.h" + +/***************/ +/* CONSTRUCTOR */ +/***************/ +// Pass number of rows in grid in rc. +FieldGrid::FieldGrid( UInt8 rc ) : + rows( new FieldRow[ rc ] ), + rowCount( rc ) +{ +} + +/**************/ +/* DESTRUCTOR */ +/**************/ +FieldGrid::~FieldGrid() { + delete [] rows; +} + +/*************/ +/* GET A ROW */ +/*************/ +// Pass row number in rowNum. +// Returns pointer to row or NULL if no such row. +FieldRow *FieldGrid::GetRow( UInt8 rowNum ) { + if( rowNum < rowCount ) { + return rows + rowNum; + } + else { + return (FieldRow*)NULL; + } +} +