![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Simple Pong game on NokiaLCD with PS2
Dependencies: mbed PS2 NokiaLCD
ball.h@0:93dce1e528b9, 2011-02-27 (annotated)
- Committer:
- wjohnsto
- Date:
- Sun Feb 27 23:35:17 2011 +0000
- Revision:
- 0:93dce1e528b9
- Child:
- 1:3cc8b1413557
Version 0.0
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 | 0:93dce1e528b9 | 10 | // Constructor |
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 | }; |