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

📄 ski.h

📁 series60 应用程序开发的源代码 series60 应用程序开发的源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
        void SetPosn(const TSkiVector& aPosn);
        TInt Elevation() const;
        void SetElevation(TInt aElevation);
        const TSkiVector& Vel() const;
        void SetVel(const TSkiVector& aVel);
        const TSkiVector& Accel() const;
        void SetAccel(const TSkiVector& aAccel);
        TInt JumpForce() const;
        void SetJumpForce(TInt aForce);
        TInt Gravity() const;
        void SetGravity(TInt aGravity);
        TSkierState State() const;
        void SetState(TSkierState aState);
        TInt FallTickCount() const;
        void SetFallTickCount(TInt aCount);
        void RotateClockwise();
        void RotateAntiClockwise();
        TSize SkierSize() const;
        void SetSkierSize(TSize aSize);

    private:
        TSkiVector iPosn;
        TInt iElevation;
        TSkiVector iVel;
        TSkiVector iAccel;
        TInt iJumpForce;
        TInt iGravity;
        TInt iState;
        TInt iFallTickCount;
        TSize iSkierSize;
};


/**
*
* @class    CSkier Ski.h
* @brief    class to represent skier info
*
* Copyright (c) EMCC Software Ltd 2003
* @version    1.0
*
*/
class CSkier : public CBase
{
    public:
        static CSkier* NewL();
        static CSkier* NewLC();
        ~CSkier();

    public:
        // accessors
        const CSkiSprite& SpriteL() const;
        CSkiSprite& SpriteL();
        CGameGallery& Gallery();
        const CGameGallery& Gallery() const;
        TSkierAttribs& Attribs();

    public:
        void Update();
        void Reset();
        TBool Jumping() const;
        void SetJumping(TBool aJump);
        TReal MaxVel() const;
        void SetMaxVel(TReal aVel);
        TInt DefJumpForce() const;
        void SetDefJumpForce(TInt aForce);
        TReal CoeffOfRestitution() const;
        void SetCoeffOfRestitution(TReal aCoeff);
        TRect GetRect() const;

    private:
        CSkier();
        void ConstructL();
        TSkiVector GetAccelFromState() const;
        void LimitVelocity();
        void DoFriction();

    private:
        CGameGallery* iGallery;
        TSkierAttribs iAttribs;
        TBool iJumping;
        TReal iMaxVel;
        TInt iDefJumpForce;
        TReal iCoeff;
};


/**
*
* @class    TScrollDriver Ski.h
* @brief    class to control scrolling
*
* Copyright (c) EMCC Software Ltd 2003
* @version    1.0
*
*/
class TScrollDriver
{
    public:
        TScrollDriver(TSkiScreenAttribs& aAttribs);
        TScrollDriver(TSkiScreenAttribs& aAttribs, TSize aMapLimits, TSize aScrollBox);

    public:
        // If aPosn is outside of the scrollbox, the screen offset is updated.
        // The scroll box is an invisible rectangle in the centre of the screen used
        // to drive the scrolling
        void Move(TPoint aPosn);

    public:
        TSize Limits() const;
        void SetLimits(TSize aSize);
        TSize ScrollBox() const;
        void SetScrollBox(TSize aSize);

        TPoint Offset() const;
        void SetOffset(TPoint aPosn);

    private:
        TBool KeptOffsetInMap(TPoint& aOffset, TPoint aPrevious);
        TRect GetScrollBox() const;

    private:
        TSkiScreenAttribs& iAttribs;
        TSize iLimits;
        TSize iScrollBox;
        TPoint iOffset; // the scroll box is in the centre of the screen.  this offset
                        // is the amount by which we shift the scrollbox from this central position
};




/**
*
* @class    TSkierCollisionResponse Ski.h
* @brief    utility class to perform collision response
*
* Copyright (c) EMCC Software Ltd 2003
* @version    1.0
*
*/
class TSkierCollisionResponse
{
    public:
        TSkierCollisionResponse(TSkierAttribs& aAttribs);

    public:
        void Fall(const TPoint aRestartPosn);
        TBool SkierStanding();

    private:
        TSkierAttribs& iAttribs;
        TInt iFallTick;
        TPoint iRestartPosn;
};


/**
*
* @class    CSkiCollisionDetection  Ski.h
* @brief    class to manage collision detection
*
* Copyright (c) EMCC Software Ltd 2003
* @version    1.0
*
*/
class CSkiCollisionDetection : public CBase
{
    public:
        static CSkiCollisionDetection* NewL(CSkiMap& aMap, CSkier& aSkier);
        static CSkiCollisionDetection* NewLC(CSkiMap& aMap, CSkier& aSkier);
        ~CSkiCollisionDetection();

    public:
        void UpdateL();
        TBool Collision() const;

    private:
        void ConstructL();
        CSkiCollisionDetection(CSkiMap& aMap, CSkier& aSkier);

    private:
        CMapPrimitiveBoundingRects* iSolidRects;
        CSkiMap& iMap;
        CSkier& iSkier;
        TBool iCollision;
        TSkierCollisionResponse iResponse;
};


/**
*
* @class    CSkiEngine Ski.h
* @brief    class to hold engine attributes
*
* Copyright (c) EMCC Software Ltd 2003
* @version    1.0
*
*/
class CSkiEngine : public CBase
{
    public:
        static CSkiEngine* NewL(TRect aRect);
        static CSkiEngine* NewLC(TRect aRect);
        ~CSkiEngine();

