Simple Gamepad decoder library

I built noordstar/elm-gamepad, a small library that helps users add controller support for their Elm apps. Using the following JavaScript function,

navigator.getGamepads();

Web developers can add support for controllers to their Elm apps (or games). If you port this function to Elm, you can use Gamepad.decoder to decode the JSON, and then use the other functions to extract the right data from the file.

Please check out this live demo! Connect a game controller and test all the buttons.

As a sidenote, not all controllers function properly in the browser. So if you’d like to check the configuration of a controller, please send your test results to me, so that I can write a patch and add compatibility for unusual/off-brand/broken/old controllers. :slight_smile:

9 Likes

Awesome to see more things built with elm and games. BTW, there is also xarvh package elm-gamepad 3.0.0 which has existed for quite a while, and was working well last time I used it (few years ago). Would be great to see it mentioned in your readme and explain the main differences and tradeoffs.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.