![](/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: Tetris/playGround.cpp
- Revision:
- 6:d2aa47c92687
- Parent:
- 5:5ce8976cd303
- Child:
- 7:0e426e81c566
--- a/Tetris/playGround.cpp Sat Mar 18 22:30:32 2017 +0000 +++ b/Tetris/playGround.cpp Sat Mar 18 23:53:12 2017 +0000 @@ -18,7 +18,6 @@ RA8875 TFT(p5,p6,p7,p12,NC, p9,p10,p13, "tft"); // SPI:{MOSI,MISO,SCK,/ChipSelect,/reset}, I2C:{SDA,SCL,/IRQ}, name #else RA8875 TFT(p5,p6,p7,p12,NC, "tft"); // SPI:{MOSI,MISO,SCK,/ChipSelect,/reset}, name -LocalFileSystem local("local"); // access to calibration file for resistive touch. #endif #ifdef BIG_SCREEN @@ -33,19 +32,6 @@ #define BL_NORM 25 // Backlight Normal setting (0 to 255) #endif -#if 0 -#define PIN_XP p20 -#define PIN_XM p19 -#define PIN_YP p18 -#define PIN_YM p17 -#define PIN_MOSI p11 -#define PIN_MISO p12 -#define PIN_SCLK p13 -#define PIN_CS_TFT p14 -#define PIN_DC_TFT p21 -#define PIN_BL_TFT p15 -#define PIN_CS_SD p4 -#endif // Hot-Spots static const rect_t Drop = { DROP }; @@ -60,7 +46,7 @@ void drawMap() { - int y , x; + int y, x; for ( y = 0 ; y < MAXY ; y++ ) { for ( x = 0 ; x < MAXX ; x++ ) { @@ -180,6 +166,11 @@ TFT.rect(mLeft, Charcoal); TFT.rect(mRight, Charcoal); TFT.SelectDrawingLayer(0); + for (int y=0; y<MAXY; y++) { + for (int x=0; x<MAXX; x++) { + Field[y][x] = 0; + } + } } void gameOver(int score)