diff options
author | rubenwardy <rubenwardy@gmail.com> | 2017-04-02 23:00:34 +0100 |
---|---|---|
committer | Auke Kok <sofar+github@foo-projects.org> | 2017-04-06 20:58:52 -0700 |
commit | bce0d458d8cda70c10d78ea9ec476474f0a6f01a (patch) | |
tree | 529062ce8f0e7b7fd8f5bd94608af3e36a7860d6 /src/client/joystick_controller.h | |
parent | 351cc2e79a7d78f7ec97ff9b33e4f0bad4042b19 (diff) | |
download | minetest-bce0d458d8cda70c10d78ea9ec476474f0a6f01a.tar.gz minetest-bce0d458d8cda70c10d78ea9ec476474f0a6f01a.tar.bz2 minetest-bce0d458d8cda70c10d78ea9ec476474f0a6f01a.zip |
Add Joystick type detection and Xbox controller support
* Add joystick type detection (with joystick_type setting to override it)
* Fix multiple joysticks from interfering with each other by only reading from one (add joystick_id setting)
* Add support for Xbox controllers
Diffstat (limited to 'src/client/joystick_controller.h')
-rw-r--r-- | src/client/joystick_controller.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/client/joystick_controller.h b/src/client/joystick_controller.h index ed0ee4068..867a0c3f2 100644 --- a/src/client/joystick_controller.h +++ b/src/client/joystick_controller.h @@ -98,6 +98,9 @@ class JoystickController { public: JoystickController(); + + void onJoystickConnect(const std::vector<irr::SJoystickInfo> &joystick_infos); + bool handleEvent(const irr::SEvent::SJoystickEvent &ev); void clear(); @@ -146,10 +149,14 @@ public: f32 doubling_dtime; private: - const JoystickLayout *m_layout; + void setLayoutFromControllerName(std::string name); + + JoystickLayout m_layout; s16 m_axes_vals[JA_COUNT]; + u8 m_joystick_id; + std::bitset<KeyType::INTERNAL_ENUM_COUNT> m_pressed_keys; f32 m_internal_time; |