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
FieldGrid.cpp@15:d8ea0c7b7e64, 2013-06-15 (annotated)
- Committer:
- RichardE
- Date:
- Sat Jun 15 15:05:19 2013 +0000
- Revision:
- 15:d8ea0c7b7e64
Started adding code to represent a grid of rectangles which is used on high score entry screen. See FieldGrid, FieldRow and FieldCell classes and use in HighScoreEntry.cpp.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RichardE | 15:d8ea0c7b7e64 | 1 | /* |
RichardE | 15:d8ea0c7b7e64 | 2 | * SOURCE FILE : FieldGrid.cpp |
RichardE | 15:d8ea0c7b7e64 | 3 | * |
RichardE | 15:d8ea0c7b7e64 | 4 | * Definition of class FieldGrid. |
RichardE | 15:d8ea0c7b7e64 | 5 | * This is a grid of rectangles used for fields on a form or whatever. |
RichardE | 15:d8ea0c7b7e64 | 6 | * |
RichardE | 15:d8ea0c7b7e64 | 7 | */ |
RichardE | 15:d8ea0c7b7e64 | 8 | |
RichardE | 15:d8ea0c7b7e64 | 9 | #include "FieldGrid.h" |
RichardE | 15:d8ea0c7b7e64 | 10 | |
RichardE | 15:d8ea0c7b7e64 | 11 | /***************/ |
RichardE | 15:d8ea0c7b7e64 | 12 | /* CONSTRUCTOR */ |
RichardE | 15:d8ea0c7b7e64 | 13 | /***************/ |
RichardE | 15:d8ea0c7b7e64 | 14 | // Pass number of rows in grid in rc. |
RichardE | 15:d8ea0c7b7e64 | 15 | FieldGrid::FieldGrid( UInt8 rc ) : |
RichardE | 15:d8ea0c7b7e64 | 16 | rows( new FieldRow[ rc ] ), |
RichardE | 15:d8ea0c7b7e64 | 17 | rowCount( rc ) |
RichardE | 15:d8ea0c7b7e64 | 18 | { |
RichardE | 15:d8ea0c7b7e64 | 19 | } |
RichardE | 15:d8ea0c7b7e64 | 20 | |
RichardE | 15:d8ea0c7b7e64 | 21 | /**************/ |
RichardE | 15:d8ea0c7b7e64 | 22 | /* DESTRUCTOR */ |
RichardE | 15:d8ea0c7b7e64 | 23 | /**************/ |
RichardE | 15:d8ea0c7b7e64 | 24 | FieldGrid::~FieldGrid() { |
RichardE | 15:d8ea0c7b7e64 | 25 | delete [] rows; |
RichardE | 15:d8ea0c7b7e64 | 26 | } |
RichardE | 15:d8ea0c7b7e64 | 27 | |
RichardE | 15:d8ea0c7b7e64 | 28 | /*************/ |
RichardE | 15:d8ea0c7b7e64 | 29 | /* GET A ROW */ |
RichardE | 15:d8ea0c7b7e64 | 30 | /*************/ |
RichardE | 15:d8ea0c7b7e64 | 31 | // Pass row number in rowNum. |
RichardE | 15:d8ea0c7b7e64 | 32 | // Returns pointer to row or NULL if no such row. |
RichardE | 15:d8ea0c7b7e64 | 33 | FieldRow *FieldGrid::GetRow( UInt8 rowNum ) { |
RichardE | 15:d8ea0c7b7e64 | 34 | if( rowNum < rowCount ) { |
RichardE | 15:d8ea0c7b7e64 | 35 | return rows + rowNum; |
RichardE | 15:d8ea0c7b7e64 | 36 | } |
RichardE | 15:d8ea0c7b7e64 | 37 | else { |
RichardE | 15:d8ea0c7b7e64 | 38 | return (FieldRow*)NULL; |
RichardE | 15:d8ea0c7b7e64 | 39 | } |
RichardE | 15:d8ea0c7b7e64 | 40 | } |
RichardE | 15:d8ea0c7b7e64 | 41 |