require "lib.moonloader" -- подключение библиотеки
local keys = require "vkeys"
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local fa = require 'faIcons'
local fa_glyph_ranges = imgui.ImGlyphRanges({ fa.min_range, fa.max_range })
main_window_state = imgui.ImBool(false)
function imgui.BeforeDrawFrame()
if fa_font == nil then
local font_config = imgui.ImFontConfig() -- to use 'imgui.ImFontConfig.new()' on error
font_config.MergeMode = true
fa_font = imgui.GetIO().Fonts:AddFontFromFileTTF('moonloader/resource/fonts/fontawesome-webfont.ttf', 14.0, font_config, fa_glyph_ranges)
end
end
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand("icons", cmd_icons)
while true do
wait(0)
end
end
function cmd_icons(arg)
main_window_state.v = not main_window_state.v
imgui.Process = main_window_state.v
end
function imgui.OnDrawFrame()
if not main_window_state.v then
imgui.Process = false
end
if main_window_state.v then
local sw, sh = getScreenResolution()
imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(200, 200), imgui.Cond.FirstUseEver)
imgui.Begin(fa.ICON_PENCIL .. ' Imgui Icons', main_window_state, imgui.WindowFlags.NoCollapse)
imgui.Button(fa.ICON_PICTURE_O .. ' AppStore')
imgui.TextColoredRGB("{FF4500}" .. fa.ICON_TAXI .. u8"{708090} Привет", 2);
imgui.End()
end
end