mirror of
https://github.com/minetest/minetest.git
synced 2024-08-19 04:54:18 +02:00
Fix keyWasDown in input handler
This was changed 291a6b70d674d9003f522b5875a60f7e2753e32b but should have never been done.
This commit is contained in:
parent
35b476c65d
commit
9b59b2f75d
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user