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: Level0.cpp
- Revision:
- 1:dfd5eaaf96a3
- Parent:
- 0:5fa232ee5fdf
- Child:
- 2:bb0f631a6068
--- a/Level0.cpp Tue Jun 04 20:16:33 2013 +0000 +++ b/Level0.cpp Wed Jun 05 22:05:41 2013 +0000 @@ -60,48 +60,51 @@ // level data has been initialised and the return value returned // by the Play method. Level::LevelExitCode Level0::PlayLoop( void ) { -#if 0 - // Set screen background to black. - GD.wr( BG_COLOR, RGB( 0, 0, 0 ) ); - GDExtra::ClearScreen( TransparentChar ); - GDExtra::HideAllSprites(); - SoundManager::Instance.SilenceAll(); - // Draw border around screen. - CharFrame::Draw( 0, 0, VISIBLE_CHAR_WIDTH, VISIBLE_CHAR_HEIGHT ); - // Draw big block of characters that read "ROBOTRIC". - GDExtra::WriteProgCharBlock( 2, 2, CharBlocks::RobotRicText ); - // Write message telling user how to start game. - GDExtra::WriteProgString( 2, VISIBLE_CHAR_HEIGHT - 3, startText ); - // Validate high scores in EEPROM which will re-write the entire - // table with default data if it finds nonsense in the EEPROM. - // Then check if EEPROM now makes sense. If it does then display - // the high score table. If it does not then chances are there - // is no EEPROM connected so don't bother with high scores. - if( highScores != (HighScoreTable*)NULL ) { - highScores->ValidateEEPROM(); - if( highScores->EEPROMValid() ) { - DrawHighScores(); - } + // Must have a Gameduino defined. + if( gd != (Gameduino*)NULL ) { + // Set screen background to black. + gd->wr( Gameduino::BG_COLOR, Gameduino::RGB( 0, 0, 0 ) ); + GDExtra::ClearScreen( gd, TransparentChar ); + GDExtra::HideAllSprites( gd ); + // SoundManager::Instance.SilenceAll(); + // Draw border around screen. + // CharFrame::Draw( 0, 0, VISIBLE_CHAR_WIDTH, VISIBLE_CHAR_HEIGHT ); + // Draw big block of characters that read "ROBOTRIC". + GDExtra::WriteProgCharBlock( gd, 2, 2, CharBlocks::RobotRicText ); + // Write message telling user how to start game. + GDExtra::WriteProgString( gd, 2, VISIBLE_CHAR_HEIGHT - 3, startText ); + #if 0 + // Validate high scores in EEPROM which will re-write the entire + // table with default data if it finds nonsense in the EEPROM. + // Then check if EEPROM now makes sense. If it does then display + // the high score table. If it does not then chances are there + // is no EEPROM connected so don't bother with high scores. + if( highScores != (HighScoreTable*)NULL ) { + highScores->ValidateEEPROM(); + if( highScores->EEPROMValid() ) { + DrawHighScores(); + } + } + // Must have a player with non-NULL controls. + PanelControls *controls; + if( + ( player != (PlayerObject*)NULL ) && + ( ( controls = player->GetControls() ) != (PanelControls*)NULL ) + ) { + // Wait until all panel controls are released. + UInt16 inputs; + do { + controls->Read(); + inputs = controls->GetInputs(); + } while( inputs != 0 ); + // Wait until a panel control is activated. + do { + controls->Read(); + inputs = controls->GetInputs(); + } while( inputs == 0 ); + } + #endif } - // Must have a player with non-NULL controls. - PanelControls *controls; - if( - ( player != (PlayerObject*)NULL ) && - ( ( controls = player->GetControls() ) != (PanelControls*)NULL ) - ) { - // Wait until all panel controls are released. - UInt16 inputs; - do { - controls->Read(); - inputs = controls->GetInputs(); - } while( inputs != 0 ); - // Wait until a panel control is activated. - do { - controls->Read(); - inputs = controls->GetInputs(); - } while( inputs == 0 ); - } -#endif - return Completed; + return Completed; }