?? cengine.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 + -