Craig Evans
/
Pong
Example Pong game for mbed.
Diff: main.cpp
- Revision:
- 4:d349e5d847cf
- Parent:
- 3:910d7e87f367
- Child:
- 6:d9d05b321b4d
diff -r 910d7e87f367 -r d349e5d847cf main.cpp --- a/main.cpp Sun Mar 05 21:18:09 2017 +0000 +++ b/main.cpp Sun Mar 05 23:19:55 2017 +0000 @@ -5,8 +5,8 @@ #include "PongEngine.h" #define PADDLE_WIDTH 2 -#define PADDLE_HEIGHT 10 -#define BALL_RADIUS 2 +#define PADDLE_HEIGHT 8 +#define BALL_SIZE 2 #define BALL_SPEED 3 /////////////// structs ///////////////// @@ -34,7 +34,7 @@ render(); // draw initial frame wait(1.0f/fps); - // game loop - read input, update the game state and render + // game loop - read input, update the game state and render the display while (1) { pong.read_input(pad); pong.update(pad); @@ -50,7 +50,7 @@ pad.init(); // initialise the game - pong.init(PADDLE_WIDTH,PADDLE_HEIGHT,BALL_RADIUS,BALL_SPEED); + pong.init(PADDLE_WIDTH,PADDLE_HEIGHT,BALL_SIZE,BALL_SPEED); } @@ -64,8 +64,8 @@ void welcome() { - lcd.printString(" Pong! ",0,1); - lcd.printString(" Press Start ",0,4); + lcd.printString(" Pong! ",0,1); + lcd.printString(" Press Start ",0,4); lcd.refresh(); // wait flashing LEDs until start button is pressed