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
Diff: Basket.h
- Revision:
- 12:b142d87160f1
- Parent:
- 10:2e441532206e
- Child:
- 13:6865b08e82c3
--- a/Basket.h Thu May 04 10:28:56 2017 +0000 +++ b/Basket.h Thu May 04 11:16:07 2017 +0000 @@ -7,105 +7,104 @@ class Basket { - public: - +public: + Basket(); ~Basket(); - + //INITILISATION FUNCTION// - + /** Initialise Basket - * - * Sets reference points by which basket can be drawn on screen. - * Sets score equal to zero. - * @param y - y co-ordinate of the basket (0 to 47)(41 by default) - * @param width - width of the basket (0 to 83)(12 by default) - */ + * + * Sets reference points by which basket can be drawn on screen. + * Sets score equal to zero. + * @param y - y co-ordinate of the basket (0 to 47)(41 by default) + * @param width - width of the basket (0 to 83)(12 by default) + */ void init(int y, int width); - - + + //UPDATE FUNCTIONS// - + /** Move Basket w/ Joystick - * - * Move the basket left/right using the gamepad's joystick. - * @param d - direction the joystick is pushed towards (N,NE,E,SE,S,SW,W,NW) - * @param mag - float in range 0.0 to 1.0 - */ + * + * Move the basket left/right using the gamepad's joystick. + * @param d - direction the joystick is pushed towards (N,NE,E,SE,S,SW,W,NW) + * @param mag - float in range 0.0 to 1.0 + */ void move_stick(Direction d, float mag); - + /** Move the basket w/ L and R - * - * Move the basket left/right using the gamepad's L and R buttons. - * @param pad - Gamepad custom library - */ + * + * Move the basket left/right using the gamepad's L and R buttons. + * @param pad - Gamepad custom library + */ void move_LR(Gamepad &pad); - - + + //SCORE FUNCTIONS// - + /** Increase Score (1) - * - * Adds 1 to overall score. - */ + * + * Adds 1 to overall score. + */ void add_score_1(); - + /** Increase Score (2) - * - * Adds 2 to overall score. - */ + * + * Adds 2 to overall score. + */ void add_score_2(); - + /** Increase Score (3) - * - * Adds 5 to overall score. - */ + * + * Adds 5 to overall score. + */ void add_score_5(); - + /** Increase Score (4) - * - * Adds 10 to overall score. - */ + * + * Adds 10 to overall score. + */ void add_score_10(); - + /** Get Score - * - * Returns value of score. - */ + * + * Returns value of score. + */ int get_score(); - - + + //DISPLAY FUNCTIONS// - + /** Draw Basket * - * Draw the basket in the screen buffer using + * Draw the basket in the screen buffer using * the reference points set in Basket::init(). * @param lcd - N5110 custom library */ void draw(N5110 &lcd); - + /** Get x * * Return value of the x co-ordinate (0 to 71). */ int get_x(); - + /** Get y * * Return value of the y co-ordinate (0 to 47). */ int get_y(); - - private: - + +private: + //VARIABLES// int y_ref; int x_ref; int basket_width; int stick_speed; int score; - + }; #endif - \ No newline at end of file