Skip to content

feature: added human-readable names for input keys#7315

Open
unstoppablecarl wants to merge 1 commit into
phaserjs:masterfrom
unstoppablecarl:input-key-names
Open

feature: added human-readable names for input keys#7315
unstoppablecarl wants to merge 1 commit into
phaserjs:masterfrom
unstoppablecarl:input-key-names

Conversation

@unstoppablecarl

Copy link
Copy Markdown

This PR

  • Adds a new feature

Describe the changes below:

Adds human readable strings for input keys.

import GetKeyName from Phaser.Input.Keyboard.GetKeyName
import KeyCodes from Phaser.Input.Keyboard.KeyCodes

GetKeyName(KeyCodes.LEFT) // '←' 
GetKeyName('LEFT') // '←'
GetKeyName(KeyCodes.BACKSPACE) // 'Backspace'
GetKeyName('BACKSPACE') // 'Backspace'
GetKeyName(KeyCodes.OPEN_BRACKET) // '['
GetKeyName('OPEN_BRACKET') // '['

This PR still needs tests and documentation updates. I'm happy to do them if this PR is approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant