stmm-games-doc  0.32.0
Public Member Functions | List of all members
stmg::StdConfig::KeyAction Class Referencefinal

The key action class. More...

Public Member Functions

 KeyAction (const std::vector< std::string > &aKeyActionName, const std::string &sDescription, const std::vector< std::pair< stmi::Capability::Class, std::vector< stmi::HARDWARE_KEY > > > &aDefaultClassKeys) noexcept
 Construct a key action. More...
 
 KeyAction (const std::string &sKeyActionName, const std::string &sDescription, const stmi::Capability::Class &oCapaClass, const std::vector< stmi::HARDWARE_KEY > &aDefaultClassKeys) noexcept
 Construct a key action. More...
 
const std::vector< std::string > & getNames () const noexcept
 Names associated with the key action. More...
 
const std::string & getDescription () const noexcept
 Description of the key action. More...
 
const std::vector< stmi::Capability::Class > & getClasses () const noexcept
 Capability classes that have default keys for this key action. More...
 
const std::vector< stmi::HARDWARE_KEY > & getClassDefaultKeys (const stmi::Capability::Class &oClass) const noexcept
 Default keys of a capability class for this key action. More...
 

Detailed Description

The key action class.

Can be used by the preferences dialog.

Constructor & Destructor Documentation

◆ KeyAction() [1/2]

stmg::StdConfig::KeyAction::KeyAction ( const std::vector< std::string > &  aKeyActionName,
const std::string &  sDescription,
const std::vector< std::pair< stmi::Capability::Class, std::vector< stmi::HARDWARE_KEY > > > &  aDefaultClassKeys 
)
noexcept

Construct a key action.

Having more than one name for the same action allows to mix different games into one.

Names must start with alphanumeric character.

Ex. The hardware key stmi::HK_UP can be assigned to a tetris block with key action name "Rotate" and to a cursor that responds to a key action named "MoveUp".

Parameters
aKeyActionNameThe non empty names that identify the same key action.
sDescriptionThe description as it should appear in the preferences dialog.
aDefaultClassKeysThe capability classes and their default keys.

◆ KeyAction() [2/2]

stmg::StdConfig::KeyAction::KeyAction ( const std::string &  sKeyActionName,
const std::string &  sDescription,
const stmi::Capability::Class oCapaClass,
const std::vector< stmi::HARDWARE_KEY > &  aDefaultClassKeys 
)
noexcept

Construct a key action.

The name must start with alphanumeric character.

Parameters
sKeyActionNameThe name of the key action. Must be unique.
sDescriptionThe description of the key action.
oCapaClassThe device's capability class for which the default keys are defined.
aDefaultClassKeysThe keys that can be used as defaults by a preferences dialog.

Member Function Documentation

◆ getClassDefaultKeys()

const std::vector<stmi::HARDWARE_KEY>& stmg::StdConfig::KeyAction::getClassDefaultKeys ( const stmi::Capability::Class oClass) const
noexcept

Default keys of a capability class for this key action.

◆ getClasses()

const std::vector<stmi::Capability::Class>& stmg::StdConfig::KeyAction::getClasses ( ) const
inlinenoexcept

Capability classes that have default keys for this key action.

◆ getDescription()

const std::string& stmg::StdConfig::KeyAction::getDescription ( ) const
inlinenoexcept

Description of the key action.

◆ getNames()

const std::vector<std::string>& stmg::StdConfig::KeyAction::getNames ( ) const
inlinenoexcept

Names associated with the key action.