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:
- 15:47ea86f1ed70
- Parent:
- 13:4026781772cb
- Child:
- 18:e58a1f8e72ad
diff -r 9e2ce28b4e63 -r 47ea86f1ed70 main.cpp
--- a/main.cpp Sun May 06 12:58:00 2018 +0000
+++ b/main.cpp Mon May 07 11:57:22 2018 +0000
@@ -11,24 +11,25 @@
#include "mbed.h"
#include "Gamepad.h"
#include "N5110.h"
+#include "snake_engine.h"
#include "snake.h"
-#include "snake_engine.h"
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
+
Gamepad pad;
snake_engine engine;
+void init();
+void render();
+void welcome();
+void reset();
+
+
struct UserInput {
Direction d;
float mag;
};
-
-void init();
-void render();
-void welcome();
-void reset();
-
int main()
{
init();
@@ -41,9 +42,8 @@
wait(0.05f);
reset();
}
+
}
-
-
void init()
{
lcd.init();
@@ -51,28 +51,27 @@
engine.init();
}
-
void render()
{
-
lcd.clear();
engine.draw(lcd);
lcd.refresh();
}
-
-
-
-
void welcome()
{
-
+ lcd.printString(" Simple ",0,1);
+ lcd.printString("Snake Game",0,2);
+ lcd.printString(" WEI WEI ",0,3);
+ lcd.printString("200975452",0,4);
+ lcd.printString(" PRESS START ",0,5);
+ lcd.refresh();
+ lcd.clear();
+ wait(0.5);
while ( pad.check_event(Gamepad::START_PRESSED) == false) {
}
}
-
-
void reset()
{
if ( pad.check_event(Gamepad::BACK_PRESSED) == true) {
@@ -86,45 +85,3 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-