Atlas Engine
API Referencegraphite

Button

Clickable text button with hover, enabled state, and click callback support.

Module: graphite

Clickable text button with hover, enabled state, and click callback support.

Declaration

export class Button extends UIObject { ... }

Extends: UIObject

Constructors

constructor();
constructor(font: Font, label: string, position: Position2d);

Properties

label

label: string;

font

font: Font;

position

position: Position3d;

fontSize

fontSize: number;

padding

padding: Size2d;

minimumSize

minimumSize: Size2d;

textColor

textColor: Color;

backgroundColor

backgroundColor: Color;

hoverBackgroundColor

hoverBackgroundColor: Color;

pressedBackgroundColor

pressedBackgroundColor: Color;

borderColor

borderColor: Color;

hoverBorderColor

hoverBorderColor: Color;

enabled

enabled: boolean;

Methods

getSize

Returns the current dimensions.

override getSize(): Size2d;

getScreenPosition

Returns the UI element's screen-space position.

override getScreenPosition(): Position2d;

setScreenPosition

Sets the UI element's screen-space position.

override setScreenPosition(position: Position2d): void;

getLabel

getLabel(): string;

isHovered

isHovered(): boolean;

isEnabled

isEnabled(): boolean;

style

Returns the element's style.

style(): UIStyle;

setLabel

setLabel(label: string): Button;

setPadding

setPadding(padding: Size2d): Button;

setMinimumSize

setMinimumSize(size: Size2d): Button;

setFontSize

setFontSize(size: number): Button;

setStyle

Applies a style to the element.

setStyle(style: UIStyle): Button;

setOnClick

Registers the click callback and returns this button for chaining.

setOnClick(callback: Button.ClickCallback): Button;

setEnabled

setEnabled(enabled: boolean): void;

On this page