yy-input
basic input support for touch, mouse, and keyboard
rationale
I used this in all my games, so I decided to centralize and share it. This is a very simple class that emits events after a touch, mouse, or keyboard event. The events are tied to an HTMLElement.
installation
npm i yy-input
simple example
const Input = require('yy-input')
this.input = new Input()
this.input.on('down',
function down(x, y)
{
console.log('You clicked at ' + x + ', ' + y)
})
live example
https://davidfig.github.io/input/
API
constructor(options)
destroy()
addPointers()
removePointers()
addKeyboard()
removeKeyboard()
License
MIT License
(c) 2017 YOPEY YOPEY LLC by David Figatner