mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-14 00:55:20 +02: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:
@@ -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;
|
||||
|
Reference in New Issue
Block a user