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:
- 10:2e441532206e
- Parent:
- 9:05fd30d491f1
- Child:
- 12:b142d87160f1
diff -r 05fd30d491f1 -r 2e441532206e Basket.h --- a/Basket.h Sat Apr 22 12:21:58 2017 +0000 +++ b/Basket.h Thu Apr 27 12:39:16 2017 +0000 @@ -13,26 +13,93 @@ ~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) + */ 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 + */ 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 + */ void move_LR(Gamepad &pad); + //SCORE FUNCTIONS// + + /** Increase Score (1) + * + * Adds 1 to overall score. + */ void add_score_1(); + + /** Increase Score (2) + * + * Adds 2 to overall score. + */ void add_score_2(); + + /** Increase Score (3) + * + * Adds 5 to overall score. + */ void add_score_5(); + + /** Increase Score (4) + * + * Adds 10 to overall score. + */ void add_score_10(); + + /** Get Score + * + * Returns value of score. + */ int get_score(); + //DISPLAY FUNCTIONS// + + /** Draw Basket + * + * 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: + //VARIABLES// int y_ref; int x_ref; int basket_width;