Skip to content
0.2.0-dev Download ZIP
72 lines ·4.5 KB Raw
1<?xml version="1.0" encoding="UTF-8" ?>
2<class name="TextureRect" inherits="Control" api_type="core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 A control that displays a texture.
5 </brief_description>
6 <description>
7 A control that displays a texture, for example an icon inside a GUI. The texture's placement can be controlled with the [member stretch_mode] property. It can scale, tile, or stay centered inside its bounding rectangle.
8 </description>
9 <tutorials>
10 <link title="3D Voxel Demo">https://godotengine.org/asset-library/asset/2755</link>
11 </tutorials>
12 <members>
13 <member name="expand_mode" type="int" setter="set_expand_mode" getter="get_expand_mode" enum="TextureRect.ExpandMode" default="0" experimental="Using [constant EXPAND_FIT_WIDTH], [constant EXPAND_FIT_WIDTH_PROPORTIONAL], [constant EXPAND_FIT_HEIGHT], or [constant EXPAND_FIT_HEIGHT_PROPORTIONAL] may result in unstable behavior in some [Container] controls. This behavior may be re-evaluated and changed in the future.">
14 Defines how minimum size is determined based on the texture's size.
15 </member>
16 <member name="flip_h" type="bool" setter="set_flip_h" getter="is_flipped_h" default="false">
17 If [code]true[/code], texture is flipped horizontally.
18 </member>
19 <member name="flip_v" type="bool" setter="set_flip_v" getter="is_flipped_v" default="false">
20 If [code]true[/code], texture is flipped vertically.
21 </member>
22 <member name="mouse_filter" type="int" setter="set_mouse_filter" getter="get_mouse_filter" overrides="Control" enum="Control.MouseFilter" default="1" />
23 <member name="stretch_mode" type="int" setter="set_stretch_mode" getter="get_stretch_mode" enum="TextureRect.StretchMode" default="0">
24 Controls the texture's behavior when resizing the node's bounding rectangle.
25 </member>
26 <member name="texture" type="Texture2D" setter="set_texture" getter="get_texture">
27 The node's [Texture2D] resource.
28 </member>
29 </members>
30 <constants>
31 <constant name="EXPAND_KEEP_SIZE" value="0" enum="ExpandMode">
32 The minimum size will be equal to texture size, i.e. [TextureRect] can't be smaller than the texture.
33 </constant>
34 <constant name="EXPAND_IGNORE_SIZE" value="1" enum="ExpandMode">
35 The size of the texture won't be considered for minimum size calculation, so the [TextureRect] can be shrunk down past the texture size.
36 </constant>
37 <constant name="EXPAND_FIT_WIDTH" value="2" enum="ExpandMode">
38 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].
39 </constant>
40 <constant name="EXPAND_FIT_WIDTH_PROPORTIONAL" value="3" enum="ExpandMode">
41 Same as [constant EXPAND_FIT_WIDTH], but keeps texture's aspect ratio.
42 </constant>
43 <constant name="EXPAND_FIT_HEIGHT" value="4" enum="ExpandMode">
44 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].
45 </constant>
46 <constant name="EXPAND_FIT_HEIGHT_PROPORTIONAL" value="5" enum="ExpandMode">
47 Same as [constant EXPAND_FIT_HEIGHT], but keeps texture's aspect ratio.
48 </constant>
49 <constant name="STRETCH_SCALE" value="0" enum="StretchMode">
50 Scale to fit the node's bounding rectangle.
51 </constant>
52 <constant name="STRETCH_TILE" value="1" enum="StretchMode">
53 Tile inside the node's bounding rectangle.
54 [b]Note:[/b] [constant STRETCH_TILE] mode is not supported for [member texture] set to an [AtlasTexture] with non-zero [member AtlasTexture.margin].
55 </constant>
56 <constant name="STRETCH_KEEP" value="2" enum="StretchMode">
57 The texture keeps its original size and stays in the bounding rectangle's top-left corner.
58 </constant>
59 <constant name="STRETCH_KEEP_CENTERED" value="3" enum="StretchMode">
60 The texture keeps its original size and stays centered in the node's bounding rectangle.
61 </constant>
62 <constant name="STRETCH_KEEP_ASPECT" value="4" enum="StretchMode">
63 Scale the texture to fit the node's bounding rectangle, but maintain the texture's aspect ratio.
64 </constant>
65 <constant name="STRETCH_KEEP_ASPECT_CENTERED" value="5" enum="StretchMode">
66 Scale the texture to fit the node's bounding rectangle, center it and maintain its aspect ratio.
67 </constant>
68 <constant name="STRETCH_KEEP_ASPECT_COVERED" value="6" enum="StretchMode">
69 Scale the texture so that the shorter side fits the bounding rectangle. The other side clips to the node's limits.
70 </constant>
71 </constants>
72</class>