Convert m_smoothTurnRate to new settings API

This commit is contained in:
Vasily
2019-12-10 08:28:41 +01:00
committed by username223
parent 22b52d403c
commit 7a6c3fc53e
2 changed files with 11 additions and 20 deletions
+11 -19
View File
@@ -44,9 +44,6 @@ void MoveCenterTabController::initStage1()
m_turnComfortFactor = static_cast<unsigned int>( settings::getSetting( m_turnComfortFactor = static_cast<unsigned int>( settings::getSetting(
settings::IntSetting::PLAYSPACE_turnComfortFactor ) ); settings::IntSetting::PLAYSPACE_turnComfortFactor ) );
m_smoothTurnRate = settings::getSetting(
settings::IntSetting::PLAYSPACE_smoothTurnRate );
m_heightToggleOffset = static_cast<float>( settings::getSetting( m_heightToggleOffset = static_cast<float>( settings::getSetting(
settings::DoubleSetting::PLAYSPACE_heightToggleOffset ) ); settings::DoubleSetting::PLAYSPACE_heightToggleOffset ) );
m_gravityStrength = static_cast<float>( settings::getSetting( m_gravityStrength = static_cast<float>( settings::getSetting(
@@ -475,23 +472,18 @@ void MoveCenterTabController::setSnapTurnAngle( int value, bool notify )
int MoveCenterTabController::smoothTurnRate() const int MoveCenterTabController::smoothTurnRate() const
{ {
return m_smoothTurnRate; return settings::getSetting(
settings::IntSetting::PLAYSPACE_smoothTurnRate );
} }
void MoveCenterTabController::setSmoothTurnRate( int value, bool notify ) void MoveCenterTabController::setSmoothTurnRate( int value, bool notify )
{ {
if ( m_smoothTurnRate != value ) settings::setSetting( settings::IntSetting::PLAYSPACE_smoothTurnRate,
value );
if ( notify )
{ {
m_smoothTurnRate = value; emit smoothTurnRateChanged( value );
auto settings = OverlayController::appSettings();
settings->beginGroup( "playspaceSettings" );
settings->setValue( "smoothTurnRate", m_smoothTurnRate );
settings->endGroup();
settings->sync();
if ( notify )
{
emit smoothTurnRateChanged( m_smoothTurnRate );
}
} }
} }
@@ -2045,10 +2037,10 @@ void MoveCenterTabController::smoothTurnLeft( bool smoothTurnLeftActive )
return; return;
} }
// Activates every tick. m_smoothTurnRate effectively becomes a percentage // Activates every tick. smoothTurnRate() effectively becomes a percentage
// of a degree per tick. A setting of 100 would equal 90 degrees/sec or 15 // of a degree per tick. A setting of 100 would equal 90 degrees/sec or 15
// RPM with a framerate of 90fps // RPM with a framerate of 90fps
int newRotationAngleDeg = m_rotation - m_smoothTurnRate; int newRotationAngleDeg = m_rotation - smoothTurnRate();
// Keep angle within -18000 ~ 18000 centidegrees // Keep angle within -18000 ~ 18000 centidegrees
if ( newRotationAngleDeg > 18000 ) if ( newRotationAngleDeg > 18000 )
{ {
@@ -2069,10 +2061,10 @@ void MoveCenterTabController::smoothTurnRight( bool smoothTurnRightActive )
return; return;
} }
// Activates every tick. m_smoothTurnRate effectively becomes a percentage // Activates every tick. smoothTurnRate() effectively becomes a percentage
// of a degree per tick. A setting of 100 would equal 90 degrees/sec or 15 // of a degree per tick. A setting of 100 would equal 90 degrees/sec or 15
// RPM with a framerate of 90fps // RPM with a framerate of 90fps
int newRotationAngleDeg = m_rotation + m_smoothTurnRate; int newRotationAngleDeg = m_rotation + smoothTurnRate();
// Keep angle within -18000 ~ 18000 centidegrees // Keep angle within -18000 ~ 18000 centidegrees
if ( newRotationAngleDeg > 18000 ) if ( newRotationAngleDeg > 18000 )
{ {
@@ -119,7 +119,6 @@ private:
int m_rotation = 0; int m_rotation = 0;
int m_oldRotation = 0; int m_oldRotation = 0;
int m_tempRotation = 0; int m_tempRotation = 0;
int m_smoothTurnRate = 100;
bool m_moveShortcutRightPressed = false; bool m_moveShortcutRightPressed = false;
bool m_moveShortcutLeftPressed = false; bool m_moveShortcutLeftPressed = false;
vr::TrackedDeviceIndex_t m_activeMoveController; vr::TrackedDeviceIndex_t m_activeMoveController;