Library to calculate movement and to draw the objects in the pong game
Dependencies: RTC-DS1307 SPI_TFT_ILI9341 TFT_fonts mbed
Fork of MainSketch by
2manpong.cpp@11:d812de0e5136, 2017-05-24 (annotated)
- Committer:
- tunagonen
- Date:
- Wed May 24 15:18:13 2017 +0000
- Revision:
- 11:d812de0e5136
- Parent:
- pong.cpp@10:6940a3201757
l
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tunagonen | 10:6940a3201757 | 1 | |
tunagonen | 10:6940a3201757 | 2 | #include "libs.h" |
tunagonen | 11:d812de0e5136 | 3 | #include "2manpong.h" |
tunagonen | 10:6940a3201757 | 4 | |
tunagonen | 10:6940a3201757 | 5 | int main() { |
tunagonen | 10:6940a3201757 | 6 | |
tunagonen | 10:6940a3201757 | 7 | AnalogIn Player1(); //reading analog inputs from the potentiometers |
tunagonen | 10:6940a3201757 | 8 | AnalogIn Player2(); |
tunagonen | 10:6940a3201757 | 9 | int SCREENH = 239 ; //screen height |
tunagonen | 10:6940a3201757 | 10 | int SCREENW = 319 ; //screen width |
tunagonen | 10:6940a3201757 | 11 | int PADDLEW = 10 ; // paddle width |
tunagonen | 10:6940a3201757 | 12 | int PADDLEH = 40 ; // paddle height |
tunagonen | 10:6940a3201757 | 13 | int PADDLEG = 10 ; // paddle gap from the touchscreen |
tunagonen | 10:6940a3201757 | 14 | int ABALL = 10 ; // ball size |
tunagonen | 10:6940a3201757 | 15 | int PADDLE_A = 0 ; // location paddle A |
tunagonen | 10:6940a3201757 | 16 | int PADDLE_B = 0 ; // location paddle B |
tunagonen | 10:6940a3201757 | 17 | int PADDLE_AF = 0 ; // final location paddle A |
tunagonen | 10:6940a3201757 | 18 | int PADDLE_BF = 0 ; // final location paddle B |
tunagonen | 10:6940a3201757 | 19 | float XBALL = 0 ; // ball's x location |
tunagonen | 10:6940a3201757 | 20 | float YBALL = 0 ; // ball's y location |
tunagonen | 10:6940a3201757 | 21 | |
tunagonen | 10:6940a3201757 | 22 | float VXball = 3 ; // velocity in x-direction |
tunagonen | 10:6940a3201757 | 23 | float VYball = 2 ; // velocity in y-direction |
tunagonen | 10:6940a3201757 | 24 | |
tunagonen | 10:6940a3201757 | 25 | while(1) { |
tunagonen | 10:6940a3201757 | 26 | draw(); |
tunagonen | 10:6940a3201757 | 27 | move(); |
tunagonen | 10:6940a3201757 | 28 | } |
tunagonen | 10:6940a3201757 | 29 | } |
tunagonen | 10:6940a3201757 | 30 |