font_awesone_buttons

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
local u8 = encoding.UTF8
local fa = require 'faIcons'
local style = imgui.GetStyle()
local colors = style.Colors
local clr = imgui.Col
local ImVec4 = imgui.ImVec4
style.WindowRounding = 1.5
colors[clr.TitleBg] = ImVec4(0.0, 0.0, 0.0, 0.6)
colors[clr.TitleBgActive] = ImVec4(0.0, 0.0, 0.0, 0.7)
colors[clr.TitleBgCollapsed] = ImVec4(0.0, 0.0, 0.0, 0.8)
colors[clr.CloseButton] = ImVec4(0.41, 0.41, 0.41, 0.50)
colors[clr.CloseButtonHovered] = ImVec4(0.98, 0.39, 0.36, 1.00)
colors[clr.CloseButtonActive] = ImVec4(0.98, 0.39, 0.36, 1.00)
colors[clr.WindowBg] = ImVec4(0.0, 0.0, 0.0, 0.5)
colors[clr.ScrollbarBg] = ImVec4(0.0, 0.0, 0.0, 0.2)
colors[clr.ScrollbarGrab] = ImVec4(0.8, 0.8, 0.8, 0.3)
colors[clr.ScrollbarGrabHovered] = ImVec4(0.8, 0.8, 0.8, 0.4)
colors[clr.ScrollbarGrabActive] = ImVec4(0.8, 0.8, 0.8, 0.5)
colors[clr.Header] = ImVec4(0.8, 0.8, 0.8, 0.3)
colors[clr.HeaderHovered] = ImVec4(0.8, 0.8, 0.8, 0.4)
colors[clr.HeaderActive] = ImVec4(0.8, 0.8, 0.8, 0.5)
colors[clr.Button] = ImVec4(0.8, 0.8, 0.8, 0.3)
colors[clr.ButtonHovered] = ImVec4(0.8, 0.8, 0.8, 0.4)
colors[clr.ButtonActive] = ImVec4(0.8, 0.8, 0.8, 0.5)
colors[clr.SliderGrabActive] = ImVec4(0.8, 0.8, 0.8, 0.3)
local fa_font = nil
local fa_glyph_ranges = imgui.ImGlyphRanges({ fa.min_range, fa.max_range })
local current_menu = imgui.ImInt(0)
local res = { 'github', 'vk', 'twitter' }
local function font_awesone_buttons(id_child, current, buttons, size)
imgui.PushFont(fa_font)
imgui.BeginChild(id_child, size)
local cursor_x = imgui.GetCursorPosX()
local sizeb = imgui.ImVec2(0, 0)
for i = 1, #buttons do
local c = imgui.CalcTextSize(buttons[i])
if sizeb.x < c.x then sizeb.x = c.x end
end
sizeb.x = sizeb.x + 10
sizeb.y = sizeb.x
for i = 1, #buttons do
local is_current = i - 1 == current.v
if not is_current then imgui.PushStyleColor(clr.Button, imgui.ImVec4(0.0, 0.0, 0.0, 0.0)) end
if imgui.Button(buttons[i], sizeb) then current.v = i - 1 end
if imgui.GetCursorPosX() - cursor_x > size.x - 5 and buttons[i] ~= #buttons then imgui.SameLine() end
if not is_current then imgui.PopStyleColor() end
end
imgui.EndChild()
imgui.PopFont()
end
function main()
while true do wait(0)
if testCheat('ASD') then imgui.Process = not imgui.Process end
end
end
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 imgui.OnDrawFrame()
imgui.Begin('test')
imgui.Columns(2, nil, true)
imgui.SetColumnWidth(imgui.GetColumnIndex(), 40)
font_awesone_buttons('testchild', current_menu, { fa.ICON_GITHUB, fa.ICON_VK, fa.ICON_TWITTER }, imgui.ImVec2(25, 0))
imgui.NextColumn()
imgui.Text(res[current_menu.v + 1])
imgui.Columns(1)
imgui.End()
end