2017-09-12 20:42:36 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
2021-04-26 11:14:51 +00:00
<class name= "TextureRect" inherits= "Control" version= "3.4" >
2017-09-12 20:42:36 +00:00
<brief_description >
2018-05-20 20:43:48 +00:00
Control for drawing textures.
2017-09-12 20:42:36 +00:00
</brief_description>
<description >
2018-05-20 20:43:48 +00:00
Used to draw icons and sprites in a user interface. The texture's placement can be controlled with the [member stretch_mode] property. It can scale, tile, or stay centered inside its bounding rectangle.
2020-07-24 18:28:48 +00:00
[b]Note:[/b] You should enable [member flip_v] when using a TextureRect to display a [ViewportTexture]. Alternatively, you can enable [member Viewport.render_target_v_flip] on the Viewport. Otherwise, the image will appear upside down.
2017-09-12 20:42:36 +00:00
</description>
<tutorials >
2020-10-01 08:34:47 +00:00
<link title= "3D Voxel Demo" > https://godotengine.org/asset-library/asset/676</link>
2017-09-12 20:42:36 +00:00
</tutorials>
<methods >
</methods>
<members >
2019-06-29 10:38:01 +00:00
<member name= "expand" type= "bool" setter= "set_expand" getter= "has_expand" default= "false" >
2019-06-29 13:24:23 +00:00
If [code]true[/code], the texture scales to fit its bounding rectangle.
2017-09-12 20:42:36 +00:00
</member>
2019-06-29 10:38:01 +00:00
<member name= "flip_h" type= "bool" setter= "set_flip_h" getter= "is_flipped_h" default= "false" >
2019-06-29 13:24:23 +00:00
If [code]true[/code], texture is flipped horizontally.
2019-02-05 04:12:44 +00:00
</member>
2019-06-29 10:38:01 +00:00
<member name= "flip_v" type= "bool" setter= "set_flip_v" getter= "is_flipped_v" default= "false" >
2019-06-29 13:24:23 +00:00
If [code]true[/code], texture is flipped vertically.
2019-02-05 04:12:44 +00:00
</member>
2019-09-24 11:34:03 +00:00
<member name= "mouse_filter" type= "int" setter= "set_mouse_filter" getter= "get_mouse_filter" override= "true" enum= "Control.MouseFilter" default= "1" />
2019-06-29 10:38:01 +00:00
<member name= "stretch_mode" type= "int" setter= "set_stretch_mode" getter= "get_stretch_mode" enum= "TextureRect.StretchMode" default= "0" >
2019-04-15 12:49:41 +00:00
Controls the texture's behavior when resizing the node's bounding rectangle. See [enum StretchMode].
</member>
2019-07-15 18:42:47 +00:00
<member name= "texture" type= "Texture" setter= "set_texture" getter= "get_texture" >
2019-04-15 12:49:41 +00:00
The node's [Texture] resource.
</member>
2017-09-12 20:42:36 +00:00
</members>
<constants >
2017-11-24 22:16:30 +00:00
<constant name= "STRETCH_SCALE_ON_EXPAND" value= "0" enum= "StretchMode" >
2019-06-27 10:34:26 +00:00
Scale to fit the node's bounding rectangle, only if [code]expand[/code] is [code]true[/code]. Default [code]stretch_mode[/code], for backwards compatibility. Until you set [code]expand[/code] to [code]true[/code], the texture will behave like [constant STRETCH_KEEP].
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "STRETCH_SCALE" value= "1" enum= "StretchMode" >
2017-09-16 09:54:44 +00:00
Scale to fit the node's bounding rectangle.
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "STRETCH_TILE" value= "2" enum= "StretchMode" >
2017-09-16 09:54:44 +00:00
Tile inside the node's bounding rectangle.
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "STRETCH_KEEP" value= "3" enum= "StretchMode" >
2017-09-16 09:54:44 +00:00
The texture keeps its original size and stays in the bounding rectangle's top-left corner.
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "STRETCH_KEEP_CENTERED" value= "4" enum= "StretchMode" >
2017-09-16 09:54:44 +00:00
The texture keeps its original size and stays centered in the node's bounding rectangle.
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "STRETCH_KEEP_ASPECT" value= "5" enum= "StretchMode" >
2017-09-16 09:54:44 +00:00
Scale the texture to fit the node's bounding rectangle, but maintain the texture's aspect ratio.
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "STRETCH_KEEP_ASPECT_CENTERED" value= "6" enum= "StretchMode" >
2017-09-16 09:54:44 +00:00
Scale the texture to fit the node's bounding rectangle, center it and maintain its aspect ratio.
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "STRETCH_KEEP_ASPECT_COVERED" value= "7" enum= "StretchMode" >
2017-09-16 09:54:44 +00:00
Scale the texture so that the shorter side fits the bounding rectangle. The other side clips to the node's limits.
2017-09-12 20:42:36 +00:00
</constant>
</constants>
</class>