mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-01 17:38:41 +00:00
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
This commit is contained in:
parent
351cc2e79a
commit
bce0d458d8
8 changed files with 146 additions and 37 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue