Two player imu pong

Dependencies:   4DGL-uLCD-SE IMUfilter LSM9DS0 PinDetect mbed

Committer:
rrr93
Date:
Thu Oct 22 16:50:22 2015 +0000
Revision:
0:941225f01ccc
qewrt

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rrr93 0:941225f01ccc 1 #include "uLCD_4DGL.h"
rrr93 0:941225f01ccc 2
rrr93 0:941225f01ccc 3 class Paddle
rrr93 0:941225f01ccc 4 {
rrr93 0:941225f01ccc 5 public:
rrr93 0:941225f01ccc 6 // Constructors
rrr93 0:941225f01ccc 7 Paddle(int, int);
rrr93 0:941225f01ccc 8 Paddle(int, int, int, int);
rrr93 0:941225f01ccc 9 // Set Functions
rrr93 0:941225f01ccc 10 void setLength(int);
rrr93 0:941225f01ccc 11 void setWidth(int);
rrr93 0:941225f01ccc 12 void setPaddleMove(int);
rrr93 0:941225f01ccc 13 void setLimits(int, int); // upper and lower limits of the paddle
rrr93 0:941225f01ccc 14 // Get Function
rrr93 0:941225f01ccc 15 int getScore();
rrr93 0:941225f01ccc 16 // Member Functions
rrr93 0:941225f01ccc 17 void movePaddle(bool); // moves the paddle locations (does not draw!)
rrr93 0:941225f01ccc 18 bool checkHitX(int, int, int, bool); // Using a position and radius, checks to see if something has hit the paddle in the x direction. The bool is to determine if it is the left or right paddle
rrr93 0:941225f01ccc 19 bool checkHitY(int, int, int); // Using a position and radius, checks to see if something has hit the paddle in the y direction
rrr93 0:941225f01ccc 20 void resetScore(); // sets score to 0
rrr93 0:941225f01ccc 21 void initDraw(uLCD_4DGL *uLCD); // draw the paddle initially (draws the whole thing)
rrr93 0:941225f01ccc 22 void redraw(uLCD_4DGL *uLCD); // draws the paddle for a move (does NOT draw the whole thing)
rrr93 0:941225f01ccc 23
rrr93 0:941225f01ccc 24
rrr93 0:941225f01ccc 25 private:
rrr93 0:941225f01ccc 26 // Data members are suggestions, feel free to add/remove
rrr93 0:941225f01ccc 27 int score;
rrr93 0:941225f01ccc 28 int x;
rrr93 0:941225f01ccc 29 int y;
rrr93 0:941225f01ccc 30 int oldy;
rrr93 0:941225f01ccc 31 int length;
rrr93 0:941225f01ccc 32 int width;
rrr93 0:941225f01ccc 33 int paddleMove;
rrr93 0:941225f01ccc 34 int topLimit;
rrr93 0:941225f01ccc 35 int bottomLimit;
rrr93 0:941225f01ccc 36 };
rrr93 0:941225f01ccc 37