Tetris for the RA8875, derived from another users implementation.

Dependencies:   RA8875

Fork of Tetris by Sergejs Popovs

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.

Committer:
sergun2311
Date:
Mon Feb 20 14:14:30 2017 +0000
Revision:
0:645509d95b8d
Child:
1:b4aa36ae11ac
Tetris - Physics

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sergun2311 0:645509d95b8d 1 #include "mbed.h"
sergun2311 0:645509d95b8d 2 #include <ctime>
sergun2311 0:645509d95b8d 3 #include "playGround.h"
sergun2311 0:645509d95b8d 4 #include "Block.h"
sergun2311 0:645509d95b8d 5
sergun2311 0:645509d95b8d 6 #define SPEED 10
sergun2311 0:645509d95b8d 7
sergun2311 0:645509d95b8d 8 int main()
sergun2311 0:645509d95b8d 9 {
sergun2311 0:645509d95b8d 10 int flag;
sergun2311 0:645509d95b8d 11 clock_t start_s;
sergun2311 0:645509d95b8d 12 TFTInit();
sergun2311 0:645509d95b8d 13 drawMap();
sergun2311 0:645509d95b8d 14 while (1) {
sergun2311 0:645509d95b8d 15 Block NewBlock;
sergun2311 0:645509d95b8d 16 flag = 0;
sergun2311 0:645509d95b8d 17 drawMap();
sergun2311 0:645509d95b8d 18 while(flag == 0) {
sergun2311 0:645509d95b8d 19 drawMap();
sergun2311 0:645509d95b8d 20 drawBlock(NewBlock);
sergun2311 0:645509d95b8d 21 start_s =clock();
sergun2311 0:645509d95b8d 22 while( start_s + SPEED > clock() ) {
sergun2311 0:645509d95b8d 23 }
sergun2311 0:645509d95b8d 24 if ( NewBlock.CheckBottom() ) {
sergun2311 0:645509d95b8d 25 saveToField(NewBlock);
sergun2311 0:645509d95b8d 26 flag = 1;
sergun2311 0:645509d95b8d 27 } else {
sergun2311 0:645509d95b8d 28 clrBlock(NewBlock);
sergun2311 0:645509d95b8d 29 NewBlock.y += 1;
sergun2311 0:645509d95b8d 30 }
sergun2311 0:645509d95b8d 31 }
sergun2311 0:645509d95b8d 32 }
sergun2311 0:645509d95b8d 33 }