
Simple vertical scrolling space shooter game using navigation switch (joystick), uLCD-144-G2, and a pushbutton switch.
Dependencies: 4DGL-uLCD-SE PinDetect mbed
Display/Rectangle.cpp@0:5c666e5cd22d, 2016-03-17 (annotated)
- Committer:
- jaspinall3
- Date:
- Thu Mar 17 20:47:11 2016 +0000
- Revision:
- 0:5c666e5cd22d
March 17, 2016 Vertical Scrolling Space Shooter
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jaspinall3 | 0:5c666e5cd22d | 1 | #include "Rectangle.h" |
jaspinall3 | 0:5c666e5cd22d | 2 | |
jaspinall3 | 0:5c666e5cd22d | 3 | Rectangle::Rectangle() { |
jaspinall3 | 0:5c666e5cd22d | 4 | |
jaspinall3 | 0:5c666e5cd22d | 5 | } |
jaspinall3 | 0:5c666e5cd22d | 6 | |
jaspinall3 | 0:5c666e5cd22d | 7 | void Rectangle::init(int x, int y, uLCD_4DGL *uLCD) { |
jaspinall3 | 0:5c666e5cd22d | 8 | initSprite(x, y, uLCD); |
jaspinall3 | 0:5c666e5cd22d | 9 | setDimensions(4,4); |
jaspinall3 | 0:5c666e5cd22d | 10 | } |
jaspinall3 | 0:5c666e5cd22d | 11 | |
jaspinall3 | 0:5c666e5cd22d | 12 | void Rectangle::setDimensions(int height, int width) { |
jaspinall3 | 0:5c666e5cd22d | 13 | _height = height; |
jaspinall3 | 0:5c666e5cd22d | 14 | _width = width; |
jaspinall3 | 0:5c666e5cd22d | 15 | } |
jaspinall3 | 0:5c666e5cd22d | 16 | |
jaspinall3 | 0:5c666e5cd22d | 17 | void Rectangle::drawRect(int baseX, int baseY, int color) { |
jaspinall3 | 0:5c666e5cd22d | 18 | int newX = baseX + _x; |
jaspinall3 | 0:5c666e5cd22d | 19 | int newY = baseY + _y; |
jaspinall3 | 0:5c666e5cd22d | 20 | _uLCDptr->filled_rectangle(newX, newY, newX + _width, newY + _height, color); |
jaspinall3 | 0:5c666e5cd22d | 21 | } |