

HTML5 Gamepad API - alain_gilbert
https://github.com/alaingilbert/GamepadJs

======
drawkbox
Another excellent gamepad library that seems to have more support:
<https://github.com/sgraham/gamepad.js> Also a demo:
<https://github.com/robhawkes/gamepad-demo>

------
austinhallock
Another option: <http://johndavidfive.com/inpoot/>

Here's a demo video: <http://www.youtube.com/watch?v=6oBf-Rlm5_Y>

------
alain_gilbert
If you have any comments/suggestions/critics/pull request... You're welcome !
:)

~~~
powrtoch
First idea that comes to mind:

It would be cool if there were an option to let the gamepad act as a mouse.
There would be an initialization option, as well as a toggle function, called
something like "controlMouse".

When activated, the control stick would be able to move the cursor around, and
something intuitive like A=left click B=right click would work for the
buttons.

You could call this toggle function from any sort of event listener, including
a button press. So there would never be a situation where the user needed to
switch back and forth between the mouse and the gamepad while on your page:
You could just find some button or button combo not used by your game, make it
the "mouse mode" toggle, and the user could switch back and forth seamlessly
between "gamepad for game control" and "gamepad as mouse".

~~~
alain_gilbert
That would be great ! Unfortunately, we cannot control/move the mouse in
javascript (as far as I know). But, thanks for the suggestion !

~~~
powrtoch
Technically true, but you can fake it if it really strikes your fancy.

[http://stackoverflow.com/questions/4804068/move-mouse-
cursor...](http://stackoverflow.com/questions/4804068/move-mouse-cursor-
javascript)

~~~
alain_gilbert
I've try to do some hacks today, and the best I can do is to create a fake
cursor, and generate click on specific DOM elements.

It's impossible to fake a click on a precise screen position.

The only way I think that it can be done:

\- Create a dom selector that will gets all the links and inputs.

\- For each elements, verify if the pointer is inside (over) the element.

\- Then create a fake click for that element.

I just thought about it, I don't know if it could be viable/fast enough...

------
newobj
Related, can someone recommend a "it just works" gamepad (wired better than
wireless) for use with OSX? Preferably attainable via Amazon?

~~~
alain_gilbert
[http://www.amazon.com/Logitech-Dual-Action-USB-
Gamepad/dp/B0...](http://www.amazon.com/Logitech-Dual-Action-USB-
Gamepad/dp/B003NMMGUE)

This is my gamepad ! Works perfectly on osx.

~~~
ajacksified
I can also vouch for this gamepad- I've had one for over five years.

------
jeep87c
Wow fantastic!

