Implemented tooltip follows mouse (not perfect).

Fixed bug when using mousewheel action on inventory items.
Added a debug mode for tooltip following mouse
This commit is contained in:
Julian Murgia
2021-02-19 07:53:45 +01:00
parent 52d19c34bd
commit 38f554b496
24 changed files with 421 additions and 174 deletions

View File

@@ -1,10 +0,0 @@
extends RichTextLabel
var current_target : String
func set_target(target : String) -> void:
current_target = target
update_tooltip_text()
func update_tooltip_text():
bbcode_text = current_target

View File

@@ -1,7 +1,7 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://addons/escoria-core/game/assets/fonts/onesize/ONESIZE_.TTF" type="DynamicFontData" id=1]
[ext_resource path="res://game/ui/ui_mouse_icons/tooltip/target_tooltip.gd" type="Script" id=2]
[ext_resource path="res://game/ui/ui_mouse_icons/tooltip/tooltip_target.gd" type="Script" id=2]
[sub_resource type="DynamicFont" id=1]
size = 30
@@ -12,17 +12,17 @@ size = 30
font_data = ExtResource( 1 )
[node name="tooltip" type="RichTextLabel"]
anchor_right = 0.7
anchor_bottom = 0.06
margin_left = 1.49829
margin_right = 1.21826
margin_bottom = -10.0
margin_right = 200.0
margin_bottom = 32.0
rect_min_size = Vector2( 200, 32 )
custom_fonts/mono_font = SubResource( 1 )
custom_fonts/normal_font = SubResource( 2 )
bbcode_enabled = true
bbcode_text = "[center][/center]"
bbcode_text = "[center][color=#ffffff][/color][/center]"
scroll_active = false
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
color = Color( 1, 1, 1, 1 )
offset_from_cursor = Vector2( 100, 10 )

View File

@@ -0,0 +1,16 @@
tool
extends ESCTooltip
func update_tooltip_text():
print("new color " + str(color))
bbcode_text = "[center]"
bbcode_text += "[color=#" + color.to_html(false) + "]"
bbcode_text += current_target
bbcode_text += "[/color]"
bbcode_text += "[/center]"
# push_align(RichTextLabel.ALIGN_CENTER)
# push_color(color)
# append_bbcode(current_target)
# pop()
# pop()
update_size()