quasilyte / ebitengine-input

A Godot-inspired action input handling system for Ebitengine
MIT License
66 stars 8 forks source link

Prefer the longest key combination for events #36

Open quasilyte opened 8 months ago

quasilyte commented 8 months ago

Let's imagine a situation where the user is pressing the ctrl+left mouse button.

The keymap may have these actions:

If we check for ActionMove while pressing ctrl+lmb, it would still match, as lmb is indeed being pressed. This could lead to a double action activation (ActionMove and ActionPing). This might not be the expected behavior.

We could try to resolve these conflicts in favor of the longest match, which would be ActionPing in this case. This resolution is not implemented yet.

Or we can just document this behavior and make it a user's problem to solve.

This conflict resolution, even if implemented in the future, should be optional. It should be configured via the SystemConfig upon system creation (default=false). This would prevent the backward-incompatible behavior as well as give the user some freedom in the way they want the input events to be handled.

quasilyte commented 8 months ago

TODO: check what Godot does in this situation.