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:
- 6:4c55dd4b6d42
- Parent:
- 5:5e92567d0a44
- Child:
- 7:9e9424f5ec4b
--- a/main.cpp Tue Apr 16 20:15:09 2019 +0000
+++ b/main.cpp Fri May 03 19:17:56 2019 +0000
@@ -15,6 +15,10 @@
#include "Gamepad.h"
#include "N5110.h"
#include "menu.h"
+#include "Tone.h"
+#include "engine.h"
+
+
/////////////// structs /////////////////
@@ -26,20 +30,25 @@
///////////// prototypes ///////////////
void init();
void welcome();
+void render();
///////////// functions ////////////////
int main() {
init();
- while(true) {
- welcome();
+ welcome();
+
+ // game loop - read input, update the game state and render the display
+ while(1) {
+ render();
}
}
// initialies all classes and libraries
void init()
{
+
// need to initialise LCD and Gamepad
lcd.init();
gamepad.init();
@@ -47,9 +56,15 @@
gamepad.leds_on();
lcd.setContrast(0.4);
}
-
+// function to call the intro method of the menu class
void welcome() {
Menu menu;
- menu.intro(lcd);
+ menu.intro(lcd, gamepad);
+}
+// this function draws each frame on the LCD
+void render() {
+
+ lcd.clear();
+ lcd.refresh();
}
\ No newline at end of file