Currently, keyboard and mouse input is all handled in an ad-hoc manner in window.rs. Adding an extra layer of abstraction could help simplify the process of adding a new control. We could solve the following problems in one central place (although we don't need to solve them all now to resolve this issue):
Allowing rebinding of controls
Adding contextual controls
Having input presses that trigger an event on the next tick
Having an axis control for movement
Detecting conflicts (and allowing the same key to do multiple things if unambiguous enough)
etc. (This list is not exhaustive.)
Ideally, after this issue is done, if somebody wants to add a new key that does something, they'll just need to add the logic with minimal boilerplate code.
Currently, keyboard and mouse input is all handled in an ad-hoc manner in
window.rs
. Adding an extra layer of abstraction could help simplify the process of adding a new control. We could solve the following problems in one central place (although we don't need to solve them all now to resolve this issue):Ideally, after this issue is done, if somebody wants to add a new key that does something, they'll just need to add the logic with minimal boilerplate code.