Zappy GUI
C++ graphic client: renderer, camera, network
Loading...
Searching...
No Matches
WinScreen.hpp
Go to the documentation of this file.
1
3
4#pragma once
5
6#include <cstdint>
7#include <string>
8
9#include "ButtonWidget.hpp"
10#include "IWidget.hpp"
11#include "TooltipWidget.hpp"
12#include "raylib.h"
13
27class WinScreen : public IWidget {
28 public:
29 WinScreen();
30 ~WinScreen() override = default;
31
32 // ── Lifecycle ──────────────────────────────────────────────────────────
33 void reset() { _quitRequested = false; }
34
35 // ── Data setters ───────────────────────────────────────────────────────
37 void setWinner(const std::string& team, Color color);
38
42 void setDuration(int seconds, int64_t ticks);
43
44 // ── IWidget ────────────────────────────────────────────────────────────
45 void draw(int scaledFontSize) const override;
46
48 bool handleInput() override;
49
50 // ── State polling ──────────────────────────────────────────────────────
52 bool quitRequested() const { return _quitRequested; }
53
54 private:
55 std::string _winnerTeam;
56 Color _winnerColor = WHITE;
58 int64_t _durationTicks = -1;
59
60 bool _quitRequested = false;
61
64
65 static std::string _formatDuration(unsigned int seconds);
66 void _rebuildPanel(int scaledFontSize) const;
67};
Reusable clickable button component.
Interface for GUI widgets.
Stateful tooltip panel component implementing IWidget.
A configurable, stateful clickable button.
Interface for GUI widgets.
Definition IWidget.hpp:11
A configurable, stateful tooltip panel.
Semi-transparent overlay shown when a team wins.
Definition WinScreen.hpp:27
~WinScreen() override=default
TooltipWidget _panel
Definition WinScreen.hpp:62
int _durationSeconds
Definition WinScreen.hpp:57
ButtonWidget _quitBtn
Definition WinScreen.hpp:63
bool quitRequested() const
Returns true once the Quit button has been clicked (latched — stays true).
Definition WinScreen.hpp:52
void setDuration(int seconds, int64_t ticks)
Sets the win duration (server-authoritative, from gwt).
Definition WinScreen.cpp:44
void reset()
Definition WinScreen.hpp:33
Color _winnerColor
Definition WinScreen.hpp:56
int64_t _durationTicks
Definition WinScreen.hpp:58
void _rebuildPanel(int scaledFontSize) const
Definition WinScreen.cpp:62
std::string _winnerTeam
Definition WinScreen.hpp:55
void draw(int scaledFontSize) const override
Draws the widget.
Definition WinScreen.cpp:93
bool _quitRequested
Definition WinScreen.hpp:60
void setWinner(const std::string &team, Color color)
Sets the winning team name and highlight color.
Definition WinScreen.cpp:38
static std::string _formatDuration(unsigned int seconds)
Definition WinScreen.cpp:50
bool handleInput() override
Handles button input. Always returns true (overlay blocks all input).
Definition WinScreen.cpp:86