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:b62e8be35a5d
- Parent:
- 1:37802772843e
- Child:
- 3:b34685dbdb8d
diff -r 37802772843e -r b62e8be35a5d main.cpp
--- a/main.cpp Mon Mar 25 10:48:23 2019 +0000
+++ b/main.cpp Tue Apr 02 10:45:44 2019 +0000
@@ -9,6 +9,8 @@
*/
const int fps = 15;
+int processedTime;
+
///////// pre-processor directives ////////
#include "mbed.h"
@@ -18,30 +20,42 @@
#include "Game.h"
+////// Constants //////
+#define GRAVITY (0,-1)
+
+
+
/////////////// objects ///////////////
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
Gamepad pad;
Game game;
+
///////////// prototypes ///////////////
void init();
void welcome();
// initialies all classes and libraries
void init()
+
{
+
// need to initialise LCD and Gamepad
lcd.init();
+ lcd.setContrast(0.4);
pad.init();
+
+ processedTime = time(NULL);
}
// simple splash screen displayed on start-up
void welcome() {
- lcd.printString(" WOoo ",0,1);
+
+ lcd.printString(" WOo2 ",0,1);
lcd.printString(" Press Start ",0,4);
lcd.refresh();
@@ -51,25 +65,31 @@
wait(0.1);
pad.leds_off();
wait(0.1);
+ printf("Welcome\n");
}
-
+
}
int main()
{
init(); // initialise and then display welcome screen...
welcome(); // waiting for the user to start
+ lcd.clear();
+ lcd.refresh();
+ printf("MAIN\n");
- // first draw the initial frame
- wait(1.0f/fps); // and wait for one frame period
// game loop - read input, update the game state and render the display
while (1) {
+
+ printf("TIME: %i\n",processedTime);
+
game.read_input(pad);
game.update(pad);
game.draw(lcd);
+ wait(0.1);
+
- wait(1.0f/fps);
}
}
\ No newline at end of file