-- Исправление кодировки.
encoding.default = 'cp1251'
local u8 = encoding.UTF8
local function recode(u8) return encoding.UTF8:decode(u8) end
-- Окна.
local window_main = imgui.ImBool(false)
-- Переменные.
selectedTab = 1
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
-- Команды.
sampRegisterChatCommand('test', cmd_test)
end
-- Основная команда.
function cmd_test()
window_main.v = not window_main.v
imgui.Process = window_main.v
end
-- Отрисовка ImGui.
function imgui.OnDrawFrame()
if window_main.v then
imgui.ShowCursor = true
local resX, resY = getScreenResolution()
imgui.SetNextWindowSize(imgui.ImVec2(720, 400), 2)
imgui.SetNextWindowPos(imgui.ImVec2(resX/2, resY/2), 2, imgui.ImVec2(0.5, 0.5))
imgui.Begin('Example Window', window_main, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
imgui.BeginGroup()
imgui.BeginChild('Selectable', imgui.ImVec2(200, 0), true)
if imgui.Selectable(u8'tab1', selectedTab == 1) then selectedTab = 1 end
if imgui.Selectable(u8'tab2', selectedTab == 2) then selectedTab = 2 end
if imgui.Selectable(u8'tab3', selectedTab == 3) then selectedTab = 3 end
imgui.EndChild()
imgui.EndGroup()
imgui.SameLine()
if selectedTab == 1 then
imgui.BeginGroup()
imgui.BeginChild('tab1', imgui.ImVec2(595, 0), true)
imgui.Text(u8'its a tab1')
imgui.EndChild()
imgui.EndGroup()
end
if selectedTab == 2 then
imgui.BeginGroup()
imgui.BeginChild('tab2', imgui.ImVec2(595, 0), true)
imgui.Text(u8'its a tab2')
imgui.EndChild()
imgui.EndGroup()
end
if selectedTab == 3 then
imgui.BeginGroup()
imgui.BeginChild('tab3', imgui.ImVec2(595, 0), true)
imgui.Text(u8'its a tab3')
imgui.EndChild()
imgui.EndGroup()
end
imgui.End()
end
end