mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-12-18 14:02:34 +00:00
options_menu: only fast increment for float/int sliders
This commit is contained in:
parent
f8e6b74551
commit
d297c07edb
1 changed files with 25 additions and 22 deletions
|
|
@ -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>)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue