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:
- 11:5ab36993ebc3
- Parent:
- 10:2e441532206e
diff -r 2e441532206e -r 5ab36993ebc3 Basket.cpp --- a/Basket.cpp Thu Apr 27 12:39:16 2017 +0000 +++ b/Basket.cpp Thu May 04 10:28:56 2017 +0000 @@ -25,7 +25,7 @@ //Move the basket with the joystick void Basket::move_stick(Direction d, float mag) { - stick_speed = int(mag*6.0f); //for a full push (mag = 1) basket will move 6 pixels per loop + stick_speed = int(mag*9.0f); //for a full push (mag = 1) basket will move 6 pixels per loop if (d == E) { //E = right x_ref += stick_speed; @@ -91,13 +91,13 @@ void Basket::draw(N5110 &lcd) { - lcd.drawRect(x_ref,y_ref, 1, 2, 0); - lcd.drawRect(x_ref + 1, y_ref + 2,1,2,0); + lcd.drawRect(x_ref,y_ref, 1, 2, FILL_BLACK); + lcd.drawRect(x_ref + 1, y_ref + 2,1,2,FILL_BLACK); lcd.setPixel(x_ref + 2, y_ref + 4); - lcd.drawRect(x_ref + 2, y_ref + 5, basket_width - 4, 1, 0); + lcd.drawRect(x_ref + 2, y_ref + 5, basket_width - 4, 1, FILL_BLACK); lcd.setPixel(x_ref + 9, y_ref + 4); - lcd.drawRect(x_ref + 10, y_ref + 2, 1, 2, 0); - lcd.drawRect(x_ref + 11, y_ref, 1, 2, 0); + lcd.drawRect(x_ref + 10, y_ref + 2, 1, 2, FILL_BLACK); + lcd.drawRect(x_ref + 11, y_ref, 1, 2, FILL_BLACK); } int Basket::get_x()