TextureRect.xml 3.7 KB

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