Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Controller.js is built to handle the busy-work associated with using the Gamepad API make it easier to use for non-gaming purposes. It has three main features:
An event-driven interface
Controller.js fires DOM events on controller state and input changes. It keeps track of each input's changes over time and reports them similarly to mouse and keyboard events.
Each event provides a packet of information about the event fired, such as coordinates and angle for analog stick events.
Standardized input names
A challenge of working with gamepads is the number and variety of devices that exist in the market. Some will have more inputs than a "normal" gamepad, and some will have fewer. The Gamepad API allows for an arbitrary number of buttons and axes but it doesn't privide a way to tell what each of those inputs actually is.
buttons might be a D-pad input on one gamepad, but a trigger on another.
Controller.js alleviates this issue by mapping raw inputs against a set of known layouts and giving each input a unique, descriptive name, i.e.
Useful features and settings
Controller.js provides a set of functions for common tasks and configurable options for each gamepad. It handles the process of discovering gamepads, mapping their inputs and listening for and pausing events from those gamepads. It also provides settings to do things like change button sensitivity or map analog stick movements to the D-pad.
Explore The API
Contributing (in progress)
→ Grunt Tasks
Creating Layout Maps