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.
Diff: main.cpp
- Revision:
- 8:9d01fd4a63ad
- Parent:
- 3:6253a2d374fa
- Child:
- 9:fe86ddbf7799
diff -r c1e0593bfc99 -r 9d01fd4a63ad main.cpp
--- a/main.cpp Mon Apr 30 18:14:24 2018 +0000
+++ b/main.cpp Sun May 06 20:17:50 2018 +0000
@@ -5,7 +5,7 @@
Name: Andrew Moore
Username: el16ajm
Student ID Number: 201042893
-Date:
+Date:
*/
#include "mbed.h"
@@ -28,15 +28,16 @@
void update_game(UserInput input);
void render();
void welcome();
+void menu();
///////////// functions ////////////////
int main()
{
int fps = 8; // frames per second
-
+
init();
welcome();
-
+
wait(1.0f/fps); // and wait for one frame period
@@ -51,32 +52,35 @@
void welcome()
{
- lcd.printString(" Snake! ",0,1);
+ lcd.printString(" Snake! ",0,1);
lcd.printString(" Press Start ",0,4);
lcd.refresh();
-
- // wait flashing LEDs until start button is pressed
+
+ // wait flashing LEDs 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);
}
+
+ menu();
}
void init()
{
- // need to initialise LCD and Gamepad
+ // need to initialise LCD and Gamepad
gameEngine.init();
lcd.init();
- pad.init();
+ pad.init();
}
void render()
{
// clear screen, re-draw and refresh
- lcd.clear();
+ lcd.clear();
gameEngine.draw(lcd);
lcd.refresh();
}
+