- // 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