mirror of
https://github.com/shadowfacts/lwjgl2-arm64.git
synced 2026-04-05 06:25:46 +00:00
Added sanity checks on reported controllers to prune out one with no Axis or no Buttons.
This commit is contained in:
parent
8ac762037f
commit
b1a4935212
1 changed files with 13 additions and 0 deletions
|
|
@ -71,6 +71,19 @@ public class Controllers {
|
|||
net.java.games.input.Controller[] sub = c.getControllers();
|
||||
if (sub.length == 0) {
|
||||
JInputController controller = new JInputController(controllerCount,c);
|
||||
|
||||
// sanity checks to ensure we're actually getting game controllers rather than
|
||||
// any old detected device
|
||||
|
||||
// if we've got no buttons at all we're not a game controller
|
||||
if (controller.getButtonCount() == 0) {
|
||||
return;
|
||||
}
|
||||
// if we've got no axis at all we're not a game controller
|
||||
if (controller.getAxisCount() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
controllers.add(controller);
|
||||
controllerCount++;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue