www.pudn.com > 2DGameAnimS60C_v1_0.zip > RetroEngine.h


//////////////////////////////////////////////////////////////////////// 
// 
// RetroEngine.h 
// 
// Copyright (c) 2003 Nokia Mobile Phones Ltd.  All rights reserved. 
// 
//////////////////////////////////////////////////////////////////////// 
 
#ifndef __RETROENGINE_H__ 
#define __RETROENGINE_H__ 
 
#include  
#include "GameTimerObserver.h" 
 
class TKeyHandler; 
class CImageFactory; 
class CDoubleBufferedArea; 
class CFbsBitmap; 
class CGameTimer; 
 
class CTilemap; 
class MTileset; 
class CShipAnim;  
class CFireAnim;  
class CRetroLeafTileset; 
class CRetroNodeTileset; 
class CParticleSystem; 
class TVectorFP; 
 
class CRetroEngine : public CBase, public MGameTimerObserver, public MDirectScreenAccess 
    { 
    public: 
 
        static CRetroEngine* NewL(RWsSession& aClient, CWsScreenDevice& aScreenDevice, RWindow& aWindow,TKeyHandler& aKeyHandler, CImageFactory& aImageFactory, const TSize& aSize); 
        static CRetroEngine* NewLC(RWsSession& aClient, CWsScreenDevice& aScreenDevice, RWindow& aWindow,TKeyHandler& aKeyHandler, CImageFactory& aImageFactory, const TSize& aSize); 
        ~CRetroEngine(); 
 
		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: 
        CRetroEngine(RWsSession& aClient, CWsScreenDevice& aScreenDevice, RWindow& aWindow,TKeyHandler& aKeyHandler, CImageFactory& aImageFactory, const TSize& aSize); 
        void ConstructL(); 
 
		void ConstructSimpleMapL(); 
		void ConstructCompoundMapL(); 
		void ConstructShipL(); 
 
		void Simulate(); 
		void UpdatePosition(); 
		void Render(const TRect& aRect,CFbsBitGc* aCallerGc) const; 
 
    private: 
 
 
		//Timer 
		CGameTimer* iGameTimer; 
 
		// Window server handling 
		RWsSession& iClient; 
		CWsScreenDevice& iScreenDevice; 
		RWindow& iWindow; 
 
		// Direct Screen Access 
		CDirectScreenAccess* iDirectScreenAccess; 
		CFbsBitGc* iGc; 
		RRegion* iRegion;         
		 
		// Offscreen area for double buffering 
		CDoubleBufferedArea* iDoubleBufferedArea; 
		CFbsBitGc* iOffscreenContext; 
		 
		//Game stuff 
        TKeyHandler& iKeyHandler; 
		CImageFactory& iImageFactory; 
		 
		TPoint iShipScreenPos; 
		TPoint iShipScreenPosUp4; 
		TPoint iShipWorldPos; 
		TPoint iShipVelocity; 
 
		CTilemap* iMap; 
		CRetroLeafTileset* iLeafFactory; 
		CRetroNodeTileset* iNodeFactory; 
		TRect  iShipBounds; 
		TPoint iMapWindowTopLeft; 
 
		TInt iShipFrame; 
		CShipAnim* iShipAnim; 
		CFireAnim* iFireAnim; 
		CParticleSystem* iEngineExhaust; 
		TVectorFP* iShipVectors; 
 
		TInt iThrust; 
		TInt iGravity; 
		TInt iDragRatio; 
		TInt iDragDownshift; 
 
		TSize iSize; 
 
		TBool iDropRenderFrames; 
 
		TBool iPlaying; 
		TBool iPaused; 
		TRect iGameDawingArea; 
		TInt iFrameCounter; 
 
    }; 
#endif