coastline 0.0.4
Loading...
Searching...
No Matches
coastline::GameSettings Class Reference

Persistent game choices for the options menu. More...

#include <gamesettings.h>

Public Member Functions

 GameSettings (GameConfig &config, std::span< const std::filesystem::path > dataRoots={}, std::span< const std::array< int, 2 > > displayResolutions={})
 Build available options from the configuration, installed packs, and display modes.
std::size_t Count () const
void SetOverrides (GameConfig overrides)
 Replace temporary values supplied by command-line arguments without saving them.
bool IsEnabled (std::size_t index) const
std::string Label (std::size_t index) const
bool RequiresRestart (std::size_t index) const
bool Step (std::size_t index, int direction)
 Cycle a setting in either direction.
void FinishPresetSelection ()
 End preset browsing; the next preset adjustment captures a new baseline.

Detailed Description

Persistent game choices for the options menu.

Constructor & Destructor Documentation

◆ GameSettings()

coastline::GameSettings::GameSettings ( GameConfig & config,
std::span< const std::filesystem::path > dataRoots = {},
std::span< const std::array< int, 2 > > displayResolutions = {} )

Build available options from the configuration, installed packs, and display modes.

Parameters
configThe mutable configuration. Its lifetime must exceed the settings model's.
dataRootsThe directories searched for selectable asset packs.
displayResolutionsAvailable output widths and heights, in pixels.

Member Function Documentation

◆ Count()

std::size_t coastline::GameSettings::Count ( ) const
inline
Returns
The number of options available in this settings model.

◆ SetOverrides()

void coastline::GameSettings::SetOverrides ( GameConfig overrides)

Replace temporary values supplied by command-line arguments without saving them.

Parameters
overridesSettings that take precedence over saved values and disable matching options.

◆ IsEnabled()

bool coastline::GameSettings::IsEnabled ( std::size_t index) const
Parameters
indexThe zero-based option index.
Returns
Whether the option is valid and is not controlled by a command-line override.

◆ Label()

std::string coastline::GameSettings::Label ( std::size_t index) const
Parameters
indexThe zero-based option index.
Returns
The option label and its selected value, or empty text for an invalid index.

◆ RequiresRestart()

bool coastline::GameSettings::RequiresRestart ( std::size_t index) const
Parameters
indexThe zero-based option index.
Returns
Whether the option requires rebuilding the game session, or false for an invalid index. For graphics presets, the result reflects the most recent preset adjustment.

◆ Step()

bool coastline::GameSettings::Step ( std::size_t index,
int direction )

Cycle a setting in either direction.

Invalid or locked options, zero steps, and options with fewer than two choices are ignored.

Parameters
indexThe zero-based option index.
directionA negative value for the previous choice, positive for the next.
Returns
Whether the configuration changed.

◆ FinishPresetSelection()

void coastline::GameSettings::FinishPresetSelection ( )

End preset browsing; the next preset adjustment captures a new baseline.


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