Skip to content

TextureButton

Eduard Gushchin edited this page Jun 24, 2026 · 3 revisions

Home | API by Category | Complete API Index | API Compatibility

Field Value
Full name Electron2D.TextureButton
Namespace Electron2D
Kind class
Category UI and Text

Overview

Provides a button that draws textures for its visual states.

Syntax

public class Electron2D.TextureButton : Electron2D.BaseButton

Godot 4.7 C# profile compatibility

Profile: Electron2D 0.1.0 2D
Status: Supported / Parity verified
Out of profile: no
Godot reference: TextureButton

Texture-state button with normal, pressed, hover, disabled, focused and click-mask texture properties plus stretch mode.

Remarks

TextureButton uses Electron2D.BaseButton input and signals, then selects a texture for normal, pressed, disabled and focused states.

Thread Safety

This type is not synchronized. Create and mutate texture buttons on the main scene thread.

Since

This type is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.BaseButton
  • Electron2D.Texture2D

Members

Member Kind Summary
IgnoreTextureSize Property Gets or sets whether the texture size is ignored for minimum-size calculation.
StretchMode Property Gets or sets how the selected texture is drawn.
TextureClickMask Property Gets or sets the optional click-mask texture.
TextureDisabled Property Gets or sets the disabled-state texture.
TextureFocused Property Gets or sets the focus overlay texture.
TextureHover Property Gets or sets the hover-state texture.
TextureNormal Property Gets or sets the default texture.
TexturePressed Property Gets or sets the pressed-state texture.
Electron2D.TextureButton() Constructor Initializes a new instance of the Electron2D.TextureButton class.
_Draw() Method Draws the selected texture for the current button state.
_GetMinimumSize() Method Gets the minimum size requested by this texture button.

Member Details

IgnoreTextureSize

Kind: Property

public System.Boolean IgnoreTextureSize { get; set; }

Summary

Gets or sets whether the texture size is ignored for minimum-size calculation.

Remarks

This property does not affect drawing, only Electron2D.TextureButton._GetMinimumSize.

Value

true to return zero texture minimum size; otherwise, false.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TextureButton._GetMinimumSize

StretchMode

Kind: Property

public Electron2D.TextureButton.StretchModeEnum StretchMode { get; set; }

Summary

Gets or sets how the selected texture is drawn.

Remarks

The default is Electron2D.TextureButton.StretchModeEnum.Scale.

Value

The stretch mode used by Electron2D.TextureButton._Draw.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TextureButton.StretchModeEnum

TextureClickMask

Kind: Property

public Electron2D.Texture2D TextureClickMask { get; set; }

Summary

Gets or sets the optional click-mask texture.

Remarks

The preview stores this resource for API compatibility; rectangular hit testing remains active.

Value

The texture reserved for opaque-pixel hit testing.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Texture2D.IsPixelOpaque(System.Int32,System.Int32)

TextureDisabled

Kind: Property

public Electron2D.Texture2D TextureDisabled { get; set; }

Summary

Gets or sets the disabled-state texture.

Remarks

If this value is null, Electron2D.TextureButton.TextureNormal is used.

Value

The texture used when Electron2D.BaseButton.Disabled is true.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.BaseButton.Disabled

TextureFocused

Kind: Property

public Electron2D.Texture2D TextureFocused { get; set; }

Summary

Gets or sets the focus overlay texture.

Remarks

Set this to null to skip focus overlay drawing.

Value

The texture drawn after the state texture when the button has focus.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Control.HasFocus

TextureHover

Kind: Property

public Electron2D.Texture2D TextureHover { get; set; }

Summary

Gets or sets the hover-state texture.

Remarks

Pointer hover tracking is not exposed as public state in this preview.

Value

The texture reserved for hover rendering.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TextureButton.TextureNormal

TextureNormal

Kind: Property

public Electron2D.Texture2D TextureNormal { get; set; }

Summary

Gets or sets the default texture.

Remarks

Assigning this property queues a redraw.

Value

The texture used when no more specific state texture applies.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Texture2D

TexturePressed

Kind: Property

public Electron2D.Texture2D TexturePressed { get; set; }

Summary

Gets or sets the pressed-state texture.

Remarks

If this value is null, Electron2D.TextureButton.TextureNormal is used.

Value

The texture used when the button is pressed.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TextureButton.TextureNormal

Electron2D.TextureButton()

Kind: Constructor

public Electron2D.TextureButton()

Summary

Initializes a new instance of the Electron2D.TextureButton class.

Remarks

The new texture button uses scale drawing until Electron2D.TextureButton.StretchMode is changed.

Thread Safety

This constructor is not synchronized. Call it from the main scene thread.

Since

This constructor is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TextureButton

_Draw()

Kind: Method

public System.Void _Draw()()

Summary

Draws the selected texture for the current button state.

Remarks

The focus texture, when set, is drawn after the state texture.

Thread Safety

This callback is invoked on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TextureButton.TextureNormal

_GetMinimumSize()

Kind: Method

public Electron2D.Vector2 _GetMinimumSize()()

Summary

Gets the minimum size requested by this texture button.

Remarks

The pressed/disabled/focus textures do not change minimum size.

Returns

The normal texture size, or Electron2D.Vector2.Zero when no texture is available or size is ignored.

Thread Safety

This callback is invoked on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TextureButton.TextureNormal

Clone this wiki locally