Tooltip
namespace Griff.Scenes;
public sealed class Tooltip : ComponentSays something about the entity while the mouse rests on it: after Delay it shows Value in a box by the cursor, pinned to the screen, or writes it into the Text named in Into (an info line on the HUD). Works on anything: a sprite in the world, a button, a card on the HUD. Only the topmost one under the mouse shows, and what’s on the screen comes before the world. A script sets Value to change what it says, or it shows an Output, as a Text does.
This is a component: its saved properties are on its component page.
Properties
Section titled “Properties”public Vector2 Area { get; set; }The part of the entity the mouse hovers, in world units before the transform’s scale, centered on it. Zero is the entity’s own: its button’s area, else its collider, else its sprite.
Background
Section titled “Background”public Color Background { get; set; }The color behind them; fully transparent draws no box.
public Color Color { get; set; }The color of the box’s letters.
public float Delay { get; set; }Seconds the mouse rests on the entity before it shows (real time, so it works in a pause menu too).
public string? Font { get; set; }A font file relative to Assets, as a Text’s Font; empty uses the built-in font.
HoveredFor
Section titled “HoveredFor”public float HoveredFor { get; }How long the mouse has rested on it, in seconds of real time; 0 while it isn’t hovered.
public string? Into { get; set; }A Text to write it into instead of a box by the cursor, by name, e.g. “Hover Info”. While it shows, the text says it; after, the text says what it said before.
IsHovered
Section titled “IsHovered”public bool IsHovered { get; }True while the mouse is over the entity (and it’s the topmost tooltip there).
IsShowing
Section titled “IsShowing”public bool IsShowing { get; }True while it shows: hovered for its Delay.
Offset
Section titled “Offset”public Vector2 Offset { get; set; }Where the box’s top-left corner sits from the cursor, in world units; right and up are positive. Near the edge of the screen it goes to the other side of the cursor instead.
Output
Section titled “Output”public string? Output { get; set; }Show an output: what it gives now (see component_describe’s Outputs), e.g. a deck’s “Count” or a faction’s “Amount:Gold”. Value is then how it reads, with {0} for the output and {1} what it’s out of, e.g. “{0} / {1} cards”; a Value without them shows just the output.
public string? Shown { get; }What it says now: Value, with its Output and input prompts (“{Interact}”) filled in while it’s hovered in the game.
public float Size { get; set; }Height of a line of the box’s text, in world units, as a Text’s Size on the HUD.
public string? Track { get; set; }An entity whose Output it shows, by name, e.g. “Board”. Empty is this entity, or the nearest one it’s inside with that output.
public string? Value { get; set; }What it says. Several lines are fine. With an Output, how that reads (“{0} cards”). An action’s name in braces becomes the key or button that does it, as in a Text: “Key: {OpenWork}” reads “Key: K”, and follows the device being played with and the player’s own bindings.
public float Width { get; set; }Lines wider than this (world units) break between words; 0 never breaks them.
Methods
Section titled “Methods”LinkLabel
Section titled “LinkLabel”public override string? LinkLabel(string property)