www.pudn.com > Tetris.rar > CGameTetris.h
#ifndef __CGAMETETRIS_H #define __CGAMETETRIS_H #include#include "TGrid.h" #include "TBlock.h" const TUint8 COLORNUM = 9; class CGameTetris : public CBase { // construct and destruct public: static CGameTetris* NewL(); ~CGameTetris(); private: void ConstructL(); CGameTetris(); /////////////////////////////////////////////////////////////////////////////// // method public: TBool Command(TInt aCommand); void Draw(CFbsBitGc* aBackBufferGc); TInt8 Run(); // Other Method private: void LoadResL(); TBool MoveTo(const TPoint& aNewPos); void Rotate(); // create a new block void NewBlock(); // Start a new game void StartNewGame(); // TBool IsBlock(const TPoint& aPos) const; // Get a row from Grid void GetRowContent(TUint8 aRow, TFixedArray & aRowContent); // check if a row is full TInt CheckRows(); // start lines void StartLines(TUint8 aLines); // calculate score void Calculate(TInt rows); TBool FixBlock(); /////////////////////////////////////////////////////////////////////////////// // Data private: TFixedArray iBmpBlock; CFbsBitmap* iBmpBackground; TGrid iGrid; TBlock iBlock; TBlock iBlockNext; TPoint iBlockPos; TInt64 iSeed; TInt iDelay; TInt iLine; TInt iLevel; public: // Game State TInt iStateScore; TUint8 iStateDifficulty; // 0 or 1 or other num TInt8 iStateRotateDir; // 1 or -1 TBool iStateRunning; TBool iStateLevelUp; TBool iStateWellDone; TBool iStateClearRow; TUint8 iStateStartLines; }; #endif