Skip to content

Commit

Permalink
fix input debounce preference and stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Mar 4, 2022
1 parent 7196513 commit 1a93c5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Themes/Rebirth/BGAnimations/playerInfoFrame/settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5396,9 +5396,9 @@ local function rightFrame()
Name = "Input Debounce Time",
Type = "SingleChoice",
Explanation = "Set the amount of time required between each repeated input.",
Directions = preferenceIncrementDecrementDirections("InputDebounceTime", 0, 1, 0.01),
Directions = preferenceIncrementDecrementDirections("InputDebounceTime", 0, 0.2, 0.001),
ChoiceIndexGetter = function()
return notShit.round(PREFSMAN:GetPreference("InputDebounceTime"), 2) .. "s"
return notShit.round(PREFSMAN:GetPreference("InputDebounceTime"), 3) .. "s"
end,
},
{
Expand Down
9 changes: 4 additions & 5 deletions src/Etterna/Singletons/InputFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,15 +274,14 @@ InputFilter::CheckButtonChange(ButtonState& bs,

GameInput gi;

/* Possibly apply debounce,
* If the input was coin, possibly apply distinct coin debounce in the else
* below. */
// Possibly apply debounce
std::chrono::duration<float> timeDelta = now - bs.m_LastReportTime;
float delta = timeDelta.count();
if (!INPUTMAPPER->DeviceToGame(di, gi) && di.button != MOUSE_WHEELDOWN &&
di.button != MOUSE_WHEELUP) {
if (di.button != MOUSE_WHEELDOWN && di.button != MOUSE_WHEELUP) {
/* If the last IET_FIRST_PRESS or IET_RELEASE event was sent too
* recently, wait a while before sending it. */
// note: a debounce time longer than the min IET_REPEAT time
// will cause repeat events to fire here
if (delta < g_fInputDebounceTime) {
return;
}
Expand Down

0 comments on commit 1a93c5c

Please sign in to comment.