浏览代码

Get key state. For science

Eiyeron Fulmincendii 10 年之前
父节点
当前提交
0806f083bc
共有 3 个文件被更改,包括 11 次插入0 次删除
  1. 1 0
      platform/include/Input.h
  2. 5 0
      platform/nspire/Input.cpp
  3. 5 0
      platform/sfml/Input.cpp

+ 1 - 0
platform/include/Input.h

@@ -31,6 +31,7 @@ namespace WalrusRPG
 
         void key_poll();
 
+        KeyState key_get_state(Key key);
         bool key_pressed(Key key);
         bool key_released(Key key);
         bool key_down(Key key);

+ 5 - 0
platform/nspire/Input.cpp

@@ -23,6 +23,11 @@ static InputMap key_map[] = {
     {Key::K_START, KEY_NSPIRE_HOME}, {Key::K_SELECT, KEY_NSPIRE_ESC},
 };
 
+KeyState INPUT::key_get_state(Key key)
+{
+        return key_states[key];
+}
+
 void INPUT::key_poll()
 {
     for (unsigned i = 0; i < K_SIZE; i++)

+ 5 - 0
platform/sfml/Input.cpp

@@ -32,6 +32,11 @@ InputMap key_map[] = {
     {Key::K_SELECT, Keyboard::BackSpace, Keyboard::Unknown},
 };
 
+KeyState INPUT::key_get_state(Key key)
+{
+        return key_states[key];
+}
+
 void INPUT::key_poll()
 {
     bool hasFocus = window.hasFocus();