[Added] Pause and Game Over screens
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#ifndef GAME_SERVICE_H
|
||||
#define GAME_SERVICE_H
|
||||
|
||||
#include "Service.h"
|
||||
|
||||
class GameService : public Service<GameService> {
|
||||
public:
|
||||
bool isPaused() {
|
||||
return this->paused;
|
||||
}
|
||||
|
||||
bool isGameOver() {
|
||||
return this->gameOver;
|
||||
}
|
||||
|
||||
void setPaused(bool paused) {
|
||||
this->paused = paused;
|
||||
}
|
||||
|
||||
void setGameOver(bool gameOver) {
|
||||
this->gameOver = gameOver;
|
||||
}
|
||||
|
||||
private:
|
||||
bool paused = false;
|
||||
bool gameOver = false;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -32,7 +32,6 @@ public:
|
||||
* Start the game loop
|
||||
*/
|
||||
void startGame();
|
||||
|
||||
static void staticStep()
|
||||
{
|
||||
if (IsKeyPressed(KEY_ENTER) || IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
|
||||
@@ -45,16 +44,13 @@ public:
|
||||
|
||||
private:
|
||||
std::unique_ptr<Screen> currentScreen;
|
||||
|
||||
bool gameRunning = true;
|
||||
|
||||
Vector2 screenSize;
|
||||
|
||||
/**
|
||||
* One step of the gameloop
|
||||
*/
|
||||
void step();
|
||||
|
||||
void handleMusic();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user