ESCTooltip
Extends: RichTextLabel
Description
Dynamically controlled tooltip
Constants
MAX_WIDTH
const MAX_WIDTH = 200
Maximum width of the label
MIN_HEIGHT
const MIN_HEIGHT = 30
Minimum height of the label
MAX_HEIGHT
const MAX_HEIGHT = 500
Maximum height of the label
ONE_LINE_HEIGHT
const ONE_LINE_HEIGHT = 16
Height of one line in the label
Members
color
var color: Color
Color of the label
offset_from_cursor
var offset_from_cursor: Vector2
Vector2 defining the offset from the cursor
debug_mode
var debug_mode: bool
Activates debug mode. If enabled, shows the label with a white background.
current_action
var current_action: String
Infinitive verb
current_target
var current_target: String
Target item/hotspot
current_prep
var current_prep: String
Preposition: on, with…
current_target2
var current_target2: String
Target 2 item/hotspot
waiting_for_target2
var waiting_for_target2: Variant
True if tooltip is waiting for a click on second target (use x with y)
debug_texturerect_node
var debug_texturerect_node: TextureRect
Node containing the debug white background
Methods
set_color
func set_color(p_color: Color) -> void
Set the color of the label
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
p_color |
|
the color to set the label |
yes |
Returns
Returns nothing.
set_debug_mode
func set_debug_mode(p_debug_mode: bool) -> void
Enable/disable debug mode of the label. If enabled, the label is displayed with a white background.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
p_debug_mode |
|
if true, enable debug mode. False to disable |
yes |
Returns
Returns nothing.
set_target
func set_target(target: String, needs_second_target: bool) -> void
Set the first target of the label. #### Parameters
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
target |
|
String the target to add to the label |
yes |
needs_second_target |
|
if true, the label will prepare for a second target |
no |
Returns
Returns nothing.
set_target2
func set_target2(target2: String) -> void
Set the second target of the label #### Parameters
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
target2 |
|
String the second target to add to the label |
yes |
Returns
Returns nothing.
update_tooltip_text
func update_tooltip_text() -> void
Update the tooltip text.
Parameters
None.
Returns
Returns nothing.
update_size
func update_size() -> void
Update the tooltip size according to the text.
Parameters
None.
Returns
Returns nothing.
tooltip_distance_to_edge_top
func tooltip_distance_to_edge_top(position: Vector2) -> Variant
Return the tooltip distance to top edge. #### Parameters
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
position |
|
the position to test |
yes |
Returns
Returns nothing.
tooltip_distance_to_edge_bottom
func tooltip_distance_to_edge_bottom(position: Vector2) -> Variant
Return the tooltip distance to bottom edge. #### Parameters
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
position |
|
the position to test |
yes |
Returns
Returns nothing.
tooltip_distance_to_edge_left
func tooltip_distance_to_edge_left(position: Vector2) -> Variant
Return the tooltip distance to left edge. #### Parameters
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
position |
|
the position to test |
yes |
Returns
Returns nothing.
tooltip_distance_to_edge_right
func tooltip_distance_to_edge_right(position: Vector2) -> Variant
Return the tooltip distance to right edge. #### Parameters
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
position |
|
the position to test Return* The distance to the edge. |
yes |
Returns
Returns nothing.
clear
func clear() -> void
Clear the tooltip targets texts
Parameters
None.
Returns
Returns nothing.