R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
Game::VictoryMenu Class Reference

Victory screen displayed when the player wins the level. More...

#include <VictoryMenu.hpp>

Inheritance diagram for Game::VictoryMenu:
Inheritance graph
Collaboration diagram for Game::VictoryMenu:
Collaboration graph

Public Member Functions

 VictoryMenu (UI::IUIFactory &uiFactory)
 Construct a new VictoryMenu.
 
 ~VictoryMenu () override=default
 
void Initialize () override
 Initialize UI elements (creates buttons and text).
 
void SetOnReturnToMenu (std::function< void()> callback)
 Set callback invoked when user clicks return to menu button.
 
void SetVictoryMessage (const std::string &message)
 Set the victory message to display.
 
void Render () override
 Custom render to display victory message.
 
- Public Member Functions inherited from Game::BaseMenu
 BaseMenu (UI::IUIFactory &uiFactory)
 Constructor with UI factory reference.
 
virtual ~BaseMenu ()=default
 Virtual destructor.
 
virtual void Update ()
 Update menu state (should be called every frame).
 
virtual void Show ()
 Show the menu.
 
virtual void Hide ()
 Hide the menu.
 
virtual bool IsVisible () const
 Check if menu is currently visible.
 
void SetSoundEffectService (Audio::ISoundEffectService *soundService)
 Set the sound effect service for playing UI sounds.
 

Private Member Functions

void OnReturnToMenuClicked ()
 

Private Attributes

std::function< void()> _onReturnToMenu {}
 
std::string _victoryMessage {"VICTORY!"}
 

Additional Inherited Members

- Protected Member Functions inherited from Game::BaseMenu
std::function< void()> WrapWithClickSound (std::function< void()> callback)
 Wrap a callback to play click sound before executing.
 
std::shared_ptr< UI::IButtonCreateCenteredButton (const char *label, float offsetY, float width, float height, unsigned int backgroundColor, unsigned int hoverColor, std::function< void()> callback)
 Create a button with standard styling and positioning.
 
- Protected Attributes inherited from Game::BaseMenu
UI::IUIFactory_uiFactory
 
std::shared_ptr< UI::IMenu_menu
 
Audio::ISoundEffectService_soundService {nullptr}
 

Detailed Description

Victory screen displayed when the player wins the level.

Shows victory message and allows player to return to main menu or continue.

Definition at line 23 of file VictoryMenu.hpp.

Constructor & Destructor Documentation

◆ VictoryMenu()

Game::VictoryMenu::VictoryMenu ( UI::IUIFactory uiFactory)
explicit

Construct a new VictoryMenu.

Parameters
uiFactoryUI factory used to create menus and buttons.

Definition at line 12 of file VictoryMenu.cpp.

◆ ~VictoryMenu()

Game::VictoryMenu::~VictoryMenu ( )
overridedefault

Member Function Documentation

◆ Initialize()

void Game::VictoryMenu::Initialize ( )
overridevirtual

Initialize UI elements (creates buttons and text).

Implements Game::BaseMenu.

Definition at line 14 of file VictoryMenu.cpp.

References Game::BaseMenu::_menu, Game::BaseMenu::CreateCenteredButton(), OnReturnToMenuClicked(), and Game::BaseMenu::WrapWithClickSound().

Here is the call graph for this function:

◆ OnReturnToMenuClicked()

void Game::VictoryMenu::OnReturnToMenuClicked ( )
private

Definition at line 50 of file VictoryMenu.cpp.

References _onReturnToMenu, and LOG_INFO.

Referenced by Initialize().

◆ Render()

void Game::VictoryMenu::Render ( )
overridevirtual

Custom render to display victory message.

Reimplemented from Game::BaseMenu.

Definition at line 38 of file VictoryMenu.cpp.

References Game::BaseMenu::IsVisible(), and Game::BaseMenu::Render().

Here is the call graph for this function:

◆ SetOnReturnToMenu()

void Game::VictoryMenu::SetOnReturnToMenu ( std::function< void()>  callback)

Set callback invoked when user clicks return to menu button.

Definition at line 30 of file VictoryMenu.cpp.

References _onReturnToMenu.

◆ SetVictoryMessage()

void Game::VictoryMenu::SetVictoryMessage ( const std::string &  message)

Set the victory message to display.

Parameters
messageVictory message (e.g., "Level Complete!", "Victory!")

Definition at line 34 of file VictoryMenu.cpp.

References _victoryMessage.

Member Data Documentation

◆ _onReturnToMenu

std::function<void()> Game::VictoryMenu::_onReturnToMenu {}
private

Definition at line 56 of file VictoryMenu.hpp.

Referenced by OnReturnToMenuClicked(), and SetOnReturnToMenu().

◆ _victoryMessage

std::string Game::VictoryMenu::_victoryMessage {"VICTORY!"}
private

Definition at line 57 of file VictoryMenu.hpp.

Referenced by SetVictoryMessage().


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