melonJS
    Preparing search index...

    Interface UITextButtonSettings

    Everything UITextButton takes. Every field is optional. The object is only read, so one style object can be spread into several buttons.

    interface UITextButtonSettings {
        bindKey?: string | number;
        borderColor?: Paint;
        borderHeight?: number;
        borderStrokeColor?: Paint;
        borderWidth?: number;
        enabled?: boolean;
        fillStyle?: string;
        font?: string;
        fontData?: string;
        fontSize?: number;
        height?: number;
        hoverOffColor?: Paint;
        hoverOnColor?: Paint;
        hoverScale?: number;
        labelFillStyle?: string;
        onClick?: (button: UITextButton) => void;
        pressedColor?: Paint;
        pressScale?: number;
        size?: number;
        skin?: UITextButtonSkin;
        text?: string;
        textAlign?: string;
        textBaseline?: string;
        width?: number;
        [key: string]: any;
    }

    Hierarchy (View Summary)

    Indexable

    • [key: string]: any

      Anything else is passed on to the BitmapText of a bitmap font label, such as lineHeight.

    Index
    bindKey?: string | number

    A keyboard shortcut that clicks the button: an input.KEY key code, or the name of an action bound with input.bindKey. -1 for none. See UITextButton#bindKey.

    -1
    
    borderColor?: Paint

    outline colour, drawn look only

    "#000000"
    
    borderHeight?: number

    older name of height, still accepted

    borderStrokeColor?: Paint

    older name of borderColor, still accepted

    borderWidth?: number

    Older name of width, still accepted. It is the button's width, not an outline thickness as borderWidth is on the other widgets.

    enabled?: boolean

    whether the button answers input; see UIBaseElement#enabled

    true
    
    fillStyle?: string

    older name of labelFillStyle, still accepted

    font?: string

    The font: the name of a loaded bitmap font, or a CSS font family. A name with a font image in the loader, or a fontData setting, is drawn as a BitmapText; anything else as a Text with that CSS font.

    "sans-serif"
    
    fontData?: string

    the loader name of the bitmap font data, when it differs from font

    fontSize?: number

    The label's height in pixels, for a bitmap font as for a CSS font. A bitmap font is scaled to it. Left out: 16 for a CSS font, the authored size for a bitmap font. Wins over size.

    height?: number

    The button's height in pixels. Left out: the skin's normal region height, or else the label's height plus 16.

    hoverOffColor?: Paint

    background colour at rest, drawn look only

    "#00aa0080"
    
    hoverOnColor?: Paint

    background colour under the pointer, drawn look only

    "#00ff00ff"
    
    hoverScale?: number

    The scale the widget is drawn at under the pointer, or while it has the keyboard and gamepad focus, such as 1.05. 1 turns it off.

    1
    
    labelFillStyle?: string

    The label's colour. A bitmap font is tinted with it; left out, a bitmap font keeps its own colours and a CSS font is black.

    onClick?: (button: UITextButton) => void

    What the button does. Called once per completed click: pressed and released on the button, Enter / Space / A pressed and released with the focus on it, or its bindKey pressed and released. A press dragged off the button, called off, or turned into a scroll by a UIPanel does not call it. Nor does a disabled button.

    pressedColor?: Paint

    Background colour while held down, drawn look only. Left out, a held button shows hoverOnColor.

    pressScale?: number

    The scale the widget is drawn at while held down, such as 0.92. 1 turns it off.

    1
    
    size?: number

    Older form of fontSize, still accepted. With a CSS font it is the height in pixels; with a bitmap font it is a scale of the authored size (2 is double), not pixels.

    Draw the button from atlas regions instead of a rounded rectangle. The colour settings below are then not used.

    text?: string

    the label's text

    ""
    
    textAlign?: string

    The label's horizontal alignment about the centre of the button: "left" starts the text at the centre, "right" ends it there.

    "center"
    
    textBaseline?: string

    the label's baseline about the vertical middle of the button

    "middle"
    
    width?: number

    The button's width in pixels. Left out: the skin's normal region width, or else the label's width plus 16.