options_menu: only fast increment for float/int sliders

This commit is contained in:
Hyper 2025-01-17 15:27:40 +00:00
parent f8e6b74551
commit d297c07edb

View file

@ -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>)