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

📄 s60uiexamplemodel.h

📁 《Symbian S60第3版手机程序开发与实用教程》光盘源代码
💻 H
字号:
// Copyright (c) 2006 Nokia Corporation.

#ifndef __S60UIEXAMPLE_MODEL_H__
#define __S60UIEXAMPLE_MODEL_H__

#include <e32base.h>

/**
* THighScore
* class structure to hold high scores and names
*/
class THighScore
    {
    public:
        TInt      iScore;
        TBufC<20> iName;
    };
    
/**
* CS60UIExampleModel model class.
* An instance of class CS60UIExampleModel
*/
class CS60UIExampleModel : public CBase
    {

    public: // Constructors and destructor
    
        /**
        * CS60UIExampleModel::NewL()
        * Two-phased constructor.
        */
        static CS60UIExampleModel* CS60UIExampleModel::NewL();
        
        /**
        * CS60UIExampleModel::NewLC()
        * Two-phased constructor.
        */
        static CS60UIExampleModel* CS60UIExampleModel::NewLC();
        
        /**
        * ConstructL.
        * 2nd phase constructor.
        */
        void ConstructL();

        /**
        * Destructor
        */
        virtual ~CS60UIExampleModel();
        
    public:
        /**
        * Access functions
        */
        TBool IsGameStarted() const  { return iGameStarted; }
        TBool IsGamePaused() const   { return iGamePaused; }
            
        void GameStart()    { iGameStarted = ETrue; iLevel = 1; iScore = 0; }
        void GameStop()     { iGameStarted = EFalse; }
        void GamePause()    { iGamePaused = ETrue; }
        void GameContinue() { iGameStarted = ETrue; iGamePaused = EFalse; }
        
        TInt LevelNumber()               { return iLevel; }
        void SetLevelNumber(TInt aLevel) { iLevel = aLevel; }
        
        TInt Score()               { return iScore; }
        void SetScore(TInt aScore) { iScore = aScore; }
        
        RArray<THighScore>* HighScoreArray() { return &iHighScores; }

        void InsertInHighScoresL(TDesC& aName, TInt aScore);
        
    private: // Data

        /**
        * iGameStarted - True if Game is started
        */
        TBool iGameStarted;
        
        /**
        * iGamePaused - True if Game is paused
        */
        TBool iGamePaused;
        
        /**
        * iLevel - The game level
        */
        TInt iLevel;
        
        /**
        * iScore - The game score
        */
        TInt iScore;
        
        /**
        * iHighScores - array of highest scores
        */
        RArray<THighScore>  iHighScores;

    };


#endif // __S60UIEXAMPLE_MODEL_H__

// End of File

⌨️ 快捷键说明

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