diff --git a/core/global_constants.cpp b/core/global_constants.cpp index 3c2ac7af0971..00942dc07a8c 100644 --- a/core/global_constants.cpp +++ b/core/global_constants.cpp @@ -448,6 +448,12 @@ void register_global_constants() { BIND_GLOBAL_ENUM_CONSTANT(JOY_R); BIND_GLOBAL_ENUM_CONSTANT(JOY_R2); BIND_GLOBAL_ENUM_CONSTANT(JOY_R3); + BIND_GLOBAL_ENUM_CONSTANT(JOY_MISC1); + BIND_GLOBAL_ENUM_CONSTANT(JOY_PADDLE1); + BIND_GLOBAL_ENUM_CONSTANT(JOY_PADDLE2); + BIND_GLOBAL_ENUM_CONSTANT(JOY_PADDLE3); + BIND_GLOBAL_ENUM_CONSTANT(JOY_PADDLE4); + BIND_GLOBAL_ENUM_CONSTANT(JOY_TOUCHPAD); BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_0); BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_1); diff --git a/core/os/input_event.h b/core/os/input_event.h index fce31ae680db..6248f99f7815 100644 --- a/core/os/input_event.h +++ b/core/os/input_event.h @@ -79,7 +79,13 @@ enum JoystickList { JOY_BUTTON_13 = 13, JOY_BUTTON_14 = 14, JOY_BUTTON_15 = 15, - JOY_BUTTON_MAX = 16, + JOY_BUTTON_16 = 16, + JOY_BUTTON_17 = 17, + JOY_BUTTON_18 = 18, + JOY_BUTTON_19 = 19, + JOY_BUTTON_20 = 20, + JOY_BUTTON_21 = 21, + JOY_BUTTON_MAX = 22, JOY_L = JOY_BUTTON_4, JOY_R = JOY_BUTTON_5, @@ -93,6 +99,12 @@ enum JoystickList { JOY_DPAD_DOWN = JOY_BUTTON_13, JOY_DPAD_LEFT = JOY_BUTTON_14, JOY_DPAD_RIGHT = JOY_BUTTON_15, + JOY_MISC1 = JOY_BUTTON_16, + JOY_PADDLE1 = JOY_BUTTON_17, + JOY_PADDLE2 = JOY_BUTTON_18, + JOY_PADDLE3 = JOY_BUTTON_19, + JOY_PADDLE4 = JOY_BUTTON_20, + JOY_TOUCHPAD = JOY_BUTTON_21, JOY_SONY_CIRCLE = JOY_BUTTON_1, JOY_SONY_X = JOY_BUTTON_0, diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 59de0b912b93..aceb38a4aefb 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -988,7 +988,25 @@ Gamepad button 15. - + + Gamepad button 16. + + + Gamepad button 17. + + + Gamepad button 18. + + + Gamepad button 19. + + + Gamepad button 20. + + + Gamepad button 21. + + Represents the maximum number of joystick buttons supported. @@ -1066,6 +1084,24 @@ Gamepad DPad right. + + Gamepad SDL miscellaneous button. + + + Gamepad SDL paddle 1 button. + + + Gamepad SDL paddle 2 button. + + + Gamepad SDL paddle 3 button. + + + Gamepad SDL paddle 4 button. + + + Gamepad SDL touchpad button. + Gamepad left Shoulder button. diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index c03d71ee0001..8ae81bf5111d 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -59,7 +59,13 @@ static const char *_button_names[JOY_BUTTON_MAX] = { "D-Pad Up", "D-Pad Down", "D-Pad Left", - "D-Pad Right" + "D-Pad Right", + "Xbox Share, PS5 Microphone, Nintendo Capture", + "Xbox Paddle 1", + "Xbox Paddle 2", + "Xbox Paddle 3", + "Xbox Paddle 4", + "PS4/5 Touchpad", }; static const char *_axis_names[JOY_AXIS_MAX * 2] = { diff --git a/main/input_default.cpp b/main/input_default.cpp index a36445e33b53..fb73a7e2c4b1 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -1078,7 +1078,7 @@ void InputDefault::_get_mapped_hat_events(const JoyDeviceMapping &mapping, int p } // string names of the SDL buttons in the same order as input_event.h godot buttons -static const char *_joy_buttons[] = { "a", "b", "x", "y", "leftshoulder", "rightshoulder", "lefttrigger", "righttrigger", "leftstick", "rightstick", "back", "start", "dpup", "dpdown", "dpleft", "dpright", "guide", nullptr }; +static const char *_joy_buttons[] = { "a", "b", "x", "y", "leftshoulder", "rightshoulder", "lefttrigger", "righttrigger", "leftstick", "rightstick", "back", "start", "dpup", "dpdown", "dpleft", "dpright", "guide", "misc1", "paddle1", "paddle2", "paddle3", "paddle4", "touchpad", nullptr }; static const char *_joy_axes[] = { "leftx", "lefty", "rightx", "righty", nullptr }; JoystickList InputDefault::_get_output_button(String output) { @@ -1284,6 +1284,12 @@ static const char *_buttons[JOY_BUTTON_MAX] = { "DPAD Down", "DPAD Left", "DPAD Right" + "Misc 1", + "Paddle 1", + "Paddle 2", + "Paddle 3", + "Paddle 4", + "Touchpad", }; static const char *_axes[JOY_AXIS_MAX] = { diff --git a/main/input_default.h b/main/input_default.h index 65364b510d80..4d167372c10d 100644 --- a/main/input_default.h +++ b/main/input_default.h @@ -83,7 +83,7 @@ class InputDefault : public Input { StringName name; StringName uid; bool connected; - bool last_buttons[JOY_BUTTON_MAX + 19]; //apparently SDL specifies 35 possible buttons on android + bool last_buttons[JOY_BUTTON_MAX + 13]; //apparently SDL specifies 35 possible buttons on android float last_axis[JOY_AXIS_MAX]; int last_hat; int mapping; @@ -94,7 +94,7 @@ class InputDefault : public Input { last_axis[i] = 0.0f; } - for (int i = 0; i < JOY_BUTTON_MAX + 19; i++) { + for (int i = 0; i < JOY_BUTTON_MAX + 13; i++) { last_buttons[i] = false; }