Jordan Sanchez / Mbed 2 deprecated Tetris

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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Game.h Source File

Game.h

00001 #ifndef _GAME_
00002 #define _GAME_
00003 
00004 // ------ Includes -----
00005 
00006 #include "Board.h"
00007 #include "Pieces.h"
00008 #include "uLCD_4DGL.h"
00009 
00010 // ------ Defines -----
00011 
00012 #define WAIT_TIME 700           // Number of milliseconds that the piece remains before going 1 block down */ 
00013 
00014 
00015 // -----------------------------------------------------
00016 // Game
00017 // -----------------------------------------------------
00018 
00019 class Game
00020 {
00021 public:
00022 
00023     Game (Board *pBoard, Pieces *pPieces, int pScreenHeight, uLCD_4DGL *uLCD,int,int,int,int);
00024 
00025     void DrawScene ();
00026     void CreateNewPiece (int,int);
00027     
00028     void ErasePiece(int x,int y,int piece, int rotation);
00029     void DrawBoard ();
00030     void AddPoints(int);
00031     void AddClearedLines(int);
00032     int GetPoints();
00033     int GetClearedLines();
00034     
00035     int mPosX, mPosY;               // Position of the piece that is falling down
00036     int mPiece, mRotation;          // Kind and rotation the piece that is falling down
00037     
00038     int points;
00039     int clearedLineCount;
00040     
00041 
00042 private:
00043 
00044     int mScreenHeight;              // Screen height in pixels
00045     int mNextPosX, mNextPosY;       // Position of the next piece
00046     int mNextPiece, mNextRotation;  // Kind and rotation of the next piece
00047     
00048     Board *mBoard;
00049     Pieces *mPieces;
00050     uLCD_4DGL *uLCD;
00051 
00052     
00053     void InitGame(int,int,int,int);
00054     void DrawPiece (int pX, int pY, int pPiece, int pRotation, int colorIndex);
00055     
00056 };
00057 
00058 #endif // _GAME_