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

Main menu class with 3 buttons and no title. More...

#include <page_3b_0t.hpp>

Public Member Functions

bool action_handler (const SDL_Event &event)
 Handles events for the menu buttons.
 
bool get_continue_game () const
 Checks if the continue game button was pressed.
 
bool get_exit_mode () const
 Checks if the exit button was pressed.
 
bool get_saved_file_exists () const
 Checks if a saved game file exists.
 
bool get_started () const
 Checks if the start new game button was pressed.
 
 page_3b_0t (SDL_Renderer *_renderer, TTF_Font *font)
 Constructor for the main menu page.
 
void render_object (int mode, const std::string &highscore_name, int highscore)
 Renders the main menu.
 
void set_saved_file_exists ()
 Updates the saved file exists flag.
 
 ~page_3b_0t ()
 Destructor for the main menu page.
 

Private Attributes

SDL_Rect button_continue
 
SDL_Rect button_exit
 
SDL_Rect button_start
 
bool continue_game
 
bool exit_mode
 
TTF_Font * police
 
SDL_Renderer * renderer
 
bool saved_file_exists
 
bool start_new_game
 
SDL_Texture * texture_menu
 

Detailed Description

Main menu class with 3 buttons and no title.

This class implements the main menu screen with options to start a new game, continue a saved game, or exit to the mode selection screen.

Constructor & Destructor Documentation

◆ page_3b_0t()

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

Constructor for the main menu page.

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

Initializes the menu with buttons and checks for existing saved games

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

◆ ~page_3b_0t()

page_3b_0t::~page_3b_0t ( )

Destructor for the main menu page.

Cleans up allocated resources

Member Function Documentation

◆ action_handler()

bool page_3b_0t::action_handler ( const SDL_Event & event)

Handles events for the menu buttons.

Parameters
eventThe SDL event to process
Returns
true if a button was clicked, false otherwise

Processes SDL events to detect button clicks

Parameters
eventThe SDL event to process
Returns
true if a button was clicked, false otherwise

◆ get_continue_game()

bool page_3b_0t::get_continue_game ( ) const

Checks if the continue game button was pressed.

Returns
true if should continue a saved game, false otherwise

◆ get_exit_mode()

bool page_3b_0t::get_exit_mode ( ) const

Checks if the exit button was pressed.

Returns
true if should exit to mode selection, false otherwise

◆ get_saved_file_exists()

bool page_3b_0t::get_saved_file_exists ( ) const

Checks if a saved game file exists.

Returns
true if a saved game exists, false otherwise

◆ get_started()

bool page_3b_0t::get_started ( ) const

Checks if the start new game button was pressed.

Returns
true if a new game should be started, false otherwise

◆ render_object()

void page_3b_0t::render_object ( int mode,
const std::string & highscore_name,
int highscore )

Renders the main menu.

Parameters
modeCurrent game mode
highscore_nameName of the player with highest score
highscoreThe highest score value

Displays the menu buttons and high score information if available

Parameters
modeCurrent game mode
highscore_nameName of the player with highest score
highscoreThe highest score value

◆ set_saved_file_exists()

void page_3b_0t::set_saved_file_exists ( )

Updates the saved file exists flag.

Member Data Documentation

◆ button_continue

SDL_Rect page_3b_0t::button_continue
private

Rectangle for continueing game button

◆ button_exit

SDL_Rect page_3b_0t::button_exit
private

Rectangle for exit

◆ button_start

SDL_Rect page_3b_0t::button_start
private

Rectangle for start new game

◆ continue_game

bool page_3b_0t::continue_game
private

Flag for continuing a saved game

◆ exit_mode

bool page_3b_0t::exit_mode
private

Flag for exiting to mode selection

◆ police

TTF_Font* page_3b_0t::police
private

Font used for text rendering

◆ renderer

SDL_Renderer* page_3b_0t::renderer
private

Responsible for placing objects on the SDL screen

◆ saved_file_exists

bool page_3b_0t::saved_file_exists
private

Whether a saved game file exists

◆ start_new_game

bool page_3b_0t::start_new_game
private

Flag for starting a new game

◆ texture_menu

SDL_Texture* page_3b_0t::texture_menu
private

Texture for the menu background


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