Advertisement
Amorf

Untitled

Dec 14th, 2021
569
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.07 KB | None | 0 0
  1. #ifndef GAME_H
  2. #define GAME_H
  3.  
  4. #include "Level.h"
  5. #include "PieceSet.h"
  6. #include "Piece.h"
  7.  
  8. //
  9. // Game flow.
  10. // Only Game and DrawEngine are exposed to main().
  11. //
  12. class Game
  13. {
  14. public:
  15.     Game(DrawEngine &de);
  16.     ~Game();
  17.  
  18.     // Restarts the game
  19.     void restart();
  20.  
  21.     // Handles player's key press
  22.     bool keyPress(int vk);
  23.  
  24.     // Updates data or graphics
  25.     void timerUpdate();
  26.  
  27.     // Pass true to pause, pass false to resume
  28.     void pause(bool paused);
  29.  
  30.     // Called on WM_PAINT
  31.     void repaint() const;
  32.  
  33.     bool isGameOver() const;
  34.  
  35. protected:
  36.     // Shows GAME OVER message
  37.     inline void drawGameOver() const
  38.     {
  39.         de.drawText(TEXT("GAME OVER"), 3, 10);
  40.         de.drawText(TEXT("Press ENTER to restart"), 2, 9);
  41.     }
  42.  
  43.     // Shows PAUSE message
  44.     inline void drawPause() const
  45.     {
  46.         de.drawText(TEXT("PAUSE"), 4, 10);
  47.         de.drawText(TEXT("Press PAUSE again to continue"), 1, 9);
  48.     }
  49.  
  50.     Level *level;
  51.     DrawEngine &de;
  52.  
  53.     // Is game currently paused?
  54.     bool isPaused;
  55. };
  56.  
  57. #endif // GAME_H
  58.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement