From a175ac7032407af8e0ffe9fcb23edd5b57c6548f Mon Sep 17 00:00:00 2001 From: Andreas Haas Date: Tue, 21 Feb 2017 17:02:49 +0100 Subject: 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 --- main/input_default.cpp | 9 +++++++++ main/input_default.h | 7 +++++++ 2 files changed, 16 insertions(+) (limited to 'main') diff --git a/main/input_default.cpp b/main/input_default.cpp index 0561f2bb34..a9f643c785 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -1214,6 +1214,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