Player12
An open source football management simulator
Loading...
Searching...
No Matches
youth_scene.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2// Football Management Project
3// Copyright (c) 2025 - 2026 Flavio Milinanni. All Rights Reserved.
4//
5// This file is part of the Football Management Project.
6// See the LICENSE file in the project root.
7// -----------------------------------------------------------------------------
8
9#pragma once
10
11#include <array>
12#include <cstdint>
13#include <span>
14#include <string>
15#include <vector>
16
19#include "gui/widgets/widgets.h"
20
28{
29 public:
30 explicit YouthScene(GUIView* parent);
31
32 void update(float deltaTime) override;
33 [[nodiscard]] SceneID getID() const override { return SceneID::YOUTH; }
34
35 protected:
36 void renderContent() override;
37 [[nodiscard]] NavSection navSection() const override
38 {
39 return NavSection::YOUTH;
40 }
41 void refresh() override;
42
43 private:
45
46 enum class Tab : uint8_t
47 {
49 SQUAD,
50 INTAKE,
52 };
53
55 enum class ListKind : uint8_t
56 {
57 SQUAD,
59 INTAKE,
61 };
62
64 struct Row
65 {
67 std::string role;
68 std::string ability;
69 std::string potential;
70 std::string contract;
71 std::string rating;
72 std::string nationality;
73 std::string height;
74 std::string wage;
75 std::string offer_label;
76 std::string growth_text;
77 std::string summary;
78 std::string terms;
79 std::string chart_caption;
80 std::string chart_from;
81 std::string chart_to;
82 float growth = 0.0f;
83 };
84
86 {
87 std::string date;
88 std::string opponent;
89 std::string score;
91 };
92
94 {
96 std::string level;
97 std::string cost;
98 std::string time;
99 std::string target;
100 std::string ready;
101 float progress = 0.0f;
102 };
103
106 {
107 enum class Kind : uint8_t
108 {
109 NONE,
110 SIGN,
111 LET_GO,
113 PROMOTE,
114 DEMOTE,
115 LOAN,
116 RELEASE,
117 UPGRADE,
118 TO_U21
119 };
121 PlayerID id = 0;
123 };
124
125 void renderOverview();
126 void renderSquad();
127 void renderIntake();
128 void renderDevelopment();
129 void renderIntakeCard(float width);
130 void renderHeadCard(float width);
131 void renderBoardCard(float width);
132 void renderLeagueCard(float width);
133 void renderTable(const char* id, const std::vector<Row>& rows, ListKind kind);
134 void renderDetail(const Row& row, ListKind kind);
135 void renderChart(const Row& row, float width) const;
136 void renderConfirm();
137 void runPending();
139 void openTab(Tab tab);
140
142 std::vector<Row> squad_rows;
143 std::vector<Row> eligible_rows;
144 std::vector<Row> intake_rows;
145 std::vector<Row> development_rows;
146 std::array<UpgradeLine, 2> upgrades;
147 std::vector<ResultLine> results;
148 std::vector<UI::Outcome> form;
149 std::vector<UI::BarDatum> improvers;
150 std::vector<std::string> improver_values;
151 std::string head_rating;
152 std::string intake_line;
153 std::string deadline_line;
154 std::string preview_line;
155 std::string league_line;
156 std::string league_record;
157 std::string league_goals;
158 std::string intake_tab_label;
159 std::string squad_title;
161
163 bool tab_pending = false;
164 bool first_refresh = true;
167
169 bool confirm_release = false;
171 bool confirm_requested = false;
172 std::string confirm_text;
174};
Main view manager for the GUI. Handles scenes and overlays.
Definition gui_view.h:29
Base class for every in-career screen.
Definition management_scene.h:93
Youth academy: academy ratings, the head of youth development, board requests and the U18 league (Ove...
Definition youth_scene.h:28
std::vector< Row > development_rows
Definition youth_scene.h:145
bool first_refresh
Definition youth_scene.h:164
Tab
Definition youth_scene.h:47
std::vector< ResultLine > results
Definition youth_scene.h:147
SceneID getID() const override
Gets the ID of the scene.
Definition youth_scene.h:33
void runPending()
Definition youth_scene.cpp:1024
ListKind
Which list a table shows (decides columns and actions).
Definition youth_scene.h:56
void update(float deltaTime) override
Updates scene logic.
Definition youth_scene.cpp:166
void renderIntakeCard(float width)
Definition youth_scene.cpp:462
std::string deadline_line
Definition youth_scene.h:153
std::string league_line
Definition youth_scene.h:155
void renderSquad()
Definition youth_scene.cpp:596
void renderConfirm()
Definition youth_scene.cpp:1000
std::vector< Row > eligible_rows
Definition youth_scene.h:143
void renderContent() override
Draws the page body inside the content region.
Definition youth_scene.cpp:381
void openTab(Tab tab)
Definition youth_scene.cpp:374
std::string squad_title
Definition youth_scene.h:159
void renderHeadCard(float width)
Definition youth_scene.cpp:489
std::array< UpgradeLine, 2 > upgrades
Definition youth_scene.h:146
std::vector< Row > squad_rows
Definition youth_scene.h:142
std::vector< UI::BarDatum > improvers
Definition youth_scene.h:149
PlayerID chart_player
Definition youth_scene.h:166
std::string preview_line
Definition youth_scene.h:154
PlayerID confirm_player
Definition youth_scene.h:168
std::string intake_line
Definition youth_scene.h:152
std::string head_rating
Definition youth_scene.h:151
GameDateValue cached_date
Definition youth_scene.h:160
std::vector< Row > intake_rows
Definition youth_scene.h:144
bool confirm_requested
Definition youth_scene.h:171
bool tab_pending
Definition youth_scene.h:163
bool confirm_release
Definition youth_scene.h:169
void renderDevelopment()
Definition youth_scene.cpp:868
Row makeRow(const GameController::YouthPlayerView &view) const
Definition youth_scene.cpp:172
Tab requested_tab
Definition youth_scene.h:162
std::string league_goals
Definition youth_scene.h:157
std::string confirm_text
Definition youth_scene.h:172
void renderTable(const char *id, const std::vector< Row > &rows, ListKind kind)
Definition youth_scene.cpp:638
std::string intake_tab_label
Definition youth_scene.h:158
void renderOverview()
Definition youth_scene.cpp:415
std::vector< std::string > improver_values
Definition youth_scene.h:150
void renderLeagueCard(float width)
Definition youth_scene.cpp:566
void renderBoardCard(float width)
Definition youth_scene.cpp:517
void renderDetail(const Row &row, ListKind kind)
Definition youth_scene.cpp:772
GameController::AcademyOverview overview
Definition youth_scene.h:141
void refresh() override
Rebuilds cached view models from the game state.
Definition youth_scene.cpp:215
std::vector< UI::Outcome > form
Definition youth_scene.h:148
std::string league_record
Definition youth_scene.h:156
void renderChart(const Row &row, float width) const
Definition youth_scene.cpp:915
friend class GameFlowTest_GUIFlowLifecycle_Test
Definition youth_scene.h:44
void renderIntake()
Definition youth_scene.cpp:615
NavSection navSection() const override
Sidebar entry highlighted for this screen.
Definition youth_scene.h:37
PendingAction pending
Definition youth_scene.h:173
PlayerID selected
Definition youth_scene.h:165
SceneID
Identifiers for different GUI scenes.
Definition gui_scene.h:24
Outcome
Match outcome for form strips.
Definition widgets.h:87
NavSection
Screens of the management shell. The sidebar groups them into a few hubs (Home, Inbox,...
Definition nav_history.h:26
Definition game_controller.h:1068
Definition game_controller.h:1036
Represents a specific date in the game world.
Definition gamedate.h:20
Price and schedule of the next step of an academy investment.
Definition youth_academy.h:255
A button press, executed once the page is drawn.
Definition youth_scene.h:106
AcademyUpgrade upgrade
Definition youth_scene.h:122
Kind kind
Definition youth_scene.h:120
Kind
Definition youth_scene.h:108
Definition youth_scene.h:86
std::string date
Definition youth_scene.h:87
std::string opponent
Definition youth_scene.h:88
UI::Outcome outcome
Definition youth_scene.h:90
std::string score
Definition youth_scene.h:89
One player line, pre-formatted at refresh time.
Definition youth_scene.h:65
std::string role
Definition youth_scene.h:67
std::string potential
Definition youth_scene.h:69
std::string chart_from
Definition youth_scene.h:80
std::string terms
Definition youth_scene.h:78
std::string summary
Definition youth_scene.h:77
std::string ability
Definition youth_scene.h:68
std::string nationality
Definition youth_scene.h:72
std::string height
Definition youth_scene.h:73
std::string wage
Definition youth_scene.h:74
std::string chart_to
Definition youth_scene.h:81
float growth
Definition youth_scene.h:82
std::string offer_label
Definition youth_scene.h:75
std::string contract
Definition youth_scene.h:70
GameController::YouthPlayerView view
Definition youth_scene.h:66
std::string growth_text
Definition youth_scene.h:76
std::string chart_caption
Definition youth_scene.h:79
std::string rating
Definition youth_scene.h:71
Definition youth_scene.h:94
std::string cost
Definition youth_scene.h:97
std::string level
Definition youth_scene.h:96
UpgradeQuote quote
Definition youth_scene.h:95
std::string ready
Definition youth_scene.h:100
float progress
Definition youth_scene.h:101
std::string time
Definition youth_scene.h:98
std::string target
Definition youth_scene.h:99
uint32_t PlayerID
Type alias for Player identifiers.
Definition types.h:21
AcademyUpgrade
Academy investments the board can approve (values are persisted).
Definition youth_academy.h:63