The NEW Pong Game  V13.2.1
An interesting implemnettaion of the pong game
game_over.hpp
Go to the documentation of this file.
1 
8 #ifndef GAME_OVER_HPP
9 #define GAME_OVER_HPP
10 
11 #include <SDL.h>
12 #include <SDL_ttf.h>
13 #include <string>
14 
23 class GameOver
24 {
25 private:
26  SDL_Texture *texture_menu;
27  SDL_Renderer *renderer;
28  TTF_Font *police;
30  SDL_Rect button_back;
32  bool go_back;
34  std::string winner_name;
36 public:
37  GameOver(SDL_Renderer *_renderer, TTF_Font *font);
38  ~GameOver();
39 
40  // Handles the events from the SDL window and returns true if the back button is pressed
41  bool action_handler(const SDL_Event &event);
42 
43  // Returns true if the back button is pressed - used a sflag to change between screens
44 bool get_go_back() const { return go_back; }
45 
46  // Returns the name of the winner
47  void set_winner(const std::string &name);
48 
49  // Renders the game over menu with the winner's name and a back button
50  void render_object();
51 };
52 
53 #endif // NOTICE_MENU_HPP
Definition: game_over.hpp:24
SDL_Renderer * renderer
Definition: game_over.hpp:27
bool go_back
Definition: game_over.hpp:32
GameOver(SDL_Renderer *_renderer, TTF_Font *font)
Constructor for the game_over class.
Definition: game_over.cpp:20
SDL_Rect button_back
Definition: game_over.hpp:30
std::string winner_name
Definition: game_over.hpp:34
void set_winner(const std::string &name)
Sets the winner's name to display on the game over screen.
Definition: game_over.cpp:119
void render_object()
Renders the game over screen.
Definition: game_over.cpp:79
TTF_Font * police
Definition: game_over.hpp:28
bool get_go_back() const
Definition: game_over.hpp:44
~GameOver()
Destructor for the game_over class.
Definition: game_over.cpp:39
SDL_Texture * texture_menu
Definition: game_over.hpp:26
bool action_handler(const SDL_Event &event)
Handles user interaction events.
Definition: game_over.cpp:56
TTF_Font * font
Definition: letter_test.cpp:24