local imgui = require 'mimgui'
local faicons = require('fAwesome6')
local WinState = imgui.new.bool(true)
local currentTab = 1
local icons = {faicons("FACE_SMILE_TEAR"), faicons("FACE_SMILE_HEARTS"), faicons("FACE_SMILE_HORNS")}
imgui.OnFrame(function() return WinState[0] end, function()
imgui.SetNextWindowPos(imgui.ImVec2(500,500), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(250,300), imgui.Cond.FirstUseEver)
imgui.Begin('##Window', WinState)
for i = 1, 3 do
if imgui.PageButton(currentTab == i, icons[i], "Tab #"..i) then
currentTab = i
end
end
imgui.End()
end)
imgui.OnInitialize(function()
imgui.GetIO().IniFilename = nil
local config = imgui.ImFontConfig()
config.MergeMode = true
config.PixelSnapH = true
iconRanges = imgui.new.ImWchar[3](faicons.min_range, faicons.max_range, 0)
imgui.GetIO().Fonts:AddFontFromMemoryCompressedBase85TTF(faicons.get_font_data_base85('solid'), 14, config, iconRanges)
end)
local AI_PAGE = {}
imgui.PageButton = function(bool, icon, name, but_wide)
but_wide = but_wide or 190
local duration = 0.25
local DL = imgui.GetWindowDrawList()
local p1 = imgui.GetCursorScreenPos()
local p2 = imgui.GetCursorPos()
local col = imgui.GetStyle().Colors[imgui.Col.ButtonActive]
if not AI_PAGE[name] then
AI_PAGE[name] = { clock = nil }
end
local pool = AI_PAGE[name]
imgui.PushStyleColor(imgui.Col.Button, imgui.ImVec4(0.00, 0.00, 0.00, 0.00))
imgui.PushStyleColor(imgui.Col.ButtonHovered, imgui.ImVec4(0.00, 0.00, 0.00, 0.00))
imgui.PushStyleColor(imgui.Col.ButtonActive, imgui.ImVec4(0.00, 0.00, 0.00, 0.00))
local result = imgui.InvisibleButton(name, imgui.ImVec2(but_wide, 35))
if result and not bool then
pool.clock = os.clock()
end
local pressed = imgui.IsItemActive()
imgui.PopStyleColor(3)
if bool then
if pool.clock and (os.clock() - pool.clock) < duration then
local wide = (os.clock() - pool.clock) * (but_wide / duration)
DL:AddRectFilled(imgui.ImVec2(p1.x, p1.y), imgui.ImVec2((p1.x + 190) - wide, p1.y + 35), 0x10FFFFFF, 15, 10)
DL:AddRectFilled(imgui.ImVec2(p1.x, p1.y), imgui.ImVec2(p1.x + 5, p1.y + 35), imgui.ColorConvertFloat4ToU32(col))
DL:AddRectFilled(imgui.ImVec2(p1.x, p1.y), imgui.ImVec2(p1.x + wide, p1.y + 35), imgui.ColorConvertFloat4ToU32(imgui.ImVec4(col.x, col.y, col.z, 0.6)), 15, 10)
else
DL:AddRectFilled(imgui.ImVec2(p1.x, (pressed and p1.y + 3 or p1.y)), imgui.ImVec2(p1.x + 5, (pressed and p1.y + 32 or p1.y + 35)), imgui.ColorConvertFloat4ToU32(col))
DL:AddRectFilled(imgui.ImVec2(p1.x, p1.y), imgui.ImVec2(p1.x + 190, p1.y + 35), imgui.ColorConvertFloat4ToU32(imgui.ImVec4(col.x, col.y, col.z, 0.6)), 15, 10)
end
else
if imgui.IsItemHovered() then
DL:AddRectFilled(imgui.ImVec2(p1.x, p1.y), imgui.ImVec2(p1.x + 190, p1.y + 35), 0x10FFFFFF, 15, 10)
end
end
imgui.SameLine(10); imgui.SetCursorPosY(p2.y + 8)
if bool then
imgui.Text((' '):rep(3) .. icon)
imgui.SameLine(60)
imgui.Text(name)
else
imgui.TextColored(imgui.ImVec4(0.60, 0.60, 0.60, 1.00), (' '):rep(3) .. icon)
imgui.SameLine(60)
imgui.TextColored(imgui.ImVec4(0.60, 0.60, 0.60, 1.00), name)
end
imgui.SetCursorPosY(p2.y + 40)
return result
end