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@1:5e564d218751, 2017-03-14 (annotated)
- Committer:
- Nathanj94
- Date:
- Tue Mar 14 10:47:43 2017 +0000
- Revision:
- 1:5e564d218751
- Parent:
- 0:7e132fca6044
- Child:
- 2:5d4f2c3f3c0a
Basket.h complete with documentation
; Basket.cpp complete with most documentation finished
; Functionality tested, the basket can be moved across the screen with implemented boundary conditions to keep it on the screen
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 | 1:5e564d218751 | 11 | /** |
Nathanj94 | 1:5e564d218751 | 12 | * |
Nathanj94 | 1:5e564d218751 | 13 | * functions focused on the functionality of the basket: |
Nathanj94 | 1:5e564d218751 | 14 | * initialise the basket, draw the basket on the lcd, move the basket |
Nathanj94 | 1:5e564d218751 | 15 | * along the x-axis and keep score |
Nathanj94 | 1:5e564d218751 | 16 | * |
Nathanj94 | 1:5e564d218751 | 17 | */ |
Nathanj94 | 0:7e132fca6044 | 18 | Basket(); |
Nathanj94 | 0:7e132fca6044 | 19 | ~Basket(); |
Nathanj94 | 0:7e132fca6044 | 20 | void Basket_init(int y, int width); |
Nathanj94 | 0:7e132fca6044 | 21 | void Basket_draw(N5110 &lcd); |
Nathanj94 | 0:7e132fca6044 | 22 | void Basket_move(Direction d, float mag, Gamepad &pad); |
Nathanj94 | 0:7e132fca6044 | 23 | void Basket_score(); |
Nathanj94 | 0:7e132fca6044 | 24 | int get_Basket_score(); |
Nathanj94 | 0:7e132fca6044 | 25 | Vector2D Basket_position(); |
Nathanj94 | 0:7e132fca6044 | 26 | |
Nathanj94 | 0:7e132fca6044 | 27 | private: |
Nathanj94 | 1:5e564d218751 | 28 | /** |
Nathanj94 | 1:5e564d218751 | 29 | * |
Nathanj94 | 1:5e564d218751 | 30 | * variables used to carry out functions: |
Nathanj94 | 1:5e564d218751 | 31 | * basket_y set in Basket_init |
Nathanj94 | 1:5e564d218751 | 32 | * basket_x given by width of display and width of basket |
Nathanj94 | 1:5e564d218751 | 33 | * basket_width set in Basket_init |
Nathanj94 | 1:5e564d218751 | 34 | * basket_speed set in Basket_init |
Nathanj94 | 1:5e564d218751 | 35 | * basket_score set in Basket_init |
Nathanj94 | 1:5e564d218751 | 36 | * |
Nathanj94 | 1:5e564d218751 | 37 | */ |
Nathanj94 | 0:7e132fca6044 | 38 | int basket_y; |
Nathanj94 | 0:7e132fca6044 | 39 | int basket_x; |
Nathanj94 | 0:7e132fca6044 | 40 | int basket_width; |
Nathanj94 | 0:7e132fca6044 | 41 | int basket_speed; |
Nathanj94 | 0:7e132fca6044 | 42 | int basket_score; |
Nathanj94 | 0:7e132fca6044 | 43 | |
Nathanj94 | 0:7e132fca6044 | 44 | }; |
Nathanj94 | 0:7e132fca6044 | 45 | #endif |
Nathanj94 | 0:7e132fca6044 | 46 |