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:
- 5:b9cf407bcc63
- Parent:
- 3:b34685dbdb8d
- Child:
- 6:2ca1516ec1e2
--- a/main.cpp Sat Apr 06 11:47:18 2019 +0000
+++ b/main.cpp Sat Apr 06 14:42:34 2019 +0000
@@ -18,6 +18,8 @@
#include "N5110.h"
#include "Sprite.h"
#include "Game.h"
+#include "Music.h"
+#include "SoundData.h"
Timer processedTime;
@@ -30,6 +32,7 @@
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
Gamepad pad;
Game game;
+Music player;
@@ -48,6 +51,8 @@
pad.init();
processedTime.reset();
+
+ player.init(data1,NUM_ELEMENTS);
@@ -71,6 +76,8 @@
}
+int tick = 0.000125;
+
int main()
{
@@ -86,12 +93,17 @@
// game loop - read input, update the game state and render the display
while (1) {
processedTime.start();
- printf("TIME: %i\n",processedTime.read_ms());
+ //printf("TIME: %i\n",processedTime.read_ms());
+//
+// game.read_input(pad);
+// game.update(pad);
+// game.draw(lcd);
+// wait(0.1);
+ if (processedTime.read_us() > 125) {
+ player.play_next();
+ processedTime.reset();
+ }
- game.read_input(pad);
- game.update(pad);
- game.draw(lcd);
- wait(0.1);
}