помогите интегрировать fAwesome6

dially

Новичок
Автор темы
14
1
Версия MoonLoader
.027.0-preview
добрые люди с бластхака, прошу вашей руки и помощи в добавлении. весь скрипт полное дерьмо и я это знаю, так как все делалось через чат гпт ибо я нечего толком не понимаю не в imgui и не в mimgui

гпт пытался интегрировать fAwesome6 но так у его нечего и не получилось. я хочу сделать иконки у кнопок, но с интеграцией проблемы. если скрипт увидит свое будущее, а именно выйдет сюда готовый, тот кто сможет помочь будет указан в авторах


код:
script_name("Arizona UI")
script_author("example")

local imgui = require 'mimgui'
local inicfg = require 'inicfg'
local fa = require 'fAwesome6'
local new = imgui.new

-- =========================================
-- CONFIG
-- =========================================
local config_path = "arizona_ui.ini"

local config = inicfg.load({
    main = {
        bind = 0x71,
        auto_open = false
    }
}, config_path)

inicfg.save(config, config_path)

----------------------------------------------
--THEME
--------------------------------------------
local Themes = {
    black = {
        text = imgui.ImVec4(0.9, 0.9, 0.9, 1),
        accent = imgui.ImVec4(0.8, 0.8, 0.8, 1)
    },

    red = {
        text = imgui.ImVec4(1.0, 0.7, 0.7, 1),
        accent = imgui.ImVec4(1.0, 0.3, 0.3, 1)
    },

    purple = {
        text = imgui.ImVec4(0.8, 0.6, 1.0, 1),
        accent = imgui.ImVec4(0.6, 0.3, 1.0, 1)
    }
}

local activeTheme = "black"
local theme = Themes[activeTheme]

function SetTheme(name)
    if Themes[name] then
        activeTheme = name
        theme = Themes[name]
    end
end
-- =========================================
-- STATE
-- =========================================
local menu = new.bool(false)
local bind_mode = new.bool(false)

local GAP = 5

-- 🔥 стартовая позиция (потом будет центрироваться)
local base_pos = imgui.ImVec2(300, 200)

local left_size  = imgui.ImVec2(175, 490)
local right_size = imgui.ImVec2(740, 490)

local active_tab = 1

local window_flags =
    imgui.WindowFlags.NoCollapse +
    imgui.WindowFlags.NoResize +
    imgui.WindowFlags.NoTitleBar

local centered = false

-- =========================================
-- MAIN
-- =========================================
function main()
    repeat wait(0) until isSampAvailable()

    if config.main.auto_open then
        menu[0] = true
    end

    sampRegisterChatCommand("menu", function()
        menu[0] = not menu[0]
    end)

    while true do
        wait(0)

        if not bind_mode[0] and isKeyJustPressed(config.main.bind) then
            menu[0] = not menu[0]
        end

        if bind_mode[0] then
            for i = 0, 255 do
                if isKeyJustPressed(i) then
                    config.main.bind = i
                    inicfg.save(config, config_path)
                    bind_mode[0] = false
                end
            end
        end
    end
end

