Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

TextureProgressBar

繼承: Range < Control < CanvasItem < Node < Object

基於紋理的進度條。適用於載入螢幕和生命或體力條。

說明

TextureProgressBar 的工作方式類似於 ProgressBar,但最多使用 3 個紋理,不使用 Godot 的 Theme 資源。可用於建立水平、垂直和徑向進度條。

屬性

int

fill_mode

0

MouseFilter

mouse_filter

1 (overrides Control)

bool

nine_patch_stretch

false

Vector2

radial_center_offset

Vector2(0, 0)

float

radial_fill_degrees

360.0

float

radial_initial_angle

0.0

BitField[SizeFlags]

size_flags_vertical

1 (overrides Control)

float

step

1.0 (overrides Range)

int

stretch_margin_bottom

0

int

stretch_margin_left

0

int

stretch_margin_right

0

int

stretch_margin_top

0

Texture2D

texture_over

Texture2D

texture_progress

Vector2

texture_progress_offset

Vector2(0, 0)

Texture2D

texture_under

Color

tint_over

Color(1, 1, 1, 1)

Color

tint_progress

Color(1, 1, 1, 1)

Color

tint_under

Color(1, 1, 1, 1)

方法

int

get_stretch_margin(margin: Side) const

void

set_stretch_margin(margin: Side, value: int)


列舉

enum FillMode: 🔗

FillMode FILL_LEFT_TO_RIGHT = 0

texture_progress 從左到右填充。

FillMode FILL_RIGHT_TO_LEFT = 1

texture_progress 從右到左填充。

FillMode FILL_TOP_TO_BOTTOM = 2

texture_progress 從上到下填充。

FillMode FILL_BOTTOM_TO_TOP = 3

texture_progress 自下而上填充。

FillMode FILL_CLOCKWISE = 4

將節點變成徑向條形。texture_progress 順時針填充。參閱radial_center_offsetradial_initial_angleradial_fill_degrees來控制條形填充的方式。

FillMode FILL_COUNTER_CLOCKWISE = 5

將節點變成徑向條形。texture_progress逆時針填充。參閱radial_center_offsetradial_initial_angleradial_fill_degrees來控制條形填充的方式。

FillMode FILL_BILINEAR_LEFT_AND_RIGHT = 6

texture_progress從中心開始填充,向左和向右擴充。

FillMode FILL_BILINEAR_TOP_AND_BOTTOM = 7

texture_progress從中心開始填充,同時向頂部和底部擴充。

FillMode FILL_CLOCKWISE_AND_COUNTER_CLOCKWISE = 8

將節點變成徑向條形。texture_progress從中心徑向填充,順時針和逆時針擴展。參閱radial_center_offsetradial_initial_angleradial_fill_degrees來控制條形填充的方式。


屬性說明

int fill_mode = 0 🔗

  • void set_fill_mode(value: int)

  • int get_fill_mode()

填充方向。可能的取值見 FillMode


bool nine_patch_stretch = false 🔗

  • void set_nine_patch_stretch(value: bool)

  • bool get_nine_patch_stretch()

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


Vector2 radial_center_offset = Vector2(0, 0) 🔗

  • void set_radial_center_offset(value: Vector2)

  • Vector2 get_radial_center_offset()

Offsets texture_progress if fill_mode is FILL_CLOCKWISE, FILL_COUNTER_CLOCKWISE, or FILL_CLOCKWISE_AND_COUNTER_CLOCKWISE.

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


float radial_fill_degrees = 360.0 🔗

  • void set_fill_degrees(value: float)

  • float get_fill_degrees()

Upper limit for the fill of texture_progress if fill_mode is FILL_CLOCKWISE, FILL_COUNTER_CLOCKWISE, or FILL_CLOCKWISE_AND_COUNTER_CLOCKWISE. When the node's value is equal to its max_value, the texture fills up to this angle.

See Range.value, Range.max_value.


float radial_initial_angle = 0.0 🔗

  • void set_radial_initial_angle(value: float)

  • float get_radial_initial_angle()

Starting angle for the fill of texture_progress if fill_mode is FILL_CLOCKWISE, FILL_COUNTER_CLOCKWISE, or FILL_CLOCKWISE_AND_COUNTER_CLOCKWISE. 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 radial_fill_degrees.

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


int stretch_margin_bottom = 0 🔗

  • void set_stretch_margin(margin: Side, value: int)

  • int get_stretch_margin(margin: Side) const

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 nine_patch_stretch is true.


int stretch_margin_left = 0 🔗

  • void set_stretch_margin(margin: Side, value: int)

  • int get_stretch_margin(margin: Side) const

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


int stretch_margin_right = 0 🔗

  • void set_stretch_margin(margin: Side, value: int)

  • int get_stretch_margin(margin: Side) const

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


int stretch_margin_top = 0 🔗

  • void set_stretch_margin(margin: Side, value: int)

  • int get_stretch_margin(margin: Side) const

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


Texture2D texture_over 🔗

在進度條至上繪製的 Texture2D。可用於新增高光,也可用於新增遮擋部分 texture_progress 的上層邊框。


Texture2D texture_progress 🔗

被裁剪的 Texture2D。裁剪基於該節點的 valuefill_mode。隨著 value 的增加,該紋理將被填滿。當 value 達到 max_value 時,它將完整顯示。如果 value 等於 min_value,則它根本不顯示。

value 屬性來自 Range。參見 Range.valueRange.min_valueRange.max_value


Vector2 texture_progress_offset = Vector2(0, 0) 🔗

  • void set_texture_progress_offset(value: Vector2)

  • Vector2 get_texture_progress_offset()

texture_progress 的偏移量。對於帶有花哨的邊框的 texture_overtexture_under 很有用,可以避免進度紋理的邊緣透明。


Texture2D texture_under 🔗

在進度條下繪製的 Texture2D。該進度條的背景。


Color tint_over = Color(1, 1, 1, 1) 🔗

  • void set_tint_over(value: Color)

  • Color get_tint_over()

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


Color tint_progress = Color(1, 1, 1, 1) 🔗

  • void set_tint_progress(value: Color)

  • Color get_tint_progress()

Multiplies the color of the bar's texture_progress texture.


Color tint_under = Color(1, 1, 1, 1) 🔗

  • void set_tint_under(value: Color)

  • Color get_tint_under()

Multiplies the color of the bar's texture_under texture.


方法說明

int get_stretch_margin(margin: Side) const 🔗

返回給定索引的拉伸邊距。見 stretch_margin_bottom 及相關屬性。


void set_stretch_margin(margin: Side, value: int) 🔗

設定給定索引的拉伸邊距。見 stretch_margin_bottom 及相關屬性。