Плавное меню

santeera

Участник
Автор темы
52
2
Версия MoonLoader
.027.0-preview
Почему меню не работает брал код тут


lua:
function imgui.OnDrawFrame()
    if main_window.v then
       if main_window.alpha > 0.00 then
        local sw, sh = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(800, 400), imgui.Cond.FirstUseEver)
        imgui.Begin(' ', nil, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize)
        imgui.SetCursorPos(imgui.ImVec2(5, 25))
        PaintTrigger()
        PaintAim()
        imgui.End()
    end
end
end
function switch()
    while true do
        wait(0)
  while true do
    
        imgui.Process = (main_window.alpha > 0.00) or (info.alpha > 0.00)
        imgui.ShowCursor = main_window.state or info.state
        if isKeyJustPressed(114) then
            main_window.v = not main_window.v
        end
    end
end

local main_window = { state = false, duration = 0.5 }
setmetatable(main_window, ui_meta)

local ui_meta = {
    __index = function(self, v)
        if v == "switch" then
            local switch = function()
                if self.process and self.process:status() ~= "dead" then
                    return false
                end
                self.timer = os.clock()
                self.state = not self.state

                self.process = lua_thread.create(function()
                    local bringFloatTo = function(from, to, start_time, duration)
                        local timer = os.clock() - start_time
                        if timer >= 0.00 and timer <= duration then
                            local count = timer / (duration / 100)
                            return count * ((to - from) / 100)
                        end
                        return (timer > duration) and to or from
                    end

                    while true do wait(0)
                        local a = bringFloatTo(0.00, 1.00, self.timer, self.duration)
                        self.alpha = self.state and a or 1.00 - a
                        if a == 1.00 then break end
                    end
                end)
                return true
            end
            return switch
        end
 
        if v == "alpha" then
            return self.state and 1.00 or 0.00
        end
    end
}