local imgui = require 'mimgui'
local sw, sh = 0, 0
imgui.OnInitialize(function()
imgui.GetIO().IniFilename = nil
sw, sh = getScreenResolution()
end)
imgui.OnFrame(function() return true end, function()
local dl = imgui.GetBackgroundDrawList()
local pos = imgui.ImVec2(sw / 2, sh / 2)
local radius = sh * 0.25
local glow_size = sh * 0.04
local clr = imgui.ImVec4(0x26 / 255, 0xB4 / 255, 0xC4 / 255, 0.5)
AddCircleWithInnerGlow(dl, pos, radius, glow_size, clr, 64, 3)
end)
function AddCircleWithInnerGlow(draw_list, pos, radius, glow_size, color, num_segments, thickness)
local function getDistance(p1, p2) return ((p2.x-p1.x)^2+(p2.y-p1.y)^2)^0.5 end
local glow_size = (glow_size >= radius) and radius - 0.01 or glow_size
local temp_alpha = color.w
local start = draw_list.VtxBuffer.Size
draw_list:AddCircle(pos, radius - glow_size / 2, 0xFFFFFFFF, num_segments, glow_size)
local _end = draw_list.VtxBuffer.Size
for idx = start, _end do
local distance = getDistance(pos, draw_list.VtxBuffer.Data[idx].pos)
if distance < radius - glow_size / 2 then
color.w = 0.01
draw_list.VtxBuffer.Data[idx].col = imgui.ColorConvertFloat4ToU32(color)
else
color.w = 0.2
draw_list.VtxBuffer.Data[idx].col = imgui.ColorConvertFloat4ToU32(color)
end
end
color.w = temp_alpha
draw_list:AddCircle(pos, radius, imgui.ColorConvertFloat4ToU32(color), num_segments, thickness)
end