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@6:2aec1ed2a75a, 2017-03-31 (annotated)
- Committer:
- Nathanj94
- Date:
- Fri Mar 31 13:42:55 2017 +0000
- Revision:
- 6:2aec1ed2a75a
- Parent:
- 5:32421eb42841
- Child:
- 8:48c5adc809e1
Replaced add_score() with four similar methods adding different scores, to be called depending on which "fruit" is caught in the basket
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 | 6:2aec1ed2a75a | 17 | void add_score_1(); |
Nathanj94 | 6:2aec1ed2a75a | 18 | void add_score_2(); |
Nathanj94 | 6:2aec1ed2a75a | 19 | void add_score_5(); |
Nathanj94 | 6:2aec1ed2a75a | 20 | void add_score_10(); |
Nathanj94 | 5:32421eb42841 | 21 | int get_score(); |
Nathanj94 | 5:32421eb42841 | 22 | int get_x(); |
Nathanj94 | 5:32421eb42841 | 23 | int get_y(); |
Nathanj94 | 0:7e132fca6044 | 24 | |
Nathanj94 | 0:7e132fca6044 | 25 | private: |
Nathanj94 | 2:5d4f2c3f3c0a | 26 | |
Nathanj94 | 5:32421eb42841 | 27 | int y_ref; |
Nathanj94 | 5:32421eb42841 | 28 | int x_ref; |
Nathanj94 | 0:7e132fca6044 | 29 | int basket_width; |
Nathanj94 | 5:32421eb42841 | 30 | int stick_speed; |
Nathanj94 | 5:32421eb42841 | 31 | int bumper_speed; |
Nathanj94 | 5:32421eb42841 | 32 | int score; |
Nathanj94 | 0:7e132fca6044 | 33 | |
Nathanj94 | 0:7e132fca6044 | 34 | }; |
Nathanj94 | 0:7e132fca6044 | 35 | #endif |
Nathanj94 | 0:7e132fca6044 | 36 |