Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Joystick callbacks or make joystick input polling available to other threads #601

Open
theagentd opened this issue Sep 9, 2015 · 15 comments · May be fixed by #1590

Comments

@theagentd
Copy link

@theagentd theagentd commented Sep 9, 2015

Hello. We have a problem with input polling where at low frame rates joystick polling is done at such a low frequency that button presses are missed. The documentation specifically disallows calling the polling methods from other threads, which would solve the problem as I could just poll joysticks at a much higher rate from another thread at even intervals independent of frame rate. Alternatively, joystick callbacks would work too.

@elmindreda

This comment has been minimized.

Copy link
Member

@elmindreda elmindreda commented Dec 13, 2015

I'm reworking some joystick internals in 3.2 and will look into this.

@elmindreda elmindreda self-assigned this Dec 13, 2015
@LinusU

This comment has been minimized.

Copy link

@LinusU LinusU commented Dec 13, 2015

Exciting 👏

@elmindreda

This comment has been minimized.

Copy link
Member

@elmindreda elmindreda commented Dec 13, 2015

There will also be a joystick callback added in 3.2 but it has nothing to do with this issue; it's for reporting device connection and disconnection events analogous to the monitor callback.

@badlogic

This comment has been minimized.

Copy link

@badlogic badlogic commented Jan 5, 2016

If i may piggy back on this issue: on Windows, all gamepads are reported to have the same generic driver name. It would be awesome if the 3.2 rewrite would fix this, otherwise it's impossible to select mappings for say Xbox or PS3/4 controllers. I'm happy to send hardware if needed!

@badlogic badlogic mentioned this issue Jan 5, 2016
10 of 14 tasks complete
@elmindreda

This comment has been minimized.

Copy link
Member

@elmindreda elmindreda commented Feb 28, 2016

The joystick callback is ready for use in the dekdevy branch. The only reason it hasn't been merged yet is because DirectInput support isn't done.

@elmindreda elmindreda added this to the 3.2 milestone Feb 28, 2016
@elmindreda elmindreda modified the milestones: 3.3, 3.2 Mar 18, 2016
@elmindreda

This comment has been minimized.

Copy link
Member

@elmindreda elmindreda commented Mar 18, 2016

@badlogic I will look into getting better controller names for 3.2. Thank you for the offer of hardware! I may take you up on that when I start on the remapping work for more SDL2-ish input.

@elmindreda

This comment has been minimized.

Copy link
Member

@elmindreda elmindreda commented Mar 31, 2016

@badlogic XInput with DirectInput fallback has been merged, which should have improved the returned device names.

@httpdigest

This comment has been minimized.

Copy link
Contributor

@httpdigest httpdigest commented Apr 28, 2016

Any progress on the buffered data/event-based DirectInput implementation?

@elmindreda

This comment has been minimized.

Copy link
Member

@elmindreda elmindreda commented Apr 29, 2016

@httpdigest Not yet, have to get 3.2 out first.

@elmindreda elmindreda removed this from High Priority in Review Queue Feb 1, 2017
@elmindreda elmindreda mentioned this issue Oct 17, 2017
6 of 6 tasks complete
@elmindreda elmindreda removed their assignment Oct 26, 2017
@elmindreda elmindreda modified the milestones: 3.3, 3.4 Nov 1, 2018
@beoran

This comment has been minimized.

Copy link

@beoran beoran commented Oct 23, 2019

If you need help with this, I have experience with implementing joystick drivers in the Allegro5 project, so I am willing to contribute. Downstream of GLFW, Ebiten stands to gain much from this feature.

@beoran

This comment has been minimized.

Copy link

@beoran beoran commented Oct 30, 2019

Seeing that people are encouraging me, I'll take this up and work on a PR. Might take me some time though, to finish it...

@beoran beoran linked a pull request that will close this issue Oct 30, 2019
@beoran

This comment has been minimized.

Copy link

@beoran beoran commented Oct 31, 2019

It's going well actually, most code was already in place. Now to test it.

@beoran

This comment has been minimized.

Copy link

@beoran beoran commented Nov 2, 2019

Too bad, there are problems with the fact that GLFW uses active polling for joystick input. I'll probably have to add something in the event polling and waiting, but it looks like it won't be easy to fix it. Suggestions are welcome.

@beoran

This comment has been minimized.

Copy link

@beoran beoran commented Nov 7, 2019

Aha, I got it to work, at least on Linux! Perhaps it works on other platform, I could not test that. Could some other volunteers test it with tests/event on other platforms?

@beoran

This comment has been minimized.

Copy link

@beoran beoran commented Nov 7, 2019

@elmindreda, sorry to ping you, but could you please comment on my PR, and see if I am going in the right way? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.