![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Starter code for Georgia Tech ECE 2036 Summer 2014 Lab 2
Dependencies: 4DGL-uLCD-SE PinDetect mbed
paddle.h@2:6163865f5ce3, 2014-06-20 (annotated)
- Committer:
- jlind6
- Date:
- Fri Jun 20 15:22:28 2014 +0000
- Revision:
- 2:6163865f5ce3
- Parent:
- 0:356124c0bafc
(Typo) On line 135, changed a vy to a vx.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jlind6 | 0:356124c0bafc | 1 | #include "uLCD_4DGL.h" |
jlind6 | 0:356124c0bafc | 2 | |
jlind6 | 0:356124c0bafc | 3 | class Paddle |
jlind6 | 0:356124c0bafc | 4 | { |
jlind6 | 0:356124c0bafc | 5 | public: |
jlind6 | 0:356124c0bafc | 6 | // Constructors |
jlind6 | 0:356124c0bafc | 7 | Paddle(int, int); |
jlind6 | 0:356124c0bafc | 8 | Paddle(int, int, int, int); |
jlind6 | 0:356124c0bafc | 9 | // Set Functions |
jlind6 | 0:356124c0bafc | 10 | void setLength(int); |
jlind6 | 0:356124c0bafc | 11 | void setWidth(int); |
jlind6 | 0:356124c0bafc | 12 | void setPaddleMove(int); |
jlind6 | 0:356124c0bafc | 13 | void setLimits(int, int); // upper and lower limits of the paddle |
jlind6 | 0:356124c0bafc | 14 | // Get Function |
jlind6 | 0:356124c0bafc | 15 | int getScore(); |
jlind6 | 0:356124c0bafc | 16 | // Member Functions |
jlind6 | 0:356124c0bafc | 17 | void movePaddle(bool); // moves the paddle locations (does not draw!) |
jlind6 | 0:356124c0bafc | 18 | bool checkHitX(int, int, int); // Using a position and radius, checks to see if something has hit the paddle in the x direction |
jlind6 | 0:356124c0bafc | 19 | bool checkHitY(int, int, int); // Using a position and radius, checks to see if something has hit the paddle in the y direction |
jlind6 | 0:356124c0bafc | 20 | void resetScore(); // sets score to 0 |
jlind6 | 0:356124c0bafc | 21 | void initDraw(uLCD_4DGL *uLCD); // draw the paddle initially (draws the whole thing) |
jlind6 | 0:356124c0bafc | 22 | void redraw(uLCD_4DGL *uLCD); // draws the paddle for a move (does NOT draw the whole thing) |
jlind6 | 0:356124c0bafc | 23 | |
jlind6 | 0:356124c0bafc | 24 | |
jlind6 | 0:356124c0bafc | 25 | private: |
jlind6 | 0:356124c0bafc | 26 | // Data members are suggestions, feel free to add/remove |
jlind6 | 0:356124c0bafc | 27 | int score; |
jlind6 | 0:356124c0bafc | 28 | int x; |
jlind6 | 0:356124c0bafc | 29 | int y; |
jlind6 | 0:356124c0bafc | 30 | int oldy; |
jlind6 | 0:356124c0bafc | 31 | int length; |
jlind6 | 0:356124c0bafc | 32 | int width; |
jlind6 | 0:356124c0bafc | 33 | int paddleMove; |
jlind6 | 0:356124c0bafc | 34 | int topLimit; |
jlind6 | 0:356124c0bafc | 35 | int bottomLimit; |
jlind6 | 0:356124c0bafc | 36 | }; |
jlind6 | 0:356124c0bafc | 37 |