Skip to content
This repository has been archived by the owner on Mar 5, 2021. It is now read-only.

Uncaught Error: Invalid gamepad info #159

Open
Occult-Dev opened this issue Oct 25, 2016 · 4 comments
Open

Uncaught Error: Invalid gamepad info #159

Occult-Dev opened this issue Oct 25, 2016 · 4 comments

Comments

@Occult-Dev
Copy link

When I attempt to use the code: Sup.Input.getGamepadAxisValue( 0, 4 ) [ which should return the value of the right-thumbstick on a wired xbox360 controller ], I am met with the error: Uncaught Error: Invalid gamepad info.

I receive this error when I set the 'axis' in Sup.Input.getGamepadAxisValue( gamepad: number, axis: number ) to anything above 3.
However, according to this site: www.html5gamepad.com, it shows that I should be able to go up to axis-7.

@bilou84
Copy link
Contributor

bilou84 commented Dec 17, 2016

Hmm, I have an xbox360 controller too and for me the right-thumbstick is defined as the seventh button. So I can do Sup.Input.getGamepadButtonValue(0, 7) to get the value. Does that work for you?

I am not sure why we would have different behavior, but we can easily support more axes. Just need to change around here:
https://github.com/superpowers/superpowers-game/blob/master/SupEngine/src/Input.ts#L220
https://github.com/superpowers/superpowers-game/blob/master/SupEngine/src/Input.ts#L526

@Occult-Dev
Copy link
Author

unfortunatly, that doesn't appear to fix it.

for me, gamepad-button #7 is the start-button.

I should note that I'm using a 'slightly-offbrand' Disney Tron branded controller. And, while I was once able to use the original code I posted above in an earlier version of superpowers, it very well could just be something wonky going on with the controller.

When I get some time, I'll try and modify the parts you referenced and rebuild to see what happens...

@elisee
Copy link
Contributor

elisee commented Dec 29, 2016

Can you post of screenshot of what you see on html5gamepad.com? Sounds like your gamepad is fairly unconventional in its mappings. Also are you on Windows?

As @bilou84 said, we can increase from 4 to 8 axes or whatever if that works for you.

@Occult-Dev
Copy link
Author

Occult-Dev commented Dec 31, 2016

sure, here is me holding the right thumbstick up:
selection_003

here is the left thumbstick being held up:
selection_0031

and here is me pressing the start button which the site recognizes as 'Button-7' [ axis 2 & 5 are the left and right triggers, respectively. -1 represents them being 'idle' ]:
selection_0032

I'm using Linux Mint 18 Mate

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants