Как открыть несколько окон imgui?

Статус
В этой теме нельзя размещать новые ответы.

Vlad44352

Потрачен
Автор темы
37
48
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Как сделать чтобы показывало несколько окон imgui?​
 
Решение
Второе окно создаётся так же, как и первое, но если тебе нужно, чтобы оно пропадало при закрытии основного, то делай таким способом.
Lua:
local mainWindow = imgui.ImBool()
local extraWindow = imgui.ImBool()

function main()
    while true do wait(0)
        if wasKeyPressed(VK_L) then mainWindow.v = not mainWindow.v end
        if wasKeyPressed(VK_K) then extraWindow.v = not extraWindow.v end
    end
end

function imgui.OnDrawFrame()
    if mainWindow.v then
        if imgui.Begin('Main Window', mainWindow) then
            -- ITEMS
            imgui.End()
        end
        if extraWindow.v then
            if imgui.Begin('Extra Window', extraWindow) then
                -- ITEMS
                imgui.End()
            end
        end...

Vlad44352

Потрачен
Автор темы
37
48
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
local show_two_menu = imgui.ImBool(false)

в main
sampRegisterChatCommand('test', function () show_two_menu.v = not show_two_menu.v end)
в OnDrawFrame
if show_two_menu.v then

end
Это показ обычного imgui окна, мне нужно чтобы открыть ещё 1 окно (не основное)
 

ImPasha

Software Developer & System Administrator
Друг
1,778
2,147
Второе окно создаётся так же, как и первое, но если тебе нужно, чтобы оно пропадало при закрытии основного, то делай таким способом.
Lua:
local mainWindow = imgui.ImBool()
local extraWindow = imgui.ImBool()

function main()
    while true do wait(0)
        if wasKeyPressed(VK_L) then mainWindow.v = not mainWindow.v end
        if wasKeyPressed(VK_K) then extraWindow.v = not extraWindow.v end
    end
end

function imgui.OnDrawFrame()
    if mainWindow.v then
        if imgui.Begin('Main Window', mainWindow) then
            -- ITEMS
            imgui.End()
        end
        if extraWindow.v then
            if imgui.Begin('Extra Window', extraWindow) then
                -- ITEMS
                imgui.End()
            end
        end
    end
end
 

abnomegd

Известный
377
45
Второе окно создаётся так же, как и первое, но если тебе нужно, чтобы оно пропадало при закрытии основного, то делай таким способом.
Lua:
local mainWindow = imgui.ImBool()
local extraWindow = imgui.ImBool()

function main()
    while true do wait(0)
        if wasKeyPressed(VK_L) then mainWindow.v = not mainWindow.v end
        if wasKeyPressed(VK_K) then extraWindow.v = not extraWindow.v end
    end
end

function imgui.OnDrawFrame()
    if mainWindow.v then
        if imgui.Begin('Main Window', mainWindow) then
            -- ITEMS
            imgui.End()
        end
        if extraWindow.v then
            if imgui.Begin('Extra Window', extraWindow) then
                -- ITEMS
                imgui.End()
            end
        end
    end
end
а как сделать так чтобы не пропадало?
 
Статус
В этой теме нельзя размещать новые ответы.