Update game controller enums.
This commit is contained in:
parent
1176e078b9
commit
e7fee711b3
@ -88,7 +88,8 @@ static Vector<_GlobalConstant> _global_constants;
|
|||||||
VARIANT_ENUM_CAST(KeyList);
|
VARIANT_ENUM_CAST(KeyList);
|
||||||
VARIANT_ENUM_CAST(KeyModifierMask);
|
VARIANT_ENUM_CAST(KeyModifierMask);
|
||||||
VARIANT_ENUM_CAST(ButtonList);
|
VARIANT_ENUM_CAST(ButtonList);
|
||||||
VARIANT_ENUM_CAST(JoystickList);
|
VARIANT_ENUM_CAST(JoyButtonList);
|
||||||
|
VARIANT_ENUM_CAST(JoyAxisList);
|
||||||
VARIANT_ENUM_CAST(MidiMessageList);
|
VARIANT_ENUM_CAST(MidiMessageList);
|
||||||
|
|
||||||
void register_global_constants() {
|
void register_global_constants() {
|
||||||
@ -388,90 +389,70 @@ void register_global_constants() {
|
|||||||
BIND_GLOBAL_ENUM_CONSTANT(BUTTON_MASK_XBUTTON1);
|
BIND_GLOBAL_ENUM_CONSTANT(BUTTON_MASK_XBUTTON1);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(BUTTON_MASK_XBUTTON2);
|
BIND_GLOBAL_ENUM_CONSTANT(BUTTON_MASK_XBUTTON2);
|
||||||
|
|
||||||
//joypads
|
// Joypad buttons
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_0);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_INVALID_BUTTON);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_1);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_A);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_2);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_B);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_3);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_X);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_4);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_Y);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_5);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_BACK);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_6);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_GUIDE);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_7);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_START);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_8);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_LEFT_STICK);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_9);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_RIGHT_STICK);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_10);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_LEFT_SHOULDER);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_11);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_RIGHT_SHOULDER);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_12);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_DPAD_UP);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_13);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_DPAD_DOWN);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_14);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_DPAD_LEFT);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_15);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_DPAD_RIGHT);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_MAX);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_SDL_BUTTONS);
|
||||||
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_CIRCLE);
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_X);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_X);
|
||||||
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_CROSS);
|
||||||
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_CIRCLE);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_SQUARE);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_SQUARE);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_TRIANGLE);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_TRIANGLE);
|
||||||
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_SELECT);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_B);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_START);
|
||||||
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_PS);
|
||||||
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_L1);
|
||||||
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_R1);
|
||||||
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_L3);
|
||||||
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_R3);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_A);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_A);
|
||||||
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_B);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_X);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_X);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_Y);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_Y);
|
||||||
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_BACK);
|
||||||
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_START);
|
||||||
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_HOME);
|
||||||
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_LS);
|
||||||
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_RS);
|
||||||
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_LB);
|
||||||
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_RB);
|
||||||
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_MAX);
|
||||||
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_DS_A);
|
// Joypad axes
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_DS_B);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_INVALID_AXIS);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_DS_X);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_LEFT_X);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_DS_Y);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_LEFT_Y);
|
||||||
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_RIGHT_X);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_VR_GRIP);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_RIGHT_Y);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_VR_PAD);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_TRIGGER_LEFT);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_VR_TRIGGER);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_TRIGGER_RIGHT);
|
||||||
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_SDL_AXES);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_OCULUS_AX);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_0_X);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_OCULUS_BY);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_0_Y);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_OCULUS_MENU);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_1_X);
|
||||||
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_1_Y);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_OPENVR_MENU);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_2_X);
|
||||||
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_2_Y);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_SELECT);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_3_X);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_START);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_3_Y);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_DPAD_UP);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_4_X);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_DPAD_DOWN);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_4_Y);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_DPAD_LEFT);
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_DPAD_RIGHT);
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_L);
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_L2);
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_L3);
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_R);
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_R2);
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_R3);
|
|
||||||
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_0);
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_1);
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_2);
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_3);
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_4);
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_5);
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_6);
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_7);
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_8);
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_9);
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_MAX);
|
BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_MAX);
|
||||||
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_ANALOG_LX);
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_ANALOG_LY);
|
|
||||||
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_ANALOG_RX);
|
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(JOY_ANALOG_RY);
|
|
||||||
|
|
||||||
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
|
// midi
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(MIDI_MESSAGE_NOTE_OFF);
|
BIND_GLOBAL_ENUM_CONSTANT(MIDI_MESSAGE_NOTE_OFF);
|
||||||
BIND_GLOBAL_ENUM_CONSTANT(MIDI_MESSAGE_NOTE_ON);
|
BIND_GLOBAL_ENUM_CONSTANT(MIDI_MESSAGE_NOTE_ON);
|
||||||
|
@ -39,6 +39,87 @@
|
|||||||
#include "editor/editor_settings.h"
|
#include "editor/editor_settings.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const char *_joy_buttons[JOY_SDL_BUTTONS + 1] = {
|
||||||
|
"a",
|
||||||
|
"b",
|
||||||
|
"x",
|
||||||
|
"y",
|
||||||
|
"back",
|
||||||
|
"guide",
|
||||||
|
"start",
|
||||||
|
"leftstick",
|
||||||
|
"rightstick",
|
||||||
|
"leftshoulder",
|
||||||
|
"rightshoulder",
|
||||||
|
"dpup",
|
||||||
|
"dpdown",
|
||||||
|
"dpleft",
|
||||||
|
"dpright",
|
||||||
|
nullptr
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char *_joy_button_names[JOY_BUTTON_MAX] = {
|
||||||
|
"Face Bottom",
|
||||||
|
"Face Right",
|
||||||
|
"Face Left",
|
||||||
|
"Face Top",
|
||||||
|
"Select",
|
||||||
|
"Guide",
|
||||||
|
"Start",
|
||||||
|
"Left Stick",
|
||||||
|
"Right Stick",
|
||||||
|
"Left Shoulder",
|
||||||
|
"Right Shoulder",
|
||||||
|
"D-Pad Up",
|
||||||
|
"D-Pad Down",
|
||||||
|
"D-Pad Left",
|
||||||
|
"D-Pad Right",
|
||||||
|
"Button 15",
|
||||||
|
"Button 16",
|
||||||
|
"Button 17",
|
||||||
|
"Button 18",
|
||||||
|
"Button 19",
|
||||||
|
"Button 20",
|
||||||
|
"Button 21",
|
||||||
|
"Button 22",
|
||||||
|
"Button 23",
|
||||||
|
"Button 24",
|
||||||
|
"Button 25",
|
||||||
|
"Button 26",
|
||||||
|
"Button 27",
|
||||||
|
"Button 28",
|
||||||
|
"Button 29",
|
||||||
|
"Button 30",
|
||||||
|
"Button 31",
|
||||||
|
"Button 32",
|
||||||
|
"Button 33",
|
||||||
|
"Button 34",
|
||||||
|
"Button 35"
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char *_joy_axes[JOY_SDL_AXES + 1] = {
|
||||||
|
"leftx",
|
||||||
|
"lefty",
|
||||||
|
"rightx",
|
||||||
|
"righty",
|
||||||
|
"lefttrigger",
|
||||||
|
"righttrigger",
|
||||||
|
nullptr
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char *_joy_axis_names[JOY_AXIS_MAX] = {
|
||||||
|
"Left Stick X",
|
||||||
|
"Left Stick Y",
|
||||||
|
"Right Stick X",
|
||||||
|
"Right Stick Y",
|
||||||
|
"Left Trigger",
|
||||||
|
"Right Trigger",
|
||||||
|
"Joystick 3 Stick X",
|
||||||
|
"Joystick 3 Stick Y",
|
||||||
|
"Joystick 4 Stick X",
|
||||||
|
"Joystick 4 Stick Y"
|
||||||
|
};
|
||||||
|
|
||||||
Input *Input::singleton = nullptr;
|
Input *Input::singleton = nullptr;
|
||||||
|
|
||||||
void (*Input::set_mouse_mode_func)(Input::MouseMode) = nullptr;
|
void (*Input::set_mouse_mode_func)(Input::MouseMode) = nullptr;
|
||||||
@ -336,13 +417,12 @@ void Input::joy_connection_changed(int p_idx, bool p_connected, String p_name, S
|
|||||||
} else {
|
} else {
|
||||||
js.connected = false;
|
js.connected = false;
|
||||||
for (int i = 0; i < JOY_BUTTON_MAX; i++) {
|
for (int i = 0; i < JOY_BUTTON_MAX; i++) {
|
||||||
|
|
||||||
if (i < JOY_AXIS_MAX)
|
|
||||||
set_joy_axis(p_idx, i, 0.0f);
|
|
||||||
|
|
||||||
int c = _combine_device(i, p_idx);
|
int c = _combine_device(i, p_idx);
|
||||||
joy_buttons_pressed.erase(c);
|
joy_buttons_pressed.erase(c);
|
||||||
};
|
}
|
||||||
|
for (int i = 0; i < JOY_AXIS_MAX; i++) {
|
||||||
|
set_joy_axis(p_idx, i, 0.0f);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
joy_names[p_idx] = js;
|
joy_names[p_idx] = js;
|
||||||
|
|
||||||
@ -892,23 +972,17 @@ void Input::joy_axis(int p_device, int p_axis, const JoyAxis &p_value) {
|
|||||||
JoyEvent map = _get_mapped_axis_event(map_db[joy.mapping], p_axis);
|
JoyEvent map = _get_mapped_axis_event(map_db[joy.mapping], p_axis);
|
||||||
|
|
||||||
if (map.type == TYPE_BUTTON) {
|
if (map.type == TYPE_BUTTON) {
|
||||||
//send axis event for triggers
|
|
||||||
if (map.index == JOY_L2 || map.index == JOY_R2) {
|
|
||||||
float value = p_value.min == 0 ? p_value.value : 0.5f + p_value.value / 2.0f;
|
|
||||||
int axis = map.index == JOY_L2 ? JOY_ANALOG_L2 : JOY_ANALOG_R2;
|
|
||||||
_axis_event(p_device, axis, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (map.index == JOY_DPAD_UP || map.index == JOY_DPAD_DOWN) {
|
if (map.index == JOY_BUTTON_DPAD_UP || map.index == JOY_BUTTON_DPAD_DOWN) {
|
||||||
bool pressed = p_value.value != 0.0f;
|
bool pressed = p_value.value != 0.0f;
|
||||||
int button = p_value.value < 0 ? JOY_DPAD_UP : JOY_DPAD_DOWN;
|
int button = p_value.value < 0 ? JOY_BUTTON_DPAD_UP : JOY_BUTTON_DPAD_DOWN;
|
||||||
|
|
||||||
if (!pressed) {
|
if (!pressed) {
|
||||||
if (joy_buttons_pressed.has(_combine_device(JOY_DPAD_UP, p_device))) {
|
if (joy_buttons_pressed.has(_combine_device(JOY_BUTTON_DPAD_UP, p_device))) {
|
||||||
_button_event(p_device, JOY_DPAD_UP, false);
|
_button_event(p_device, JOY_BUTTON_DPAD_UP, false);
|
||||||
}
|
}
|
||||||
if (joy_buttons_pressed.has(_combine_device(JOY_DPAD_DOWN, p_device))) {
|
if (joy_buttons_pressed.has(_combine_device(JOY_BUTTON_DPAD_DOWN, p_device))) {
|
||||||
_button_event(p_device, JOY_DPAD_DOWN, false);
|
_button_event(p_device, JOY_BUTTON_DPAD_DOWN, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pressed == joy_buttons_pressed.has(_combine_device(button, p_device))) {
|
if (pressed == joy_buttons_pressed.has(_combine_device(button, p_device))) {
|
||||||
@ -917,16 +991,17 @@ void Input::joy_axis(int p_device, int p_axis, const JoyAxis &p_value) {
|
|||||||
_button_event(p_device, button, true);
|
_button_event(p_device, button, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (map.index == JOY_DPAD_LEFT || map.index == JOY_DPAD_RIGHT) {
|
|
||||||
|
if (map.index == JOY_BUTTON_DPAD_LEFT || map.index == JOY_BUTTON_DPAD_RIGHT) {
|
||||||
bool pressed = p_value.value != 0.0f;
|
bool pressed = p_value.value != 0.0f;
|
||||||
int button = p_value.value < 0 ? JOY_DPAD_LEFT : JOY_DPAD_RIGHT;
|
int button = p_value.value < 0 ? JOY_BUTTON_DPAD_LEFT : JOY_BUTTON_DPAD_RIGHT;
|
||||||
|
|
||||||
if (!pressed) {
|
if (!pressed) {
|
||||||
if (joy_buttons_pressed.has(_combine_device(JOY_DPAD_LEFT, p_device))) {
|
if (joy_buttons_pressed.has(_combine_device(JOY_BUTTON_DPAD_LEFT, p_device))) {
|
||||||
_button_event(p_device, JOY_DPAD_LEFT, false);
|
_button_event(p_device, JOY_BUTTON_DPAD_LEFT, false);
|
||||||
}
|
}
|
||||||
if (joy_buttons_pressed.has(_combine_device(JOY_DPAD_RIGHT, p_device))) {
|
if (joy_buttons_pressed.has(_combine_device(JOY_BUTTON_DPAD_RIGHT, p_device))) {
|
||||||
_button_event(p_device, JOY_DPAD_RIGHT, false);
|
_button_event(p_device, JOY_BUTTON_DPAD_RIGHT, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pressed == joy_buttons_pressed.has(_combine_device(button, p_device))) {
|
if (pressed == joy_buttons_pressed.has(_combine_device(button, p_device))) {
|
||||||
@ -935,12 +1010,14 @@ void Input::joy_axis(int p_device, int p_axis, const JoyAxis &p_value) {
|
|||||||
_button_event(p_device, button, true);
|
_button_event(p_device, button, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float deadzone = p_value.min == 0 ? 0.5f : 0.0f;
|
float deadzone = p_value.min == 0 ? 0.5f : 0.0f;
|
||||||
bool pressed = p_value.value > deadzone;
|
bool pressed = p_value.value > deadzone;
|
||||||
if (pressed == joy_buttons_pressed.has(_combine_device(map.index, p_device))) {
|
if (pressed == joy_buttons_pressed.has(_combine_device(map.index, p_device))) {
|
||||||
// button already pressed or released, this is an axis bounce value
|
// button already pressed or released, this is an axis bounce value
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_button_event(p_device, map.index, pressed);
|
_button_event(p_device, map.index, pressed);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -961,19 +1038,19 @@ void Input::joy_hat(int p_device, int p_val) {
|
|||||||
JoyEvent map[HAT_MAX];
|
JoyEvent map[HAT_MAX];
|
||||||
|
|
||||||
map[HAT_UP].type = TYPE_BUTTON;
|
map[HAT_UP].type = TYPE_BUTTON;
|
||||||
map[HAT_UP].index = SDL_BUTTON_DPAD_UP;
|
map[HAT_UP].index = JOY_BUTTON_DPAD_UP;
|
||||||
map[HAT_UP].value = 0;
|
map[HAT_UP].value = 0;
|
||||||
|
|
||||||
map[HAT_RIGHT].type = TYPE_BUTTON;
|
map[HAT_RIGHT].type = TYPE_BUTTON;
|
||||||
map[HAT_RIGHT].index = SDL_BUTTON_DPAD_RIGHT;
|
map[HAT_RIGHT].index = JOY_BUTTON_DPAD_RIGHT;
|
||||||
map[HAT_RIGHT].value = 0;
|
map[HAT_RIGHT].value = 0;
|
||||||
|
|
||||||
map[HAT_DOWN].type = TYPE_BUTTON;
|
map[HAT_DOWN].type = TYPE_BUTTON;
|
||||||
map[HAT_DOWN].index = SDL_BUTTON_DPAD_DOWN;
|
map[HAT_DOWN].index = JOY_BUTTON_DPAD_DOWN;
|
||||||
map[HAT_DOWN].value = 0;
|
map[HAT_DOWN].value = 0;
|
||||||
|
|
||||||
map[HAT_LEFT].type = TYPE_BUTTON;
|
map[HAT_LEFT].type = TYPE_BUTTON;
|
||||||
map[HAT_LEFT].index = SDL_BUTTON_DPAD_LEFT;
|
map[HAT_LEFT].index = JOY_BUTTON_DPAD_LEFT;
|
||||||
map[HAT_LEFT].value = 0;
|
map[HAT_LEFT].value = 0;
|
||||||
|
|
||||||
if (joy.mapping != -1) {
|
if (joy.mapping != -1) {
|
||||||
@ -1027,7 +1104,7 @@ Input::JoyEvent Input::_get_mapped_button_event(const JoyDeviceMapping &mapping,
|
|||||||
event.type = TYPE_MAX;
|
event.type = TYPE_MAX;
|
||||||
|
|
||||||
for (int i = 0; i < mapping.bindings.size(); i++) {
|
for (int i = 0; i < mapping.bindings.size(); i++) {
|
||||||
const SDLExtendedJoyBind binding = mapping.bindings[i];
|
const JoyBinding binding = mapping.bindings[i];
|
||||||
if (binding.inputType == TYPE_BUTTON && binding.input.button == p_button) {
|
if (binding.inputType == TYPE_BUTTON && binding.input.button == p_button) {
|
||||||
event.type = binding.outputType;
|
event.type = binding.outputType;
|
||||||
switch (binding.outputType) {
|
switch (binding.outputType) {
|
||||||
@ -1051,7 +1128,7 @@ Input::JoyEvent Input::_get_mapped_axis_event(const JoyDeviceMapping &mapping, i
|
|||||||
event.type = TYPE_MAX;
|
event.type = TYPE_MAX;
|
||||||
|
|
||||||
for (int i = 0; i < mapping.bindings.size(); i++) {
|
for (int i = 0; i < mapping.bindings.size(); i++) {
|
||||||
const SDLExtendedJoyBind binding = mapping.bindings[i];
|
const JoyBinding binding = mapping.bindings[i];
|
||||||
if (binding.inputType == TYPE_AXIS && binding.input.axis.axis == p_axis) {
|
if (binding.inputType == TYPE_AXIS && binding.input.axis.axis == p_axis) {
|
||||||
event.type = binding.outputType;
|
event.type = binding.outputType;
|
||||||
switch (binding.outputType) {
|
switch (binding.outputType) {
|
||||||
@ -1072,7 +1149,7 @@ Input::JoyEvent Input::_get_mapped_axis_event(const JoyDeviceMapping &mapping, i
|
|||||||
void Input::_get_mapped_hat_events(const JoyDeviceMapping &mapping, int p_hat, JoyEvent r_events[]) {
|
void Input::_get_mapped_hat_events(const JoyDeviceMapping &mapping, int p_hat, JoyEvent r_events[]) {
|
||||||
|
|
||||||
for (int i = 0; i < mapping.bindings.size(); i++) {
|
for (int i = 0; i < mapping.bindings.size(); i++) {
|
||||||
const SDLExtendedJoyBind binding = mapping.bindings[i];
|
const JoyBinding binding = mapping.bindings[i];
|
||||||
if (binding.inputType == TYPE_HAT && binding.input.hat.hat == p_hat) {
|
if (binding.inputType == TYPE_HAT && binding.input.hat.hat == p_hat) {
|
||||||
|
|
||||||
int index;
|
int index;
|
||||||
@ -1109,51 +1186,22 @@ void Input::_get_mapped_hat_events(const JoyDeviceMapping &mapping, int p_hat, J
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *sdl_buttons[] = {
|
JoyButtonList Input::_get_output_button(String output) {
|
||||||
"a",
|
|
||||||
"b",
|
|
||||||
"x",
|
|
||||||
"y",
|
|
||||||
"back",
|
|
||||||
"guide",
|
|
||||||
"start",
|
|
||||||
"leftstick",
|
|
||||||
"rightstick",
|
|
||||||
"leftshoulder",
|
|
||||||
"rightshoulder",
|
|
||||||
"dpup",
|
|
||||||
"dpdown",
|
|
||||||
"dpleft",
|
|
||||||
"dpright",
|
|
||||||
nullptr
|
|
||||||
};
|
|
||||||
|
|
||||||
Input::SDLJoyButton Input::_get_output_button(String output) {
|
for (int i = 0; _joy_buttons[i]; i++) {
|
||||||
|
if (output == _joy_buttons[i])
|
||||||
for (int i = 0; sdl_buttons[i]; i++) {
|
return JoyButtonList(i);
|
||||||
if (output == sdl_buttons[i])
|
|
||||||
return SDLJoyButton(i);
|
|
||||||
}
|
}
|
||||||
return SDLJoyButton::SDL_INVALID_BUTTON;
|
return JoyButtonList::JOY_INVALID_BUTTON;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *sdl_axes[] = {
|
JoyAxisList Input::_get_output_axis(String output) {
|
||||||
"leftx",
|
|
||||||
"lefty",
|
|
||||||
"rightx",
|
|
||||||
"righty",
|
|
||||||
"lefttrigger",
|
|
||||||
"righttrigger",
|
|
||||||
nullptr
|
|
||||||
};
|
|
||||||
|
|
||||||
Input::SDLJoyAxis Input::_get_output_axis(String output) {
|
for (int i = 0; _joy_axes[i]; i++) {
|
||||||
|
if (output == _joy_axes[i])
|
||||||
for (int i = 0; sdl_axes[i]; i++) {
|
return JoyAxisList(i);
|
||||||
if (output == sdl_axes[i])
|
|
||||||
return SDLJoyAxis(i);
|
|
||||||
}
|
}
|
||||||
return SDLJoyAxis::SDL_INVALID_AXIS;
|
return JoyAxisList::JOY_INVALID_AXIS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Input::parse_mapping(String p_mapping) {
|
void Input::parse_mapping(String p_mapping) {
|
||||||
@ -1208,18 +1256,18 @@ void Input::parse_mapping(String p_mapping) {
|
|||||||
if (input[input.length() - 1] == '~')
|
if (input[input.length() - 1] == '~')
|
||||||
invert_axis = true;
|
invert_axis = true;
|
||||||
|
|
||||||
SDLJoyButton output_button = _get_output_button(output);
|
JoyButtonList output_button = _get_output_button(output);
|
||||||
SDLJoyAxis output_axis = _get_output_axis(output);
|
JoyAxisList output_axis = _get_output_axis(output);
|
||||||
ERR_CONTINUE_MSG(output_button == SDL_INVALID_BUTTON && output_axis == SDL_INVALID_AXIS,
|
ERR_CONTINUE_MSG(output_button == JOY_INVALID_BUTTON && output_axis == JOY_INVALID_AXIS,
|
||||||
String(entry[idx] + "\nUnrecognised output string: " + output));
|
String(entry[idx] + "\nUnrecognised output string: " + output));
|
||||||
ERR_CONTINUE_MSG(output_button != SDL_INVALID_BUTTON && output_axis != SDL_INVALID_AXIS,
|
ERR_CONTINUE_MSG(output_button != JOY_INVALID_BUTTON && output_axis != JOY_INVALID_AXIS,
|
||||||
String("BUG: Output string matched both button and axis: " + output));
|
String("BUG: Output string matched both button and axis: " + output));
|
||||||
|
|
||||||
SDLExtendedJoyBind binding;
|
JoyBinding binding;
|
||||||
if (output_button != SDL_INVALID_BUTTON) {
|
if (output_button != JOY_INVALID_BUTTON) {
|
||||||
binding.outputType = TYPE_BUTTON;
|
binding.outputType = TYPE_BUTTON;
|
||||||
binding.output.button = output_button;
|
binding.output.button = output_button;
|
||||||
} else if (output_axis != SDL_INVALID_AXIS) {
|
} else if (output_axis != JOY_INVALID_AXIS) {
|
||||||
binding.outputType = TYPE_AXIS;
|
binding.outputType = TYPE_AXIS;
|
||||||
binding.output.axis.axis = output_axis;
|
binding.output.axis.axis = output_axis;
|
||||||
binding.output.axis.range = output_range;
|
binding.output.axis.range = output_range;
|
||||||
@ -1316,50 +1364,18 @@ Array Input::get_connected_joypads() {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *_buttons[JOY_BUTTON_MAX] = {
|
|
||||||
"Face Button Bottom",
|
|
||||||
"Face Button Right",
|
|
||||||
"Face Button Left",
|
|
||||||
"Face Button Top",
|
|
||||||
"L",
|
|
||||||
"R",
|
|
||||||
"L2",
|
|
||||||
"R2",
|
|
||||||
"L3",
|
|
||||||
"R3",
|
|
||||||
"Select",
|
|
||||||
"Start",
|
|
||||||
"DPAD Up",
|
|
||||||
"DPAD Down",
|
|
||||||
"DPAD Left",
|
|
||||||
"DPAD Right"
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char *_axes[JOY_AXIS_MAX] = {
|
|
||||||
"Left Stick X",
|
|
||||||
"Left Stick Y",
|
|
||||||
"Right Stick X",
|
|
||||||
"Right Stick Y",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
"L2",
|
|
||||||
"R2",
|
|
||||||
"",
|
|
||||||
""
|
|
||||||
};
|
|
||||||
|
|
||||||
String Input::get_joy_button_string(int p_button) {
|
String Input::get_joy_button_string(int p_button) {
|
||||||
ERR_FAIL_INDEX_V(p_button, JOY_BUTTON_MAX, "");
|
ERR_FAIL_INDEX_V(p_button, JOY_BUTTON_MAX, "Invalid button");
|
||||||
return _buttons[p_button];
|
return _joy_button_names[p_button];
|
||||||
}
|
}
|
||||||
|
|
||||||
int Input::get_joy_button_index_from_string(String p_button) {
|
int Input::get_joy_button_index_from_string(String p_button) {
|
||||||
for (int i = 0; i < JOY_BUTTON_MAX; i++) {
|
for (int i = 0; i < JOY_BUTTON_MAX; i++) {
|
||||||
if (p_button == _buttons[i]) {
|
if (p_button == _joy_button_names[i]) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ERR_FAIL_V(-1);
|
ERR_FAIL_V(JOY_INVALID_BUTTON);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Input::get_unused_joy_id() {
|
int Input::get_unused_joy_id() {
|
||||||
@ -1372,17 +1388,17 @@ int Input::get_unused_joy_id() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String Input::get_joy_axis_string(int p_axis) {
|
String Input::get_joy_axis_string(int p_axis) {
|
||||||
ERR_FAIL_INDEX_V(p_axis, JOY_AXIS_MAX, "");
|
ERR_FAIL_INDEX_V(p_axis, JOY_AXIS_MAX, "Invalid axis");
|
||||||
return _axes[p_axis];
|
return _joy_axis_names[p_axis];
|
||||||
}
|
}
|
||||||
|
|
||||||
int Input::get_joy_axis_index_from_string(String p_axis) {
|
int Input::get_joy_axis_index_from_string(String p_axis) {
|
||||||
for (int i = 0; i < JOY_AXIS_MAX; i++) {
|
for (int i = 0; i < JOY_AXIS_MAX; i++) {
|
||||||
if (p_axis == _axes[i]) {
|
if (p_axis == _joy_axis_names[i]) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ERR_FAIL_V(-1);
|
ERR_FAIL_V(JOY_INVALID_AXIS);
|
||||||
}
|
}
|
||||||
|
|
||||||
Input::Input() {
|
Input::Input() {
|
||||||
|
@ -145,7 +145,7 @@ private:
|
|||||||
StringName name;
|
StringName name;
|
||||||
StringName uid;
|
StringName uid;
|
||||||
bool connected;
|
bool connected;
|
||||||
bool last_buttons[JOY_BUTTON_MAX + 19]; //apparently SDL specifies 35 possible buttons on android
|
bool last_buttons[JOY_BUTTON_MAX];
|
||||||
float last_axis[JOY_AXIS_MAX];
|
float last_axis[JOY_AXIS_MAX];
|
||||||
float filter;
|
float filter;
|
||||||
int last_hat;
|
int last_hat;
|
||||||
@ -154,11 +154,9 @@ private:
|
|||||||
|
|
||||||
Joypad() {
|
Joypad() {
|
||||||
for (int i = 0; i < JOY_AXIS_MAX; i++) {
|
for (int i = 0; i < JOY_AXIS_MAX; i++) {
|
||||||
|
|
||||||
last_axis[i] = 0.0f;
|
last_axis[i] = 0.0f;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < JOY_BUTTON_MAX + 19; i++) {
|
for (int i = 0; i < JOY_BUTTON_MAX; i++) {
|
||||||
|
|
||||||
last_buttons[i] = false;
|
last_buttons[i] = false;
|
||||||
}
|
}
|
||||||
connected = false;
|
connected = false;
|
||||||
@ -183,37 +181,6 @@ private:
|
|||||||
TYPE_MAX,
|
TYPE_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SDLJoyButton {
|
|
||||||
SDL_INVALID_BUTTON = -1,
|
|
||||||
SDL_BUTTON_A,
|
|
||||||
SDL_BUTTON_B,
|
|
||||||
SDL_BUTTON_X,
|
|
||||||
SDL_BUTTON_Y,
|
|
||||||
SDL_BUTTON_BACK,
|
|
||||||
SDL_BUTTON_GUIDE,
|
|
||||||
SDL_BUTTON_START,
|
|
||||||
SDL_BUTTON_LEFTSTICK,
|
|
||||||
SDL_BUTTON_RIGHTSTICK,
|
|
||||||
SDL_BUTTON_LEFTSHOULDER,
|
|
||||||
SDL_BUTTON_RIGHTSHOULDER,
|
|
||||||
SDL_BUTTON_DPAD_UP,
|
|
||||||
SDL_BUTTON_DPAD_DOWN,
|
|
||||||
SDL_BUTTON_DPAD_LEFT,
|
|
||||||
SDL_BUTTON_DPAD_RIGHT,
|
|
||||||
SDL_BUTTON_MAX
|
|
||||||
};
|
|
||||||
|
|
||||||
enum SDLJoyAxis {
|
|
||||||
SDL_INVALID_AXIS = -1,
|
|
||||||
SDL_AXIS_LEFTX,
|
|
||||||
SDL_AXIS_LEFTY,
|
|
||||||
SDL_AXIS_RIGHTX,
|
|
||||||
SDL_AXIS_RIGHTY,
|
|
||||||
SDL_AXIS_TRIGGERLEFT,
|
|
||||||
SDL_AXIS_TRIGGERRIGHT,
|
|
||||||
SDL_AXIS_MAX,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum JoyAxisRange {
|
enum JoyAxisRange {
|
||||||
NEGATIVE_HALF_AXIS = -1,
|
NEGATIVE_HALF_AXIS = -1,
|
||||||
FULL_AXIS = 0,
|
FULL_AXIS = 0,
|
||||||
@ -226,7 +193,7 @@ private:
|
|||||||
int value;
|
int value;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SDLExtendedJoyBind {
|
struct JoyBinding {
|
||||||
JoyType inputType;
|
JoyType inputType;
|
||||||
union {
|
union {
|
||||||
int button;
|
int button;
|
||||||
@ -245,10 +212,10 @@ private:
|
|||||||
|
|
||||||
JoyType outputType;
|
JoyType outputType;
|
||||||
union {
|
union {
|
||||||
SDLJoyButton button;
|
JoyButtonList button;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
SDLJoyAxis axis;
|
JoyAxisList axis;
|
||||||
JoyAxisRange range;
|
JoyAxisRange range;
|
||||||
} axis;
|
} axis;
|
||||||
|
|
||||||
@ -258,7 +225,7 @@ private:
|
|||||||
struct JoyDeviceMapping {
|
struct JoyDeviceMapping {
|
||||||
String uid;
|
String uid;
|
||||||
String name;
|
String name;
|
||||||
Vector<SDLExtendedJoyBind> bindings;
|
Vector<JoyBinding> bindings;
|
||||||
};
|
};
|
||||||
|
|
||||||
Vector<JoyDeviceMapping> map_db;
|
Vector<JoyDeviceMapping> map_db;
|
||||||
@ -266,8 +233,8 @@ private:
|
|||||||
JoyEvent _get_mapped_button_event(const JoyDeviceMapping &mapping, int p_button);
|
JoyEvent _get_mapped_button_event(const JoyDeviceMapping &mapping, int p_button);
|
||||||
JoyEvent _get_mapped_axis_event(const JoyDeviceMapping &mapping, int p_axis);
|
JoyEvent _get_mapped_axis_event(const JoyDeviceMapping &mapping, int p_axis);
|
||||||
void _get_mapped_hat_events(const JoyDeviceMapping &mapping, int p_hat, JoyEvent r_events[HAT_MAX]);
|
void _get_mapped_hat_events(const JoyDeviceMapping &mapping, int p_hat, JoyEvent r_events[HAT_MAX]);
|
||||||
SDLJoyButton _get_output_button(String output);
|
JoyButtonList _get_output_button(String output);
|
||||||
SDLJoyAxis _get_output_axis(String output);
|
JoyAxisList _get_output_axis(String output);
|
||||||
void _button_event(int p_device, int p_index, bool p_pressed);
|
void _button_event(int p_device, int p_index, bool p_pressed);
|
||||||
void _axis_event(int p_device, int p_axis, float p_value);
|
void _axis_event(int p_device, int p_axis, float p_value);
|
||||||
float _handle_deadzone(int p_device, int p_axis, float p_value);
|
float _handle_deadzone(int p_device, int p_axis, float p_value);
|
||||||
|
@ -59,98 +59,84 @@ enum ButtonList {
|
|||||||
BUTTON_MASK_XBUTTON2 = (1 << (BUTTON_XBUTTON2 - 1))
|
BUTTON_MASK_XBUTTON2 = (1 << (BUTTON_XBUTTON2 - 1))
|
||||||
};
|
};
|
||||||
|
|
||||||
enum JoystickList {
|
enum JoyButtonList {
|
||||||
|
|
||||||
JOY_BUTTON_0 = 0,
|
JOY_INVALID_BUTTON = -1,
|
||||||
JOY_BUTTON_1 = 1,
|
|
||||||
JOY_BUTTON_2 = 2,
|
|
||||||
JOY_BUTTON_3 = 3,
|
|
||||||
JOY_BUTTON_4 = 4,
|
|
||||||
JOY_BUTTON_5 = 5,
|
|
||||||
JOY_BUTTON_6 = 6,
|
|
||||||
JOY_BUTTON_7 = 7,
|
|
||||||
JOY_BUTTON_8 = 8,
|
|
||||||
JOY_BUTTON_9 = 9,
|
|
||||||
JOY_BUTTON_10 = 10,
|
|
||||||
JOY_BUTTON_11 = 11,
|
|
||||||
JOY_BUTTON_12 = 12,
|
|
||||||
JOY_BUTTON_13 = 13,
|
|
||||||
JOY_BUTTON_14 = 14,
|
|
||||||
JOY_BUTTON_15 = 15,
|
|
||||||
JOY_BUTTON_MAX = 16,
|
|
||||||
|
|
||||||
JOY_L = JOY_BUTTON_4,
|
// SDL Buttons
|
||||||
JOY_R = JOY_BUTTON_5,
|
JOY_BUTTON_A = 0,
|
||||||
JOY_L2 = JOY_BUTTON_6,
|
JOY_BUTTON_B = 1,
|
||||||
JOY_R2 = JOY_BUTTON_7,
|
JOY_BUTTON_X = 2,
|
||||||
JOY_L3 = JOY_BUTTON_8,
|
JOY_BUTTON_Y = 3,
|
||||||
JOY_R3 = JOY_BUTTON_9,
|
JOY_BUTTON_BACK = 4,
|
||||||
JOY_SELECT = JOY_BUTTON_10,
|
JOY_BUTTON_GUIDE = 5,
|
||||||
JOY_START = JOY_BUTTON_11,
|
JOY_BUTTON_START = 6,
|
||||||
JOY_DPAD_UP = JOY_BUTTON_12,
|
JOY_BUTTON_LEFT_STICK = 7,
|
||||||
JOY_DPAD_DOWN = JOY_BUTTON_13,
|
JOY_BUTTON_RIGHT_STICK = 8,
|
||||||
JOY_DPAD_LEFT = JOY_BUTTON_14,
|
JOY_BUTTON_LEFT_SHOULDER = 9,
|
||||||
JOY_DPAD_RIGHT = JOY_BUTTON_15,
|
JOY_BUTTON_RIGHT_SHOULDER = 10,
|
||||||
|
JOY_BUTTON_DPAD_UP = 11,
|
||||||
|
JOY_BUTTON_DPAD_DOWN = 12,
|
||||||
|
JOY_BUTTON_DPAD_LEFT = 13,
|
||||||
|
JOY_BUTTON_DPAD_RIGHT = 14,
|
||||||
|
JOY_SDL_BUTTONS = 15,
|
||||||
|
|
||||||
JOY_SONY_CIRCLE = JOY_BUTTON_1,
|
// Sony Buttons
|
||||||
JOY_SONY_X = JOY_BUTTON_0,
|
JOY_SONY_X = JOY_BUTTON_A,
|
||||||
JOY_SONY_SQUARE = JOY_BUTTON_2,
|
JOY_SONY_CROSS = JOY_BUTTON_A,
|
||||||
JOY_SONY_TRIANGLE = JOY_BUTTON_3,
|
JOY_SONY_CIRCLE = JOY_BUTTON_B,
|
||||||
|
JOY_SONY_SQUARE = JOY_BUTTON_X,
|
||||||
|
JOY_SONY_TRIANGLE = JOY_BUTTON_Y,
|
||||||
|
JOY_SONY_SELECT = JOY_BUTTON_BACK,
|
||||||
|
JOY_SONY_START = JOY_BUTTON_START,
|
||||||
|
JOY_SONY_PS = JOY_BUTTON_GUIDE,
|
||||||
|
JOY_SONY_L1 = JOY_BUTTON_LEFT_SHOULDER,
|
||||||
|
JOY_SONY_R1 = JOY_BUTTON_RIGHT_SHOULDER,
|
||||||
|
JOY_SONY_L3 = JOY_BUTTON_LEFT_STICK,
|
||||||
|
JOY_SONY_R3 = JOY_BUTTON_RIGHT_STICK,
|
||||||
|
|
||||||
JOY_XBOX_A = JOY_BUTTON_0,
|
// Xbox Buttons
|
||||||
JOY_XBOX_B = JOY_BUTTON_1,
|
JOY_XBOX_A = JOY_BUTTON_A,
|
||||||
JOY_XBOX_X = JOY_BUTTON_2,
|
JOY_XBOX_B = JOY_BUTTON_B,
|
||||||
JOY_XBOX_Y = JOY_BUTTON_3,
|
JOY_XBOX_X = JOY_BUTTON_X,
|
||||||
|
JOY_XBOX_Y = JOY_BUTTON_Y,
|
||||||
|
JOY_XBOX_BACK = JOY_BUTTON_BACK,
|
||||||
|
JOY_XBOX_START = JOY_BUTTON_START,
|
||||||
|
JOY_XBOX_HOME = JOY_BUTTON_GUIDE,
|
||||||
|
JOY_XBOX_LS = JOY_BUTTON_LEFT_STICK,
|
||||||
|
JOY_XBOX_RS = JOY_BUTTON_RIGHT_STICK,
|
||||||
|
JOY_XBOX_LB = JOY_BUTTON_LEFT_SHOULDER,
|
||||||
|
JOY_XBOX_RB = JOY_BUTTON_RIGHT_SHOULDER,
|
||||||
|
|
||||||
JOY_DS_A = JOY_BUTTON_1,
|
JOY_BUTTON_MAX = 36 // Apparently Android supports up to 36 buttons.
|
||||||
JOY_DS_B = JOY_BUTTON_0,
|
};
|
||||||
JOY_DS_X = JOY_BUTTON_3,
|
|
||||||
JOY_DS_Y = JOY_BUTTON_2,
|
|
||||||
|
|
||||||
JOY_WII_C = JOY_BUTTON_5,
|
enum JoyAxisList {
|
||||||
JOY_WII_Z = JOY_BUTTON_6,
|
|
||||||
|
|
||||||
JOY_WII_MINUS = JOY_BUTTON_10,
|
JOY_INVALID_AXIS = -1,
|
||||||
JOY_WII_PLUS = JOY_BUTTON_11,
|
|
||||||
|
|
||||||
JOY_VR_GRIP = JOY_BUTTON_2,
|
// SDL Axes
|
||||||
JOY_VR_PAD = JOY_BUTTON_14,
|
JOY_AXIS_LEFT_X = 0,
|
||||||
JOY_VR_TRIGGER = JOY_BUTTON_15,
|
JOY_AXIS_LEFT_Y = 1,
|
||||||
|
JOY_AXIS_RIGHT_X = 2,
|
||||||
|
JOY_AXIS_RIGHT_Y = 3,
|
||||||
|
JOY_AXIS_TRIGGER_LEFT = 4,
|
||||||
|
JOY_AXIS_TRIGGER_RIGHT = 5,
|
||||||
|
JOY_SDL_AXES = 6,
|
||||||
|
|
||||||
JOY_OCULUS_AX = JOY_BUTTON_7,
|
// Joystick axes.
|
||||||
JOY_OCULUS_BY = JOY_BUTTON_1,
|
JOY_AXIS_0_X = 0,
|
||||||
JOY_OCULUS_MENU = JOY_BUTTON_3,
|
JOY_AXIS_0_Y = 1,
|
||||||
|
JOY_AXIS_1_X = 2,
|
||||||
|
JOY_AXIS_1_Y = 3,
|
||||||
|
JOY_AXIS_2_X = 4,
|
||||||
|
JOY_AXIS_2_Y = 5,
|
||||||
|
JOY_AXIS_3_X = 6,
|
||||||
|
JOY_AXIS_3_Y = 7,
|
||||||
|
JOY_AXIS_4_X = 8,
|
||||||
|
JOY_AXIS_4_Y = 9,
|
||||||
|
|
||||||
JOY_OPENVR_MENU = JOY_BUTTON_1,
|
JOY_AXIS_MAX = 10 // OpenVR supports up to 5 Joysticks making a total of 10 axes.
|
||||||
|
|
||||||
// end of history
|
|
||||||
|
|
||||||
JOY_AXIS_0 = 0,
|
|
||||||
JOY_AXIS_1 = 1,
|
|
||||||
JOY_AXIS_2 = 2,
|
|
||||||
JOY_AXIS_3 = 3,
|
|
||||||
JOY_AXIS_4 = 4,
|
|
||||||
JOY_AXIS_5 = 5,
|
|
||||||
JOY_AXIS_6 = 6,
|
|
||||||
JOY_AXIS_7 = 7,
|
|
||||||
JOY_AXIS_8 = 8,
|
|
||||||
JOY_AXIS_9 = 9,
|
|
||||||
JOY_AXIS_MAX = 10,
|
|
||||||
|
|
||||||
JOY_ANALOG_LX = JOY_AXIS_0,
|
|
||||||
JOY_ANALOG_LY = JOY_AXIS_1,
|
|
||||||
|
|
||||||
JOY_ANALOG_RX = JOY_AXIS_2,
|
|
||||||
JOY_ANALOG_RY = JOY_AXIS_3,
|
|
||||||
|
|
||||||
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 {
|
enum MidiMessageList {
|
||||||
|
@ -1037,7 +1037,7 @@ ProjectSettings::ProjectSettings() {
|
|||||||
key->set_keycode(KEY_SPACE);
|
key->set_keycode(KEY_SPACE);
|
||||||
events.push_back(key);
|
events.push_back(key);
|
||||||
joyb.instance();
|
joyb.instance();
|
||||||
joyb->set_button_index(JOY_BUTTON_0);
|
joyb->set_button_index(JOY_BUTTON_A);
|
||||||
events.push_back(joyb);
|
events.push_back(joyb);
|
||||||
action["events"] = events;
|
action["events"] = events;
|
||||||
GLOBAL_DEF("input/ui_accept", action);
|
GLOBAL_DEF("input/ui_accept", action);
|
||||||
@ -1050,7 +1050,7 @@ ProjectSettings::ProjectSettings() {
|
|||||||
key->set_keycode(KEY_SPACE);
|
key->set_keycode(KEY_SPACE);
|
||||||
events.push_back(key);
|
events.push_back(key);
|
||||||
joyb.instance();
|
joyb.instance();
|
||||||
joyb->set_button_index(JOY_BUTTON_3);
|
joyb->set_button_index(JOY_BUTTON_Y);
|
||||||
events.push_back(joyb);
|
events.push_back(joyb);
|
||||||
action["events"] = events;
|
action["events"] = events;
|
||||||
GLOBAL_DEF("input/ui_select", action);
|
GLOBAL_DEF("input/ui_select", action);
|
||||||
@ -1063,7 +1063,7 @@ ProjectSettings::ProjectSettings() {
|
|||||||
key->set_keycode(KEY_ESCAPE);
|
key->set_keycode(KEY_ESCAPE);
|
||||||
events.push_back(key);
|
events.push_back(key);
|
||||||
joyb.instance();
|
joyb.instance();
|
||||||
joyb->set_button_index(JOY_BUTTON_1);
|
joyb->set_button_index(JOY_BUTTON_B);
|
||||||
events.push_back(joyb);
|
events.push_back(joyb);
|
||||||
action["events"] = events;
|
action["events"] = events;
|
||||||
GLOBAL_DEF("input/ui_cancel", action);
|
GLOBAL_DEF("input/ui_cancel", action);
|
||||||
@ -1097,7 +1097,7 @@ ProjectSettings::ProjectSettings() {
|
|||||||
key->set_keycode(KEY_LEFT);
|
key->set_keycode(KEY_LEFT);
|
||||||
events.push_back(key);
|
events.push_back(key);
|
||||||
joyb.instance();
|
joyb.instance();
|
||||||
joyb->set_button_index(JOY_DPAD_LEFT);
|
joyb->set_button_index(JOY_BUTTON_DPAD_LEFT);
|
||||||
events.push_back(joyb);
|
events.push_back(joyb);
|
||||||
action["events"] = events;
|
action["events"] = events;
|
||||||
GLOBAL_DEF("input/ui_left", action);
|
GLOBAL_DEF("input/ui_left", action);
|
||||||
@ -1110,7 +1110,7 @@ ProjectSettings::ProjectSettings() {
|
|||||||
key->set_keycode(KEY_RIGHT);
|
key->set_keycode(KEY_RIGHT);
|
||||||
events.push_back(key);
|
events.push_back(key);
|
||||||
joyb.instance();
|
joyb.instance();
|
||||||
joyb->set_button_index(JOY_DPAD_RIGHT);
|
joyb->set_button_index(JOY_BUTTON_DPAD_RIGHT);
|
||||||
events.push_back(joyb);
|
events.push_back(joyb);
|
||||||
action["events"] = events;
|
action["events"] = events;
|
||||||
GLOBAL_DEF("input/ui_right", action);
|
GLOBAL_DEF("input/ui_right", action);
|
||||||
@ -1123,7 +1123,7 @@ ProjectSettings::ProjectSettings() {
|
|||||||
key->set_keycode(KEY_UP);
|
key->set_keycode(KEY_UP);
|
||||||
events.push_back(key);
|
events.push_back(key);
|
||||||
joyb.instance();
|
joyb.instance();
|
||||||
joyb->set_button_index(JOY_DPAD_UP);
|
joyb->set_button_index(JOY_BUTTON_DPAD_UP);
|
||||||
events.push_back(joyb);
|
events.push_back(joyb);
|
||||||
action["events"] = events;
|
action["events"] = events;
|
||||||
GLOBAL_DEF("input/ui_up", action);
|
GLOBAL_DEF("input/ui_up", action);
|
||||||
@ -1136,7 +1136,7 @@ ProjectSettings::ProjectSettings() {
|
|||||||
key->set_keycode(KEY_DOWN);
|
key->set_keycode(KEY_DOWN);
|
||||||
events.push_back(key);
|
events.push_back(key);
|
||||||
joyb.instance();
|
joyb.instance();
|
||||||
joyb->set_button_index(JOY_DPAD_DOWN);
|
joyb->set_button_index(JOY_BUTTON_DPAD_DOWN);
|
||||||
events.push_back(joyb);
|
events.push_back(joyb);
|
||||||
action["events"] = events;
|
action["events"] = events;
|
||||||
GLOBAL_DEF("input/ui_down", action);
|
GLOBAL_DEF("input/ui_down", action);
|
||||||
|
@ -943,212 +943,185 @@
|
|||||||
<constant name="BUTTON_MASK_XBUTTON2" value="256" enum="ButtonList">
|
<constant name="BUTTON_MASK_XBUTTON2" value="256" enum="ButtonList">
|
||||||
Extra mouse button 2 mask.
|
Extra mouse button 2 mask.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_BUTTON_0" value="0" enum="JoystickList">
|
<constant name="JOY_INVALID_BUTTON" value="-1" enum="JoyButtonList">
|
||||||
Gamepad button 0.
|
An invalid game controller button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_BUTTON_1" value="1" enum="JoystickList">
|
<constant name="JOY_BUTTON_A" value="0" enum="JoyButtonList">
|
||||||
Gamepad button 1.
|
Game controller SDL button A.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_BUTTON_2" value="2" enum="JoystickList">
|
<constant name="JOY_BUTTON_B" value="1" enum="JoyButtonList">
|
||||||
Gamepad button 2.
|
Game controller SDL button B.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_BUTTON_3" value="3" enum="JoystickList">
|
<constant name="JOY_BUTTON_X" value="2" enum="JoyButtonList">
|
||||||
Gamepad button 3.
|
Game controller SDL button X.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_BUTTON_4" value="4" enum="JoystickList">
|
<constant name="JOY_BUTTON_Y" value="3" enum="JoyButtonList">
|
||||||
Gamepad button 4.
|
Game controller SDL button Y.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_BUTTON_5" value="5" enum="JoystickList">
|
<constant name="JOY_BUTTON_BACK" value="4" enum="JoyButtonList">
|
||||||
Gamepad button 5.
|
Game controller SDL back button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_BUTTON_6" value="6" enum="JoystickList">
|
<constant name="JOY_BUTTON_GUIDE" value="5" enum="JoyButtonList">
|
||||||
Gamepad button 6.
|
Game controller SDL guide button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_BUTTON_7" value="7" enum="JoystickList">
|
<constant name="JOY_BUTTON_START" value="6" enum="JoyButtonList">
|
||||||
Gamepad button 7.
|
Game controller SDL start button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_BUTTON_8" value="8" enum="JoystickList">
|
<constant name="JOY_BUTTON_LEFT_STICK" value="7" enum="JoyButtonList">
|
||||||
Gamepad button 8.
|
Game controller SDL left stick button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_BUTTON_9" value="9" enum="JoystickList">
|
<constant name="JOY_BUTTON_RIGHT_STICK" value="8" enum="JoyButtonList">
|
||||||
Gamepad button 9.
|
Game controller SDL right stick button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_BUTTON_10" value="10" enum="JoystickList">
|
<constant name="JOY_BUTTON_LEFT_SHOULDER" value="9" enum="JoyButtonList">
|
||||||
Gamepad button 10.
|
Game controller SDL left shoulder button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_BUTTON_11" value="11" enum="JoystickList">
|
<constant name="JOY_BUTTON_RIGHT_SHOULDER" value="10" enum="JoyButtonList">
|
||||||
Gamepad button 11.
|
Game controller SDL right shoulder button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_BUTTON_12" value="12" enum="JoystickList">
|
<constant name="JOY_BUTTON_DPAD_UP" value="11" enum="JoyButtonList">
|
||||||
Gamepad button 12.
|
Game controller SDL D-pad up button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_BUTTON_13" value="13" enum="JoystickList">
|
<constant name="JOY_BUTTON_DPAD_DOWN" value="12" enum="JoyButtonList">
|
||||||
Gamepad button 13.
|
Game controller SDL D-pad down button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_BUTTON_14" value="14" enum="JoystickList">
|
<constant name="JOY_BUTTON_DPAD_LEFT" value="13" enum="JoyButtonList">
|
||||||
Gamepad button 14.
|
Game controller SDL D-pad left button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_BUTTON_15" value="15" enum="JoystickList">
|
<constant name="JOY_BUTTON_DPAD_RIGHT" value="14" enum="JoyButtonList">
|
||||||
Gamepad button 15.
|
Game controller SDL D-pad right button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_BUTTON_MAX" value="16" enum="JoystickList">
|
<constant name="JOY_SDL_BUTTONS" value="15" enum="JoyButtonList">
|
||||||
Represents the maximum number of joystick buttons supported.
|
The number of SDL game controller buttons.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_SONY_CIRCLE" value="1" enum="JoystickList">
|
<constant name="JOY_SONY_X" value="0" enum="JoyButtonList">
|
||||||
DualShock circle button.
|
Sony DualShock controller X button maps to SDL button A.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_SONY_X" value="0" enum="JoystickList">
|
<constant name="JOY_SONY_CROSS" value="0" enum="JoyButtonList">
|
||||||
DualShock X button.
|
Sony DualShock controller cross button maps to SDL button A.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_SONY_SQUARE" value="2" enum="JoystickList">
|
<constant name="JOY_SONY_CIRCLE" value="1" enum="JoyButtonList">
|
||||||
DualShock square button.
|
Sony DualShock controller circle button maps to SDL button B.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_SONY_TRIANGLE" value="3" enum="JoystickList">
|
<constant name="JOY_SONY_SQUARE" value="2" enum="JoyButtonList">
|
||||||
DualShock triangle button.
|
Sony DualShock controller square button maps to SDL button X.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_XBOX_B" value="1" enum="JoystickList">
|
<constant name="JOY_SONY_TRIANGLE" value="3" enum="JoyButtonList">
|
||||||
Xbox controller B button.
|
Sony DualShock controller triangle button maps to SDL button Y.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_XBOX_A" value="0" enum="JoystickList">
|
<constant name="JOY_SONY_SELECT" value="4" enum="JoyButtonList">
|
||||||
Xbox controller A button.
|
Sony DualShock controller select button maps to SDL back button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_XBOX_X" value="2" enum="JoystickList">
|
<constant name="JOY_SONY_START" value="6" enum="JoyButtonList">
|
||||||
Xbox controller X button.
|
Sony DualShock controller start button maps to SDL start button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_XBOX_Y" value="3" enum="JoystickList">
|
<constant name="JOY_SONY_PS" value="5" enum="JoyButtonList">
|
||||||
Xbox controller Y button.
|
Sony DualShock controller PS button maps to SDL guide button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_DS_A" value="1" enum="JoystickList">
|
<constant name="JOY_SONY_L1" value="9" enum="JoyButtonList">
|
||||||
Nintendo controller A button.
|
Sony DualShock controller L1 button maps to SDL left shoulder button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_DS_B" value="0" enum="JoystickList">
|
<constant name="JOY_SONY_R1" value="10" enum="JoyButtonList">
|
||||||
Nintendo controller B button.
|
Sony DualShock controller R1 button maps to SDL right shoulder button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_DS_X" value="3" enum="JoystickList">
|
<constant name="JOY_SONY_L3" value="7" enum="JoyButtonList">
|
||||||
Nintendo controller X button.
|
Sony DualShock controller L3 button maps to SDL left stick button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_DS_Y" value="2" enum="JoystickList">
|
<constant name="JOY_SONY_R3" value="8" enum="JoyButtonList">
|
||||||
Nintendo controller Y button.
|
Sony DualShock controller R3 button maps to SDL right stick button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_VR_GRIP" value="2" enum="JoystickList">
|
<constant name="JOY_XBOX_A" value="0" enum="JoyButtonList">
|
||||||
Grip (side) buttons on a VR controller.
|
Xbox game controller A button maps to SDL button A.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_VR_PAD" value="14" enum="JoystickList">
|
<constant name="JOY_XBOX_B" value="1" enum="JoyButtonList">
|
||||||
Push down on the touchpad or main joystick on a VR controller.
|
Xbox game controller B button maps to SDL button B.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_VR_TRIGGER" value="15" enum="JoystickList">
|
<constant name="JOY_XBOX_X" value="2" enum="JoyButtonList">
|
||||||
Trigger on a VR controller.
|
Xbox game controller X button maps to SDL button X.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_OCULUS_AX" value="7" enum="JoystickList">
|
<constant name="JOY_XBOX_Y" value="3" enum="JoyButtonList">
|
||||||
A button on the right Oculus Touch controller, X button on the left controller (also when used in OpenVR).
|
Xbox game controller Y button maps to SDL button Y.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_OCULUS_BY" value="1" enum="JoystickList">
|
<constant name="JOY_XBOX_BACK" value="4" enum="JoyButtonList">
|
||||||
B button on the right Oculus Touch controller, Y button on the left controller (also when used in OpenVR).
|
Xbox game controller back button maps to SDL back button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_OCULUS_MENU" value="3" enum="JoystickList">
|
<constant name="JOY_XBOX_START" value="6" enum="JoyButtonList">
|
||||||
Menu button on either Oculus Touch controller.
|
Xbox game controller start button maps to SDL start button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_OPENVR_MENU" value="1" enum="JoystickList">
|
<constant name="JOY_XBOX_HOME" value="5" enum="JoyButtonList">
|
||||||
Menu button in OpenVR (Except when Oculus Touch controllers are used).
|
Xbox game controller home button maps to SDL guide button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_SELECT" value="10" enum="JoystickList">
|
<constant name="JOY_XBOX_LS" value="7" enum="JoyButtonList">
|
||||||
Gamepad button Select.
|
Xbox game controller left stick button maps to SDL left stick button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_START" value="11" enum="JoystickList">
|
<constant name="JOY_XBOX_RS" value="8" enum="JoyButtonList">
|
||||||
Gamepad button Start.
|
Xbox game controller right stick button maps to SDL right stick button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_DPAD_UP" value="12" enum="JoystickList">
|
<constant name="JOY_XBOX_LB" value="9" enum="JoyButtonList">
|
||||||
Gamepad DPad up.
|
Xbox game controller left bumper button maps to SDL left shoulder button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_DPAD_DOWN" value="13" enum="JoystickList">
|
<constant name="JOY_XBOX_RB" value="10" enum="JoyButtonList">
|
||||||
Gamepad DPad down.
|
Xbox game controller right bumper button maps to SDL right shoulder button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_DPAD_LEFT" value="14" enum="JoystickList">
|
<constant name="JOY_BUTTON_MAX" value="36" enum="JoyAxisList">
|
||||||
Gamepad DPad left.
|
The maximum number of game controller buttons.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_DPAD_RIGHT" value="15" enum="JoystickList">
|
<constant name="JOY_INVALID_BUTTON" value="-1" enum="JoyButtonList">
|
||||||
Gamepad DPad right.
|
An invalid game controller axis.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_L" value="4" enum="JoystickList">
|
<constant name="JOY_AXIS_LEFT_X" value="0" enum="JoyAxisList">
|
||||||
Gamepad left Shoulder button.
|
Game controller left joystick x-axis.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_L2" value="6" enum="JoystickList">
|
<constant name="JOY_AXIS_LEFT_Y" value="1" enum="JoyAxisList">
|
||||||
Gamepad left trigger.
|
Game controller left joystick y-axis.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_L3" value="8" enum="JoystickList">
|
<constant name="JOY_AXIS_RIGHT_X" value="2" enum="JoyAxisList">
|
||||||
Gamepad left stick click.
|
Game controller right joystick x-axis.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_R" value="5" enum="JoystickList">
|
<constant name="JOY_AXIS_RIGHT_Y" value="3" enum="JoyAxisList">
|
||||||
Gamepad right Shoulder button.
|
Game controller right joystick y-axis.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_R2" value="7" enum="JoystickList">
|
<constant name="JOY_AXIS_TRIGGER_LEFT" value="4" enum="JoyAxisList">
|
||||||
Gamepad right trigger.
|
Game controller left trigger axis.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_R3" value="9" enum="JoystickList">
|
<constant name="JOY_AXIS_TRIGGER_RIGHT" value="5" enum="JoyAxisList">
|
||||||
Gamepad right stick click.
|
Game controller right trigger axis.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_AXIS_0" value="0" enum="JoystickList">
|
<constant name="JOY_SDL_AXES" value="6" enum="JoyAxisList">
|
||||||
Gamepad left stick horizontal axis.
|
The number of SDL game controller axes.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_AXIS_1" value="1" enum="JoystickList">
|
<constant name="JOY_AXIS_0_X" value="0" enum="JoyAxisList">
|
||||||
Gamepad left stick vertical axis.
|
Game controller joystick 0 x-axis.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_AXIS_2" value="2" enum="JoystickList">
|
<constant name="JOY_AXIS_0_Y" value="1" enum="JoyAxisList">
|
||||||
Gamepad right stick horizontal axis.
|
Game controller joystick 0 y-axis.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_AXIS_3" value="3" enum="JoystickList">
|
<constant name="JOY_AXIS_1_X" value="2" enum="JoyAxisList">
|
||||||
Gamepad right stick vertical axis.
|
Game controller joystick 1 x-axis.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_AXIS_4" value="4" enum="JoystickList">
|
<constant name="JOY_AXIS_1_Y" value="3" enum="JoyAxisList">
|
||||||
Generic gamepad axis 4.
|
Game controller joystick 1 y-axis.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_AXIS_5" value="5" enum="JoystickList">
|
<constant name="JOY_AXIS_2_X" value="4" enum="JoyAxisList">
|
||||||
Generic gamepad axis 5.
|
Game controller joystick 2 x-axis.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_AXIS_6" value="6" enum="JoystickList">
|
<constant name="JOY_AXIS_2_Y" value="5" enum="JoyAxisList">
|
||||||
Gamepad left trigger analog axis.
|
Game controller joystick 2 y-axis.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_AXIS_7" value="7" enum="JoystickList">
|
<constant name="JOY_AXIS_3_X" value="6" enum="JoyAxisList">
|
||||||
Gamepad right trigger analog axis.
|
Game controller joystick 3 x-axis.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_AXIS_8" value="8" enum="JoystickList">
|
<constant name="JOY_AXIS_3_Y" value="7" enum="JoyAxisList">
|
||||||
Generic gamepad axis 8.
|
Game controller joystick 3 y-axis.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_AXIS_9" value="9" enum="JoystickList">
|
<constant name="JOY_AXIS_4_X" value="8" enum="JoyAxisList">
|
||||||
Generic gamepad axis 9.
|
Game controller joystick 4 x-axis.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_AXIS_MAX" value="10" enum="JoystickList">
|
<constant name="JOY_AXIS_4_Y" value="9" enum="JoyAxisList">
|
||||||
Represents the maximum number of joystick axes supported.
|
Game controller joystick 4 y-axis.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_ANALOG_LX" value="0" enum="JoystickList">
|
<constant name="JOY_AXIS_MAX" value="10" enum="JoyAxisList">
|
||||||
Gamepad left stick horizontal axis.
|
The maximum number of game controller axes.
|
||||||
</constant>
|
|
||||||
<constant name="JOY_ANALOG_LY" value="1" enum="JoystickList">
|
|
||||||
Gamepad left stick vertical axis.
|
|
||||||
</constant>
|
|
||||||
<constant name="JOY_ANALOG_RX" value="2" enum="JoystickList">
|
|
||||||
Gamepad right stick horizontal axis.
|
|
||||||
</constant>
|
|
||||||
<constant name="JOY_ANALOG_RY" value="3" enum="JoystickList">
|
|
||||||
Gamepad right stick vertical axis.
|
|
||||||
</constant>
|
|
||||||
<constant name="JOY_ANALOG_L2" value="6" enum="JoystickList">
|
|
||||||
Gamepad left analog trigger.
|
|
||||||
</constant>
|
|
||||||
<constant name="JOY_ANALOG_R2" value="7" enum="JoystickList">
|
|
||||||
Gamepad 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>
|
||||||
<constant name="MIDI_MESSAGE_NOTE_OFF" value="8" enum="MidiMessageList">
|
<constant name="MIDI_MESSAGE_NOTE_OFF" value="8" enum="MidiMessageList">
|
||||||
MIDI note OFF message.
|
MIDI note OFF message.
|
||||||
|
@ -96,7 +96,7 @@
|
|||||||
<argument index="1" name="axis" type="int">
|
<argument index="1" name="axis" type="int">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Returns the current value of the joypad axis at given index (see [enum JoystickList]).
|
Returns the current value of the joypad axis at given index (see [enum JoyAxisList]).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_joy_axis_index_from_string">
|
<method name="get_joy_axis_index_from_string">
|
||||||
@ -114,7 +114,7 @@
|
|||||||
<argument index="0" name="axis_index" type="int">
|
<argument index="0" name="axis_index" type="int">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Receives a [enum JoystickList] axis and returns its equivalent name as a string.
|
Receives a [enum JoyAxisList] axis and returns its equivalent name as a string.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_joy_button_index_from_string">
|
<method name="get_joy_button_index_from_string">
|
||||||
@ -132,7 +132,7 @@
|
|||||||
<argument index="0" name="button_index" type="int">
|
<argument index="0" name="button_index" type="int">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Receives a gamepad button from [enum JoystickList] and returns its equivalent name as a string.
|
Receives a gamepad button from [enum JoyButtonList] and returns its equivalent name as a string.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_joy_guid" qualifiers="const">
|
<method name="get_joy_guid" qualifiers="const">
|
||||||
@ -235,7 +235,7 @@
|
|||||||
<argument index="1" name="button" type="int">
|
<argument index="1" name="button" type="int">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Returns [code]true[/code] if you are pressing the joypad button (see [enum JoystickList]).
|
Returns [code]true[/code] if you are pressing the joypad button (see [enum JoyButtonList]).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="is_joy_known">
|
<method name="is_joy_known">
|
||||||
@ -244,7 +244,7 @@
|
|||||||
<argument index="0" name="device" type="int">
|
<argument index="0" name="device" type="int">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Returns [code]true[/code] if the system knows the specified device. This means that it sets all button and axis indices exactly as defined in [enum JoystickList]. Unknown joypads are not expected to match these constants, but you can still retrieve events from them.
|
Returns [code]true[/code] if the system knows the specified device. This means that it sets all button and axis indices. Unknown joypads are not expected to match these constants, but you can still retrieve events from them.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="is_key_pressed" qualifiers="const">
|
<method name="is_key_pressed" qualifiers="const">
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
</methods>
|
</methods>
|
||||||
<members>
|
<members>
|
||||||
<member name="button_index" type="int" setter="set_button_index" getter="get_button_index" default="0">
|
<member name="button_index" type="int" setter="set_button_index" getter="get_button_index" default="0">
|
||||||
Button identifier. One of the [enum JoystickList] button constants.
|
Button identifier. One of the [enum JoyButtonList] button constants.
|
||||||
</member>
|
</member>
|
||||||
<member name="pressed" type="bool" setter="set_pressed" getter="is_pressed" default="false">
|
<member name="pressed" type="bool" setter="set_pressed" getter="is_pressed" default="false">
|
||||||
If [code]true[/code], the button's state is pressed. If [code]false[/code], the button's state is released.
|
If [code]true[/code], the button's state is pressed. If [code]false[/code], the button's state is released.
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
</methods>
|
</methods>
|
||||||
<members>
|
<members>
|
||||||
<member name="axis" type="int" setter="set_axis" getter="get_axis" default="0">
|
<member name="axis" type="int" setter="set_axis" getter="get_axis" default="0">
|
||||||
Axis identifier. Use one of the [enum JoystickList] axis constants.
|
Axis identifier. Use one of the [enum JoyAxisList] axis constants.
|
||||||
</member>
|
</member>
|
||||||
<member name="axis_value" type="float" setter="set_axis_value" getter="get_axis_value" default="0.0">
|
<member name="axis_value" type="float" setter="set_axis_value" getter="get_axis_value" default="0.0">
|
||||||
Current position of the joystick on the given axis. The value ranges from [code]-1.0[/code] to [code]1.0[/code]. A value of [code]0[/code] means the axis is in its resting position.
|
Current position of the joystick on the given axis. The value ranges from [code]-1.0[/code] to [code]1.0[/code]. A value of [code]0[/code] means the axis is in its resting position.
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
<argument index="0" name="button" type="int">
|
<argument index="0" name="button" type="int">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Returns [code]true[/code] if the button at index [code]button[/code] is pressed. See [enum JoystickList], in particular the [code]JOY_VR_*[/code] constants.
|
Returns [code]true[/code] if the button at index [code]button[/code] is pressed. See [enum JoyButtonList].
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
</methods>
|
</methods>
|
||||||
|
@ -24656,7 +24656,7 @@ msgstr ""
|
|||||||
#: doc/classes/Input.xml:99
|
#: doc/classes/Input.xml:99
|
||||||
msgid ""
|
msgid ""
|
||||||
"Returns the current value of the joypad axis at given index (see [enum "
|
"Returns the current value of the joypad axis at given index (see [enum "
|
||||||
"JoystickList])."
|
"JoyAxisList])."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/Input.xml:108
|
#: doc/classes/Input.xml:108
|
||||||
@ -24665,7 +24665,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: doc/classes/Input.xml:117
|
#: doc/classes/Input.xml:117
|
||||||
msgid ""
|
msgid ""
|
||||||
"Receives a [enum JoystickList] axis and returns its equivalent name as a "
|
"Receives a [enum JoyAxisList] axis and returns its equivalent name as a "
|
||||||
"string."
|
"string."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -24675,7 +24675,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: doc/classes/Input.xml:135
|
#: doc/classes/Input.xml:135
|
||||||
msgid ""
|
msgid ""
|
||||||
"Receives a gamepad button from [enum JoystickList] and returns its "
|
"Receives a gamepad button from [enum JoyButtonList] and returns its "
|
||||||
"equivalent name as a string."
|
"equivalent name as a string."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -24750,15 +24750,14 @@ msgstr ""
|
|||||||
#: doc/classes/Input.xml:238
|
#: doc/classes/Input.xml:238
|
||||||
msgid ""
|
msgid ""
|
||||||
"Returns [code]true[/code] if you are pressing the joypad button (see [enum "
|
"Returns [code]true[/code] if you are pressing the joypad button (see [enum "
|
||||||
"JoystickList])."
|
"JoyButtonList])."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/Input.xml:247
|
#: doc/classes/Input.xml:247
|
||||||
msgid ""
|
msgid ""
|
||||||
"Returns [code]true[/code] if the system knows the specified device. This "
|
"Returns [code]true[/code] if the system knows the specified device. This "
|
||||||
"means that it sets all button and axis indices exactly as defined in [enum "
|
"means that it sets all button and axis indices. Unknown joypads are not "
|
||||||
"JoystickList]. Unknown joypads are not expected to match these constants, "
|
"expected to match these constants, but you can still retrieve events from them."
|
||||||
"but you can still retrieve events from them."
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/Input.xml:256
|
#: doc/classes/Input.xml:256
|
||||||
@ -25150,7 +25149,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/InputEventJoypadButton.xml:16
|
#: doc/classes/InputEventJoypadButton.xml:16
|
||||||
msgid "Button identifier. One of the [enum JoystickList] button constants."
|
msgid "Button identifier. One of the [enum JoyButtonList] button constants."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/InputEventJoypadButton.xml:19
|
#: doc/classes/InputEventJoypadButton.xml:19
|
||||||
@ -25178,7 +25177,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/InputEventJoypadMotion.xml:16
|
#: doc/classes/InputEventJoypadMotion.xml:16
|
||||||
msgid "Axis identifier. Use one of the [enum JoystickList] axis constants."
|
msgid "Axis identifier. Use one of the [enum JoyAxisList] axis constants."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/InputEventJoypadMotion.xml:19
|
#: doc/classes/InputEventJoypadMotion.xml:19
|
||||||
@ -57946,8 +57945,7 @@ msgstr ""
|
|||||||
#: doc/classes/XRController3D.xml:65
|
#: doc/classes/XRController3D.xml:65
|
||||||
msgid ""
|
msgid ""
|
||||||
"Returns [code]true[/code] if the button at index [code]button[/code] is "
|
"Returns [code]true[/code] if the button at index [code]button[/code] is "
|
||||||
"pressed. See [enum JoystickList], in particular the [code]JOY_VR_*[/code] "
|
"pressed. See [enum JoyButtonList]."
|
||||||
"constants."
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/XRController3D.xml:71
|
#: doc/classes/XRController3D.xml:71
|
||||||
|
@ -24666,7 +24666,7 @@ msgstr ""
|
|||||||
#: doc/classes/Input.xml:99
|
#: doc/classes/Input.xml:99
|
||||||
msgid ""
|
msgid ""
|
||||||
"Returns the current value of the joypad axis at given index (see [enum "
|
"Returns the current value of the joypad axis at given index (see [enum "
|
||||||
"JoystickList])."
|
"JoyAxisList])."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/Input.xml:108
|
#: doc/classes/Input.xml:108
|
||||||
@ -24675,7 +24675,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: doc/classes/Input.xml:117
|
#: doc/classes/Input.xml:117
|
||||||
msgid ""
|
msgid ""
|
||||||
"Receives a [enum JoystickList] axis and returns its equivalent name as a "
|
"Receives a [enum JoyAxisList] axis and returns its equivalent name as a "
|
||||||
"string."
|
"string."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -24685,7 +24685,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: doc/classes/Input.xml:135
|
#: doc/classes/Input.xml:135
|
||||||
msgid ""
|
msgid ""
|
||||||
"Receives a gamepad button from [enum JoystickList] and returns its "
|
"Receives a gamepad button from [enum JoyButtonList] and returns its "
|
||||||
"equivalent name as a string."
|
"equivalent name as a string."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -24760,15 +24760,14 @@ msgstr ""
|
|||||||
#: doc/classes/Input.xml:238
|
#: doc/classes/Input.xml:238
|
||||||
msgid ""
|
msgid ""
|
||||||
"Returns [code]true[/code] if you are pressing the joypad button (see [enum "
|
"Returns [code]true[/code] if you are pressing the joypad button (see [enum "
|
||||||
"JoystickList])."
|
"JoyButtonList])."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/Input.xml:247
|
#: doc/classes/Input.xml:247
|
||||||
msgid ""
|
msgid ""
|
||||||
"Returns [code]true[/code] if the system knows the specified device. This "
|
"Returns [code]true[/code] if the system knows the specified device. This "
|
||||||
"means that it sets all button and axis indices exactly as defined in [enum "
|
"means that it sets all button and axis indices. Unknown joypads are not "
|
||||||
"JoystickList]. Unknown joypads are not expected to match these constants, "
|
"expected to match these constants, but you can still retrieve events from them."
|
||||||
"but you can still retrieve events from them."
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/Input.xml:256
|
#: doc/classes/Input.xml:256
|
||||||
@ -25160,7 +25159,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/InputEventJoypadButton.xml:16
|
#: doc/classes/InputEventJoypadButton.xml:16
|
||||||
msgid "Button identifier. One of the [enum JoystickList] button constants."
|
msgid "Button identifier. One of the [enum JoyButtonList] button constants."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/InputEventJoypadButton.xml:19
|
#: doc/classes/InputEventJoypadButton.xml:19
|
||||||
@ -25188,7 +25187,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/InputEventJoypadMotion.xml:16
|
#: doc/classes/InputEventJoypadMotion.xml:16
|
||||||
msgid "Axis identifier. Use one of the [enum JoystickList] axis constants."
|
msgid "Axis identifier. Use one of the [enum JoyAxisList] axis constants."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/InputEventJoypadMotion.xml:19
|
#: doc/classes/InputEventJoypadMotion.xml:19
|
||||||
@ -57956,8 +57955,7 @@ msgstr ""
|
|||||||
#: doc/classes/XRController3D.xml:65
|
#: doc/classes/XRController3D.xml:65
|
||||||
msgid ""
|
msgid ""
|
||||||
"Returns [code]true[/code] if the button at index [code]button[/code] is "
|
"Returns [code]true[/code] if the button at index [code]button[/code] is "
|
||||||
"pressed. See [enum JoystickList], in particular the [code]JOY_VR_*[/code] "
|
"pressed. See [enum JoyButtonList]."
|
||||||
"constants."
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/XRController3D.xml:71
|
#: doc/classes/XRController3D.xml:71
|
||||||
|
@ -43,37 +43,45 @@
|
|||||||
|
|
||||||
ProjectSettingsEditor *ProjectSettingsEditor::singleton = nullptr;
|
ProjectSettingsEditor *ProjectSettingsEditor::singleton = nullptr;
|
||||||
|
|
||||||
static const char *_button_names[JOY_BUTTON_MAX] = {
|
static const char *_button_descriptions[JOY_SDL_BUTTONS] = {
|
||||||
"DualShock Cross, Xbox A, Nintendo B",
|
"Face Bottom, DualShock Cross, Xbox A, Nintendo B",
|
||||||
"DualShock Circle, Xbox B, Nintendo A",
|
"Face Right, DualShock Circle, Xbox B, Nintendo A",
|
||||||
"DualShock Square, Xbox X, Nintendo Y",
|
"Face Left, DualShock Square, Xbox X, Nintendo Y",
|
||||||
"DualShock Triangle, Xbox Y, Nintendo X",
|
"Face Top, DualShock Triangle, Xbox Y, Nintendo X",
|
||||||
"L, L1",
|
"DualShock Select, Xbox Back, Nintendo -",
|
||||||
"R, R1",
|
"Home, DualShock PS, Guide",
|
||||||
"L2",
|
"Start, Nintendo +",
|
||||||
"R2",
|
"Left Stick, DualShock L3, Xbox L/LS",
|
||||||
"L3",
|
"Right Stick, DualShock R3, Xbox R/RS",
|
||||||
"R3",
|
"Left Shoulder, DualShock L1, Xbox LB",
|
||||||
"Select, DualShock Share, Nintendo -",
|
"Right Shoulder, DualShock R1, Xbox RB",
|
||||||
"Start, DualShock Options, Nintendo +",
|
|
||||||
"D-Pad Up",
|
"D-Pad Up",
|
||||||
"D-Pad Down",
|
"D-Pad Down",
|
||||||
"D-Pad Left",
|
"D-Pad Left",
|
||||||
"D-Pad Right"
|
"D-Pad Right"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *_axis_names[JOY_AXIS_MAX * 2] = {
|
static const char *_axis_descriptions[JOY_AXIS_MAX * 2] = {
|
||||||
" (Left Stick Left)",
|
"Left Stick Left",
|
||||||
" (Left Stick Right)",
|
"Left Stick Right",
|
||||||
" (Left Stick Up)",
|
"Left Stick Up",
|
||||||
" (Left Stick Down)",
|
"Left Stick Down",
|
||||||
" (Right Stick Left)",
|
"Right Stick Left",
|
||||||
" (Right Stick Right)",
|
"Right Stick Right",
|
||||||
" (Right Stick Up)",
|
"Right Stick Up",
|
||||||
" (Right Stick Down)",
|
"Right Stick Down",
|
||||||
"", "", "", "",
|
"Joystick 2 Left",
|
||||||
"", " (L2)",
|
"Joystick 2 Right, Left Trigger, L2, LT",
|
||||||
"", " (R2)"
|
"Joystick 2 Up",
|
||||||
|
"Joystick 2 Down, Right Trigger, R2, RT",
|
||||||
|
"Joystick 3 Left",
|
||||||
|
"Joystick 3 Right",
|
||||||
|
"Joystick 3 Up",
|
||||||
|
"Joystick 3 Down",
|
||||||
|
"Joystick 4 Left",
|
||||||
|
"Joystick 4 Right",
|
||||||
|
"Joystick 4 Up",
|
||||||
|
"Joystick 4 Down",
|
||||||
};
|
};
|
||||||
|
|
||||||
void ProjectSettingsEditor::_unhandled_input(const Ref<InputEvent> &p_event) {
|
void ProjectSettingsEditor::_unhandled_input(const Ref<InputEvent> &p_event) {
|
||||||
@ -527,9 +535,9 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even
|
|||||||
device_index_label->set_text(TTR("Joypad Axis Index:"));
|
device_index_label->set_text(TTR("Joypad Axis Index:"));
|
||||||
device_index->clear();
|
device_index->clear();
|
||||||
for (int i = 0; i < JOY_AXIS_MAX * 2; i++) {
|
for (int i = 0; i < JOY_AXIS_MAX * 2; i++) {
|
||||||
|
String desc = TTR("Axis") + " " + itos(i / 2) + " " + ((i & 1) ? "+" : "-") +
|
||||||
String desc = _axis_names[i];
|
" (" + TTR(_axis_descriptions[i]) + ")";
|
||||||
device_index->add_item(TTR("Axis") + " " + itos(i / 2) + " " + ((i & 1) ? "+" : "-") + desc);
|
device_index->add_item(desc);
|
||||||
}
|
}
|
||||||
device_input->popup_centered(Size2(350, 95) * EDSCALE);
|
device_input->popup_centered(Size2(350, 95) * EDSCALE);
|
||||||
|
|
||||||
@ -548,10 +556,11 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even
|
|||||||
|
|
||||||
device_index_label->set_text(TTR("Joypad Button Index:"));
|
device_index_label->set_text(TTR("Joypad Button Index:"));
|
||||||
device_index->clear();
|
device_index->clear();
|
||||||
|
|
||||||
for (int i = 0; i < JOY_BUTTON_MAX; i++) {
|
for (int i = 0; i < JOY_BUTTON_MAX; i++) {
|
||||||
|
String desc = TTR("Button") + " " + itos(i);
|
||||||
device_index->add_item(itos(i) + ": " + String(_button_names[i]));
|
if (i < JOY_SDL_BUTTONS)
|
||||||
|
desc += " (" + TTR(_button_descriptions[i]) + ")";
|
||||||
|
device_index->add_item(desc);
|
||||||
}
|
}
|
||||||
device_input->popup_centered(Size2(350, 95) * EDSCALE);
|
device_input->popup_centered(Size2(350, 95) * EDSCALE);
|
||||||
|
|
||||||
@ -792,9 +801,10 @@ void ProjectSettingsEditor::_update_actions() {
|
|||||||
|
|
||||||
if (jb.is_valid()) {
|
if (jb.is_valid()) {
|
||||||
|
|
||||||
String str = _get_device_string(jb->get_device()) + ", " + TTR("Button") + " " + itos(jb->get_button_index());
|
String str = _get_device_string(jb->get_device()) + ", " +
|
||||||
if (jb->get_button_index() >= 0 && jb->get_button_index() < JOY_BUTTON_MAX) {
|
TTR("Button") + " " + itos(jb->get_button_index());
|
||||||
str += String() + " (" + _button_names[jb->get_button_index()] + ")";
|
if (jb->get_button_index() >= 0 && jb->get_button_index() < JOY_SDL_BUTTONS) {
|
||||||
|
str += String() + " (" + TTR(_button_descriptions[jb->get_button_index()]) + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
action2->set_text(0, str);
|
action2->set_text(0, str);
|
||||||
@ -835,8 +845,9 @@ void ProjectSettingsEditor::_update_actions() {
|
|||||||
|
|
||||||
int ax = jm->get_axis();
|
int ax = jm->get_axis();
|
||||||
int n = 2 * ax + (jm->get_axis_value() < 0 ? 0 : 1);
|
int n = 2 * ax + (jm->get_axis_value() < 0 ? 0 : 1);
|
||||||
String desc = _axis_names[n];
|
String str = _get_device_string(jm->get_device()) + ", " +
|
||||||
String str = _get_device_string(jm->get_device()) + ", " + TTR("Axis") + " " + itos(ax) + " " + (jm->get_axis_value() < 0 ? "-" : "+") + desc;
|
TTR("Axis") + " " + itos(ax) + " " + (jm->get_axis_value() < 0 ? "-" : "+") +
|
||||||
|
" (" + _axis_descriptions[n] + ")";
|
||||||
action2->set_text(0, str);
|
action2->set_text(0, str);
|
||||||
action2->set_icon(0, input_editor->get_theme_icon("JoyAxis", "EditorIcons"));
|
action2->set_icon(0, input_editor->get_theme_icon("JoyAxis", "EditorIcons"));
|
||||||
}
|
}
|
||||||
|
@ -247,37 +247,31 @@ static void on_focus_in(ViewController *view_controller, bool *is_focus_out) {
|
|||||||
int joy_id = [self getJoyIdForController:controller];
|
int joy_id = [self getJoyIdForController:controller];
|
||||||
|
|
||||||
if (element == gamepad.buttonA) {
|
if (element == gamepad.buttonA) {
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_0,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_A,
|
||||||
gamepad.buttonA.isPressed);
|
gamepad.buttonA.isPressed);
|
||||||
} else if (element == gamepad.buttonB) {
|
} else if (element == gamepad.buttonB) {
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_1,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_B,
|
||||||
gamepad.buttonB.isPressed);
|
gamepad.buttonB.isPressed);
|
||||||
} else if (element == gamepad.buttonX) {
|
} else if (element == gamepad.buttonX) {
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_2,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_X,
|
||||||
gamepad.buttonX.isPressed);
|
gamepad.buttonX.isPressed);
|
||||||
} else if (element == gamepad.buttonY) {
|
} else if (element == gamepad.buttonY) {
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_3,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_Y,
|
||||||
gamepad.buttonY.isPressed);
|
gamepad.buttonY.isPressed);
|
||||||
} else if (element == gamepad.leftShoulder) {
|
} else if (element == gamepad.leftShoulder) {
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_L,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_LEFT_SHOULDER,
|
||||||
gamepad.leftShoulder.isPressed);
|
gamepad.leftShoulder.isPressed);
|
||||||
} else if (element == gamepad.rightShoulder) {
|
} else if (element == gamepad.rightShoulder) {
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_R,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_RIGHT_SHOULDER,
|
||||||
gamepad.rightShoulder.isPressed);
|
gamepad.rightShoulder.isPressed);
|
||||||
} else if (element == gamepad.leftTrigger) {
|
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_L2,
|
|
||||||
gamepad.leftTrigger.isPressed);
|
|
||||||
} else if (element == gamepad.rightTrigger) {
|
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_R2,
|
|
||||||
gamepad.rightTrigger.isPressed);
|
|
||||||
} else if (element == gamepad.dpad) {
|
} else if (element == gamepad.dpad) {
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_DPAD_UP,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_DPAD_UP,
|
||||||
gamepad.dpad.up.isPressed);
|
gamepad.dpad.up.isPressed);
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_DPAD_DOWN,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_DPAD_DOWN,
|
||||||
gamepad.dpad.down.isPressed);
|
gamepad.dpad.down.isPressed);
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_DPAD_LEFT,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_DPAD_LEFT,
|
||||||
gamepad.dpad.left.isPressed);
|
gamepad.dpad.left.isPressed);
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_DPAD_RIGHT,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_DPAD_RIGHT,
|
||||||
gamepad.dpad.right.isPressed);
|
gamepad.dpad.right.isPressed);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -285,20 +279,20 @@ static void on_focus_in(ViewController *view_controller, bool *is_focus_out) {
|
|||||||
jx.min = -1;
|
jx.min = -1;
|
||||||
if (element == gamepad.leftThumbstick) {
|
if (element == gamepad.leftThumbstick) {
|
||||||
jx.value = gamepad.leftThumbstick.xAxis.value;
|
jx.value = gamepad.leftThumbstick.xAxis.value;
|
||||||
OSIPhone::get_singleton()->joy_axis(joy_id, JOY_ANALOG_LX, jx);
|
OSIPhone::get_singleton()->joy_axis(joy_id, JOY_AXIS_LEFT_X, jx);
|
||||||
jx.value = -gamepad.leftThumbstick.yAxis.value;
|
jx.value = -gamepad.leftThumbstick.yAxis.value;
|
||||||
OSIPhone::get_singleton()->joy_axis(joy_id, JOY_ANALOG_LY, jx);
|
OSIPhone::get_singleton()->joy_axis(joy_id, JOY_AXIS_LEFT_Y, jx);
|
||||||
} else if (element == gamepad.rightThumbstick) {
|
} else if (element == gamepad.rightThumbstick) {
|
||||||
jx.value = gamepad.rightThumbstick.xAxis.value;
|
jx.value = gamepad.rightThumbstick.xAxis.value;
|
||||||
OSIPhone::get_singleton()->joy_axis(joy_id, JOY_ANALOG_RX, jx);
|
OSIPhone::get_singleton()->joy_axis(joy_id, JOY_AXIS_RIGHT_X, jx);
|
||||||
jx.value = -gamepad.rightThumbstick.yAxis.value;
|
jx.value = -gamepad.rightThumbstick.yAxis.value;
|
||||||
OSIPhone::get_singleton()->joy_axis(joy_id, JOY_ANALOG_RY, jx);
|
OSIPhone::get_singleton()->joy_axis(joy_id, JOY_AXIS_RIGHT_Y, jx);
|
||||||
} else if (element == gamepad.leftTrigger) {
|
} else if (element == gamepad.leftTrigger) {
|
||||||
jx.value = gamepad.leftTrigger.value;
|
jx.value = gamepad.leftTrigger.value;
|
||||||
OSIPhone::get_singleton()->joy_axis(joy_id, JOY_ANALOG_L2, jx);
|
OSIPhone::get_singleton()->joy_axis(joy_id, JOY_AXIS_TRIGGER_LEFT, jx);
|
||||||
} else if (element == gamepad.rightTrigger) {
|
} else if (element == gamepad.rightTrigger) {
|
||||||
jx.value = gamepad.rightTrigger.value;
|
jx.value = gamepad.rightTrigger.value;
|
||||||
OSIPhone::get_singleton()->joy_axis(joy_id, JOY_ANALOG_R2, jx);
|
OSIPhone::get_singleton()->joy_axis(joy_id, JOY_AXIS_TRIGGER_RIGHT, jx);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} else if (controller.gamepad != nil) {
|
} else if (controller.gamepad != nil) {
|
||||||
@ -309,31 +303,31 @@ static void on_focus_in(ViewController *view_controller, bool *is_focus_out) {
|
|||||||
int joy_id = [self getJoyIdForController:controller];
|
int joy_id = [self getJoyIdForController:controller];
|
||||||
|
|
||||||
if (element == gamepad.buttonA) {
|
if (element == gamepad.buttonA) {
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_0,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_A,
|
||||||
gamepad.buttonA.isPressed);
|
gamepad.buttonA.isPressed);
|
||||||
} else if (element == gamepad.buttonB) {
|
} else if (element == gamepad.buttonB) {
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_1,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_B,
|
||||||
gamepad.buttonB.isPressed);
|
gamepad.buttonB.isPressed);
|
||||||
} else if (element == gamepad.buttonX) {
|
} else if (element == gamepad.buttonX) {
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_2,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_X,
|
||||||
gamepad.buttonX.isPressed);
|
gamepad.buttonX.isPressed);
|
||||||
} else if (element == gamepad.buttonY) {
|
} else if (element == gamepad.buttonY) {
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_3,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_Y,
|
||||||
gamepad.buttonY.isPressed);
|
gamepad.buttonY.isPressed);
|
||||||
} else if (element == gamepad.leftShoulder) {
|
} else if (element == gamepad.leftShoulder) {
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_L,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_LEFT_SHOULDER,
|
||||||
gamepad.leftShoulder.isPressed);
|
gamepad.leftShoulder.isPressed);
|
||||||
} else if (element == gamepad.rightShoulder) {
|
} else if (element == gamepad.rightShoulder) {
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_R,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_RIGHT_SHOULDER,
|
||||||
gamepad.rightShoulder.isPressed);
|
gamepad.rightShoulder.isPressed);
|
||||||
} else if (element == gamepad.dpad) {
|
} else if (element == gamepad.dpad) {
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_DPAD_UP,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_DPAD_UP,
|
||||||
gamepad.dpad.up.isPressed);
|
gamepad.dpad.up.isPressed);
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_DPAD_DOWN,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_DPAD_DOWN,
|
||||||
gamepad.dpad.down.isPressed);
|
gamepad.dpad.down.isPressed);
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_DPAD_LEFT,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_DPAD_LEFT,
|
||||||
gamepad.dpad.left.isPressed);
|
gamepad.dpad.left.isPressed);
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_DPAD_RIGHT,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_DPAD_RIGHT,
|
||||||
gamepad.dpad.right.isPressed);
|
gamepad.dpad.right.isPressed);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -347,19 +341,19 @@ static void on_focus_in(ViewController *view_controller, bool *is_focus_out) {
|
|||||||
int joy_id = [self getJoyIdForController:controller];
|
int joy_id = [self getJoyIdForController:controller];
|
||||||
|
|
||||||
if (element == gamepad.buttonA) {
|
if (element == gamepad.buttonA) {
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_0,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_A,
|
||||||
gamepad.buttonA.isPressed);
|
gamepad.buttonA.isPressed);
|
||||||
} else if (element == gamepad.buttonX) {
|
} else if (element == gamepad.buttonX) {
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_2,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_X,
|
||||||
gamepad.buttonX.isPressed);
|
gamepad.buttonX.isPressed);
|
||||||
} else if (element == gamepad.dpad) {
|
} else if (element == gamepad.dpad) {
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_DPAD_UP,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_DPAD_UP,
|
||||||
gamepad.dpad.up.isPressed);
|
gamepad.dpad.up.isPressed);
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_DPAD_DOWN,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_DPAD_DOWN,
|
||||||
gamepad.dpad.down.isPressed);
|
gamepad.dpad.down.isPressed);
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_DPAD_LEFT,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_DPAD_LEFT,
|
||||||
gamepad.dpad.left.isPressed);
|
gamepad.dpad.left.isPressed);
|
||||||
OSIPhone::get_singleton()->joy_button(joy_id, JOY_DPAD_RIGHT,
|
OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_DPAD_RIGHT,
|
||||||
gamepad.dpad.right.isPressed);
|
gamepad.dpad.right.isPressed);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -659,14 +659,7 @@ void DisplayServerJavaScript::process_joypads() {
|
|||||||
for (int button = 0; button < button_count; button++) {
|
for (int button = 0; button < button_count; button++) {
|
||||||
|
|
||||||
float value = state.analogButton[button];
|
float value = state.analogButton[button];
|
||||||
if (String::utf8(state.mapping) == "standard" && (button == JOY_ANALOG_L2 || button == JOY_ANALOG_R2)) {
|
input->joy_button(joypad, button, value);
|
||||||
Input::JoyAxis joy_axis;
|
|
||||||
joy_axis.min = 0;
|
|
||||||
joy_axis.value = value;
|
|
||||||
input->joy_axis(joypad, button, joy_axis);
|
|
||||||
} else {
|
|
||||||
input->joy_button(joypad, button, value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for (int axis = 0; axis < axis_count; axis++) {
|
for (int axis = 0; axis < axis_count; axis++) {
|
||||||
|
|
||||||
|
@ -64,12 +64,12 @@ void JoypadUWP::process_controllers() {
|
|||||||
button_mask *= 2;
|
button_mask *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
input->joy_axis(joy.id, JOY_AXIS_0, axis_correct(reading.LeftThumbstickX));
|
input->joy_axis(joy.id, JOY_AXIS_LEFT_X, axis_correct(reading.LeftThumbstickX));
|
||||||
input->joy_axis(joy.id, JOY_AXIS_1, axis_correct(reading.LeftThumbstickY, true));
|
input->joy_axis(joy.id, JOY_AXIS_LEFT_Y, axis_correct(reading.LeftThumbstickY, true));
|
||||||
input->joy_axis(joy.id, JOY_AXIS_2, axis_correct(reading.RightThumbstickX));
|
input->joy_axis(joy.id, JOY_AXIS_RIGHT_X, axis_correct(reading.RightThumbstickX));
|
||||||
input->joy_axis(joy.id, JOY_AXIS_3, axis_correct(reading.RightThumbstickY, true));
|
input->joy_axis(joy.id, JOY_AXIS_RIGHT_Y, axis_correct(reading.RightThumbstickY, true));
|
||||||
input->joy_axis(joy.id, JOY_AXIS_4, axis_correct(reading.LeftTrigger, false, true));
|
input->joy_axis(joy.id, JOY_AXIS_TRIGGER_LEFT, axis_correct(reading.LeftTrigger, false, true));
|
||||||
input->joy_axis(joy.id, JOY_AXIS_5, axis_correct(reading.RightTrigger, false, true));
|
input->joy_axis(joy.id, JOY_AXIS_TRIGGER_RIGHT, axis_correct(reading.RightTrigger, false, true));
|
||||||
|
|
||||||
uint64_t timestamp = input->get_joy_vibration_timestamp(joy.id);
|
uint64_t timestamp = input->get_joy_vibration_timestamp(joy.id);
|
||||||
if (timestamp > joy.ff_timestamp) {
|
if (timestamp > joy.ff_timestamp) {
|
||||||
|
@ -347,12 +347,12 @@ void JoypadWindows::process_joypads() {
|
|||||||
button_mask = button_mask * 2;
|
button_mask = button_mask * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
input->joy_axis(joy.id, JOY_AXIS_0, axis_correct(joy.state.Gamepad.sThumbLX, true));
|
input->joy_axis(joy.id, JOY_AXIS_LEFT_X, axis_correct(joy.state.Gamepad.sThumbLX, true));
|
||||||
input->joy_axis(joy.id, JOY_AXIS_1, axis_correct(joy.state.Gamepad.sThumbLY, true, false, true));
|
input->joy_axis(joy.id, JOY_AXIS_LEFT_Y, axis_correct(joy.state.Gamepad.sThumbLY, true, false, true));
|
||||||
input->joy_axis(joy.id, JOY_AXIS_2, axis_correct(joy.state.Gamepad.sThumbRX, true));
|
input->joy_axis(joy.id, JOY_AXIS_RIGHT_X, axis_correct(joy.state.Gamepad.sThumbRX, true));
|
||||||
input->joy_axis(joy.id, JOY_AXIS_3, axis_correct(joy.state.Gamepad.sThumbRY, true, false, true));
|
input->joy_axis(joy.id, JOY_AXIS_RIGHT_Y, axis_correct(joy.state.Gamepad.sThumbRY, true, false, true));
|
||||||
input->joy_axis(joy.id, JOY_AXIS_4, axis_correct(joy.state.Gamepad.bLeftTrigger, true, true));
|
input->joy_axis(joy.id, JOY_AXIS_TRIGGER_LEFT, axis_correct(joy.state.Gamepad.bLeftTrigger, true, true));
|
||||||
input->joy_axis(joy.id, JOY_AXIS_5, axis_correct(joy.state.Gamepad.bRightTrigger, true, true));
|
input->joy_axis(joy.id, JOY_AXIS_TRIGGER_RIGHT, axis_correct(joy.state.Gamepad.bRightTrigger, true, true));
|
||||||
joy.last_packet = joy.state.dwPacketNumber;
|
joy.last_packet = joy.state.dwPacketNumber;
|
||||||
}
|
}
|
||||||
uint64_t timestamp = input->get_joy_vibration_timestamp(joy.id);
|
uint64_t timestamp = input->get_joy_vibration_timestamp(joy.id);
|
||||||
|
Loading…
Reference in New Issue
Block a user