![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Tetris for the RA8875, derived from another users implementation.
Fork of Tetris by
Tetris, adapted to the RA8875 graphics library and display.
As currently implemented, this version is defined for the 800x480 display. A number of macros can adapt it for other screen resolutions.
Further, while presently configured for landscape mode, it should be fairly easy to reconfigure it for portrait mode.
Diff: main.cpp
- Revision:
- 4:107d1d5a642e
- Parent:
- 2:6b6986c3d2bd
- Child:
- 5:5ce8976cd303
diff -r 36de55e63fdf -r 107d1d5a642e main.cpp --- 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