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

Pause menu with 3 buttons. More...

#include <page_3b.hpp>

Public Member Functions

bool action_handler (const SDL_Event &event)
 Handles events for the menu buttons.
 
bool get_exit_mode () const
 Checks if the exit button was pressed.
 
int get_mode_type () const
 Gets the current game mode type.
 
 page_3b (SDL_Renderer *renderer, TTF_Font *font)
 Constructor for pause menu.
 
void render_object ()
 Renders the pause menu.
 
void set_mode_type (int type)
 Sets the current game mode type.
 
bool ShouldResume () const
 Checks if the resume button was pressed.
 
bool ShouldSave () const
 Checks if the save button was pressed.
 
 ~page_3b ()
 Destructor for pause menu.
 

Private Attributes

SDL_Rect button_exit
 
bool mExit
 
int mode_type
 
bool mResume
 
SDL_Rect mResumeButton
 
bool mSave
 
SDL_Rect mSaveButton
 
TTF_Font * police
 
SDL_Renderer * renderer
 
int selected_button
 

Detailed Description

Pause menu with 3 buttons.

This class implements the pause menu that appears during gameplay, allowing players to resume the game, save their progress, or exit.

Constructor & Destructor Documentation

◆ page_3b()

page_3b::page_3b ( SDL_Renderer * renderer,
TTF_Font * font )

Constructor for pause menu.

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

Initializes the pause menu with resume, save and exit buttons

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

◆ ~page_3b()

page_3b::~page_3b ( )

Destructor for pause menu.

Member Function Documentation

◆ action_handler()

bool page_3b::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 hovers and clicks

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

◆ get_exit_mode()

bool page_3b::get_exit_mode ( ) const

Checks if the exit button was pressed.

Returns
true if the game should exit, false otherwise

◆ get_mode_type()

int page_3b::get_mode_type ( ) const

Gets the current game mode type.

Returns
The current game mode type ID

◆ render_object()

void page_3b::render_object ( )

Renders the pause menu.

Draws the background and buttons with appropriate styling

◆ set_mode_type()

void page_3b::set_mode_type ( int type)

Sets the current game mode type.

Parameters
typeThe game mode type ID

◆ ShouldResume()

bool page_3b::ShouldResume ( ) const

Checks if the resume button was pressed.

Returns
true if the game should resume, false otherwise

◆ ShouldSave()

bool page_3b::ShouldSave ( ) const

Checks if the save button was pressed.

Returns
true if the game should be saved, false otherwise

Member Data Documentation

◆ button_exit

SDL_Rect page_3b::button_exit
private

Rectangle for exit button

◆ mExit

bool page_3b::mExit
private

Flag for exit button

◆ mode_type

int page_3b::mode_type
private

Current game mode type

◆ mResume

bool page_3b::mResume
private

Flag for resume button

◆ mResumeButton

SDL_Rect page_3b::mResumeButton
private

Rectangle for resume button

◆ mSave

bool page_3b::mSave
private

Flag for save button

◆ mSaveButton

SDL_Rect page_3b::mSaveButton
private

Rectangle for save button

◆ police

TTF_Font* page_3b::police
private

Font used for text rendering

◆ renderer

SDL_Renderer* page_3b::renderer
private

Renderer for drawing elements

◆ selected_button

int page_3b::selected_button
private

Currently selected/highlighted button


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