remove fast repeat rate. It's the same as the slow rate, and nothing uses it. (IET_FAST_REPEAT kept for now, since some code uses it.)
This commit is contained in:
@@ -29,10 +29,9 @@ InputFilter* INPUTFILTER = NULL; // global and accessable from anywhere in our p
|
|||||||
static const float TIME_BEFORE_SLOW_REPEATS = 0.25f;
|
static const float TIME_BEFORE_SLOW_REPEATS = 0.25f;
|
||||||
static const float TIME_BEFORE_FAST_REPEATS = 1.5f;
|
static const float TIME_BEFORE_FAST_REPEATS = 1.5f;
|
||||||
|
|
||||||
static const float SLOW_REPEATS_PER_SEC = 8;
|
static const float REPEATS_PER_SEC = 8;
|
||||||
static const float FAST_REPEATS_PER_SEC = 8;
|
|
||||||
|
|
||||||
static float g_fTimeBeforeSlow, g_fTimeBeforeFast, g_fTimeBetweenSlow, g_fTimeBetweenFast;
|
static float g_fTimeBeforeSlow, g_fTimeBeforeFast, g_fTimeBetweenRepeats;
|
||||||
|
|
||||||
|
|
||||||
InputFilter::InputFilter()
|
InputFilter::InputFilter()
|
||||||
@@ -54,17 +53,16 @@ void InputFilter::Reset()
|
|||||||
ResetDevice( InputDevice(i) );
|
ResetDevice( InputDevice(i) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputFilter::SetRepeatRate( float fSlowDelay, float fSlowRate, float fFastDelay, float fFastRate )
|
void InputFilter::SetRepeatRate( float fSlowDelay, float fFastDelay, float fRepeatRate )
|
||||||
{
|
{
|
||||||
g_fTimeBeforeSlow = fSlowDelay;
|
g_fTimeBeforeSlow = fSlowDelay;
|
||||||
g_fTimeBeforeFast = fFastDelay;
|
g_fTimeBeforeFast = fFastDelay;
|
||||||
g_fTimeBetweenSlow = 1/fSlowRate;
|
g_fTimeBetweenRepeats = 1/fRepeatRate;
|
||||||
g_fTimeBetweenFast = 1/fFastRate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputFilter::ResetRepeatRate()
|
void InputFilter::ResetRepeatRate()
|
||||||
{
|
{
|
||||||
SetRepeatRate( TIME_BEFORE_SLOW_REPEATS, SLOW_REPEATS_PER_SEC, TIME_BEFORE_FAST_REPEATS, FAST_REPEATS_PER_SEC );
|
SetRepeatRate( TIME_BEFORE_SLOW_REPEATS, TIME_BEFORE_FAST_REPEATS, REPEATS_PER_SEC );
|
||||||
}
|
}
|
||||||
|
|
||||||
InputFilter::ButtonState::ButtonState():
|
InputFilter::ButtonState::ButtonState():
|
||||||
@@ -180,21 +178,18 @@ void InputFilter::Update(float fDeltaTime)
|
|||||||
bs.m_fSecsHeld += fDeltaTime;
|
bs.m_fSecsHeld += fDeltaTime;
|
||||||
const float fNewHoldTime = bs.m_fSecsHeld;
|
const float fNewHoldTime = bs.m_fSecsHeld;
|
||||||
|
|
||||||
float fTimeBetweenRepeats;
|
|
||||||
InputEventType iet;
|
InputEventType iet;
|
||||||
if( fOldHoldTime > g_fTimeBeforeSlow )
|
if( fOldHoldTime > g_fTimeBeforeSlow )
|
||||||
{
|
{
|
||||||
if( fOldHoldTime > g_fTimeBeforeFast )
|
if( fOldHoldTime > g_fTimeBeforeFast )
|
||||||
{
|
{
|
||||||
fTimeBetweenRepeats = g_fTimeBetweenFast;
|
|
||||||
iet = IET_FAST_REPEAT;
|
iet = IET_FAST_REPEAT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fTimeBetweenRepeats = g_fTimeBetweenSlow;
|
|
||||||
iet = IET_SLOW_REPEAT;
|
iet = IET_SLOW_REPEAT;
|
||||||
}
|
}
|
||||||
if( int(fOldHoldTime/fTimeBetweenRepeats) != int(fNewHoldTime/fTimeBetweenRepeats) )
|
if( int(fOldHoldTime/g_fTimeBetweenRepeats) != int(fNewHoldTime/g_fTimeBetweenRepeats) )
|
||||||
{
|
{
|
||||||
queue.push_back( InputEvent(di,iet) );
|
queue.push_back( InputEvent(di,iet) );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
void Reset();
|
void Reset();
|
||||||
void Update(float fDeltaTime);
|
void Update(float fDeltaTime);
|
||||||
|
|
||||||
void SetRepeatRate( float fSlowDelay, float fSlowRate, float fFastDelay, float fFastRate );
|
void SetRepeatRate( float fSlowDelay, float fFastDelay, float fRepeatRate );
|
||||||
void ResetRepeatRate();
|
void ResetRepeatRate();
|
||||||
void ResetKeyRepeat( DeviceInput di );
|
void ResetKeyRepeat( DeviceInput di );
|
||||||
|
|
||||||
|
|||||||
@@ -638,7 +638,7 @@ void ScreenOptions::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
}
|
}
|
||||||
else if( SM == SM_GainFocus )
|
else if( SM == SM_GainFocus )
|
||||||
{
|
{
|
||||||
INPUTFILTER->SetRepeatRate( 0.25f, 12, 0.25f, 12 );
|
INPUTFILTER->SetRepeatRate( 0.25f, 0.25f, 12 );
|
||||||
}
|
}
|
||||||
else if( SM == SM_LoseFocus )
|
else if( SM == SM_LoseFocus )
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user