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

Fix web gamepads #58

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

SirNate0
Copy link
Collaborator

  • Fix gamepads not updating on web
  • Fix crash on web debug build from Input::graphics_ being null during the first SDL_WINDOWEVENT

The html Gamepad API does not support an event-based model, only a polling model for input
(see [here](https://emscripten.org/docs/api_reference/html5.h.html#how-to-use-this-api)).
While mouse and such work without the `SDL_PollEvent` and resulting `SDL_PumpEvents`
call because SDL sets emscripten callbacks that handle the other events,
joysticks will only be connected and updated once, and then not again.
@SirNate0
Copy link
Collaborator Author

SirNate0 commented Dec 12, 2023

I just realized, my changes seem to have broken key press detection (key down works fine, but key presses seem to be missed ~99% of the time).

Correction: I think key-presses are triggering twice, which would toggle the DebugHud on and off with the same key press. (It also broke my jumping code, but that is a separate issue). Interestingly, there is still something different going on with the 1% of cases, so more investigation is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant