guarriconos

This commit is contained in:
2023-02-14 18:09:22 +01:00
parent 3498dcd68f
commit 61b53578d0
4 changed files with 25 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

View File

@@ -2,8 +2,17 @@ extends ESCTooltip
var id: int
export(Texture) var iconTexture: Texture = null \
setget ,_get_icon_texture
func _init(tooltip_id = 0):
id = tooltip_id
#$icon.texture = iconTexture
signal tooltip2_size_updated
@@ -13,14 +22,16 @@ func update_tooltip_text():
# first frame the text is wider than the default of 0 and ends up being really tall
# and setting the wrong vertical margin for the tooltip
update_size()
#var texturePath = get_constant()
var texturePath = null
# We signal this here since the processing in this class happens AFTER input
# processing. We signal here to avoid "lagging" behind a frame since
# tooltips are presently dependent on the size of the bounding box around
# the rendered string.
emit_signal("tooltip2_size_updated")
bbcode_text = "[center]"
#if(texturePath != null):
bbcode_text += "[img]" + "res://gymkhana/addons/escoria-ui-return-monkey-island/cursors/mouse_right.png" + "[/img]"
bbcode_text += "[color=#" + color.to_html(false) + "]"
bbcode_text += current_target
bbcode_text += "[/color]"
@@ -35,3 +46,12 @@ func update_tooltip_text():
func _on_room_ready():
escoria.main.current_scene.game.tooltip2_node = self
_room_is_ready = true
func _get_icon_texture() -> Texture:
if iconTexture == null:
for c in get_children():
if c is TextureRect or c is Sprite:
return c.texture
return null
else:
return iconTexture

View File

@@ -19,8 +19,10 @@ func update_tooltip_text():
# tooltips are presently dependent on the size of the bounding box around
# the rendered string.
emit_signal("tooltip_size_updated")
bbcode_text = "[center]"
bbcode_text = "[center]"
bbcode_text += "[img]" + "res://gymkhana/addons/escoria-ui-return-monkey-island/cursors/mouse_left.png" + "[/img]"
bbcode_text += "[color=#" + color.to_html(false) + "]"
bbcode_text += current_target
bbcode_text += "[/color]"