Skip to content

UIButton Class

Definition

Namespace: Brine2D.UI

Interactive button UI component.

C#
public class UIButton : Brine2D.UI.IUIComponent, Brine2D.UI.IAnchoredUIComponent

Inheritance System.Object → UIButton

Implements IUIComponent, IAnchoredUIComponent

Properties
Anchor The screen anchor point this component is positioned relative to.
AnchorOffset Pixel offset from the resolved anchor point.
DisabledColor Color used when the button is disabled.
DisabledTexture Optional nine-slice texture for the disabled state. Falls back to NormalTexture when null.
FocusColor Color of the focus ring drawn when the button has keyboard focus.
Font Optional font for rendering text \(null = renderer default\).
HoverColor Hover state color.
HoverTexture Optional nine-slice texture for the hover state. Falls back to NormalTexture when null.
IsFocused Whether this button currently has keyboard focus.
NormalColor Normal state color.
NormalTexture Optional nine-slice texture for the normal \(idle\) state. Replaces the solid NormalColor fill when set.
PressedColor Pressed state color.
PressedTexture Optional nine-slice texture for the pressed state. Falls back to NormalTexture when null.
Text Button text.
TextAlignment Horizontal text alignment. Defaults to Center.
TextColor Text color.
TextPadding Pixels between the text and the button edge when alignment is Left or Right. Ignored for Center.
TextureBorder Nine-slice border insets \(texels\) shared by all state textures.
TextureTint Tint color applied to the active state texture.
Events
OnClick Event fired when button is clicked.
OnFocusGained Event fired when this button gains keyboard focus.
OnFocusLost Event fired when this button loses keyboard focus.
OnHoverEnter Event fired when the mouse cursor enters the button bounds.
OnHoverExit Event fired when the mouse cursor leaves the button bounds.
OnRightClick Event fired when the button is right-clicked.