Player12
An open source football management simulator
Loading...
Searching...
No Matches
lineup_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 <imgui.h>
12
13#include <string>
14#include <unordered_map>
15
18#include "model/lineup.h"
19
28{
29 public:
34 explicit LineupScene(class GUIView* parent);
35
41 LineupScene(class GUIView* parent, PlayerID focusPlayer);
42
43 void update(float deltaTime) override;
44
45 [[nodiscard]] SceneID getID() const override { return SceneID::LINEUP; }
46
47 protected:
48 void renderContent() override;
49 [[nodiscard]] NavSection navSection() const override
50 {
51 return NavSection::LINEUP;
52 }
53 void refresh() override { loadLineup(); }
54
55 private:
57 void loadLineup();
58 void renderToolbar();
59 void renderPitch(float width, float height);
60 void renderPlayerToken(const Player& player, ImVec2 center, bool goalkeeper,
61 ImVec2 pitchMin, ImVec2 pitchSize);
62 void renderBench(float height);
63 void autoPickBestEleven();
64 [[nodiscard]] const Player* selectedPitchPlayer() const;
65 [[nodiscard]] const Player* selectedBenchPlayer() const;
67 void renderOutsiders(float height);
68 [[nodiscard]] const Player* selectedOutsider() const;
69
71 enum class Unavailability : uint8_t
72 {
73 INJURED,
75 };
76
77 [[nodiscard]] size_t unavailableStarters() const;
78
81 std::unordered_map<PlayerID, Unavailability> unavailable;
82
88 std::vector<const Player*> outsiders;
89
90 // Captain and set-piece takers.
91 void renderLeadership();
93 std::string captain_summary;
94};
Main view manager for the GUI. Handles scenes and overlays.
Definition gui_view.h:29
GUI scene for managing the team's lineup.
Definition lineup_scene.h:28
PlayerID selected_pitch_player_id
Definition lineup_scene.h:84
SceneID getID() const override
Gets the ID of the scene.
Definition lineup_scene.h:45
void renderPitch(float width, float height)
Definition lineup_scene.cpp:414
void renderBench(float height)
Definition lineup_scene.cpp:439
void renderPlayerToken(const Player &player, ImVec2 center, bool goalkeeper, ImVec2 pitchMin, ImVec2 pitchSize)
Definition lineup_scene.cpp:292
void loadLineup()
Definition lineup_scene.cpp:113
const Player * selectedBenchPlayer() const
Definition lineup_scene.cpp:643
std::string captain_summary
Definition lineup_scene.h:93
void renderContent() override
Draws the page body inside the content region.
Definition lineup_scene.cpp:145
void update(float deltaTime) override
Updates scene logic.
Definition lineup_scene.cpp:111
void renderLeadership()
Definition lineup_scene.cpp:281
void renderOutsiders(float height)
Definition lineup_scene.cpp:572
Unavailability
Why a player cannot be picked right now.
Definition lineup_scene.h:72
PlayerID selected_bench_player_id
Definition lineup_scene.h:85
void renderToolbar()
Definition lineup_scene.cpp:181
NavSection navSection() const override
Sidebar entry highlighted for this screen.
Definition lineup_scene.h:49
std::unordered_map< PlayerID, Unavailability > unavailable
Definition lineup_scene.h:81
PlayerID selected_outsider_id
Definition lineup_scene.h:86
Lineup * current_lineup
Definition lineup_scene.h:83
PlayerID focus_player_id
Definition lineup_scene.h:79
SetPiecesDialog set_pieces
Definition lineup_scene.h:92
void autoPickBestEleven()
Definition lineup_scene.cpp:259
std::vector< const Player * > outsiders
Definition lineup_scene.h:88
int formation_index
Definition lineup_scene.h:80
friend class GameFlowTest_GUIFlowLifecycle_Test
Definition lineup_scene.h:56
const Player * selectedOutsider() const
Definition lineup_scene.cpp:634
void refresh() override
Rebuilds cached view models from the game state.
Definition lineup_scene.h:53
const Player * selectedPitchPlayer() const
Definition lineup_scene.cpp:555
size_t unavailableStarters() const
Definition lineup_scene.cpp:247
Manages the starting XI and reserves of a team.
Definition lineup.h:85
Base class for every in-career screen.
Definition management_scene.h:93
Persistent career identity, attributes, traits and day-to-day state.
Definition player.h:104
Captain, vice-captain and set-piece takers of the managed lineup: one dropdown per duty listing the s...
Definition set_pieces_dialog.h:25
SceneID
Identifiers for different GUI scenes.
Definition gui_scene.h:24
NavSection
Screens of the management shell. The sidebar groups them into a few hubs (Home, Inbox,...
Definition nav_history.h:26
uint32_t PlayerID
Type alias for Player identifiers.
Definition types.h:21