PongGame.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (c) 2011 Nokia Corporation.
  3. */
  4. #ifndef __PONGGAME__
  5. #define __PONGGAME__
  6. #include "PongObject.h"
  7. enum PONGGAMESTATE { PGS_RUNNING, PGS_GAMEOVER, PGS_LEVELFINISHED, PGS_ABOUTTOSTART, PGS_2PL_PLAYER1WINS, PGS_2PL_PLAYER2WINS };
  8. class PongGame {
  9. public:
  10. PongGame(PongApp *app, bool singlepl );
  11. ~PongGame();
  12. bool update( const float frameTime,
  13. bool *buttons, float *pointerX, float *pointerY );
  14. void render();
  15. void addScore( int add ) { currentScore += add; }
  16. void levelCompleted();
  17. void gameOver();
  18. float getBallDefaultSpeed() { return m_ballDefaultSpeed; }
  19. int getScore() { return currentScore; }
  20. inline PONGGAMESTATE getGameState() { return gameState; }
  21. inline int getCurrentLevel() { return currentLevel; }
  22. inline bool isSinglePlayer() { return singlePlayer; }
  23. protected:
  24. bool singlePlayer;
  25. void resetBall();
  26. char stateText[256];
  27. PONGGAMESTATE gameState;
  28. float stateCounter;
  29. float runTime;
  30. bool exbuttonDown;
  31. float quitAnimation;
  32. PongApp *pongApp;
  33. PongObject *pads[2];
  34. PongObject *ball;
  35. int scoreIncreaseCounter;
  36. int displayScore;
  37. int currentScore;
  38. int currentLevel;
  39. float m_ballDefaultSpeed;
  40. };
  41. #endif