diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-03-07 14:47:20 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-03-07 14:47:20 +0300 |
commit | f8fcfcfef1e5a8cbda66328664f41b3f9aa2a773 (patch) | |
tree | fce3dc2882525b56f7fb4f5219c58aad716ccda1 /src/joystick.cpp | |
parent | 008a29a3fbcf282d1bed8ce4a9bdfb665defd943 (diff) | |
download | plus-f8fcfcfef1e5a8cbda66328664f41b3f9aa2a773.tar.gz plus-f8fcfcfef1e5a8cbda66328664f41b3f9aa2a773.tar.bz2 plus-f8fcfcfef1e5a8cbda66328664f41b3f9aa2a773.tar.xz plus-f8fcfcfef1e5a8cbda66328664f41b3f9aa2a773.zip |
Fix key repeat time calculation.
Add configurabale auto repeat time.
Diffstat (limited to 'src/joystick.cpp')
-rw-r--r-- | src/joystick.cpp | 10 |
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)); + } } } } |