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

Utility class providing user interface functionality. More...

#include <gui.hpp>

Static Public Member Functions

static std::string player_name_input (SDL_Renderer *renderer, TTF_Font *font, int player_number)
 Gets the player's name input from the SDL window.
 

Detailed Description

Utility class providing user interface functionality.

This class contains static methods for handling UI elements and user interactions throughout the game.

Member Function Documentation

◆ player_name_input()

std::string GUI::player_name_input ( SDL_Renderer * renderer,
TTF_Font * font,
int player_number )
static

Gets the player's name input from the SDL window.

Displays an input field for a player to enter their name.

This function handles SDL events to capture the player's name input from the keyboard. It displays the input text on screen and updates it in real-time as the player types.

Parameters
rendererThe SDL renderer used for drawing
fontThe TTF font used to render text
player_numberThe player number (for display purposes)
Returns
std::string The name entered by the player

This function creates an SDL window with an input field where the player can type their name. It manages all input events and rendering.

Parameters
rendererThe SDL renderer to use for drawing
fontThe TTF font to use for text display
player_numberThe player number (for display purposes)
Returns
std::string The name entered by the player

Define UI element positions and dimensions Centers the input field and instruction text on screen

Initialize the white background

Main input loop Processes keyboard events and updates the display

Render the instruction text

Render the input text

Cleanup resources before returning


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