The NEW Pong Game V13.2.1
An interesting implemnettaion of the pong game
Loading...
Searching...
No Matches
GameOver Class Reference

#include <game_over.hpp>

Public Member Functions

bool action_handler (const SDL_Event &event)
 Handles user interaction events.
 
 GameOver (SDL_Renderer *_renderer, TTF_Font *font)
 Constructor for the game_over class.
 
bool get_go_back () const
 
void render_object ()
 Renders the game over screen.
 
void set_winner (const std::string &name)
 Sets the winner's name to display on the game over screen.
 
 ~GameOver ()
 Destructor for the game_over class.
 

Private Attributes

SDL_Rect button_back
 
bool go_back
 
TTF_Font * police
 
SDL_Renderer * renderer
 
SDL_Texture * texture_menu
 
std::string winner_name
 

Constructor & Destructor Documentation

◆ GameOver()

GameOver::GameOver ( SDL_Renderer * _renderer,
TTF_Font * font )

Constructor for the game_over class.

Initializes the game over screen with default values and sets up the back button

Parameters
_rendererThe SDL renderer to use for drawing
fontThe TTF font to use for text display

◆ ~GameOver()

GameOver::~GameOver ( )

Destructor for the game_over class.

Cleans up allocated resources

Member Function Documentation

◆ action_handler()

bool GameOver::action_handler ( const SDL_Event & event)

Handles user interaction events.

Processes SDL events to detect button clicks, particularly for the back button

Parameters
eventThe SDL event to process
Returns
true if the back button is pressed, false otherwise

◆ get_go_back()

bool GameOver::get_go_back ( ) const

◆ render_object()

void GameOver::render_object ( )

Renders the game over screen.

Displays the game over message, the winner's name, and the back button

◆ set_winner()

void GameOver::set_winner ( const std::string & name)

Sets the winner's name to display on the game over screen.

Parameters
nameThe name of the winner to be displayed

Member Data Documentation

◆ button_back

SDL_Rect GameOver::button_back
private

Rectangle defining the back button's position and size

◆ go_back

bool GameOver::go_back
private

Flag to indicate going back to the modes menu

◆ police

TTF_Font* GameOver::police
private

Font used for text rendering

◆ renderer

SDL_Renderer* GameOver::renderer
private

Responsible for placing the objects on the SDL screen

◆ texture_menu

SDL_Texture* GameOver::texture_menu
private

Texture for the menu background

◆ winner_name

std::string GameOver::winner_name
private

Name of the winning player to display


The documentation for this class was generated from the following files: