1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-16 14:00:40 +00:00

Support adding advanced joypad features

This commit is contained in:
Nintorch
2025-10-20 19:28:06 +05:00
parent 36b92128b1
commit 7ae67813a1
9 changed files with 560 additions and 3 deletions

View File

@@ -208,6 +208,8 @@ void JoypadSDL::process_events() {
device_name,
joypads[joy_id].guid,
joypad_info);
Input::get_singleton()->set_joy_features(joy_id, &joypads[joy_id]);
}
// An event for an attached joypad
} else if (sdl_event.type >= SDL_EVENT_JOYSTICK_AXIS_MOTION && sdl_event.type < SDL_EVENT_FINGER_DOWN && sdl_instance_id_to_joypad_id.has(sdl_event.jdevice.which)) {
@@ -299,4 +301,12 @@ void JoypadSDL::close_joypad(int p_pad_idx) {
}
}
SDL_Joystick *JoypadSDL::Joypad::get_sdl_joystick() const {
return SDL_GetJoystickFromID(sdl_instance_idx);
}
SDL_Gamepad *JoypadSDL::Joypad::get_sdl_gamepad() const {
return SDL_GetGamepadFromID(sdl_instance_idx);
}
#endif // SDL_ENABLED