A brand new game
for Windows, Linux, Mac, HTML5, 3DS Homebrew and more
21st February, 2020
Image taken from Browser Gamepad page
Aaah, the complicated world of buttons..
I'm currently delving into the joypad configuration stuff in the Browsercade again. (nnngh!)
The "Standard" is laid out as above, and typically any and all controllers you plug in are supposed to follow those numbers.
The essential numbers being 0 and 1 for A and B, 12,13,14,15 for the DPad, 5 for Start.
The two thumbsticks are X (-=left, +=right) and Y (-=up, +=down)
This has improved immeasurably in just the year or so since I started the Browsercade project. Back then, different browsers hadn't yet settled on these standards, and sometimes the buttons were laid out differently, sometimes the Y controller would be inverted, and so on.
But it seems that standardising things has helped a LOT!!!
Michael Fernie should, at the very least, be able to wiggle his thumbstick without accidentally pausing the game.
This is all, of course, dependant on the Browser (and how up to date the browser is), the current OS, as well as the type of Controller, the driver versions, and probably more.
And this is the crux of the matter.
Numbers can solve a lot of issues in gamedev, but only if those numbers are where you expect them to be!
On a keyboard, scancodes are a wonderful thing. The button next to caps lock is number 30. Check for number 30 and you'll know that's the button "Where A is on my QWERTY Keyboard".
Left = Button(30) and we're 25% of the way to WASD controls.
If instead you have to Left = Button("A") then you have a problem when people have an AZERTY keyboard.. A's not in the same place, anymore, but the physical key will always be #30. (Or at least, that's the number it used to be, back in the BlitzBasic days!)
So, knowing that standardised numbers are, at the very least, in the process of being added to browsers.. That can only be a good thing.
Bring it on, Browser-dev's!!