How to make the gamepad work on the new Cocoon?


Hello, I was using the old CocoonJS and was working on a game for Android that needs gamepads, and it was working good, now I compiled with the new CocoonIO and installed the Canvas Gamepad on the settings but it doesn’t recognize the gamepad anymore.

Does anyone have this issue or knows how to fix it? (Thanks in advance)

(I’m using MelonJS)


It’s solved, the old cocoon gamepad js code doesn’t work anymore, but MelonJS (the engine I’m using) has some gamepad support on it’s own on the newest version, it worked fine adding the Canvas Gamepad plugin and exporting as Webview+.



Great news! It would be awesome if you could provide a tutorial for that.
Either here in the forum or on shatter-box:

This will help others a lot!

Thank you!



Hello, I still have some issues, I’m using melonJS new version and it allows to get the axes values of the analog sticks of the gamepads, but I can’t get the data from the second analog.

The same stuff happends if I try this: on the coocon webview+ or using chrome on android, if I open that link using firefox the data from that stick does show up.

Also the Canvas+ option it’s not loading (the old version cocoon canvas+ with an old version of melonjs worked with the two analogs), I will need to understand and maybe solve those issues before doing a tutorial.


Hello again, I’ve been trying some stuff and I came to two conclusions, first it’s not needed to add the gamepad plugin with the Webview+, the gamepad just work on it by default, if you are using melonJS use the 3.1.0 version or later to get access to the axis.

Second, some gampads on some devices have diferent behaviours, for example the PS3 gamepad on a JXD s5800 works perfect, but if you use the same gamepad on an Ouya you will not get the right stick axes data, the Ouya gamepad on the Ouya doesn’t get those axes neither con Cocoon, and when I tryied the Ouya gamepad on the JXD s5800 it wen’t completly wrong, and the built-in gamepad of the JXD s5800 doen’t get the data for the right stick neither.

Soo keep those things in mind and try to get the devices and the controllers you want your game to run cause you will need to try them.


One more thing about this subjet, on the Webview+ the gamepads works (with some issues depending on the gamepad brand, but mostly works).

But on Canvas+ I can’t find a way to add the gamepad support, and it worked on old cocoonJS, can you help me or it’s only posible to add gamepad support on Webview+ now?


Please, a solution to this problem canvas plus!


Hi @irisnegro @naujalberto
For this matter you have to ask @imanolm1
But if it worked in CocoonJS it should be possible in CocoonIO (Canvas+) as well.



Hi every body

i ve been searching to make gamepad work with no success
does any one make it work ?
it works on webview+ but not in canvas+ mode
none of the function webkitGetGamepads or getGamepads seems to be implemented

Will take every help

My code is actually :

  var gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads : []);	
  for (var i = 0; i < gamepads.length; i++) {
		console.log('gamepad detected');

thanks a lot



Hi , Any news on this ?
Does anyone make it work with canvas+ ?

May be cocoon dev are on it , but is it possible just to know that we have to wait ?

tks a lot



Still nothing ?
you know this thing has been reported a year ago
for a game solution, cocoon is missing something :’(

see ya