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

📄 cengine.h

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


// INCLUDES
#include <e32base.h>
#include <w32std.h>
#include "MGameTimerObserver.h"

#include "TSample.h"

// forward declarations
class CGameTimer;
class CGameTetris;
class CSplash;
class CMenu;
class TScore;
class CSoundMixer;

const TInt TopNum = 5;

enum TGameState
{
		ENewSplash = 0,
		EDialog,
		EMenu,
		EMenuRunning,
		ERunning,
		EGameOver,
		EExit
};

class CEngine : public CBase
              , public MGameTimerObserver
{
// construct and destruct
public:

	static CEngine* NewL( CGameTetris* aGame, CWindowGc& aGc, RWindow& aWindow, TDisplayMode aDisplayMode );

	~CEngine();

private:

	void ConstructL();

	CEngine( CGameTetris* aGame, CWindowGc& aGc, RWindow& aWindow, TDisplayMode aDisplayMode );

//////////////////////////////////////////////////////////////////////////////////
// Method from MGameTimerObserver

public:
	/// Game timer calls this function
	/// @return timer continue flag, 0 if timer is to stop.
	TInt DoGameFrameL();

// New Method
	void Start();
	void Stop();
	void Pause();

	void Command(TInt aCommand);

private:
	TBool ShowSplash();

	void DipEffect(TUint16* aAddr, TInt aWidthInPixel, TInt aHeightInPixel);

	void DipBlackwhite(TUint16* aAddr, TInt aWidthInPixel, TInt aHeightInPixel);

	// method deal with score
	void ScoreLoadL();
	void ScoreSaveL();
	void ScoreAddL();
	void ScoreDisplay();
	void ScoreReset();

	// method deal with sound
	void StopMixer();
	void StartMixer();

//////////////////////////////////////////////////////////////////////////////////
// data

private:
	CSplash*		iSplash;
	CGameTimer*		iTimer;					// has a 
	CMenu*			iMenu;					// has a

	CGameTetris*	iGame;
	CWindowGc&		iGc;
	RWindow&		iWindow;
	TDisplayMode	iDisplayMode;

	TRect			iDrawRect;				// Draw region on screen
	TPoint			iPos;


	TBool			iPause;

	CFbsBitmap*			iBackBufferBitmap;
	CFbsBitmapDevice*	iBackBufferDevice;
	CFbsBitGc*			iBackBufferGc;

	TBitmapUtil*		iBitmapUtil;		// Only for bitmap locking
	TInt				iControl;

	// keys
	TInt			iKey;

	
	TGameState			iGameState;

	CArrayFixSeg<TScore> *iScoreTable;		// score table

	TBool				iDisplayTop5;

	// sound
	CSoundMixer*	iSound;

	TSample		iSoundBg;			// background music
	TSample		iSoundGameOver;		// sound effect
	TSample		iSoundOnClick;		// sound effect
	TSample		iSoundMenu;
	TSample		iSoundClearRow;
	TSample		iSoundWellDone;
	TSample		iSoundLevelUp;

	TBool		iSoundEffectOff;
	TBool		iMusicOff;
};



#endif

⌨️ 快捷键说明

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