PurpleKingdomGames / indigo

An FP game engine for Scala.
https://indigoengine.io/
MIT License
650 stars 60 forks source link

Modifies Keyboard events to use the `code` property #772

Closed hobnob closed 3 weeks ago

hobnob commented 1 month ago

This is a breaking change

Fixes https://github.com/PurpleKingdomGames/indigo/issues/766 by adding a new KeyCode enum, which is populated with the values from the code property of the KeyboardEvent. Additionally, the Key class also has a new location property, which maps to the location property of the KeyboardEvent.

All Key.*_ARROW constants are now Key.ARROW_* to bring it in line with the key codes that they relate to:

The KeyboardEvent itself now also supports some new additional properties:

Additionally adds isNumeric and asNumeric methods to Key in order to fulfill #746