local imgui = require 'imgui'
local key = require 'vkeys'
local lfs = require("lfs")
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local main_window_state = imgui.ImBool(false)
function main()
while not isSampAvailable() do wait(100) end
while true do wait(0)
if wasKeyPressed(key.VK_X) then main_window_state.v = not main_window_state.v end
imgui.Process = main_window_state.v
end
end
function imgui.OnDrawFrame()
if main_window_state.v then
imgui.SetNextWindowSize(imgui.ImVec2(300, 300), imgui.Cond.FirstUseEver)
imgui.Begin('My window', main_window_state)
for entry in lfs.dir(getWorkingDirectory()) do
if entry:find("mp3") then
if imgui.Button(u8:decode(entry)) then
hande = loadAudioStream(getWorkingDirectory()..'\\'..entry)
if getAudioStreamState(hande) ~= -1 then
releaseAudioStream(hande) end
setAudioStreamVolume(hande, 50)
setAudioStreamState(hande, 1)
print(getAudioStreamState(hande))
end
end
end
imgui.End()
end
end