local tooltipFadeSpeed = 0.02
local tooltipStates = {}
function imgui.TextQuestion(id, text)
tooltipStates[id] = tooltipStates[id] or { alpha = 0.0 }
local tooltipState = tooltipStates[id]
imgui.TextDisabled("(?)")
if imgui.IsItemHovered() then
if tooltipState.alpha < 1.0 then
tooltipState.alpha = math.min(tooltipState.alpha + tooltipFadeSpeed, 1.0)
end
else
if tooltipState.alpha > 0.0 then
tooltipState.alpha = math.max(tooltipState.alpha - tooltipFadeSpeed, 0.0)
end
end
if tooltipState.alpha > 0.0 then
imgui.BeginTooltip()
imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(1.0, 1.0, 1.0, tooltipState.alpha))
imgui.PushTextWrapPos(450)
imgui.TextUnformatted(text)
imgui.PopTextWrapPos()
imgui.PopStyleColor()
imgui.EndTooltip()
end
end
--mimgui
imgui.TextQuestion("#1", "Hello, World")
imgui.TextQuestion("#2", "Hello, Everybody")
imgui.TextQuestion("#3", "Hello, Dewize")