Tetris game on mikroTFT touchscreen and LPC1768

Dependencies:   Tetris

Dependents:   Tetris

Revision:
4:107d1d5a642e
Parent:
2:6b6986c3d2bd
--- a/main.cpp	Sat Mar 11 19:50:03 2017 +0000
+++ b/main.cpp	Sat Mar 18 14:45:16 2017 +0000
@@ -1,17 +1,23 @@
+/* Tetris game for touchscreen MicroTFT 320x240 and microcontorller LPC1768
+ * Uses SeeedStudioTFTv2 library
+ * Copyright (c) 2017 Sergejs Popovs    sergun2311
+ */
+
 #include "mbed.h"
 #include <ctime>
 #include "playGround.h"
 #include "Block.h"
 #include "Field.h"
-
-#define SPEED 100
+#include "Define.h"
 
 int main()
 {
     int score = 0;
+    int period = SPEED;
     bool flag;
     clock_t start_s;
     TFTInit();
+    drawFrame();
     drawMap();
     while (1) {
         Block NewBlock;
@@ -23,7 +29,7 @@
             drawMap();
             drawBlock(NewBlock);
             start_s = clock();
-            while( start_s + SPEED > clock() ) {
+            while( start_s + period > clock() ) {
                 if ( TouchStatus() )    {
                     clrBlock(NewBlock);
                     NewBlock = doGest(NewBlock);
@@ -41,9 +47,12 @@
             }
         }
         score += checkLine();
+        if ( score < 3200 )
+            period = SPEED - score / 50;
         clrNextBlock(NewBlock);
         if ( checkGameOver() )
             break;
     }
     gameOver(score);
+
 }
\ No newline at end of file