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

Committer:
RichardE
Date:
2013-06-17
Revision:
18:70190f956a24
Parent:
15:d8ea0c7b7e64

File content as of revision 18:70190f956a24:

/*
 * 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;
    }
}