Skip to content

Instantly share code, notes, and snippets.

@deathcap
Created November 10, 2013 03:55
Show Gist options
  • Save deathcap/7393584 to your computer and use it in GitHub Desktop.
Save deathcap/7393584 to your computer and use it in GitHub Desktop.
kb-controls mouse test right-click
var raf = require('raf')
, kb = require('./index')
var pre = document.createElement('pre')
document.body.appendChild(pre)
var ctl = kb({
'<left>': 'strafe_left'
, '<right>': 'strafe_right'
, '<up>': 'forward'
, '<down>': 'backward'
, 'W': 'forward'
, 'A': 'strafe_left'
, 'S': 'backward'
, 'D': 'strafe_right'
, '<mouse 1>': 'fire1'
, '<mouse 2>': 'fire2'
, '<mouse 3>': 'fire3'
, '<mouse 4>': 'fire4'
})
raf(document.body)
.on('data', function(dt) {
pre.textContents = pre.innerText = JSON.stringify(ctl)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment