Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 25:1d91ab97d86a
- Parent:
- 24:14489d259ffb
--- a/main.cpp Mon Apr 30 16:40:32 2018 +0000
+++ b/main.cpp Mon Apr 30 18:07:51 2018 +0000
@@ -20,58 +20,55 @@
void init();
void welcome();
void render();
+void draw(N5110 &lcd);
int main()
{
-init();
-do{
- engine.start(pad,lcd);
- }
- while(pad.check_event(Gamepad::START_PRESSED) == false);
+ init();
+ draw(lcd);
while(1){
- engine.read_input(pad);
- engine.update(pad,lcd);
- render();
- wait(0.1);
- }
+ engine.read_input(pad);
+ engine.update(pad,lcd);
+ render();
+ wait(0.1);
+ }
}
-
+
+void draw(N5110 &lcd)
+{
+ lcd.clear();
+ lcd.printString(" Boom",0,0);
+ lcd.printString(" Start",0,2);
+ lcd.printString(" Help",0,4);
+ help11.draw_arrow(lcd);
+ lcd.refresh();
+ while(pad.check_event(Gamepad::Y_PRESSED) == true);
+
+ //press START to start game
+ do{
+ engine.start(pad,lcd);
+ }
+ while(pad.check_event(Gamepad::START_PRESSED) == false);
+}
+
+
void init()
{
- //initialise LCD and Gamepad
- lcd.init();
- pad.init();
-
-
+ //initialise LCD and Gamepad
+ lcd.init();
+ pad.init();
}
-/*
-void welcome() {
-
- lcd.printString(" Boom",0,0);
- lcd.printString(" Press start",0,2);
- lcd.printString(" help",0,4);
- //lcd.printString(" Press Start ",0,4);
- lcd.refresh();
-
- //LEDs keep flashing until start button is pressed
- while ( pad.check_event(Gamepad::START_PRESSED) == false) {
- pad.leds_on();
- wait(0.1);
- pad.leds_off();
- wait(0.1);
- }
- }
- */
+
void render()
{
- // clear screen, re-draw and refresh
- lcd.clear();
- engine.draw(lcd);
- lcd.refresh();
+ // clear screen, re-draw and refresh
+ lcd.clear();
+ engine.draw(lcd);
+ lcd.refresh();
}