Keep quick taps and swipes on slow Android frames

Use Kryon's Android touch replay for Inbe's pointer, so a tap or swipe that
starts and lifts within one slow frame, or lifts before its next movement
arrives, reaches the app where the finger actually lifted.
This commit is contained in:
waozi committed 2026-10-08 23:54:15 -03:00
1 parent 838d84c431
commit 37401b5bc7
2 files changed
+29 -14

No files matched your search

+18 -3
View File
@@ -57,6 +57,10 @@ SetTargetFPS :: (fps: s32) #foreign raylib;
#import "swipe_props"
#import "zoom"
#import "scroll_device"
#import "touch_replay"
#if #defined(ANDROID_BUILD) {
AndroidTouch :: #import "android_touch";
}
#import, file "../app/app.zi";
#import, file "../app/app_zoom.zi";
@@ -287,6 +291,17 @@ app_frame :: (app: *InnerBreeze) {
app_route_transition_advance(app, GetTime())
screen_mouse: Vector2 = GetMousePosition()
touch: TouchSample
touch.position = screen_mouse
touch.pressed = IsMouseButtonPressed(MOUSE_BUTTON_LEFT)
touch.down = IsMouseButtonDown(MOUSE_BUTTON_LEFT)
touch.released = IsMouseButtonReleased(MOUSE_BUTTON_LEFT)
#if #defined(ANDROID_BUILD) {
// A touch that began and ended within one frame reports nothing.
AndroidTouch.AndroidTouchInstall()
touch = AndroidTouch.AndroidTouchSample(touch)
screen_mouse = touch.position
}
mouse: Vector2 = screen_mouse
if app.camera.zoom > 0.0 {
mouse = ScreenToWorld(screen_mouse, app.camera)
@@ -313,9 +328,9 @@ app_frame :: (app: *InnerBreeze) {
pointer: PointerFrame
pointer.x = mouse.x
pointer.y = mouse.y
pointer.pressed = IsMouseButtonPressed(MOUSE_BUTTON_LEFT)
pointer.down = IsMouseButtonDown(MOUSE_BUTTON_LEFT)
pointer.released = IsMouseButtonReleased(MOUSE_BUTTON_LEFT)
pointer.pressed = touch.pressed
pointer.down = touch.down
pointer.released = touch.released
app.ui.manual_swipe_frame.pointer = mouse
app.ui.manual_swipe_frame.pressed = pointer.pressed
app.ui.manual_swipe_frame.down = pointer.down
+11 -11
View File
@@ -37,22 +37,22 @@
"source": true,
"url": "https://github.com/LoupVaillant/Monocypher.git"
},
{
"commit": "fa71619a177cfc4cfa228a691e2601327ef77ddd",
"dependencies": {"raylib": "p5a77c9c35110e925"},
"id": "p41cbd2336fa7016b",
"name": "kryon",
"ref": "master",
"url": "https://github.com/kryonlabs/kryon.git"
},
{
"commit": "2a00992af0347c47f04bafe27aa86f666268d638",
"dependencies": {"kryon": "p41cbd2336fa7016b"},
"dependencies": {"kryon": "p4d36356769dd6cb7"},
"id": "p4818b2449814c7f4",
"name": "Kss",
"ref": "master",
"url": "https://github.com/kryonlabs/kss.git"
},
{
"commit": "bf90d5bd9d453d14427d0b52e28862c300a7e805",
"dependencies": {"raylib": "p5a77c9c35110e925"},
"id": "p4d36356769dd6cb7",
"name": "kryon",
"ref": "master",
"url": "https://github.com/kryonlabs/kryon.git"
},
{
"commit": "5cc7677b290f0448462410f7c7e85f518664b943",
"dependencies": {"liboqs": "p0d047aae8cb8cecb"},
@@ -80,7 +80,7 @@
},
{
"commit": "7aa01465ac3f988e0404f3c6dc244bf4b009f253",
"dependencies": {"kryon": "p41cbd2336fa7016b"},
"dependencies": {"kryon": "p4d36356769dd6cb7"},
"id": "paa08e1730a25bda0",
"name": "Game2D",
"ref": "master",
@@ -97,7 +97,7 @@
}
],
"root": {
"dependencies": {"curl": "pc4b263336680098b", "daochi_client": "pa6cfb65dcd8a925b", "game2d": "paa08e1730a25bda0", "kryon": "p41cbd2336fa7016b", "kss": "p4818b2449814c7f4", "liboqs": "p0d047aae8cb8cecb", "monocypher": "p2ff634c7b007140d", "oqs": "p55635fc8976895a9", "rini": "p09fa77e94b0dfc6c", "sqlite": "p151b83a361c86f2d"},
"dependencies": {"curl": "pc4b263336680098b", "daochi_client": "pa6cfb65dcd8a925b", "game2d": "paa08e1730a25bda0", "kryon": "p4d36356769dd6cb7", "kss": "p4818b2449814c7f4", "liboqs": "p0d047aae8cb8cecb", "monocypher": "p2ff634c7b007140d", "oqs": "p55635fc8976895a9", "rini": "p09fa77e94b0dfc6c", "sqlite": "p151b83a361c86f2d"},
"name": "Inbe"
},
"toolchain": {