TextureButton.xml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="TextureButton" inherits="BaseButton" category="Core" version="3.1">
  3. <brief_description>
  4. Texture-based button. Supports Pressed, Hover, Disabled and Focused states.
  5. </brief_description>
  6. <description>
  7. [code]TextureButton[/code] has the same functionality as [Button], except it uses sprites instead of Godot's [Theme] resource. It is faster to create, but it doesn't support localization like more complex Controls.
  8. The Normal state's texture is required. Others are optional.
  9. </description>
  10. <tutorials>
  11. </tutorials>
  12. <demos>
  13. </demos>
  14. <methods>
  15. </methods>
  16. <members>
  17. <member name="expand" type="bool" setter="set_expand" getter="get_expand">
  18. If [code]true[/code], the texture stretches to the edges of the node's bounding rectangle using the [member stretch_mode]. If [code]false[/code], the texture will not scale with the node. Default value: [code]false[/code].
  19. </member>
  20. <member name="stretch_mode" type="int" setter="set_stretch_mode" getter="get_stretch_mode" enum="TextureButton.StretchMode">
  21. Controls the texture's behavior when you resize the node's bounding rectangle, [b]only if[/b] [member expand] is [code]true[/code]. Set it to one of the [code]STRETCH_*[/code] constants. See the constants to learn more.
  22. </member>
  23. <member name="texture_click_mask" type="BitMap" setter="set_click_mask" getter="get_click_mask">
  24. Pure black and white [Bitmap] image to use for click detection. On the mask, white pixels represent the button's clickable area. Use it to create buttons with curved shapes.
  25. </member>
  26. <member name="texture_disabled" type="Texture" setter="set_disabled_texture" getter="get_disabled_texture">
  27. Texture to display when the node is disabled. See [member BaseButton.disabled].
  28. </member>
  29. <member name="texture_focused" type="Texture" setter="set_focused_texture" getter="get_focused_texture">
  30. Texture to display when the node has mouse or keyboard focus.
  31. </member>
  32. <member name="texture_hover" type="Texture" setter="set_hover_texture" getter="get_hover_texture">
  33. Texture to display when the mouse hovers the node.
  34. </member>
  35. <member name="texture_normal" type="Texture" setter="set_normal_texture" getter="get_normal_texture">
  36. Texture to display by default, when the node is [b]not[/b] in the disabled, focused, hover or pressed state.
  37. </member>
  38. <member name="texture_pressed" type="Texture" setter="set_pressed_texture" getter="get_pressed_texture">
  39. Texture to display on mouse down over the node, if the node has keyboard focus and the player presses the enter key or if the player presses the [member BaseButton.shortcut] key.
  40. </member>
  41. </members>
  42. <constants>
  43. <constant name="STRETCH_SCALE" value="0" enum="StretchMode">
  44. Scale to fit the node's bounding rectangle.
  45. </constant>
  46. <constant name="STRETCH_TILE" value="1" enum="StretchMode">
  47. Tile inside the node's bounding rectangle.
  48. </constant>
  49. <constant name="STRETCH_KEEP" value="2" enum="StretchMode">
  50. The texture keeps its original size and stays in the bounding rectangle's top-left corner.
  51. </constant>
  52. <constant name="STRETCH_KEEP_CENTERED" value="3" enum="StretchMode">
  53. The texture keeps its original size and stays centered in the node's bounding rectangle.
  54. </constant>
  55. <constant name="STRETCH_KEEP_ASPECT" value="4" enum="StretchMode">
  56. Scale the texture to fit the node's bounding rectangle, but maintain the texture's aspect ratio.
  57. </constant>
  58. <constant name="STRETCH_KEEP_ASPECT_CENTERED" value="5" enum="StretchMode">
  59. Scale the texture to fit the node's bounding rectangle, center it, and maintain its aspect ratio.
  60. </constant>
  61. <constant name="STRETCH_KEEP_ASPECT_COVERED" value="6" enum="StretchMode">
  62. Scale the texture so that the shorter side fits the bounding rectangle. The other side clips to the node's limits.
  63. </constant>
  64. </constants>
  65. </class>