summaryrefslogtreecommitdiff
path: root/src/joystick.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-03-07 14:47:20 +0300
committerAndrei Karas <akaras@inbox.ru>2013-03-07 14:47:20 +0300
commitf8fcfcfef1e5a8cbda66328664f41b3f9aa2a773 (patch)
treefce3dc2882525b56f7fb4f5219c58aad716ccda1 /src/joystick.cpp
parent008a29a3fbcf282d1bed8ce4a9bdfb665defd943 (diff)
downloadManaVerse-f8fcfcfef1e5a8cbda66328664f41b3f9aa2a773.tar.gz
ManaVerse-f8fcfcfef1e5a8cbda66328664f41b3f9aa2a773.tar.bz2
ManaVerse-f8fcfcfef1e5a8cbda66328664f41b3f9aa2a773.tar.xz
ManaVerse-f8fcfcfef1e5a8cbda66328664f41b3f9aa2a773.zip
Fix key repeat time calculation.
Add configurabale auto repeat time.
Diffstat (limited to 'src/joystick.cpp')
-rw-r--r--src/joystick.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/joystick.cpp b/src/joystick.cpp
index 1e5d5e5f9..0c78621d3 100644
--- a/src/joystick.cpp
+++ b/src/joystick.cpp
@@ -345,10 +345,14 @@ void Joystick::handleRepeat(const int time)
if (mActiveButtons[key])
repeat = true;
}
- if (repeat && abs(keyTime - time) > 10)
+ if (repeat)
{
- keyTime = time;
- inputManager.triggerAction(getActionVectorByKey(key));
+ if (time > keyTime && abs(time - keyTime)
+ > SDL_DEFAULT_REPEAT_DELAY * 10)
+ {
+ keyTime = time;
+ inputManager.triggerAction(getActionVectorByKey(key));
+ }
}
}
}