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

Revision:
1:5e564d218751
Parent:
0:7e132fca6044
Child:
2:5d4f2c3f3c0a
--- a/Basket.cpp	Tue Mar 14 10:00:01 2017 +0000
+++ b/Basket.cpp	Tue Mar 14 10:47:43 2017 +0000
@@ -9,7 +9,17 @@
 {
     
 }
-
+/** Basket_init
+ *  
+ *  initialise the basket with a y-coordinate and width
+ *  by default the y-coordinate will be 41 and the width 
+ *  is 12 pixels but this could be altered by 
+ *  difficulty settings 
+ *  
+ *  @param y - column number (0 to 47)
+ *  @param width - basket width (0 to 83)
+ *
+ */
 void Basket::Basket_init(int y, int width)
 {
     basket_y = y;
@@ -19,6 +29,13 @@
     basket_score = 0;
 }
 
+/** Basket_draw
+ *
+ *  draw the basket on the lcd using x and y parameters set in Basket_init
+ *
+ *  @param N5110 - lcd display
+ *
+ */
 void Basket::Basket_draw(N5110 &lcd)
 {
     lcd.drawRect(basket_x,basket_y, 1, 2, 0);
@@ -30,6 +47,16 @@
     lcd.drawRect(basket_x + 11, basket_y, 1, 2, 0);
 }
 
+/** Basket_move
+ *
+ *  move the basket left and right at a set y-coordinate
+ *  using the joystick or L/R buttons
+ *
+ *  @param d - joystick direction (N,NE,E,SE,S,SW,W,NW)
+ *  @param mag - joystick directional magnitude (0 to 1)
+ *  @param pad - call the Gamepad class to interact w/ buttons
+ *
+ */
 void Basket::Basket_move(Direction d, float mag, Gamepad &pad)
 {
     basket_speed = int(mag*5.0f);
@@ -48,11 +75,21 @@
     }
 }
 
+/** Basket_score
+ * 
+ *  set score
+ *
+ */
 void Basket::Basket_score()
 {
     basket_score++;
 }
 
+/** get_Basket_score
+ *
+ *  return score
+ *
+ */
 int Basket::get_Basket_score()
 {
     return basket_score;