MovingBlocks / DestinationSol

Official continuation of Destination Sol, the great fun little arcade space shooter from http://sourceforge.net/projects/destinationsol/ Modules live at https://github.com/DestinationSol/
Apache License 2.0
326 stars 123 forks source link

feat(input): remove fixed keyboard controls from GameOptions #655

Open BenjaminAmos opened 2 years ago

BenjaminAmos commented 2 years ago

Description

This pull request moves the input control constants from GameOptions into a separate DefaultOptions enum. GameOptions has been changed to instead use a dynamic map of controls to their triggering inputs. This should allow for greater extensibility in the future, since modules can now define input controls. There is no way at present to persist the runtime-added controls yet.

An input control consists of an action that can be triggered by any number of input keys. The control itself contains the constant data describing what the control is and how it can be used. Controls are now associated with input types, which can be any of KEYBOARD, MIXED, MOUSE and CONTROLLER. Controls can be associated with multiple input types.

A control can now support an arbitrary number of keys as triggering inputs. This is implemented internally within GameOptions but currently nothing in the game supports it. Changing the input bindings from the main menu will replace all existing bindings for that control with the single binding chosen currently.

Testing

Future Improvements

These changes are not happening in this pull request but would be ideal as follow-ups.

Notes