BeginChild

Citrys

Участник
Автор темы
178
5
Версия MoonLoader
Другое
что делать если BeginChild сдвигает кнокпи?
Lua:
        if imgui.Button('Режимы', imgui.ImVec2(70, 40)) then
            bool = true
            bool2 = false
            bool3 = false
        end

                if imgui.IsItemHovered() then
                    imgui.BeginTooltip()
                    imgui.Text('Выбрать режим на котором можно поиграть')
                    imgui.EndTooltip()
                end

        imgui.SameLine()
        imgui.BeginChild("ChildWindow", imgui.ImVec2(150,-1), true)

            if bool then
                imgui.Button('DM', imgui.ImVec2(50, 20))
                imgui.Button('GW', imgui.ImVec2(50, 20))
                imgui.Button('AC', imgui.ImVec2(50, 20))
            end

        imgui.EndChild()




        if imgui.Button('Команды', imgui.ImVec2(70, 40)) then
            bool = false
            bool2 = true
            bool3 = false
        end
                if imgui.IsItemHovered() then
                    imgui.BeginTooltip()
                    imgui.Text('Быстрыи команды')
                    imgui.EndTooltip()
                end

            if bool2 then
                imgui.Text('Hi')
            end


        if imgui.Button('Репорт', imgui.ImVec2(70, 40)) then
            bool = false
            bool2 = false
            bool3 = true
        end

                if imgui.IsItemHovered() then
                    imgui.BeginTooltip()
                    imgui.Text('можно быстро отправить репорт')
                    imgui.EndTooltip()
                end

            if bool3 then
                imgui.Button('hi77564')

            end
 

Rice.

Известный
Модератор
1,695
1,462
что делать если BeginChild сдвигает кнокпи?
Lua:
        if imgui.Button('Режимы', imgui.ImVec2(70, 40)) then
            bool = true
            bool2 = false
            bool3 = false
        end

                if imgui.IsItemHovered() then
                    imgui.BeginTooltip()
                    imgui.Text('Выбрать режим на котором можно поиграть')
                    imgui.EndTooltip()
                end

        imgui.SameLine()
        imgui.BeginChild("ChildWindow", imgui.ImVec2(150,-1), true)

            if bool then
                imgui.Button('DM', imgui.ImVec2(50, 20))
                imgui.Button('GW', imgui.ImVec2(50, 20))
                imgui.Button('AC', imgui.ImVec2(50, 20))
            end

        imgui.EndChild()




        if imgui.Button('Команды', imgui.ImVec2(70, 40)) then
            bool = false
            bool2 = true
            bool3 = false
        end
                if imgui.IsItemHovered() then
                    imgui.BeginTooltip()
                    imgui.Text('Быстрыи команды')
                    imgui.EndTooltip()
                end

            if bool2 then
                imgui.Text('Hi')
            end


        if imgui.Button('Репорт', imgui.ImVec2(70, 40)) then
            bool = false
            bool2 = false
            bool3 = true
        end

                if imgui.IsItemHovered() then
                    imgui.BeginTooltip()
                    imgui.Text('можно быстро отправить репорт')
                    imgui.EndTooltip()
                end

            if bool3 then
                imgui.Button('hi77564')

            end
Скинь весь скрипт.
 

whyhardlyz

Известный
120
89
что делать если BeginChild сдвигает кнокпи?
Lua:
        if imgui.Button('Режимы', imgui.ImVec2(70, 40)) then
            bool = true
            bool2 = false
            bool3 = false
        end

                if imgui.IsItemHovered() then
                    imgui.BeginTooltip()
                    imgui.Text('Выбрать режим на котором можно поиграть')
                    imgui.EndTooltip()
                end

        imgui.SameLine()
        imgui.BeginChild("ChildWindow", imgui.ImVec2(150,-1), true)

            if bool then
                imgui.Button('DM', imgui.ImVec2(50, 20))
                imgui.Button('GW', imgui.ImVec2(50, 20))
                imgui.Button('AC', imgui.ImVec2(50, 20))
            end

        imgui.EndChild()




        if imgui.Button('Команды', imgui.ImVec2(70, 40)) then
            bool = false
            bool2 = true
            bool3 = false
        end
                if imgui.IsItemHovered() then
                    imgui.BeginTooltip()
                    imgui.Text('Быстрыи команды')
                    imgui.EndTooltip()
                end

            if bool2 then
                imgui.Text('Hi')
            end


        if imgui.Button('Репорт', imgui.ImVec2(70, 40)) then
            bool = false
            bool2 = false
            bool3 = true
        end

                if imgui.IsItemHovered() then
                    imgui.BeginTooltip()
                    imgui.Text('можно быстро отправить репорт')
                    imgui.EndTooltip()
                end

            if bool3 then
                imgui.Button('hi77564')

            end
Использовать SetCursorPos, прошу заметить что внутри BeginChild свои координаты (ImVec2(X, Y))
прим. на плюсах:
C++:
if (ImGui::Begin("##window", &window))
{

    ImGui::SetCursorPos(ImVec2(32,210.5)); // положение кнопки относительно всего окна
    ImGui::Button("Button outside Child", ImVec2(148,19));

    ImGui::SetCursorPos(ImVec2(182,160));
    ImGui::BeginChild(3, ImVec2(276,130), true);

    ImGui::SetCursorPos(ImVec2(17,50)); // положение относительно BeginChild
    ImGui::Button("Button inside Child", ImVec2(141,19));

    ImGui::EndChild();


    ImGui::End();
}

1643556293952.png