My Project
UML Lab
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Menu Class Reference

Class representing the game menu for player color selection. More...

#include <menu.h>

Public Member Functions

 Menu (sf::RenderWindow &window)
 Constructs a Menu object.
 
Player chooseColor ()
 Displays a menu for the player to choose their color.
 

Private Attributes

sf::RenderWindow & window
 

Detailed Description

Class representing the game menu for player color selection.

Constructor & Destructor Documentation

◆ Menu()

Menu::Menu ( sf::RenderWindow & window)

Constructs a Menu object.

Parameters
windowReference to the SFML RenderWindow object.

Initializes the Menu object with a reference to the SFML RenderWindow it will use for display.

Parameters
windowReference to the SFML RenderWindow object.

Member Function Documentation

◆ chooseColor()

Player Menu::chooseColor ( )

Displays a menu for the player to choose their color.

Displays a menu for the player to choose their color (Red or Black).

Returns
Player object with the chosen color.

This function presents a simple menu with text options for "Red" and "Black." It waits for the user to click on one of the options and returns a Player object with the corresponding color.

Returns
Player object with the chosen color. If the window closes before a choice is made, it defaults to a Player object with color Red.

Member Data Documentation

◆ window

sf::RenderWindow& Menu::window
private

Reference to the SFML RenderWindow object.


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