Documentation
¶
Overview ¶
graphics.gd/classdb/TextureButton has the same functionality as graphics.gd/classdb/Button, except it uses sprites instead of Godot's graphics.gd/classdb/Theme resource. It is faster to create, but it doesn't support localization like more complex [graphics.gd/classdb/Control]s.
See also graphics.gd/classdb/BaseButton which contains common properties and methods associated with this node.
Note: Setting a texture for the "normal" state (Instance.TextureNormal) is recommended. If Instance.TextureNormal is not set, the graphics.gd/classdb/TextureButton will still receive input events and be clickable, but the user will not be able to see it unless they activate another one of its states with a texture assigned (e.g., hover over it to show Instance.TextureHover).
Index ¶
- type Advanced
- type Any
- type Extension
- func (self *Extension[T]) AsBaseButton() BaseButton.Instance
- func (self *Extension[T]) AsCanvasItem() CanvasItem.Instance
- func (self *Extension[T]) AsControl() Control.Instance
- func (self *Extension[T]) AsNode() Node.Instance
- func (self *Extension[T]) AsObject() [1]gd.Object
- func (self *Extension[T]) AsTextureButton() Instance
- type ID
- type Instance
- func (self Instance) AsBaseButton() BaseButton.Instance
- func (self Instance) AsCanvasItem() CanvasItem.Instance
- func (self Instance) AsControl() Control.Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsTextureButton() Instance
- func (self Instance) FlipH() bool
- func (self Instance) FlipV() bool
- func (self Instance) ID() ID
- func (self Instance) IgnoreTextureSize() bool
- func (self Instance) SetFlipH(value bool)
- func (self Instance) SetFlipV(value bool)
- func (self Instance) SetIgnoreTextureSize(value bool)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetStretchMode(value StretchMode)
- func (self Instance) SetTextureClickMask(value BitMap.Instance)
- func (self Instance) SetTextureDisabled(value Texture2D.Instance)
- func (self Instance) SetTextureFocused(value Texture2D.Instance)
- func (self Instance) SetTextureHover(value Texture2D.Instance)
- func (self Instance) SetTextureNormal(value Texture2D.Instance)
- func (self Instance) SetTexturePressed(value Texture2D.Instance)
- func (self Instance) StretchMode() StretchMode
- func (self Instance) TextureClickMask() BitMap.Instance
- func (self Instance) TextureDisabled() Texture2D.Instance
- func (self Instance) TextureFocused() Texture2D.Instance
- func (self Instance) TextureHover() Texture2D.Instance
- func (self Instance) TextureNormal() Texture2D.Instance
- func (self Instance) TexturePressed() Texture2D.Instance
- func (self Instance) Virtual(name string) reflect.Value
- type StretchMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsBaseButton ¶
func (self *Extension[T]) AsBaseButton() BaseButton.Instance
func (*Extension[T]) AsCanvasItem ¶
func (self *Extension[T]) AsCanvasItem() CanvasItem.Instance
func (*Extension[T]) AsTextureButton ¶
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
type Instance [1]gdclass.TextureButton
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsBaseButton ¶
func (self Instance) AsBaseButton() BaseButton.Instance
func (Instance) AsCanvasItem ¶
func (self Instance) AsCanvasItem() CanvasItem.Instance
func (Instance) AsTextureButton ¶
func (Instance) IgnoreTextureSize ¶
func (Instance) SetIgnoreTextureSize ¶
func (Instance) SetStretchMode ¶
func (self Instance) SetStretchMode(value StretchMode)
func (Instance) SetTextureClickMask ¶
func (Instance) SetTextureDisabled ¶
func (Instance) SetTextureFocused ¶
func (Instance) SetTextureHover ¶
func (Instance) SetTextureNormal ¶
func (Instance) SetTexturePressed ¶
func (Instance) StretchMode ¶
func (self Instance) StretchMode() StretchMode
func (Instance) TextureClickMask ¶
func (Instance) TextureDisabled ¶
func (Instance) TextureFocused ¶
func (Instance) TextureHover ¶
func (Instance) TextureNormal ¶
func (Instance) TexturePressed ¶
type StretchMode ¶
type StretchMode int //gd:TextureButton.StretchMode
const ( // Scale to fit the node's bounding rectangle. StretchScale StretchMode = 0 // Tile inside the node's bounding rectangle. StretchTile StretchMode = 1 // The texture keeps its original size and stays in the bounding rectangle's top-left corner. StretchKeep StretchMode = 2 // The texture keeps its original size and stays centered in the node's bounding rectangle. StretchKeepCentered StretchMode = 3 // Scale the texture to fit the node's bounding rectangle, but maintain the texture's aspect ratio. StretchKeepAspect StretchMode = 4 // Scale the texture to fit the node's bounding rectangle, center it, and maintain its aspect ratio. StretchKeepAspectCentered StretchMode = 5 // Scale the texture so that the shorter side fits the bounding rectangle. The other side clips to the node's limits. StretchKeepAspectCovered StretchMode = 6 )