浏览代码

Fleshed out the input buttons.

Eiyeron Fulmincendii 10 年之前
父节点
当前提交
d53daef14e
共有 3 个文件被更改,包括 52 次插入8 次删除
  1. 4 0
      platform/include/Input.h
  2. 22 2
      platform/nspire/Input.cpp
  3. 26 6
      platform/sfml/Input.cpp

+ 4 - 0
platform/include/Input.h

@@ -7,10 +7,14 @@ namespace WalrusRPG
     {
         bool key_a();
         bool key_b();
+        bool key_l();
+        bool key_r();
         bool key_up();
         bool key_down();
         bool key_left();
         bool key_right();
+        bool key_start();
+        bool key_select();
     }
 }
 

+ 22 - 2
platform/nspire/Input.cpp

@@ -5,12 +5,22 @@
 
 bool INPUT::key_a()
 {
-    return isKeyPressed(KEY_NSPIRE_ENTER);
+    return isKeyPressed(KEY_NSPIRE_CTRL);
 }
 
 bool INPUT::key_b()
 {
-    return isKeyPressed(KEY_NSPIRE_ESC);
+    return isKeyPressed(KEY_NSPIRE_SHIFT);
+}
+
+bool INPUT::key_l()
+{
+    return isKeyPressed(KEY_NSPIRE_TAB);
+}
+
+bool INPUT::key_r()
+{
+    return isKeyPressed(KEY_NSPIRE_MENU);
 }
 
 bool INPUT::key_up()
@@ -32,3 +42,13 @@ bool INPUT::key_right()
 {
     return isKeyPressed(KEY_NSPIRE_6);
 }
+
+bool INPUT::key_start()
+{
+    return isKeyPressed(KEY_NSPIRE_HOME);
+}
+
+bool INPUT::key_select()
+{
+    return isKeyPressed(KEY_NSPIRE_ESC);
+}

+ 26 - 6
platform/sfml/Input.cpp

@@ -7,30 +7,50 @@ using sf::Keyboard;
 
 bool INPUT::key_a()
 {
-    return window.hasFocus() && Keyboard::isKeyPressed(Keyboard::Return);
+    return window.hasFocus() && (Keyboard::isKeyPressed(Keyboard::W) || Keyboard::isKeyPressed(Keyboard::Z));
 }
 
 bool INPUT::key_b()
 {
-    return window.hasFocus() && Keyboard::isKeyPressed(Keyboard::BackSpace);
+    return window.hasFocus() && Keyboard::isKeyPressed(Keyboard::X);
+}
+
+bool INPUT::key_l()
+{
+    return window.hasFocus() && (Keyboard::isKeyPressed(Keyboard::Q) || Keyboard::isKeyPressed(Keyboard::A));
+}
+
+bool INPUT::key_r()
+{
+    return window.hasFocus() && Keyboard::isKeyPressed(Keyboard::S);
 }
 
 bool INPUT::key_up()
 {
-    return window.hasFocus() && (Keyboard::isKeyPressed(Keyboard::W) || Keyboard::isKeyPressed(Keyboard::Up));
+    return window.hasFocus() && (Keyboard::isKeyPressed(Keyboard::Up));
 }
 
 bool INPUT::key_down()
 {
-    return window.hasFocus() && (Keyboard::isKeyPressed(Keyboard::S) || Keyboard::isKeyPressed(Keyboard::Down));
+    return window.hasFocus() && (Keyboard::isKeyPressed(Keyboard::Down));
 }
 
 bool INPUT::key_left()
 {
-    return window.hasFocus() && (Keyboard::isKeyPressed(Keyboard::A) || Keyboard::isKeyPressed(Keyboard::Left));
+    return window.hasFocus() && (Keyboard::isKeyPressed(Keyboard::Left));
 }
 
 bool INPUT::key_right()
 {
-    return window.hasFocus() && (Keyboard::isKeyPressed(Keyboard::D) || Keyboard::isKeyPressed(Keyboard::Right));
+    return window.hasFocus() && (Keyboard::isKeyPressed(Keyboard::Right));
+}
+
+bool INPUT::key_start()
+{
+    return window.hasFocus() && Keyboard::isKeyPressed(Keyboard::Return);
+}
+
+bool INPUT::key_select()
+{
+    return window.hasFocus() && Keyboard::isKeyPressed(Keyboard::BackSpace);
 }