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
ball.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 Ball { |
smultron1977 | 0:2353da390056 | 4 | /* This class creates a ball object */ |
smultron1977 | 0:2353da390056 | 5 | |
smultron1977 | 0:2353da390056 | 6 | // Attributes |
smultron1977 | 0:2353da390056 | 7 | int x,y,width,height,color,xInc,yInc; |
smultron1977 | 0:2353da390056 | 8 | |
smultron1977 | 0:2353da390056 | 9 | public: |
smultron1977 | 0:2353da390056 | 10 | // Constructors |
smultron1977 | 0:2353da390056 | 11 | Ball(); |
smultron1977 | 0:2353da390056 | 12 | Ball(int x, int y, int w, int h, int c, int xi, int yi); |
smultron1977 | 0:2353da390056 | 13 | |
smultron1977 | 0:2353da390056 | 14 | // Member functions |
smultron1977 | 0:2353da390056 | 15 | void move(ST7735_TFT &lcd); |
smultron1977 | 0:2353da390056 | 16 | void draw(ST7735_TFT &lcd, bool isBlack) const; |
smultron1977 | 0:2353da390056 | 17 | int getX() const; |
smultron1977 | 0:2353da390056 | 18 | int getY() const; |
smultron1977 | 0:2353da390056 | 19 | bool hitX(); |
smultron1977 | 0:2353da390056 | 20 | bool hitY(); |
smultron1977 | 0:2353da390056 | 21 | bool hitP1(int _x, int _y, int _height); |
smultron1977 | 0:2353da390056 | 22 | bool hitP2(int _x, int _y, int _height); |
smultron1977 | 0:2353da390056 | 23 | int size() const; |
smultron1977 | 0:2353da390056 | 24 | void reverseX(); |
smultron1977 | 0:2353da390056 | 25 | void reverseY(); |
smultron1977 | 0:2353da390056 | 26 | }; |