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@9:05fd30d491f1, 2017-04-22 (annotated)
- Committer:
- Nathanj94
- Date:
- Sat Apr 22 12:21:58 2017 +0000
- Revision:
- 9:05fd30d491f1
- Parent:
- 8:48c5adc809e1
- Child:
- 10:2e441532206e
Removed redundancy and organised header/main ready for final notes
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 | 9:05fd30d491f1 | 14 | |
Nathanj94 | 9:05fd30d491f1 | 15 | //INITILISATION FUNCTION// |
Nathanj94 | 5:32421eb42841 | 16 | void init(int y, int width); |
Nathanj94 | 9:05fd30d491f1 | 17 | |
Nathanj94 | 9:05fd30d491f1 | 18 | //UPDATE FUNCTIONS// |
Nathanj94 | 8:48c5adc809e1 | 19 | void move_stick(Direction d, float mag); |
Nathanj94 | 8:48c5adc809e1 | 20 | void move_LR(Gamepad &pad); |
Nathanj94 | 9:05fd30d491f1 | 21 | |
Nathanj94 | 9:05fd30d491f1 | 22 | //SCORE FUNCTIONS// |
Nathanj94 | 6:2aec1ed2a75a | 23 | void add_score_1(); |
Nathanj94 | 6:2aec1ed2a75a | 24 | void add_score_2(); |
Nathanj94 | 6:2aec1ed2a75a | 25 | void add_score_5(); |
Nathanj94 | 6:2aec1ed2a75a | 26 | void add_score_10(); |
Nathanj94 | 5:32421eb42841 | 27 | int get_score(); |
Nathanj94 | 9:05fd30d491f1 | 28 | |
Nathanj94 | 9:05fd30d491f1 | 29 | //DISPLAY FUNCTIONS// |
Nathanj94 | 9:05fd30d491f1 | 30 | void draw(N5110 &lcd); |
Nathanj94 | 5:32421eb42841 | 31 | int get_x(); |
Nathanj94 | 5:32421eb42841 | 32 | int get_y(); |
Nathanj94 | 0:7e132fca6044 | 33 | |
Nathanj94 | 0:7e132fca6044 | 34 | private: |
Nathanj94 | 2:5d4f2c3f3c0a | 35 | |
Nathanj94 | 5:32421eb42841 | 36 | int y_ref; |
Nathanj94 | 5:32421eb42841 | 37 | int x_ref; |
Nathanj94 | 0:7e132fca6044 | 38 | int basket_width; |
Nathanj94 | 5:32421eb42841 | 39 | int stick_speed; |
Nathanj94 | 5:32421eb42841 | 40 | int score; |
Nathanj94 | 0:7e132fca6044 | 41 | |
Nathanj94 | 0:7e132fca6044 | 42 | }; |
Nathanj94 | 0:7e132fca6044 | 43 | #endif |
Nathanj94 | 0:7e132fca6044 | 44 |