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

📄 polytubeengine.h

📁 手机 GAME c++ 版
💻 H
字号:
////////////////////////////////////////////////////////////////////////
//
// PolyTubeEngine.h
//
// Copyright (c) 2003 Nokia Mobile Phones Ltd.  All rights reserved.
//
////////////////////////////////////////////////////////////////////////

#ifndef __POLYTUBEENGINE_H__
#define __POLYTUBEENGINE_H__

////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////

#include <w32std.h>
#include "GameTimerObserver.h"
#include "Cube.h"
#include "TorusSector.h"
#include "MathLookup.h"
#include "ScanConverter.h"

////////////////////////////////////////////////////////////////////////

class TKeyHandler;
class CDoubleBufferedArea;
class CFbsBitmap;
class CGameTimer;

////////////////////////////////////////////////////////////////////////

class CPolyTubeEngine : public CBase, public MGameTimerObserver, public MDirectScreenAccess
    {
    public:

        static CPolyTubeEngine* NewL
			(
			RWsSession& aClient, 
			CWsScreenDevice& aScreenDevice, 
			RWindow& aWindow,
			TKeyHandler& aKeyHandler, 
			const TSize& aSize
			);

        static CPolyTubeEngine* NewLC
			(
			RWsSession& aClient, 
			CWsScreenDevice& aScreenDevice, 
			RWindow& aWindow,
			TKeyHandler& aKeyHandler, 
			const TSize& aSize
			);

        ~CPolyTubeEngine();

		void StartGameL();
		void StartFirstGameL();
		void StopGame();


		// 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:
        
		CPolyTubeEngine
			(
			RWsSession& aClient, 
			CWsScreenDevice& aScreenDevice, 
			RWindow& aWindow,
			TKeyHandler& aKeyHandler, 
			const TSize& aSize
			);

        void ConstructL();

		void Simulate();
		void Render();

    private:

		//Timer
		CGameTimer* iGameTimer;

		// Window server handling
		RWsSession& iClient;
		CWsScreenDevice& iScreenDevice;
		RWindow& iWindow;

		TRawEvent iRedraw;

		// Direct Screen Access
		CDirectScreenAccess* iDirectScreenAccess;
		CFbsBitGc* iGc;
		RRegion* iRegion;        
		
		// Offscreen area for double buffering
		CDoubleBufferedArea* iDoubleBufferedArea;
		CFbsBitGc* iOffscreenContext;
		
		//Game stuff
        TKeyHandler& iKeyHandler;
		TSize iSize;

		TBool iDropRenderFrames;

		TBool iPlaying;
		TBool iPaused;
		TRect iGameDawingArea;
		TInt iFrameCounter;

		TMathLookup		iMath;
		TScanConverter	iScanConverter;
		TCube			iCube;
		TTorusSector	iTorusSector;
    };

////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////

#endif

////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

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