The tooltip system is now done! Although it requires some UI improvements, the functionality itself is complete.
Tooltip links are generated at startup by scanning the help text for any terms registered as tooltips already.
Example code:
void tooltip_register_defaults(void) {
// test
tooltip_register( (tooltip) { .name = "ASSET_WOOD", .content = "Used as a building material or fuel for the ASSET_FURNACE." } );
tooltip_register( (tooltip) { .name = "ASSET_FURNACE", .content = "Producer used to smelt ASSET_IRON_ORE into ASSET_IRON_INGOT." } );
tooltip_register( (tooltip) { .name = "ASSET_IRON_ORE", .content = "Natural resource that can be smelted in ASSET_FURNACE." } );
tooltip_register( (tooltip) { .name = "ASSET_IRON_INGOT", .content = "Used as a building material. It is smelted from ASSET_IRON_ORE" } );
}
As a user, you call:
tooltip_show("ASSET_FURNACE", mouse_pos.x+5, mouse_pos.y+5);
And the internals will draw a tooltip with references to other registered help texts in content.