stmm-games-doc  0.32.0
Public Member Functions | List of all members
stmg::AppConfig Class Referenceabstract

Read-only interface to application configuration data. More...

Inheritance diagram for stmg::AppConfig:
Inheritance graph
[legend]

Public Member Functions

virtual ~AppConfig () noexcept=default
 
virtual const std::string & getAppName () const noexcept=0
 The name of the application. More...
 
virtual const std::string & getAppVersion () const noexcept=0
 The version of the application. More...
 
virtual const AppConstraintsgetAppConstraints () const noexcept=0
 The application constraints. More...
 
virtual shared_ptr< stmi::DeviceManagergetDeviceManager () const noexcept=0
 The device manager that generates the input events. More...
 
virtual int32_t getTotKeyActions () const noexcept=0
 The total number of key actions. More...
 
virtual int32_t getKeyActionId (const std::string &sKeyActionName) const noexcept=0
 Get to the key action id from its name. More...
 
virtual const NamedObjIndex< shared_ptr< Option > > & getOptions (OwnerType eOwner) const noexcept=0
 Get the options for an owner type. More...
 
virtual const shared_ptr< Option > & getOption (OwnerType eOwner, const std::string &sName) const noexcept=0
 Get an option by name. More...
 
virtual bool isEventAssignedToActivePlayer () const noexcept=0
 Tells whether events should be assigned to the active player. More...
 
virtual bool soundEnabled () const noexcept=0
 Whether the game plays sounds. More...
 
virtual bool canPlayPerPlayerSounds () const noexcept=0
 Whether allows playback devices to be assigned to players. More...
 
virtual bool isTestMode () const noexcept=0
 Whether in testing mode. More...
 

Detailed Description

Read-only interface to application configuration data.

Constructor & Destructor Documentation

◆ ~AppConfig()

virtual stmg::AppConfig::~AppConfig ( )
virtualdefaultnoexcept

Member Function Documentation

◆ canPlayPerPlayerSounds()

virtual bool stmg::AppConfig::canPlayPerPlayerSounds ( ) const
pure virtualnoexcept

Whether allows playback devices to be assigned to players.

If true the game allows playback devices such as head phones to be assigned to each player for personalized output. Ignored if playsSounds() returns false.

Returns
Whether sounds can be player specific.

Implemented in stmg::StdConfig.

◆ getAppConstraints()

virtual const AppConstraints& stmg::AppConfig::getAppConstraints ( ) const
pure virtualnoexcept

The application constraints.

Returns
The constraints.

Implemented in stmg::StdConfig.

◆ getAppName()

virtual const std::string& stmg::AppConfig::getAppName ( ) const
pure virtualnoexcept

The name of the application.

Returns
The application name. Cannot be empty.

Implemented in stmg::StdConfig.

◆ getAppVersion()

virtual const std::string& stmg::AppConfig::getAppVersion ( ) const
pure virtualnoexcept

The version of the application.

Returns
The application version. Cannot be empty.

Implemented in stmg::StdConfig.

◆ getDeviceManager()

virtual shared_ptr<stmi::DeviceManager> stmg::AppConfig::getDeviceManager ( ) const
pure virtualnoexcept

The device manager that generates the input events.

Returns
The device manager. Cannot be null.

Implemented in stmg::StdConfig.

◆ getKeyActionId()

virtual int32_t stmg::AppConfig::getKeyActionId ( const std::string &  sKeyActionName) const
pure virtualnoexcept

Get to the key action id from its name.

Parameters
sKeyActionNameThe key action name.
Returns
The key action id or -1 if not found.

Implemented in stmg::StdConfig.

◆ getOption()

virtual const shared_ptr<Option>& stmg::AppConfig::getOption ( OwnerType  eOwner,
const std::string &  sName 
) const
pure virtualnoexcept

Get an option by name.

Parameters
eOwnerThe owner type.
sNameThe name of the option. Cannot be empty.
Returns
The option or null if not defined.

Implemented in stmg::StdConfig.

◆ getOptions()

virtual const NamedObjIndex< shared_ptr<Option> >& stmg::AppConfig::getOptions ( OwnerType  eOwner) const
pure virtualnoexcept

Get the options for an owner type.

Parameters
eOwnerThe owner type.
Returns
The options.

Implemented in stmg::StdConfig.

◆ getTotKeyActions()

virtual int32_t stmg::AppConfig::getTotKeyActions ( ) const
pure virtualnoexcept

The total number of key actions.

A valid key action id is a number from 0 to getTotKeyActions()-1.

Returns
The total number of key actions.

Implemented in stmg::StdConfig.

◆ isEventAssignedToActivePlayer()

virtual bool stmg::AppConfig::isEventAssignedToActivePlayer ( ) const
pure virtualnoexcept

Tells whether events should be assigned to the active player.

If this function returns true, the game, when it receives an event from a device's capability that wasn't assigned to a player in the preferences, will try to assign it to the unique active human player. If more than one human player is active at the moment the event is received, it is dropped.

This is useful in turn based games where the two players use the same device (ex. the mouse). Be aware that it can cause inconsistencies. Example: if between the press and the release of a joystick button the active player is changed the release event is sent to a different player.

Returns
Whether to look for a target human player for an unassigned event.

Implemented in stmg::StdConfig.

◆ isTestMode()

virtual bool stmg::AppConfig::isTestMode ( ) const
pure virtualnoexcept

Whether in testing mode.

This flag can be used to output additional information.

Returns
Whether testing.

Implemented in stmg::StdConfig.

◆ soundEnabled()

virtual bool stmg::AppConfig::soundEnabled ( ) const
pure virtualnoexcept

Whether the game plays sounds.

If this function returns false sounds are not played and the view preferences should not show widgets to choose the volume.

Returns
Whether sounds activated.

Implemented in stmg::StdConfig.