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".
Actually there is a way to simulate it. Using yahoo's YUI library there was some things that let you simulate mouse events on a page. Worked pretty well but rather processing intensive. We later ripped it out to something without all the extra YUI stuff. (Full disclosure, work at Flypad on game control stuff)
17 comments
[ 2.7 ms ] story [ 45.0 ms ] threadIt 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".
http://stackoverflow.com/questions/4804068/move-mouse-cursor...
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...
https://github.com/alaingilbert/GamepadJs/blob/master/exampl...
You can click on any links/inputs/labels in the page.
It could probably be possible to create a chrome extension that will allows you to browse the whole web with a gamepad ! :D
This is my gamepad ! Works perfectly on osx.
Here's a demo video: http://www.youtube.com/watch?v=6oBf-Rlm5_Y