Attention: Here be dragons
This is the
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
A control that displays a texture.
A control that displays a texture, for example an icon inside a GUI. The texture's placement can be controlled with the stretch_mode property. It can scale, tile, or stay centered inside its bounding rectangle.
ExpandMode EXPAND_KEEP_SIZE =
The minimum size will be equal to texture size, i.e. TextureRect can't be smaller than the texture.
ExpandMode EXPAND_IGNORE_SIZE =
The size of the texture won't be considered for minimum size calculation, so the TextureRect can be shrunk down past the texture size.
ExpandMode EXPAND_FIT_WIDTH =
The height of the texture will be ignored. Minimum width will be equal to the current height. Useful for horizontal layouts, e.g. inside HBoxContainer.
ExpandMode EXPAND_FIT_WIDTH_PROPORTIONAL =
Same as EXPAND_FIT_WIDTH, but keeps texture's aspect ratio.
ExpandMode EXPAND_FIT_HEIGHT =
The width of the texture will be ignored. Minimum height will be equal to the current width. Useful for vertical layouts, e.g. inside VBoxContainer.
ExpandMode EXPAND_FIT_HEIGHT_PROPORTIONAL =
Same as EXPAND_FIT_HEIGHT, but keeps texture's aspect ratio.
StretchMode STRETCH_SCALE =
Scale to fit the node's bounding rectangle.
StretchMode STRETCH_TILE =
Tile inside the node's bounding rectangle.
StretchMode STRETCH_KEEP =
The texture keeps its original size and stays in the bounding rectangle's top-left corner.
StretchMode STRETCH_KEEP_CENTERED =
The texture keeps its original size and stays centered in the node's bounding rectangle.
StretchMode STRETCH_KEEP_ASPECT =
Scale the texture to fit the node's bounding rectangle, but maintain the texture's aspect ratio.
StretchMode STRETCH_KEEP_ASPECT_CENTERED =
Scale the texture to fit the node's bounding rectangle, center it and maintain its aspect ratio.
StretchMode STRETCH_KEEP_ASPECT_COVERED =
Scale the texture so that the shorter side fits the bounding rectangle. The other side clips to the node's limits.
ExpandMode expand_mode =
Defines how minimum size is determined based on the texture's size. See ExpandMode for options.
Note: Using EXPAND_FIT_WIDTH, EXPAND_FIT_WIDTH_PROPORTIONAL, EXPAND_FIT_HEIGHT or EXPAND_FIT_HEIGHT_PROPORTIONAL may result in unstable behavior in some containers. This functionality is being re-evaluated and will change in the future.
bool flip_h =
true, texture is flipped horizontally.
bool flip_v =
true, texture is flipped vertically.
StretchMode stretch_mode =
Controls the texture's behavior when resizing the node's bounding rectangle. See StretchMode.