|
Zappy GUI
C++ graphic client: renderer, camera, network
|
Semi-transparent overlay shown when a team wins. More...
#include <WinScreen.hpp>
Inheritance diagram for WinScreen:
Collaboration diagram for WinScreen:Public Member Functions | |
| WinScreen () | |
| ~WinScreen () override=default | |
| void | reset () |
| void | setWinner (const std::string &team, Color color) |
| Sets the winning team name and highlight color. | |
| void | setDuration (int seconds, int64_t ticks) |
| Sets the win duration (server-authoritative, from gwt). | |
| void | draw (int scaledFontSize) const override |
| Draws the widget. | |
| bool | handleInput () override |
| Handles button input. Always returns true (overlay blocks all input). | |
| bool | quitRequested () const |
| Returns true once the Quit button has been clicked (latched — stays true). | |
Public Member Functions inherited from IWidget | |
| virtual | ~IWidget ()=default |
Private Member Functions | |
| void | _rebuildPanel (int scaledFontSize) const |
Static Private Member Functions | |
| static std::string | _formatDuration (unsigned int seconds) |
Private Attributes | |
| std::string | _winnerTeam |
| Color | _winnerColor = WHITE |
| int | _durationSeconds = -1 |
| int64_t | _durationTicks = -1 |
| bool | _quitRequested = false |
| TooltipWidget | _panel |
| ButtonWidget | _quitBtn |
Semi-transparent overlay shown when a team wins.
Composed of a TooltipWidget (title + team name + duration) and a ButtonWidget (Quit). Both components are owned and driven internally. Call draw() every frame once the game has ended; poll quitRequested() to know when the player clicked Quit.
Usage: winScreen.setWinner(teamName, teamColor); winScreen.setDuration(durationSeconds, durationTicks); if (winScreen.handleInput()) { ... } // optional: blocks sibling input winScreen.draw(fontSize); if (winScreen.quitRequested()) closeWindow();
Definition at line 27 of file WinScreen.hpp.
| WinScreen::WinScreen | ( | ) |
Definition at line 19 of file WinScreen.cpp.
References _panel, _quitBtn, BTN_H, BTN_MARGIN, TooltipWidget::Center, ButtonWidget::None, PANEL_BORDER, PANEL_MIN_W, ButtonWidget::setAnchor(), TooltipWidget::setAnchor(), TooltipWidget::setBackgroundColor(), ButtonWidget::setBorderColor(), TooltipWidget::setBorderColor(), ButtonWidget::setBorderThickness(), TooltipWidget::setBorderThickness(), TooltipWidget::setExtraBottomPadding(), TooltipWidget::setMinWidth(), TooltipWidget::setPadding(), ButtonWidget::setRoundness(), ButtonWidget::setSize(), and TooltipWidget::setTextAlign().
Here is the call graph for this function:
|
overridedefault |
|
staticprivate |
Definition at line 50 of file WinScreen.cpp.
Referenced by _rebuildPanel().
Here is the caller graph for this function:
|
private |
Definition at line 62 of file WinScreen.cpp.
References _durationSeconds, _durationTicks, _formatDuration(), _panel, _winnerColor, _winnerTeam, ACCENT, TooltipWidget::addColoredLine(), TooltipWidget::addLine(), TooltipWidget::clearLines(), I18n::get(), TITLE_COLOR, I18n::WIN_DURATION, I18n::WIN_DURATION_UNKNOWN, I18n::WIN_GAME_OVER, I18n::WIN_TEAM_WON, and I18n::WIN_TICKS.
Referenced by draw().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Draws the widget.
| scaledFontSize | Base font size for UI scaling. |
Implements IWidget.
Definition at line 93 of file WinScreen.cpp.
References _panel, _quitBtn, _rebuildPanel(), BTN_H, BTN_MARGIN, BTN_W, ButtonWidget::draw(), TooltipWidget::draw(), I18n::get(), TooltipWidget::getLastBounds(), OVERLAY_COLOR, ButtonWidget::setLabel(), ButtonWidget::setPosition(), ButtonWidget::setSize(), and I18n::WIN_QUIT.
Referenced by RaylibRenderer::_render2D().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Handles button input. Always returns true (overlay blocks all input).
Implements IWidget.
Definition at line 86 of file WinScreen.cpp.
References _quitBtn, _quitRequested, ButtonWidget::handleInput(), and ButtonWidget::wasClicked().
Referenced by RaylibRenderer::_render2D().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Returns true once the Quit button has been clicked (latched — stays true).
Definition at line 52 of file WinScreen.hpp.
References _quitRequested.
Referenced by RaylibRenderer::shouldClose().
Here is the caller graph for this function:
|
inline |
Definition at line 33 of file WinScreen.hpp.
References _quitRequested.
Referenced by RaylibRenderer::init().
Here is the caller graph for this function:| void WinScreen::setDuration | ( | int | seconds, |
| int64_t | ticks | ||
| ) |
Sets the win duration (server-authoritative, from gwt).
| seconds | Time the winner took to win, in seconds (-1 = not yet received). |
| ticks | Same in game-time ticks. |
Definition at line 44 of file WinScreen.cpp.
References _durationSeconds, and _durationTicks.
Referenced by RaylibRenderer::_render2D().
Here is the caller graph for this function:| void WinScreen::setWinner | ( | const std::string & | team, |
| Color | color | ||
| ) |
Sets the winning team name and highlight color.
Definition at line 38 of file WinScreen.cpp.
References _winnerColor, and _winnerTeam.
Referenced by RaylibRenderer::_render2D().
Here is the caller graph for this function:
|
private |
Definition at line 57 of file WinScreen.hpp.
Referenced by _rebuildPanel(), and setDuration().
|
private |
Definition at line 58 of file WinScreen.hpp.
Referenced by _rebuildPanel(), and setDuration().
|
mutableprivate |
Definition at line 62 of file WinScreen.hpp.
Referenced by _rebuildPanel(), draw(), and WinScreen().
|
mutableprivate |
Definition at line 63 of file WinScreen.hpp.
Referenced by draw(), handleInput(), and WinScreen().
|
private |
Definition at line 60 of file WinScreen.hpp.
Referenced by handleInput(), quitRequested(), and reset().
|
private |
Definition at line 56 of file WinScreen.hpp.
Referenced by _rebuildPanel(), and setWinner().
|
private |
Definition at line 55 of file WinScreen.hpp.
Referenced by _rebuildPanel(), and setWinner().