Передвигается рамка при движении окна imgui

3211Marlon1123

Участник
Автор темы
135
13
Версия MoonLoader
.026-beta
Хай гайз, ай нид хелп. Я делаю скриптик. Проблема в том что когда я передвигаю окно imgui, вместе с ним внутри него передвигается рамка. Как фиксануть?
 
Решение
Lua:
function imgui.OnDrawFrame()

    imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
  imgui.SetNextWindowSize(imgui.ImVec2(xcoefficent * 720, ycoefficent * 480), imgui.Cond.FirstUseEver)
    imgui.Begin(u8'CautionFAM Helper', main_window_state)

    local draw_x, draw_y = imgui.GetCursorScreenPos().x, imgui.GetCursorScreenPos().y

    imgui.GetStyle().ButtonTextAlign = imgui.ImVec2(0.5, 0.5)

    --imgui.CenterText(u8"Настройки")

    --imgui.SetCursorPosX(275)
    imgui.BeginChild('MainChildWindow', imgui.ImVec2(xcoefficent * 180, ycoefficent * 450), true)
        if imgui.Button(fa.ICON_COGS .. u8' Настройки', imgui.ImVec2(xcoefficent * 173, ycoefficent * 50)) then...

Rice.

Известный
Модератор
1,753
1,660
Хай гайз, ай нид хелп. Я делаю скриптик. Проблема в том что когда я передвигаю окно imgui, вместе с ним внутри него передвигается рамка. Как фиксануть?
Скинь отдельно ссылку, видео недоступно
 

Rice.

Известный
Модератор
1,753
1,660
PyIRT.png

Возможно у тебя закрыто видео на канале?
 

3211Marlon1123

