Sha256: c62bb01c10109dc794e51db642a53e3ab7b17ed8f29387c4253515289f6c9d0f
Contents?: true
Size: 671 Bytes
Versions: 8
Compression:
Stored size: 671 Bytes
Contents
/* The pressed method is used to check if a key or keys are currently pressed. This is most useful in mousemove, keydown or usually an update listener. @usage //move player re.e('update image player.png') .on('update', function(){ if(re.pressed(['w', 'up'])){ this.posY -= 10; } }); //click based on key re.e('mouse image button.png') .on('click', function(){ if(re.pressed('mouse:middle')){ //do something.. } }); */ re.pressed = function(key){ var c = arguments; if(re.is(key, 'array')) c = key; for(var i=0, l = c.length; i<l; i++){ if(re.pressed.d[c[i]]){ return true; } } return false; }; re.pressed.d = {};
Version data entries
8 entries across 8 versions & 1 rubygems