True if mobile controls should be shown
// High-res Android phone (1440x3168) → returns true via user-agent
// Desktop with 1440px screen → returns false (no mobile user-agent)
// iPad Pro 12.9" (1024x1366) → returns true (tablet user-agent)
// Surface Pro in tablet mode → returns true (touch + tablet size)
if (shouldUseMobileControls()) {
return <VirtualDPad />; // Touch-optimized controls
}
Check if device should use mobile controls Takes into account device type, screen size, and touch capability
Uses user-agent detection to correctly identify mobile devices regardless of screen resolution. This ensures high-end Android 15/16 phones with 2K/4K displays (1200px+, 1440px+) show mobile controls.
Also ensures tablets and touch-enabled devices always show mobile controls regardless of resolution, for better UX on touch devices.