imgui.OnInitialize (function() -- Called once
imgui.GetStyle().WindowTitleAlign = imgui.ImVec2(0.5, 0.84)
fonts = {}
fontsArray = {}
load_ini()
fontChanged, fontSizeChanged = false, false
enableSettingsWindow = imgui.new.bool()
-- imgui.GetIO().WantCaptureMouse = true DONT WORKS
imgui.GetIO().IniFilename = nil
imgui.GetStyle().WindowBorderSize = 0
local glyph_ranges = imgui.GetIO().Fonts:GetGlyphRangesCyrillic()
imgui.GetIO().Fonts:Clear()
imgui.GetIO().Fonts:AddFontFromFileTTF(getFolderPath(0x14) .. '\\'..data.values.font_name, fontSize[0], nil, glyph_ranges)
--imgui.RebuildFonts()
local search, file = findFirstFile(getFolderPath(0x14) .. '\\*.ttf')
while file do
table.insert(fonts, file)
if file == data.values.font_name then fontSelected = imgui.new.int(#fonts - 1) end
file = findNextFile(search)
end
fontsArray = imgui.new['const char*'][#fonts](fonts)
fontSize[0] = imgui.GetIO().Fonts.ConfigData.Data[0].SizePixels
-- https://github.com/imring/spur-imgui/blob/master/spur_imgui.lua#L106
local ranges = {
0x0020, 0x00FF,
0x0400, 0x052F,
0x2DE0, 0x2DFF,
0xA640, 0xA69F,
0x2013, 0x2122,
0,
}
local fonts = imgui.GetIO().Fonts
--fonts:Clear()
iranges = ffi.new('ImWchar[?]', #ranges, ranges) -- или mimgui стиль: imgui.new.ImWchar[#ranges](ranges)
fonts:AddFontFromFileTTF(getFolderPath(0x14) .. '\\consola.ttf', 12, nil, iranges)
bold = fonts:AddFontFromFileTTF(getFolderPath(0x14) .. '\\consolab.ttf', 12, nil, iranges)
welcome = fonts:AddFontFromFileTTF(getFolderPath(0x14) .. '\\consolab.ttf', 14, nil, iranges)
end)