HTML5 Gamepad not detected in HTML5

Discussion in 'GameMaker Studio 2 Community Tech Support' started by Hector Guerrero, Apr 15, 2017.

Tags:
  1. The function "gamepad_get_device_count()" returns 0 in HTML5 using GMS2, I have a gamepad connected and it is not detected.
    Have any one a trick or know how to detect the gamepads in the browser?
    Thanks in advance.
     
  2. JSON

    JSON Guest

    I would also like to figure this out. I have the same results "gamepad_get_device_count()" returns 0 in HTML5 export GMS2.... Please help!
     
  3. chmod777

    chmod777 Member

    Joined:
    Aug 26, 2016
    Posts:
    199
    Obviously, this function should return the length of an array (empty by default) but this array is never altered. So it always returns 0.
    I can't try but that looks like a bug. @Mike
     
  4. Ben Taylor

    Ben Taylor Member

    Joined:
    Mar 19, 2017
    Posts:
    5
    I was having a similar problem in GMS 1.4, not sure how much help it'll be for 2.0 but worth a look.

    For reference GMS 1.4 HTML5 Export was (and still is) returning gamepad_get_device_count(); = 0 but I'm now playing it with a gamepad.

    If you need it for one gamepad then it looks like the HTML5 export will still let you use the gamepad if you use device 0.

    So if you're checking gamepad_get_device_count() to start your gamepad code try gamepad_is_connected(0). That worked for me. Could be that checking specific slots works fine? Haven't checked but you could just loop a reasonable number of devices since the number of slots available will never realistically be higher than 20.

    Also found that it gets some buttons mixed up? Could just be the controller (DS4) as I only have one to test with but the triggers swap with the right thumbstick.

    html5gamepad
    .com/ revealed that one for me.

    Hopefully that helps, very little information out there about this.
     
  5. gnysek

    gnysek Member

    Joined:
    Jun 20, 2016
    Posts:
    1,305
  6. Abrexas

    Abrexas Member

    Joined:
    Aug 10, 2016
    Posts:
    72
    Had the same issue, and could have the same solution for you?
    Turns out the browser doesn't recognize a controller until some input has occurred. Felt pretty dumb when I figured this out, but everything works fine after pressing any button on the controller haha.
     
  7. Adam Eason

    Adam Eason Member

    Joined:
    Apr 19, 2018
    Posts:
    2
    THANK YOU. i know this was forever ago, but its good to know.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice