Starter code for Georgia Tech ECE 2036 Summer 2014 Lab 2

Dependencies:   4DGL-uLCD-SE PinDetect mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ball.h Source File

ball.h

00001 #include "tempModule.h"
00002 #include "uLCD_4DGL.h"
00003 
00004 class Ball
00005 {
00006 public:    
00007     // Constructors
00008     Ball ();
00009     Ball (float, float, int);
00010     /* For Part 3: 
00011      * you need to be able to pass a pin to the 
00012      * tempModule object from main, so you should
00013      * add in a PinName argument.
00014      */
00015     Ball(PinName);
00016     Ball(PinName, float, float, int);
00017     */
00018     // Set Functions
00019     void setBaseVx(float); // This sets the lowest velocity of vx (for Thermal pong) or the constant velocity
00020     void setBaseVy(float); // This sets the lowest velocity of vy (for Thermal pong) or the constant velocity
00021     void setVxSign(int); 
00022     void setVySign(int);
00023     // Get Functions
00024     int getFutureX();   // get estimate of where the ball will be in the next update()
00025     int getFutureY();   // get estimate of where the ball will be in the next update()
00026     // Member Functions
00027     void reverseXDirection(); // negate the sign for when a ball hits something
00028     void reverseYDirection(); // negate the sign for when a ball hits something
00029     void reset(int, int, int, int, uLCD_4DGL *); // takes in a new location and new directions and draws the starting point for the ball
00030     void update(uLCD_4DGL *); // moves the ball on the screen one vx and vy
00031     
00032 private:
00033     // Data members are suggestions, feel free to add/remove
00034     TempModule *tempSensor; // Pointer -- it's recommended to use "new" operator to create this
00035     int vxSign;
00036     int vySign;
00037     float fx;
00038     float fy;
00039     int x;
00040     int y;
00041     int radius;
00042     bool lose;
00043 };