local key = require 'vkeys'
local imgui = require 'imgui'
local inicfg = require 'inicfg'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local ds = inicfg.load(nil, "test")
if ds == nil then
local ds = inicfg.load(
{
pos = {
x = 500,
y = 500,
},
size = {
x = 500,
y = 500
}
})
if inicfg.save(ds,'test') then
print('new file')
end
end
local main_window_state = imgui.ImBool(false)
function main()
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(ds.size.x, ds.size.y), imgui.Cond.FirstUseEver) -- size
imgui.SetNextWindowPos(imgui.ImVec2(ds.pos.x,ds.pos.y), imgui.Cond.FirstUseEver) -- pos
imgui.Begin('My window', main_window_state)
local pos, size = imgui.GetWindowPos(), imgui.GetWindowSize()
ds.size.x, ds.size.y = size.x, size.y
ds.pos.x, ds.pos.y = pos.x, pos.y
inicfg.save(ds,'test')
imgui.End()
end
end