You've already forked godot
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:
@@ -986,6 +986,15 @@ void Input::set_joy_axis(int p_device, JoyAxis p_axis, float p_value) {
|
||||
_joy_axis[c] = p_value;
|
||||
}
|
||||
|
||||
void Input::set_joy_features(int p_device, JoypadFeatures *p_features) {
|
||||
Joypad *joypad = joy_names.getptr(p_device);
|
||||
if (!joypad) {
|
||||
return;
|
||||
}
|
||||
joypad->features = p_features;
|
||||
_update_joypad_features(p_device);
|
||||
}
|
||||
|
||||
void Input::start_joy_vibration(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
if (p_weak_magnitude < 0.f || p_weak_magnitude > 1.f || p_strong_magnitude < 0.f || p_strong_magnitude > 1.f) {
|
||||
@@ -1478,6 +1487,15 @@ void Input::_update_action_cache(const StringName &p_action_name, ActionState &r
|
||||
}
|
||||
}
|
||||
|
||||
void Input::_update_joypad_features(int p_device) {
|
||||
Joypad *joypad = joy_names.getptr(p_device);
|
||||
if (!joypad || joypad->features == nullptr) {
|
||||
return;
|
||||
}
|
||||
// Do something based on the features. For example, we can save the information about
|
||||
// the joypad having motion sensors, LED light, etc.
|
||||
}
|
||||
|
||||
Input::JoyEvent Input::_get_mapped_button_event(const JoyDeviceMapping &mapping, JoyButton p_button) {
|
||||
JoyEvent event;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user