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

Creates a new button.

constructor();

Creates a new button.

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

Properties

label

The label.

label: string;

font

The font.

font: Font;

position

The position in world space.

position: Position3d;

fontSize

The font size.

fontSize: number;

padding

The padding.

padding: Size2d;

minimumSize

The minimum size.

minimumSize: Size2d;

textColor

The text color.

textColor: Color;

backgroundColor

The background color.

backgroundColor: Color;

hoverBackgroundColor

The hover background color.

hoverBackgroundColor: Color;

pressedBackgroundColor

The pressed background color.

pressedBackgroundColor: Color;

borderColor

The border color.

borderColor: Color;

hoverBorderColor

The hover border color.

hoverBorderColor: Color;

enabled

Whether this feature is 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

Returns label.

getLabel(): string;

isHovered

Reports whether hovered.

isHovered(): boolean;

isEnabled

Reports whether enabled.

isEnabled(): boolean;

style

Returns the element's style.

style(): UIStyle;

setLabel

Sets label.

setLabel(label: string): Button;

setPadding

Sets padding.

setPadding(padding: Size2d): Button;

setMinimumSize

Sets minimum size.

setMinimumSize(size: Size2d): Button;

setFontSize

Sets font size.

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

Sets enabled.

setEnabled(enabled: boolean): void;

On this page