Анимация появления/исчезновения окна Imgui

santeera

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

Vespan

loneliness
Проверенный
2,101
1,633
хах,как раз работаю над этим
Вот что я сделал:
Lua:
require 'lib.moonloader'
render = require 'lib.render'
folder           = require 'folder'
memory           = require 'memory'
imgui            = require 'imgui'
sampev           = require 'lib.samp.events'
inicfg           = require 'inicfg'
encoding         = require("encoding")
encoding.default = 'CP1251'
u8 = encoding.UTF8

-- inicfg

-- imgui
local imgui_window = imgui.ImBool(false)
local imgui_window1 = imgui.ImBool(false)
local inputtext = imgui.ImBuffer(256)


local sw
local sh

a = false

alpha = 0.00

function main()

  if not isSampLoaded() and not isSampfuncsLoaded() then return end
  while not isSampAvailable() do wait(0) end 

  sampRegisterChatCommand('/test', function() imgui_window1.v = not imgui_window1.v end)
  sampRegisterChatCommand('/test_render', function(param) 

    RenderText.toggle()

end)

  -- sampRegisterChatCommand('/a', function() a = not a printStringNow(a and '1' or '0',1500) end)

  while true do wait(0)

    sw, sh = getScreenResolution()

    imgui.Process = imgui_window.v

    if imgui_window1.v then
        if alpha ~= 1.00 then alpha = alpha + 0.05 end
    else
        if alpha ~= 0.00 then alpha = alpha - 0.05 end

    end

    if (alpha > 1.00) then alpha = 1.00 end
    if (alpha < 0.00) then alpha = 0.00 end 

    if (alpha ~= 0.00) then imgui_window.v = true else imgui_window.v = false end 

 
  end
end

function imgui.OnDrawFrame()

  if imgui_window.v then
    imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
      imgui.SetNextWindowSize(imgui.ImVec2(200, 200), imgui.Cond.FirstUseEver)
      imgui.PushStyleVar(imgui.StyleVar.Alpha, alpha)
    imgui.Begin('1')


    imgui.End()
    imgui.PopStyleVar()
  end
end
Не работает брал тут тык
Оно работает,но только на одном имгуи окне,если попробуешь использовать больше одного имгуи окна то крашется скрипт

(прикрепил файлик один,может пригодится тебе :=-))) )
 

Вложения

  • NEW IMGUI_NOTF TEST.lua
    7.5 KB · Просмотры: 9