Skip to content

Button

Defined in: ui/Button.ts:84

Implements

Description

A class representing a button.

Extends

  • _Button

Implements

Constructors

new Button()

new Button(config): Button

Defined in: ui/Button.ts:113

Parameters

config

Partial<ButtonConfig>

The configuration for the button.

Returns

Button

Overrides

_Button.constructor

Properties

add

add: object

Defined in: mixins/factory/Factory.ts:6

animatedSprite()

animatedSprite: (props?) => AnimatedSprite

Parameters
props?

Partial<AnimatedSpriteProps>

Returns

AnimatedSprite

bitmapText()

bitmapText: (props?) => BitmapText

Parameters
props?

Partial<TextProps>

Returns

BitmapText

button()

button: (props?) => Button

Parameters
props?

Partial<ButtonProps>

Returns

Button

container()

container: (props?) => Container

Parameters
props?

Partial<ContainerProps>

Returns

Container

existing()

existing: <TEntity>(entity, props?) => TEntity

Type Parameters

TEntity

Parameters
entity

TEntity

props?

Partial<ExistingProps>

Returns

TEntity

flexContainer()

flexContainer: (props?) => FlexContainer

Parameters
props?

Partial<FlexContainerProps>

Returns

FlexContainer

graphics()

graphics: (props?) => Graphics

Parameters
props?

Partial<GraphicsProps>

Returns

Graphics

htmlText()

htmlText: (props?) => HTMLText

Parameters
props?

Partial<HTMLTextProps>

Returns

HTMLText

particleContainer()

particleContainer: (props?) => ParticleContainer

Parameters
props?

Partial<ParticleContainerProps>

Returns

ParticleContainer

spine()

spine: (props?) => Spine

Parameters
props?

Partial<SpineProps>

Returns

Spine

spineAnimation()

spineAnimation: (props?) => SpineAnimation

Parameters
props?

Partial<SpineProps>

Returns

SpineAnimation

sprite()

sprite: (props?) => Sprite

Parameters
props?

Partial<SpriteProps>

Returns

Sprite

text()

text: (props?) => Text

Parameters
props?

Partial<TextProps>

Returns

Text

texture()

texture: (props?) => Texture = resolveTexture

Parameters
props?

Partial<TextureProps>

Returns

Texture

uiCanvas()

uiCanvas: (props?) => UICanvas

Parameters
props?

Partial<UICanvasFactoryProps>

Returns

UICanvas

svg()

Parameters
props

WithRequiredProps<SvgProps, "ctx">

Returns

Svg

Inherited from

_Button.add


focusEnabled

focusEnabled: boolean

Defined in: plugins/focus/FocusManagerPlugin.ts:19

Inherited from

_Button.focusEnabled


id

id: string

Defined in: ui/Button.ts:96

Implementation of

IButton.id


isDown

isDown: boolean

Defined in: ui/Button.ts:100

Implementation of

IButton.isDown


isFocused

isFocused: boolean

Defined in: plugins/focus/FocusManagerPlugin.ts:17

Inherited from

_Button.isFocused


isKeyDown

isKeyDown: boolean

Defined in: plugins/focus/FocusManagerPlugin.ts:18

Inherited from

_Button.isKeyDown


isOver

isOver: boolean

Defined in: ui/Button.ts:101

Implementation of

IButton.isOver


make

make: object

Defined in: mixins/factory/Factory.ts:7

animatedSprite()

animatedSprite: (props?) => AnimatedSprite

Parameters
props?

Partial<AnimatedSpriteProps>

Returns

AnimatedSprite

bitmapText()

bitmapText: (props?) => BitmapText

Parameters
props?

Partial<TextProps>

Returns

BitmapText

button()

button: (props?) => Button

Parameters
props?

Partial<ButtonProps>

Returns

Button

container()

container: (props?) => Container

Parameters
props?

Partial<ContainerProps>

Returns

Container

existing()

existing: <TEntity>(entity, props?) => TEntity

Type Parameters

TEntity

Parameters
entity

TEntity

props?

Partial<ExistingProps>

Returns

TEntity

flexContainer()

flexContainer: (props?) => FlexContainer

Parameters
props?

Partial<FlexContainerProps>

Returns

FlexContainer

graphics()

graphics: (props?) => Graphics

Parameters
props?

Partial<GraphicsProps>

Returns

Graphics

htmlText()

htmlText: (props?) => HTMLText

Parameters
props?

Partial<HTMLTextProps>

Returns

HTMLText

particleContainer()

particleContainer: (props?) => ParticleContainer

Parameters
props?

Partial<ParticleContainerProps>

Returns

ParticleContainer

spine()

spine: (props?) => Spine

Parameters
props?

Partial<SpineProps>

Returns

Spine

spineAnimation()

spineAnimation: (props?) => SpineAnimation

Parameters
props?

Partial<SpineProps>

Returns

SpineAnimation

sprite()

sprite: (props?) => Sprite

Parameters
props?

Partial<SpriteProps>

Returns

Sprite

text()

text: (props?) => Text

Parameters
props?

Partial<TextProps>

Returns

Text

texture()

texture: (props?) => Texture = resolveTexture

Parameters
props?

Partial<TextureProps>

Returns

Texture

uiCanvas()

uiCanvas: (props?) => UICanvas

Parameters
props?

Partial<UICanvasFactoryProps>

Returns

UICanvas

