Player12
An open source football management simulator
Loading...
Searching...
No Matches
LineupScene Class Reference

GUI scene for managing the team's lineup. More...

#include <lineup_scene.h>

Inheritance diagram for LineupScene:
ManagementScene GUIScene

Public Member Functions

 LineupScene (class GUIView *parent)
 Constructor.
 
 LineupScene (class GUIView *parent, PlayerID focusPlayer)
 Opens the lineup with one player pre-selected.
 
void update (float deltaTime) override
 Updates scene logic.
 
SceneID getID () const override
 Gets the ID of the scene.
 
- Public Member Functions inherited from ManagementScene
 ManagementScene (GUIView *guiViewPtr)
 
void render () final
 Renders the scene.
 
void onEnter () override
 Called when the scene is entered/becomes active.
 
void onResume () override
 Called when an overlay above this scene closes and it becomes the active scene again. Screens use it to refresh cached view models after a match, a transfer or any other state change made elsewhere.
 
void handleEvent (const SDL_Event &event) override
 
std::optional< NavEntry > historyEntry () const override
 
- Public Member Functions inherited from GUIScene
 GUIScene (GUIView *guiView_ptr)
 Constructs a new GUIScene.
 
virtual ~GUIScene ()=default
 Destroys the GUIScene.
 
virtual void onExit ()
 Called when the scene is exited/becomes inactive.
 
virtual void onResize (int width, int height)
 Called when the window is resized.
 

Protected Member Functions

void renderContent () override
 Draws the page body inside the content region.
 
NavSection navSection () const override
 Sidebar entry highlighted for this screen.
 
void refresh () override
 Rebuilds cached view models from the game state.
 
- Protected Member Functions inherited from ManagementScene
virtual std::optional< EditorContext > editorContext () const
 
void showToast (std::string message, bool isError=false)
 Shows a short confirmation message in the top bar.
 
HolidayDialog & holidayDialog ()
 Holiday planner and return report of this screen.
 
- Protected Member Functions inherited from GUIScene
SDL_Renderer * getRenderer () const
 Gets the SDL renderer.
 
SDL_Window * getWindow () const
 Gets the SDL window.
 
GUIView * getGuiView () const
 Gets the associated GUIView.
 
void changeScene (std::unique_ptr< GUIScene > newScene)
 Requests a scene change.
 
void quit ()
 Requests the application to quit.
 

Private Types

enum class  Unavailability : uint8_t { INJURED , SUSPENDED }
 Why a player cannot be picked right now. More...
 

Private Member Functions

void loadLineup ()
 
void renderToolbar ()
 
void renderPitch (float width, float height)
 
void renderPlayerToken (const Player &player, ImVec2 center, bool goalkeeper, ImVec2 pitchMin, ImVec2 pitchSize)
 
void renderBench (float height)
 
void autoPickBestEleven ()
 
const Player * selectedPitchPlayer () const
 
const Player * selectedBenchPlayer () const
 
void renderOutsiders (float height)
 
const Player * selectedOutsider () const
 
size_t unavailableStarters () const
 
void renderLeadership ()
 

Private Attributes

PlayerID focus_player_id = 0
 
int formation_index = -1
 
std::unordered_map< PlayerID, Unavailability > unavailable
 
Lineup * current_lineup = nullptr
 
PlayerID selected_pitch_player_id = 0
 
PlayerID selected_bench_player_id = 0
 
PlayerID selected_outsider_id = 0
 
std::vector< const Player * > outsiders
 
SetPiecesDialog set_pieces
 
std::string captain_summary
 

Friends

class GameFlowTest_GUIFlowLifecycle_Test
 

Additional Inherited Members

- Protected Attributes inherited from GUIScene
GUIView * guiView
 

Detailed Description

GUI scene for managing the team's lineup.

This scene allows the user to view and modify their lineup using a 2D pitch representation, formation presets and an automatic best-XI pick.

Member Enumeration Documentation

◆ Unavailability

enum class LineupScene::Unavailability : uint8_t
strongprivate

