get_gamepad seems to block
See original GitHub issueFor my application it is crucial to check if there are new events but if not, proceed with the other code.
However: In order to check for new events I need to call get_gamepad
which calls internal read
on the device. This function seems to block until an event arrives.
It would be awesome to add a nonblocking read or an option to specify all reads as nonblocking!
As always: Thanks for your library!
Issue Analytics
- State:
- Created 7 years ago
- Reactions:7
- Comments:12
Top Results From Across the Web
Navigator.getGamepads() - Web APIs - MDN Web Docs
getGamepads () method returns an array of Gamepad objects, one for each gamepad connected to the ... Use of this feature was blocked...
Read more >I get getGamepad warnings but I'm not using gamepads at all
I started getting getGamepad warnings in HTTP context. ... and I don't want to use gamepads at all :thinking: How to fully disable...
Read more >Is the HTML5 Gamepad API limited to only 4 Controllers?
getGamepads (); seems to return an array of 4 undefined spots in Chrome and Edge, and an unspecified array in FireFox that still...
Read more >Gamepad - W3C on GitHub
Axes that are drawn from a 2D input device SHOULD appear next to each ... Gamepads returned by getGamepads () MUST NOT report...
Read more >Using Gamepads and Joysticks in JavaScript - Beej.us
Also I can't seem to get it to show another one of my joysticks at all. ... getGamepads(); for (let i = 0;...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I added this in the _character_device() in the InputDevice class:
And then calling this in my code:
To bypass the while True loop in iter(). Not so pretty but hey, it worked for me!
I think adding this flag and also yeilding an empty array in iter() if there is no data would be a nice complete solution but I never tried it.
why was the blocking parameter never added to inputs? I either need to run part of my input handling in a seperate thread or I need to edit inputs to be nonblocking. it reduces my programs fps from 3000 to about 200 with most of the time being spent waiting for inputs.get_gamepad()