Simple Pong game on NokiaLCD with PS2
Dependencies: mbed PS2 NokiaLCD
ball.h@2:d1031c73e187, 2011-02-28 (annotated)
- Committer:
- wjohnsto
- Date:
- Mon Feb 28 00:22:23 2011 +0000
- Revision:
- 2:d1031c73e187
- Parent:
- 1:3cc8b1413557
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wjohnsto | 0:93dce1e528b9 | 1 | #include "NokiaLCD.h" |
wjohnsto | 0:93dce1e528b9 | 2 | |
wjohnsto | 0:93dce1e528b9 | 3 | class Ball { |
wjohnsto | 0:93dce1e528b9 | 4 | /* This class creates a ball object */ |
wjohnsto | 0:93dce1e528b9 | 5 | |
wjohnsto | 0:93dce1e528b9 | 6 | // Attributes |
wjohnsto | 0:93dce1e528b9 | 7 | int x,y,width,height,color,xInc,yInc; |
wjohnsto | 0:93dce1e528b9 | 8 | |
wjohnsto | 0:93dce1e528b9 | 9 | public: |
wjohnsto | 1:3cc8b1413557 | 10 | // Constructors |
wjohnsto | 0:93dce1e528b9 | 11 | Ball(); |
wjohnsto | 0:93dce1e528b9 | 12 | Ball(int x, int y, int w, int h, int c, int xi, int yi); |
wjohnsto | 0:93dce1e528b9 | 13 | |
wjohnsto | 0:93dce1e528b9 | 14 | // Member functions |
wjohnsto | 0:93dce1e528b9 | 15 | void move(NokiaLCD &lcd); |
wjohnsto | 0:93dce1e528b9 | 16 | void draw(NokiaLCD &lcd, bool isBlack) const; |
wjohnsto | 0:93dce1e528b9 | 17 | int getX() const; |
wjohnsto | 0:93dce1e528b9 | 18 | int getY() const; |
wjohnsto | 0:93dce1e528b9 | 19 | bool hitX(); |
wjohnsto | 0:93dce1e528b9 | 20 | bool hitY(); |
wjohnsto | 0:93dce1e528b9 | 21 | bool hitP1(int _x, int _y, int _height); |
wjohnsto | 0:93dce1e528b9 | 22 | bool hitP2(int _x, int _y, int _height); |
wjohnsto | 0:93dce1e528b9 | 23 | int size() const; |
wjohnsto | 0:93dce1e528b9 | 24 | void reverseX(); |
wjohnsto | 0:93dce1e528b9 | 25 | void reverseY(); |
wjohnsto | 0:93dce1e528b9 | 26 | }; |