mtmckenna Posted February 29, 2016 Share Posted February 29, 2016 Has anyone had a good experience with a JS library that wraps keyboard/mouse/touch input? Thank you! Quote Link to comment Share on other sites More sharing options...
mattstyles Posted February 29, 2016 Share Posted February 29, 2016 Phaser has its own module to handle this if you are using it. I wrote my own wrapper for keyboard input called Quay, there is no UMD build but if you are using something to package commonJS modules (i.e browserify, webpack) it'll work immediately. It is particularly suitable for games as it'll emit a (reasonably) reliable stream of keyboard events when a key is pressed (natively you have to wait for the key repeat which is usually a deal-breaker for games). It also keeps track of currently pressed keys which can be useful for checking for multiple keypresses (cmd-X, ctrl-S, etc etc). It does not handle mouse/touch input, I'd use a separate module for that although I havent found any use-case where native event listeners didnt do the job. Quote Link to comment Share on other sites More sharing options...
mtmckenna Posted March 1, 2016 Author Share Posted March 1, 2016 Thank you, @mattstyles ! Quote Link to comment Share on other sites More sharing options...
Roman Posted March 9, 2016 Share Posted March 9, 2016 I've been using hammerjs for the swipe detection from JS and i totally can recommend it for these purposes Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.