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: CharFrame.cpp
- Revision:
- 16:d0b142ba4362
- Parent:
- 2:bb0f631a6068
--- a/CharFrame.cpp Sat Jun 15 15:05:19 2013 +0000 +++ b/CharFrame.cpp Sat Jun 15 19:27:36 2013 +0000 @@ -55,3 +55,35 @@ gd->wr( address, BottomRight ); } +/****************/ +/* WIPE A FRAME */ +/****************/ +// Pass Gameduino to draw on in gd. +// Pass x coordinate of top left in x. +// Pass y coordinate of top left in y. +// Pass width in w. +// Pass height in h. +void CharFrame::Wipe( Gameduino *gd, UInt8 x, UInt8 y, UInt8 w, UInt8 h ) { + // Calculate address for top left. + unsigned int rowStart = Gameduino::RAM_PIC + y * SCREEN_CHAR_WIDTH + x; + unsigned int address; + UInt8 count; + // Wipe top edge. + address = rowStart; + for( count = w; count > 0; --count ) { + gd->wr( address++, TransparentChar ); + } + // Wipe left and right edges. + address = rowStart + SCREEN_CHAR_WIDTH; + if( h > 2 ) { + for( count = h - 2; count > 0; --count ) { + gd->wr( address, TransparentChar ); + gd->wr( address + w - 1, TransparentChar ); + } + } + // Wipe bottom edge. + address = rowStart + SCREEN_CHAR_WIDTH * ( h - 1 ); + for( count = w; count > 0; --count ) { + gd->wr( address++, TransparentChar ); + } +}