quasilyte / ebitengine-input

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

Add press duration to PressedActionInfo #33

Closed phalasz closed 8 months ago

phalasz commented 9 months ago

Add key press duration to the PressedActionInfo's EventInfo. Resolves quasilyte/ebitengine-input#32

I've included an internal minOf implementation. This can be removed if the required go version can be bumped to 1.21.0+ which has a built-in min function with variadic parameter support.

quasilyte commented 9 months ago

I'll take a closer look tomorrow, but I think it looks good. I would like to mention that the duration is in frames, as it may not be obvious unless you're expecting it to have the same API as inpututil.

phalasz commented 9 months ago

Sure, no worries. Let me know if changes are needed or if there are improvements that should be made.

quasilyte commented 8 months ago

We may want to add something that uses this feature in the examples though. It could be a new example or some extension to an already existing example.