Defines the mode selection menu with 4 buttons and 1 title.
More...
#include <page_4b_1t.hpp>
|
bool | action_handler (const SDL_Event &event) |
| Handles events for the menu buttons.
|
|
bool | get_exit_game () const |
| Checks if the exit game flag is set.
|
|
int | get_mode_id () const |
| Gets the selected game mode ID.
|
|
| page_4b_1t (SDL_Renderer *_renderer, TTF_Font *font) |
| Constructor for the mode menu page.
|
|
void | render_object () |
| Renders the mode menu.
|
|
| ~page_4b_1t () |
| Destructor for the mode menu page.
|
|
Defines the mode selection menu with 4 buttons and 1 title.
This class handles the mode selection screen where players can choose between different game modes (AI mode, Two players mode, etc.)
◆ page_4b_1t()
page_4b_1t::page_4b_1t |
( |
SDL_Renderer * | _renderer, |
|
|
TTF_Font * | font ) |
Constructor for the mode menu page.
- Parameters
-
_renderer | The SDL renderer to use for drawing |
font | The TTF font to use for text display |
Initializes the menu with buttons for different game modes and an exit button
- Parameters
-
_renderer | The SDL renderer to use for drawing |
font | The TTF font to use for text display |
◆ ~page_4b_1t()
page_4b_1t::~page_4b_1t |
( |
| ) |
|
Destructor for the mode menu page.
Cleans up allocated resources
◆ action_handler()
bool page_4b_1t::action_handler |
( |
const SDL_Event & | event | ) |
|
Handles events for the menu buttons.
- Parameters
-
event | The SDL event to process |
- Returns
- true if a button was clicked, false otherwise
Processes SDL events to detect button clicks and set corresponding mode flags
- Parameters
-
event | The SDL event to process |
- Returns
- true if a button was clicked, false otherwise
◆ get_exit_game()
bool page_4b_1t::get_exit_game |
( |
| ) |
const |
Checks if the exit game flag is set.
- Returns
- true if the game should exit, false otherwise
◆ get_mode_id()
int page_4b_1t::get_mode_id |
( |
| ) |
const |
Gets the selected game mode ID.
- Returns
- The selected mode ID for redirecting to the correct view
◆ render_object()
void page_4b_1t::render_object |
( |
| ) |
|
Renders the mode menu.
Draws the title and all game mode buttons on screen
◆ button_ai_mode
SDL_Rect page_4b_1t::button_ai_mode |
|
private |
Rectangle for AI mode button
◆ button_exit
SDL_Rect page_4b_1t::button_exit |
|
private |
Rectangle for exit button
◆ button_fun_mode
SDL_Rect page_4b_1t::button_fun_mode |
|
private |
Rectangle for fun mode button
◆ button_storytime_mode
SDL_Rect page_4b_1t::button_storytime_mode |
|
private |
Rectangle for storytime mode button
◆ button_two_players_mode
SDL_Rect page_4b_1t::button_two_players_mode |
|
private |
Rectangle for two players mode button
◆ exit_game
bool page_4b_1t::exit_game |
|
private |
◆ mode_id
◆ police
TTF_Font* page_4b_1t::police |
|
private |
Font used for text rendering
◆ renderer
SDL_Renderer* page_4b_1t::renderer |
|
private |
Responsible for placing the objects on the SDL screen
◆ texture_menu
SDL_Texture* page_4b_1t::texture_menu |
|
private |
mode = 1 -> AI mode mode = 2 -> Two players mode mode = 3 -> Storytime mode mode = 4 -> Fun mode
Check macros.hpp for more information Texture for the menu background
The documentation for this class was generated from the following files: