Tetris Base Game

Dependencies:   4DGL-uLCD-SE SDFileSystem mbed-rtos mbed wave_player

Committer:
jsanchez307
Date:
Wed Nov 30 21:57:25 2022 +0000
Revision:
0:1858f2b100fd
Tetris Skeleton V 1.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jsanchez307 0:1858f2b100fd 1 #ifndef _GAME_
jsanchez307 0:1858f2b100fd 2 #define _GAME_
jsanchez307 0:1858f2b100fd 3
jsanchez307 0:1858f2b100fd 4 // ------ Includes -----
jsanchez307 0:1858f2b100fd 5
jsanchez307 0:1858f2b100fd 6 #include "Board.h"
jsanchez307 0:1858f2b100fd 7 #include "Pieces.h"
jsanchez307 0:1858f2b100fd 8 #include "uLCD_4DGL.h"
jsanchez307 0:1858f2b100fd 9
jsanchez307 0:1858f2b100fd 10 // ------ Defines -----
jsanchez307 0:1858f2b100fd 11
jsanchez307 0:1858f2b100fd 12 #define WAIT_TIME 700 // Number of milliseconds that the piece remains before going 1 block down */
jsanchez307 0:1858f2b100fd 13
jsanchez307 0:1858f2b100fd 14
jsanchez307 0:1858f2b100fd 15 // -----------------------------------------------------
jsanchez307 0:1858f2b100fd 16 // Game
jsanchez307 0:1858f2b100fd 17 // -----------------------------------------------------
jsanchez307 0:1858f2b100fd 18
jsanchez307 0:1858f2b100fd 19 class Game
jsanchez307 0:1858f2b100fd 20 {
jsanchez307 0:1858f2b100fd 21 public:
jsanchez307 0:1858f2b100fd 22
jsanchez307 0:1858f2b100fd 23 Game (Board *pBoard, Pieces *pPieces, int pScreenHeight, uLCD_4DGL *uLCD,int,int,int,int);
jsanchez307 0:1858f2b100fd 24
jsanchez307 0:1858f2b100fd 25 void DrawScene ();
jsanchez307 0:1858f2b100fd 26 void CreateNewPiece (int,int);
jsanchez307 0:1858f2b100fd 27
jsanchez307 0:1858f2b100fd 28 void ErasePiece(int x,int y,int piece, int rotation);
jsanchez307 0:1858f2b100fd 29 void DrawBoard ();
jsanchez307 0:1858f2b100fd 30 void AddPoints(int);
jsanchez307 0:1858f2b100fd 31 void AddClearedLines(int);
jsanchez307 0:1858f2b100fd 32 int GetPoints();
jsanchez307 0:1858f2b100fd 33 int GetClearedLines();
jsanchez307 0:1858f2b100fd 34
jsanchez307 0:1858f2b100fd 35 int mPosX, mPosY; // Position of the piece that is falling down
jsanchez307 0:1858f2b100fd 36 int mPiece, mRotation; // Kind and rotation the piece that is falling down
jsanchez307 0:1858f2b100fd 37
jsanchez307 0:1858f2b100fd 38 int points;
jsanchez307 0:1858f2b100fd 39 int clearedLineCount;
jsanchez307 0:1858f2b100fd 40
jsanchez307 0:1858f2b100fd 41
jsanchez307 0:1858f2b100fd 42 private:
jsanchez307 0:1858f2b100fd 43
jsanchez307 0:1858f2b100fd 44 int mScreenHeight; // Screen height in pixels
jsanchez307 0:1858f2b100fd 45 int mNextPosX, mNextPosY; // Position of the next piece
jsanchez307 0:1858f2b100fd 46 int mNextPiece, mNextRotation; // Kind and rotation of the next piece
jsanchez307 0:1858f2b100fd 47
jsanchez307 0:1858f2b100fd 48 Board *mBoard;
jsanchez307 0:1858f2b100fd 49 Pieces *mPieces;
jsanchez307 0:1858f2b100fd 50 uLCD_4DGL *uLCD;
jsanchez307 0:1858f2b100fd 51
jsanchez307 0:1858f2b100fd 52
jsanchez307 0:1858f2b100fd 53 void InitGame(int,int,int,int);
jsanchez307 0:1858f2b100fd 54 void DrawPiece (int pX, int pY, int pPiece, int pRotation, int colorIndex);
jsanchez307 0:1858f2b100fd 55
jsanchez307 0:1858f2b100fd 56 };
jsanchez307 0:1858f2b100fd 57
jsanchez307 0:1858f2b100fd 58 #endif // _GAME_