Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: 4DGL-uLCD-SE Physac-MBED PinDetect SDFileSystem mbed-rtos mbed
Board.h
00001 #ifndef _BOARD_ 00002 #define _BOARD_ 00003 00004 // ------ Includes ----- 00005 00006 #include "Pieces.h" 00007 00008 // ------ Defines ----- 00009 00010 #define BOARD_LINE_WIDTH 6 // Width of each of the two lines that delimit the board 00011 #define BLOCK_SIZE 6 // Width and Height of each block of a piece 00012 #define BOARD_POSITION 50 // Center position of the board from the left of the screen 00013 #define BOARD_WIDTH 10 // Board width in blocks 00014 #define BOARD_HEIGHT 20 // Board height in blocks 00015 #define MIN_VERTICAL_MARGIN 8 // Minimum vertical margin for the board limit 00016 #define MIN_HORIZONTAL_MARGIN 20 // Minimum horizontal margin for the board limit 00017 #define PIECE_BLOCKS 5 // Number of horizontal and vertical blocks of a matrix piece 00018 00019 00020 // -------------------------------------------------------------------------------- 00021 // Board 00022 // -------------------------------------------------------------------------------- 00023 00024 class Board 00025 { 00026 public: 00027 00028 Board (Pieces *pPieces, int pScreenHeight); 00029 00030 int GetXPosInPixels (int pPos); 00031 int GetYPosInPixels (int pPos); 00032 bool IsFreeBlock (int pX, int pY); 00033 bool IsPossibleMovement (int pX, int pY, int pPiece, int pRotation); 00034 void StorePiece (int pX, int pY, int pPiece, int pRotation); 00035 int DeletePossibleLines (); 00036 bool IsGameOver (); 00037 void InitBoard(); 00038 00039 private: 00040 00041 // enum holds no value besides the described properties 00042 enum { POS_FREE, POS_FILLED }; // POS_FREE = free position of the board; POS_FILLED = filled position of the board 00043 int mBoard [BOARD_WIDTH][BOARD_HEIGHT]; // Board that contains the pieces 00044 Pieces *mPieces; 00045 int mScreenHeight; 00046 00047 //void InitBoard(); 00048 void DeleteLine (int pY); 00049 }; 00050 00051 #endif
Generated on Fri Dec 9 2022 21:28:44 by
1.7.2