HeadBall  1.0
A game
GameOver.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <SFML/Graphics.hpp>
4 
5 #include "State.hpp"
6 #include "Game.hpp"
7 
8 namespace HeadBall {
13  class GameOver : public State {
14  public:
21  GameOver (GameDataRef data, ScoreTimeRef scoreTime);
22 
27  void init ( );
28 
33  void handleInput ( );
34 
39  void update ( );
40 
45  void draw ( );
46 
47  private:
50 
51  sf::Sound _crowdCheerOnGoal;
52  sf::Sound _btnClickSfx;
53 
54  sf::Sprite _background;
55  sf::Sprite _replayBtn;
56  sf::Sprite _exitBtn;
57 
58  sf::Text _winnerText;
59  sf::Text _score;
60  };
61 }
Class for game over or full-time state.
Definition: GameOver.hpp:13
sf::Sound _btnClickSfx
Sound effect for button click.
Definition: GameOver.hpp:52
void init()
Initialize state related data.
Definition: GameOver.cpp:11
sf::Text _winnerText
Text to display depending on who won or if it is a draw.
Definition: GameOver.hpp:58
ScoreTimeRef _scoreTime
The shared pointer for ScoreTimeData.
Definition: GameOver.hpp:49
sf::Sprite _replayBtn
Button to replay the game.
Definition: GameOver.hpp:55
GameDataRef _data
The shared pointer for GameData.
Definition: GameOver.hpp:48
sf::Sprite _background
Background sprite to draw on the screen.
Definition: GameOver.hpp:54
void update()
Update state data.
Definition: GameOver.cpp:115
sf::Sprite _exitBtn
Button to exit the game.
Definition: GameOver.hpp:56
void handleInput()
Handle user input.
Definition: GameOver.cpp:76
void draw()
Draw state objects.
Definition: GameOver.cpp:117
GameOver(GameDataRef data, ScoreTimeRef scoreTime)
Construct a new Game Over object.
Definition: GameOver.cpp:9
sf::Sound _crowdCheerOnGoal
Sound effect for crowd cheering.
Definition: GameOver.hpp:51
sf::Text _score
Final score of the game.
Definition: GameOver.hpp:59
Abstract based class which inherits all the states of the game.
Definition: State.hpp:8
Custom namespace used throughout the project.
Definition: AboutState.cpp:6
std::shared_ptr< ScoreTimeData > ScoreTimeRef
The Shared Pointer of ScoreTimeData struct.
Definition: Game.hpp:45
std::shared_ptr< GameData > GameDataRef
The Shared Pointer of GameData Struct.
Definition: Game.hpp:39