Table of Contents

Class TextureButton

Namespace
Godot
Assembly
GodotSharp.dll

TextureButton has the same functionality as Button, except it uses sprites instead of Godot's Theme resource. It is faster to create, but it doesn't support localization like more complex Controls.

The "normal" state must contain a texture (TextureNormal); other textures are optional.

See also BaseButton which contains common properties and methods associated with this node.

public class TextureButton : BaseButton, IDisposable
Inheritance
TextureButton
Implements
Inherited Members

Constructors

TextureButton()

public TextureButton()

Properties

FlipH

If true, texture is flipped horizontally.

public bool FlipH { get; set; }

Property Value

bool

FlipV

If true, texture is flipped vertically.

public bool FlipV { get; set; }

Property Value

bool

IgnoreTextureSize

If true, the size of the texture won't be considered for minimum size calculation, so the TextureButton can be shrunk down past the texture size.

public bool IgnoreTextureSize { get; set; }

Property Value

bool

StretchMode

Controls the texture's behavior when you resize the node's bounding rectangle. See the TextureButton.StretchModeEnum constants for available options.

public TextureButton.StretchModeEnum StretchMode { get; set; }

Property Value

TextureButton.StretchModeEnum

TextureClickMask

Pure black and white Bitmap image to use for click detection. On the mask, white pixels represent the button's clickable area. Use it to create buttons with curved shapes.

public Bitmap TextureClickMask { get; set; }

Property Value

Bitmap

TextureDisabled

Texture to display when the node is disabled. See Disabled.

public Texture2D TextureDisabled { get; set; }

Property Value

Texture2D

TextureFocused

Texture to display when the node has mouse or keyboard focus. TextureFocused is displayed over the base texture, so a partially transparent texture should be used to ensure the base texture remains visible. A texture that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a fully transparent texture of any size. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons.

public Texture2D TextureFocused { get; set; }

Property Value

Texture2D

TextureHover

Texture to display when the mouse hovers the node.

public Texture2D TextureHover { get; set; }

Property Value

Texture2D

TextureNormal

Texture to display by default, when the node is not in the disabled, hover or pressed state. This texture is still displayed in the focused state, with TextureFocused drawn on top.

public Texture2D TextureNormal { get; set; }

Property Value

Texture2D

TexturePressed

Texture to display on mouse down over the node, if the node has keyboard focus and the player presses the Enter key or if the player presses the Shortcut key.

public Texture2D TexturePressed { get; set; }

Property Value

Texture2D

Methods

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool