mirror of
https://github.com/glfw/glfw.git
synced 2025-06-08 00:34:56 +00:00
Joystick hat: treat invalid combinations as nothing pressed
Previously this condition asserted, but on win32 it's possible to get opposing directions set simultaneously with some xinput controllers.
This commit is contained in:
parent
9a87635686
commit
008fab88bb
@ -464,8 +464,10 @@ void _glfwInputJoystickHat(_GLFWjoystick* js, int hat, char value)
|
||||
|
||||
// Valid hat values only use the least significant nibble and have at most two bits
|
||||
// set, which can be considered adjacent plus an arbitrary rotation within the nibble
|
||||
// Treat invalid combinations as nothing pressed
|
||||
assert((value & 0xf0) == 0);
|
||||
assert((value & ((value << 2) | (value >> 2))) == 0);
|
||||
if ((value & ((value << 2) | (value >> 2))) != 0)
|
||||
value = 0;
|
||||
|
||||
base = js->buttonCount + hat * 4;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user