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

Two or three players side by side: attributes on a radar and as bars, ability and potential, this season's numbers and value, wage and contract. Players of other clubs are shown with the club's scouting estimates and their ranges, never their true attributes. More...

#include <player_compare_scene.h>

Inheritance diagram for PlayerCompareScene:
ManagementScene GUIScene

Classes

struct  Candidate
 A player the picker offers. More...
 
struct  Slot
 Everything shown for one compared player. More...
 

Public Member Functions

 PlayerCompareScene (GUIView *parent, PlayerID first, PlayerID second=0)
 
void update (float deltaTime) override
 Updates scene logic.
 
SceneID getID () const override
 Gets the ID of the scene.
 
std::optional< NavEntry > historyEntry () const override
 
- 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
 
- 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.
 

Static Public Attributes

static constexpr std::size_t MAX_PLAYERS = 3
 

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 Member Functions

void setSlot (std::size_t index, PlayerID id)
 
void buildCandidates ()
 
void rebuildAxes ()
 
void renderSlots ()
 
void renderPicker (std::size_t index, float width)
 
void renderRadar (float width)
 
void renderBars (float width)
 
void renderFacts ()
 
std::size_t filledSlots () const
 
ImVec4 seriesColor (std::size_t index) const
 

Private Attributes

std::array< Slot, MAX_PLAYERS > slots
 
std::array< PlayerID, MAX_PLAYERS > requested {}
 
std::array< PlayerID, 2 > opened_with {}
 
std::vector< std::string > axes
 
std::vector< std::string > axis_labels
 
std::vector< Candidate > candidates
 
std::array< char, 48 > filter {}
 
std::vector< std::size_t > filtered
 
std::string filtered_query
 

Friends

class GameFlowTest_GUIFlowLifecycle_Test
 

Additional Inherited Members

- Protected Attributes inherited from GUIScene
GUIView * guiView
 

Detailed Description

Two or three players side by side: attributes on a radar and as bars, ability and potential, this season's numbers and value, wage and contract. Players of other clubs are shown with the club's scouting estimates and their ranges, never their true attributes.

Constructor & Destructor Documentation

◆ PlayerCompareScene()

PlayerCompareScene::PlayerCompareScene ( GUIView *  parent,
PlayerID  first,
PlayerID  second = 0 
)
Parameters
first,secondPlayers to start with (0 = empty slot).

Member Function Documentation

◆ buildCandidates()

void PlayerCompareScene::buildCandidates ( )
private

◆ filledSlots()

std::size_t PlayerCompareScene::filledSlots ( ) const
private

◆ getID()

SceneID PlayerCompareScene::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.

◆ historyEntry()

std::optional< NavEntry > PlayerCompareScene::historyEntry ( ) const
inlineoverridevirtual

The players it was opened with, whatever was picked since.

Reimplemented from ManagementScene.

◆ navSection()

NavSection PlayerCompareScene::navSection ( ) const
inlineoverrideprotectedvirtual

Sidebar entry highlighted for this screen.

Implements ManagementScene.

◆ rebuildAxes()

void PlayerCompareScene::rebuildAxes ( )
private

◆ refresh()

void PlayerCompareScene::refresh ( )
overrideprotectedvirtual

Rebuilds cached view models from the game state.

Reimplemented from ManagementScene.

◆ renderBars()

void PlayerCompareScene::renderBars ( float  width)
private

◆ renderContent()

void PlayerCompareScene::renderContent ( )
overrideprotectedvirtual

Draws the page body inside the content region.

Implements ManagementScene.

◆ renderFacts()

void PlayerCompareScene::renderFacts ( )
private

◆ renderPicker()

void PlayerCompareScene::renderPicker ( std::size_t  index,
float  width 
)
private

◆ renderRadar()

void PlayerCompareScene::renderRadar ( float  width)
private

◆ renderSlots()

void PlayerCompareScene::renderSlots ( )
private

◆ seriesColor()

ImVec4 PlayerCompareScene::seriesColor ( std::size_t  index) const
private

◆ setSlot()

void PlayerCompareScene::setSlot ( std::size_t  index,
PlayerID  id 
)
private

◆ update()

void PlayerCompareScene::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

◆ axes

std::vector<std::string> PlayerCompareScene::axes
private

Attribute names on the radar (union of the compared players').

◆ axis_labels

std::vector<std::string> PlayerCompareScene::axis_labels
private

Localised, same order.

◆ candidates

std::vector<Candidate> PlayerCompareScene::candidates
private

◆ filter

std::array<char, 48> PlayerCompareScene::filter {}
private

◆ filtered

std::vector<std::size_t> PlayerCompareScene::filtered
private

◆ filtered_query

std::string PlayerCompareScene::filtered_query
private

◆ MAX_PLAYERS

constexpr std::size_t PlayerCompareScene::MAX_PLAYERS = 3
staticconstexpr

◆ opened_with

std::array<PlayerID, 2> PlayerCompareScene::opened_with {}
private

◆ requested

std::array<PlayerID, MAX_PLAYERS> PlayerCompareScene::requested {}
private

◆ slots

std::array<Slot, MAX_PLAYERS> PlayerCompareScene::slots
private

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