summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
Diffstat (limited to 'src/control')
-rw-r--r--src/control/InputHandler.hpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/control/InputHandler.hpp b/src/control/InputHandler.hpp
index 1a34982..7eb98a9 100644
--- a/src/control/InputHandler.hpp
+++ b/src/control/InputHandler.hpp
@@ -51,17 +51,17 @@ public:
}
void keyPressed(uint16_t key, uint64_t time) {
- pressedKeys.insert(key);
-
- for (auto &listener : listeners)
- listener(key, true, time);
+ if (pressedKeys.insert(key).second) {
+ for (auto &listener : listeners)
+ listener(key, true, time);
+ }
}
void keyReleased(uint16_t key, uint64_t time) {
- pressedKeys.erase(key);
-
- for (auto &listener : listeners)
- listener(key, false, time);
+ if (pressedKeys.erase(key)) {
+ for (auto &listener : listeners)
+ listener(key, false, time);
+ }
}
bool isKeyPressed(uint16_t key) {