Skip to content
/ gkey Public

An index of gamepad input mappings for controllers using the HTML5 gamepad API

License

Notifications You must be signed in to change notification settings

hughsk/gkey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gkey

A list of human-readable names for Browser-friendly gamepads. Currently only supports generic/Xbox-like controllers, but if you have the opportunity to test with others then submit a pull request and I'll merge it in!

Installation

npm install gkey

Usage

See gp-controls for an example implementation.

var generic = require('gkey/generic')
var xbox = require('gkey/xbox')

var gamepad = navigator.getGamepads()[0]

console.log(generic.buttons[0], gamepad.buttons[0]) // "<action 1>" 1
console.log(xbox.buttons[0], gamepad.buttons[0])    // "<a>" 1

console.log(generic.axes[0], gamepad.buttons[0])    // "<axis-left-x>" -0.75
console.log(xbox.axes[0], gamepad.buttons[0])       // "<axis-left-x>" -0.75

About

An index of gamepad input mappings for controllers using the HTML5 gamepad API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published