Skip to content

Touch not working

Zariep edited this page Jul 6, 2026 · 1 revision

If the game isn't responding to taps at all, work through these steps from the OS level down to your game logic:

Verify Touch Event Expiry (IsMouseButtonReleased)

If your buttons flash their "hovered" color but never trigger an action, your touch state is expiring too quickly.

The Problem: On mobile, GetTouchPointCount() == 0 triggers the exact same frame as IsMouseButtonReleased(). If your custom code jumps the pointer offscreen when touch count drops to 0, your buttons lose focus before registering the click release.

The Fix: Switch from GetTouchPosition(0) to the generic GetMousePosition(). Raylib’s Android backend automatically maps touch data to mouse position arrays, retaining the last position even on the frame the finger lifts.

Check the Android Input Queue Log

Run adb logcat and look for this specific line during application startup:

threaded_app: Attaching input queue to looper

If missing: Your NativeActivity isn't capturing OS events. Ensure your activity in AndroidManifest.xml is configured to use android.app.NativeActivity or a subclass that properly initializes the native thread loop (Which should be the default)

Check for UI System Layer Blocks

If you are overlapping UI views or states (e.g., drawing a Pause overlay state over a Game state):

Ensure that back-layer coordinate checking is completely disabled when an overlay is active. Otherwise, an offscreen or hidden element may be capturing or confusing your input bounds logic.

Clone this wiki locally