    public:
        void UpdateEngineL();

    public:
        CSkiMap& Map();
        const CSkiMap& Map() const;
        CSkier& Skier();
        const CSkier& Skier() const;
        CMapGallery& MapGallery();
        const CMapGallery& MapGallery() const;
        TSkiScreenAttribs& ScreenAttribs();
        const TSkiScreenAttribs& ScreenAttribs() const;
        TKeyHandler& KeyHandler();
        const TKeyHandler& KeyHandler() const;
        TScrollDriver& ScrollDriver();
        const TScrollDriver& ScrollDriver() const;

    private:
        CSkiEngine();
        void ConstructL(TRect aRect);
        void LoadSkierL();
        void LoadMapL();
        void LoadMapElementL(TMapPrimitive::TMapObjectType aType, TPoint aPosn);
        void LoadMapGalleryL();
        void ProcessUserInput();
        void KeepSkierWithinMapLimits();

    private:
        CSkiMap* iMap;
        CSkier* iSkier;
        CMapGallery* iMapGallery;
        CSkiCollisionDetection* iColDetect;
        TKeyHandler iKeyHandler;
        TSkiScreenAttribs iScrAttribs;
        TScrollDriver iScrollDriver;
};


/**
*
* @class    SkiBitmapLoader Ski.h
* @brief    utility bitmap loader
*
* Copyright (c) EMCC Software Ltd 2003
* @version    1.0
*
*/
class SkiBitmapLoader
{
    public:
        static CFbsBitmap* CreateBitmapLC(const TDesC& aName,TInt aId);
        static void AddSkierSpritesToGalleryL(CGameGallery& aGallery);
        static void AddMapSpritesToGalleryL(CGameGallery& aGallery);
};


/**
*
* @class    CSkiFrameRenderer Ski.h
* @brief    frame renderer
*
* Copyright (c) EMCC Software Ltd 2003
* @version    1.0
*
*/
class CSkiFrameRenderer : public CBase
{
    public:
        static CSkiFrameRenderer* NewL(TSize aSize, CSkiEngine& aEngineAttribs);
        static CSkiFrameRenderer* NewLC(TSize aSize, CSkiEngine& aEngineAttribs);
        ~CSkiFrameRenderer();

    public:
        const CFbsBitmap* RenderedFrameL() const;

    private:
        CSkiFrameRenderer(CSkiEngine& aEngineAttribs);
        void ConstructL(TSize aSize);

    private:
        void DrawPrimitiveL(const TMapPrimitive& aPrimitive) const;
        void DisplaySkierL() const;
        void DrawSpriteL(TPoint aPosn, const CSkiSprite& aSprite) const;

    private:
        CSkiEngine& iEngineAttribs;
        TSkiScreenAttribs& iScrAttribs;
        CDoubleBufferedArea* iDBArea;
};


/**
*
* @class    DSA controller Ski.h
* @brief    Class for managing access to the direct screen access class
*
* Copyright (c) EMCC Software Ltd 2003
* @version    1.0
*
*/
class CDSAWrapper : public CBase
{
    public:
        static CDSAWrapper* NewL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow);
        static CDSAWrapper* NewLC(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow);
        ~CDSAWrapper();

    public:
        TBool DSAAvailable() const;
        CFbsBitGc* DSAGc();
        void InstantiateDSAL(MDirectScreenAccess& aObserver);
        void DeleteDSA();
        void StartDSAL();
        void CancelDSA();
        TBool DSAActive() const;
        void UpdateScreenDevice();

    private:
        void ConstructL();
        CDSAWrapper(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow);

    private:
        CDirectScreenAccess* iDSA;
        RWsSession& iWs;
        CWsScreenDevice& iScreenDevice;
        RWindowBase& iWindow;
        TBool iCanBeActivated;
};


/**
*
* @class    CSkiGameLoop Ski.h
* @brief    class to perform message loop of game
*
* Copyright (c) EMCC Software Ltd 2003
* @version    1.0
*
*/
class CSkiGameLoop : public CTimer, public MDirectScreenAccess
{
    public:
        static CSkiGameLoop* NewL(CSkiEngine& aEngine, CSkiFrameRenderer& aRenderer, CDSAWrapper& aDSA);
        static CSkiGameLoop* NewLC(CSkiEngine& aEngine, CSkiFrameRenderer& aRenderer, CDSAWrapper& aDSA);
        ~CSkiGameLoop();
        void Start(TTimeIntervalMicroSeconds32 anInterval);
        void SetPaused(TBool aFlag);

    public:
        // from MDirectScreenAccess
        void Restart(RDirectScreenAccess::TTerminationReasons aReason);
        void AbortNow(RDirectScreenAccess::TTerminationReasons aReason);

    private:
        CSkiGameLoop(CSkiEngine& aEngine, CSkiFrameRenderer& aRenderer, CDSAWrapper& aDSA);
        void ConstructL();

    private:
        // from CActive
        virtual void RunL();
        virtual TInt RunError(TInt aError);
        virtual void DoCancel();

    private:
        TTimeIntervalMicroSeconds32 iInterval;
        CSkiEngine& iEngine;
        CSkiFrameRenderer& iRenderer;
        CDSAWrapper& iDSA;
        TBool iPaused;
};


#endif


⌨️ 快捷键说明

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