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:
- 2:ee9b361ba6df
- Parent:
- 1:8e319bd14b84
- Child:
- 3:3d35ab70b565
diff -r 8e319bd14b84 -r ee9b361ba6df main.cpp
--- a/main.cpp Sun May 05 14:21:56 2019 +0000
+++ b/main.cpp Sun May 05 21:54:07 2019 +0000
@@ -3,6 +3,7 @@
/////////////// objects ///////////////
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
Gamepad pad;
+Engine engine;
int main() {
@@ -11,15 +12,18 @@
string option = menu();
begin(option);
+ lcd.printString(" END",0,3);
}
void init() {
+
// initialise display and peripherals
lcd.init();
pad.init();
// initialise any in game functions (e.g: sprites)
+ engine.init(MAP_WIDTH,MAP_HEIGHT);
}
void welcome() {
@@ -126,11 +130,19 @@
}
void play() {
- lcd.printString(" Playing!! ",0,0);
- lcd.refresh();
+
+ wait(0.2);
+
+ while (pad.check_event(Gamepad::START_PRESSED) == false) {
+ engine.read(pad);
+ engine.write(MAX_SPEED);
+ engine.render(lcd);
+ wait(0.1);
+ }
}
void tutorial() {
+
lcd.printString(" Tutorial!! ",0,0);
lcd.refresh();
}