Player12
An open source football management simulator
Loading...
Searching...
No Matches
team_selection_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#include <imgui.h>
11
12#include <cstdint>
13#include <optional>
14#include <set>
15#include <string>
16#include <vector>
17
18#include "gui/gui_scene.h"
20#include "model/league.h"
21#include "model/team.h"
22
27{
28 public:
33 explicit TeamSelectionScene(GUIView* parent);
34
38 ~TeamSelectionScene() override = default;
39
43 void onEnter() override;
44
49 void update(float deltaTime) override;
50
54 void render() override;
55
60 [[nodiscard]] SceneID getID() const override;
61
62 private:
66 {
67 TeamID id = 0;
68 std::string name;
69 uint8_t reputation = 0;
70 uint32_t stadium = 0;
71 size_t squad_size = 0;
72 float average_overall = 0.0f;
73 float best_overall = 0.0f;
74 int64_t balance = 0;
75 int64_t weekly_wages = 0;
77 const char* objective_key = "";
78 int difficulty = 0;
79 std::string code;
80 uint32_t primary = 0;
81 uint32_t secondary = 0;
82 std::string nickname;
83 std::string founded;
84 std::string balance_text;
85 std::string wages_text;
86 std::string stadium_text;
87 std::vector<std::pair<std::string, float>> key_players;
88 };
89
92 {
93 LeagueID id = 0;
95 std::string name;
96 uint8_t tier = 1;
97 size_t lower_divisions = 0;
98 };
99
101 void loadAvailableTeams();
102 void sortClubs();
104 void renderStackedBrowser(float width);
106 void renderLeagueList(float width, float height);
108 void renderClubTable(float height);
110 void renderSelectedClub(float width, float height);
114 static void renderClubIdentity(const ClubSummary& club, float badgeHeight,
115 float width);
116 [[nodiscard]] const ClubSummary* selectedClub() const;
117 void selectLeague(const LeagueEntry& entry);
118 void startCareer(TeamID teamId);
120 void startUnemployed();
122 void backToMenu();
123
124 std::vector<LeagueEntry> league_entries;
125 std::vector<std::reference_wrapper<const Team>> available_teams;
126 std::optional<uint8_t> selected_league_id;
127 std::optional<TeamID> selected_team_id;
129 std::set<LeagueID> expanded_countries;
130 bool laid_out = false;
131 std::vector<ClubSummary> club_summaries;
132 ImGuiID sort_column = 0;
133 bool sort_ascending = false;
135};
Base class for all GUI scenes.
Definition gui_scene.h:68
Main view manager for the GUI. Handles scenes and overlays.
Definition gui_view.h:29
The "your manager" card of the new-game club choice: name, nationality, experience (starting reputati...
Definition manager_scene.h:30
Scene for selecting a team.
Definition team_selection_scene.h:27
void selectLeague(const LeagueEntry &entry)
Definition team_selection_scene.cpp:249
void render() override
Renders the scene.
Definition team_selection_scene.cpp:138
SceneID getID() const override
Gets the ID of this scene.
Definition team_selection_scene.cpp:780
void renderLeagueList(float width, float height)
Height 0 = natural height (no inner scrolling).
Definition team_selection_scene.cpp:258
void startUnemployed()
Starts the career without a club (the Job Centre opens).
Definition team_selection_scene.cpp:588
bool sort_ascending
Definition team_selection_scene.h:133
void renderStackedBrowser(float width)
Short windows: natural-height cards, only the page scrolls.
Definition team_selection_scene.cpp:220
void backToMenu()
Leaves for the main menu (Back button, Escape).
Definition team_selection_scene.cpp:581
ImGuiID sort_column
Definition team_selection_scene.h:132
void sortClubs()
Definition team_selection_scene.cpp:742
void renderSelectedClubStrip()
One-row club card above the table for narrow windows.
Definition team_selection_scene.cpp:541
~TeamSelectionScene() override=default
Destroys the TeamSelectionScene.
std::vector< std::reference_wrapper< const Team > > available_teams
Definition team_selection_scene.h:125
std::set< LeagueID > expanded_countries
Definition team_selection_scene.h:129
void renderSelectedClub(float width, float height)
Club card beside the table; the start button sits at its top.
Definition team_selection_scene.cpp:483
std::optional< uint8_t > selected_league_id
Definition team_selection_scene.h:126
static void renderClubIdentity(const ClubSummary &club, float badgeHeight, float width)
Badge, name, nickname and reputation of a club in width.
Definition team_selection_scene.cpp:463
void loadAvailableLeagues()
Definition team_selection_scene.cpp:594
void onEnter() override
Called when entering the scene.
Definition team_selection_scene.cpp:130
void renderClubTable(float height)
Height 0 = every row at natural height (no inner scrolling).
Definition team_selection_scene.cpp:326
void startCareer(TeamID teamId)
Definition team_selection_scene.cpp:571
const ClubSummary * selectedClub() const
Definition team_selection_scene.cpp:455
std::vector< LeagueEntry > league_entries
Definition team_selection_scene.h:124
std::optional< TeamID > selected_team_id
Definition team_selection_scene.h:127
void update(float deltaTime) override
Updates scene logic.
Definition team_selection_scene.cpp:136
std::vector< ClubSummary > club_summaries
Definition team_selection_scene.h:131
ManagerSetupPanel manager_panel
Definition team_selection_scene.h:134
friend class GameFlowTest_GUIFlowLifecycle_Test
Definition team_selection_scene.h:63
void loadAvailableTeams()
Definition team_selection_scene.cpp:618
bool laid_out
Definition team_selection_scene.h:130
SceneID
Identifiers for different GUI scenes.
Definition gui_scene.h:24
Cached, display-ready summary of one selectable club.
Definition team_selection_scene.h:66
std::string balance_text
Definition team_selection_scene.h:84
float average_overall
Definition team_selection_scene.h:72
uint32_t secondary
Definition team_selection_scene.h:81
uint32_t stadium
Definition team_selection_scene.h:70
std::string founded
Definition team_selection_scene.h:83
std::string wages_text
Definition team_selection_scene.h:85
size_t squad_size
Definition team_selection_scene.h:71
uint8_t reputation
Definition team_selection_scene.h:69
int difficulty
Definition team_selection_scene.h:78
int64_t weekly_wages
Definition team_selection_scene.h:75
int64_t balance
Definition team_selection_scene.h:74
float best_overall
Definition team_selection_scene.h:73
const char * objective_key
Definition team_selection_scene.h:77
std::string nickname
Definition team_selection_scene.h:82
std::string code
Definition team_selection_scene.h:79
std::string stadium_text
Definition team_selection_scene.h:86
uint32_t primary
Definition team_selection_scene.h:80
std::vector< std::pair< std::string, float > > key_players
Definition team_selection_scene.h:87
int expected_position
Definition team_selection_scene.h:76
std::string name
Definition team_selection_scene.h:68
One entry of the league list, grouped by country.
Definition team_selection_scene.h:92
size_t lower_divisions
Definition team_selection_scene.h:97
std::string name
Definition team_selection_scene.h:95
uint8_t tier
Definition team_selection_scene.h:96
LeagueID root
Definition team_selection_scene.h:94
uint8_t LeagueID
Type alias for League identifiers.
Definition types.h:15
uint16_t TeamID
Type alias for Team identifiers.
Definition types.h:18