ST7735 Pong by Jonne Valola, derived work from William Johnston\'s mbed Pong for NokiaLCD / PS2 keyboard This pong uses a rotary encoder hooked to pins 21 and 22, ST7735_TFT library by me, RotaryEncoder library by Shinichiro Nakamura. All copyrights of respective owners. Use on your own risk and discretion.
Dependencies: mbed ST7735_TFT RotaryEncoder TFT_fonts_old
paddle.h@0:2353da390056, 2011-12-12 (annotated)
- Committer:
- smultron1977
- Date:
- Mon Dec 12 21:35:42 2011 +0000
- Revision:
- 0:2353da390056
Original 2 hour hack
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
smultron1977 | 0:2353da390056 | 1 | #include "ST7735_TFT.h" |
smultron1977 | 0:2353da390056 | 2 | |
smultron1977 | 0:2353da390056 | 3 | class Paddle { |
smultron1977 | 0:2353da390056 | 4 | /* This class creates a paddle object */ |
smultron1977 | 0:2353da390056 | 5 | |
smultron1977 | 0:2353da390056 | 6 | // Attributes |
smultron1977 | 0:2353da390056 | 7 | int x,y,width,height,color,lives,score; |
smultron1977 | 0:2353da390056 | 8 | |
smultron1977 | 0:2353da390056 | 9 | public: |
smultron1977 | 0:2353da390056 | 10 | // Constructors |
smultron1977 | 0:2353da390056 | 11 | Paddle(); |
smultron1977 | 0:2353da390056 | 12 | Paddle(int x, int y, int w, int h, int c, int l, int s); |
smultron1977 | 0:2353da390056 | 13 | |
smultron1977 | 0:2353da390056 | 14 | // Member functions |
smultron1977 | 0:2353da390056 | 15 | void move(ST7735_TFT &lcd, int increment); |
smultron1977 | 0:2353da390056 | 16 | void moveCPU(ST7735_TFT &lcd, int _y); |
smultron1977 | 0:2353da390056 | 17 | void draw(ST7735_TFT &lcd, bool isBlack) const; |
smultron1977 | 0:2353da390056 | 18 | bool loseLife(); |
smultron1977 | 0:2353da390056 | 19 | void addPoint(); |
smultron1977 | 0:2353da390056 | 20 | int size() const; |
smultron1977 | 0:2353da390056 | 21 | int getWidth() const; |
smultron1977 | 0:2353da390056 | 22 | int getHeight() const; |
smultron1977 | 0:2353da390056 | 23 | int getX() const; |
smultron1977 | 0:2353da390056 | 24 | int getY() const; |
smultron1977 | 0:2353da390056 | 25 | int getLives() const; |
smultron1977 | 0:2353da390056 | 26 | int getScore() const; |
smultron1977 | 0:2353da390056 | 27 | void setLives(int l); |
smultron1977 | 0:2353da390056 | 28 | |
smultron1977 | 0:2353da390056 | 29 | }; |