rich_text_bbcode.tscn 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. [gd_scene load_steps=5 format=3 uid="uid://oeg5vj7lpjw0"]
  2. [ext_resource type="Script" path="res://rich_text_bbcode.gd" id="1"]
  3. [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_q1hwu"]
  4. [sub_resource type="InputEventAction" id="InputEventAction_eu7pn"]
  5. action = &"toggle_pause"
  6. [sub_resource type="Shortcut" id="Shortcut_n2ck8"]
  7. events = [SubResource("InputEventAction_eu7pn")]
  8. [node name="RichTextBBCode" type="Control"]
  9. layout_mode = 3
  10. anchors_preset = 8
  11. anchor_left = 0.5
  12. anchor_top = 0.5
  13. anchor_right = 0.5
  14. anchor_bottom = 0.5
  15. offset_left = -512.0
  16. offset_top = -300.0
  17. offset_right = 512.0
  18. offset_bottom = 300.0
  19. grow_horizontal = 2
  20. grow_vertical = 2
  21. size_flags_horizontal = 2
  22. size_flags_vertical = 2
  23. script = ExtResource("1")
  24. [node name="RichTextLabel" type="RichTextLabel" parent="."]
  25. clip_contents = false
  26. layout_mode = 1
  27. anchors_preset = 15
  28. anchor_right = 1.0
  29. anchor_bottom = 1.0
  30. offset_top = -2.0
  31. offset_bottom = -2.0
  32. grow_horizontal = 2
  33. grow_vertical = 2
  34. size_flags_horizontal = 2
  35. size_flags_vertical = 2
  36. focus_mode = 2
  37. theme_override_colors/selection_color = Color(1, 1, 1, 0.164706)
  38. theme_override_constants/line_separation = 1
  39. theme_override_constants/table_h_separation = 120
  40. theme_override_constants/table_v_separation = 10
  41. theme_override_styles/focus = SubResource("StyleBoxEmpty_q1hwu")
  42. bbcode_enabled = true
  43. text = "RichTextLabel is a flexible way of adding text to your project, with support for [i]italics[/i], [b]bold[/b] and [i][b]both[/b][/i].
  44. [u]Underline[/u] and [s]strikethrough[/s] work too, including with [u][i]italics[/i][/u], [u][b]bold[/b][/u] and [u][i][b]both[/b][/i][/u].
  45. Text [color=#4cf]color[/color], [fgcolor=#49c9]foreground [color=#4cf]color[/color][/fgcolor] and [bgcolor=#49c9]background [color=#4cf]color[/color][/bgcolor] can be adjusted.
  46. It's also possible to include [img]res://unicorn_icon.png[/img] [font_size=24]custom images[/font_size], as well as [color=aqua][url=https://godotengine.org]custom URLs[/url][/color]. [hint=This displays a hint.]Hover this to display a tooltip![/hint]
  47. Left alignment is default,[center]but center alignment is supported,[/center][right]as well as right alignment.[/right]
  48. [fill][dropcap font_size=48 color=yellow margins=0,-10,0,-12]F[/dropcap]ill alignment is also supported, and allows writing very long text that will end up fitting the horizontal space entirely with words of joy. Drop caps are also supported. When using a drop cap, the first character of a paragraph is made larger, taking up several lines of text and optionally using a specific font or color.[/fill]
  49. Several effects are also available: [wave]Wave[/wave] [tornado]Tornado[/tornado] [shake]Shake[/shake] [fade start=67 length=7]Fade[/fade] [rainbow]Rainbow[/rainbow]
  50. [table=2]
  51. [cell border=#fff3 bg=#fff1]
  52. [ul]
  53. Tables
  54. are supported.
  55. [/ul]
  56. [/cell]
  57. [cell border=#fc13 bg=#fc11]
  58. [ol]
  59. Ordered
  60. list example.
  61. [/ol]
  62. [/cell]
  63. [/table]
  64. You can also create custom tags/effects, or customize behavior of [lb]url[rb] tags on click. For full reference, [color=aqua][url=https://docs.godotengine.org/en/latest/tutorials/gui/bbcode_in_richtextlabel.html]check the documentation.[/url][/color]
  65. "
  66. context_menu_enabled = true
  67. selection_enabled = true
  68. [node name="Pause" type="Button" parent="."]
  69. process_mode = 3
  70. layout_mode = 1
  71. anchors_preset = 2
  72. anchor_top = 1.0
  73. anchor_bottom = 1.0
  74. offset_top = -42.0
  75. offset_right = 96.0
  76. grow_vertical = 0
  77. toggle_mode = true
  78. shortcut = SubResource("Shortcut_n2ck8")
  79. shortcut_in_tooltip = false
  80. text = "Pause"
  81. [connection signal="meta_clicked" from="RichTextLabel" to="." method="_on_RichTextLabel_meta_clicked"]
  82. [connection signal="toggled" from="Pause" to="." method="_on_pause_toggled"]