summaryrefslogtreecommitdiff
path: root/doc/classes/TextureRect.xml
blob: af5626ae84c8fe3314b5e528b22fef35689a046a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?xml version="1.0" encoding="UTF-8" ?>
<class name="TextureRect" inherits="Control" category="Core" version="3.0.alpha.custom_build">
	<brief_description>
		Draws a sprite or a texture inside a User Interface. The texture can tile or not.
	</brief_description>
	<description>
		Use TextureRect to draw icons and sprites in your User Interfaces. To create panels and menu boxes, take a look at [NinePatchFrame]. Its Stretch Mode property controls the texture's scale and placement. It can scale, tile and stay centered inside its bounding rectangle. TextureRect is one of the 5 most common nodes to create game UI.
	</description>
	<tutorials>
	</tutorials>
	<demos>
	</demos>
	<methods>
		<method name="get_stretch_mode" qualifiers="const">
			<return type="int" enum="TextureRect.StretchMode">
			</return>
			<description>
			</description>
		</method>
		<method name="get_texture" qualifiers="const">
			<return type="Texture">
			</return>
			<description>
			</description>
		</method>
		<method name="has_expand" qualifiers="const">
			<return type="bool">
			</return>
			<description>
			</description>
		</method>
		<method name="set_expand">
			<return type="void">
			</return>
			<argument index="0" name="enable" type="bool">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_stretch_mode">
			<return type="void">
			</return>
			<argument index="0" name="stretch_mode" type="int" enum="TextureRect.StretchMode">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_texture">
			<return type="void">
			</return>
			<argument index="0" name="texture" type="Texture">
			</argument>
			<description>
			</description>
		</method>
	</methods>
	<members>
		<member name="expand" type="bool" setter="set_expand" getter="has_expand">
			If [code]true[/code], the texture scales to fit its bounding rectangle. Default value: [code]false[/code].
		</member>
		<member name="stretch_mode" type="int" setter="set_stretch_mode" getter="get_stretch_mode" enum="TextureRect.StretchMode">
			Controls the texture's behavior when you resize the node's bounding rectangle. Set it to one of the [code]STRETCH_*[/code] constants. See the constants to learn more.
		</member>
		<member name="texture" type="Texture" setter="set_texture" getter="get_texture">
			The node's [Texture] resource.
		</member>
	</members>
	<constants>
		<constant name="STRETCH_SCALE_ON_EXPAND" value="0">
			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 [code]STRETCH_KEEP[/code].
		</constant>
		<constant name="STRETCH_SCALE" value="1">
			Scale to fit the node's bounding rectangle.
		</constant>
		<constant name="STRETCH_TILE" value="2">
			Tile inside the node's bounding rectangle.
		</constant>
		<constant name="STRETCH_KEEP" value="3">
			The texture keeps its original size and stays in the bounding rectangle's top-left corner.
		</constant>
		<constant name="STRETCH_KEEP_CENTERED" value="4">
			The texture keeps its original size and stays centered in the node's bounding rectangle.
		</constant>
		<constant name="STRETCH_KEEP_ASPECT" value="5">
			Scale the texture to fit the node's bounding rectangle, but maintain the texture's aspect ratio.
		</constant>
		<constant name="STRETCH_KEEP_ASPECT_CENTERED" value="6">
			Scale the texture to fit the node's bounding rectangle, center it and maintain its aspect ratio.
		</constant>
		<constant name="STRETCH_KEEP_ASPECT_COVERED" value="7">
			Scale the texture so that the shorter side fits the bounding rectangle. The other side clips to the node's limits.
		</constant>
	</constants>
</class>