GetGamepad ( [port] )

Parameters

port (optional) - stable controller slot, 0..15; 0 by default.

Description

Removes and returns the next standard gamepad button press, 1..21, or 0 when the queue is empty. The queue holds 31 presses; drain it regularly. GetJoy uses a separate raw-button queue. FlushJoy clears both queues and both hit counts without releasing held buttons.

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

; GetGamepad 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,"GetGamepad: "+GetGamepad()
    Flip
Wend
End

Index