Skip to content

raylib.IsGamepadAvailable

JoeStrout edited this page Apr 29, 2026 · 2 revisions

Check if a gamepad is available

Parameters

Parameter Default Value Note
gamepad 0

Return value

Condition Return Value
(always) number

Notes

Example

raylib.InitWindow 800, 600, "Gamepad Demo"
while not raylib.WindowShouldClose
    raylib.BeginDrawing
    raylib.ClearBackground color.white
    if raylib.IsGamepadAvailable(0) then
        raylib.DrawText "Gamepad 0 connected", 10, 10, 20, color.green
    else
        raylib.DrawText "No gamepad detected", 10, 10, 20, color.red
    end if
    raylib.EndDrawing
end while
raylib.CloseWindow

Clone this wiki locally