Su 200943147

Dependencies:   Gamepad N5110 mbed

Revision:
0:444b4d0a113d
Child:
1:4f00a4d5073c
Child:
2:84e6975dd4b2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Shape/Shape.cpp	Tue Apr 11 18:52:08 2017 +0000
@@ -0,0 +1,70 @@
+#include "Shape.h"
+
+
+Shape::shape()
+{
+}
+
+void Shape::L_Shape(N5110 &lcd)
+{
+    lcd.drawRect(x,y,2,4,FILL_BLACK);
+    lcd.drawRect(x,y+4,4,2,FILL_BLACK);
+}
+
+void Shape::O_Shape(N5110 &lcd)
+{
+    lcd.drawRect(x,y,4,4,FILL_BLACK);
+}
+
+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);
+}
+
+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);
+}
+void Shape::I_Shape(N5110 &lcd)
+{
+    lcd.drawRect(x,y,2,8,FILL_BLACK);
+}
+void Shape::J_Shape(N5110 &lcd)
+{
+    lcd.drawRect(x,y,2,4,FILL_BLACK);
+    lcd.drawRect(x-2,y+4,4,2,FILL_BLACK);
+}
+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::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) {
+        x+=mag*10;
+    }
+}
+
+void Shape::Drop()
+{
+    y=y+1;
+}
\ No newline at end of file