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

Defines the mode selection menu with 4 buttons and 1 title. More...

#include <page_4b_1t.hpp>

Public Member Functions

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.
 

Private Attributes

SDL_Rect button_ai_mode
 
SDL_Rect button_exit
 
SDL_Rect button_fun_mode
 
SDL_Rect button_storytime_mode
 
SDL_Rect button_two_players_mode
 
bool exit_game
 
int mode_id
 
TTF_Font * police
 
SDL_Renderer * renderer
 
SDL_Texture * texture_menu
 

Detailed Description

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.)

Constructor & Destructor Documentation

◆ page_4b_1t()

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

Constructor for the mode menu page.

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

Initializes the menu with buttons for different game modes and an exit button

Parameters
_rendererThe SDL renderer to use for drawing
fontThe 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

Member Function Documentation

◆ action_handler()

bool page_4b_1t::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 and set corresponding mode flags

Parameters
eventThe 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

Member Data Documentation

◆ 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

Flag to exit the game

◆ mode_id

int page_4b_1t::mode_id
private

Selected game 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: