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

Middle menu class with 3 buttons and 1 title. More...

#include <page_3b_1t.hpp>

Public Member Functions

bool action_handler (const SDL_Event &event)
 Handles events for the menu buttons.
 
int get_mode_type () const
 Gets the current mode type.
 
int get_selected_option () const
 Gets the currently selected option.
 
 page_3b_1t (SDL_Renderer *_renderer, TTF_Font *font)
 Constructor for the middle menu page.
 
void render_object ()
 Renders the middle menu.
 
void set_mode_type (int type)
 Sets the mode type to display appropriate options.
 
 ~page_3b_1t ()
 Destructor for the middle menu page.
 

Private Attributes

SDL_Rect button_1
 
SDL_Rect button_2
 
SDL_Rect button_3
 
int mode_type
 
TTF_Font * police
 
SDL_Renderer * renderer
 
int selected_button
 
SDL_Texture * texture_middle_menu
 

Detailed Description

Middle menu class with 3 buttons and 1 title.

This class is a versatile menu that can be used for multiple purposes such as ball type selection or AI difficulty selection.

Constructor & Destructor Documentation

◆ page_3b_1t()

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

Constructor for the middle menu page.

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

Initializes the menu with three buttons and default settings

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

◆ ~page_3b_1t()

page_3b_1t::~page_3b_1t ( )

Destructor for the middle menu page.

Cleans up allocated resources

Member Function Documentation

◆ action_handler()

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

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

◆ get_mode_type()

int page_3b_1t::get_mode_type ( ) const

Gets the current mode type.

Returns
The current mode type ID

◆ get_selected_option()

int page_3b_1t::get_selected_option ( ) const

Gets the currently selected option.

Returns
The selected button index (0-2), or -1 if none selected

◆ render_object()

void page_3b_1t::render_object ( )

Renders the middle menu.

Displays different options based on the current mode_type value

◆ set_mode_type()

void page_3b_1t::set_mode_type ( int type)

Sets the mode type to display appropriate options.

Parameters
typeThe mode type ID to set

Member Data Documentation

◆ button_1

SDL_Rect page_3b_1t::button_1
private

Rectangle for first option button

◆ button_2

SDL_Rect page_3b_1t::button_2
private

Rectangle for second option button

◆ button_3

SDL_Rect page_3b_1t::button_3
private

Rectangle for third option button

◆ mode_type

int page_3b_1t::mode_type
private

Mode type for determining what options to show

◆ police

TTF_Font* page_3b_1t::police
private

Font used for text rendering

◆ renderer

SDL_Renderer* page_3b_1t::renderer
private

Responsible for placing objects on the SDL screen

◆ selected_button

int page_3b_1t::selected_button
private

Currently selected button (-1 if none)

◆ texture_middle_menu

SDL_Texture* page_3b_1t::texture_middle_menu
private

Texture for the menu background


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