aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/inputhandler.cpp11
-rw-r--r--src/client/inputhandler.h2
2 files changed, 4 insertions, 9 deletions
diff --git a/src/client/inputhandler.cpp b/src/client/inputhandler.cpp
index 608a405a8..978baa320 100644
--- a/src/client/inputhandler.cpp
+++ b/src/client/inputhandler.cpp
@@ -113,17 +113,12 @@ bool MyEventReceiver::OnEvent(const SEvent &event)
if (event.EventType == irr::EET_KEY_INPUT_EVENT) {
const KeyPress &keyCode = event.KeyInput;
if (keysListenedFor[keyCode]) {
- // If the key is being held down then the OS may
- // send a continuous stream of keydown events.
- // In this case, we don't want to let this
- // stream reach the application as it will cause
- // certain actions to repeat constantly.
if (event.KeyInput.PressedDown) {
- if (!IsKeyDown(keyCode)) {
- keyWasDown.set(keyCode);
+ if (!IsKeyDown(keyCode))
keyWasPressed.set(keyCode);
- }
+
keyIsDown.set(keyCode);
+ keyWasDown.set(keyCode);
} else {
if (IsKeyDown(keyCode))
keyWasReleased.set(keyCode);
diff --git a/src/client/inputhandler.h b/src/client/inputhandler.h
index 7487bbdc7..1fb4cf0ec 100644
--- a/src/client/inputhandler.h
+++ b/src/client/inputhandler.h
@@ -201,7 +201,7 @@ private:
// The current state of keys
KeyList keyIsDown;
- // Whether a key was down
+ // Like keyIsDown but only reset when that key is read
KeyList keyWasDown;
// Whether a key has just been pressed