Tetris game on mikroTFT touchscreen and LPC1768

Dependencies:   Tetris

Dependents:   Tetris

Revision:
1:b4aa36ae11ac
Parent:
0:645509d95b8d
Child:
3:36de55e63fdf
--- a/Field.cpp	Mon Feb 20 14:14:30 2017 +0000
+++ b/Field.cpp	Sat Feb 25 23:52:28 2017 +0000
@@ -1,6 +1,42 @@
 #include "Field.h"
+#include "playGround.h"
 
+#define BLACK           0
 #define MAXX            10
 #define MAXY            12
 
-extern int Field[MAXY][MAXX] = {0};
\ No newline at end of file
+extern int Field[MAXY][MAXX] = {0};
+
+int checkLine()    {
+    int x, y, score = 0;
+    bool status;
+    for ( y = 0 ; y < 12 ; y++ ) {
+        status = true;
+        for ( x = 0 ; x < 10 ; x++ )  {
+            if ( Field[y][x] == BLACK )
+                status = false;
+        }
+        if ( status )   {
+            score += 100;
+            int xx, yy;
+            for ( yy = y ; yy > 0 ; yy-- )   {
+                for (xx = 0 ; xx < 10 ; xx++ )  {
+                    Field[yy][xx] = Field[yy-1][xx];
+                }
+                
+            }
+        }
+    }
+    if (score)
+        drawMapV2();
+    return score;
+}
+
+bool checkGameOver()
+{
+    int x;
+    for ( x = 0 ; x < 10 ; x++ )
+        if ( Field[0][x] != BLACK )
+            return true;
+    return false;        
+}
\ No newline at end of file