GamepadHit ( button[,port] )

Parameters

button - standard physical position, 1..21.
port (optional) - stable controller slot, 0..15; 0 by default.

Description

Returns and clears the number of new presses for this standard button since its previous GamepadHit call or FlushJoy. Holding a button does not repeat. Raw JoyHit counts and GetGamepad queue entries are independent. Absent, unmapped and invalid buttons return 0.

Supported on Windows, macOS, iOS, Android and web, subject to device and platform capabilities. Input requires application focus; device presence and names remain queryable in the background.

See also: Controller guide and button table, JoyType, FlushJoy, Controller playground.

Example

; GamepadHit example
Graphics 800,480,32,2
SetBuffer BackBuffer()
While Not KeyHit(1)
    Cls
    Text 20,20,"Connect a controller, then press a pad button. Esc exits."
    Text 20,60,"GamepadHit: "+GamepadHit(1)
    Flip
Wend
End

Index