Gamepad not working with HTML5 target
-
flixel: [4.3.0]
lime: [2.9.1]
openfl: [3.6.1]Gamepad works with neko, but doesn't with html5
When I do a trace(FlxG.gamepads); I get:
Levels.hx:128: {
activeGamepads : [],
gamepads : [],
hx__closures : {
65 : <function>,
66 : <function>
}
}Gamepad is logitech RumblePad 2, browser is chromium 62.0.3202.89 on Debian 9.2 (64-bit)
Gamepad works here : http://html5gamepad.com/
Is this a known problem with flixel: [4.3.0] + lime: [2.9.1] + openfl: [3.6.1] ?
Should I downgrade to a version where gamepads actually work for html5 ?
Thx for reply
EDIT:
The flixel-demo "GamepadTest" works in neko, but doesn't in HTML5
In HTML5 it says "No gamepad detected" or something like that
-
This post is deleted!
-
@jul2000 UPDATE
So, it appears that if I replace
if(data.mapping == "standard") { cache.isGamepad = true; }
By
cache.isGamepad = true;
In ,updateGameDevices: function()
The gamepad gets recognized
Left axis/analog stick works as expected, not buttons, they are messed up (basically right stick becomes jump button, on neko button 2 is jump button)
Oddly , the directional arrows work too, by pushing the "mode" button, which does nothing normally when exported to neko (in that case analog stick and directional arrows both work at the same time)
As a reminder, this is my pad
Logitech RumblePad 2, pretty standard
Any idea how I can fix that from AS3/Haxe code instead of directly modifying it in the HTML5 code ?
-
@jul2000 So I ended up hacking my way out of this in an absolutely fucken horrible way, but now I get gamepads inputs working with html5 build, completely messed up inputs when it comes to buttons, but the directional pad and stick work as expected
It came from lime 2.9.1
So I basically went to haxelib/lime/2.9.1/lime/_backend/html5/HTML5Application.hx and added
cache.isGamepad = true;
right after
if (data.mapping == "standard") { cache.isGamepad = true; }
on line 394
Now I need to hack my ingame gamepad controls specifically for html5 target and I'm not even sure the buttons will somehow get detected or if that will be even remotely consitent with different gamepads
Sad
Edit: In order to make it work properly (buttons) I have to change model from LOGITECH to XINPUT
if (FlxG.gamepads.lastActive != null){ FlxG.gamepads.lastActive.model = FlxGamepadModel.createByName("XINPUT"); }
Edit: Sad
-
while the title for this thread is definitely incorrect - when pulling the gamepad example at
http://haxeflixel.com/demos/GamepadTest/I can successfully connect a xbox360 controller and have it detected using firefox on android, chrome on android and desktop - but I cannot successfully detect a gamepad on desktop firefox.
As another thread indicated, the gamepad events are provided to haxeflixel through openfl.
Sounds like the issue was on chromium on linux, I wonder if using stardard chrome on windows or android chrome or firefox might've worked.
I have yet to see the demo work with any controller on desktop firefox.