00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef RPSGAMESCREENS_
00031 #define RPSGAMESCREENS_
00032
00033 #include "rpsMenuOptions.h"
00034 #include "rpsPlayTimer.h"
00035 #include "roshambo.h"
00036
00037 const TInt KMaxRpsTextElement = 30;
00038 const TInt KRPSScreensHAlignment = 15;
00039
00040 extern TInt gScreenWidth;
00041 extern TInt gScreenHeight;
00042
00043 class CRpsGameEngine;
00044 class CBluetoothManager;
00045 class CGameScreen;
00046 class CWsBitmap;
00047
00048 class TGameData
00049 {
00050 public:
00054 TInt iRpsError;
00055 };
00056
00057
00058
00059
00060
00061
00062 class CGameScreenManager : public CBase
00063 {
00064 public:
00065 enum TGameState
00066 {
00067 ESplashScreen,
00068 EMainScreen,
00069 EPausedScreen,
00070 EPlayScreen,
00071 EWaitOpponentScreen,
00072 EResultScreen,
00073 EControlScreen,
00074 ENotifierScreen,
00075 EConnectingScreen,
00076 EStartScreen,
00077 EWaitStartScreen,
00078 EWaitConnScreen,
00079 EErrorScreen,
00080 EAboutScreen,
00081 EGameScreensTotal
00082 };
00083 enum TPlayMode
00084 {
00085 ESinglePlayer,
00086 ETwoPlayerShortlink,
00087 };
00088 public:
00095 static CGameScreenManager* NewL(CRpsGameEngine& aEngine);
00096
00100 ~CGameScreenManager();
00101 public:
00106 void SetGameState(TGameState aNewGameState);
00107 public:
00112 inline void SetPlayMode(TPlayMode aPlayMode) {iPlayMode = aPlayMode;};
00113
00118 inline TGameState GameState() const {return (iGameState);};
00119
00124 inline TPlayMode PlayMode() const {return (iPlayMode);};
00125
00129 inline CGameScreen* GameScreen() {return (iGameScreens[iGameState]);};
00130
00134 inline TRoshambo& Roshambo() {return (iRoshambo);};
00135
00139 inline CRpsGameEngine& GameEngine() {return iEngine;};
00140
00144 inline CBluetoothManager& BluetoothManager() {return (*iBTManager);};
00145
00149 inline TGameData& GameData() {return iGameData;};
00150
00151 private:
00156 void ConstructL();
00157
00163 CGameScreenManager(CRpsGameEngine& aEngine);
00164 private:
00168 TGameState iGameState;
00169
00173 TPlayMode iPlayMode;
00174
00178 CRpsGameEngine& iEngine;
00179
00183 CGameScreen* iGameScreens[EGameScreensTotal];
00184
00188 TRoshambo iRoshambo;
00189
00193 TGameData iGameData;
00194
00198 CBluetoothManager* iBTManager;
00199 };
00200
00201
00202
00203
00204
00205
00206 class TGameScreenItem
00207 {
00208 public:
00209 TGameScreenItem(RPS::TMenuOption aOption, const TDesC& aText);
00210 TDblQueLink iDlink;
00211 RPS::TMenuOption iOption;
00212 TBool iHighlighted;
00213 TInt iX;
00214 TInt iY;
00215 TBufC<KMaxRpsTextElement> iText;
00216 };
00217
00218
00219
00220
00221
00222
00223
00224 class CGameScreen : public CBase
00225 {
00226 public:
00227
00228 virtual void DrawGameScreen() =0;
00229
00230 virtual void ProcessInput(TUint& ) {};
00231
00232 virtual void PreActivate() {};
00233
00234 virtual void DeActivate() {};
00235 virtual ~CGameScreen();
00236 protected:
00237 CGameScreen(CGameScreenManager& iGameScreenMgr);
00238 protected:
00239 CGameScreenManager& iGameScreenMgr;
00240 };
00241
00242
00243
00244
00245
00246
00247 class CMenuScreen : public CGameScreen
00248 {
00249 public:
00250 virtual ~CMenuScreen();
00251 public:
00252 virtual void DrawGameScreen();
00253 virtual void ProcessInput(TUint& aKeyState);
00254 protected:
00255 CMenuScreen(CGameScreenManager& iGameScreenMgr);
00256 virtual void DoProcessInput(RPS::TMenuOption aSelected) =0;
00257 protected:
00258 TDblQue<TGameScreenItem> iItems;
00259 TDblQueIter<TGameScreenItem> iIterator;
00260 };
00261
00262
00263
00264
00265
00266
00267
00268 class CMainScreen : public CMenuScreen
00269 {
00270 public:
00277 static CGameScreen* NewL(CGameScreenManager& aScreenMgr);
00278 protected:
00279 virtual void DoProcessInput(RPS::TMenuOption aSelected);
00280 private:
00281 void ConstructL();
00282 CMainScreen(CGameScreenManager& aScreenMgr);
00283 };
00284
00285
00286
00287
00288
00289
00290
00291 class CPlayScreen : public CMenuScreen
00292 {
00293 public:
00300 static CGameScreen* NewL(CGameScreenManager& aScreenMgr);
00301 ~CPlayScreen();
00302 void PlayTimeout();
00303 protected:
00304 virtual void DoProcessInput(RPS::TMenuOption aSelected);
00305 virtual void PreActivate();
00306 virtual void DeActivate();
00307 private:
00308 void ConstructL();
00309 CPlayScreen(CGameScreenManager& aScreenMgr);
00310 private:
00311 CPlayTimer* iPlayTimer;
00312 };
00313
00314
00315
00316
00317
00318
00319 class CAboutScreen : public CMenuScreen
00320 {
00321 public:
00328 static CGameScreen* NewL(CGameScreenManager& aScreenMgr);
00329 protected:
00330 virtual void DrawGameScreen();
00331 virtual void DoProcessInput(RPS::TMenuOption aSelected);
00332 private:
00333 void ConstructL();
00334 CAboutScreen(CGameScreenManager& aScreenMgr);
00335 };
00336
00337
00338
00339
00340
00341
00342 class CPauseScreen : public CGameScreen
00343 {
00344 public:
00351 static CGameScreen* NewL(CGameScreenManager& aScreenMgr);
00352 ~CPauseScreen();
00353 public:
00354 virtual void DrawGameScreen();
00355 virtual void ProcessInput(TUint& aKeyState);
00356 virtual void DeActivate();
00357 private:
00358 void ConstructL();
00359 CPauseScreen(CGameScreenManager& aScreenMgr);
00360 private:
00361 CWsBitmap* iBmp;
00362 TPoint iPos;
00363 };
00364
00365
00366
00367
00368
00369 class CSplashScreen : public CGameScreen
00370 {
00371 public:
00378 static CGameScreen* NewL(CGameScreenManager& aScreenMgr);
00379 ~CSplashScreen();
00380 public:
00381 virtual void DrawGameScreen();
00382 private:
00383 void ConstructL();
00384 CSplashScreen(CGameScreenManager& aScreenMgr);
00385 private:
00386 TInt iSplashCounter;
00387 CWsBitmap* iBmp;
00388 TPoint iPos;
00389 };
00390
00391
00392
00393
00394
00395
00396 class CResultScreen : public CGameScreen
00397 {
00398 public:
00405 static CResultScreen* NewL(CGameScreenManager& aScreenMgr);
00406 public:
00407 virtual void DrawGameScreen();
00408 virtual void ProcessInput(TUint& aKeyState);
00409 private:
00410 void ConstructL();
00411 CResultScreen(CGameScreenManager& aScreenMgr);
00412 };
00413
00414
00415
00416
00417
00418
00419
00420
00421 class CControlScreen : public CMenuScreen
00422 {
00423 public:
00430 static CGameScreen* NewL(CGameScreenManager& aScreenMgr);
00431 protected:
00432 virtual void DoProcessInput(RPS::TMenuOption aSelected);
00433 private:
00434 void ConstructL();
00435 CControlScreen(CGameScreenManager& aScreenMgr);
00436 };
00437
00438
00439
00440
00441
00442
00443 class CStartScreen : public CMenuScreen
00444 {
00445 public:
00452 static CGameScreen* NewL(CGameScreenManager& aScreenMgr);
00453 protected:
00454 virtual void DoProcessInput(RPS::TMenuOption aSelected);
00455 private:
00456 void ConstructL();
00457 CStartScreen(CGameScreenManager& aScreenMgr);
00458 };
00459
00460
00461
00462
00463
00464
00465 class CWaitStartScreen : public CGameScreen
00466 {
00467 public:
00474 static CWaitStartScreen* NewL(CGameScreenManager& aScreenMgr);
00475 public:
00476 virtual void DrawGameScreen();
00477 private:
00478 void ConstructL();
00479 CWaitStartScreen(CGameScreenManager& aScreenMgr);
00480 };
00481
00482
00483
00484
00485
00486
00487 class CWaitConnScreen : public CGameScreen
00488 {
00489 public:
00496 static CWaitConnScreen* NewL(CGameScreenManager& aScreenMgr);
00497 public:
00498 virtual void DrawGameScreen();
00499 private:
00500 void ConstructL();
00501 CWaitConnScreen(CGameScreenManager& aScreenMgr);
00502 };
00503
00504
00505
00506
00507
00508
00509 class CErrorScreen : public CGameScreen
00510 {
00511 public:
00518 static CErrorScreen* NewL(CGameScreenManager& aScreenMgr);
00519 public:
00520 virtual void DrawGameScreen();
00521 virtual void ProcessInput(TUint& aKeyState);
00522 virtual void DeActivate();
00523 private:
00524 void ConstructL();
00525 CErrorScreen(CGameScreenManager& aScreenMgr);
00526 };
00527
00528
00529
00530
00531
00532
00533 class CConnectingScreen : public CGameScreen
00534 {
00535 public:
00542 static CConnectingScreen* NewL(CGameScreenManager& aScreenMgr);
00543 public:
00544 virtual void DrawGameScreen();
00545 virtual void ProcessInput(TUint& aKeyState);
00546 private:
00547 void ConstructL();
00548 CConnectingScreen(CGameScreenManager& aScreenMgr);
00549 };
00550
00551
00552
00553
00554
00555
00556 class CWaitOpponentScreen : public CGameScreen
00557 {
00558 public:
00565 static CWaitOpponentScreen* NewL(CGameScreenManager& aScreenMgr);
00566 public:
00567 virtual void DrawGameScreen();
00568 private:
00569 void ConstructL();
00570 CWaitOpponentScreen(CGameScreenManager& aScreenMgr);
00571 };
00572
00573
00574 class CNotifierScreen : public CGameScreen
00575 {
00576 public:
00577 static CNotifierScreen* NewL(CGameScreenManager& aGameScreenMgr);
00578 ~CNotifierScreen();
00579 public:
00580 virtual void DrawGameScreen();
00581 private:
00582 CNotifierScreen(CGameScreenManager& aGameScreenMgr);
00583 };
00584
00585 #endif