svg()

Parameters
props

WithRequiredProps<SvgProps, "ctx">

Returns

Svg

Inherited from

_Button.make


onBlur

onBlur: Signal<(focusable) => void>

Defined in: plugins/focus/FocusManagerPlugin.ts:35

Inherited from

_Button.onBlur


onClick

onClick: Signal<() => void>

Defined in: ui/Button.ts:91

Implementation of

IButton.onClick


onDestroy

onDestroy: Signal<() => void>

Defined in: ui/Button.ts:95

Implementation of

IButton.onDestroy


onDisabled

onDisabled: Signal<() => void>

Defined in: ui/Button.ts:93

Implementation of

IButton.onDisabled


onDown

onDown: Signal<() => void>

Defined in: ui/Button.ts:86

Implementation of

IButton.onDown


onEnabled

onEnabled: Signal<() => void>

Defined in: ui/Button.ts:92

Implementation of

IButton.onEnabled


onFocus

onFocus: Signal<(focusable) => void>

Defined in: plugins/focus/FocusManagerPlugin.ts:34

Inherited from

_Button.onFocus


onFocusIn

onFocusIn: Signal<(focusable) => void>

Defined in: plugins/focus/FocusManagerPlugin.ts:32

Inherited from

_Button.onFocusIn


onFocusOut

onFocusOut: Signal<(focusable) => void>

Defined in: plugins/focus/FocusManagerPlugin.ts:33

Inherited from

_Button.onFocusOut


onInteraction()

onInteraction: (eventName) => InteractionSignal

Defined in: mixins/interaction.ts:16

Parameters

eventName

keyof FederatedEventMap | keyof GlobalFederatedEventMap

Returns

InteractionSignal

Inherited from

_Button.onInteraction


onKeyboardEvent

onKeyboardEvent: Signal<(key) => void>

Defined in: ui/Button.ts:94

Implementation of

IButton.onKeyboardEvent


onOut

onOut: Signal<() => void>

Defined in: ui/Button.ts:89

Implementation of

IButton.onOut


onOver

onOver: Signal<() => void>

Defined in: ui/Button.ts:90

Implementation of

IButton.onOver


onUp

onUp: Signal<() => void>

Defined in: ui/Button.ts:87

Implementation of

IButton.onUp


onUpOutside

onUpOutside: Signal<() => void>

Defined in: ui/Button.ts:88

Implementation of

IButton.onUpOutside


signalConnections

signalConnections: SignalConnections

Defined in: mixins/signals.ts:9

Inherited from

_Button.signalConnections


view

view: Sprite

Defined in: ui/Button.ts:98

Implementation of

IButton.view

Accessors

app

Get Signature

get app(): IApplication

Defined in: ui/Button.ts:179

Returns

IApplication


enabled

Set Signature

set enabled(enabled): void

Defined in: ui/Button.ts:157

Description

Sets the enabled state of the button.

Parameters
enabled

boolean

Whether the button is enabled.

Returns

void

Methods

addIsDownCallback()

addIsDownCallback(callbackId, callback): void

Defined in: ui/Button.ts:208

Parameters

callbackId

string

callback

() => void

Returns

void


addSignalConnection()

addSignalConnection(…args): void

Defined in: mixins/signals.ts:13

Parameters

args

SignalConnection[]

Returns

void

Inherited from

_Button.addSignalConnection


blur()

blur(): void

Defined in: ui/Button.ts:194

Returns

void

Overrides

_Button.blur


click()

click(): void

Defined in: plugins/focus/FocusManagerPlugin.ts:41

Returns

void

Inherited from

_Button.click


connectAction()

connectAction(…args): void

Defined in: mixins/signals.ts:15

Parameters

args

SignalConnection[]

Returns

void

Inherited from

_Button.connectAction


connectSignal()

connectSignal(…args): void

Defined in: mixins/signals.ts:14

Parameters

args

SignalConnection[]

Returns

void

Inherited from

_Button.connectSignal


destroy()

destroy(options?): void

Defined in: ui/Button.ts:183

Removes all internal references and listeners as well as removes children from the display list. Do not use a Container after calling destroy.

Parameters

options?

DestroyOptions

Options parameter. A boolean will act as if all options have been set to that value

Returns

void

Overrides

_Button.destroy


focusIn()

focusIn(): void

Defined in: plugins/focus/FocusManagerPlugin.ts:37

Returns

void

Inherited from

_Button.focusIn


focusOut()

focusOut(): void

Defined in: ui/Button.ts:188

Returns

void

Overrides

_Button.focusOut


getFocusArea()

getFocusArea(): Bounds

Defined in: ui/Button.ts:200

Returns

Bounds

Overrides

_Button.getFocusArea


getFocusPosition()

getFocusPosition(): number[]

Defined in: ui/Button.ts:204

Returns

number[]

Overrides

_Button.getFocusPosition


getFocusSize()

getFocusSize(): null | PointLike

Defined in: plugins/focus/FocusManagerPlugin.ts:51

Returns

null | PointLike

Inherited from

_Button.getFocusSize


removeIsDownCallback()

removeIsDownCallback(callbackId): void

Defined in: ui/Button.ts:213

Parameters

callbackId

string

Returns

void


setTexture()

setTexture(textureId, texture): void

Defined in: ui/Button.ts:217

Parameters

textureId

ButtonTextureId

texture

TextureLike

Returns

void