Su 200943147
Dependencies: Gamepad N5110 mbed
Diff: Shape/Shape.cpp
- Revision:
- 1:4f00a4d5073c
- Parent:
- 0:444b4d0a113d
--- a/Shape/Shape.cpp Tue Apr 11 18:52:08 2017 +0000 +++ b/Shape/Shape.cpp Mon Apr 17 15:37:35 2017 +0000 @@ -7,56 +7,98 @@ void Shape::L_Shape(N5110 &lcd) { - lcd.drawRect(x,y,2,4,FILL_BLACK); - lcd.drawRect(x,y+4,4,2,FILL_BLACK); + Array= {0,0,0,0,0,0, + 0,0,1,1,0,0, + 0,0,1,1,0,0, + 0,0,1,1,0,0, + 0,0,1,1,0,0, + 0,0,1,1,1,1, + 0,0,1,1,1,1, + 0,0,0,0,0,0 + } } void Shape::O_Shape(N5110 &lcd) { - lcd.drawRect(x,y,4,4,FILL_BLACK); + Array= {0,0,0,0,0,0, + 0,0,0,0,0,0, + 0,1,1,1,1,0, + 0,1,1,1,1,0, + 0,1,1,1,1,0, + 0,1,1,1,1,0, + 0,0,0,0,0,0, + 0,0,0,0,0,0 + } } void Shape::S_Shape(N5110 &lcd) { - lcd.drawRect(x,y,2,4,FILL_BLACK); - lcd.drawRect(x+2,y,2,2,FILL_BLACK); - lcd.drawRect(x-2,y+2,2,2,FILL_BLACK); + Array= {0,0,0,0,0,0, + 0,0,0,0,0,0, + 0,0,1,1,1,1, + 0,0,1,1,1,1, + 1,1,1,1,0,0, + 1,1,1,1,0,0, + 0,0,0,0,0,0, + 0,0,0,0,0,0 + } } void Shape::Z_Shape(N5110 &lcd) { - lcd.drawRect(x,y,2,4,FILL_BLACK); - lcd.drawRect(x-2,y,2,2,FILL_BLACK); - lcd.drawRect(x+2,y+2,2,2,FILL_BLACK); + Array= {0,0,0,0,0,0, + 0,0,0,0,0,0, + 1,1,1,1,0,0, + 1,1,1,1,0,0, + 0,0,1,1,1,1, + 0,0,1,1,1,1, + 0,0,0,0,0,0, + 0,0,0,0,0,0 + } } void Shape::I_Shape(N5110 &lcd) { - lcd.drawRect(x,y,2,8,FILL_BLACK); + Array= {0,0,1,1,0,0, + 0,0,1,1,0,0, + 0,0,1,1,0,0, + 0,0,1,1,0,0, + 0,0,1,1,0,0, + 0,0,1,1,0,0, + 0,0,1,1,0,0, + 0,0,1,1,0,0, + } } void Shape::J_Shape(N5110 &lcd) { - lcd.drawRect(x,y,2,4,FILL_BLACK); - lcd.drawRect(x-2,y+4,4,2,FILL_BLACK); + Array= {0,0,0,0,0,0, + 0,0,1,1,0,0, + 0,0,1,1,0,0, + 0,0,1,1,0,0, + 0,0,1,1,0,0, + 1,1,1,1,0,0, + 1,1,1,1,0,0, + 0,0,0,0,0,0 + } } -void Shape::L_Shape(N5110 &lcd) +void Shape::T_Shape(N5110 &lcd) { - lcd.drawRect(x,y,2,4,FILL_BLACK); - lcd.drawRect(x-2,y,2,2,FILL_BLACK); - lcd.drawRect(x+2,y,2,2,FILL_BLACK); + Array= {0,0,0,0,0,0, + 0,0,0,0,0,0, + 1,1,1,1,1,1, + 1,1,1,1,1,1, + 0,0,1,1,0,0, + 0,0,1,1,0,0, + 0,0,0,0,0,0, + 0,0,0,0,0,0 + } } -void Shape::L_Shape(N5110 &lcd) -{ - lcd.drawRect(x,y,2,4,FILL_BLACK); - lcd.drawRect(x-2,y,2,2,FILL_BLACK); - lcd.drawRect(x+2,y,2,2,FILL_BLACK); -} void Shape::Movement(Direction d,float mag) { float mag = joystick.get_mag(); Direction d = joystick.get_direction(); - + if(d == W) { x-=mag*10; } else if(d == E) {