"Вкладки" в ImGui

corruptmemory

Участник
Автор темы
74
25
Версия MoonLoader
.026-beta
Мужики, як сделать типо вкладок в ImGui? То есть при нажатии на кнопку #1 появляется например текст "poka world", а при нажатии на кнопку #2 текст "poka world" пропадает и появляется текст "privet world"
 
Последнее редактирование:

Fott

Простреленный
3,468
2,392
Как пример
Lua:
function imgui.OnDrawFrame()
    imgui.ShowCursor = main_window_state.v
    imgui.SetNextWindowPos(imgui.ImVec2(ScreenX / 2 , ScreenY / 2), imgui.Cond.FirsUseEver, imgui.ImVec2(0.5, 0.5))
    imgui.SetNextWindowSize(imgui.ImVec2(449, 320), imgui.Cond.FirstUseEver)
    imgui.Begin(u8"test", main_window_state, imgui.WindowFlags.NoCollapse)
        if imgui.Button('One', (imgui.ImVec2(100, 50))) then
             active = true
            active1 = false
            active2 = false
        end
        if imgui.Button('Two', (imgui.ImVec2(100, 50))) then
            active = false
            active1 = true
            active2 = false
        end
        if imgui.Button('Three', (imgui.ImVec2(100, 50))) then
            active = false
            active1 = false
            active2 = true
        end
        if active then
        imgui.BeginChild('text', imgui.ImVec2(100 , 100))
        imgui.Text('test')
        imgui.EndChild()
    end
    if active1 then
        imgui.BeginChild('text1', imgui.ImVec2(100 , 100))
        imgui.Text('test1')
        imgui.EndChild()
    end
    if active2 then
        imgui.BeginChild('text2', imgui.ImVec2(100 , 100))
        imgui.Text('test2')
        imgui.EndChild()
    end
    imgui.End()
end
 

Myradov|

Известный
361
106
твой способ практически идентичен моему, не знаю почему ТС считает что говнокодить лучше чем сделать нормально
Это и не мой способ, этот способ я увидел у D.Kopnev в его коин мастере