- 213
- 18
- Версия MoonLoader
- .026-beta
здарова.
сделал такой кодик, который должен импортировать темы, но он нифига не работает.
помогите решить проблему.
сделал такой кодик, который должен импортировать темы, но он нифига не работает.
помогите решить проблему.
MIMGUI WINDOW:
local imgui = require 'mimgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local new = imgui.new
local renderWindow = new.bool(false)
local selectedTheme = new.int(0)
imgui.OnInitialize(function()
imgui.GetIO().IniFilename = nil
end)
local themes = import 'resource/themes.lua'
local newFrame = imgui.OnFrame(
function() return renderWindow[0] end,
function(player)
local resX, resY = getScreenResolution()
local sizeX, sizeY = 500, 300
imgui.SetNextWindowPos(imgui.ImVec2(resX / 2, resY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(sizeX, sizeY), imgui.Cond.FirstUseEver)
imgui.Begin('Main Window', renderWindow)
if imgui.Combo('Select Theme', selectedTheme, themes.colorThemes, #themes.colorThemes) then
themes.themes(selectedTheme[0] + 1)
end
imgui.End()
end
)
function main()
while not isSampAvailable() do wait(0) end
sampRegisterChatCommand('mim', function()
renderWindow[0] = not renderWindow[0]
end)
while true do
wait(0)
end
end
Themes.lua:
local imgui = require 'mimgui'
EXPORTS = {
colorThemes = {'Dark-grey','Purple'},
themes = function(theme)
local ImVec4 = imgui.ImVec4
local style = imgui.GetStyle()
local colors = style.Colors
style.WindowPadding = imgui.ImVec2(15, 15)
style.WindowRounding = 10.0
style.ChildRounding = 6.0
style.FramePadding = imgui.ImVec2(8, 7)
style.FrameRounding = 8.0
style.ItemSpacing = imgui.ImVec2(8, 8)
style.ItemInnerSpacing = imgui.ImVec2(10, 6)
style.IndentSpacing = 25.0
style.ScrollbarSize = 20
style.ScrollbarRounding = 12.0
style.GrabMinSize = 10.0
style.GrabRounding = 6.0
style.PopupRounding = 8
style.WindowTitleAlign = imgui.ImVec2(0.5, 0.5)
style.ButtonTextAlign = imgui.ImVec2(0.5, 0.5)
if theme == 1 or theme == nil then
style.Colors[imgui.Col.Text] = imgui.ImVec4(1.00, 1.00, 1.00, 1.00);
style.Colors[imgui.Col.TextDisabled] = imgui.ImVec4(0.50, 0.50, 0.50, 1.00);
style.Colors[imgui.Col.WindowBg] = imgui.ImVec4(0.09, 0.09, 0.09, 1.00);
style.Colors[imgui.Col.ChildBg] = imgui.ImVec4(0.13, 0.13, 0.13, 1.00);
style.Colors[imgui.Col.PopupBg] = imgui.ImVec4(0.12, 0.12, 0.12, 1.00);
style.Colors[imgui.Col.Border] = imgui.ImVec4(0.19, 0.19, 0.19, 1.00);
style.Colors[imgui.Col.BorderShadow] = imgui.ImVec4(0.00, 0.00, 0.00, 0.00);
style.Colors[imgui.Col.FrameBg] = imgui.ImVec4(0.08, 0.08, 0.08, 0.54);
style.Colors[imgui.Col.FrameBgHovered] = imgui.ImVec4(0.16, 0.16, 0.16, 0.54);
style.Colors[imgui.Col.FrameBgActive] = imgui.ImVec4(0.17, 0.17, 0.17, 0.54);
style.Colors[imgui.Col.TitleBg] = imgui.ImVec4(0.21, 0.21, 0.21, 1.00);
style.Colors[imgui.Col.TitleBgActive] = imgui.ImVec4(0.37, 0.37, 0.37, 1.00);
style.Colors[imgui.Col.TitleBgCollapsed] = imgui.ImVec4(0.00, 0.00, 0.00, 0.51);
style.Colors[imgui.Col.MenuBarBg] = imgui.ImVec4(0.14, 0.14, 0.14, 1.00);
style.Colors[imgui.Col.ScrollbarBg] = imgui.ImVec4(0.24, 0.24, 0.24, 1.00);
style.Colors[imgui.Col.ScrollbarGrab] = imgui.ImVec4(0.18, 0.18, 0.18, 1.00);
style.Colors[imgui.Col.ScrollbarGrabHovered] = imgui.ImVec4(0.18, 0.18, 0.18, 1.00);
style.Colors[imgui.Col.ScrollbarGrabActive] = imgui.ImVec4(0.36, 0.36, 0.36, 1.00);
style.Colors[imgui.Col.CheckMark] = imgui.ImVec4(1.00, 1.00, 1.00, 1.00);
style.Colors[imgui.Col.SliderGrab] = imgui.ImVec4(0.24, 0.24, 0.24, 1.00);
style.Colors[imgui.Col.SliderGrabActive] = imgui.ImVec4(0.37, 0.37, 0.37, 1.00);
style.Colors[imgui.Col.Button] = imgui.ImVec4(0.24, 0.24, 0.24, 1.00);
style.Colors[imgui.Col.ButtonHovered] = imgui.ImVec4(0.37, 0.37, 0.37, 1.00);
style.Colors[imgui.Col.ButtonActive] = imgui.ImVec4(0.37, 0.37, 0.37, 1.00);
style.Colors[imgui.Col.Header] = imgui.ImVec4(0.24, 0.24, 0.24, 1.00);
style.Colors[imgui.Col.HeaderHovered] = imgui.ImVec4(0.37, 0.37, 0.37, 1.00);
style.Colors[imgui.Col.HeaderActive] = imgui.ImVec4(0.37, 0.37, 0.37, 1.00);
style.Colors[imgui.Col.Separator] = imgui.ImVec4(0.71, 0.71, 0.71, 1.00);
style.Colors[imgui.Col.SeparatorHovered] = imgui.ImVec4(0.71, 0.71, 0.71, 1.00);
style.Colors[imgui.Col.SeparatorActive] = imgui.ImVec4(0.71, 0.71, 0.71, 1.00);
style.Colors[imgui.Col.ResizeGrip] = imgui.ImVec4(0.71, 0.71, 0.71, 1.00);
style.Colors[imgui.Col.ResizeGripHovered] = imgui.ImVec4(0.48, 0.48, 0.48, 1.00);
style.Colors[imgui.Col.ResizeGripActive] = imgui.ImVec4(0.48, 0.48, 0.48, 1.00);
style.Colors[imgui.Col.Tab] = imgui.ImVec4(0.24, 0.24, 0.24, 1.00);
style.Colors[imgui.Col.TabHovered] = imgui.ImVec4(0.37, 0.37, 0.37, 1.00);
style.Colors[imgui.Col.TabActive] = imgui.ImVec4(0.37, 0.37, 0.37, 1.00);
style.Colors[imgui.Col.TabUnfocused] = imgui.ImVec4(0.07, 0.10, 0.15, 0.97);
style.Colors[imgui.Col.TabUnfocusedActive] = imgui.ImVec4(0.14, 0.26, 0.42, 1.00);
style.Colors[imgui.Col.PlotLines] = imgui.ImVec4(0.61, 0.61, 0.61, 1.00);
style.Colors[imgui.Col.PlotLinesHovered] = imgui.ImVec4(1.00, 0.43, 0.35, 1.00);
style.Colors[imgui.Col.PlotHistogram] = imgui.ImVec4(0.90, 0.70, 0.00, 1.00);
style.Colors[imgui.Col.PlotHistogramHovered] = imgui.ImVec4(1.00, 0.60, 0.00, 1.00);
style.Colors[imgui.Col.TextSelectedBg] = imgui.ImVec4(0.26, 0.59, 0.98, 0.35);
style.Colors[imgui.Col.DragDropTarget] = imgui.ImVec4(1.00, 1.00, 0.00, 0.90);
style.Colors[imgui.Col.NavHighlight] = imgui.ImVec4(0.26, 0.59, 0.98, 1.00);
style.Colors[imgui.Col.NavWindowingHighlight] = imgui.ImVec4(1.00, 1.00, 1.00, 0.70);
style.Colors[imgui.Col.NavWindowingDimBg] = imgui.ImVec4(0.80, 0.80, 0.80, 0.20);
style.Colors[imgui.Col.ModalWindowDimBg] = imgui.ImVec4(0.80, 0.80, 0.80, 0.35);
elseif theme == 2 then
style.Colors[imgui.Col.Text] = imgui.ImVec4(1.00, 0.90, 0.85, 1.00)
style.Colors[imgui.Col.TextDisabled] = imgui.ImVec4(0.75, 0.60, 0.55, 1.00)
style.Colors[imgui.Col.WindowBg] = imgui.ImVec4(0.25, 0.15, 0.10, 1.00)
style.Colors[imgui.Col.ChildBg] = imgui.ImVec4(0.30, 0.20, 0.15, 0.30)
style.Colors[imgui.Col.PopupBg] = imgui.ImVec4(0.30, 0.20, 0.15, 1.00)
style.Colors[imgui.Col.Border] = imgui.ImVec4(0.80, 0.35, 0.20, 1.00)
style.Colors[imgui.Col.BorderShadow] = imgui.ImVec4(0.00, 0.00, 0.00, 0.00)
style.Colors[imgui.Col.FrameBg] = imgui.ImVec4(0.30, 0.20, 0.15, 1.00)
style.Colors[imgui.Col.FrameBgHovered] = imgui.ImVec4(0.45, 0.25, 0.20, 1.00)
style.Colors[imgui.Col.FrameBgActive] = imgui.ImVec4(0.55, 0.35, 0.25, 1.00)
style.Colors[imgui.Col.TitleBg] = imgui.ImVec4(0.25, 0.15, 0.10, 1.00)
style.Colors[imgui.Col.TitleBgCollapsed] = imgui.ImVec4(0.20, 0.10, 0.05, 1.00)
style.Colors[imgui.Col.TitleBgActive] = imgui.ImVec4(0.30, 0.20, 0.15, 1.00)
style.Colors[imgui.Col.MenuBarBg] = imgui.ImVec4(0.25, 0.15, 0.10, 1.00)
style.Colors[imgui.Col.ScrollbarBg] = imgui.ImVec4(0.25, 0.15, 0.10, 1.00)
style.Colors[imgui.Col.ScrollbarGrab] = imgui.ImVec4(0.80, 0.35, 0.20, 1.00)
style.Colors[imgui.Col.ScrollbarGrabHovered] = imgui.ImVec4(0.90, 0.50, 0.35, 1.00)
style.Colors[imgui.Col.ScrollbarGrabActive] = imgui.ImVec4(1.00, 0.65, 0.50, 1.00)
style.Colors[imgui.Col.CheckMark] = imgui.ImVec4(1.00, 0.65, 0.50, 1.00)
style.Colors[imgui.Col.SliderGrab] = imgui.ImVec4(1.00, 0.65, 0.50, 1.00)
style.Colors[imgui.Col.SliderGrabActive] = imgui.ImVec4(1.00, 0.70, 0.55, 1.00)
style.Colors[imgui.Col.Button] = imgui.ImVec4(0.30, 0.20, 0.15, 1.00)
style.Colors[imgui.Col.ButtonHovered] = imgui.ImVec4(0.90, 0.50, 0.35, 1.00)
style.Colors[imgui.Col.ButtonActive] = imgui.ImVec4(1.00, 0.55, 0.40, 1.00)
style.Colors[imgui.Col.Header] = imgui.ImVec4(0.45, 0.25, 0.20, 1.00)
style.Colors[imgui.Col.HeaderHovered] = imgui.ImVec4(0.55, 0.30, 0.25, 1.00)
style.Colors[imgui.Col.HeaderActive] = imgui.ImVec4(0.65, 0.40, 0.30, 1.00)
style.Colors[imgui.Col.Separator] = imgui.ImVec4(0.80, 0.35, 0.20, 1.00)
style.Colors[imgui.Col.SeparatorHovered] = imgui.ImVec4(0.90, 0.50, 0.35, 1.00)
style.Colors[imgui.Col.SeparatorActive] = imgui.ImVec4(1.00, 0.65, 0.50, 1.00)
style.Colors[imgui.Col.ResizeGrip] = imgui.ImVec4(0.45, 0.25, 0.20, 1.00)
style.Colors[imgui.Col.ResizeGripHovered] = imgui.ImVec4(0.55, 0.30, 0.25, 1.00)
style.Colors[imgui.Col.ResizeGripActive] = imgui.ImVec4(0.65, 0.40, 0.30, 1.00)
style.Colors[imgui.Col.PlotLines] = imgui.ImVec4(0.90, 0.50, 0.35, 1.00)
style.Colors[imgui.Col.PlotLinesHovered] = imgui.ImVec4(1.00, 0.55, 0.40, 1.00)
style.Colors[imgui.Col.PlotHistogram] = imgui.ImVec4(0.90, 0.50, 0.35, 1.00)
style.Colors[imgui.Col.PlotHistogramHovered] = imgui.ImVec4(1.00, 0.55, 0.40, 1.00)
style.Colors[imgui.Col.TextSelectedBg] = imgui.ImVec4(0.55, 0.30, 0.25, 1.00)
style.Colors[imgui.Col.ModalWindowDimBg] = imgui.ImVec4(0.25, 0.15, 0.10, 0.80)
style.Colors[imgui.Col.Tab] = imgui.ImVec4(0.30, 0.20, 0.15, 1.00)
style.Colors[imgui.Col.TabHovered] = imgui.ImVec4(0.90, 0.50, 0.35, 1.00)
style.Colors[imgui.Col.TabActive] = imgui.ImVec4(1.00, 0.55, 0.40, 1.00)
end
end
}
Лог ошибки:
[00:15:24.110500] (error) faw.lua: ...es\Arizona Games Launcher\bin\arizona\moonloader\faw.lua:26: bad argument #3 to 'Combo' (cannot convert 'table' to 'const char *const *')
stack traceback:
[C]: in function 'Combo'
...es\Arizona Games Launcher\bin\arizona\moonloader\faw.lua:26: in function '_draw'
...ames Launcher\bin\arizona\moonloader\lib\mimgui\init.lua:107: in function <...ames Launcher\bin\arizona\moonloader\lib\mimgui\init.lua:91>
[00:15:24.115500] (error) faw.lua: Script died due to an error. (185A03C4)