Why a player cannot be picked right now.

Enumerator
INJURED 
SUSPENDED 

Constructor & Destructor Documentation

◆ LineupScene() [1/2]

LineupScene::LineupScene ( class GUIView *  parent)
explicit

Constructor.

Parameters
parentPointer to the GUIView managing this scene

◆ LineupScene() [2/2]

LineupScene::LineupScene ( class GUIView *  parent,
PlayerID  focusPlayer 
)

Opens the lineup with one player pre-selected.

Parameters
parentPointer to the GUIView managing this scene
focusPlayerPlayer to highlight on the pitch or bench

Member Function Documentation

◆ autoPickBestEleven()

void LineupScene::autoPickBestEleven ( )
private

◆ getID()

SceneID LineupScene::getID ( ) const
inlineoverridevirtual

Gets the ID of the scene.

Returns
The SceneID of this scene.

GUIView uses this identifier to apply match-specific event and scene behavior.

Implements GUIScene.

◆ loadLineup()

void LineupScene::loadLineup ( )
private

◆ navSection()

NavSection LineupScene::navSection ( ) const
inlineoverrideprotectedvirtual

Sidebar entry highlighted for this screen.

Implements ManagementScene.

◆ refresh()

void LineupScene::refresh ( )
inlineoverrideprotectedvirtual

Rebuilds cached view models from the game state.

Reimplemented from ManagementScene.

◆ renderBench()

void LineupScene::renderBench ( float  height)
private

◆ renderContent()

void LineupScene::renderContent ( )
overrideprotectedvirtual

Draws the page body inside the content region.

Implements ManagementScene.

◆ renderLeadership()

void LineupScene::renderLeadership ( )
private

◆ renderOutsiders()

void LineupScene::renderOutsiders ( float  height)
private

Squad players outside the matchday squad, with one selectable.

◆ renderPitch()

void LineupScene::renderPitch ( float  width,
float  height 
)
private

◆ renderPlayerToken()

void LineupScene::renderPlayerToken ( const Player &  player,
ImVec2  center,
bool  goalkeeper,
ImVec2  pitchMin,
ImVec2  pitchSize 
)
private

◆ renderToolbar()

void LineupScene::renderToolbar ( )
private

◆ selectedBenchPlayer()

const Player * LineupScene::selectedBenchPlayer ( ) const
private

◆ selectedOutsider()

const Player * LineupScene::selectedOutsider ( ) const
private

◆ selectedPitchPlayer()

const Player * LineupScene::selectedPitchPlayer ( ) const
private

◆ unavailableStarters()

size_t LineupScene::unavailableStarters ( ) const
private

◆ update()

void LineupScene::update ( float  deltaTime)
overridevirtual

Updates scene logic.

Parameters
deltaTimeThe time elapsed since the last update.

Implements GUIScene.

Friends And Related Symbol Documentation

◆ GameFlowTest_GUIFlowLifecycle_Test

friend class GameFlowTest_GUIFlowLifecycle_Test
friend

Member Data Documentation

◆ captain_summary

std::string LineupScene::captain_summary
private

◆ current_lineup

Lineup* LineupScene::current_lineup = nullptr
private

◆ focus_player_id

PlayerID LineupScene::focus_player_id = 0
private

◆ formation_index

int LineupScene::formation_index = -1
private

◆ outsiders

std::vector<const Player*> LineupScene::outsiders
private

Rebuilt each frame from the club's squad (capacity kept).

◆ selected_bench_player_id

PlayerID LineupScene::selected_bench_player_id = 0
private

◆ selected_outsider_id

PlayerID LineupScene::selected_outsider_id = 0
private

◆ selected_pitch_player_id

PlayerID LineupScene::selected_pitch_player_id = 0
private

◆ set_pieces

SetPiecesDialog LineupScene::set_pieces
private

◆ unavailable

std::unordered_map<PlayerID, Unavailability> LineupScene::unavailable
private

The documentation for this class was generated from the following files: