📄 cengine.h
字号:
/*
*
============================================================================
* Name : CEngine.h
* Part of : Example3D
* Created : 12/14/2003 by Forum Nokia
* Description:
* This is the project specification file for Example3D.
* Initial content was generated by Series 60 AppWizard.
*
* Version : 1.0.0
* Copyright: Forum Nokia
*
============================================================================
*/
#ifndef __CENGINE_H__
#define __CENGINE_H__
// INCLUDES
#include <e32base.h>
#include <w32std.h>
#include "MGameTimerObserver.h"
#include "TBitmap.h"
// FORWARD DECLARATIONS
class CGameTimer;
class MGame;
class CFpsCounter;
// ENUMERATIONS
enum TDrawBuffer
{
EDoubleBuffered, // direct screen write with double buffer
EBitmapCopy // just blit screen with BitBlt
};
// CLASS DECLARATION
/**
* CEngine is the game runner class and wrapper for symbian UI-classes
* This class takes care of screen drawing, double buffering
* timing and key events.
* Uses CGameTimer for timing
* Calls MGame derived game class
*/
class CEngine
: public CBase
, public MGameTimerObserver
{
public:
/// Two-phased constructor
/// @param aGc pointer to application's graphic context
/// @param aWindow pointer to application's window
/// @param aScreenSize physical screen size in pixels
/// @param aDisplayMode used screen color mode
static CEngine* NewL( CWindowGc& aGc, RWindow& aWindow,
const TSize& aScreenSize, TDisplayMode aDisplayMode );
/// Destructor:
~CEngine();
private:
/// Second-phase constructor
void ConstructL();
/// Default constructor
/// @param aGc pointer to application's graphic context
/// @param aWindow pointer to application's window
/// @param aScreenSize physical screen size in pixels
/// @param aDisplayMode used screen color mode
CEngine( CWindowGc& aGc, RWindow& aWindow,
const TSize& aScreenSize, TDisplayMode aDisplayMode );
public: // MGameTimerObserver
/// Game timer calls this function
/// @return timer continue flag, 0 if timer is to stop.
TInt DoGameFrameL();
public: // New methods:
/// Container updates key events here:
/// @param aKeyEvent key event type
/// @param aType key event code
void KeyEvent( const TKeyEvent& aKeyEvent,TEventCode aType );
/// starts updating engine
void Start();
/// stops updating engine
void Stop();
private: // Data
MGame* iGame; // pointer to game
CGameTimer* iTimer; // CIdle timer to run the engine
CWindowGc& iGc;
RWindow& iWindow;
TSize iScreenSize; // physical screen size
CFbsBitmap* iFbsBitmapBuffer; // CFbsBitmap containing drawing screen
TBitmap iBuffer; // CFbsBitmap wrapped to TBitmap type
TBitmap iScreen; // TBitmap to direct screen memory
TTime iTime; // time from start
TInt iUpdates; // number of game "move"s
TUint8 iKey[ 256 ]; // keyboard status
CFpsCounter* iFps; // current speed Frames / Second
TBool iPaused; // paused flag
TDisplayMode iDisplayMode; // current display mode
CFbsScreenDevice* iFbsScreenDevice; // screen device for direct screen flushing
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -