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

The managed club's tactics: style and instructions, player roles and duties, and the shape with the ball. More...

#include <strategy_scene.h>

Inheritance diagram for StrategyScene:
ManagementScene GUIScene

Public Member Functions

 StrategyScene (GUIView *parent)
 Constructs a new StrategyScene.
 
 ~StrategyScene () override=default
 Destroys the StrategyScene.
 
void update (float deltaTime) override
 Updates scene logic.
 
SceneID getID () const override
 Gets the ID of this 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 Member Functions

void renderInstructions (float width)
 
void renderSummary (float width) const
 
void renderRoles (float width)
 
void renderShapeEditor (const Lineup &lineup, float width)
 
void renderSlotList (const Lineup &lineup)
 
void renderSlotDetails (const Lineup &lineup)
 
void renderShapePresets (const Lineup &lineup, float width)
 
Strategy * clubStrategy () const
 
const Lineup * clubLineup () const
 
SlotInstruction slotAt (const Lineup &lineup, int slot) const
 
void storeSlot (const SlotInstruction &instruction) const
 
void setRole (const Lineup &lineup, TacticalRole role)
 
void setDuty (const Lineup &lineup, RoleDuty duty)
 
void applyShape (const Lineup &lineup, PossessionShape shape)
 
void suggestRoles (const Lineup &lineup)
 
void applySliders () const
 
bool changedSinceEntry () const
 
void revert ()
 
void loadStrategy ()
 

Private Attributes

StrategySliders current_sliders
 
Strategy entry_strategy
 
int selected_preset = -1
 
int selected_slot = 0
 
int dragging_slot = -1
 

Static Private Attributes

static constexpr int KEEPER_SLOT = -1
 

Friends

class GameFlowTest_GUIFlowLifecycle_Test
 

Additional Inherited Members

- Protected Attributes inherited from GUIScene
GUIView * guiView
 

Detailed Description

The managed club's tactics: style and instructions, player roles and duties, and the shape with the ball.

Every change applies to the club's tactic in memory straight away (it is written with the next save), so leaving the screen by any route never loses an edit; Revert restores the tactic as it was on arrival.

Constructor & Destructor Documentation

◆ StrategyScene()

StrategyScene::StrategyScene ( GUIView *  parent)
explicit

Constructs a new StrategyScene.

Parameters
parentPointer to the GUIView.

◆ ~StrategyScene()

StrategyScene::~StrategyScene ( )
overridedefault

Destroys the StrategyScene.

Member Function Documentation

◆ applyShape()

void StrategyScene::applyShape ( const Lineup &  lineup,
PossessionShape  shape 
)
private

◆ applySliders()

void StrategyScene::applySliders ( ) const
private

◆ changedSinceEntry()

bool StrategyScene::changedSinceEntry ( ) const
private

Whether the tactic differs from the one on arrival.

◆ clubLineup()

const Lineup * StrategyScene::clubLineup ( ) const
private

◆ clubStrategy()

Strategy * StrategyScene::clubStrategy ( ) const
private

The club's tactic and lineup (nullptr without a managed club).

◆ getID()

SceneID StrategyScene::getID ( ) const
overridevirtual

Gets the ID of this scene.

Returns
The SceneID (STRATEGY).

Implements GUIScene.

◆ loadStrategy()

void StrategyScene::loadStrategy ( )
private

◆ navSection()

NavSection StrategyScene::navSection ( ) const
inlineoverrideprotectedvirtual

Sidebar entry highlighted for this screen.

Implements ManagementScene.

◆ refresh()

void StrategyScene::refresh ( )
inlineoverrideprotectedvirtual

Rebuilds cached view models from the game state.

Reimplemented from ManagementScene.

◆ renderContent()

void StrategyScene::renderContent ( )
overrideprotectedvirtual

Draws the page body inside the content region.

Implements ManagementScene.

◆ renderInstructions()

void StrategyScene::renderInstructions ( float  width)
private

◆ renderRoles()

void StrategyScene::renderRoles ( float  width)
private

◆ renderShapeEditor()

void StrategyScene::renderShapeEditor ( const Lineup &  lineup,
float  width 
)
private

◆ renderShapePresets()

void StrategyScene::renderShapePresets ( const Lineup &  lineup,
float  width 
)
private

◆ renderSlotDetails()

void StrategyScene::renderSlotDetails ( const Lineup &  lineup)
private

◆ renderSlotList()

void StrategyScene::renderSlotList ( const Lineup &  lineup)
private

◆ renderSummary()

void StrategyScene::renderSummary ( float  width) const
private

◆ revert()

void StrategyScene::revert ( )
private

◆ setDuty()

void StrategyScene::setDuty ( const Lineup &  lineup,
RoleDuty  duty 
)
private

◆ setRole()

void StrategyScene::setRole ( const Lineup &  lineup,
TacticalRole  role 
)
private

◆ slotAt()

SlotInstruction StrategyScene::slotAt ( const Lineup &  lineup,
int  slot 
) const
private

Instruction of an outfield slot (a Standard one when none is stored).

◆ storeSlot()

void StrategyScene::storeSlot ( const SlotInstruction &  instruction) const
private

◆ suggestRoles()

void StrategyScene::suggestRoles ( const Lineup &  lineup)
private

◆ update()

void StrategyScene::update ( float  deltaTime)
overridevirtual

Updates scene logic.

Parameters
deltaTimeTime elapsed since last update.

Implements GUIScene.

Friends And Related Symbol Documentation

◆ GameFlowTest_GUIFlowLifecycle_Test

friend class GameFlowTest_GUIFlowLifecycle_Test
friend

Member Data Documentation

◆ current_sliders

StrategySliders StrategyScene::current_sliders
private

◆ dragging_slot

int StrategyScene::dragging_slot = -1
private

Outfield slot dragged on the shape editor (-1 none).

◆ entry_strategy

Strategy StrategyScene::entry_strategy
private

The tactic as it was when the screen was opened (Revert).

◆ KEEPER_SLOT

constexpr int StrategyScene::KEEPER_SLOT = -1
staticconstexprprivate

Selection on the roles card: the goalkeeper or an outfield slot.

◆ selected_preset

int StrategyScene::selected_preset = -1
private

◆ selected_slot

int StrategyScene::selected_slot = 0
private

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