openfl / lime

A foundational Haxe framework for cross-platform development
https://lime.openfl.org/
MIT License
749 stars 361 forks source link

Prevents stuck if we don't have access to gamepad #1728

Closed andrew-git closed 7 months ago

andrew-git commented 7 months ago

Original issue: Failed to execute 'getGamepads' on 'Navigator': Access to the feature "gamepad" is disallowed by permissions policy. #1727

andrew-git commented 7 months ago
// if something went wrong, treat it the same as when navigator.getGamepads doesn't exist
// we probably don't have permission to use this feature

But we anyway will continue to try get gamepads each frame https://github.com/openfl/lime/blob/develop/src/lime/_internal/backend/html5/HTML5Application.hx#L362

@joshtynjala Maybe add additional fixes or add flag to disable calls of updateGameDevices() if we don't need gamepads/joysticks in game?

joshtynjala commented 7 months ago

But we anyway will continue to try get gamepads each frame

This should be fine. It should behave the same as an older browser where navigator.getGamepads doesn't exist: updateGameDevices() will see null and return early.