Jump to content

Browse full list of keyboard buttons


spinnerbox
 Share

Recommended Posts

Is there a way to see the full list of keyboard buttons? For example Phaser.Keyboard.SPACEBAR, Phaser.Keyboard.ONE, Phaser.Keyboard.TWO etc...

I cannot see these "constants" in the phaser 2.2.2 docs. 

For example I need dot, single quote, dash(minus), ~ 

Link to comment
Share on other sites

  • 2 weeks later...

Any ideas how can i separate keys that have alphabet letters including space, dot, dash, tilde from other buttons?

Yes letter buttons have keypress event additionally while other non-letter buttons have only keydown and keyup but how could I do this in Phaser? Are there some helper properties that can aid me in this task?

I want to effectively disable(override default behavior) all other keys except letter keys, dot, dash and space. Could I do this somehow automatically or I have to go key by key?

Here is code I use to override default behavior of some of the buttons:

sendOtherKey = function (kbBtn) {
	// do some stuff with kbBtn
};

myBackspaceKey = game.input.keyboard.addKey(Phaser.Keyboard.BACKSPACE);
myBackspaceKey.onDown.add(sendOtherKey, this);

 

Link to comment
Share on other sites

I'm not entirely sure how to cancel/stop all other keys in Phaser. You could dip outside of Phaser and add the event listeners to the canvas directly. Then you could call "stopPropagation" and "preventDefault" on them yourself, and handle the ones you care about directly.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...