Library draw call sites match 1.93: AddLineH/AddLineV + StrokeCenterBiased/StrokeInside (window/menu borders, separators, text cursor), tab border PathStroke, check mark AALineEnds, CloseButton/TreeNode lines/ColorButton/alpha checkerboard 1.93, Ctrl+Tab highlight AddRect arg order, metrics AA push/pop
This commit is contained in:
@@ -1 +1 @@
|
||||
[[46, "imgui.lua"], [21461, "imgui_demo.lua"], [33313, "imgui_draw.lua"], [40829, "imgui_h.lua"], [43735, "imgui_impl_roblox.lua"], [45383, "imgui_impl_roblox_fonts.lua"], [51786, "imgui_internal.lua"], [55495, "imgui_tables.lua"], [60554, "imgui_widgets.lua"], [72543, "imstb_rectpack.lua"], [73207, "imstb_textedit.lua"], [74749, "imstb_truetype.lua"], [77537, "imstd_minstdio.lua"]]
|
||||
[[46, "imgui.lua"], [21466, "imgui_demo.lua"], [33318, "imgui_draw.lua"], [40827, "imgui_h.lua"], [43733, "imgui_impl_roblox.lua"], [45381, "imgui_impl_roblox_fonts.lua"], [51784, "imgui_internal.lua"], [55494, "imgui_tables.lua"], [60553, "imgui_widgets.lua"], [72529, "imstb_rectpack.lua"], [73193, "imstb_textedit.lua"], [74735, "imstb_truetype.lua"], [77523, "imstd_minstdio.lua"]]
|
||||
+101
-115
@@ -10504,7 +10504,7 @@ local function RenderWindowOuterBorders(window)
|
||||
|
||||
if g.Style.FrameBorderSize > 0 and (bit32.band(window.Flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) == 0) and not window.DockIsActive then
|
||||
local y = window.Pos.y + window.TitleBarHeight - 1
|
||||
window.DrawList:AddLineH(window.Pos.x + border_size * 0.5, window.Pos.x + window.Size.x - border_size * 0.5, y, border_col, g.Style.FrameBorderSize)
|
||||
window.DrawList:AddLineH(window.Pos.x + border_size, window.Pos.x + window.Size.x - border_size, y, border_col, g.Style.FrameBorderSize, 393216 --[[ImDrawFlags.StrokeCenterBiased]])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10585,7 +10585,7 @@ local function RenderWindowDecorations(window, title_bar_rect, title_bar_is_high
|
||||
menu_bar_rect:ClipWith(window:Rect()) -- Soft clipping, in particular child window don't have minimum size covering the menu bar so this is useful for them.
|
||||
window.DrawList:AddRectFilled(menu_bar_rect.Min, menu_bar_rect.Max, ImGui.GetColorU32(13 --[[ImGuiCol.MenuBarBg]]), (bit32.band(flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) ~= 0) and window_rounding or 0.0, 48 --[[ImDrawFlags.RoundTop]])
|
||||
if style.FrameBorderSize > 0.0 and menu_bar_rect.Max.y < window.Pos.y + window.Size.y then
|
||||
window.DrawList:AddLineH(menu_bar_rect.Min.x + window_border_size * 0.5, menu_bar_rect.Max.x - window_border_size * 0.5, menu_bar_rect.Max.y, ImGui.GetColorU32(5 --[[ImGuiCol.Border]]), style.FrameBorderSize)
|
||||
window.DrawList:AddLineH(menu_bar_rect.Min.x + window_border_size, menu_bar_rect.Max.x - window_border_size, menu_bar_rect.Max.y, ImGui.GetColorU32(5 --[[ImGuiCol.Border]]), style.FrameBorderSize, 393216 --[[ImDrawFlags.StrokeCenterBiased]])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19084,7 +19084,7 @@ function ImGui.RenderDimmedBackgrounds()
|
||||
window.DrawList:ChannelsMerge()
|
||||
if window.DrawList.CmdBuffer.Size == 0 then window.DrawList:AddDrawCmd() end
|
||||
window.DrawList:PushClipRect(viewport.Pos, viewport.Pos + viewport.Size)
|
||||
window.DrawList:AddRect(bb.Min, bb.Max, ImGui.GetColorU32(60 --[[ImGuiCol.NavWindowingHighlight]], g.NavWindowingHighlightAlpha), window.WindowRounding, 0, 3.0) -- FIXME-DPI
|
||||
window.DrawList:AddRect(bb.Min, bb.Max, ImGui.GetColorU32(60 --[[ImGuiCol.NavWindowingHighlight]], g.NavWindowingHighlightAlpha), window.WindowRounding, 3.0) -- FIXME-DPI
|
||||
window.DrawList:PopClipRect()
|
||||
end
|
||||
end
|
||||
@@ -20730,8 +20730,7 @@ function ImGui.DebugNodeDrawList(window, viewport, draw_list, label)
|
||||
else
|
||||
local cr = pcmd.ClipRect
|
||||
local open = ImGui.TreeNode(cmd_n, "DrawCmd:%5d tris, Tex %s, ClipRect (%4.0f,%4.0f)-(%4.0f,%4.0f)", math.floor(pcmd.ElemCount / 3), tostring(pcmd.TexRef and (pcmd.TexRef._TexID or pcmd.TexRef._TexData)), cr.x, cr.y, cr.z, cr.w)
|
||||
local function ShowMesh(show_mesh, show_aabb)
|
||||
if not fg_draw_list then return end
|
||||
local function ShowMeshImpl(show_mesh, show_aabb)
|
||||
local clip_rect = ImRect(cr.x, cr.y, cr.z, cr.w)
|
||||
local vtxs_rect = ImRect(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]])
|
||||
local base = pcmd.IdxOffset
|
||||
@@ -20750,6 +20749,12 @@ function ImGui.DebugNodeDrawList(window, viewport, draw_list, label)
|
||||
fg_draw_list:AddRect(ImTrunc(vtxs_rect.Min), ImTrunc(vtxs_rect.Max), IM_COL32(0, 255, 255, 255)) -- In cyan: bounding box of triangles
|
||||
end
|
||||
end
|
||||
local function ShowMesh(show_mesh, show_aabb) -- DebugNodeDrawCmdShowMeshAndBoundingBox()
|
||||
if not fg_draw_list then return end
|
||||
fg_draw_list:PushDrawFlag(8192 --[[ImDrawFlags.AALines]], false) -- Disable AA on triangle outlines is more readable for very large and thin triangles.
|
||||
ShowMeshImpl(show_mesh, show_aabb)
|
||||
fg_draw_list:PopDrawFlag()
|
||||
end
|
||||
if ImGui.IsItemHovered() and (cfg.ShowDrawCmdMesh or cfg.ShowDrawCmdBoundingBoxes) then ShowMesh(cfg.ShowDrawCmdMesh, cfg.ShowDrawCmdBoundingBoxes) end
|
||||
if open then
|
||||
ImGui.Selectable(string.format("Mesh: ElemCount: %d, VtxOffset: +%d, IdxOffset: +%d", pcmd.ElemCount, pcmd.VtxOffset, pcmd.IdxOffset))
|
||||
@@ -20778,8 +20783,8 @@ function ImGui.DebugNodeTabBar(tab_bar, label)
|
||||
if is_active and ImGui.IsItemHovered() then
|
||||
local dl = FG(tab_bar.Window)
|
||||
dl:AddRect(tab_bar.BarRect.Min, tab_bar.BarRect.Max, IM_COL32(255, 255, 0, 255))
|
||||
dl:AddLine(ImVec2(tab_bar.ScrollingRectMinX, tab_bar.BarRect.Min.y), ImVec2(tab_bar.ScrollingRectMinX, tab_bar.BarRect.Max.y), IM_COL32(0, 255, 0, 255))
|
||||
dl:AddLine(ImVec2(tab_bar.ScrollingRectMaxX, tab_bar.BarRect.Min.y), ImVec2(tab_bar.ScrollingRectMaxX, tab_bar.BarRect.Max.y), IM_COL32(0, 255, 0, 255))
|
||||
dl:AddLineV(tab_bar.ScrollingRectMinX, tab_bar.BarRect.Min.y, tab_bar.BarRect.Max.y, IM_COL32(0, 255, 0, 255))
|
||||
dl:AddLineV(tab_bar.ScrollingRectMaxX, tab_bar.BarRect.Min.y, tab_bar.BarRect.Max.y, IM_COL32(0, 255, 0, 255))
|
||||
end
|
||||
if open then
|
||||
for tab_n, tab in tab_bar.Tabs:iter() do
|
||||
@@ -40469,7 +40474,7 @@ function ImGui.RenderCheckMark(draw_list, pos, col, sz)
|
||||
draw_list:PathLineTo(p)
|
||||
p.x = bx + third * 2.0; p.y = by - third * 2.0
|
||||
draw_list:PathLineTo(p)
|
||||
draw_list:PathStroke(col, thickness)
|
||||
draw_list:PathStroke(col, thickness, 16384 --[[ImDrawFlags.AALineEnds]])
|
||||
end
|
||||
|
||||
-- Render an arrow. 'pos' is position of the arrow tip. half_sz.x is length from base to tip. half_sz.y is length on each side.
|
||||
@@ -40555,7 +40560,7 @@ function ImGui.RenderRectFilledInRangeH(draw_list, rect, col, fill_x0, fill_x1,
|
||||
end
|
||||
end
|
||||
|
||||
draw_list:PathFillConvex(col)
|
||||
draw_list:PathFillConvex(col, 1024 --[[ImDrawFlags.JoinMiter]])
|
||||
end
|
||||
|
||||
--- @param r_in ImRect
|
||||
@@ -40589,16 +40594,16 @@ end
|
||||
-- Helper for ColorPicker4()
|
||||
-- NB: This is rather brittle and will show artifact when rounding this enabled if rounded corners overlap multiple cells. Caller currently responsible for avoiding that.
|
||||
-- Spent a non reasonable amount of time trying to getting this right for ColorButton with rounding+anti-aliasing+ImGuiColorEditFlags_HalfAlphaPreview flag + various grid sizes and offsets, and eventually gave up... probably more reasonable to disable rounding altogether.
|
||||
-- FIXME: uses ImGui.GetColorU32
|
||||
--- @param draw_list ImDrawList
|
||||
--- @param p_min ImVec2
|
||||
--- @param p_max ImVec2
|
||||
--- @param col ImU32
|
||||
--- @param alpha float
|
||||
--- @param grid_step float
|
||||
--- @param grid_off ImVec2
|
||||
--- @param rounding? float
|
||||
--- @param flags? ImDrawFlags
|
||||
function ImGui.RenderColorRectWithAlphaCheckerboard(draw_list, p_min, p_max, col, grid_step, grid_off, rounding, flags)
|
||||
function ImGui.RenderColorRectWithAlphaCheckerboard(draw_list, p_min, p_max, col, alpha, grid_step, grid_off, rounding, flags)
|
||||
if rounding == nil then rounding = 0.0 end
|
||||
if flags == nil then flags = 0 end
|
||||
|
||||
@@ -40607,60 +40612,53 @@ function ImGui.RenderColorRectWithAlphaCheckerboard(draw_list, p_min, p_max, col
|
||||
end
|
||||
|
||||
if bit32.rshift(bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]), 24 --[[IM_COL32_A_SHIFT]]) < 0xFF then
|
||||
local col_bg1 = ImGui.GetColorU32(ImStd.ImAlphaBlendColors(IM_COL32(128, 128, 128, 255), col), nil, true)
|
||||
local col_bg2 = ImGui.GetColorU32(ImStd.ImAlphaBlendColors(IM_COL32(204, 204, 204, 255), col), nil, true)
|
||||
draw_list:AddRectFilled(p_min, p_max, col_bg1, rounding, flags)
|
||||
assert(alpha >= 0.0 and alpha <= 1.0)
|
||||
local a_mask = bit32.lshift(ImTrunc(alpha * 255.0), 24 --[[IM_COL32_A_SHIFT]])
|
||||
local col_bg1 = bit32.bor(bit32.band(ImStd.ImAlphaBlendColors(IM_COL32(128, 128, 128, 255), col), bit32.bnot(4278190080 --[[IM_COL32_A_MASK]])), a_mask)
|
||||
local col_bg2 = bit32.bor(bit32.band(ImStd.ImAlphaBlendColors(IM_COL32(204, 204, 204, 255), col), bit32.bnot(4278190080 --[[IM_COL32_A_MASK]])), a_mask)
|
||||
local dual_layer = (alpha == 1.0) -- Dual layer is faster but incorrect if blending.
|
||||
if dual_layer then
|
||||
draw_list:AddRectFilled(p_min, p_max, col_bg1, rounding, flags)
|
||||
end
|
||||
|
||||
local yi = 0
|
||||
local y = p_min.y + grid_off.y
|
||||
local x_start
|
||||
local x
|
||||
local cell_flags
|
||||
while y < p_max.y do
|
||||
repeat
|
||||
local y1 = ImClamp(y, p_min.y, p_max.y)
|
||||
local y2 = ImMin(y + grid_step, p_max.y)
|
||||
local y1 = ImClamp(ImTrunc(y), p_min.y, p_max.y)
|
||||
local y2 = ImMin(ImTrunc(y + grid_step), p_max.y)
|
||||
if y2 > y1 then
|
||||
local x_start_off = dual_layer and (((yi + 1) % 2) * grid_step) or 0.0
|
||||
local x_step = dual_layer and (grid_step * 2.0) or grid_step
|
||||
local xi = 0
|
||||
local x = p_min.x + grid_off.x + x_start_off
|
||||
while x < p_max.x do
|
||||
local x1 = ImClamp(ImTrunc(x), p_min.x, p_max.x)
|
||||
local x2 = ImMin(ImTrunc(x + grid_step), p_max.x)
|
||||
if x2 > x1 then
|
||||
local cell_flags = 256 --[[ImDrawFlags.RoundNone]] -- FIXME: Could use CalcRoundingFlagsForRectInRect()
|
||||
if y1 <= p_min.y then
|
||||
if x1 <= p_min.x then cell_flags = bit32.bor(cell_flags, 16 --[[ImDrawFlags.RoundTopLeft]]) end
|
||||
if x2 >= p_max.x then cell_flags = bit32.bor(cell_flags, 32 --[[ImDrawFlags.RoundTopRight]]) end
|
||||
end
|
||||
if y2 >= p_max.y then
|
||||
if x1 <= p_min.x then cell_flags = bit32.bor(cell_flags, 64 --[[ImDrawFlags.RoundBottomLeft]]) end
|
||||
if x2 >= p_max.x then cell_flags = bit32.bor(cell_flags, 128 --[[ImDrawFlags.RoundBottomRight]]) end
|
||||
end
|
||||
|
||||
if y2 <= y1 then
|
||||
break
|
||||
-- Combine flags
|
||||
if flags == 256 --[[ImDrawFlags.RoundNone]] or cell_flags == 256 --[[ImDrawFlags.RoundNone]] then
|
||||
cell_flags = 256 --[[ImDrawFlags.RoundNone]]
|
||||
else
|
||||
cell_flags = bit32.band(cell_flags, flags)
|
||||
end
|
||||
local col_bg
|
||||
if dual_layer then col_bg = col_bg2 elseif (yi + xi) % 2 == 1 then col_bg = col_bg2 else col_bg = col_bg1 end
|
||||
draw_list:AddRectFilled(ImVec2(x1, y1), ImVec2(x2, y2), col_bg, rounding, cell_flags)
|
||||
end
|
||||
x = x + x_step
|
||||
xi = xi + 1
|
||||
end
|
||||
end
|
||||
|
||||
x_start = p_min.x + grid_off.x + ((yi + 1) % 2) * grid_step
|
||||
x = x_start
|
||||
while x < p_max.x do
|
||||
repeat
|
||||
local x1 = ImClamp(x, p_min.x, p_max.x)
|
||||
local x2 = ImMin(x + grid_step, p_max.x)
|
||||
|
||||
if x2 <= x1 then
|
||||
break
|
||||
end
|
||||
|
||||
cell_flags = 256 --[[ImDrawFlags.RoundNone]] -- FIXME: Could use CalcRoundingFlagsForRectInRect()
|
||||
if y1 <= p_min.y then
|
||||
if x1 <= p_min.x then cell_flags = bit32.bor(cell_flags, 16 --[[ImDrawFlags.RoundTopLeft]]) end
|
||||
if x2 >= p_max.x then cell_flags = bit32.bor(cell_flags, 32 --[[ImDrawFlags.RoundTopRight]]) end
|
||||
end
|
||||
if y2 >= p_max.y then
|
||||
if x1 <= p_min.x then cell_flags = bit32.bor(cell_flags, 64 --[[ImDrawFlags.RoundBottomLeft]]) end
|
||||
if x2 >= p_max.x then cell_flags = bit32.bor(cell_flags, 128 --[[ImDrawFlags.RoundBottomRight]]) end
|
||||
end
|
||||
|
||||
-- Combine flags
|
||||
if flags == 256 --[[ImDrawFlags.RoundNone]] or cell_flags == 256 --[[ImDrawFlags.RoundNone]] then
|
||||
cell_flags = 256 --[[ImDrawFlags.RoundNone]]
|
||||
else
|
||||
cell_flags = bit32.band(cell_flags, flags)
|
||||
end
|
||||
draw_list:AddRectFilled(ImVec2(x1, y1), ImVec2(x2, y2), col_bg2, rounding, cell_flags)
|
||||
|
||||
until true
|
||||
|
||||
x = x + grid_step * 2.0
|
||||
end
|
||||
|
||||
until true
|
||||
|
||||
y = y + grid_step
|
||||
yi = yi + 1
|
||||
end
|
||||
@@ -54293,6 +54291,7 @@ function ImGuiContext(shared_font_atlas) -- TODO: tidy up / complete this struct
|
||||
|
||||
DisabledAlphaBackup = 0.0, -- Backup for style.Alpha for BeginDisabled()
|
||||
DisabledStackSize = 0,
|
||||
MixedValueLabel = "-", -- Value replacement when displaying a mixed value.
|
||||
|
||||
ItemFlagsStack = ImVector(), -- Stack for PushItemFlag()/PopItemFlag() - inherited by Begin()
|
||||
GroupStack = ImVector(), -- Stack for BeginGroup()/EndGroup() - not inherited by Begin()
|
||||
@@ -61487,7 +61486,7 @@ function ImGui.CloseButton(id, pos)
|
||||
window.DrawList:AddRectFilled(bb.Min, bb.Max, bg_col)
|
||||
end
|
||||
|
||||
local cross_center = bb:GetCenter() - ImVec2(0.5, 0.5)
|
||||
local cross_center = bb:GetCenter()
|
||||
local cross_extent = g.FontSize * 0.5 * 0.7071 - 1
|
||||
local cross_col = ImGui.GetColorU32(0 --[[ImGuiCol.Text]])
|
||||
local cross_thickness = 1.0 -- FIXME-DPI
|
||||
@@ -61497,32 +61496,6 @@ function ImGui.CloseButton(id, pos)
|
||||
return pressed
|
||||
end
|
||||
|
||||
--- @return bool
|
||||
function ImGui.CollapseButton(id, pos)
|
||||
local g = GImGui
|
||||
|
||||
local window = g.CurrentWindow
|
||||
|
||||
local bb = ImRect(pos, pos + ImVec2(g.FontSize, g.FontSize))
|
||||
|
||||
local is_clipped = not ImGui.ItemAdd(bb, id)
|
||||
|
||||
local pressed, hovered = ImGui.ButtonBehavior(bb, id)
|
||||
|
||||
-- Render
|
||||
if hovered then
|
||||
window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(23 --[[ImGuiCol.ButtonHovered]]))
|
||||
end
|
||||
|
||||
if window.Collapsed then
|
||||
ImGui.RenderArrow(window.DrawList, bb.Min, ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), 1 --[[ImGuiDir.Right]], 1)
|
||||
else
|
||||
ImGui.RenderArrow(window.DrawList, bb.Min, ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), 3 --[[ImGuiDir.Down]], 1)
|
||||
end
|
||||
|
||||
return pressed
|
||||
end
|
||||
|
||||
--- @param window ImGuiWindow
|
||||
--- @param axis ImGuiAxis
|
||||
--- @return ImGuiID
|
||||
@@ -62427,7 +62400,7 @@ function ImGui.SeparatorTextEx(id, label, label_end, extra_w)
|
||||
|
||||
local sep1_x1 = pos.x
|
||||
local sep2_x2 = bb.Max.x
|
||||
local seps_y = ImTrunc((bb.Min.y + bb.Max.y) * 0.5 + 0.999)
|
||||
local seps_y = ImTrunc((bb.Min.y + bb.Max.y) * 0.5) + 1.0
|
||||
|
||||
local label_avail_w = ImMax(0.0, sep2_x2 - sep1_x1 - padding.x * 2.0)
|
||||
local label_pos = ImVec2(pos.x + padding.x + ImMax(0.0, (label_avail_w - label_size.x - extra_w) * style.SeparatorTextAlign.x), pos.y + text_baseline_y) -- FIXME-ALIGN
|
||||
@@ -62442,11 +62415,11 @@ function ImGui.SeparatorTextEx(id, label, label_end, extra_w)
|
||||
local sep2_x1 = label_pos.x + label_size.x + extra_w + style.ItemSpacing.x
|
||||
|
||||
if sep1_x2 > sep1_x1 and separator_thickness > 0.0 then
|
||||
window.DrawList:AddLineH(sep1_x1, sep1_x2, seps_y, separator_col, separator_thickness)
|
||||
window.DrawList:AddLineH(sep1_x1, sep1_x2, seps_y, separator_col, separator_thickness, 393216 --[[ImDrawFlags.StrokeCenterBiased]])
|
||||
end
|
||||
|
||||
if sep2_x2 > sep2_x1 and separator_thickness > 0.0 then
|
||||
window.DrawList:AddLineH(sep2_x1, sep2_x2, seps_y, separator_col, separator_thickness)
|
||||
window.DrawList:AddLineH(sep2_x1, sep2_x2, seps_y, separator_col, separator_thickness, 393216 --[[ImDrawFlags.StrokeCenterBiased]])
|
||||
end
|
||||
|
||||
if g.LogEnabled then
|
||||
@@ -62460,7 +62433,7 @@ function ImGui.SeparatorTextEx(id, label, label_end, extra_w)
|
||||
end
|
||||
|
||||
if separator_thickness > 0.0 then
|
||||
window.DrawList:AddLineH(sep1_x1, sep2_x2, seps_y, separator_col, separator_thickness)
|
||||
window.DrawList:AddLineH(sep1_x1, sep2_x2, seps_y, separator_col, separator_thickness, 393216 --[[ImDrawFlags.StrokeCenterBiased]])
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -66789,10 +66762,10 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback
|
||||
local cursor_is_visible = (not g.IO.ConfigInputTextCursorBlink) or (state.CursorAnim <= 0.0) or (ImFmod(state.CursorAnim, 1.20) <= 0.80)
|
||||
|
||||
local cursor_screen_pos = ImTrunc(draw_pos + cursor_offset - draw_scroll)
|
||||
local cursor_screen_rect = ImRect(cursor_screen_pos.x, cursor_screen_pos.y - g.FontSize + 0.5, cursor_screen_pos.x + 1.0, cursor_screen_pos.y - 1.5)
|
||||
local cursor_screen_rect = ImRect(cursor_screen_pos.x, cursor_screen_pos.y - g.FontSize + 1.0, cursor_screen_pos.x + 1.0, cursor_screen_pos.y - 1.0)
|
||||
|
||||
if cursor_is_visible and cursor_screen_rect:Overlaps(clip_rect) then
|
||||
draw_window.DrawList:AddLineV(cursor_screen_rect.Min.x, cursor_screen_rect.Min.y, cursor_screen_rect.Max.y, ImGui.GetColorU32(34 --[[ImGuiCol.InputTextCursor]]), style.InputTextCursorSize)
|
||||
draw_window.DrawList:AddLineV(cursor_screen_rect.Min.x, cursor_screen_rect.Min.y, cursor_screen_rect.Max.y, ImGui.GetColorU32(34 --[[ImGuiCol.InputTextCursor]]), style.InputTextCursorSize, 131072 --[[ImDrawFlags.StrokeInside]])
|
||||
end
|
||||
|
||||
-- Notify OS of text input position for advanced IME (-1 x offset so that Windows IME can cover our cursor. Bit of an extra nicety.)
|
||||
@@ -67670,7 +67643,7 @@ function ImGui.ColorPicker4(label, col, flags, ref_col)
|
||||
if alpha_bar then
|
||||
local alpha = ImSaturate(col[4])
|
||||
local bar1_bb = ImRect(bar1_pos_x, picker_pos.y, bar1_pos_x + bars_width, picker_pos.y + sv_picker_size)
|
||||
ImGui.RenderColorRectWithAlphaCheckerboard(draw_list, bar1_bb.Min, bar1_bb.Max, 0, bar1_bb:GetWidth() / 2.0, ImVec2(0.0, 0.0))
|
||||
ImGui.RenderColorRectWithAlphaCheckerboard(draw_list, bar1_bb.Min, bar1_bb.Max, IM_COL32(0, 0, 0, 0), style.Alpha, bar1_bb:GetWidth() / 2.0, ImVec2(0.0, 0.0))
|
||||
draw_list:AddRectFilledMultiColor(bar1_bb.Min, bar1_bb.Max, user_col32_striped_of_alpha, user_col32_striped_of_alpha, bit32.band(user_col32_striped_of_alpha, bit32.bnot(4278190080 --[[IM_COL32_A_MASK]])), bit32.band(user_col32_striped_of_alpha, bit32.bnot(4278190080 --[[IM_COL32_A_MASK]])))
|
||||
|
||||
local bar1_line_y = IM_ROUND(picker_pos.y + (1.0 - alpha) * sv_picker_size)
|
||||
@@ -67748,36 +67721,45 @@ function ImGui.ColorButton(desc_id, col, flags, size_arg)
|
||||
local col_rgb_without_alpha = ImVec4(col_rgb.x, col_rgb.y, col_rgb.z, 1.0)
|
||||
local grid_step = ImMin(size.x, size.y) / 2.99
|
||||
local rounding = ImMin(g.Style.FrameRounding, grid_step * 0.5)
|
||||
local bb_inner = ImRect()
|
||||
ImRect_Copy(bb_inner, bb)
|
||||
local off = 0.0
|
||||
if bit32.band(flags, 1024 --[[ImGuiColorEditFlags.NoBorder]]) == 0 then
|
||||
off = -0.75
|
||||
bb_inner:Expand(off)
|
||||
local is_mixed = bit32.band(g.LastItemData.ItemFlags, 4096 --[[ImGuiItemFlags.MixedValue]]) ~= 0
|
||||
|
||||
local backup_alpha = g.Style.Alpha
|
||||
if g.DisabledStackSize > 0 then
|
||||
g.Style.Alpha = g.DisabledAlphaBackup -- Cancel out effect of BeginDisabled() for color swatches.
|
||||
end
|
||||
if bit32.band(flags, 16384 --[[ImGuiColorEditFlags.AlphaPreviewHalf]]) ~= 0 and col_rgb.w < 1.0 then
|
||||
local mid_x = IM_ROUND((bb_inner.Min.x + bb_inner.Max.x) * 0.5)
|
||||
if bit32.band(flags, 8192 --[[ImGuiColorEditFlags.AlphaNoBg]]) == 0 then
|
||||
ImGui.RenderColorRectWithAlphaCheckerboard(window.DrawList, ImVec2(bb_inner.Min.x + grid_step, bb_inner.Min.y), bb_inner.Max, ImGui.GetColorU32(col_rgb), grid_step, ImVec2(-grid_step + off, off), rounding, 160 --[[ImDrawFlags.RoundRight]])
|
||||
else
|
||||
window.DrawList:AddRectFilled(ImVec2(bb_inner.Min.x + grid_step, bb_inner.Min.y), bb_inner.Max, ImGui.GetColorU32(col_rgb), rounding, 160 --[[ImDrawFlags.RoundRight]])
|
||||
if is_mixed then
|
||||
window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(7 --[[ImGuiCol.FrameBg]]), rounding)
|
||||
ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], g.Style.Colors[1 --[[ImGuiCol.TextDisabled]]]) -- ImGuiCol_TextMixedValue
|
||||
if g.MixedValueLabel ~= nil then
|
||||
ImGui.RenderTextClipped(ImVec2(bb.Min.x, bb.Min.y + g.Style.FramePadding.y), bb.Max, g.MixedValueLabel, nil, nil, ImVec2(0.5, 0.0))
|
||||
end
|
||||
window.DrawList:AddRectFilled(bb_inner.Min, ImVec2(mid_x, bb_inner.Max.y), ImGui.GetColorU32(col_rgb_without_alpha), rounding, 80 --[[ImDrawFlags.RoundLeft]])
|
||||
ImGui.PopStyleColor()
|
||||
elseif bit32.band(flags, 16384 --[[ImGuiColorEditFlags.AlphaPreviewHalf]]) ~= 0 and col_rgb.w < 1.0 then
|
||||
local mid_x = IM_ROUND((bb.Min.x + bb.Max.x) * 0.5)
|
||||
if bit32.band(flags, 8192 --[[ImGuiColorEditFlags.AlphaNoBg]]) == 0 then
|
||||
ImGui.RenderColorRectWithAlphaCheckerboard(window.DrawList, ImVec2(bb.Min.x + grid_step, bb.Min.y), bb.Max, ImGui.ColorConvertFloat4ToU32(col_rgb), g.Style.Alpha, grid_step, ImVec2(-grid_step, 0.0), rounding, 160 --[[ImDrawFlags.RoundRight]])
|
||||
else
|
||||
window.DrawList:AddRectFilled(ImVec2(bb.Min.x + grid_step, bb.Min.y), bb.Max, ImGui.GetColorU32(col_rgb), rounding, 160 --[[ImDrawFlags.RoundRight]])
|
||||
end
|
||||
window.DrawList:AddRectFilled(bb.Min, ImVec2(mid_x, bb.Max.y), ImGui.GetColorU32(col_rgb_without_alpha), rounding, 80 --[[ImDrawFlags.RoundLeft]])
|
||||
else
|
||||
-- Because GetColorU32() multiplies by the global style Alpha and we don't want to display a checkerboard if the source code had no alpha
|
||||
local col_source = (bit32.band(flags, 4096 --[[ImGuiColorEditFlags.AlphaOpaque]]) ~= 0) and col_rgb_without_alpha or col_rgb
|
||||
if col_source.w < 1.0 and bit32.band(flags, 8192 --[[ImGuiColorEditFlags.AlphaNoBg]]) == 0 then
|
||||
ImGui.RenderColorRectWithAlphaCheckerboard(window.DrawList, bb_inner.Min, bb_inner.Max, ImGui.GetColorU32(col_source), grid_step, ImVec2(off, off), rounding)
|
||||
ImGui.RenderColorRectWithAlphaCheckerboard(window.DrawList, bb.Min, bb.Max, ImGui.ColorConvertFloat4ToU32(col_source), g.Style.Alpha, grid_step, ImVec2(0.0, 0.0), rounding)
|
||||
else
|
||||
window.DrawList:AddRectFilled(bb_inner.Min, bb_inner.Max, ImGui.GetColorU32(col_source), rounding)
|
||||
window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(col_source), rounding)
|
||||
end
|
||||
end
|
||||
if g.DisabledStackSize > 0 then
|
||||
g.Style.Alpha = backup_alpha
|
||||
end
|
||||
ImGui.RenderNavCursor(bb, id)
|
||||
if bit32.band(flags, 1024 --[[ImGuiColorEditFlags.NoBorder]]) == 0 then
|
||||
if g.Style.FrameBorderSize > 0.0 then
|
||||
ImGui.RenderFrameBorder(bb.Min, bb.Max, rounding)
|
||||
else
|
||||
window.DrawList:AddRect(bb.Min, bb.Max, ImGui.GetColorU32(7 --[[ImGuiCol.FrameBg]]), rounding) -- Color buttons are often in need of some sort of border
|
||||
window.DrawList:AddRect(bb.Min, bb.Max, ImGui.GetColorU32(7 --[[ImGuiCol.FrameBg]]), rounding, 1.0 * ImTrunc(g.Style._MainScale)) -- Color buttons are often in need of some sort of border -- FIXME-DPI
|
||||
end
|
||||
end
|
||||
|
||||
@@ -68460,23 +68442,27 @@ function ImGui.TreeNodeDrawLineToChildNode(target_pos)
|
||||
|
||||
-- FIXME: Could this be simplified using new stroke flags?
|
||||
local parent_data = g.TreeNodeStack.Data[g.TreeNodeStack.Size]
|
||||
local x1 = ImTrunc(parent_data.DrawLinesX1)
|
||||
local half_size = g.Style.TreeLinesSize * 0.5
|
||||
local x1 = ImTrunc(parent_data.DrawLinesX1 - half_size) + half_size -- Draw line centered at X1, but snap to pixels boundary.
|
||||
local x2 = ImTrunc(target_pos.x - g.Style.ItemInnerSpacing.x)
|
||||
local y = ImTrunc(target_pos.y)
|
||||
local y = ImTrunc(target_pos.y - half_size) + half_size
|
||||
local rounding = (g.Style.TreeLinesRounding > 0.0) and ImMin(x2 - x1, g.Style.TreeLinesRounding) or 0.0
|
||||
parent_data.DrawLinesToNodesY2 = ImMax(parent_data.DrawLinesToNodesY2, y - rounding)
|
||||
if x1 >= x2 then
|
||||
return
|
||||
end
|
||||
if rounding > 0.0 then
|
||||
x1 = x1 + 0.5 + rounding
|
||||
if rounding > 0.0 and rounding > half_size then
|
||||
x1 = x1 + rounding
|
||||
window.DrawList:PathArcToFast(ImVec2(x1, y - rounding), rounding, 6, 3)
|
||||
if x1 < x2 then
|
||||
window.DrawList:PathLineTo(ImVec2(x2, y))
|
||||
end
|
||||
window.DrawList:PathStroke(ImGui.GetColorU32(55 --[[ImGuiCol.TreeLines]]), g.Style.TreeLinesSize)
|
||||
else
|
||||
window.DrawList:AddLineH(x1, x2, y, ImGui.GetColorU32(55 --[[ImGuiCol.TreeLines]]), g.Style.TreeLinesSize)
|
||||
-- We use AddLine() instead of AddLineH() as we provide coordinates for line center,
|
||||
-- in order to make the code use same coordinates for both rounded and non-rounded version. (FIXME-OPT)
|
||||
x1 = x1 + half_size -- Avoid overdraw
|
||||
window.DrawList:AddLine(ImVec2(x1, y), ImVec2(x2, y), ImGui.GetColorU32(55 --[[ImGuiCol.TreeLines]]), g.Style.TreeLinesSize)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -72458,7 +72444,7 @@ function ImGui.TabItemBackground(draw_list, bb, flags, col)
|
||||
draw_list:PathArcToFast(ImVec2(bb.Min.x + rounding, y1 + rounding), rounding, 6, 9)
|
||||
draw_list:PathArcToFast(ImVec2(bb.Max.x - rounding, y1 + rounding), rounding, 9, 12)
|
||||
draw_list:PathLineTo(ImVec2(bb.Max.x, y2))
|
||||
draw_list:PathStroke(ImGui.GetColorU32(5 --[[ImGuiCol.Border]]), g.Style.TabBorderSize)
|
||||
draw_list:PathStroke(ImGui.GetColorU32(5 --[[ImGuiCol.Border]]), g.Style.TabBorderSize, 393216 --[[ImDrawFlags.StrokeCenterBiased]]) -- Use _StrokeInside?
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
[[183, "imgui.lua"], [21598, "imgui_demo.lua"], [33450, "imgui_draw.lua"], [40966, "imgui_h.lua"], [43872, "imgui_impl_love.lua"], [44412, "imgui_internal.lua"], [48121, "imgui_tables.lua"], [53180, "imgui_widgets.lua"], [65169, "imstb_rectpack.lua"], [65833, "imstb_textedit.lua"], [67375, "imstb_truetype.lua"], [70163, "imstd_minstdio.lua"]]
|
||||
[[183, "imgui.lua"], [21603, "imgui_demo.lua"], [33455, "imgui_draw.lua"], [40964, "imgui_h.lua"], [43870, "imgui_impl_love.lua"], [44410, "imgui_internal.lua"], [48120, "imgui_tables.lua"], [53179, "imgui_widgets.lua"], [65155, "imstb_rectpack.lua"], [65819, "imstb_textedit.lua"], [67361, "imstb_truetype.lua"], [70149, "imstd_minstdio.lua"]]
|
||||
+101
-115
@@ -10641,7 +10641,7 @@ local function RenderWindowOuterBorders(window)
|
||||
|
||||
if g.Style.FrameBorderSize > 0 and (bit32.band(window.Flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) == 0) and not window.DockIsActive then
|
||||
local y = window.Pos.y + window.TitleBarHeight - 1
|
||||
window.DrawList:AddLineH(window.Pos.x + border_size * 0.5, window.Pos.x + window.Size.x - border_size * 0.5, y, border_col, g.Style.FrameBorderSize)
|
||||
window.DrawList:AddLineH(window.Pos.x + border_size, window.Pos.x + window.Size.x - border_size, y, border_col, g.Style.FrameBorderSize, 393216 --[[ImDrawFlags.StrokeCenterBiased]])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10722,7 +10722,7 @@ local function RenderWindowDecorations(window, title_bar_rect, title_bar_is_high
|
||||
menu_bar_rect:ClipWith(window:Rect()) -- Soft clipping, in particular child window don't have minimum size covering the menu bar so this is useful for them.
|
||||
window.DrawList:AddRectFilled(menu_bar_rect.Min, menu_bar_rect.Max, ImGui.GetColorU32(13 --[[ImGuiCol.MenuBarBg]]), (bit32.band(flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) ~= 0) and window_rounding or 0.0, 48 --[[ImDrawFlags.RoundTop]])
|
||||
if style.FrameBorderSize > 0.0 and menu_bar_rect.Max.y < window.Pos.y + window.Size.y then
|
||||
window.DrawList:AddLineH(menu_bar_rect.Min.x + window_border_size * 0.5, menu_bar_rect.Max.x - window_border_size * 0.5, menu_bar_rect.Max.y, ImGui.GetColorU32(5 --[[ImGuiCol.Border]]), style.FrameBorderSize)
|
||||
window.DrawList:AddLineH(menu_bar_rect.Min.x + window_border_size, menu_bar_rect.Max.x - window_border_size, menu_bar_rect.Max.y, ImGui.GetColorU32(5 --[[ImGuiCol.Border]]), style.FrameBorderSize, 393216 --[[ImDrawFlags.StrokeCenterBiased]])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19221,7 +19221,7 @@ function ImGui.RenderDimmedBackgrounds()
|
||||
window.DrawList:ChannelsMerge()
|
||||
if window.DrawList.CmdBuffer.Size == 0 then window.DrawList:AddDrawCmd() end
|
||||
window.DrawList:PushClipRect(viewport.Pos, viewport.Pos + viewport.Size)
|
||||
window.DrawList:AddRect(bb.Min, bb.Max, ImGui.GetColorU32(60 --[[ImGuiCol.NavWindowingHighlight]], g.NavWindowingHighlightAlpha), window.WindowRounding, 0, 3.0) -- FIXME-DPI
|
||||
window.DrawList:AddRect(bb.Min, bb.Max, ImGui.GetColorU32(60 --[[ImGuiCol.NavWindowingHighlight]], g.NavWindowingHighlightAlpha), window.WindowRounding, 3.0) -- FIXME-DPI
|
||||
window.DrawList:PopClipRect()
|
||||
end
|
||||
end
|
||||
@@ -20867,8 +20867,7 @@ function ImGui.DebugNodeDrawList(window, viewport, draw_list, label)
|
||||
else
|
||||
local cr = pcmd.ClipRect
|
||||
local open = ImGui.TreeNode(cmd_n, "DrawCmd:%5d tris, Tex %s, ClipRect (%4.0f,%4.0f)-(%4.0f,%4.0f)", math.floor(pcmd.ElemCount / 3), tostring(pcmd.TexRef and (pcmd.TexRef._TexID or pcmd.TexRef._TexData)), cr.x, cr.y, cr.z, cr.w)
|
||||
local function ShowMesh(show_mesh, show_aabb)
|
||||
if not fg_draw_list then return end
|
||||
local function ShowMeshImpl(show_mesh, show_aabb)
|
||||
local clip_rect = ImRect(cr.x, cr.y, cr.z, cr.w)
|
||||
local vtxs_rect = ImRect(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]])
|
||||
local base = pcmd.IdxOffset
|
||||
@@ -20887,6 +20886,12 @@ function ImGui.DebugNodeDrawList(window, viewport, draw_list, label)
|
||||
fg_draw_list:AddRect(ImTrunc(vtxs_rect.Min), ImTrunc(vtxs_rect.Max), IM_COL32(0, 255, 255, 255)) -- In cyan: bounding box of triangles
|
||||
end
|
||||
end
|
||||
local function ShowMesh(show_mesh, show_aabb) -- DebugNodeDrawCmdShowMeshAndBoundingBox()
|
||||
if not fg_draw_list then return end
|
||||
fg_draw_list:PushDrawFlag(8192 --[[ImDrawFlags.AALines]], false) -- Disable AA on triangle outlines is more readable for very large and thin triangles.
|
||||
ShowMeshImpl(show_mesh, show_aabb)
|
||||
fg_draw_list:PopDrawFlag()
|
||||
end
|
||||
if ImGui.IsItemHovered() and (cfg.ShowDrawCmdMesh or cfg.ShowDrawCmdBoundingBoxes) then ShowMesh(cfg.ShowDrawCmdMesh, cfg.ShowDrawCmdBoundingBoxes) end
|
||||
if open then
|
||||
ImGui.Selectable(string.format("Mesh: ElemCount: %d, VtxOffset: +%d, IdxOffset: +%d", pcmd.ElemCount, pcmd.VtxOffset, pcmd.IdxOffset))
|
||||
@@ -20915,8 +20920,8 @@ function ImGui.DebugNodeTabBar(tab_bar, label)
|
||||
if is_active and ImGui.IsItemHovered() then
|
||||
local dl = FG(tab_bar.Window)
|
||||
dl:AddRect(tab_bar.BarRect.Min, tab_bar.BarRect.Max, IM_COL32(255, 255, 0, 255))
|
||||
dl:AddLine(ImVec2(tab_bar.ScrollingRectMinX, tab_bar.BarRect.Min.y), ImVec2(tab_bar.ScrollingRectMinX, tab_bar.BarRect.Max.y), IM_COL32(0, 255, 0, 255))
|
||||
dl:AddLine(ImVec2(tab_bar.ScrollingRectMaxX, tab_bar.BarRect.Min.y), ImVec2(tab_bar.ScrollingRectMaxX, tab_bar.BarRect.Max.y), IM_COL32(0, 255, 0, 255))
|
||||
dl:AddLineV(tab_bar.ScrollingRectMinX, tab_bar.BarRect.Min.y, tab_bar.BarRect.Max.y, IM_COL32(0, 255, 0, 255))
|
||||
dl:AddLineV(tab_bar.ScrollingRectMaxX, tab_bar.BarRect.Min.y, tab_bar.BarRect.Max.y, IM_COL32(0, 255, 0, 255))
|
||||
end
|
||||
if open then
|
||||
for tab_n, tab in tab_bar.Tabs:iter() do
|
||||
@@ -40606,7 +40611,7 @@ function ImGui.RenderCheckMark(draw_list, pos, col, sz)
|
||||
draw_list:PathLineTo(p)
|
||||
p.x = bx + third * 2.0; p.y = by - third * 2.0
|
||||
draw_list:PathLineTo(p)
|
||||
draw_list:PathStroke(col, thickness)
|
||||
draw_list:PathStroke(col, thickness, 16384 --[[ImDrawFlags.AALineEnds]])
|
||||
end
|
||||
|
||||
-- Render an arrow. 'pos' is position of the arrow tip. half_sz.x is length from base to tip. half_sz.y is length on each side.
|
||||
@@ -40692,7 +40697,7 @@ function ImGui.RenderRectFilledInRangeH(draw_list, rect, col, fill_x0, fill_x1,
|
||||
end
|
||||
end
|
||||
|
||||
draw_list:PathFillConvex(col)
|
||||
draw_list:PathFillConvex(col, 1024 --[[ImDrawFlags.JoinMiter]])
|
||||
end
|
||||
|
||||
--- @param r_in ImRect
|
||||
@@ -40726,16 +40731,16 @@ end
|
||||
-- Helper for ColorPicker4()
|
||||
-- NB: This is rather brittle and will show artifact when rounding this enabled if rounded corners overlap multiple cells. Caller currently responsible for avoiding that.
|
||||
-- Spent a non reasonable amount of time trying to getting this right for ColorButton with rounding+anti-aliasing+ImGuiColorEditFlags_HalfAlphaPreview flag + various grid sizes and offsets, and eventually gave up... probably more reasonable to disable rounding altogether.
|
||||
-- FIXME: uses ImGui.GetColorU32
|
||||
--- @param draw_list ImDrawList
|
||||
--- @param p_min ImVec2
|
||||
--- @param p_max ImVec2
|
||||
--- @param col ImU32
|
||||
--- @param alpha float
|
||||
--- @param grid_step float
|
||||
--- @param grid_off ImVec2
|
||||
--- @param rounding? float
|
||||
--- @param flags? ImDrawFlags
|
||||
function ImGui.RenderColorRectWithAlphaCheckerboard(draw_list, p_min, p_max, col, grid_step, grid_off, rounding, flags)
|
||||
function ImGui.RenderColorRectWithAlphaCheckerboard(draw_list, p_min, p_max, col, alpha, grid_step, grid_off, rounding, flags)
|
||||
if rounding == nil then rounding = 0.0 end
|
||||
if flags == nil then flags = 0 end
|
||||
|
||||
@@ -40744,60 +40749,53 @@ function ImGui.RenderColorRectWithAlphaCheckerboard(draw_list, p_min, p_max, col
|
||||
end
|
||||
|
||||
if bit32.rshift(bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]), 24 --[[IM_COL32_A_SHIFT]]) < 0xFF then
|
||||
local col_bg1 = ImGui.GetColorU32(ImStd.ImAlphaBlendColors(IM_COL32(128, 128, 128, 255), col), nil, true)
|
||||
local col_bg2 = ImGui.GetColorU32(ImStd.ImAlphaBlendColors(IM_COL32(204, 204, 204, 255), col), nil, true)
|
||||
draw_list:AddRectFilled(p_min, p_max, col_bg1, rounding, flags)
|
||||
assert(alpha >= 0.0 and alpha <= 1.0)
|
||||
local a_mask = bit32.lshift(ImTrunc(alpha * 255.0), 24 --[[IM_COL32_A_SHIFT]])
|
||||
local col_bg1 = bit32.bor(bit32.band(ImStd.ImAlphaBlendColors(IM_COL32(128, 128, 128, 255), col), bit32.bnot(4278190080 --[[IM_COL32_A_MASK]])), a_mask)
|
||||
local col_bg2 = bit32.bor(bit32.band(ImStd.ImAlphaBlendColors(IM_COL32(204, 204, 204, 255), col), bit32.bnot(4278190080 --[[IM_COL32_A_MASK]])), a_mask)
|
||||
local dual_layer = (alpha == 1.0) -- Dual layer is faster but incorrect if blending.
|
||||
if dual_layer then
|
||||
draw_list:AddRectFilled(p_min, p_max, col_bg1, rounding, flags)
|
||||
end
|
||||
|
||||
local yi = 0
|
||||
local y = p_min.y + grid_off.y
|
||||
local x_start
|
||||
local x
|
||||
local cell_flags
|
||||
while y < p_max.y do
|
||||
repeat
|
||||
local y1 = ImClamp(y, p_min.y, p_max.y)
|
||||
local y2 = ImMin(y + grid_step, p_max.y)
|
||||
local y1 = ImClamp(ImTrunc(y), p_min.y, p_max.y)
|
||||
local y2 = ImMin(ImTrunc(y + grid_step), p_max.y)
|
||||
if y2 > y1 then
|
||||
local x_start_off = dual_layer and (((yi + 1) % 2) * grid_step) or 0.0
|
||||
local x_step = dual_layer and (grid_step * 2.0) or grid_step
|
||||
local xi = 0
|
||||
local x = p_min.x + grid_off.x + x_start_off
|
||||
while x < p_max.x do
|
||||
local x1 = ImClamp(ImTrunc(x), p_min.x, p_max.x)
|
||||
local x2 = ImMin(ImTrunc(x + grid_step), p_max.x)
|
||||
if x2 > x1 then
|
||||
local cell_flags = 256 --[[ImDrawFlags.RoundNone]] -- FIXME: Could use CalcRoundingFlagsForRectInRect()
|
||||
if y1 <= p_min.y then
|
||||
if x1 <= p_min.x then cell_flags = bit32.bor(cell_flags, 16 --[[ImDrawFlags.RoundTopLeft]]) end
|
||||
if x2 >= p_max.x then cell_flags = bit32.bor(cell_flags, 32 --[[ImDrawFlags.RoundTopRight]]) end
|
||||
end
|
||||
if y2 >= p_max.y then
|
||||
if x1 <= p_min.x then cell_flags = bit32.bor(cell_flags, 64 --[[ImDrawFlags.RoundBottomLeft]]) end
|
||||
if x2 >= p_max.x then cell_flags = bit32.bor(cell_flags, 128 --[[ImDrawFlags.RoundBottomRight]]) end
|
||||
end
|
||||
|
||||
if y2 <= y1 then
|
||||
break
|
||||
-- Combine flags
|
||||
if flags == 256 --[[ImDrawFlags.RoundNone]] or cell_flags == 256 --[[ImDrawFlags.RoundNone]] then
|
||||
cell_flags = 256 --[[ImDrawFlags.RoundNone]]
|
||||
else
|
||||
cell_flags = bit32.band(cell_flags, flags)
|
||||
end
|
||||
local col_bg
|
||||
if dual_layer then col_bg = col_bg2 elseif (yi + xi) % 2 == 1 then col_bg = col_bg2 else col_bg = col_bg1 end
|
||||
draw_list:AddRectFilled(ImVec2(x1, y1), ImVec2(x2, y2), col_bg, rounding, cell_flags)
|
||||
end
|
||||
x = x + x_step
|
||||
xi = xi + 1
|
||||
end
|
||||
end
|
||||
|
||||
x_start = p_min.x + grid_off.x + ((yi + 1) % 2) * grid_step
|
||||
x = x_start
|
||||
while x < p_max.x do
|
||||
repeat
|
||||
local x1 = ImClamp(x, p_min.x, p_max.x)
|
||||
local x2 = ImMin(x + grid_step, p_max.x)
|
||||
|
||||
if x2 <= x1 then
|
||||
break
|
||||
end
|
||||
|
||||
cell_flags = 256 --[[ImDrawFlags.RoundNone]] -- FIXME: Could use CalcRoundingFlagsForRectInRect()
|
||||
if y1 <= p_min.y then
|
||||
if x1 <= p_min.x then cell_flags = bit32.bor(cell_flags, 16 --[[ImDrawFlags.RoundTopLeft]]) end
|
||||
if x2 >= p_max.x then cell_flags = bit32.bor(cell_flags, 32 --[[ImDrawFlags.RoundTopRight]]) end
|
||||
end
|
||||
if y2 >= p_max.y then
|
||||
if x1 <= p_min.x then cell_flags = bit32.bor(cell_flags, 64 --[[ImDrawFlags.RoundBottomLeft]]) end
|
||||
if x2 >= p_max.x then cell_flags = bit32.bor(cell_flags, 128 --[[ImDrawFlags.RoundBottomRight]]) end
|
||||
end
|
||||
|
||||
-- Combine flags
|
||||
if flags == 256 --[[ImDrawFlags.RoundNone]] or cell_flags == 256 --[[ImDrawFlags.RoundNone]] then
|
||||
cell_flags = 256 --[[ImDrawFlags.RoundNone]]
|
||||
else
|
||||
cell_flags = bit32.band(cell_flags, flags)
|
||||
end
|
||||
draw_list:AddRectFilled(ImVec2(x1, y1), ImVec2(x2, y2), col_bg2, rounding, cell_flags)
|
||||
|
||||
until true
|
||||
|
||||
x = x + grid_step * 2.0
|
||||
end
|
||||
|
||||
until true
|
||||
|
||||
y = y + grid_step
|
||||
yi = yi + 1
|
||||
end
|
||||
@@ -46919,6 +46917,7 @@ function ImGuiContext(shared_font_atlas) -- TODO: tidy up / complete this struct
|
||||
|
||||
DisabledAlphaBackup = 0.0, -- Backup for style.Alpha for BeginDisabled()
|
||||
DisabledStackSize = 0,
|
||||
MixedValueLabel = "-", -- Value replacement when displaying a mixed value.
|
||||
|
||||
ItemFlagsStack = ImVector(), -- Stack for PushItemFlag()/PopItemFlag() - inherited by Begin()
|
||||
GroupStack = ImVector(), -- Stack for BeginGroup()/EndGroup() - not inherited by Begin()
|
||||
@@ -54113,7 +54112,7 @@ function ImGui.CloseButton(id, pos)
|
||||
window.DrawList:AddRectFilled(bb.Min, bb.Max, bg_col)
|
||||
end
|
||||
|
||||
local cross_center = bb:GetCenter() - ImVec2(0.5, 0.5)
|
||||
local cross_center = bb:GetCenter()
|
||||
local cross_extent = g.FontSize * 0.5 * 0.7071 - 1
|
||||
local cross_col = ImGui.GetColorU32(0 --[[ImGuiCol.Text]])
|
||||
local cross_thickness = 1.0 -- FIXME-DPI
|
||||
@@ -54123,32 +54122,6 @@ function ImGui.CloseButton(id, pos)
|
||||
return pressed
|
||||
end
|
||||
|
||||
--- @return bool
|
||||
function ImGui.CollapseButton(id, pos)
|
||||
local g = GImGui
|
||||
|
||||
local window = g.CurrentWindow
|
||||
|
||||
local bb = ImRect(pos, pos + ImVec2(g.FontSize, g.FontSize))
|
||||
|
||||
local is_clipped = not ImGui.ItemAdd(bb, id)
|
||||
|
||||
local pressed, hovered = ImGui.ButtonBehavior(bb, id)
|
||||
|
||||
-- Render
|
||||
if hovered then
|
||||
window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(23 --[[ImGuiCol.ButtonHovered]]))
|
||||
end
|
||||
|
||||
if window.Collapsed then
|
||||
ImGui.RenderArrow(window.DrawList, bb.Min, ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), 1 --[[ImGuiDir.Right]], 1)
|
||||
else
|
||||
ImGui.RenderArrow(window.DrawList, bb.Min, ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), 3 --[[ImGuiDir.Down]], 1)
|
||||
end
|
||||
|
||||
return pressed
|
||||
end
|
||||
|
||||
--- @param window ImGuiWindow
|
||||
--- @param axis ImGuiAxis
|
||||
--- @return ImGuiID
|
||||
@@ -55053,7 +55026,7 @@ function ImGui.SeparatorTextEx(id, label, label_end, extra_w)
|
||||
|
||||
local sep1_x1 = pos.x
|
||||
local sep2_x2 = bb.Max.x
|
||||
local seps_y = ImTrunc((bb.Min.y + bb.Max.y) * 0.5 + 0.999)
|
||||
local seps_y = ImTrunc((bb.Min.y + bb.Max.y) * 0.5) + 1.0
|
||||
|
||||
local label_avail_w = ImMax(0.0, sep2_x2 - sep1_x1 - padding.x * 2.0)
|
||||
local label_pos = ImVec2(pos.x + padding.x + ImMax(0.0, (label_avail_w - label_size.x - extra_w) * style.SeparatorTextAlign.x), pos.y + text_baseline_y) -- FIXME-ALIGN
|
||||
@@ -55068,11 +55041,11 @@ function ImGui.SeparatorTextEx(id, label, label_end, extra_w)
|
||||
local sep2_x1 = label_pos.x + label_size.x + extra_w + style.ItemSpacing.x
|
||||
|
||||
if sep1_x2 > sep1_x1 and separator_thickness > 0.0 then
|
||||
window.DrawList:AddLineH(sep1_x1, sep1_x2, seps_y, separator_col, separator_thickness)
|
||||
window.DrawList:AddLineH(sep1_x1, sep1_x2, seps_y, separator_col, separator_thickness, 393216 --[[ImDrawFlags.StrokeCenterBiased]])
|
||||
end
|
||||
|
||||
if sep2_x2 > sep2_x1 and separator_thickness > 0.0 then
|
||||
window.DrawList:AddLineH(sep2_x1, sep2_x2, seps_y, separator_col, separator_thickness)
|
||||
window.DrawList:AddLineH(sep2_x1, sep2_x2, seps_y, separator_col, separator_thickness, 393216 --[[ImDrawFlags.StrokeCenterBiased]])
|
||||
end
|
||||
|
||||
if g.LogEnabled then
|
||||
@@ -55086,7 +55059,7 @@ function ImGui.SeparatorTextEx(id, label, label_end, extra_w)
|
||||
end
|
||||
|
||||
if separator_thickness > 0.0 then
|
||||
window.DrawList:AddLineH(sep1_x1, sep2_x2, seps_y, separator_col, separator_thickness)
|
||||
window.DrawList:AddLineH(sep1_x1, sep2_x2, seps_y, separator_col, separator_thickness, 393216 --[[ImDrawFlags.StrokeCenterBiased]])
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -59415,10 +59388,10 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback
|
||||
local cursor_is_visible = (not g.IO.ConfigInputTextCursorBlink) or (state.CursorAnim <= 0.0) or (ImFmod(state.CursorAnim, 1.20) <= 0.80)
|
||||
|
||||
local cursor_screen_pos = ImTrunc(draw_pos + cursor_offset - draw_scroll)
|
||||
local cursor_screen_rect = ImRect(cursor_screen_pos.x, cursor_screen_pos.y - g.FontSize + 0.5, cursor_screen_pos.x + 1.0, cursor_screen_pos.y - 1.5)
|
||||
local cursor_screen_rect = ImRect(cursor_screen_pos.x, cursor_screen_pos.y - g.FontSize + 1.0, cursor_screen_pos.x + 1.0, cursor_screen_pos.y - 1.0)
|
||||
|
||||
if cursor_is_visible and cursor_screen_rect:Overlaps(clip_rect) then
|
||||
draw_window.DrawList:AddLineV(cursor_screen_rect.Min.x, cursor_screen_rect.Min.y, cursor_screen_rect.Max.y, ImGui.GetColorU32(34 --[[ImGuiCol.InputTextCursor]]), style.InputTextCursorSize)
|
||||
draw_window.DrawList:AddLineV(cursor_screen_rect.Min.x, cursor_screen_rect.Min.y, cursor_screen_rect.Max.y, ImGui.GetColorU32(34 --[[ImGuiCol.InputTextCursor]]), style.InputTextCursorSize, 131072 --[[ImDrawFlags.StrokeInside]])
|
||||
end
|
||||
|
||||
-- Notify OS of text input position for advanced IME (-1 x offset so that Windows IME can cover our cursor. Bit of an extra nicety.)
|
||||
@@ -60296,7 +60269,7 @@ function ImGui.ColorPicker4(label, col, flags, ref_col)
|
||||
if alpha_bar then
|
||||
local alpha = ImSaturate(col[4])
|
||||
local bar1_bb = ImRect(bar1_pos_x, picker_pos.y, bar1_pos_x + bars_width, picker_pos.y + sv_picker_size)
|
||||
ImGui.RenderColorRectWithAlphaCheckerboard(draw_list, bar1_bb.Min, bar1_bb.Max, 0, bar1_bb:GetWidth() / 2.0, ImVec2(0.0, 0.0))
|
||||
ImGui.RenderColorRectWithAlphaCheckerboard(draw_list, bar1_bb.Min, bar1_bb.Max, IM_COL32(0, 0, 0, 0), style.Alpha, bar1_bb:GetWidth() / 2.0, ImVec2(0.0, 0.0))
|
||||
draw_list:AddRectFilledMultiColor(bar1_bb.Min, bar1_bb.Max, user_col32_striped_of_alpha, user_col32_striped_of_alpha, bit32.band(user_col32_striped_of_alpha, bit32.bnot(4278190080 --[[IM_COL32_A_MASK]])), bit32.band(user_col32_striped_of_alpha, bit32.bnot(4278190080 --[[IM_COL32_A_MASK]])))
|
||||
|
||||
local bar1_line_y = IM_ROUND(picker_pos.y + (1.0 - alpha) * sv_picker_size)
|
||||
@@ -60374,36 +60347,45 @@ function ImGui.ColorButton(desc_id, col, flags, size_arg)
|
||||
local col_rgb_without_alpha = ImVec4(col_rgb.x, col_rgb.y, col_rgb.z, 1.0)
|
||||
local grid_step = ImMin(size.x, size.y) / 2.99
|
||||
local rounding = ImMin(g.Style.FrameRounding, grid_step * 0.5)
|
||||
local bb_inner = ImRect()
|
||||
ImRect_Copy(bb_inner, bb)
|
||||
local off = 0.0
|
||||
if bit32.band(flags, 1024 --[[ImGuiColorEditFlags.NoBorder]]) == 0 then
|
||||
off = -0.75
|
||||
bb_inner:Expand(off)
|
||||
local is_mixed = bit32.band(g.LastItemData.ItemFlags, 4096 --[[ImGuiItemFlags.MixedValue]]) ~= 0
|
||||
|
||||
local backup_alpha = g.Style.Alpha
|
||||
if g.DisabledStackSize > 0 then
|
||||
g.Style.Alpha = g.DisabledAlphaBackup -- Cancel out effect of BeginDisabled() for color swatches.
|
||||
end
|
||||
if bit32.band(flags, 16384 --[[ImGuiColorEditFlags.AlphaPreviewHalf]]) ~= 0 and col_rgb.w < 1.0 then
|
||||
local mid_x = IM_ROUND((bb_inner.Min.x + bb_inner.Max.x) * 0.5)
|
||||
if bit32.band(flags, 8192 --[[ImGuiColorEditFlags.AlphaNoBg]]) == 0 then
|
||||
ImGui.RenderColorRectWithAlphaCheckerboard(window.DrawList, ImVec2(bb_inner.Min.x + grid_step, bb_inner.Min.y), bb_inner.Max, ImGui.GetColorU32(col_rgb), grid_step, ImVec2(-grid_step + off, off), rounding, 160 --[[ImDrawFlags.RoundRight]])
|
||||
else
|
||||
window.DrawList:AddRectFilled(ImVec2(bb_inner.Min.x + grid_step, bb_inner.Min.y), bb_inner.Max, ImGui.GetColorU32(col_rgb), rounding, 160 --[[ImDrawFlags.RoundRight]])
|
||||
if is_mixed then
|
||||
window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(7 --[[ImGuiCol.FrameBg]]), rounding)
|
||||
ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], g.Style.Colors[1 --[[ImGuiCol.TextDisabled]]]) -- ImGuiCol_TextMixedValue
|
||||
if g.MixedValueLabel ~= nil then
|
||||
ImGui.RenderTextClipped(ImVec2(bb.Min.x, bb.Min.y + g.Style.FramePadding.y), bb.Max, g.MixedValueLabel, nil, nil, ImVec2(0.5, 0.0))
|
||||
end
|
||||
window.DrawList:AddRectFilled(bb_inner.Min, ImVec2(mid_x, bb_inner.Max.y), ImGui.GetColorU32(col_rgb_without_alpha), rounding, 80 --[[ImDrawFlags.RoundLeft]])
|
||||
ImGui.PopStyleColor()
|
||||
elseif bit32.band(flags, 16384 --[[ImGuiColorEditFlags.AlphaPreviewHalf]]) ~= 0 and col_rgb.w < 1.0 then
|
||||
local mid_x = IM_ROUND((bb.Min.x + bb.Max.x) * 0.5)
|
||||
if bit32.band(flags, 8192 --[[ImGuiColorEditFlags.AlphaNoBg]]) == 0 then
|
||||
ImGui.RenderColorRectWithAlphaCheckerboard(window.DrawList, ImVec2(bb.Min.x + grid_step, bb.Min.y), bb.Max, ImGui.ColorConvertFloat4ToU32(col_rgb), g.Style.Alpha, grid_step, ImVec2(-grid_step, 0.0), rounding, 160 --[[ImDrawFlags.RoundRight]])
|
||||
else
|
||||
window.DrawList:AddRectFilled(ImVec2(bb.Min.x + grid_step, bb.Min.y), bb.Max, ImGui.GetColorU32(col_rgb), rounding, 160 --[[ImDrawFlags.RoundRight]])
|
||||
end
|
||||
window.DrawList:AddRectFilled(bb.Min, ImVec2(mid_x, bb.Max.y), ImGui.GetColorU32(col_rgb_without_alpha), rounding, 80 --[[ImDrawFlags.RoundLeft]])
|
||||
else
|
||||
-- Because GetColorU32() multiplies by the global style Alpha and we don't want to display a checkerboard if the source code had no alpha
|
||||
local col_source = (bit32.band(flags, 4096 --[[ImGuiColorEditFlags.AlphaOpaque]]) ~= 0) and col_rgb_without_alpha or col_rgb
|
||||
if col_source.w < 1.0 and bit32.band(flags, 8192 --[[ImGuiColorEditFlags.AlphaNoBg]]) == 0 then
|
||||
ImGui.RenderColorRectWithAlphaCheckerboard(window.DrawList, bb_inner.Min, bb_inner.Max, ImGui.GetColorU32(col_source), grid_step, ImVec2(off, off), rounding)
|
||||
ImGui.RenderColorRectWithAlphaCheckerboard(window.DrawList, bb.Min, bb.Max, ImGui.ColorConvertFloat4ToU32(col_source), g.Style.Alpha, grid_step, ImVec2(0.0, 0.0), rounding)
|
||||
else
|
||||
window.DrawList:AddRectFilled(bb_inner.Min, bb_inner.Max, ImGui.GetColorU32(col_source), rounding)
|
||||
window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(col_source), rounding)
|
||||
end
|
||||
end
|
||||
if g.DisabledStackSize > 0 then
|
||||
g.Style.Alpha = backup_alpha
|
||||
end
|
||||
ImGui.RenderNavCursor(bb, id)
|
||||
if bit32.band(flags, 1024 --[[ImGuiColorEditFlags.NoBorder]]) == 0 then
|
||||
if g.Style.FrameBorderSize > 0.0 then
|
||||
ImGui.RenderFrameBorder(bb.Min, bb.Max, rounding)
|
||||
else
|
||||
window.DrawList:AddRect(bb.Min, bb.Max, ImGui.GetColorU32(7 --[[ImGuiCol.FrameBg]]), rounding) -- Color buttons are often in need of some sort of border
|
||||
window.DrawList:AddRect(bb.Min, bb.Max, ImGui.GetColorU32(7 --[[ImGuiCol.FrameBg]]), rounding, 1.0 * ImTrunc(g.Style._MainScale)) -- Color buttons are often in need of some sort of border -- FIXME-DPI
|
||||
end
|
||||
end
|
||||
|
||||
@@ -61086,23 +61068,27 @@ function ImGui.TreeNodeDrawLineToChildNode(target_pos)
|
||||
|
||||
-- FIXME: Could this be simplified using new stroke flags?
|
||||
local parent_data = g.TreeNodeStack.Data[g.TreeNodeStack.Size]
|
||||
local x1 = ImTrunc(parent_data.DrawLinesX1)
|
||||
local half_size = g.Style.TreeLinesSize * 0.5
|
||||
local x1 = ImTrunc(parent_data.DrawLinesX1 - half_size) + half_size -- Draw line centered at X1, but snap to pixels boundary.
|
||||
local x2 = ImTrunc(target_pos.x - g.Style.ItemInnerSpacing.x)
|
||||
local y = ImTrunc(target_pos.y)
|
||||
local y = ImTrunc(target_pos.y - half_size) + half_size
|
||||
local rounding = (g.Style.TreeLinesRounding > 0.0) and ImMin(x2 - x1, g.Style.TreeLinesRounding) or 0.0
|
||||
parent_data.DrawLinesToNodesY2 = ImMax(parent_data.DrawLinesToNodesY2, y - rounding)
|
||||
if x1 >= x2 then
|
||||
return
|
||||
end
|
||||
if rounding > 0.0 then
|
||||
x1 = x1 + 0.5 + rounding
|
||||
if rounding > 0.0 and rounding > half_size then
|
||||
x1 = x1 + rounding
|
||||
window.DrawList:PathArcToFast(ImVec2(x1, y - rounding), rounding, 6, 3)
|
||||
if x1 < x2 then
|
||||
window.DrawList:PathLineTo(ImVec2(x2, y))
|
||||
end
|
||||
window.DrawList:PathStroke(ImGui.GetColorU32(55 --[[ImGuiCol.TreeLines]]), g.Style.TreeLinesSize)
|
||||
else
|
||||
window.DrawList:AddLineH(x1, x2, y, ImGui.GetColorU32(55 --[[ImGuiCol.TreeLines]]), g.Style.TreeLinesSize)
|
||||
-- We use AddLine() instead of AddLineH() as we provide coordinates for line center,
|
||||
-- in order to make the code use same coordinates for both rounded and non-rounded version. (FIXME-OPT)
|
||||
x1 = x1 + half_size -- Avoid overdraw
|
||||
window.DrawList:AddLine(ImVec2(x1, y), ImVec2(x2, y), ImGui.GetColorU32(55 --[[ImGuiCol.TreeLines]]), g.Style.TreeLinesSize)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -65084,7 +65070,7 @@ function ImGui.TabItemBackground(draw_list, bb, flags, col)
|
||||
draw_list:PathArcToFast(ImVec2(bb.Min.x + rounding, y1 + rounding), rounding, 6, 9)
|
||||
draw_list:PathArcToFast(ImVec2(bb.Max.x - rounding, y1 + rounding), rounding, 9, 12)
|
||||
draw_list:PathLineTo(ImVec2(bb.Max.x, y2))
|
||||
draw_list:PathStroke(ImGui.GetColorU32(5 --[[ImGuiCol.Border]]), g.Style.TabBorderSize)
|
||||
draw_list:PathStroke(ImGui.GetColorU32(5 --[[ImGuiCol.Border]]), g.Style.TabBorderSize, 393216 --[[ImDrawFlags.StrokeCenterBiased]]) -- Use _StrokeInside?
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user