Skip to content

raylib.IsMouseButtonDown

JoeStrout edited this page Apr 29, 2026 · 2 revisions

Check if a mouse button is being pressed

Parameters

Parameter Default Value Note
button

Return value

Condition Return Value
(always) number

Notes

Example

raylib.InitWindow 800, 600, "Mouse Button Down Demo"
while not raylib.WindowShouldClose
    raylib.BeginDrawing
    raylib.ClearBackground color.white
    if raylib.IsMouseButtonDown(raylib.MOUSE_BUTTON_LEFT) then
        raylib.DrawText "Left button held", 10, 10, 20, color.red
    else
        raylib.DrawText "Click and hold the left button", 10, 10, 20, color.black
    end if
    raylib.EndDrawing
end while
raylib.CloseWindow

Clone this wiki locally