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:b393cfe4e0a7
- Parent:
- 5:7207c9b70108
- Child:
- 7:f61ac963eb07
--- a/main.cpp Wed May 27 21:13:59 2020 +0000
+++ b/main.cpp Thu May 28 01:11:47 2020 +0000
@@ -3,8 +3,9 @@
#include "Gamepad.h"
#include "N5110.h"
#include "Touch.h"
+#include "Bitmap.h"
#ifdef WITH_TESTING
-#include "test.h"
+# include "tests.h"
#endif
#define PADDLE_WIDTH 2
@@ -21,7 +22,6 @@
N5110 lcd;
Gamepad pad;
Touch touch;
-
///////////// prototypes ///////////////
void init();
void update_game(UserInput input);
@@ -37,16 +37,20 @@
if(number_of_failures > 0) return number_of_failures;
#endif
int fps = 6; // frames per second
- init(); // initialise and then display welcome screen...
- welcome(); // waiting for the user to start;
+ init(); // initialise and then display welcome screen...
+ welcome(); // waiting for the user to start
+ //lcd.drawRect(0,0,84,24,FILL_BLACK);
render(); // first draw the initial frame
+ //lcd.drawRect(0,0,84,24,FILL_BLACK);
wait(1.0f/fps); // and wait for one frame period
//lcd.drawRect(0,0,84,24,FILL_BLACK);
// game loop - read input, update the game state and render the display
while (1) {
+ // pong.read_input(pad);
+ // pong.read_input(pad);
touch.read_input(pad);
- touch.update(pad,lcd);
+ touch.update(pad);
render();
//lcd.drawRect(0,0,84,24,FILL_BLACK);
wait(1.0f/fps);
@@ -61,7 +65,7 @@
pad.init();
// initialise the game with correct ball and paddle sizes
- pong.init(PADDLE_WIDTH,PADDLE_HEIGHT,BALL_SIZE,BALL_SPEED,lcd);
+ touch.init(PADDLE_WIDTH,PADDLE_HEIGHT,BALL_SIZE,BALL_SPEED);
}