Как открыть несколько окон 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 окно (не основное)
 

Pakulichev

Software Developer & System Administrator
Друг
1,789
2,133
Второе окно создаётся так же, как и первое, но если тебе нужно, чтобы оно пропадало при закрытии основного, то делай таким способом.
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

Активный
335
35
Второе окно создаётся так же, как и первое, но если тебе нужно, чтобы оно пропадало при закрытии основного, то делай таким способом.
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
а как сделать так чтобы не пропадало?
 

#Northn

Police Helper «Reborn» — уже ШЕСТЬ лет!
Всефорумный модератор
2,635
2,485
Статус
В этой теме нельзя размещать новые ответы.