diff options
author | Andreas Haas <liu.gam3@gmail.com> | 2017-02-21 17:02:49 +0100 |
---|---|---|
committer | Andreas Haas <liu.gam3@gmail.com> | 2017-02-26 21:01:31 +0100 |
commit | a175ac7032407af8e0ffe9fcb23edd5b57c6548f (patch) | |
tree | 55b9a768892e2c01d15075b1a7861eae078ce009 /main/input_default.h | |
parent | de0045cf1b0a5e20fbf74da192039d344ee8d0c7 (diff) |
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
Diffstat (limited to 'main/input_default.h')
-rw-r--r-- | main/input_default.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/main/input_default.h b/main/input_default.h index 3e41c494c1..78bc0f4355 100644 --- a/main/input_default.h +++ b/main/input_default.h @@ -134,6 +134,11 @@ public: HAT_LEFT, HAT_MAX, }; + + enum { + JOYPADS_MAX = 16, + }; + struct JoyAxis { int min; float value; @@ -243,6 +248,8 @@ public: virtual int get_joy_axis_index_from_string(String p_axis); virtual int get_joy_button_index_from_string(String p_button); + int get_unused_joy_id(); + bool is_joy_mapped(int p_device); String get_joy_guid_remapped(int p_device) const; void set_fallback_mapping(String p_guid); |