📄 lvtetrisengine.h
字号:
#ifndef LVTETRISENGINE_H_
#define LVTETRISENGINE_H_
#include <w32std.h>
#include "TGrid.h"
#include "TBlock.h"
#include "LvtetrisMenu.h"
const TUint8 COLORNUM = 9;
class CLvtetrisEngine : public CBase
{
// construct and destruct
public:
static CLvtetrisEngine* NewL();
~CLvtetrisEngine();
private:
void ConstructL();
CLvtetrisEngine();
///////////////////////////////////////////////////////////////////////////////
// method
public:
TGameStatus Command(TInt aCommand);
void DrawTetris(CFbsBitGc* aBackBufferGc);
void DrawGamePauseInfor(CFbsBitGc* aBackBufferGc);
void DrawGameOverInfor(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<TUint8, KGridX>& 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<CFbsBitmap*, COLORNUM> iBmpBlock;
CFbsBitmap* iBmpBackground;
TGrid iGrid;
TBlock iBlock;
TBlock iBlockNext;
TPoint iBlockPos;
TInt64 iSeed;
TInt iDelay;
TInt iLine;
TInt iLevel;
TFixedArray<HBufC*, 2> iGamePauseInforTxt;
TFixedArray<HBufC*, 2> iGameOverInforTxt;
TFixedArray<TPoint, 2> iGamePauseInforPos;
TFixedArray<TPoint, 2> iGameOverInforPos;
public:
// TInt8 iLevel;
// Game State
TInt iStateScore;
TUint8 iStateDifficulty; // 0 or 1 or other num
TInt8 iStateRotateDir; // 1 or -1
TBool iStateRunning;
TUint8 iStateStartLines;
};
#endif /*LVTETRISENGINE_H_*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -