TextureProgressBar

package
v0.0.0-...-357ca8a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 31 Imported by: 0

Documentation

Overview

TextureProgressBar works like ProgressBar, but uses up to 3 textures instead of Godot's Theme resource. It can be used to create horizontal, vertical and radial progress bars.

Index

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 Any

type Any interface {
	gd.IsClass
	AsTextureProgressBar() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

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]) AsCanvasItem

func (self *Extension[T]) AsCanvasItem() CanvasItem.Instance

func (*Extension[T]) AsControl

func (self *Extension[T]) AsControl() Control.Instance

func (*Extension[T]) AsNode

func (self *Extension[T]) AsNode() Node.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRange

func (self *Extension[T]) AsRange() Range.Instance

func (*Extension[T]) AsTextureProgressBar

func (self *Extension[T]) AsTextureProgressBar() Instance

type FillMode

type FillMode int //gd:TextureProgressBar.FillMode
const (
	// The [TextureProgress] fills from left to right.
	//
	// [TextureProgress]: https://pkg.go.dev/graphics.gd/classdb/#Instance.TextureProgress
	FillLeftToRight FillMode = 0
	// The [TextureProgress] fills from right to left.
	//
	// [TextureProgress]: https://pkg.go.dev/graphics.gd/classdb/#Instance.TextureProgress
	FillRightToLeft FillMode = 1
	// The [TextureProgress] fills from top to bottom.
	//
	// [TextureProgress]: https://pkg.go.dev/graphics.gd/classdb/#Instance.TextureProgress
	FillTopToBottom FillMode = 2
	// The [TextureProgress] fills from bottom to top.
	//
	// [TextureProgress]: https://pkg.go.dev/graphics.gd/classdb/#Instance.TextureProgress
	FillBottomToTop FillMode = 3
	// Turns the node into a radial bar. The [TextureProgress] fills clockwise. See [RadialCenterOffset], [RadialInitialAngle] and [RadialFillDegrees] to control the way the bar fills up.
	//
	// [RadialCenterOffset]: https://pkg.go.dev/graphics.gd/classdb/#Instance.RadialCenterOffset
	// [RadialFillDegrees]: https://pkg.go.dev/graphics.gd/classdb/#Instance.RadialFillDegrees
	// [RadialInitialAngle]: https://pkg.go.dev/graphics.gd/classdb/#Instance.RadialInitialAngle
	// [TextureProgress]: https://pkg.go.dev/graphics.gd/classdb/#Instance.TextureProgress
	FillClockwise FillMode = 4
	// Turns the node into a radial bar. The [TextureProgress] fills counterclockwise. See [RadialCenterOffset], [RadialInitialAngle] and [RadialFillDegrees] to control the way the bar fills up.
	//
	// [RadialCenterOffset]: https://pkg.go.dev/graphics.gd/classdb/#Instance.RadialCenterOffset
	// [RadialFillDegrees]: https://pkg.go.dev/graphics.gd/classdb/#Instance.RadialFillDegrees
	// [RadialInitialAngle]: https://pkg.go.dev/graphics.gd/classdb/#Instance.RadialInitialAngle
	// [TextureProgress]: https://pkg.go.dev/graphics.gd/classdb/#Instance.TextureProgress
	FillCounterClockwise FillMode = 5
	// The [TextureProgress] fills from the center, expanding both towards the left and the right.
	//
	// [TextureProgress]: https://pkg.go.dev/graphics.gd/classdb/#Instance.TextureProgress
	FillBilinearLeftAndRight FillMode = 6
	// The [TextureProgress] fills from the center, expanding both towards the top and the bottom.
	//
	// [TextureProgress]: https://pkg.go.dev/graphics.gd/classdb/#Instance.TextureProgress
	FillBilinearTopAndBottom FillMode = 7
	// Turns the node into a radial bar. The [TextureProgress] fills radially from the center, expanding both clockwise and counterclockwise. See [RadialCenterOffset], [RadialInitialAngle] and [RadialFillDegrees] to control the way the bar fills up.
	//
	// [RadialCenterOffset]: https://pkg.go.dev/graphics.gd/classdb/#Instance.RadialCenterOffset
	// [RadialFillDegrees]: https://pkg.go.dev/graphics.gd/classdb/#Instance.RadialFillDegrees
	// [RadialInitialAngle]: https://pkg.go.dev/graphics.gd/classdb/#Instance.RadialInitialAngle
	// [TextureProgress]: https://pkg.go.dev/graphics.gd/classdb/#Instance.TextureProgress
	FillClockwiseAndCounterClockwise FillMode = 8
)

type ID

type ID Object.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.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.TextureProgressBar

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 New

func New() Instance

func (Instance) AsCanvasItem

func (self Instance) AsCanvasItem() CanvasItem.Instance

func (Instance) AsControl

func (self Instance) AsControl() Control.Instance

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRange

func (self Instance) AsRange() Range.Instance

func (Instance) AsTextureProgressBar

func (self Instance) AsTextureProgressBar() Instance

func (Instance) FillMode

func (self Instance) FillMode() int

The fill direction. See FillMode for possible values.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) NinePatchStretch

func (self Instance) NinePatchStretch() bool

If true, Godot treats the bar's textures like in NinePatchRect. Use the stretch_margin_* properties like StretchMarginBottom to set up the nine patch's 3×3 grid. When using a radial FillMode, this setting will only enable stretching for TextureProgress, while TextureUnder and TextureOver will be treated like in NinePatchRect.

func (Instance) RadialCenterOffset

func (self Instance) RadialCenterOffset() Vector2.XY

Offsets TextureProgress if FillMode is FillClockwise, FillCounterClockwise, or FillClockwiseAndCounterClockwise.

Note: The effective radial center always stays within the TextureProgress bounds. If you need to move it outside the texture's bounds, modify the TextureProgress to contain additional empty space where needed.

func (Instance) RadialFillDegrees

func (self Instance) RadialFillDegrees() Float.X

Upper limit for the fill of TextureProgress if FillMode is FillClockwise, FillCounterClockwise, or FillClockwiseAndCounterClockwise. When the node's value is equal to its max_value, the texture fills up to this angle.

See Range.Value, Range.MaxValue.

func (Instance) RadialInitialAngle

func (self Instance) RadialInitialAngle() Angle.Radians

Starting angle for the fill of TextureProgress if FillMode is FillClockwise, FillCounterClockwise, or FillClockwiseAndCounterClockwise. When the node's value is equal to its min_value, the texture doesn't show up at all. When the value increases, the texture fills and tends towards RadialFillDegrees.

Note: RadialInitialAngle is wrapped between 0 and 360 degrees (inclusive).

func (Instance) SetFillMode

func (self Instance) SetFillMode(value int)

SetFillMode sets the property returned by [GetFillMode].

func (Instance) SetNinePatchStretch

func (self Instance) SetNinePatchStretch(value bool)

SetNinePatchStretch sets the property returned by [GetNinePatchStretch].

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetRadialCenterOffset

func (self Instance) SetRadialCenterOffset(value Vector2.XY)

SetRadialCenterOffset sets the property returned by [GetRadialCenterOffset].

func (Instance) SetRadialFillDegrees

func (self Instance) SetRadialFillDegrees(value Float.X)

SetRadialFillDegrees sets the property returned by [GetFillDegrees].

func (Instance) SetRadialInitialAngle

func (self Instance) SetRadialInitialAngle(value Angle.Radians)

SetRadialInitialAngle sets the property returned by [GetRadialInitialAngle].

func (Instance) SetStretchMarginBottom

func (self Instance) SetStretchMarginBottom(value int)

SetStretchMarginBottom sets the property returned by [GetStretchMargin].

func (Instance) SetStretchMarginLeft

func (self Instance) SetStretchMarginLeft(value int)

SetStretchMarginLeft sets the property returned by [GetStretchMargin].

func (Instance) SetStretchMarginRight

func (self Instance) SetStretchMarginRight(value int)

SetStretchMarginRight sets the property returned by [GetStretchMargin].

func (Instance) SetStretchMarginTop

func (self Instance) SetStretchMarginTop(value int)

SetStretchMarginTop sets the property returned by [GetStretchMargin].

func (Instance) SetTextureOver

func (self Instance) SetTextureOver(value Texture2D.Instance)

SetTextureOver sets the property returned by [GetOverTexture].

func (Instance) SetTextureProgress

func (self Instance) SetTextureProgress(value Texture2D.Instance)

SetTextureProgress sets the property returned by [GetProgressTexture].

func (Instance) SetTextureProgressOffset

func (self Instance) SetTextureProgressOffset(value Vector2.XY)

SetTextureProgressOffset sets the property returned by [GetTextureProgressOffset].

func (Instance) SetTextureUnder

func (self Instance) SetTextureUnder(value Texture2D.Instance)

SetTextureUnder sets the property returned by [GetUnderTexture].

func (Instance) SetTintOver

func (self Instance) SetTintOver(value Color.RGBA)

SetTintOver sets the property returned by [GetTintOver].

func (Instance) SetTintProgress

func (self Instance) SetTintProgress(value Color.RGBA)

SetTintProgress sets the property returned by [GetTintProgress].

func (Instance) SetTintUnder

func (self Instance) SetTintUnder(value Color.RGBA)

SetTintUnder sets the property returned by [GetTintUnder].

func (Instance) StretchMarginBottom

func (self Instance) StretchMarginBottom() int

The height of the 9-patch's bottom row. A margin of 16 means the 9-slice's bottom corners and side will have a height of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders. Only effective if NinePatchStretch is true.

func (Instance) StretchMarginLeft

func (self Instance) StretchMarginLeft() int

The width of the 9-patch's left column. Only effective if NinePatchStretch is true.

func (Instance) StretchMarginRight

func (self Instance) StretchMarginRight() int

The width of the 9-patch's right column. Only effective if NinePatchStretch is true.

func (Instance) StretchMarginTop

func (self Instance) StretchMarginTop() int

The height of the 9-patch's top row. Only effective if NinePatchStretch is true.

func (Instance) TextureOver

func (self Instance) TextureOver() Texture2D.Instance

Texture2D that draws over the progress bar. Use it to add highlights or an upper-frame that hides part of TextureProgress.

func (Instance) TextureProgress

func (self Instance) TextureProgress() Texture2D.Instance

Texture2D that clips based on the node's value and FillMode. As value increased, the texture fills up. It shows entirely when value reaches max_value. It doesn't show at all if value is equal to min_value.

The value property comes from Range. See Range.Value, Range.MinValue, Range.MaxValue.

func (Instance) TextureProgressOffset

func (self Instance) TextureProgressOffset() Vector2.XY

The offset of TextureProgress. Useful for TextureOver and TextureUnder with fancy borders, to avoid transparent margins in your progress texture.

func (Instance) TextureUnder

func (self Instance) TextureUnder() Texture2D.Instance

Texture2D that draws under the progress bar. The bar's background.

func (Instance) TintOver

func (self Instance) TintOver() Color.RGBA

Multiplies the color of the bar's TextureOver texture. The effect is similar to CanvasItem.Modulate, except it only affects this specific texture instead of the entire node.

func (Instance) TintProgress

func (self Instance) TintProgress() Color.RGBA

Multiplies the color of the bar's TextureProgress texture.

func (Instance) TintUnder

func (self Instance) TintUnder() Color.RGBA

Multiplies the color of the bar's TextureUnder texture.

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL