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.cpp
- Revision:
- 2:5d4f2c3f3c0a
- Parent:
- 1:5e564d218751
- Child:
- 3:d8deea6454df
--- a/Basket.cpp Tue Mar 14 10:47:43 2017 +0000 +++ b/Basket.cpp Fri Mar 17 15:33:58 2017 +0000 @@ -9,17 +9,7 @@ { } -/** 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; @@ -29,13 +19,6 @@ 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); @@ -47,23 +30,13 @@ 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) +void Basket::Basket_move(Direction d, float mag) { - basket_speed = int(mag*5.0f); + basket_speed = int(mag*8.0f); - if (d == E || pad.check_event(Gamepad::R_PRESSED)) { + if (d == E) { basket_x += basket_speed; - } else if (d == W || pad.check_event(Gamepad::L_PRESSED)) { + } else if (d == W) { basket_x -= basket_speed; } @@ -75,29 +48,12 @@ } } -/** Basket_score - * - * set score - * - */ void Basket::Basket_score() { basket_score++; } -/** get_Basket_score - * - * return score - * - */ int Basket::get_Basket_score() { return basket_score; -} -/* -Vector2D Basket::Basket_position() -{ - Vector2D pos = (basket_x,basket_y); - return pos; -} -*/ \ No newline at end of file +} \ No newline at end of file