The KeyHandler class should use a more powerful system for managing keybindings, revolving around actions:
An action has the following properties:
A name, e.g. move_player_left.
A callback, e.g. player.move_left
A parameter list, e.g. { speed }
A list of keybindings, e.g. { a, left }
A name, being the unique identifier of an action, will be immutable. All other properties will be able to be changed during runtime. Some system for passing in event details to the callback will be required, and dynamic values would be useful here: parameters = { event.is_shift_held and fast_speed or normal_speed }
The KeyHandler class should use a more powerful system for managing keybindings, revolving around actions: An action has the following properties:
move_player_left
.player.move_left
{ speed }
{ a, left }
A name, being the unique identifier of an action, will be immutable. All other properties will be able to be changed during runtime. Some system for passing in event details to the callback will be required, and dynamic values would be useful here:
parameters = { event.is_shift_held and fast_speed or normal_speed }