mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-12-30 15:50:05 -06:00
options_menu: only fast increment for float/int sliders
This commit is contained in:
@@ -685,28 +685,6 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf
|
||||
bool decrement = leftTapped;
|
||||
bool increment = rightTapped;
|
||||
|
||||
bool fastIncrement = (time - g_lastTappedTime) > 0.5;
|
||||
constexpr double INCREMENT_TIME = 1.0 / 120.0;
|
||||
|
||||
constexpr double INCREMENT_SOUND_TIME = 1.0 / 7.5;
|
||||
bool isPlayIncrementSound = true;
|
||||
|
||||
if (fastIncrement)
|
||||
{
|
||||
isPlayIncrementSound = (time - g_lastIncrementSoundTime) > INCREMENT_SOUND_TIME;
|
||||
|
||||
if ((time - g_lastIncrementTime) < INCREMENT_TIME)
|
||||
fastIncrement = false;
|
||||
else
|
||||
g_lastIncrementTime = time;
|
||||
}
|
||||
|
||||
if (fastIncrement)
|
||||
{
|
||||
decrement = leftIsHeld;
|
||||
increment = rightIsHeld;
|
||||
}
|
||||
|
||||
g_leftWasHeld = leftIsHeld;
|
||||
g_rightWasHeld = rightIsHeld;
|
||||
|
||||
@@ -738,6 +716,31 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf
|
||||
{
|
||||
float deltaTime = ImGui::GetIO().DeltaTime;
|
||||
|
||||
bool fastIncrement = (time - g_lastTappedTime) > 0.5;
|
||||
bool isPlayIncrementSound = true;
|
||||
|
||||
constexpr double INCREMENT_TIME = 1.0 / 120.0;
|
||||
constexpr double INCREMENT_SOUND_TIME = 1.0 / 7.5;
|
||||
|
||||
if (isSlider)
|
||||
{
|
||||
if (fastIncrement)
|
||||
{
|
||||
isPlayIncrementSound = (time - g_lastIncrementSoundTime) > INCREMENT_SOUND_TIME;
|
||||
|
||||
if ((time - g_lastIncrementTime) < INCREMENT_TIME)
|
||||
fastIncrement = false;
|
||||
else
|
||||
g_lastIncrementTime = time;
|
||||
}
|
||||
|
||||
if (fastIncrement)
|
||||
{
|
||||
decrement = leftIsHeld;
|
||||
increment = rightIsHeld;
|
||||
}
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if constexpr (std::is_integral_v<T>)
|
||||
|
||||
Reference in New Issue
Block a user