Код:
local imgui = require 'mimgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
local u8 = encoding.UTF8
local renderWindow = imgui.new.bool(false)
local function applyTheme()
local style = imgui.GetStyle()
local clr = style.Colors
style.WindowRounding = 0
style.ChildRounding = 4
style.FrameRounding = 4
style.WindowBorderSize = 0
style.FrameBorderSize = 0
style.ItemSpacing = imgui.ImVec2(10, 12)
clr[imgui.Col.Text] = imgui.ImVec4(0.85, 0.86, 0.88, 1)
clr[imgui.Col.WindowBg] = imgui.ImVec4(0.06, 0.08, 0.10, 1)
clr[imgui.Col.ChildBg] = imgui.ImVec4(0.07, 0.09, 0.11, 1)
clr[imgui.Col.TitleBg] = imgui.ImVec4(0.06, 0.08, 0.10, 1)
clr[imgui.Col.TitleBgActive] = imgui.ImVec4(0.06, 0.08, 0.10, 1)
clr[imgui.Col.FrameBg] = imgui.ImVec4(0.10, 0.14, 0.18, 1)
end
imgui.OnInitialize(function()
imgui.GetIO().IniFilename = nil
applyTheme()
end)
imgui.OnFrame(function() return renderWindow[0] end, function()
imgui.SetNextWindowSize(imgui.ImVec2(450, 350), imgui.Cond.FirstUseEver)
local sw, sh = getScreenResolution()
imgui.SetNextWindowPos(imgui.ImVec2(sw * 0.5, sh * 0.5), imgui.Cond.Appearing, imgui.ImVec2(0.5, 0.5))
if imgui.Begin(u8"test", renderWindow, imgui.WindowFlags.NoResize) then
imgui.Text(u8"Тест")
imgui.End()
end
end)
function main()
repeat wait(0) until isSampAvailable()
sampAddChatMessage("{00FFFF}[Test]{FFFFFF} Загружен. Активация {00FFFF}/test", -1);
sampRegisterChatCommand("test", function() renderWindow[0] = not renderWindow[0] end)
wait(-1)
end