Simple Pong game on NokiaLCD with PS2
Dependencies: mbed PS2 NokiaLCD
paddle.h@1:3cc8b1413557, 2011-02-28 (annotated)
- Committer:
- wjohnsto
- Date:
- Mon Feb 28 00:12:36 2011 +0000
- Revision:
- 1:3cc8b1413557
- Parent:
- 0:93dce1e528b9
Commented code
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 Paddle { |
wjohnsto | 0:93dce1e528b9 | 4 | /* This class creates a paddle object */ |
wjohnsto | 0:93dce1e528b9 | 5 | |
wjohnsto | 0:93dce1e528b9 | 6 | // Attributes |
wjohnsto | 0:93dce1e528b9 | 7 | int x,y,width,height,color,lives,score; |
wjohnsto | 0:93dce1e528b9 | 8 | |
wjohnsto | 0:93dce1e528b9 | 9 | public: |
wjohnsto | 1:3cc8b1413557 | 10 | // Constructors |
wjohnsto | 0:93dce1e528b9 | 11 | Paddle(); |
wjohnsto | 0:93dce1e528b9 | 12 | Paddle(int x, int y, int w, int h, int c, int l, int s); |
wjohnsto | 0:93dce1e528b9 | 13 | |
wjohnsto | 0:93dce1e528b9 | 14 | // Member functions |
wjohnsto | 0:93dce1e528b9 | 15 | void move(NokiaLCD &lcd, int increment); |
wjohnsto | 0:93dce1e528b9 | 16 | void moveCPU(NokiaLCD &lcd, int _y); |
wjohnsto | 0:93dce1e528b9 | 17 | void draw(NokiaLCD &lcd, bool isBlack) const; |
wjohnsto | 0:93dce1e528b9 | 18 | bool loseLife(); |
wjohnsto | 0:93dce1e528b9 | 19 | void addPoint(); |
wjohnsto | 0:93dce1e528b9 | 20 | int size() const; |
wjohnsto | 0:93dce1e528b9 | 21 | int getWidth() const; |
wjohnsto | 0:93dce1e528b9 | 22 | int getHeight() const; |
wjohnsto | 0:93dce1e528b9 | 23 | int getX() const; |
wjohnsto | 0:93dce1e528b9 | 24 | int getY() const; |
wjohnsto | 0:93dce1e528b9 | 25 | int getLives() const; |
wjohnsto | 0:93dce1e528b9 | 26 | int getScore() const; |
wjohnsto | 0:93dce1e528b9 | 27 | void setLives(int l); |
wjohnsto | 0:93dce1e528b9 | 28 | |
wjohnsto | 0:93dce1e528b9 | 29 | }; |