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

HTML5 Gamepad API #18

Closed
wants to merge 3 commits into from
Closed

HTML5 Gamepad API #18

wants to merge 3 commits into from

Conversation

SpliFF
Copy link

@SpliFF SpliFF commented Aug 9, 2017

Changes to allow the use of physical game devices such as gamepads and joysticks on browsers that support the HTML5 Gamepad API.

To use a physical gamepad select "Joystick" for either port in Config->Ports. The existing emulated joystick can be selected by choosing "Emulated" from the same dropdown.

Tested on:

  • Firefox 54 and Chrome 59 on Windows 7
  • Microsoft Edge 25 on Windows 10
  • Firefox 54 on Linux Mint 15

Known Issues:

  • Firefox requires a button on the controller to be pressed before controllers are detected
  • Chrome only detects connection events when you switch to another tab and return (seriously??)
  • Firefox calls devices "xinput" rather than finding the controller proper model name

These are all browser bugs so not much can be done about them.

Shannon Baker added 3 commits August 9, 2017 15:35
Changes to allow the use of physical game devices such as gamepads and joysticks on browsers that support the HTML5 Gamepad API
Detects when gamepad list changes and updates the dropdown.
Prompt user to press button on controller because FF doesn't trigger gamepad events until you do.
Restore default port 1 type to joystick emulation since many players won't have gamepads.
@naTmeg
Copy link
Owner

naTmeg commented Aug 14, 2017

Hi SpliFF, sorry for the delay. This looks interesting, I'll check it...

@naTmeg naTmeg self-assigned this Aug 14, 2017
@naTmeg
Copy link
Owner

naTmeg commented Aug 14, 2017

...nice work! I've extended some things, fixed problems (no call to cancelAnimationFrame(), malformed Joystick.button[]) and did some syntax-cosmetics. Also renamed 'Port 1/2' back to 'Mouse/Game', because this is printed on Amigas. I've finally also added the pointerLock-API, so I do an own commit.

Thanks for your time and work!

@naTmeg naTmeg closed this Aug 14, 2017
@naTmeg naTmeg removed their assignment Aug 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants