📄 gameengine.h
字号:
////////////////////////////////////////////////////////////////////////
//
// GameEngine.h
//
// Copyright (c) 2003 Nokia Mobile Phones Ltd. All rights reserved.
//
////////////////////////////////////////////////////////////////////////
#ifndef __GameENGINE_H__
#define __GameENGINE_H__
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
#include <w32std.h>
#include <MdaAudioOutputStream.h>
#include <mda\common\audio.h>
#include <stdint.h>
#include "SoundContext.h"
#include "GameTimerObserver.h"
////////////////////////////////////////////////////////////////////////
class CDoubleBufferedArea;
class CFbsBitmap;
class CGameTimer;
class App;
class Context;
class CDirectScreenBitmap;
class CRenderActive;
////////////////////////////////////////////////////////////////////////
class CGameEngine :
public CBase,
public MGameTimerObserver,
public MDirectScreenAccess,
public MMdaAudioOutputStreamCallback,
public SoundContext
{
public:
static CGameEngine* NewL
(
RWsSession& aClient,
CWsScreenDevice& aScreenDevice,
RWindow& aWindow,
const TSize& aSize
);
static CGameEngine* NewLC
(
RWsSession& aClient,
CWsScreenDevice& aScreenDevice,
RWindow& aWindow,
const TSize& aSize
);
~CGameEngine();
void StartGameL();
void StartFirstGameL();
void StopGame();
void InitSounds();
void StartSoundPlayback();
void MaoscOpenComplete( TInt aError );
void MaoscBufferCopied( TInt aError, const TDesC8& aBuffer );
void MaoscPlayComplete( TInt aError);
App* app() const {return m_app;}
// Are we in play?
inline TBool Playing(){return iPlaying;}
private:
TInt DoGameFrame();
void PauseFrame();
private:
// MDirectScreenAccess
void Restart(RDirectScreenAccess::TTerminationReasons aReason);
void AbortNow(RDirectScreenAccess::TTerminationReasons aReason);
void SetupDirectScreenAccessL();
private:
CGameEngine
(
RWsSession& aClient,
CWsScreenDevice& aScreenDevice,
RWindow& aWindow,
const TSize& aSize
);
void ConstructL();
void Simulate();
void Render();
#ifdef __SERIES60_3X__
void DirectRender();
#endif
private:
Context* m_context;
App* m_app;
uint16_t* m_buffer;
uint16_t* m_conv4Kto64K;
TUint32* m_conv4Kto256K;
//Timer
CGameTimer* iGameTimer;
int iTickCount;
// Window server handling
RWsSession& iClient;
CWsScreenDevice& iScreenDevice;
RWindow& iWindow;
TRawEvent iRedraw;
// Direct Screen Access
CDirectScreenAccess* iDirectScreenAccess;
CFbsBitGc* iGc;
RRegion* iRegion;
#ifdef __SERIES60_3X__
CDirectScreenBitmap* iDSBitmap;
CRenderActive* iRenderAo;
#endif
// Offscreen area for double buffering
CDoubleBufferedArea* iDoubleBufferedArea;
CFbsBitGc* iOffscreenContext;
//Game stuff
TSize iSize;
TBool iDropRenderFrames;
TBool iPlaying;
TBool iPaused;
TRect iGameDawingArea;
TInt iFrameCounter;
void* SoundBuffer();
HBufC8* iBuffer;
#ifndef SOUNDS_DISABLED
CMdaAudioOutputStream* iStream;
TMdaAudioDataSettings iSettings;
#endif
};
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
#endif // __GameENGINE_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -