Add media key bindings, update docs

All bindings are disabled by default. This is to prevent confusing
behaviour from users who do not know about the new bindings. Forcing
users to manually set up their bindings will also enable them to play
around with the SteamVR bindings interface, which allows for much more
versatile binding options that our current offerings.

All actions are curently in main action set. If the selection of
bindings was greatly expanded it could be beneficial to encapsulate the
options more. The current code is more intended as a proof of concept
until our full binding needs have been uncovered.

The processInputBindings function should probably also be split into
several functions of related bindings, as the amount of bindings grows.
This commit is contained in:
Vasily
2019-01-21 21:19:28 +01:00
parent 3a62ec89be
commit 667711246e
7 changed files with 117 additions and 47 deletions
+39 -1
View File
@@ -124,7 +124,12 @@ mystically not working.
*/
SteamIVRInput::SteamIVRInput()
: m_manifest(), m_mainSet( input_strings::k_setMain ),
m_nextTrack( input_strings::k_actionNextTrack, ActionType::Digital )
m_nextTrack( input_strings::k_actionNextTrack, ActionType::Digital ),
m_previousTrack( input_strings::k_actionPreviousTrack,
ActionType::Digital ),
m_pausePlayTrack( input_strings::k_actionPausePlayTrack,
ActionType::Digital ),
m_stopTrack( input_strings::k_actionStopTrack, ActionType::Digital )
{
m_activeActionSet.ulActionSet = m_mainSet.handle();
m_activeActionSet.ulRestrictedToDevice = vr::k_ulInvalidInputValueHandle;
@@ -141,6 +146,39 @@ bool SteamIVRInput::nextSong()
return isDigitalActionActivatedOnce( m_nextTrack );
}
/*!
Returns true if the previous media track should be played.
Will only return true the first time that the button is pressed. Holding the
button down will result in false until it has been released and pushed again.
*/
bool SteamIVRInput::previousSong()
{
return isDigitalActionActivatedOnce( m_previousTrack );
}
/*!
Returns true if media playback should be paused/played.
Will only return true the first time that the button is pressed. Holding the
button down will result in false until it has been released and pushed again.
*/
bool SteamIVRInput::pausePlaySong()
{
return isDigitalActionActivatedOnce( m_pausePlayTrack );
}
/*!
Returns true if media playback should be stopped.
Will only return true the first time that the button is pressed. Holding the
button down will result in false until it has been released and pushed again.
*/
bool SteamIVRInput::stopSong()
{
return isDigitalActionActivatedOnce( m_stopTrack );
}
/*!
Updates the active action set(s).
Should be called every frame, or however often you want the input system to