![]() |
The NEW Pong Game
V13.2.1
An interesting implemnettaion of the pong game
|
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. More... | |
| bool | get_continue_game () const |
| Checks if the continue game button was pressed. More... | |
| bool | get_exit_mode () const |
| Checks if the exit button was pressed. More... | |
| bool | get_saved_file_exists () const |
| Checks if a saved game file exists. More... | |
| bool | get_started () const |
| Checks if the start new game button was pressed. More... | |
| page_3b_0t (SDL_Renderer *_renderer, TTF_Font *font) | |
| Constructor for the main menu page. More... | |
| void | render_object (int mode, const std::string &highscore_name, int highscore) |
| Renders the main menu. More... | |
| void | set_saved_file_exists () |
| Updates the saved file exists flag. More... | |
| ~page_3b_0t () | |
| Destructor for the main menu page. More... | |
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 |
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.
| page_3b_0t::page_3b_0t | ( | SDL_Renderer * | _renderer, |
| TTF_Font * | font | ||
| ) |
Constructor for the main menu page.
| _renderer | The SDL renderer to use for drawing |
| font | The TTF font to use for text display |
Initializes the menu with buttons and checks for existing saved games
| _renderer | The SDL renderer to use for drawing |
| font | The TTF font to use for text display |
| page_3b_0t::~page_3b_0t | ( | ) |
Destructor for the main menu page.
Cleans up allocated resources
| bool page_3b_0t::action_handler | ( | const SDL_Event & | event | ) |
Handles events for the menu buttons.
| event | The SDL event to process |
Processes SDL events to detect button clicks
| event | The SDL event to process |
| bool page_3b_0t::get_continue_game | ( | ) | const |
Checks if the continue game button was pressed.
| bool page_3b_0t::get_exit_mode | ( | ) | const |
Checks if the exit button was pressed.
| bool page_3b_0t::get_saved_file_exists | ( | ) | const |
Checks if a saved game file exists.
| bool page_3b_0t::get_started | ( | ) | const |
Checks if the start new game button was pressed.
| void page_3b_0t::render_object | ( | int | mode, |
| const std::string & | highscore_name, | ||
| int | highscore | ||
| ) |
Renders the main menu.
| mode | Current game mode |
| highscore_name | Name of the player with highest score |
| highscore | The highest score value |
Displays the menu buttons and high score information if available
| mode | Current game mode |
| highscore_name | Name of the player with highest score |
| highscore | The highest score value |
| void page_3b_0t::set_saved_file_exists | ( | ) |
Updates the saved file exists flag.
|
private |
Rectangle for continueing game button
|
private |
Rectangle for exit
|
private |
Rectangle for start new game
|
private |
Flag for continuing a saved game
|
private |
Flag for exiting to mode selection
|
private |
Font used for text rendering
|
private |
Responsible for placing objects on the SDL screen
|
private |
Whether a saved game file exists
|
private |
Flag for starting a new game
|
private |
Texture for the menu background