melonJS
    Preparing search index...

    Interface ButtonOptions

    A button of the virtual gamepad.

    interface ButtonOptions {
        area?: ControlArea;
        button?: number | null;
        floating?: boolean;
        hideAtRest?: boolean;
        key?: number;
        label?: string;
        position?: Placement;
        pressed?: string;
        radius?: number;
        region?: string;
    }
    Index

    where a floating button can be pressed: "half" (the default), the half of the screen its position is on; "screen", anywhere; or a rectangle { x, y, width, height } in viewport pixels. Fixed controls come first where they overlap it, and floating buttons sharing an area split it by distance to where each rests (see ControlArea). Ignored for a fixed button.

    button?: number | null

    the pad button it presses, from input.GAMEPAD.BUTTONS. The buttons press FACE_1, FACE_2, FACE_3 and FACE_4 in turn by default, or no pad button when a key is given. null for none.

    floating?: boolean

    the button is pressed wherever a finger lands inside its area, and drawn under that finger while held, rather than at a fixed spot. It rests at its position. Off by default.

    hideAtRest?: boolean

    draw a floating button only while a finger holds it; let go, it fades out where it was. Off by default: it rests at its position, to show it is there. Ignored for a fixed button.

    key?: number

    a key to press, from input.KEY, for a game that reads the keyboard rather than a pad

    label?: string

    the text shown on it, such as "A" or "Jump"

    position?: Placement

    where its center sits; the buttons gather in the bottom-right corner by default

    pressed?: string

    the region while held. When omitted, the resting region is drawn slightly smaller while held (and brighter, while the opacity leaves room)

    radius?: number

    its radius, in viewport pixels

    region?: string

    the region in the plugin's skin atlas; shapes when omitted