I felt like there where a couple of issues with the way the Tooltip functionality was implemented:
The tooltip is drawn immediately after the control and, in a tight panel of controls, this space can be later occupied by another control, thus hiding the tooltip
Every time the tooltps string were added with GuiSetTooltip(my_tooltip_string) before a control they had to be reset with another call to GuiSetTooltip(NULL) with NULL as argument.
This change aims at fixing both.
Point 1:
Now during a frame the guiTooltipDrawPtr and guiTooltipDrawRec are modified in case a tooltip should activate and at the end of the frame (or whenever the user wants) the tooltip can be drawn by calling GuiTooltip(), now taking no arguments and being exposed to the users.
Point 2:
The guiTooltipPtr is reset at the end of the controls that allow it. This eliminates te verbosity of calling GuiSetTooltip(NULL) after every control.
I tried to be consistent with the naming and the comments, let me know if anything else should change. This will be a breaking change for tooltips, there are no examples using them so maybe we could add one as well. Let me know. I will definitely use my implementation in my projects.
@AndreaBoroni I'm afraid this redesign is a breaking change and it would break all the codebases using previous implementation, including all my tools. I'm not merging it.
I felt like there where a couple of issues with the way the Tooltip functionality was implemented:
GuiSetTooltip(my_tooltip_string)
before a control they had to be reset with another call toGuiSetTooltip(NULL)
withNULL
as argument.This change aims at fixing both.
Point 1: Now during a frame the
guiTooltipDrawPtr
andguiTooltipDrawRec
are modified in case a tooltip should activate and at the end of the frame (or whenever the user wants) the tooltip can be drawn by callingGuiTooltip()
, now taking no arguments and being exposed to the users.Point 2: The
guiTooltipPtr
is reset at the end of the controls that allow it. This eliminates te verbosity of callingGuiSetTooltip(NULL)
after every control.I tried to be consistent with the naming and the comments, let me know if anything else should change. This will be a breaking change for tooltips, there are no examples using them so maybe we could add one as well. Let me know. I will definitely use my implementation in my projects.