updating stuff
Fork of Pokittris by
Diff: tetris.cpp
- Revision:
- 3:8540039d1eed
- Parent:
- 1:827c9852286e
- Child:
- 4:e861ad5ad42d
--- a/tetris.cpp Sun Oct 15 16:54:13 2017 +0000 +++ b/tetris.cpp Sun Oct 15 18:03:18 2017 +0000 @@ -71,7 +71,6 @@ // some globals... long int frameNumber = 0; -long int myDelay; long int tempTime; int dropTime = 0; int slideTime = 0; @@ -159,7 +158,7 @@ } void drawPlayfield() { - drawBackground(); + drawBackground(); for (char y = 1; y < 19; y++) { for (char x = 3; x < 13; x++) { @@ -227,7 +226,6 @@ } for (char y = 0; y < 10; y++) { - char line = 0; for (char x = 3; x < 13; x++) { topLine += playfield[x + 16 * y] != 0 ? 1 : 0; } @@ -386,8 +384,8 @@ #define SLIDECOUNT 6 #define DROPCOUNT 20 #else - #define SLIDECOUNT 1 - #define DROPCOUNT 2 + #define SLIDECOUNT 6 + #define DROPCOUNT 20 #endif if(linesToRemove==0 && animSplode==0){ @@ -540,8 +538,6 @@ px=6; gameMode=0; - char oldMode = 50; - myDelay=40; game.sound.playMusicStream(musicName); @@ -553,7 +549,7 @@ while (game.isRunning()) { // if it is time to update the screen - if (game.update(1)){ +// if (game.update(1)){ frameNumber++; game.sound.updateStream(); myPad = updateButtons(myPad); @@ -574,8 +570,15 @@ gameOver(); break; } - game.display.updateRegion(0,0,220,176); - } + + if(gameMode==1){ + // render only the playing area + //game.display.updateRegion(64,16,144,160); + game.display.updateRegion((px + 4)*8, py*8,((px+4)*8)+48,(py*8)+48); + }else{ + game.display.updateRegion(0,0,220,176); + } + // } } return 0; }