как сделать эффект выделенной вкладки mimgui?

askfmaskfaosflas

Потрачен
Автор темы
1,089
512
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Версия MoonLoader
.026-beta
эээээ кароч ээээ я тут недавно эээ на мимгуи перешёл да ээээээ....
карооооч как сделать эффект выделенной вкладки?

ээээ:
if imgui.Button('1') then tab = 1 end
и т.д
 

Vespan

loneliness
Проверенный
2,102
1,631
Lua:
function imgui.SelectableButton(label,bool,size)
    local b = false
    if bool == false then
        imgui.PushStyleColor(imgui.Col.Button,imgui.ImVec4(colors.button.v[1],colors.button.v[2],colors.button.v[3],colors.button.v[4]))
        imgui.PushStyleColor(imgui.Col.ButtonHovered,imgui.ImVec4(colors.button.v[1],colors.button.v[2],colors.button.v[3],colors.button.v[4]))
        imgui.PushStyleColor(imgui.Col.ButtonActive,imgui.ImVec4(colors.button.v[1],colors.button.v[2],colors.button.v[3],colors.button.v[4]))
    else
        imgui.PushStyleColor(imgui.Col.Button,imgui.ImVec4(colors.button.v[1],colors.button.v[2],colors.button.v[3],1))
        imgui.PushStyleColor(imgui.Col.ButtonHovered,imgui.ImVec4(colors.button.v[1],colors.button.v[2],colors.button.v[3],1))
        imgui.PushStyleColor(imgui.Col.ButtonActive,imgui.ImVec4(colors.button.v[1],colors.button.v[2],colors.button.v[3],1))
    end

   imgui.Button(label or 'nil;',size or imgui.ImVec2(0,0))

    if imgui.IsItemClicked() then
        b = true
    end

    imgui.PopStyleColor(3)

    return b
end
это имгуи,но суть думаю ясна.
Заменишь цвета в PushStyleColor на свои
 
  • Bug
Реакции: qdIbp

askfmaskfaosflas

Потрачен
Автор темы
1,089
512
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Lua:
function imgui.SelectableButton(label,bool,size)
    local b = false
    if bool == false then
        imgui.PushStyleColor(imgui.Col.Button,imgui.ImVec4(colors.button.v[1],colors.button.v[2],colors.button.v[3],colors.button.v[4]))
        imgui.PushStyleColor(imgui.Col.ButtonHovered,imgui.ImVec4(colors.button.v[1],colors.button.v[2],colors.button.v[3],colors.button.v[4]))
        imgui.PushStyleColor(imgui.Col.ButtonActive,imgui.ImVec4(colors.button.v[1],colors.button.v[2],colors.button.v[3],colors.button.v[4]))
    else
        imgui.PushStyleColor(imgui.Col.Button,imgui.ImVec4(colors.button.v[1],colors.button.v[2],colors.button.v[3],1))
        imgui.PushStyleColor(imgui.Col.ButtonHovered,imgui.ImVec4(colors.button.v[1],colors.button.v[2],colors.button.v[3],1))
        imgui.PushStyleColor(imgui.Col.ButtonActive,imgui.ImVec4(colors.button.v[1],colors.button.v[2],colors.button.v[3],1))
    end

   imgui.Button(label or 'nil;',size or imgui.ImVec2(0,0))

    if imgui.IsItemClicked() then
        b = true
    end

    imgui.PopStyleColor(3)

    return b
end
это имгуи,но суть думаю ясна.
я как бы не тупой и умею гуглить, дело в том, что данный вариант не принимает аргументы "text" и "imvec"