2017-09-13 04:42:36 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-07-06 16:08:05 +08:00
<class name= "TextureRect" inherits= "Control" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2017-09-13 04:42:36 +08:00
<brief_description >
2023-04-30 22:26:09 +08:00
A control that displays a texture.
2017-09-13 04:42:36 +08:00
</brief_description>
<description >
2023-04-30 22:26:09 +08:00
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.
2017-09-13 04:42:36 +08:00
</description>
<tutorials >
2020-10-01 16:34:47 +08:00
<link title= "3D Voxel Demo" > https://godotengine.org/asset-library/asset/676</link>
2017-09-13 04:42:36 +08:00
</tutorials>
<members >
2023-02-16 04:25:40 +08:00
<member name= "expand_mode" type= "int" setter= "set_expand_mode" getter= "get_expand_mode" enum= "TextureRect.ExpandMode" default= "0" is_experimental= "true" >
2022-02-25 08:19:24 +08:00
Defines how minimum size is determined based on the texture's size. See [enum ExpandMode] for options.
2023-02-16 04:25:40 +08:00
[b]Note:[/b] 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 containers. This functionality is being re-evaluated and will change in the future.
2022-02-25 08:19:24 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "flip_h" type= "bool" setter= "set_flip_h" getter= "is_flipped_h" default= "false" >
2019-06-29 21:24:23 +08:00
If [code]true[/code], texture is flipped horizontally.
2019-02-05 12:12:44 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "flip_v" type= "bool" setter= "set_flip_v" getter= "is_flipped_v" default= "false" >
2019-06-29 21:24:23 +08:00
If [code]true[/code], texture is flipped vertically.
2019-02-05 12:12:44 +08:00
</member>
2021-12-03 03:38:49 +08:00
<member name= "mouse_filter" type= "int" setter= "set_mouse_filter" getter= "get_mouse_filter" overrides= "Control" enum= "Control.MouseFilter" default= "1" />
2019-06-29 18:38:01 +08:00
<member name= "stretch_mode" type= "int" setter= "set_stretch_mode" getter= "get_stretch_mode" enum= "TextureRect.StretchMode" default= "0" >
2019-04-15 20:49:41 +08:00
Controls the texture's behavior when resizing the node's bounding rectangle. See [enum StretchMode].
</member>
2020-02-12 16:59:06 +08:00
<member name= "texture" type= "Texture2D" setter= "set_texture" getter= "get_texture" >
The node's [Texture2D] resource.
2019-04-15 20:49:41 +08:00
</member>
2017-09-13 04:42:36 +08:00
</members>
<constants >
2022-02-25 08:19:24 +08:00
<constant name= "EXPAND_KEEP_SIZE" value= "0" enum= "ExpandMode" >
The minimum size will be equal to texture size, i.e. [TextureRect] can't be smaller than the texture.
</constant>
<constant name= "EXPAND_IGNORE_SIZE" value= "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.
</constant>
<constant name= "EXPAND_FIT_WIDTH" value= "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].
</constant>
<constant name= "EXPAND_FIT_WIDTH_PROPORTIONAL" value= "3" enum= "ExpandMode" >
Same as [constant EXPAND_FIT_WIDTH], but keeps texture's aspect ratio.
</constant>
<constant name= "EXPAND_FIT_HEIGHT" value= "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].
</constant>
<constant name= "EXPAND_FIT_HEIGHT_PROPORTIONAL" value= "5" enum= "ExpandMode" >
Same as [constant EXPAND_FIT_HEIGHT], but keeps texture's aspect ratio.
</constant>
2021-11-30 08:21:45 +08:00
<constant name= "STRETCH_SCALE" value= "0" enum= "StretchMode" >
2017-09-16 17:54:44 +08:00
Scale to fit the node's bounding rectangle.
2017-09-13 04:42:36 +08:00
</constant>
2021-11-30 08:21:45 +08:00
<constant name= "STRETCH_TILE" value= "1" enum= "StretchMode" >
2017-09-16 17:54:44 +08:00
Tile inside the node's bounding rectangle.
2017-09-13 04:42:36 +08:00
</constant>
2021-11-30 08:21:45 +08:00
<constant name= "STRETCH_KEEP" value= "2" enum= "StretchMode" >
2017-09-16 17:54:44 +08:00
The texture keeps its original size and stays in the bounding rectangle's top-left corner.
2017-09-13 04:42:36 +08:00
</constant>
2021-11-30 08:21:45 +08:00
<constant name= "STRETCH_KEEP_CENTERED" value= "3" enum= "StretchMode" >
2017-09-16 17:54:44 +08:00
The texture keeps its original size and stays centered in the node's bounding rectangle.
2017-09-13 04:42:36 +08:00
</constant>
2021-11-30 08:21:45 +08:00
<constant name= "STRETCH_KEEP_ASPECT" value= "4" enum= "StretchMode" >
2017-09-16 17:54:44 +08:00
Scale the texture to fit the node's bounding rectangle, but maintain the texture's aspect ratio.
2017-09-13 04:42:36 +08:00
</constant>
2021-11-30 08:21:45 +08:00
<constant name= "STRETCH_KEEP_ASPECT_CENTERED" value= "5" enum= "StretchMode" >
2017-09-16 17:54:44 +08:00
Scale the texture to fit the node's bounding rectangle, center it and maintain its aspect ratio.
2017-09-13 04:42:36 +08:00
</constant>
2021-11-30 08:21:45 +08:00
<constant name= "STRETCH_KEEP_ASPECT_COVERED" value= "6" enum= "StretchMode" >
2017-09-16 17:54:44 +08:00
Scale the texture so that the shorter side fits the bounding rectangle. The other side clips to the node's limits.
2017-09-13 04:42:36 +08:00
</constant>
</constants>
</class>