1- /*! p5.js v0.3.13 December 01 , 2014 */
1+ /*! p5.js v0.3.13 December 03 , 2014 */
22var shim = function ( require ) {
33 window . requestDraw = function ( ) {
44 return window . requestAnimationFrame || window . webkitRequestAnimationFrame || window . mozRequestAnimationFrame || window . oRequestAnimationFrame || window . msRequestAnimationFrame || function ( callback , element ) {
@@ -3000,7 +3000,7 @@ var inputfiles = function (require, core, reqwest) {
30003000var inputkeyboard = function ( require , core ) {
30013001 'use strict' ;
30023002 var p5 = core ;
3003- p5 . prototype . _downKeys = [ ] ;
3003+ var downKeys = { } ;
30043004 p5 . prototype . isKeyPressed = false ;
30053005 p5 . prototype . keyIsPressed = false ;
30063006 p5 . prototype . key = '' ;
@@ -3009,9 +3009,7 @@ var inputkeyboard = function (require, core) {
30093009 this . _setProperty ( 'isKeyPressed' , true ) ;
30103010 this . _setProperty ( 'keyIsPressed' , true ) ;
30113011 this . _setProperty ( 'keyCode' , e . which ) ;
3012- if ( this . _downKeys . indexOf ( e . which ) < 0 ) {
3013- this . _downKeys . push ( e . which ) ;
3014- }
3012+ downKeys [ e . which ] = true ;
30153013 var key = String . fromCharCode ( e . which ) ;
30163014 if ( ! key ) {
30173015 key = e . which ;
@@ -3029,9 +3027,7 @@ var inputkeyboard = function (require, core) {
30293027 var keyReleased = this . keyReleased || window . keyReleased ;
30303028 this . _setProperty ( 'isKeyPressed' , false ) ;
30313029 this . _setProperty ( 'keyIsPressed' , false ) ;
3032- if ( this . _downKeys . indexOf ( e . which ) >= 0 ) {
3033- this . _downKeys . splice ( this . _downKeys . indexOf ( e . which ) , 1 ) ;
3034- }
3030+ downKeys [ e . which ] = false ;
30353031 var key = String . fromCharCode ( e . which ) ;
30363032 if ( ! key ) {
30373033 key = e . which ;
@@ -3057,7 +3053,7 @@ var inputkeyboard = function (require, core) {
30573053 }
30583054 } ;
30593055 p5 . prototype . keyIsDown = function ( code ) {
3060- return this . _downKeys . indexOf ( code ) >= 0 ;
3056+ return downKeys [ code ] ;
30613057 } ;
30623058 return p5 ;
30633059 } ( { } , core ) ;
0 commit comments