Class reference

TextureRect

Inherits Control

A control that displays a texture.

Description

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.

Properties

bool flip_h = false

If true, texture is flipped horizontally.

bool flip_v = false

If true, texture is flipped vertically.

int mouse_filter = 1

int stretch_mode = 0

Controls the texture's behavior when resizing the node's bounding rectangle.

Constants

EXPAND_KEEP_SIZE = 0

Enum: ExpandMode

The minimum size will be equal to texture size, i.e. TextureRect can't be smaller than the texture.

EXPAND_IGNORE_SIZE = 1

Enum: ExpandMode

The size of the texture won't be considered for minimum size calculation, so the TextureRect can be shrunk down past the texture size.

EXPAND_FIT_WIDTH = 2

Enum: ExpandMode

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.

EXPAND_FIT_WIDTH_PROPORTIONAL = 3

Enum: ExpandMode

Same as EXPAND_FIT_WIDTH, but keeps texture's aspect ratio.

EXPAND_FIT_HEIGHT = 4

Enum: ExpandMode

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.

EXPAND_FIT_HEIGHT_PROPORTIONAL = 5

Enum: ExpandMode

Same as EXPAND_FIT_HEIGHT, but keeps texture's aspect ratio.

STRETCH_SCALE = 0

Enum: StretchMode

Scale to fit the node's bounding rectangle.

STRETCH_TILE = 1

Enum: StretchMode

Tile inside the node's bounding rectangle.

STRETCH_KEEP = 2

Enum: StretchMode

The texture keeps its original size and stays in the bounding rectangle's top-left corner.

STRETCH_KEEP_CENTERED = 3

Enum: StretchMode

The texture keeps its original size and stays centered in the node's bounding rectangle.

STRETCH_KEEP_ASPECT = 4

Enum: StretchMode

Scale the texture to fit the node's bounding rectangle, but maintain the texture's aspect ratio.

STRETCH_KEEP_ASPECT_CENTERED = 5

Enum: StretchMode

Scale the texture to fit the node's bounding rectangle, center it and maintain its aspect ratio.

STRETCH_KEEP_ASPECT_COVERED = 6

Enum: StretchMode

Scale the texture so that the shorter side fits the bounding rectangle. The other side clips to the node's limits.

Tutorials

Source revision 4f5b14abade2
Connection interrupted. Reload×

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.