android: dpi_scale, scissor, JNI safe-insets, touch input
Four Android UX wins landing together; all verified end-to-end on a
Pixel 7 Pro (board fills width, info-panel text renders, status bar
inset honored, tap-to-select + tap-to-move plays 1. e4).
- AndroidPlatform.init reads density via AConfiguration_getDensity
(app->config at offset 32) and sets dpi_scale = density / 160. The
hardcoded 1.0 had been making every logical unit equal one physical
pixel; ChessBoardView's 520-default size_that_fits fallback then
rendered at ~half the framebuffer width on the device, and glyphs
rasterized at literal 11-13 physical pixels were essentially invisible
on a 2340-tall display.
- gles3.sx set_scissor un-stubbed; with dpi_scale right the renderer
feeds in valid pixel bounds and the Y-flip math lands inside the
framebuffer.
- New library/vendors/sx_android_jni/sx_android_jni.c walks
activity -> window -> decorView -> rootWindowInsets via JNI and
publishes the system-bar insets. safe_insets() lazy-queries the
first call after EGL is up (decor view isn't attached at bootstrap).
- sx_android_install_input_handler sets app->onInputEvent; sx-side
sx_android_input_event translates AMotionEvent DOWN/MOVE/UP/CANCEL
into existing mouse_down/mouse_moved/mouse_up Events so the chess
board's tap-to-select + ScrollView drag path Just Works. Coordinates
divided by dpi_scale so layout-side hit tests match. poll_events
drains its slice after returning (mirrors the SDL pattern).
- src/imports.zig now routes #import c { #source / #include } paths
through the same chain as #import (importing dir -> CWD -> stdlib
search paths). Lets library-owned C helpers like the JNI bridge
live in sx/library/vendors/ without forcing consumers to vendor a
copy. Existing CWD-relative consumer layouts (chess's vendors/...)
still resolve first, so no regression.
86/86 regression tests pass.
This commit is contained in:
@@ -303,12 +303,8 @@ impl GPU for Gles3Gpu {
|
||||
|
||||
set_scissor :: (self: *Gles3Gpu, x: s32, y: s32, w: s32, h: s32) {
|
||||
inline if OS != .android { return; }
|
||||
// TODO: re-enable once we figure out why the renderer passes
|
||||
// a 0×0 clip rect on Android (chess's ScrollView path). The
|
||||
// bounds the renderer feeds us land outside the framebuffer
|
||||
// and clip everything off-screen.
|
||||
// glEnable(GL_SCISSOR_TEST);
|
||||
// glScissor(x, self.pixel_h - (y + h), w, h);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
glScissor(x, self.pixel_h - (y + h), w, h);
|
||||
}
|
||||
|
||||
disable_scissor :: (self: *Gles3Gpu) {
|
||||
|
||||
Reference in New Issue
Block a user