![]() |
The NEW Pong Game V13.2.1
An interesting implemnettaion of the pong game
|
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 |
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.
page_3b::page_3b | ( | SDL_Renderer * | renderer, |
TTF_Font * | font ) |
Constructor for pause menu.
renderer | The SDL renderer to use for drawing |
font | The TTF font to use for text display |
Initializes the pause menu with resume, save and exit buttons
renderer | The SDL renderer to use for drawing |
font | The TTF font to use for text display |
page_3b::~page_3b | ( | ) |
Destructor for pause menu.
bool page_3b::action_handler | ( | const SDL_Event & | event | ) |
Handles events for the menu buttons.
event | The SDL event to process |
Processes SDL events to detect button hovers and clicks
event | The SDL event to process |
bool page_3b::get_exit_mode | ( | ) | const |
Checks if the exit button was pressed.
int page_3b::get_mode_type | ( | ) | const |
Gets the current game mode type.
void page_3b::render_object | ( | ) |
Renders the pause menu.
Draws the background and buttons with appropriate styling
void page_3b::set_mode_type | ( | int | type | ) |
Sets the current game mode type.
type | The game mode type ID |
bool page_3b::ShouldResume | ( | ) | const |
Checks if the resume button was pressed.
bool page_3b::ShouldSave | ( | ) | const |
Checks if the save button was pressed.
|
private |
Rectangle for exit button
|
private |
Flag for exit button
|
private |
Current game mode type
|
private |
Flag for resume button
|
private |
Rectangle for resume button
|
private |
Flag for save button
|
private |
Rectangle for save button
|
private |
Font used for text rendering
|
private |
Renderer for drawing elements
|
private |
Currently selected/highlighted button