TextureRect

Inherits: Control < CanvasItem < Node < Object

Control para dibujar texturas.

Descripción

Used to draw icons and sprites in a user interface. The texture's placement can be controlled with the stretch_mode property. It can scale, tile, or stay centered inside its bounding rectangle.

Note: You should enable flip_v when using a TextureRect to display a ViewportTexture. Alternatively, you can enable Viewport.render_target_v_flip on the Viewport. Otherwise, the image will appear upside down.

Tutoriales

Propiedades

bool

expand

false

bool

flip_h

false

bool

flip_v

false

MouseFilter

mouse_filter

1 (overrides Control)

StretchMode

stretch_mode

0

Texture

texture

Enumeraciones

enum StretchMode:

  • STRETCH_SCALE_ON_EXPAND = 0 --- Escala para ajustarse al rectángulo delimitador del nodo, sólo si expand es true. Por defecto stretch_mode, para compatibilidad hacia atrás. Hasta que no pongas expand en true, la textura se comportará como STRETCH_KEEP.

  • STRETCH_SCALE = 1 --- Escala para ajustarse al rectángulo delimitador del nodo.

  • STRETCH_TILE = 2 --- Tile dentro del rectángulo delimitador del nodo.

  • STRETCH_KEEP = 3 --- La textura mantiene su tamaño original y se mantiene en la esquina superior izquierda del rectángulo delimitador.

  • STRETCH_KEEP_CENTERED = 4 --- La textura mantiene su tamaño original y permanece centrado en el rectángulo delimitador del nodo.

  • STRETCH_KEEP_ASPECT = 5 --- Escala la textura para que se ajuste al rectángulo delimitador del nodo, pero mantén la relación de aspecto de la textura.

  • STRETCH_KEEP_ASPECT_CENTERED = 6 --- Escala la textura para que se ajuste al rectángulo delimitador del nodo, céntrarlo y mantenga su relación de aspecto.

  • STRETCH_KEEP_ASPECT_COVERED = 7 --- Escala la textura para que el lado más corto se ajuste al rectángulo delimitador. El otro lado se ajusta a los límites del nodo.

Descripciones de Propiedades

Default

false

Setter

set_expand(value)

Getter

has_expand()

Si true, la textura se escala para ajustarse a su rectángulo delimitador.


Default

false

Setter

set_flip_h(value)

Getter

is_flipped_h()

Si true, la textura se voltea horizontalmente.


Default

false

Setter

set_flip_v(value)

Getter

is_flipped_v()

Si true, la textura se voltea verticalmente.


Default

0

Setter

set_stretch_mode(value)

Getter

get_stretch_mode()

Controla el comportamiento de la textura al redimensionar el rectángulo de delimitación del nodo. Ver StretchMode.


Setter

set_texture(value)

Getter

get_texture()

The node's Texture resource.