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

Scene for managing application settings. More...

#include <settings_scene.h>

Inheritance diagram for SettingsScene:
GUIScene

Classes

struct  Capture
 
struct  Conflict
 

Public Member Functions

 SettingsScene (GUIView *guiView_ptr)
 Constructs a new SettingsScene.
 
 SettingsScene (GUIView *guiView_ptr, bool inCareer)
 Constructs a SettingsScene opened from inside a career.
 
 ~SettingsScene ()=default
 Destroys the SettingsScene.
 
void update (float deltaTime) override
 Updates scene logic.
 
void render () override
 Renders the scene.
 
void onEnter () override
 Called when entering the scene.
 
SceneID getID () const override
 Gets the ID of this scene.
 
- Public Member Functions inherited from GUIScene
 GUIScene (GUIView *guiView_ptr)
 Constructs a new GUIScene.
 
virtual ~GUIScene ()=default
 Destroys the GUIScene.
 
virtual void handleEvent (const SDL_Event &event)
 Handles SDL events for the scene.
 
virtual void onExit ()
 Called when the scene is exited/becomes inactive.
 
virtual void onResume ()
 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.
 
virtual void onResize (int width, int height)
 Called when the window is resized.
 
virtual std::optional< NavEntry > historyEntry () const
 How to open this screen again from the navigation history, or nothing for scenes outside it (menus, team selection, the live match).
 

Private Member Functions

void applyAndSaveSettings ()
 
void cancel ()
 
void leave ()
 
void resetToDefaults ()
 
void syncPendingFromSettings ()
 
void renderGeneral ()
 
void renderAppearance ()
 
void renderGuidance ()
 
void renderAudio ()
 
void renderControls ()
 
void renderControlRow (Input::ActionId id, const Input::Action &action, float labelWidth)
 
void renderData ()
 
void renderSaving ()
 
void previewAppearance ()
 
void updateCapture ()
 

Private Attributes

std::vector< std::string > languageOptions
 
std::vector< Language > availableLanguageEnums
 
std::vector< GUIConstants::Resolution > resolutions
 
std::vector< std::string > resolutionOptions
 
std::vector< std::string > fpsOptionsStrings
 
int selectedLanguage = 0
 
int selectedFPS = 0
 
int selectedResolution = 0
 
bool fullscreen = false
 
bool vsync = false
 
bool showWipeDataOverlay = false
 
float wipeDataTimer = 0.0f
 
bool in_career = false
 
Settings original_settings
 
float pending_ui_scale = 1.0f
 
float pending_text_scale = 1.0f
 
std::optional< Capture > capture
 
std::optional< Conflict > conflict
 
int capture_end_frame = -1
 
std::vector< std::array< std::string, Input::BINDING_SLOTS > > chord_labels
 
std::uint32_t labels_revision = 0
 

Friends

class GameFlowTest_GUIFlowLifecycle_Test
 

Additional Inherited Members

- 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.
 
- Protected Attributes inherited from GUIScene
GUIView * guiView
 

Detailed Description

Scene for managing application settings.

Appearance, audio, match, guidance and control changes apply at once (a live preview; Cancel restores them). Language and the display settings (resolution, frame cap, fullscreen, VSync) apply when the player presses Apply. Every row explains itself in a tooltip.

Constructor & Destructor Documentation

◆ SettingsScene() [1/2]

SettingsScene::SettingsScene ( GUIView *  guiView_ptr)
explicit

Constructs a new SettingsScene.

Parameters
guiView_ptrPointer to the GUIView.

◆ SettingsScene() [2/2]

SettingsScene::SettingsScene ( GUIView *  guiView_ptr,
bool  inCareer 
)

Constructs a SettingsScene opened from inside a career.

Parameters
guiView_ptrPointer to the GUIView.
inCareerWhen true, leaving the scene returns to the career instead of the main menu, and save wiping is not offered.

◆ ~SettingsScene()

SettingsScene::~SettingsScene ( )
default

Destroys the SettingsScene.

Member Function Documentation

◆ applyAndSaveSettings()

