foreignsasquatch / raylib-hx

Haxe bindings for raylib, a simple and easy-to-use library to learn videogame programming
https://raylib.com
zlib License
56 stars 12 forks source link

Enable pattern matching on Rl.Keys #27

Closed jobf closed 1 year ago

jobf commented 1 year ago

The following code would produce the error Only inline or read-only (default, never) fields can be used as a pattern

switch Rl.getKeyPressed() {
 case Rl.Keys.UP: handle_up();
 case _: 
}

Removing static from the fields within enum abstract Keys fixes this.

I also added to and from rules for easier casting. This negates the need for the explicit Int type hint.

foreignsasquatch commented 1 year ago

Thank you :D