summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-06-13 17:41:33 +0200
committerGitHub <noreply@github.com>2019-06-13 17:41:33 +0200
commit48fb3debf66af3bb3e6bea5be10c3178f2861d85 (patch)
treea5479e6cdf4ea4e9aad0b65435a8984df514a735
parent933dd1cbe273f11e1ca02b5dc62b182b27934414 (diff)
parenta9581d2b3f05506e4fc6f3e3571147b4922fc417 (diff)
Merge pull request #29754 from BastiaanOlij/vr_button_mapping
Added constants for the main buttons and axis used in VR
-rw-r--r--core/global_constants.cpp16
-rw-r--r--core/os/input_event.h16
-rw-r--r--doc/classes/@GlobalScope.xml33
3 files changed, 65 insertions, 0 deletions
diff --git a/core/global_constants.cpp b/core/global_constants.cpp
index fb90403226..671b3c545b 100644
--- a/core/global_constants.cpp
+++ b/core/global_constants.cpp
@@ -425,6 +425,16 @@ void register_global_constants() {
BIND_GLOBAL_ENUM_CONSTANT(JOY_DS_X);
BIND_GLOBAL_ENUM_CONSTANT(JOY_DS_Y);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_VR_GRIP);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_VR_PAD);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_VR_TRIGGER);
+
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_OCULUS_AX);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_OCULUS_BY);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_OCULUS_MENU);
+
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_OPENVR_MENU);
+
BIND_GLOBAL_ENUM_CONSTANT(JOY_SELECT);
BIND_GLOBAL_ENUM_CONSTANT(JOY_START);
BIND_GLOBAL_ENUM_CONSTANT(JOY_DPAD_UP);
@@ -459,6 +469,12 @@ void register_global_constants() {
BIND_GLOBAL_ENUM_CONSTANT(JOY_ANALOG_L2);
BIND_GLOBAL_ENUM_CONSTANT(JOY_ANALOG_R2);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_VR_ANALOG_TRIGGER);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_VR_ANALOG_GRIP);
+
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_OPENVR_TOUCHPADX);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_OPENVR_TOUCHPADY);
+
// midi
BIND_GLOBAL_ENUM_CONSTANT(MIDI_MESSAGE_NOTE_OFF);
BIND_GLOBAL_ENUM_CONSTANT(MIDI_MESSAGE_NOTE_ON);
diff --git a/core/os/input_event.h b/core/os/input_event.h
index 7a9a1f71c3..2eb321f134 100644
--- a/core/os/input_event.h
+++ b/core/os/input_event.h
@@ -117,6 +117,16 @@ enum JoystickList {
JOY_WII_MINUS = JOY_BUTTON_10,
JOY_WII_PLUS = JOY_BUTTON_11,
+ JOY_VR_GRIP = JOY_BUTTON_2,
+ JOY_VR_PAD = JOY_BUTTON_14,
+ JOY_VR_TRIGGER = JOY_BUTTON_15,
+
+ JOY_OCULUS_AX = JOY_BUTTON_7,
+ JOY_OCULUS_BY = JOY_BUTTON_1,
+ JOY_OCULUS_MENU = JOY_BUTTON_3,
+
+ JOY_OPENVR_MENU = JOY_BUTTON_1,
+
// end of history
JOY_AXIS_0 = 0,
@@ -139,6 +149,12 @@ enum JoystickList {
JOY_ANALOG_L2 = JOY_AXIS_6,
JOY_ANALOG_R2 = JOY_AXIS_7,
+
+ JOY_VR_ANALOG_TRIGGER = JOY_AXIS_2,
+ JOY_VR_ANALOG_GRIP = JOY_AXIS_4,
+
+ JOY_OPENVR_TOUCHPADX = JOY_AXIS_0,
+ JOY_OPENVR_TOUCHPADY = JOY_AXIS_1,
};
enum MidiMessageList {
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index 760287e1b8..eb612191e7 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -1003,6 +1003,27 @@
<constant name="JOY_DS_Y" value="2" enum="JoystickList">
DualShock controller Y button
</constant>
+ <constant name="JOY_VR_GRIP" value="2" enum="JoystickList">
+ Grip (side) buttons on a VR controller
+ </constant>
+ <constant name="JOY_VR_PAD" value="14" enum="JoystickList">
+ Push down on the touchpad or main joystick on a VR controller
+ </constant>
+ <constant name="JOY_VR_TRIGGER" value="15" enum="JoystickList">
+ Trigger on a VR controller
+ </constant>
+ <constant name="JOY_OCULUS_AX" value="7" enum="JoystickList">
+ A button on the right Oculus Touch controller, X button on the left controller (also when used in OpenVR)
+ </constant>
+ <constant name="JOY_OCULUS_BY" value="1" enum="JoystickList">
+ B button on the right Oculus Touch controller, Y button on the left controller (also when used in OpenVR)
+ </constant>
+ <constant name="JOY_OCULUS_MENU" value="3" enum="JoystickList">
+ Menu button on either Oculus Touch controller.
+ </constant>
+ <constant name="JOY_OPENVR_MENU" value="1" enum="JoystickList">
+ Menu button in OpenVR (Except when Oculus Touch controllers are used)
+ </constant>
<constant name="JOY_SELECT" value="10" enum="JoystickList">
Joypad Button Select
</constant>
@@ -1085,6 +1106,18 @@
<constant name="JOY_ANALOG_R2" value="7" enum="JoystickList">
Joypad Right Analog Trigger
</constant>
+ <constant name="JOY_VR_ANALOG_TRIGGER" value="2" enum="JoystickList">
+ VR Controller Analog Trigger
+ </constant>
+ <constant name="JOY_VR_ANALOG_GRIP" value="4" enum="JoystickList">
+ VR Controller Analog Grip (side buttons)
+ </constant>
+ <constant name="JOY_OPENVR_TOUCHPADX" value="0" enum="JoystickList">
+ OpenVR touchpad X axis (Joystick axis on Oculus Touch and Windows MR controllers)
+ </constant>
+ <constant name="JOY_OPENVR_TOUCHPADY" value="1" enum="JoystickList">
+ OpenVR touchpad Y axis (Joystick axis on Oculus Touch and Windows MR controllers)
+ </constant>
<constant name="MIDI_MESSAGE_NOTE_OFF" value="8" enum="MidiMessageList">
</constant>
<constant name="MIDI_MESSAGE_NOTE_ON" value="9" enum="MidiMessageList">