void SettingsScene::applyAndSaveSettings ( )
private

◆ cancel()

void SettingsScene::cancel ( )
private

◆ getID()

SceneID SettingsScene::getID ( ) const
overridevirtual

Gets the ID of this scene.

Returns
The SceneID (SETTINGS).

Implements GUIScene.

◆ leave()

void SettingsScene::leave ( )
private

◆ onEnter()

void SettingsScene::onEnter ( )
overridevirtual

Called when entering the scene.

Reimplemented from GUIScene.

◆ previewAppearance()

void SettingsScene::previewAppearance ( )
private

◆ render()

void SettingsScene::render ( )
overridevirtual

Renders the scene.

Implements GUIScene.

◆ renderAppearance()

void SettingsScene::renderAppearance ( )
private

◆ renderAudio()

void SettingsScene::renderAudio ( )
private

◆ renderControlRow()

void SettingsScene::renderControlRow ( Input::ActionId  id,
const Input::Action &  action,
float  labelWidth 
)
private

◆ renderControls()

void SettingsScene::renderControls ( )
private

◆ renderData()

void SettingsScene::renderData ( )
private

◆ renderGeneral()

void SettingsScene::renderGeneral ( )
private

◆ renderGuidance()

void SettingsScene::renderGuidance ( )
private

◆ renderSaving()

void SettingsScene::renderSaving ( )
private

◆ resetToDefaults()

void SettingsScene::resetToDefaults ( )
private

Restores every setting but the language (and seen tips).

◆ syncPendingFromSettings()

void SettingsScene::syncPendingFromSettings ( )
private

Points the Apply-time widgets at the current settings.

◆ update()

void SettingsScene::update ( float  deltaTime)
overridevirtual

Updates scene logic.

Parameters
deltaTimeTime elapsed since last update.

Implements GUIScene.

◆ updateCapture()

void SettingsScene::updateCapture ( )
private

Handles a key pressed while a binding waits for one.

Friends And Related Symbol Documentation

◆ GameFlowTest_GUIFlowLifecycle_Test

friend class GameFlowTest_GUIFlowLifecycle_Test
friend

Member Data Documentation

◆ availableLanguageEnums

std::vector<Language> SettingsScene::availableLanguageEnums
private

◆ capture

std::optional<Capture> SettingsScene::capture
private

◆ capture_end_frame

int SettingsScene::capture_end_frame = -1
private

Frame a capture ended on: Space/Enter must not also press a button.

◆ chord_labels

std::vector<std::array<std::string, Input::BINDING_SLOTS> > SettingsScene::chord_labels
private

Chord labels per action and slot, rebuilt when a binding changes.

◆ conflict

std::optional<Conflict> SettingsScene::conflict
private

◆ fpsOptionsStrings

std::vector<std::string> SettingsScene::fpsOptionsStrings
private

◆ fullscreen

bool SettingsScene::fullscreen = false
private

◆ in_career

bool SettingsScene::in_career = false
private

◆ labels_revision

std::uint32_t SettingsScene::labels_revision = 0
private

◆ languageOptions

std::vector<std::string> SettingsScene::languageOptions
private

◆ original_settings

Settings SettingsScene::original_settings
private

◆ pending_text_scale

float SettingsScene::pending_text_scale = 1.0f
private

◆ pending_ui_scale

float SettingsScene::pending_ui_scale = 1.0f
private

◆ resolutionOptions

std::vector<std::string> SettingsScene::resolutionOptions
private

◆ resolutions

std::vector<GUIConstants::Resolution> SettingsScene::resolutions
private

◆ selectedFPS

int SettingsScene::selectedFPS = 0
private

◆ selectedLanguage

int SettingsScene::selectedLanguage = 0
private

◆ selectedResolution

int SettingsScene::selectedResolution = 0
private

◆ showWipeDataOverlay

bool SettingsScene::showWipeDataOverlay = false
private

◆ vsync

bool SettingsScene::vsync = false
private

◆ wipeDataTimer

float SettingsScene::wipeDataTimer = 0.0f
private

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