lmccart/p5.js — pull request #411 by limikael (2014-11-04 01:18:47+00:00)
Title: keyIsDown function

Please see this as the start of a discussion rather than something ready to integrate...

Anyway, the idea with this is to be able to check if a key is currently pressed, in order to get a game like behaviour where it is possible to press for two keys and be able to move a sprite diagonally.

check the example in keyboard/gamestyle.js

Two issues that I see currently:

* What should the name be? The best would be keyIsPressed but that is already busy. I chose keyIsDown in lack of better ideas but not 100% satisfied with it.
* It needs some cross browser/version/os compatibility testing and possible work arounds. It currently works in the latest versions of Chrome and Firefox on my Mac but I noticed it not working in some version of Firefox on some version of Linux. So a bit of testing needed...

Let me know what you think!