Участник
Автор темы
135
13
Увидел, теперь кидай код скрипта. Посмотрим что у тебя там.
Lua:
function imgui.OnDrawFrame()

    imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
  imgui.SetNextWindowSize(imgui.ImVec2(xcoefficent * 720, ycoefficent * 480), imgui.Cond.FirstUseEver)
    imgui.Begin(u8'CautionFAM Helper', main_window_state)

    local draw_x, draw_y = imgui.GetCursorScreenPos().x, imgui.GetCursorScreenPos().y

    imgui.GetStyle().ButtonTextAlign = imgui.ImVec2(0.5, 0.5)

    --imgui.CenterText(u8"Настройки")

    --imgui.SetCursorPosX(275)
    imgui.BeginChild('MainChildWindow', imgui.ImVec2(xcoefficent * 180, ycoefficent * 450), true)
        if imgui.Button(fa.ICON_COGS .. u8' Настройки', imgui.ImVec2(xcoefficent * 173, ycoefficent * 50)) then
            tab = 4
        end
        if imgui.Button(fa.ICON_FLOPPY_O .. u8' Сохранить настройки', imgui.ImVec2(xcoefficent * 173, ycoefficent * 50)) then
            save()
            --notify.addNotify(second_color_text .. '[CautionFAM]', 'Настройки успешно сохранены.', 2, 1, 3)
            notf('Настройки успешно сохранены.', 5, 1057)
        end
        --imgui.SameLine()
    imgui.EndChild()

    imgui.SetCursorPosX(xcoefficent * (draw_x - 294))
    imgui.SetCursorPosY(ycoefficent * (draw_y - 285))

    imgui.BeginChild('NastrChildWindow', imgui.ImVec2(xcoefficent * 520, ycoefficent * 450), true)
        if tab == 4 then
            imgui.SetCursorPosX(xcoefficent * 7)
            imgui.SetCursorPosY(ycoefficent * 7)

            if imgui.Combo(u8'Стиль меню', combo_select_themes, namecolorthemes, #namecolorthemes) then
                themecolor = combo_select_themes.v + 1
                setthemecolor(themecolor)
            end

            imgui.SetCursorPosX(xcoefficent * 7)
            imgui.SetCursorPosY(ycoefficent * (7+25))

            if imgui.Checkbox(u8'Закрывать меню на ESC', checked_status_closeonesc) then
                closeonesc = not closeonesc
            end

            imgui.SetCursorPosX(xcoefficent * 7)
            imgui.SetCursorPosY(ycoefficent * (7+2*25))

            imgui.Separator()

            imgui.SetCursorPosX(xcoefficent * 7)
            imgui.SetCursorPosY(ycoefficent * (7+2*25+5))

            if imgui.Checkbox(u8'Напоминания событий', checked_status_eventsochki) then
                eventsochki = not eventsochki
            end

            imgui.SameLine()

        imgui.TextQuestion(u8'Напоминания для игр (PUBG, казаки и т.п.).')

            imgui.SetCursorPosX(xcoefficent * 7)
            imgui.SetCursorPosY(ycoefficent * (7+3*25+5))

            if imgui.Checkbox(u8'AutoTask', checked_status_autotaketasks) then
                autotaketasks = not autotaketasks
            end

            imgui.SameLine()

            imgui.TextQuestion(u8'Автоматически в /tasks при первом спавне\nберёт все задания.\n\nПримечание! Т.к. на сервере есть\nанти-флуд система, не пишите\nникаких команд\nв течение 5-8 секунд\nво избежание проблем с работой скрипта.')

            imgui.SetCursorPosX(xcoefficent * 7)
            imgui.SetCursorPosY(ycoefficent * (7+4*25+5))

            if imgui.Checkbox(u8'AutoDeathPubg', checked_status_autodeathonpubg) then
                autodeathonpubg = not autodeathonpubg
            end

            imgui.SameLine()

            imgui.TextQuestion(u8'Автоматический выход из самолёта\n и смерть на PUBG.')
            --imgui.InputText(u8'Сюда нужно ввести текст', text_buffer)
            --x, y, z = getCharCoordinates(PLAYER_PED)
            --imgui.Text(u8('Позиция игрока: X: ' .. math.floor(x) .. ', Y: ' .. math.floor(y) .. ', Z: ' .. math.floor(z)))
            --if imgui.Button('Press me') then
                --sampAddChatMessage(u8:decode(text_buffer.v), main_color)
            --end
        end
    imgui.EndChild()

    imgui.End()
end

Размеры домножаю на x/y coefficent для норм отображения на других разрешениях. Переменные все прописаны в других разделах.
 

Rice.

Известный
Модератор
1,753
1,660
Lua:
function imgui.OnDrawFrame()

    imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
  imgui.SetNextWindowSize(imgui.ImVec2(xcoefficent * 720, ycoefficent * 480), imgui.Cond.FirstUseEver)
    imgui.Begin(u8'CautionFAM Helper', main_window_state)

    local draw_x, draw_y = imgui.GetCursorScreenPos().x, imgui.GetCursorScreenPos().y

    imgui.GetStyle().ButtonTextAlign = imgui.ImVec2(0.5, 0.5)

    --imgui.CenterText(u8"Настройки")

    --imgui.SetCursorPosX(275)
    imgui.BeginChild('MainChildWindow', imgui.ImVec2(xcoefficent * 180, ycoefficent * 450), true)
        if imgui.Button(fa.ICON_COGS .. u8' Настройки', imgui.ImVec2(xcoefficent * 173, ycoefficent * 50)) then
            tab = 4
        end
        if imgui.Button(fa.ICON_FLOPPY_O .. u8' Сохранить настройки', imgui.ImVec2(xcoefficent * 173, ycoefficent * 50)) then
            save()
            --notify.addNotify(second_color_text .. '[CautionFAM]', 'Настройки успешно сохранены.', 2, 1, 3)
            notf('Настройки успешно сохранены.', 5, 1057)
        end
        --imgui.SameLine()
    imgui.EndChild()

    imgui.SetCursorPosX(xcoefficent * (draw_x - 294))
    imgui.SetCursorPosY(ycoefficent * (draw_y - 285))

    imgui.BeginChild('NastrChildWindow', imgui.ImVec2(xcoefficent * 520, ycoefficent * 450), true)
        if tab == 4 then
            imgui.SetCursorPosX(xcoefficent * 7)
            imgui.SetCursorPosY(ycoefficent * 7)

            if imgui.Combo(u8'Стиль меню', combo_select_themes, namecolorthemes, #namecolorthemes) then
                themecolor = combo_select_themes.v + 1
                setthemecolor(themecolor)
            end

            imgui.SetCursorPosX(xcoefficent * 7)
            imgui.SetCursorPosY(ycoefficent * (7+25))

            if imgui.Checkbox(u8'Закрывать меню на ESC', checked_status_closeonesc) then
                closeonesc = not closeonesc
            end

            imgui.SetCursorPosX(xcoefficent * 7)
            imgui.SetCursorPosY(ycoefficent * (7+2*25))

            imgui.Separator()

            imgui.SetCursorPosX(xcoefficent * 7)
            imgui.SetCursorPosY(ycoefficent * (7+2*25+5))

            if imgui.Checkbox(u8'Напоминания событий', checked_status_eventsochki) then
                eventsochki = not eventsochki
            end

            imgui.SameLine()

        imgui.TextQuestion(u8'Напоминания для игр (PUBG, казаки и т.п.).')

            imgui.SetCursorPosX(xcoefficent * 7)
            imgui.SetCursorPosY(ycoefficent * (7+3*25+5))

            if imgui.Checkbox(u8'AutoTask', checked_status_autotaketasks) then
                autotaketasks = not autotaketasks
            end

            imgui.SameLine()

            imgui.TextQuestion(u8'Автоматически в /tasks при первом спавне\nберёт все задания.\n\nПримечание! Т.к. на сервере есть\nанти-флуд система, не пишите\nникаких команд\nв течение 5-8 секунд\nво избежание проблем с работой скрипта.')

            imgui.SetCursorPosX(xcoefficent * 7)
            imgui.SetCursorPosY(ycoefficent * (7+4*25+5))

            if imgui.Checkbox(u8'AutoDeathPubg', checked_status_autodeathonpubg) then
                autodeathonpubg = not autodeathonpubg
            end

            imgui.SameLine()

            imgui.TextQuestion(u8'Автоматический выход из самолёта\n и смерть на PUBG.')
            --imgui.InputText(u8'Сюда нужно ввести текст', text_buffer)
            --x, y, z = getCharCoordinates(PLAYER_PED)
            --imgui.Text(u8('Позиция игрока: X: ' .. math.floor(x) .. ', Y: ' .. math.floor(y) .. ', Z: ' .. math.floor(z)))
            --if imgui.Button('Press me') then
                --sampAddChatMessage(u8:decode(text_buffer.v), main_color)
            --end
        end
    imgui.EndChild()

    imgui.End()
end

Размеры домножаю на x/y coefficent для норм отображения на других разрешениях. Переменные все прописаны в других разделах.
Было бы классно, если бы ты скинул фулл скрипт. Чтобы нам не делать тут 2-ух страничную переписку.