Library that draws a basket on a Nokia N5110 LCD display and allows it to be moved left/right on the display using buttons or a joystick.
Dependents: Game_Controller_Project
Basket.h@5:32421eb42841, 2017-03-23 (annotated)
- Committer:
- Nathanj94
- Date:
- Thu Mar 23 15:24:22 2017 +0000
- Revision:
- 5:32421eb42841
- Parent:
- 4:4ce558075c32
- Child:
- 6:2aec1ed2a75a
Improved names of functions and variables;; Added use of L/R buttons to move basket but not working while the buttons are held down, only with each press
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Nathanj94 | 0:7e132fca6044 | 1 | #ifndef BASKET_H |
Nathanj94 | 0:7e132fca6044 | 2 | #define BASKET_H |
Nathanj94 | 0:7e132fca6044 | 3 | |
Nathanj94 | 0:7e132fca6044 | 4 | #include "mbed.h" |
Nathanj94 | 0:7e132fca6044 | 5 | #include "N5110.h" |
Nathanj94 | 0:7e132fca6044 | 6 | #include "Gamepad.h" |
Nathanj94 | 0:7e132fca6044 | 7 | |
Nathanj94 | 0:7e132fca6044 | 8 | class Basket |
Nathanj94 | 0:7e132fca6044 | 9 | { |
Nathanj94 | 0:7e132fca6044 | 10 | public: |
Nathanj94 | 2:5d4f2c3f3c0a | 11 | |
Nathanj94 | 0:7e132fca6044 | 12 | Basket(); |
Nathanj94 | 0:7e132fca6044 | 13 | ~Basket(); |
Nathanj94 | 5:32421eb42841 | 14 | void init(int y, int width); |
Nathanj94 | 5:32421eb42841 | 15 | void draw(N5110 &lcd); |
Nathanj94 | 5:32421eb42841 | 16 | void move(Direction d, float mag, Gamepad &pad); |
Nathanj94 | 5:32421eb42841 | 17 | void add_score(); |
Nathanj94 | 5:32421eb42841 | 18 | int get_score(); |
Nathanj94 | 5:32421eb42841 | 19 | int get_x(); |
Nathanj94 | 5:32421eb42841 | 20 | int get_y(); |
Nathanj94 | 0:7e132fca6044 | 21 | |
Nathanj94 | 0:7e132fca6044 | 22 | private: |
Nathanj94 | 2:5d4f2c3f3c0a | 23 | |
Nathanj94 | 5:32421eb42841 | 24 | int y_ref; |
Nathanj94 | 5:32421eb42841 | 25 | int x_ref; |
Nathanj94 | 0:7e132fca6044 | 26 | int basket_width; |
Nathanj94 | 5:32421eb42841 | 27 | int stick_speed; |
Nathanj94 | 5:32421eb42841 | 28 | int bumper_speed; |
Nathanj94 | 5:32421eb42841 | 29 | int score; |
Nathanj94 | 0:7e132fca6044 | 30 | |
Nathanj94 | 0:7e132fca6044 | 31 | }; |
Nathanj94 | 0:7e132fca6044 | 32 | #endif |
Nathanj94 | 0:7e132fca6044 | 33 |