⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cgametetris.h

📁 在symbian2.0平台上开发的完整的俄罗斯方块的源码。
💻 H
字号:
#ifndef __CGAMETETRIS_H
#define __CGAMETETRIS_H

#include <w32std.h>


#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<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;

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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -