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:
- 3:b34685dbdb8d
- Parent:
- 2:b62e8be35a5d
- Child:
- 5:b9cf407bcc63
diff -r b62e8be35a5d -r b34685dbdb8d main.cpp
--- a/main.cpp Tue Apr 02 10:45:44 2019 +0000
+++ b/main.cpp Tue Apr 02 12:40:31 2019 +0000
@@ -9,7 +9,7 @@
*/
const int fps = 15;
-int processedTime;
+
///////// pre-processor directives ////////
@@ -19,9 +19,10 @@
#include "Sprite.h"
#include "Game.h"
+Timer processedTime;
////// Constants //////
-#define GRAVITY (0,-1)
+
@@ -45,9 +46,9 @@
lcd.init();
lcd.setContrast(0.4);
pad.init();
-
+ processedTime.reset();
- processedTime = time(NULL);
+
}
@@ -72,6 +73,8 @@
int main()
{
+
+
init(); // initialise and then display welcome screen...
welcome(); // waiting for the user to start
lcd.clear();
@@ -82,8 +85,8 @@
// game loop - read input, update the game state and render the display
while (1) {
-
- printf("TIME: %i\n",processedTime);
+ processedTime.start();
+ printf("TIME: %i\n",processedTime.read_ms());
game.read_input(pad);
game.update(pad);