if imgui.Button('Hello') then
sampAddChatMessage('Hello')
else
imgui.Hint('Hello')
end
function imgui.Hint(text, delay, action)
if imgui.IsItemHovered() then
if go_hint == nil then go_hint = os.clock() + (delay and delay or 0.0) end
local alpha = (os.clock() - go_hint) * 5 -- скорость появления
if os.clock() >= go_hint then
imgui.PushStyleVar(imgui.StyleVar.WindowPadding, imgui.ImVec2(10, 10))
imgui.PushStyleVar(imgui.StyleVar.Alpha, (alpha <= 1.0 and alpha or 1.0))
imgui.PushStyleColor(imgui.Col.PopupBg, imgui.GetStyle().Colors[imgui.Col.PopupBg])
imgui.BeginTooltip()
imgui.PushTextWrapPos(700)
imgui.TextColored(imgui.GetStyle().Colors[imgui.Col.ButtonActive], u8' Подсказка:')
imgui.TextUnformatted(text)
if action ~= nil then
imgui.TextColored(imgui.GetStyle().Colors[imgui.Col.TextDisabled], '\n '..action)
end
if not imgui.IsItemVisible() and imgui.GetStyle().Alpha == 1.0 then go_hint = nil end
imgui.PopTextWrapPos()
imgui.EndTooltip()
imgui.PopStyleColor()
imgui.PopStyleVar(2)
end
end
end