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 "tempModule.h"
rrr93 0:941225f01ccc 2 #include "uLCD_4DGL.h"
rrr93 0:941225f01ccc 3
rrr93 0:941225f01ccc 4 class Ball
rrr93 0:941225f01ccc 5 {
rrr93 0:941225f01ccc 6 public:
rrr93 0:941225f01ccc 7 // Constructors
rrr93 0:941225f01ccc 8 //Ball ();
rrr93 0:941225f01ccc 9 // Ball (float, float, int);
rrr93 0:941225f01ccc 10 /* For Part 3:
rrr93 0:941225f01ccc 11 * you need to be able to pass a pin to the
rrr93 0:941225f01ccc 12 * tempModule object from main, so you should
rrr93 0:941225f01ccc 13 * add in a PinName argument.
rrr93 0:941225f01ccc 14 */
rrr93 0:941225f01ccc 15 Ball(PinName);
rrr93 0:941225f01ccc 16 Ball(PinName, float, float, int, int, int);
rrr93 0:941225f01ccc 17 //*/
rrr93 0:941225f01ccc 18 // Set Functions
rrr93 0:941225f01ccc 19 void setBaseVx(float); // This sets the lowest velocity of vx (for Thermal pong) or the constant velocity
rrr93 0:941225f01ccc 20 void setBaseVy(float); // This sets the lowest velocity of vy (for Thermal pong) or the constant velocity
rrr93 0:941225f01ccc 21 void setVxSign(int);
rrr93 0:941225f01ccc 22 void setVySign(int);
rrr93 0:941225f01ccc 23 void setX (int);
rrr93 0:941225f01ccc 24 void setY (int);
rrr93 0:941225f01ccc 25 void setRand(int seed);
rrr93 0:941225f01ccc 26 // Get Functions
rrr93 0:941225f01ccc 27 int getVx();
rrr93 0:941225f01ccc 28 int getVy();
rrr93 0:941225f01ccc 29 int getFutureX(); // get estimate of where the ball will be in the next update()
rrr93 0:941225f01ccc 30 int getFutureY(); // get estimate of where the ball will be in the next update()
rrr93 0:941225f01ccc 31 int getRadius();
rrr93 0:941225f01ccc 32 // Member Functions
rrr93 0:941225f01ccc 33 void reverseXDirection(); // negate the sign for when a ball hits something
rrr93 0:941225f01ccc 34 void reverseYDirection(); // negate the sign for when a ball hits something
rrr93 0:941225f01ccc 35 //void reset(int, int, int, int, uLCD_4DGL *); // takes in a new location and new directions and draws the starting point for the ball
rrr93 0:941225f01ccc 36 void dispTemp(uLCD_4DGL *);
rrr93 0:941225f01ccc 37 void update(uLCD_4DGL *); // moves the ball on the screen one vx and vy
rrr93 0:941225f01ccc 38 bool CheckHit(); //check if the ball hit walls
rrr93 0:941225f01ccc 39 bool CheckLose(); //check if the ball is out of bounds
rrr93 0:941225f01ccc 40 private:
rrr93 0:941225f01ccc 41 // Data members are suggestions, feel free to add/remove
rrr93 0:941225f01ccc 42 TempModule *tempSensor; // Pointer -- it's recommended to use "new" operator to create this
rrr93 0:941225f01ccc 43 int vxSign;
rrr93 0:941225f01ccc 44 int vySign;
rrr93 0:941225f01ccc 45 float basevx;
rrr93 0:941225f01ccc 46 float basevy;
rrr93 0:941225f01ccc 47 float fx;
rrr93 0:941225f01ccc 48 float fy;
rrr93 0:941225f01ccc 49 int x;
rrr93 0:941225f01ccc 50 int y;
rrr93 0:941225f01ccc 51 int radius;
rrr93 0:941225f01ccc 52 bool lose;
rrr93 0:941225f01ccc 53 };