aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/inputmanager.cpp')
-rw-r--r--src/inputmanager.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/inputmanager.cpp b/src/inputmanager.cpp
new file mode 100644
index 00000000..0bcb35f8
--- /dev/null
+++ b/src/inputmanager.cpp
@@ -0,0 +1,24 @@
+#include "inputmanager.hpp"
+
+namespace yage
+{
+
+void InputManager::keyPressed(unsigned key)
+{
+ key_map_[key]=true;
+}
+
+void InputManager::keyReleased(unsigned key)
+{
+ key_map_[key]=false;
+}
+
+bool InputManager::isKeyPressed(unsigned key) const
+{
+ auto key_index=key_map_.find(key);
+ if(key_index!=key_map_.end())
+ return key_index->second;
+ return false;
+}
+
+}