rezoner / playground

Playground.js is a framework for your javascript based games. It gives you out-of-box access to essentials like mouse, keyboard, sound and well designed architecture that you can expand to your needs.
MIT License
466 stars 50 forks source link

Any Keypress? #32

Open jedStevens opened 8 years ago

jedStevens commented 8 years ago

I posted on the website about a symbol for any keypress, as I believe it may be useful to have access to. Possibly something like app.keyboard.any

rezoner commented 8 years ago

Pushed new version - app.keyboard.any should be there

There is a problem if you press keys, then switch tab or window - I will fix that later.

jedStevens commented 8 years ago

I did a little digging myself as I found that sometimes playground.js reported that -1 buttons were being pressed, so I added a small fix that catches the bottom limit. At line 2300 I changed this.any--; to this.any = this.any - 1 < 0 ? 0 : this.any--; and the -1 problem is no more.

rezoner commented 8 years ago

I will add it as a temporary fix, but we should really find when it happens :)

I am only aware of -1 problem when you press a key being in application - but release it in another window.