I'm trying to add gamepad support to my game, but Construct 2 will not recognize my cheap PS2-style gamepads. The LastButton property will always be 0 for them.
When I test with an XBox360 controller, everything is fine. But I don't want to require every gamepad user to go out and get an XBox360 controller.
So... where do I find out what gamepads are supported by Construct 2 or by the Chrome browser I test on?
Typically everything that says "Xbox360-compatible" on the box.
Some had luck with PS3-compatibles, but that depends on a lot of factors (meticulous driver setups, for instance)
A wider range isn't supported, unfortunately. That's not up to Construct2 though, it's entirely browser-shenanigans.
How unfortunate. I guess I'll just bill my game as "Playable with XB360-Compatible controllers!"
I wonder if Firefox or Chrome offer addons for more controller types?
Develop games in your browser. Powerful, performant & highly capable.
I've been playing for a while with my old gamepad (Mint Gamepad MGP-509) - it didn't work straight away.
I tried using it with a soft called "x360ce" then:
So I assumed that this only fully works with proper X360 compatible gamepads.
I never done it but I believe that you can get other gamepads to work if you use the button index in the gamepad object. I think I read about that in one of Ashley's blogs, or the manual... somewhere, I just can't remember where.
Logitech gamepad f310 works well in my test.
ryanrybot: I'm using Button Index exclusively. However now that I'm done with the implementation there's something else I can check before calling it a lost cause...
I have tried alot of different gamepads for my game and all of them works like a charm so the problem might be your cheap gamepads as you called them. Your game probably works for the majority of the gamepads on the market.
Sorry MoscowModder, it was Raw input I was thinking.
Here's an excerpt from the Manual...
Different controllers have different button layouts, or the buttons have different names. For example, the Playstation 3 controller uses square, circle, triangle and X buttons, whereas the XBox 360 controller uses A, B, X and Y (note that X appears in a different position in each controller too). For consistency, the Gamepad object refers to the XBox 360 layout only.
The Gamepad object will also attempt to map other controller's keys to the XBox 360 layout internally, to ensure the same button always triggers the same event. However it is impractical to set this up for every device in existence, so some device buttons may trigger different key events in the Gamepad object. This is partly why it is recommended to focus on XBox 360 controllers. If you are interested in using Gamepad input extensively, be sure to test on as wide a range of devices as you can obtain.
Raw input can be obtained, circumventing the Gamepad object's built in key mapping, using the Raw expressions.
Retrieve raw axis input for a specific gamepad and axis index. This returns the value without keymapping, applying the analog deadzone, or multiplying the returned value by 100. Axis values range from -1 to 1.
Return the number of axes available in the raw input for a specific gamepad. This returns the value without keymapping.
Retrieve raw button input for a specific gamepad and button index. This returns the value without keymapping. Button values range from 0 to 1 (pressure sensitive buttons can return values in between).
Return the number of buttons available in the raw input for a specific gamepad. This returns the value without keymapping.
How to actually set it up to get other gamepads to work is out of my experience, but I hope this might be something beneficial.
There is a bug in Chromium where when using non-xbox controllers (at least on several of my different non xbox controllers), they can only be used once. If you close the browser or tab, and then open the game again the controller will no longer be recognized.
With Firefox though, this bug is non-existant, you can use your controller no matter how many times you open or close the browser or tab. Who knows how long Chrome will take to catch up in this area?