Bombfuse / emerald

A 2D rust game engine focused on portability.
MIT License
558 stars 16 forks source link

Input handler for actions #187

Open nezvers opened 2 years ago

nezvers commented 2 years ago

An option to bind more than one input to a single input action. For example Godot input actions and Unity's new InputSystem. In Godot, there are several ways how to interact with actions, all of which take into account the deadzone (default 0.5). ref: Input | InputMap Input.is_action_pressed - true if any associated input is held Input.is_action_just_pressed / released - true only for one frame Input.get_action_strength - 0.0 to 1.0 for analogue input and 0 or 1 for other Input.get_axis( negative_action, positive_action ) - gives result (example right_action minus left_action)

For more naming examples/influence: Gamemaker: key_check - true if the button is held key_check_pressed / key_check_released - true for one frame

Unity: GetKey - true if a key is held GetKeyDown / GetKeyUp - true for one frame

Bombfuse commented 2 years ago

Added some really basic bindings in via https://github.com/Bombfuse/emerald/pull/189, I think we still need to add the analogue stick related APIs.