Mouse

Pointer state sampled into one host-cycle input.

The host stores one packed state byte per raylib mouse button code 0 through 6: bit 0 is held, bit 1 is pressed during the input interval, and bit 2 is released during it. Read them through the receivers -- input.devices.mouse.position(), button_down, button_pressed -- rather than through the bytes.

Pass input.devices.mouse directly to these helpers; there is nothing to construct.

position : { ..state, x : F32, y : F32 } -> { x : F32, y : F32 }

Current cursor position in logical drawing coordinates.

delta : { ..state, delta_x : F32, delta_y : F32 } -> { x : F32, y : F32 }

Cursor movement since the previous frame, sampled once by the host.

wheel_delta : { ..state, wheel_x : F32, wheel_y : F32 } -> { x : F32, y : F32 }

Horizontal and vertical wheel movement retained for this input interval.

virtual_at : { x : F32, y : F32 } -> Source

A virtual pointer at a position, with no button held.

virtual_click_at : { x : F32, y : F32 } -> Source

A virtual pointer at a position with the left button held, so the next input reports a press there.

button_down : { ..state, buttons : List(U8) }, Button -> Bool

Check if a mouse button is currently held down.

button_up : { ..state, buttons : List(U8) }, Button -> Bool

Check if a mouse button is currently up.

button_pressed : { ..state, buttons : List(U8) }, Button -> Bool

Check if a mouse button was pressed during this input interval.

button_released : { ..state, buttons : List(U8) }, Button -> Bool

Check if a mouse button was released during this input interval.

Snapshot

:= {
    buttons : List(U8),
    left : Bool,
    middle : Bool,
    right : Bool,
    wheel : F32,
    wheel_x : F32,
    wheel_y : F32,
    delta_x : F32,
    delta_y : F32,
    x : F32,
    y : F32,
}

Mouse input sampled once at the start of the current frame.

button_up : Snapshot, Button -> Bool

Whether a button is currently up.

button_pressed : Snapshot, Button -> Bool

Whether a button was pressed during this input interval.

button_released : Snapshot, Button -> Bool

Whether a button was released during this input interval.

position : Snapshot -> { x : F32, y : F32 }

Current cursor position in logical drawing coordinates.

delta : Snapshot -> { x : F32, y : F32 }

Cursor movement since the previous frame.

wheel_delta : Snapshot -> { x : F32, y : F32 }

Horizontal and vertical wheel movement for this input interval.

Cursor

:= [
    Default,
    Arrow,
    IBeam,
    Crosshair,
    PointingHand,
    ResizeEastWest,
    ResizeNorthSouth,
    ResizeNorthwestSoutheast,
    ResizeNortheastSouthwest,
    ResizeAll,
    NotAllowed,
]

Native operating-system cursor shapes.

is_eq : _

Compare two of these values.

Button

:= [Left, Right, Middle, Side, Extra, Forward, Back]

Standard mouse buttons sampled by the platform.

Source

:= [Hardware, Virtual({ x : F32, y : F32, left : Bool, middle : Bool, right : Bool, wheel : F32 })]

Select hardware pointer samples or deterministic application-provided samples. Where pointer input comes from: Hardware, or a Virtual pointer whose position and buttons the app states itself. Mouse.set_source! on the platform is what switches between them.