-- =========================================
-- RENDER
-- =========================================
imgui.OnFrame(
    function()
        return menu[0]
    end,
    function()

        local io = imgui.GetIO()

        -- 🔥 ЦЕНТРОВКА ПРИ ПЕРВОМ ОТКРЫТИИ
        if not centered then
            local total_w = left_size.x + right_size.x + GAP
            local total_h = math.max(left_size.y, right_size.y)

            base_pos = imgui.ImVec2(
                (io.DisplaySize.x - total_w) / 2,
                (io.DisplaySize.y - total_h) / 2
            )

            centered = true
        end

        local left_hover = false
        local right_hover = false

-- =====================================================
-- LEFT WINDOW
-- =====================================================

local style = imgui.GetStyle()
style.FrameRounding = 12.0

local left_hover = false

-- 🔥 КНОПКА С GLOW + ACTIVE STATE
local function TabButton(label, id)
    local isActive = (active_tab == id)

    local draw = imgui.GetWindowDrawList()
    local pos = imgui.GetCursorScreenPos()
    local size = imgui.ImVec2(158, 80)

    -- hover проверка
    local hovered = imgui.IsMouseHoveringRect(
        pos,
        imgui.ImVec2(pos.x + size.x, pos.y + size.y)
    )

    -- 🔵 glow (усиление при hover + активной вкладке)
    local glowAlpha = 0.12
    if hovered then glowAlpha = 0.25 end
    if isActive then glowAlpha = 0.35 end

    draw:AddRectFilled(
        imgui.ImVec2(pos.x - 1, pos.y - 1),
        imgui.ImVec2(pos.x + size.x + 1, pos.y + size.y + 1),
        imgui.GetColorU32Vec4(imgui.ImVec4(0.6, 0.3, 1.0, glowAlpha)),
        12
    )

    -- 🎨 цвета кнопки
    if isActive then
        imgui.PushStyleColor(imgui.Col.Button, imgui.ImVec4(0.6, 0.3, 1.0, 1.0))
        imgui.PushStyleColor(imgui.Col.ButtonHovered, imgui.ImVec4(0.65, 0.35, 1.0, 1.0))
        imgui.PushStyleColor(imgui.Col.ButtonActive, imgui.ImVec4(0.5, 0.2, 0.9, 1.0))
    else
        imgui.PushStyleColor(imgui.Col.Button, imgui.ImVec4(0.15, 0.15, 0.15, 1.0))
        imgui.PushStyleColor(imgui.Col.ButtonHovered, imgui.ImVec4(0.25, 0.25, 0.25, 1.0))
        imgui.PushStyleColor(imgui.Col.ButtonActive, imgui.ImVec4(0.10, 0.10, 0.10, 1.0))
    end

    local clicked = imgui.Button(label, size)

    imgui.PopStyleColor(3)

    if clicked then
        active_tab = id
    end
end

-- =====================================================
-- WINDOW
-- =====================================================
imgui.SetNextWindowSize(left_size, imgui.Cond.Always)
imgui.SetNextWindowPos(base_pos, imgui.Cond.Always)

imgui.Begin("Left", nil, window_flags)

imgui.SetCursorPosY(10)
TabButton('Основное', 1)

imgui.SetCursorPosY(100)
TabButton('Биндер', 2)

imgui.SetCursorPosY(190)
TabButton('Хелпер', 3)

imgui.SetCursorPosY(280)
TabButton('FPS UP', 4)

imgui.SetCursorPosY(370)
TabButton('Настройки', 5)

imgui.SetCursorPosY(460)
CenterTextDisabled("1.0")

left_hover = imgui.IsWindowHovered()
imgui.End()
-- =====================================================
 -- RIGHT WINDOW
-- =====================================================
        local right_pos = imgui.ImVec2(
            base_pos.x + left_size.x + GAP,
            base_pos.y
        )

        imgui.SetNextWindowSize(right_size, imgui.Cond.Always)
        imgui.SetNextWindowPos(right_pos, imgui.Cond.Always)

        imgui.Begin("Right", nil, window_flags)

        right_hover = imgui.IsWindowHovered()

        if active_tab == 1 then
            imgui.Text("MAIN TAB")
            
            
            
            
            
        elseif active_tab == 2 then
            imgui.Text("INFO TAB")
            
            
            
            
            
        elseif active_tab == 3 then
        imgui.Text("EXTRA TAB")
        
        
        
        
        
        elseif active_tab == 4 then
        imgui.Text("helper TAB")
        
        
        
        
        
        
        
        
        elseif active_tab == 5 then
            imgui.Text("SETTINGS")
            imgui.Text("Bind: " .. config.main.bind)

            if not bind_mode[0] then
                if imgui.Button("Change bind") then
                    bind_mode[0] = true
                end
            else
                imgui.Text("Press key...")
            end
            imgui.Text("Themes:")
            imgui.Separator()

            if imgui.Button("Black") then
            SetTheme("black")
            end

            if imgui.Button("Red") then
            SetTheme("red")
            end

            if imgui.Button("Purple") then
            SetTheme("purple")
            end
            imgui.TextColored(theme.text, "Hello UI")
            imgui.TextColored(theme.accent, "Accent text")
        end

        imgui.End()

        -- =====================================================
        -- DRAG ВСЕЙ СИСТЕМЫ
        -- =====================================================
        if (left_hover or right_hover) and imgui.IsMouseDragging(0) then
            base_pos.x = base_pos.x + io.MouseDelta.x
            base_pos.y = base_pos.y + io.MouseDelta.y
        end

    end
)

-- =========================================
-- ESC
-- =========================================
addEventHandler('onWindowMessage', function(msg, wparam)
    if wparam == 27 and menu[0] then
        if msg == 0x0100 then
            consumeWindowMessage(true, false)
        end
        if msg == 0x0101 then
            menu[0] = false
        end
    end
end)


imgui.OnInitialize(function()
    imgui.GetIO().IniFilename = nil

    local style = imgui.GetStyle()
    local c = style.Colors

    -- 🔥 СЕРЫЙ ФОН МЕНЮ (основное окно)
    c[imgui.Col.WindowBg] = imgui.ImVec4(0.15, 0.15, 0.15, 1.00)
end)



function RoundedButton(label, size, rounding)
    rounding = rounding or 8.0

    imgui.PushStyleVar(imgui.StyleVar.FrameRounding, rounding)

    local clicked = imgui.Button(label, size)

    imgui.PopStyleVar()

    return clicked
end

function CenterTextDisabled(text)
    imgui.SetCursorPosX((imgui.GetWindowWidth() - imgui.CalcTextSize(text).x) / 2)
    imgui.TextDisabled(text)
end

function GlowButton(label, size, baseColor, glowColor)
    local draw = imgui.GetWindowDrawList()
    local pos = imgui.GetCursorScreenPos()
    local rounding = 8

    local hovered = imgui.IsMouseHoveringRect(pos, imgui.ImVec2(pos.x + size.x, pos.y + size.y))

    -- 🔥 сила свечения (усиливается при наведении)
    local alpha = hovered and 0.35 or 0.15

    -- 🔵 glow фон (ореол)
    draw:AddRectFilled(
        imgui.ImVec2(pos.x - 2, pos.y - 2),
        imgui.ImVec2(pos.x + size.x + 2, pos.y + size.y + 2),
        imgui.GetColorU32Vec4(imgui.ImVec4(glowColor.x, glowColor.y, glowColor.z, alpha)),
        roundingф
    )

    -- кнопка
    imgui.PushStyleColor(imgui.Col.Button, baseColor)
    imgui.PushStyleColor(imgui.Col.ButtonHovered, baseColor)
    imgui.PushStyleColor(imgui.Col.ButtonActive, baseColor)

    local clicked = imgui.Button(label, size)

    imgui.PopStyleColor(3)

    return clicked
end
 

minxty

Известный
1,267
1,149
у тебя тут пиздец какой то а не скрипт, по хорошему тут только все переписать с нуля без ии