Merge pull request #11324 from GDquest/ui-nodes

[DOCS] Write and update TextureRect, Label and NinePatchRect
This commit is contained in:
Poommetee Ketson 2017-09-17 08:38:52 +07:00 committed by GitHub
commit 91b5a15ebc
3 changed files with 43 additions and 11 deletions

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Label" inherits="Control" category="Core" version="3.0.alpha.custom_build">
<brief_description>
Control that displays formatted text.
Displays plain text in a line or wrapped inside a rectangle. For formatted text, use [RichTextLabel].
</brief_description>
<description>
Label is a control that displays formatted text, optionally autowrapping it to the [Control] area. It inherits from range to be able to scroll wrapped text vertically.
Label displays plain text on the screen. It gives you control over the horizontal and vertical alignment, and can wrap the text inside the node's bounding rectangle. It doesn't support bold, italics or other formatting. For that, use [RichTextLabel] instead.
</description>
<tutorials>
</tutorials>
@ -22,14 +22,14 @@
<return type="int">
</return>
<description>
Return the amount of lines.
Returns the amount of lines of text the Label has.
</description>
</method>
<method name="get_line_height" qualifiers="const">
<return type="int">
</return>
<description>
Return the height of a line.
Returns the font size in pixels.
</description>
</method>
<method name="get_lines_skipped" qualifiers="const">
@ -98,14 +98,14 @@
<return type="bool">
</return>
<description>
Return true if text would be cut off if it is too wide.
Return [code]true[/code] if text would be cut off if it is too wide.
</description>
</method>
<method name="is_uppercase" qualifiers="const">
<return type="bool">
</return>
<description>
Return true if text is displayed in all capitals.
Return [code]true[/code] if text is displayed in all capitals.
</description>
</method>
<method name="set_align">
@ -201,22 +201,31 @@
</methods>
<members>
<member name="align" type="int" setter="set_align" getter="get_align" enum="Label.Align">
Controls the text's horizontal align. Supports left, center, right, and fill, or justify. Set it to one of the [code]ALIGN_*[/code] constants.
</member>
<member name="autowrap" type="bool" setter="set_autowrap" getter="has_autowrap">
If [code]true[/code], wraps the text inside the node's bounding rectangle. If you resize the node, it will change its height automatically to show all the text. Default: false.
</member>
<member name="clip_text" type="bool" setter="set_clip_text" getter="is_clipping_text">
If [code]true[/code], the Label only shows the text that fits inside its bounding rectangle. It also lets you scale the node down freely.
</member>
<member name="lines_skipped" type="int" setter="set_lines_skipped" getter="get_lines_skipped">
The node ignores the first [code]lines_skipped[/code] lines before it starts to display text.
</member>
<member name="max_lines_visible" type="int" setter="set_max_lines_visible" getter="get_max_lines_visible">
Limits the lines of text the node shows on screen.
</member>
<member name="percent_visible" type="float" setter="set_percent_visible" getter="get_percent_visible">
Limits the count of visible characters. If you set [code]percent_visible[/code] to 50, only up to half of the text's characters will display on screen. Useful to animate the text in a dialog box.
</member>
<member name="text" type="String" setter="set_text" getter="get_text">
The text to display on screen.
</member>
<member name="uppercase" type="bool" setter="set_uppercase" getter="is_uppercase">
If [code]true[/code], all the text displays as UPPERCASE.
</member>
<member name="valign" type="int" setter="set_valign" getter="get_valign" enum="Label.VAlign">
Controls the text's vertical align. Supports top, center, bottom, and fill. Set it to one of the [code]VALIGN_*[/code] constants.
</member>
</members>
<constants>

View File

@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="NinePatchRect" inherits="Control" category="Core" version="3.0.alpha.custom_build">
<brief_description>
Scalable texture-based frame that tiles the texture's centers and sides, but keeps the corners' original size. Perfect for panels and dialog boxes.
</brief_description>
<description>
Better known as 9-slice panels, NinePatchRect produces clean panels of any size, based on a small texture. To do so, it splits the texture in a 3 by 3 grid. When you scale the node, it tiles the texture's sides horizontally or vertically, the center on both axes but it doesn't scale or tile the corners.
</description>
<tutorials>
</tutorials>
@ -100,36 +102,49 @@
</methods>
<members>
<member name="axis_stretch_horizontal" type="int" setter="set_h_axis_stretch_mode" getter="get_h_axis_stretch_mode" enum="NinePatchRect.AxisStretchMode">
Doesn't do anything at the time of writing.
</member>
<member name="axis_stretch_vertical" type="int" setter="set_v_axis_stretch_mode" getter="get_v_axis_stretch_mode" enum="NinePatchRect.AxisStretchMode">
Doesn't do anything at the time of writing.
</member>
<member name="draw_center" type="bool" setter="set_draw_center" getter="is_draw_center_enabled">
If [code]true[/code], draw the panel's center. Else, only draw the 9-slice's borders. Default value: [code]true[/code]
</member>
<member name="patch_margin_bottom" type="int" setter="set_patch_margin" getter="get_patch_margin">
The height of the 9-slice's bottom row. A margin of 16 means the 9-slice's bottom corners and side will have a height of 16 pixels. You can set all 4 margin values indivually to create panels with non-uniform borders.
</member>
<member name="patch_margin_left" type="int" setter="set_patch_margin" getter="get_patch_margin">
The height of the 9-slice's left column.
</member>
<member name="patch_margin_right" type="int" setter="set_patch_margin" getter="get_patch_margin">
The height of the 9-slice's right column.
</member>
<member name="patch_margin_top" type="int" setter="set_patch_margin" getter="get_patch_margin">
The height of the 9-slice's top row.
</member>
<member name="region_rect" type="Rect2" setter="set_region_rect" getter="get_region_rect">
Rectangular region of the texture to sample from. If you're working with an atlas, use this property to define the area the 9-slice should use. All other properties are relative to this one.
</member>
<member name="texture" type="Texture" setter="set_texture" getter="get_texture">
The node's texture resource.
</member>
</members>
<signals>
<signal name="texture_changed">
<description>
Fired when the node's texture changes.
</description>
</signal>
</signals>
<constants>
<constant name="AXIS_STRETCH_MODE_STRETCH" value="0">
Doesn't do anything at the time of writing. Default value for [code]axis_stretch_horizontal[/code] and [code]axis_stretch_vertical[/code].
</constant>
<constant name="AXIS_STRETCH_MODE_TILE" value="1">
Doesn't do anything at the time of writing.
</constant>
<constant name="AXIS_STRETCH_MODE_TILE_FIT" value="2">
Doesn't do anything at the time of writing.
</constant>
</constants>
</class>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="TextureRect" inherits="Control" category="Core" version="3.0.alpha.custom_build">
<brief_description>
Control that draws a texture.
Draws a sprite or a texture inside a User Interface. The texture can tile or not.
</brief_description>
<description>
Control that draws a texture.
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>
@ -56,31 +56,39 @@
</methods>
<members>
<member name="expand" type="bool" setter="set_expand" getter="has_expand">
If [code]true[/code] texture will expand to fit. Default value: [code]false[/code].
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">
Stretch mode of the texture. Use STRETCH_* constants as value.
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 [Texture] resource for the node.
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>