diff options
Diffstat (limited to 'game/src/Game/GameSession/Tooltip.gd')
-rw-r--r-- | game/src/Game/GameSession/Tooltip.gd | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/game/src/Game/GameSession/Tooltip.gd b/game/src/Game/GameSession/Tooltip.gd new file mode 100644 index 0000000..c110e2e --- /dev/null +++ b/game/src/Game/GameSession/Tooltip.gd @@ -0,0 +1,23 @@ +extends GUINode + +var _tooltip_label : GUILabel + +func _ready() -> void: + add_gui_element("core", "ToolTip") + + _tooltip_label = get_gui_label_from_nodepath(^"./ToolTip") + if _tooltip_label: + _tooltip_label.set_auto_adjust_to_content_size(true) + + MenuSingleton.update_tooltip.connect(update_tooltip) + + hide() + +func update_tooltip(text : String, substitution_dict : Dictionary, position : Vector2) -> void: + if text: + _tooltip_label.set_text(text) + _tooltip_label.set_substitution_dict(substitution_dict) + _tooltip_label.set_position(position) + show() + else: + hide() |