Open vchelaru opened 1 month ago
Update - I have tested Slayer Knight ( https://andrewandrepowell.itch.io/slayer-knight-playground ) and I have the same problems - gamepad is not detected in chrome or firefox, but works fine in Edge.
This may be related to plugins on Chrome. I uninstalled most of my plugins and I was able to get a connected gamepad - at least, I was getting something I didn't get before - an exception. I think that the exception is an unrelated issue, but it is preventing me from testing with this Xbox360 gamepad that I have. For reference, the issue is:
https://github.com/kniEngine/kni/issues/1850
I was able to get this exception to happen by uninstalling plugins/disabling plugins. This is what I have enabled (notice most are disabled):
Another user was able to get gamepads working, these are the plugins they had enabled:
In Firefox after pressing a button, calling navigator.getGamepads()
actually returns an array with the gamepad in it...
Why the pooling code does not detect it?
I can no longer reproduce the issue in chrome; however, I can reproduce the issue that @mfigueirido posted above in Firefox. I believe the two issues that I had (chrome and Firefox) might be unrelated. I can also see the gamepad array using the same code:
I've tested it with two xbox360 controllers. Both worked on Chrome without making any changes. On firefox unfortunately the controllers are not detected, not even locally.
For the issue in firefox, does it fire the gamepadConnected event? it's in window.js, place a break point there and connect/disconnect the controller and press a couple of buttons.
Gamepads are detected properly when creating a local game project (both debug and release), but they are not detected when the project is deployed.
I have created a simple project that reproduces the problem:
XboxGamepadTest.zip
For convenience, the only difference between this project and a brand new BlazorGL project is the code to read the gamepad and output it to the console. Here's the entire Game class:
If I run this locally, I can view the console in the browser to see that the gamepad does get connected once I press the A button (it does not connect until input is registered).
I have uploaded the project here:
https://files.flatredball.com/WebProjects/GamepadTest/wwwroot/
Unfortunately if I run this, the gamepad is never connected, nor is input detected even if I press buttons on the gamepad.
This problem reproduces on both Chrome and Firefox, but mysteriously enough it works fine in Edge.
What could I be doing wrong on Firefox and Chrome?
What version of KNI does the bug occur on:
What operating system are you using:
What KNI platform are you using: