You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
Better handling of joypad device IDs.
Now InputDefault is responsible for giving out joypad device IDs to the platform, instead of each platform handling this itself. This makes it possible for c++ modules to add their own "custom" gamepad devices, without the risk of messing up events in case the user also has regular gamepads attached (using the OS code). For now, it's implemented for the main desktop platforms. Possible targets for future work: android, uwp, javascript
This commit is contained in:
@@ -1157,6 +1157,15 @@ int InputDefault::get_joy_button_index_from_string(String p_button) {
|
||||
ERR_FAIL_V(-1);
|
||||
}
|
||||
|
||||
int InputDefault::get_unused_joy_id() {
|
||||
for (int i = 0; i < JOYSTICKS_MAX; i++) {
|
||||
if (!joy_names.has(i) || !joy_names[i].connected) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
String InputDefault::get_joy_axis_string(int p_axis) {
|
||||
ERR_FAIL_INDEX_V(p_axis, JOY_AXIS_MAX, "");
|
||||
return _axes[p_axis];
|
||||
|
||||
Reference in New Issue
Block a user