Tetris game on mikroTFT touchscreen and LPC1768

Dependencies:   Tetris

Dependents:   Tetris

main.cpp

Committer:
sergun2311
Date:
2017-02-20
Revision:
0:645509d95b8d
Child:
1:b4aa36ae11ac

File content as of revision 0:645509d95b8d:

#include "mbed.h"
#include <ctime>
#include "playGround.h"
#include "Block.h"

#define SPEED 10

int main()
{
    int flag;
    clock_t start_s;
    TFTInit();
    drawMap();
    while (1) {
        Block NewBlock;
        flag = 0;
        drawMap();
        while(flag == 0) {
            drawMap();
            drawBlock(NewBlock);
            start_s =clock();
            while( start_s + SPEED > clock() ) {
            }
            if ( NewBlock.CheckBottom() ) {
                saveToField(NewBlock);
                flag = 1;
            } else {
                clrBlock(NewBlock);
                NewBlock.y += 1;
            }
        }
    }
}