This feature PR adds two new key press event, one for pressing a key and one for releasing a key. The distinction is that the precise key press events include the SDL timestamp of the keypress. By calling SDL_GetTicks() (which this PR also includes an interface for), you can calculate the number of milliseconds since the key was pressed. This is useful for mitigating input latency.
Notes:
The previous PR (#1561) is now deprecated and has been closed.
This PR creates a new, otherwise-redundant key press event to prevent breaking changes from modifying the existing key press event.
The event has been made to be compatible with both Native and HTML5.
The timestamp provided by the keypress event is only suitable for comparision, and is not an absolute/Unix timestamp.
This behavior probably needs to change somehow, for example making a Timestamp object with various compare functions available.
On native, compare to lime._internal.backend.native.NativeCFFI.lime_sdl_get_ticks().
On HTML5, compare to js.Browser.window.performance.now().
The old key press event can be deprecated and eventually removed in a future update.
Once #1684 is tested, debugged, and implemented, the event can be updated to use nanosecond timings instead.
This feature PR adds two new key press event, one for pressing a key and one for releasing a key. The distinction is that the precise key press events include the SDL timestamp of the keypress. By calling
SDL_GetTicks()
(which this PR also includes an interface for), you can calculate the number of milliseconds since the key was pressed. This is useful for mitigating input latency.Notes:
compare
functions available.lime._internal.backend.native.NativeCFFI.lime_sdl_get_ticks()
.js.Browser.window.performance.now()
.