From 15dc766d82ad2cece55ca21892e0b4efcdd11a34 Mon Sep 17 00:00:00 2001 From: 4DBug <4DBug@github.com> Date: Thu, 15 Oct 2026 00:23:20 -0500 Subject: [PATCH] bundle.py: build-time Luau optimizations (draw-data identical; IMGUI_BUNDLE_NOOPT=1 disables): hot library globals as bundle locals, enum/constant folding (values dumped by the luau CLI; IMGUI_BUNDLE_STRICT=1 in CI), --@hoist pure helpers to inlinable bundle-level local functions, statement IM_ASSERT -> assert; builtin type instead of ImGui._GetTypeFunc() alias (GETGLOBAL 15903 -> 540) --- .github/workflows/release.yml | 2 + build/ImGui.linemap.json | 2 +- build/ImGui.luau | 8555 +++++++++++++++++---------------- build/imgui_love.linemap.json | 2 +- build/imgui_love.lua | 8523 ++++++++++++++++---------------- imgui_h.lua | 5 +- imgui_internal.lua | 10 +- tools/bundle.py | 236 +- 8 files changed, 8820 insertions(+), 8515 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 175c83b..57127d0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,6 +30,8 @@ jobs: unzip -q luau.zip -d luau && chmod +x luau/* && echo "$PWD/luau" >> "$GITHUB_PATH" - name: Build + env: + IMGUI_BUNDLE_STRICT: "1" # fail if enum folding (needs the luau CLI above) can't run run: | mkdir -p dist python3 tools/bundle.py dist/roblox # ImGui.luau (library + demo) diff --git a/build/ImGui.linemap.json b/build/ImGui.linemap.json index 7e9fe7d..a705ed0 100644 --- a/build/ImGui.linemap.json +++ b/build/ImGui.linemap.json @@ -1 +1 @@ -[[12, "imgui.lua"], [21355, "imgui_demo.lua"], [29773, "imgui_draw.lua"], [35711, "imgui_h.lua"], [38377, "imgui_impl_roblox.lua"], [40024, "imgui_impl_roblox_fonts.lua"], [46427, "imgui_internal.lua"], [49888, "imgui_tables.lua"], [54947, "imgui_widgets.lua"], [65587, "imstb_rectpack.lua"], [66251, "imstb_textedit.lua"], [67793, "imstb_truetype.lua"], [70581, "imstd_minstdio.lua"]] \ No newline at end of file +[[46, "imgui.lua"], [21389, "imgui_demo.lua"], [29807, "imgui_draw.lua"], [35745, "imgui_h.lua"], [38412, "imgui_impl_roblox.lua"], [40059, "imgui_impl_roblox_fonts.lua"], [46462, "imgui_internal.lua"], [49931, "imgui_tables.lua"], [54990, "imgui_widgets.lua"], [65630, "imstb_rectpack.lua"], [66294, "imstb_textedit.lua"], [67836, "imstb_truetype.lua"], [70624, "imstd_minstdio.lua"]] \ No newline at end of file diff --git a/build/ImGui.luau b/build/ImGui.luau index ad1c1f2..9c6694b 100644 --- a/build/ImGui.luau +++ b/build/ImGui.luau @@ -1,6 +1,40 @@ --!optimize 2 -- GENERATED by tools/bundle.py from *.lua, backends/, fonts/ - do not edit +local ImGui, ImVec2, ImVec4, ImRect, ImVec2_Copy, ImStd, ImVector, HelpMarker, IMGUI_DEMO_MARKER, ImGuiInputFlags, ImRect_Copy, ImGuiDataType, ImStb, IM_TRUNC, ImGuiKey, ImGuiStyleVarInfo, ImVec2_CopyV, IM_ASSERT_USER_ERROR, ImGuiHoveredFlags, ImFormatString, ImHashStr, ImS32, ImGuiColorEditFlags, IM_ASSERT_USER_ERROR_RET, ImDrawFlags, ImGuiTableFlags, ImIsPowerOfTwo, ImGuiWindowFlags, ImVec4_Copy, IM_ROUND, ImGuiTreeNodeFlags, ImGuiTableColumnFlags, ImU16, ImAbs, ImGuiItemFlags, ImGui_ImplRoblox_GetBackendData, stbte, ImGuiButtonFlags, ImGuiDebugLogFlags, ImGuiLocKey, ImU32, ImCos, ImGuiTabBarFlags, ImS16, ImSin, ImUpperPowerOfTwo, ImVec2_MulVX, IM_F32_TO_INT8_SAT, ImCeil, ImFontAtlasPackGetRect, ImGuiListClipper, DockSettingsRenameNodeReferences, IM_ASSERT_PARANOID, ImGuiCol, ImGuiTextFilter, ImLengthSqr, ImS8, ImU8, _PathArcToFastExXY, ImFabs, ImGuiLastItemData_Copy, ImGuiScrollFlags, ImLog, ImMemchr, ImStrByte, IMGUI_DEBUG_LOG_VIEWPORT, ImGuiComboFlags, ImGuiInputEvent, ImPow, DemoBuf, DemoHas, IMGUI_DEBUG_LOG_FONT, ImAddClampOverflow, ImFontAtlasBuildInit, ImFontCalcWordWrapPositionEx, ImGuiChildFlags, ImGuiLastItemData, ImGuiPayload_IsDataType, ImGuiPopupFlags, ImGuiSliderFlags, ImRotate, ImSubClampOverflow, ImTextClassifierSetCharClass, ImVec2_AddVA, ImVec2_SubVA, CalcNextScrollFromScrollTargetAndClamp, DemoBufStr, DemoNotPorted, IMGUI_PAYLOAD_TYPE_WINDOW, IMGUI_VERSION, ImCharIsSeparatorW, ImFmod, ImFontAtlasBakedAddFontGlyph, ImFontAtlasPackAddRect, ImFontBaked_BuildLoadGlyph, ImGuiInputTextFlags, ImGuiNavMoveFlags, ImGuiTextBuffer, ImHashData, ImVec1_Copy, ShowExampleMenuFile, ExampleTree_CreateNode, IM_F32_TO_INT8_UNBOUND, IM_PI, ImCharIsBlankA, ImCharIsBlankW, ImFontAtlasBuildRenderBitmapFromString, ImFontAtlasFontDestroyOutput, ImFontAtlasFontDiscardBakes, ImFontAtlasFontSourceAddToFont, ImFontAtlasFontSourceInit, ImFontAtlasRectId_GetIndex, ImFontAtlasTextureAdd, ImFontAtlasTextureBlockQueueUpload, ImFontAtlasTextureGrow, ImFontBaked_BuildGrowIndex, ImFontConfig, ImFontGlyph, ImGuiFocusedFlags, ImGuiTabItemFlags, ImGuiTableColumn, ImGuiWindowClass, ImGui_ImplRoblox_RenderDrawData, ImParseFormatFindStart, ImRect_CopyFromV4, ImTextureRect, ImTextureRef, ImTrunc64, stb_textedit_key, stbtt_GetGlyphBitmapBoxSubpixel, DockSettingsHandler_ClearAll, IMGUI_DEBUG_LOG_TABLE, IMGUI_PAYLOAD_TYPE_COLOR_4F, IM_FREE, ImDrawListSplitter, ImFontAtlasBakedDiscard, ImFontAtlasBuildDestroy, ImFontAtlasBuildNotifySetFont, ImFontAtlasBuildSetTexture, ImFontAtlasBuildSetupFontBakedFallback, ImFontAtlasFontDestroySourceData, ImFontAtlasPackInit, ImFontAtlasTextureBlockCopy, ImFontAtlasTextureGetSizeEstimate, ImFontAtlasUpdateDrawListsSharedData, ImFontBaked_BuildLoadGlyphAdvanceX, ImFontCalcTextSizeEx, ImFontCalcWordWrapPositionEx_Uncached, ImGuiDockNodeFlags, ImGuiDragDropFlags, ImGuiFocusScopeData, ImGuiInputTextCallbackData, ImGuiSettingsHandler, ImGuiStyleMod, ImHashStrRaw, ImTextClassifierClear, ImTextClassifierGet, ImTextClassifierSetCharClassFromStr, ImTextureDataGetFormatBytesPerPixel, stb_text_locate_coord +local type, mathMin, mathMax, mathFloor, mathCeil, bitOr, bitLShift = type, math.min, math.max, math.floor, math.ceil, bit32.bor, bit32.lshift +local function IM_COL32(R, G, B, A) return (bitOr(bitLShift(A, 24 --[[IM_COL32_A_SHIFT]]), bitLShift(B, 16 --[[IM_COL32_B_SHIFT]]), bitLShift(G, 8 --[[IM_COL32_G_SHIFT]]), bitLShift(R, 0 --[[IM_COL32_R_SHIFT]]))) end +@native +local function ImMin(lhs, rhs) + if type(lhs) == "number" then return mathMin(lhs, rhs) end + return ImVec2(mathMin(lhs.x, rhs.x), mathMin(lhs.y, rhs.y)) +end +@native +local function ImMax(lhs, rhs) + if type(lhs) == "number" then return mathMax(lhs, rhs) end + return ImVec2(mathMax(lhs.x, rhs.x), mathMax(lhs.y, rhs.y)) +end +@native +local function ImClamp(v, mn, mx) + if type(v) == "number" and type(mn) == "number" and type(mx) == "number" then return mathMin(mathMax(v, mn), mx) + elseif type(v) == "table" and type(mn) == "table" and type(mx) == "table" then return ImVec2(mathMax(mn.x, mathMin(v.x, mx.x)), mathMax(mn.y, mathMin(v.y, mx.y))) + end +end +@native +local function ImLerp(a, b, t) + if type(a) == "number" and type(b) == "number" and type(t) == "number" then return ((a) + ((b) - (a)) * (t)) + elseif type(a) == "table" and type(b) == "table" and type(t) == "number" then return ImVec2(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t) + elseif type(a) == "table" and type(b) == "table" and type(t) == "table" then return ImVec2(a.x + (b.x - a.x) * t.x, a.y + (b.y - a.y) * t.y) + end +end +local function _Trunc(val) if val >= 0 then return mathFloor(val) else return mathCeil(val) end end +local function ImTrunc(v) + if type(v) == "number" then return _Trunc(v) + elseif type(v) == "table" then return ImVec2(_Trunc(v.x), _Trunc(v.y)) + end +end +local function ImFloor(f) if f >= 0 or math.floor(f) == f then return math.floor(f) else return math.floor(f) - 1 end end +local function ImSaturate(f) return ((f < 0.0 and 0.0) or (f > 1.0 and 1.0) or f) end local __FILES, __LOADED = {}, {} function IM_INCLUDE(name) local r = __LOADED[name] @@ -541,10 +575,10 @@ function ImGui.ClearDragDrop() local g = ImGui.GetCurrentContext() g.DragDropActive = false ImGuiPayload_Clear(g.DragDropPayload) - g.DragDropAcceptFlagsCurr = ImGuiDragDropFlags.None + g.DragDropAcceptFlagsCurr = 0 --[[ImGuiDragDropFlags.None]] g.DragDropAcceptIdCurr = 0 g.DragDropAcceptIdPrev = 0 - g.DragDropAcceptIdCurrRectSurface = FLT_MAX + g.DragDropAcceptIdCurrRectSurface = 3.4028234663853e+38 --[[FLT_MAX]] g.DragDropAcceptFrameCount = -1 end @@ -562,12 +596,12 @@ function ImGui.BeginDragDropSource(flags) -- FIXME-DRAGDROP: While in the common-most "drag from non-zero active id" case we can tell the mouse button, -- in both SourceExtern and id==0 cases we may requires something else (explicit flags or some heuristic). - local mouse_button = ImGuiMouseButton.Left + local mouse_button = 0 --[[ImGuiMouseButton.Left]] local source_drag_active = false local source_id = 0 local source_parent_id = 0 - if bit32.band(flags, ImGuiDragDropFlags.SourceExtern) == 0 then + if bit32.band(flags, 16 --[[ImGuiDragDropFlags.SourceExtern]]) == 0 then source_id = g.LastItemData.ID if source_id ~= 0 then -- Common path: items with ID @@ -578,14 +612,14 @@ function ImGui.BeginDragDropSource(flags) else -- Uncommon path: items without ID if g.IO.MouseDown[mouse_button] == false or window.SkipItems then return false end - if bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HoveredRect) == 0 and (g.ActiveId == 0 or g.ActiveIdWindow ~= window) then + if bit32.band(g.LastItemData.StatusFlags, 1 --[[ImGuiItemStatusFlags.HoveredRect]]) == 0 and (g.ActiveId == 0 or g.ActiveIdWindow ~= window) then return false end -- If you want to use BeginDragDropSource() on an item with no unique identifier for interaction, such as Text() or Image(), you need to: -- A) Read the explanation below, B) Use the ImGuiDragDropFlags.SourceAllowNullID flag. - if bit32.band(flags, ImGuiDragDropFlags.SourceAllowNullID) == 0 then - IM_ASSERT(false, "Use ImGuiDragDropFlags.SourceAllowNullID for items without an ID") + if bit32.band(flags, 8 --[[ImGuiDragDropFlags.SourceAllowNullID]]) == 0 then + assert(false, "Use ImGuiDragDropFlags.SourceAllowNullID for items without an ID") return false end @@ -620,12 +654,12 @@ function ImGui.BeginDragDropSource(flags) ImGui.SetActiveID(source_id, nil) end - IM_ASSERT(g.DragDropWithinTarget == false) -- Can't nest BeginDragDropSource() and BeginDragDropTarget() + assert(g.DragDropWithinTarget == false) -- Can't nest BeginDragDropSource() and BeginDragDropTarget() if not source_drag_active then return false end -- Activate drag and drop if not g.DragDropActive then - IM_ASSERT(source_id ~= 0) + assert(source_id ~= 0) ImGui.ClearDragDrop() local payload = g.DragDropPayload payload.SourceId = source_id @@ -638,30 +672,30 @@ function ImGui.BeginDragDropSource(flags) g.DragDropSourceFrameCount = g.FrameCount g.DragDropWithinSource = true - if bit32.band(flags, ImGuiDragDropFlags.SourceNoPreviewTooltip) == 0 then + if bit32.band(flags, 1 --[[ImGuiDragDropFlags.SourceNoPreviewTooltip]]) == 0 then -- Target can request the Source to not display its tooltip (we use a dedicated flag to make this request explicit) -- We unfortunately can't just modify the source flags and skip the call to BeginTooltip, as caller may be emitting contents. local ret - if g.DragDropAcceptIdPrev ~= 0 and bit32.band(g.DragDropAcceptFlagsPrev, ImGuiDragDropFlags.AcceptNoPreviewTooltip) ~= 0 then + if g.DragDropAcceptIdPrev ~= 0 and bit32.band(g.DragDropAcceptFlagsPrev, 4096 --[[ImGuiDragDropFlags.AcceptNoPreviewTooltip]]) ~= 0 then ret = ImGui.BeginTooltipHidden() else ret = ImGui.BeginTooltip() end - IM_ASSERT(ret) -- FIXME-NEWBEGIN: If this ever becomes false, we need to Begin("##Hidden", nil, ImGuiWindowFlags.NoSavedSettings) + SetWindowHiddenAndSkipItemsForCurrentFrame(). + assert(ret) -- FIXME-NEWBEGIN: If this ever becomes false, we need to Begin("##Hidden", nil, ImGuiWindowFlags.NoSavedSettings) + SetWindowHiddenAndSkipItemsForCurrentFrame(). end - if bit32.band(flags, ImGuiDragDropFlags.SourceNoDisableHover) == 0 and bit32.band(flags, ImGuiDragDropFlags.SourceExtern) == 0 then - g.LastItemData.StatusFlags = bit32.band(g.LastItemData.StatusFlags, bit32.bnot(ImGuiItemStatusFlags.HoveredRect)) + if bit32.band(flags, 2 --[[ImGuiDragDropFlags.SourceNoDisableHover]]) == 0 and bit32.band(flags, 16 --[[ImGuiDragDropFlags.SourceExtern]]) == 0 then + g.LastItemData.StatusFlags = bit32.band(g.LastItemData.StatusFlags, bit32.bnot(1 --[[ImGuiItemStatusFlags.HoveredRect]])) end return true end function ImGui.EndDragDropSource() local g = ImGui.GetCurrentContext() - IM_ASSERT(g.DragDropActive) - IM_ASSERT(g.DragDropWithinSource, "Not after a BeginDragDropSource()?") + assert(g.DragDropActive) + assert(g.DragDropWithinSource, "Not after a BeginDragDropSource()?") - if bit32.band(g.DragDropSourceFlags, ImGuiDragDropFlags.SourceNoPreviewTooltip) == 0 then + if bit32.band(g.DragDropSourceFlags, 1 --[[ImGuiDragDropFlags.SourceNoPreviewTooltip]]) == 0 then ImGui.EndTooltip() end @@ -676,14 +710,14 @@ end function ImGui.SetDragDropPayload(type, data, data_size, cond) local g = ImGui.GetCurrentContext() local payload = g.DragDropPayload - if cond == nil or cond == 0 then cond = ImGuiCond.Always end + if cond == nil or cond == 0 then cond = 1 --[[ImGuiCond.Always]] end - IM_ASSERT(type ~= nil) - IM_ASSERT(#type < 32, "Payload type can be at most 32 characters long") - IM_ASSERT(cond == ImGuiCond.Always or cond == ImGuiCond.Once) - IM_ASSERT(payload.SourceId ~= 0) -- Not called between BeginDragDropSource() and EndDragDropSource() + assert(type ~= nil) + assert(#type < 32, "Payload type can be at most 32 characters long") + assert(cond == 1 --[[ImGuiCond.Always]] or cond == 2 --[[ImGuiCond.Once]]) + assert(payload.SourceId ~= 0) -- Not called between BeginDragDropSource() and EndDragDropSource() - if cond == ImGuiCond.Always or payload.DataFrameCount == -1 then + if cond == 1 --[[ImGuiCond.Always]] or payload.DataFrameCount == -1 then -- Copy payload payload.DataType = type payload.Data = data @@ -702,11 +736,11 @@ function ImGui.BeginDragDropTargetCustom(bb, id) local window = g.CurrentWindow local hovered_window = g.HoveredWindowUnderMovingWindow if hovered_window == nil or window.RootWindowDockTree ~= hovered_window.RootWindowDockTree then return false end - IM_ASSERT(id ~= 0) + assert(id ~= 0) if not ImGui.IsMouseHoveringRect(bb.Min, bb.Max) or (id == g.DragDropPayload.SourceId) then return false end if window.SkipItems then return false end - IM_ASSERT(g.DragDropWithinTarget == false and g.DragDropWithinSource == false) -- Can't nest BeginDragDropSource() and BeginDragDropTarget() + assert(g.DragDropWithinTarget == false and g.DragDropWithinSource == false) -- Can't nest BeginDragDropSource() and BeginDragDropTarget() g.DragDropTargetRect = ImRect(bb.Min, bb.Max) g.DragDropTargetClipRect = ImRect(window.ClipRect.Min, window.ClipRect.Max) -- May want to be overridden by user depending on use case? g.DragDropTargetId = id @@ -729,7 +763,7 @@ function ImGui.BeginDragDropTargetViewport(viewport, p_bb) return false end - IM_ASSERT(g.DragDropWithinTarget == false and g.DragDropWithinSource == false) -- Can't nest BeginDragDropSource() and BeginDragDropTarget() + assert(g.DragDropWithinTarget == false and g.DragDropWithinSource == false) -- Can't nest BeginDragDropSource() and BeginDragDropTarget() g.DragDropTargetRect = ImRect(bb.Min, bb.Max) g.DragDropTargetClipRect = ImRect(bb.Min, bb.Max) g.DragDropTargetId = id @@ -747,11 +781,11 @@ function ImGui.BeginDragDropTarget() if not g.DragDropActive then return false end local window = g.CurrentWindow - if bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HoveredRect) == 0 then return false end + if bit32.band(g.LastItemData.StatusFlags, 1 --[[ImGuiItemStatusFlags.HoveredRect]]) == 0 then return false end local hovered_window = g.HoveredWindowUnderMovingWindow if hovered_window == nil or window.RootWindowDockTree ~= hovered_window.RootWindowDockTree or window.SkipItems then return false end - local display_rect = (bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HasDisplayRect) ~= 0) and g.LastItemData.DisplayRect or g.LastItemData.Rect + local display_rect = (bit32.band(g.LastItemData.StatusFlags, 2 --[[ImGuiItemStatusFlags.HasDisplayRect]]) ~= 0) and g.LastItemData.DisplayRect or g.LastItemData.Rect local id = g.LastItemData.ID if id == 0 then id = window:GetIDFromRectangle(display_rect) @@ -759,9 +793,9 @@ function ImGui.BeginDragDropTarget() end if g.DragDropPayload.SourceId == id then return false end - IM_ASSERT(g.DragDropWithinTarget == false and g.DragDropWithinSource == false) -- Can't nest BeginDragDropSource() and BeginDragDropTarget() + assert(g.DragDropWithinTarget == false and g.DragDropWithinSource == false) -- Can't nest BeginDragDropSource() and BeginDragDropTarget() g.DragDropTargetRect = ImRect(display_rect.Min, display_rect.Max) - local clip = (bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HasClipRect) ~= 0) and g.LastItemData.ClipRect or window.ClipRect + local clip = (bit32.band(g.LastItemData.StatusFlags, 512 --[[ImGuiItemStatusFlags.HasClipRect]]) ~= 0) and g.LastItemData.ClipRect or window.ClipRect g.DragDropTargetClipRect = ImRect(clip.Min, clip.Max) g.DragDropTargetId = id g.DragDropWithinTarget = true @@ -778,8 +812,8 @@ function ImGui.AcceptDragDropPayload(type, flags) if flags == nil then flags = 0 end local g = ImGui.GetCurrentContext() local payload = g.DragDropPayload - IM_ASSERT(g.DragDropActive) -- Not called between BeginDragDropTarget() and EndDragDropTarget() ? - IM_ASSERT(payload.DataFrameCount ~= -1) -- Forgot to call EndDragDropTarget() ? + assert(g.DragDropActive) -- Not called between BeginDragDropTarget() and EndDragDropTarget() ? + assert(payload.DataFrameCount ~= -1) -- Forgot to call EndDragDropTarget() ? if type ~= nil and not ImGuiPayload_IsDataType(payload, type) then return nil end -- Accept smallest drag target bounding box, this allows us to nest drag targets conveniently without ordering constraints. @@ -796,8 +830,8 @@ function ImGui.AcceptDragDropPayload(type, flags) -- Render default drop visuals payload.Preview = was_accepted_previously - flags = bit32.bor(flags, bit32.band(g.DragDropSourceFlags, ImGuiDragDropFlags.AcceptNoDrawDefaultRect)) -- Source can also inhibit the preview (useful for external sources that live for 1 frame) - local draw_target_rect = payload.Preview and bit32.band(flags, ImGuiDragDropFlags.AcceptNoDrawDefaultRect) == 0 + flags = bit32.bor(flags, bit32.band(g.DragDropSourceFlags, 2048 --[[ImGuiDragDropFlags.AcceptNoDrawDefaultRect]])) -- Source can also inhibit the preview (useful for external sources that live for 1 frame) + local draw_target_rect = payload.Preview and bit32.band(flags, 2048 --[[ImGuiDragDropFlags.AcceptNoDrawDefaultRect]]) == 0 if draw_target_rect and g.DragDropTargetFullViewport ~= 0 then ImGui.RenderDragDropTargetRectForViewport(g.DragDropTargetFullViewport, g.DragDropTargetRect) elseif draw_target_rect then @@ -805,12 +839,12 @@ function ImGui.AcceptDragDropPayload(type, flags) end g.DragDropAcceptFrameCount = g.FrameCount - if bit32.band(g.DragDropSourceFlags, ImGuiDragDropFlags.SourceExtern) ~= 0 and g.DragDropMouseButton == -1 then + if bit32.band(g.DragDropSourceFlags, 16 --[[ImGuiDragDropFlags.SourceExtern]]) ~= 0 and g.DragDropMouseButton == -1 then payload.Delivery = was_accepted_previously and (g.DragDropSourceFrameCount < g.FrameCount) else payload.Delivery = was_accepted_previously and not ImGui.IsMouseDown(g.DragDropMouseButton) -- For extern drag sources affecting OS window focus, it's easier to just test not IsMouseDown() instead of IsMouseReleased() end - if not payload.Delivery and bit32.band(flags, ImGuiDragDropFlags.AcceptBeforeDelivery) == 0 then return nil end + if not payload.Delivery and bit32.band(flags, 1024 --[[ImGuiDragDropFlags.AcceptBeforeDelivery]]) == 0 then return nil end return payload end @@ -830,7 +864,7 @@ end function ImGui.RenderDragDropTargetRectForViewport(viewport_id, bb) local g = ImGui.GetCurrentContext() local viewport = ImGui.FindViewportByID(viewport_id) - IM_ASSERT(viewport ~= nil) + assert(viewport ~= nil) local bb_padded = ImRect(bb.Min, bb.Max) bb_padded:Expand(-g.Style.DragDropTargetPadding) ImGui.RenderDragDropTargetRectEx(ImGui.GetForegroundDrawList(viewport), bb_padded, g.Style.DragDropTargetRounding) @@ -838,8 +872,8 @@ end function ImGui.RenderDragDropTargetRectEx(draw_list, bb, rounding) local g = ImGui.GetCurrentContext() - draw_list:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(ImGuiCol.DragDropTargetBg), rounding, 0) - draw_list:AddRect(bb.Min, bb.Max, ImGui.GetColorU32(ImGuiCol.DragDropTarget), rounding, g.Style.DragDropTargetBorderSize) + draw_list:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(57 --[[ImGuiCol.DragDropTargetBg]]), rounding, 0) + draw_list:AddRect(bb.Min, bb.Max, ImGui.GetColorU32(56 --[[ImGuiCol.DragDropTarget]]), rounding, g.Style.DragDropTargetBorderSize) end --- @return ImGuiPayload? @@ -850,8 +884,8 @@ end function ImGui.EndDragDropTarget() local g = ImGui.GetCurrentContext() - IM_ASSERT(g.DragDropActive) - IM_ASSERT(g.DragDropWithinTarget) + assert(g.DragDropActive) + assert(g.DragDropWithinTarget) g.DragDropWithinTarget = false -- Clear drag and drop state payload right after delivery @@ -1034,7 +1068,7 @@ local function ImGuiDockRequest() -- DockTargetNode: Destination/Target Node to dock into -- DockPayload: Source/Payload window to dock (may be a loose window or a DockNode), [Optional] DockTargetWindow = nil, DockTargetNode = nil, DockPayload = nil, - DockSplitDir = ImGuiDir.None, DockSplitRatio = 0.5, DockSplitOuter = false, + DockSplitDir = (-1) --[[ImGuiDir.None]], DockSplitRatio = 0.5, DockSplitOuter = false, UndockTargetWindow = nil, UndockTargetNode = nil, } end @@ -1043,7 +1077,7 @@ end local function ImGuiDockNodeSettings() return { ID = 0, ParentNodeId = 0, ParentWindowId = 0, SelectedTabId = 0, - SplitAxis = ImGuiAxis.None, Depth = 0, Flags = 0, -- Flags: NB: We save individual flags one by one in ascii format (ImGuiDockNodeFlags.SavedFlagsMask_) + SplitAxis = 0 --[[ImGuiAxis.None]], Depth = 0, Flags = 0, -- Flags: NB: We save individual flags one by one in ascii format (ImGuiDockNodeFlags.SavedFlagsMask_) Pos = ImVec2(0, 0), Size = ImVec2(0, 0), SizeRef = ImVec2(0, 0), } end @@ -1065,7 +1099,7 @@ function ImGuiDockNode(id) -- LocalFlagsInWindows: (Write) Flags specific to this node, applied from windows -- MergedFlags: (Read) Effective flags (== SharedFlags | LocalFlagsInNode | LocalFlagsInWindows) SharedFlags = 0, LocalFlags = 0, LocalFlagsInWindows = 0, MergedFlags = 0, - State = ImGuiDockNodeState.Unknown, + State = 0 --[[ImGuiDockNodeState.Unknown]], ParentNode = nil, ChildNodes = { [0] = nil, [1] = nil }, -- [Split node only] Child nodes (left/right or top/bottom). Consider switching to an array. Windows = ImVector(), -- Note: unordered list! Iterate TabBar.Tabs for user-order. @@ -1074,8 +1108,8 @@ function ImGuiDockNode(id) -- Size: Current size -- SizeRef: [Split node only] Last explicitly written-to size (overridden when using a splitter affecting the node), used to calculate Size. Pos = ImVec2(0, 0), Size = ImVec2(0, 0), SizeRef = ImVec2(0, 0), - SplitAxis = ImGuiAxis.None, -- [Split node only] Split axis (X or Y) - LastBgColor = IM_COL32_WHITE, + SplitAxis = 0 --[[ImGuiAxis.None]], -- [Split node only] Split axis (X or Y) + LastBgColor = 4294967295 --[[IM_COL32_WHITE]], WindowClass = ImGuiWindowClass(), -- [Root node only] -- VisibleWindow: Generally point to window which is ID is == SelectedTabID, but when CTRL+Tabbing this can be a different window. HostWindow = nil, VisibleWindow = nil, @@ -1092,8 +1126,8 @@ function ImGuiDockNode(id) -- WantCloseTabId: [Leaf node only] Set when closing a specific tab/window. -- RefViewportId: Reference viewport ID from visible window when HostWindow == nil. LastFocusedNodeId = 0, SelectedTabId = 0, WantCloseTabId = 0, RefViewportId = 0, - AuthorityForPos = ImGuiDataAuthority.DockNode, AuthorityForSize = ImGuiDataAuthority.DockNode, -- ImGuiDataAuthority - AuthorityForViewport = ImGuiDataAuthority.Auto, + AuthorityForPos = 1 --[[ImGuiDataAuthority.DockNode]], AuthorityForSize = 1 --[[ImGuiDataAuthority.DockNode]], -- ImGuiDataAuthority + AuthorityForViewport = 0 --[[ImGuiDataAuthority.Auto]], IsVisible = true, IsFocused = false, IsBgDrawnThisFrame = false, -- IsVisible: Set to false when the node is hidden (usually disabled as it has no active window) HasCloseButton = false, HasWindowMenuButton = false, HasCentralNodeChild = false, -- HasCloseButton: Provide space for a close button (if any of the docked window has one). Note that button may be hidden on window without one. -- WantCloseAll: Set when closing all tabs at once. @@ -1104,11 +1138,11 @@ function ImGuiDockNode(id) end function DN:IsRootNode() return self.ParentNode == nil end -function DN:IsDockSpace() return bit32.band(self.MergedFlags, ImGuiDockNodeFlags.DockSpace) ~= 0 end -function DN:IsFloatingNode() return self.ParentNode == nil and bit32.band(self.MergedFlags, ImGuiDockNodeFlags.DockSpace) == 0 end -function DN:IsCentralNode() return bit32.band(self.MergedFlags, ImGuiDockNodeFlags.CentralNode) ~= 0 end -function DN:IsHiddenTabBar() return bit32.band(self.MergedFlags, ImGuiDockNodeFlags.HiddenTabBar) ~= 0 end -- Hidden tab bar can be shown back by clicking the small triangle -function DN:IsNoTabBar() return bit32.band(self.MergedFlags, ImGuiDockNodeFlags.NoTabBar) ~= 0 end -- Never show a tab bar +function DN:IsDockSpace() return bit32.band(self.MergedFlags, 1024 --[[ImGuiDockNodeFlags.DockSpace]]) ~= 0 end +function DN:IsFloatingNode() return self.ParentNode == nil and bit32.band(self.MergedFlags, 1024 --[[ImGuiDockNodeFlags.DockSpace]]) == 0 end +function DN:IsCentralNode() return bit32.band(self.MergedFlags, 2048 --[[ImGuiDockNodeFlags.CentralNode]]) ~= 0 end +function DN:IsHiddenTabBar() return bit32.band(self.MergedFlags, 8192 --[[ImGuiDockNodeFlags.HiddenTabBar]]) ~= 0 end -- Hidden tab bar can be shown back by clicking the small triangle +function DN:IsNoTabBar() return bit32.band(self.MergedFlags, 4096 --[[ImGuiDockNodeFlags.NoTabBar]]) ~= 0 end -- Never show a tab bar function DN:IsSplitNode() return self.ChildNodes[0] ~= nil end function DN:IsLeafNode() return self.ChildNodes[0] == nil end function DN:IsEmpty() return self.ChildNodes[0] == nil and self.Windows.Size == 0 end @@ -1122,10 +1156,10 @@ local function ImGuiDockPreviewData() -- IsSidesAvailable: Hold your breath, grammar freaks.. -- IsSplitDirExplicit: Set when hovered the drop rect (vs. implicit SplitDir==None when hovered the window) IsDropAllowed = false, IsCenterAvailable = false, IsSidesAvailable = false, IsSplitDirExplicit = false, - SplitNode = nil, SplitDir = ImGuiDir.None, SplitRatio = 0.0, + SplitNode = nil, SplitDir = (-1) --[[ImGuiDir.None]], SplitRatio = 0.0, DropRectsDraw = {}, -- May be slightly different from hit-testing drop rects used in DockNodeCalcDropRects() } - for n = 0, 4 do d.DropRectsDraw[n] = ImRect(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX) end + for n = 0, 4 do d.DropRectsDraw[n] = ImRect(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]]) end return d end @@ -1225,7 +1259,7 @@ end function ImGui.DockContextNewFrameUpdateUndocking(ctx) local g = ctx local dc = ctx.DockContext - if bit32.band(g.IO.ConfigFlags, ImGuiConfigFlags.DockingEnable) == 0 then + if bit32.band(g.IO.ConfigFlags, 128 --[[ImGuiConfigFlags.DockingEnable]]) == 0 then if next(dc.Nodes) ~= nil or dc.Requests.Size > 0 then ImGui.DockContextClearNodes(ctx, 0, true) end @@ -1263,7 +1297,7 @@ end function ImGui.DockContextNewFrameUpdateDocking(ctx) local g = ctx local dc = ctx.DockContext - if bit32.band(g.IO.ConfigFlags, ImGuiConfigFlags.DockingEnable) == 0 then return end + if bit32.band(g.IO.ConfigFlags, 128 --[[ImGuiConfigFlags.DockingEnable]]) == 0 then return end -- [DEBUG] Store hovered dock node. -- We could in theory use DockNodeTreeFindVisibleNodeByPos() on the root host dock node, but using .DockNode is a good shortcut. @@ -1328,7 +1362,7 @@ function ImGui.DockContextAddNode(ctx, id) if id == 0 then id = ImGui.DockContextGenNodeID(ctx) else - IM_ASSERT(ImGui.DockContextFindNodeByID(ctx, id) == nil) + assert(ImGui.DockContextFindNodeByID(ctx, id) == nil) end -- We don't set node.LastFrameAlive on construction. Nodes are always created at all time to reflect .ini settings! @@ -1338,16 +1372,16 @@ function ImGui.DockContextAddNode(ctx, id) end function ImGui.DockContextRemoveNode(ctx, node, merge_sibling_into_parent_node) - IM_ASSERT(ImGui.DockContextFindNodeByID(ctx, node.ID) == node) - IM_ASSERT(node.ChildNodes[0] == nil and node.ChildNodes[1] == nil) - IM_ASSERT(node.Windows.Size == 0) + assert(ImGui.DockContextFindNodeByID(ctx, node.ID) == node) + assert(node.ChildNodes[0] == nil and node.ChildNodes[1] == nil) + assert(node.Windows.Size == 0) if node.HostWindow then node.HostWindow.DockNodeAsHost = nil end local parent_node = node.ParentNode local merge = (merge_sibling_into_parent_node and parent_node ~= nil) if merge then - IM_ASSERT(parent_node.ChildNodes[0] == node or parent_node.ChildNodes[1] == node) + assert(parent_node.ChildNodes[0] == node or parent_node.ChildNodes[1] == node) local sibling_node = (parent_node.ChildNodes[0] == node) and parent_node.ChildNodes[1] or parent_node.ChildNodes[0] ImGui.DockNodeTreeMerge(ctx, parent_node, sibling_node) else @@ -1371,7 +1405,7 @@ end function ImGui.DockContextPruneUnusedSettingsNodes(ctx) local g = ctx local dc = ctx.DockContext - IM_ASSERT(g.Windows.Size == 0) + assert(g.Windows.Size == 0) local pool = {} local function GetOrAdd(id) @@ -1428,7 +1462,7 @@ function ImGui.DockContextPruneUnusedSettingsNodes(ctx) local data_parent = (settings.ParentNodeId ~= 0) and pool[settings.ParentNodeId] or nil local remove = false - remove = remove or (data.CountWindows == 1 and settings.ParentNodeId == 0 and data.CountChildNodes == 0 and bit32.band(settings.Flags, ImGuiDockNodeFlags.CentralNode) == 0) -- Floating root node with only 1 window + remove = remove or (data.CountWindows == 1 and settings.ParentNodeId == 0 and data.CountChildNodes == 0 and bit32.band(settings.Flags, 2048 --[[ImGuiDockNodeFlags.CentralNode]]) == 0) -- Floating root node with only 1 window remove = remove or (data.CountWindows == 0 and settings.ParentNodeId == 0 and data.CountChildNodes == 0) -- Leaf nodes with 0 window remove = remove or (data_root == nil or data_root.CountChildWindows == 0) if remove then @@ -1453,9 +1487,9 @@ function ImGui.DockContextBuildNodesFromSettings(ctx, node_settings_array, node_ node.Pos = ImVec2(settings.Pos.x, settings.Pos.y) node.Size = ImVec2(settings.Size.x, settings.Size.y) node.SizeRef = ImVec2(settings.SizeRef.x, settings.SizeRef.y) - node.AuthorityForPos = ImGuiDataAuthority.DockNode - node.AuthorityForSize = ImGuiDataAuthority.DockNode - node.AuthorityForViewport = ImGuiDataAuthority.DockNode + node.AuthorityForPos = 1 --[[ImGuiDataAuthority.DockNode]] + node.AuthorityForSize = 1 --[[ImGuiDataAuthority.DockNode]] + node.AuthorityForViewport = 1 --[[ImGuiDataAuthority.DockNode]] if node.ParentNode and node.ParentNode.ChildNodes[0] == nil then node.ParentNode.ChildNodes[0] = node elseif node.ParentNode and node.ParentNode.ChildNodes[1] == nil then @@ -1463,7 +1497,7 @@ function ImGui.DockContextBuildNodesFromSettings(ctx, node_settings_array, node_ end node.SelectedTabId = settings.SelectedTabId node.SplitAxis = settings.SplitAxis - node:SetLocalFlags(bit32.band(settings.Flags, ImGuiDockNodeFlags.SavedFlagsMask_)) + node:SetLocalFlags(bit32.band(settings.Flags, 261152 --[[ImGuiDockNodeFlags.SavedFlagsMask_]])) -- Bind host window immediately if it already exist (in case of a rebuild) -- This is useful as the RootWindowForTitleBarHighlight links necessary to highlight the currently focused node requires node.HostWindow to be set. @@ -1479,7 +1513,7 @@ function ImGui.DockContextBuildAddWindowsToNodes(ctx, root_id) for _, window in g.Windows:iter() do if window.DockId ~= 0 and window.LastFrameActive >= g.FrameCount - 1 and window.DockNode == nil then local node = ImGui.DockContextFindNodeByID(ctx, window.DockId) - IM_ASSERT(node ~= nil) -- This should have been called after DockContextBuildNodesFromSettings() + assert(node ~= nil) -- This should have been called after DockContextBuildNodesFromSettings() if root_id == 0 or ImGui.DockNodeGetRootNode(node).ID == root_id then ImGui.DockNodeAddWindow(node, window, true) end @@ -1501,7 +1535,7 @@ end ------------------------------------------------------------------------------- function ImGui.DockContextQueueDock(ctx, target, target_node, payload, split_dir, split_ratio, split_outer) - IM_ASSERT(target ~= payload) + assert(target ~= payload) local req = ImGuiDockRequest() req.Type = ImGuiDockRequestType.Dock req.DockTargetWindow = target @@ -1534,8 +1568,8 @@ function ImGui.DockContextQueueNotifyRemovedNode(ctx, node) end function ImGui.DockContextProcessDock(ctx, req) - IM_ASSERT((req.Type == ImGuiDockRequestType.Dock and req.DockPayload ~= nil) or (req.Type == ImGuiDockRequestType.Split and req.DockPayload == nil)) - IM_ASSERT(req.DockTargetWindow ~= nil or req.DockTargetNode ~= nil) + assert((req.Type == ImGuiDockRequestType.Dock and req.DockPayload ~= nil) or (req.Type == ImGuiDockRequestType.Split and req.DockPayload == nil)) + assert(req.DockTargetWindow ~= nil or req.DockTargetNode ~= nil) local g = ctx local payload_window = req.DockPayload -- Optional @@ -1556,9 +1590,9 @@ function ImGui.DockContextProcessDock(ctx, req) -- FIXME-DOCK: When we are trying to dock an existing single-window node into a loose window, transfer Node ID as well -- When processing an interactive split, usually LastFrameAlive will be < g.FrameCount. But DockBuilder operations can make it ==. - if node then IM_ASSERT(node.LastFrameAlive <= g.FrameCount) end + if node then assert(node.LastFrameAlive <= g.FrameCount) end if node and target_window and node == target_window.DockNodeAsHost then - IM_ASSERT(node.Windows.Size > 0 or node:IsSplitNode() or node:IsCentralNode()) + assert(node.Windows.Size > 0 or node:IsSplitNode() or node:IsCentralNode()) end -- Create new node and add existing window to it @@ -1569,30 +1603,30 @@ function ImGui.DockContextProcessDock(ctx, req) if target_window.DockNodeAsHost == nil then ImGui.DockNodeAddWindow(node, target_window, true) local t0 = node.TabBar.Tabs.Data[1] - t0.Flags = bit32.band(t0.Flags, bit32.bnot(ImGuiTabItemFlags.Unsorted)) + t0.Flags = bit32.band(t0.Flags, bit32.bnot(8388608 --[[ImGuiTabItemFlags.Unsorted]])) target_window.DockIsActive = true end end local split_dir = req.DockSplitDir - if split_dir ~= ImGuiDir.None then + if split_dir ~= (-1) --[[ImGuiDir.None]] then -- Split into two, one side will be our payload node unless we are dropping a loose window - local split_axis = (split_dir == ImGuiDir.Left or split_dir == ImGuiDir.Right) and ImGuiAxis.X or ImGuiAxis.Y - local split_inheritor_child_idx = (split_dir == ImGuiDir.Left or split_dir == ImGuiDir.Up) and 1 or 0 -- Current contents will be moved to the opposite side + local split_axis = (split_dir == 0 --[[ImGuiDir.Left]] or split_dir == 1 --[[ImGuiDir.Right]]) and 1 --[[ImGuiAxis.X]] or 2 --[[ImGuiAxis.Y]] + local split_inheritor_child_idx = (split_dir == 0 --[[ImGuiDir.Left]] or split_dir == 2 --[[ImGuiDir.Up]]) and 1 or 0 -- Current contents will be moved to the opposite side local split_ratio = req.DockSplitRatio ImGui.DockNodeTreeSplit(ctx, node, split_axis, split_inheritor_child_idx, split_ratio, payload_node) -- payload_node may be nil here! local new_node = node.ChildNodes[bit32.bxor(split_inheritor_child_idx, 1)] new_node.HostWindow = node.HostWindow node = new_node end - node:SetLocalFlags(bit32.band(node.LocalFlags, bit32.bnot(ImGuiDockNodeFlags.HiddenTabBar))) + node:SetLocalFlags(bit32.band(node.LocalFlags, bit32.bnot(8192 --[[ImGuiDockNodeFlags.HiddenTabBar]]))) if node ~= payload_node then -- Create tab bar before we call DockNodeMoveWindows (which would attempt to move the old tab-bar, which would lead us to payload tabs wrongly appearing before target tabs!) if node.Windows.Size > 0 and node.TabBar == nil then ImGui.DockNodeAddTabBar(node) for n = 1, node.Windows.Size do - ImGui.TabBarAddTab(node.TabBar, ImGuiTabItemFlags.None, node.Windows.Data[n]) + ImGui.TabBarAddTab(node.TabBar, 0 --[[ImGuiTabItemFlags.None]], node.Windows.Data[n]) end end @@ -1603,9 +1637,9 @@ function ImGui.DockContextProcessDock(ctx, req) -- We can dock a split payload into a node that already has windows _only_ if our payload is a node tree with a single visible node. -- In this situation, we move the windows of the target node into the currently visible node of the payload. -- This allows us to preserve some of the underlying dock tree settings nicely. - IM_ASSERT(payload_node.OnlyNodeWithWindows ~= nil) -- The docking should have been blocked by DockNodePreviewDockSetup() early on and never submitted. + assert(payload_node.OnlyNodeWithWindows ~= nil) -- The docking should have been blocked by DockNodePreviewDockSetup() early on and never submitted. local visible_node = payload_node.OnlyNodeWithWindows - if visible_node.TabBar then IM_ASSERT(visible_node.TabBar.Tabs.Size > 0) end + if visible_node.TabBar then assert(visible_node.TabBar.Tabs.Size > 0) end ImGui.DockNodeMoveWindows(node, visible_node) ImGui.DockNodeMoveWindows(visible_node, node) DockSettingsRenameNodeReferences(node.ID, visible_node.ID) @@ -1614,15 +1648,15 @@ function ImGui.DockContextProcessDock(ctx, req) -- Central node property needs to be moved to a leaf node, pick the last focused one. -- FIXME-DOCK: If we had to transfer other flags here, what would the policy be? local last_focused_node = ImGui.DockContextFindNodeByID(ctx, payload_node.LastFocusedNodeId) - IM_ASSERT(last_focused_node ~= nil) + assert(last_focused_node ~= nil) local last_focused_root_node = ImGui.DockNodeGetRootNode(last_focused_node) - IM_ASSERT(last_focused_root_node == ImGui.DockNodeGetRootNode(payload_node)) - last_focused_node:SetLocalFlags(bit32.bor(last_focused_node.LocalFlags, ImGuiDockNodeFlags.CentralNode)) - node:SetLocalFlags(bit32.band(node.LocalFlags, bit32.bnot(ImGuiDockNodeFlags.CentralNode))) + assert(last_focused_root_node == ImGui.DockNodeGetRootNode(payload_node)) + last_focused_node:SetLocalFlags(bit32.bor(last_focused_node.LocalFlags, 2048 --[[ImGuiDockNodeFlags.CentralNode]])) + node:SetLocalFlags(bit32.band(node.LocalFlags, bit32.bnot(2048 --[[ImGuiDockNodeFlags.CentralNode]]))) last_focused_root_node.CentralNode = last_focused_node end - IM_ASSERT(node.Windows.Size == 0) + assert(node.Windows.Size == 0) ImGui.DockNodeMoveChildNodes(node, payload_node) else local payload_dock_id = payload_node.ID @@ -1682,8 +1716,8 @@ function ImGui.DockContextProcessUndockWindow(ctx, window, clear_persistent_dock end function ImGui.DockContextProcessUndockNode(ctx, node) - IM_ASSERT(node:IsLeafNode()) - IM_ASSERT(node.Windows.Size >= 1) + assert(node:IsLeafNode()) + assert(node.Windows.Size >= 1) if node:IsRootNode() or node:IsCentralNode() then -- In the case of a root node or central node, the node will have to stay in place. Create a new node to receive the payload. @@ -1696,20 +1730,20 @@ function ImGui.DockContextProcessUndockNode(ctx, node) node = new_node else -- Otherwise extract our node and merge our sibling back into the parent node. - IM_ASSERT(node.ParentNode.ChildNodes[0] == node or node.ParentNode.ChildNodes[1] == node) + assert(node.ParentNode.ChildNodes[0] == node or node.ParentNode.ChildNodes[1] == node) local index_in_parent = (node.ParentNode.ChildNodes[0] == node) and 0 or 1 node.ParentNode.ChildNodes[index_in_parent] = nil ImGui.DockNodeTreeMerge(ctx, node.ParentNode, node.ParentNode.ChildNodes[bit32.bxor(index_in_parent, 1)]) - node.ParentNode.AuthorityForViewport = ImGuiDataAuthority.Window -- The node that stays in place keeps the viewport, so our newly dragged out node will create a new viewport + node.ParentNode.AuthorityForViewport = 2 --[[ImGuiDataAuthority.Window]] -- The node that stays in place keeps the viewport, so our newly dragged out node will create a new viewport node.ParentNode = nil end for _, window in node.Windows:iter() do - window.Flags = bit32.band(window.Flags, bit32.bnot(ImGuiWindowFlags.ChildWindow)) + window.Flags = bit32.band(window.Flags, bit32.bnot(16777216 --[[ImGuiWindowFlags.ChildWindow]])) if window.ParentWindow then window.ParentWindow.DC.ChildWindows:find_erase(window) end ImGui.UpdateWindowParentAndRootLinks(window, window.Flags, nil) end - node.AuthorityForPos = ImGuiDataAuthority.DockNode - node.AuthorityForSize = ImGuiDataAuthority.DockNode + node.AuthorityForPos = 1 --[[ImGuiDataAuthority.DockNode]] + node.AuthorityForSize = 1 --[[ImGuiDataAuthority.DockNode]] node.Size = FixLargeWindowsWhenUndocking(node.Size, node.Windows.Data[1].Viewport) node.WantMouseMove = true ImGui.MarkIniSettingsDirty() @@ -1722,7 +1756,7 @@ function ImGui.DockContextCalcDropPosForDocking(target, target_node, payload_win -- In DockNodePreviewDockSetup() for a root central node instead of showing both "inner" and "outer" drop rects -- (which would be functionally identical) we only show the outer one. Reflect this here. - if target_node and target_node.ParentNode == nil and target_node:IsCentralNode() and split_dir ~= ImGuiDir.None then + if target_node and target_node.ParentNode == nil and target_node:IsCentralNode() and split_dir ~= (-1) --[[ImGuiDir.None]] then split_outer = true end local split_data = ImGuiDockPreviewData() @@ -1780,10 +1814,10 @@ end function ImGui.DockNodeAddWindow(node, window, add_to_tab_bar) if window.DockNode then -- Can overwrite an existing window.DockNode (e.g. pointing to a disabled DockSpace node) - IM_ASSERT(window.DockNode.ID ~= node.ID) + assert(window.DockNode.ID ~= node.ID) ImGui.DockNodeRemoveWindow(window.DockNode, window, 0) end - IM_ASSERT(window.DockNode == nil or window.DockNodeAsHost == nil) + assert(window.DockNode == nil or window.DockNodeAsHost == nil) -- If more than 2 windows appeared on the same frame leading to the creation of a new hosting window, -- we'll hide windows until the host window is ready. Hide the 1st window after its been output (so it is not visible for one frame). @@ -1802,9 +1836,9 @@ function ImGui.DockNodeAddWindow(node, window, add_to_tab_bar) -- When reactivating a node with one or two loose window, the window pos/size/viewport are authoritative over the node storage. -- In particular it is important we init the viewport from the first window so we don't create two viewports and drop one. if node.HostWindow == nil and node:IsFloatingNode() then - if node.AuthorityForPos == ImGuiDataAuthority.Auto then node.AuthorityForPos = ImGuiDataAuthority.Window end - if node.AuthorityForSize == ImGuiDataAuthority.Auto then node.AuthorityForSize = ImGuiDataAuthority.Window end - if node.AuthorityForViewport == ImGuiDataAuthority.Auto then node.AuthorityForViewport = ImGuiDataAuthority.Window end + if node.AuthorityForPos == 0 --[[ImGuiDataAuthority.Auto]] then node.AuthorityForPos = 2 --[[ImGuiDataAuthority.Window]] end + if node.AuthorityForSize == 0 --[[ImGuiDataAuthority.Auto]] then node.AuthorityForSize = 2 --[[ImGuiDataAuthority.Window]] end + if node.AuthorityForViewport == 0 --[[ImGuiDataAuthority.Auto]] then node.AuthorityForViewport = 2 --[[ImGuiDataAuthority.Window]] end end -- Add to tab bar if requested @@ -1816,31 +1850,31 @@ function ImGui.DockNodeAddWindow(node, window, add_to_tab_bar) -- Add existing windows for n = 1, node.Windows.Size - 1 do - ImGui.TabBarAddTab(node.TabBar, ImGuiTabItemFlags.None, node.Windows.Data[n]) + ImGui.TabBarAddTab(node.TabBar, 0 --[[ImGuiTabItemFlags.None]], node.Windows.Data[n]) end end - ImGui.TabBarAddTab(node.TabBar, ImGuiTabItemFlags.Unsorted, window) + ImGui.TabBarAddTab(node.TabBar, 8388608 --[[ImGuiTabItemFlags.Unsorted]], window) end ImGui.DockNodeUpdateVisibleFlag(node) -- Update this without waiting for the next time we Begin() in the window, so our host window will have the proper title bar color on its first frame. if node.HostWindow then - ImGui.UpdateWindowParentAndRootLinks(window, bit32.bor(window.Flags, ImGuiWindowFlags.ChildWindow), node.HostWindow) + ImGui.UpdateWindowParentAndRootLinks(window, bit32.bor(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]), node.HostWindow) end end function ImGui.DockNodeRemoveWindow(node, window, save_dock_id) - IM_ASSERT(window.DockNode == node) + assert(window.DockNode == node) -- IM_ASSERT(window.RootWindowDockTree == node.HostWindow) -- IM_ASSERT(window.LastFrameActive < g.FrameCount) -- We may call this from Begin() - IM_ASSERT(save_dock_id == 0 or save_dock_id == node.ID) + assert(save_dock_id == 0 or save_dock_id == node.ID) window.DockNode = nil window.DockIsActive = false window.DockTabWantClose = false window.DockId = save_dock_id - window.Flags = bit32.band(window.Flags, bit32.bnot(ImGuiWindowFlags.ChildWindow)) + window.Flags = bit32.band(window.Flags, bit32.bnot(16777216 --[[ImGuiWindowFlags.ChildWindow]])) if window.ParentWindow then window.ParentWindow.DC.ChildWindows:find_erase(window) end ImGui.UpdateWindowParentAndRootLinks(window, window.Flags, nil) -- Update immediately @@ -1855,7 +1889,7 @@ function ImGui.DockNodeRemoveWindow(node, window, save_dock_id) -- Remove window local idx = node.Windows:find_index(window) - IM_ASSERT(idx ~= nil) + assert(idx ~= nil) node.Windows:erase(idx) if node.VisibleWindow == window then node.VisibleWindow = nil end @@ -1886,7 +1920,7 @@ function ImGui.DockNodeRemoveWindow(node, window, save_dock_id) end function ImGui.DockNodeMoveChildNodes(dst_node, src_node) - IM_ASSERT(dst_node.Windows.Size == 0) + assert(dst_node.Windows.Size == 0) dst_node.ChildNodes[0] = src_node.ChildNodes[0] dst_node.ChildNodes[1] = src_node.ChildNodes[1] if dst_node.ChildNodes[0] then dst_node.ChildNodes[0].ParentNode = dst_node end @@ -1899,9 +1933,9 @@ end function ImGui.DockNodeMoveWindows(dst_node, src_node) -- Insert tabs in the same orders as currently ordered (node.Windows isn't ordered) - IM_ASSERT(src_node and dst_node and dst_node ~= src_node) + assert(src_node and dst_node and dst_node ~= src_node) local src_tab_bar = src_node.TabBar - if src_tab_bar ~= nil then IM_ASSERT(src_node.Windows.Size <= src_node.TabBar.Tabs.Size) end + if src_tab_bar ~= nil then assert(src_node.Windows.Size <= src_node.TabBar.Tabs.Size) end -- If the dst_node is empty we can just move the entire tab bar (to preserve selection, scrolling, etc.) local move_tab_bar = (src_tab_bar ~= nil) and (dst_node.TabBar == nil) @@ -1929,8 +1963,8 @@ end function ImGui.DockNodeApplyPosSizeToWindows(node) for _, window in node.Windows:iter() do - ImGui.SetWindowPos(window, node.Pos, ImGuiCond.Always) -- We don't assign directly to Pos because it can break the calculation of SizeContents on next frame - ImGui.SetWindowSize(window, node.Size, ImGuiCond.Always) + ImGui.SetWindowPos(window, node.Pos, 1 --[[ImGuiCond.Always]]) -- We don't assign directly to Pos because it can break the calculation of SizeContents on next frame + ImGui.SetWindowSize(window, node.Size, 1 --[[ImGuiCond.Always]]) end end @@ -1953,8 +1987,8 @@ local function DockNodeFindInfo(node, info) info.CountNodesWithWindows = info.CountNodesWithWindows + 1 end if node:IsCentralNode() then - IM_ASSERT(info.CentralNode == nil) -- Should be only one - IM_ASSERT(node:IsLeafNode(), "If you get this assert: please submit .ini file + repro of actions leading to this.") + assert(info.CentralNode == nil) -- Should be only one + assert(node:IsLeafNode(), "If you get this assert: please submit .ini file + repro of actions leading to this.") info.CentralNode = node end if info.CountNodesWithWindows > 1 and info.CentralNode ~= nil then return end @@ -1963,7 +1997,7 @@ local function DockNodeFindInfo(node, info) end function ImGui.DockNodeFindWindowByID(node, id) - IM_ASSERT(id ~= 0) + assert(id ~= 0) for _, window in node.Windows:iter() do if window.ID == id then return window end end @@ -1974,11 +2008,11 @@ end -- - Update visibility flag. function ImGui.DockNodeUpdateFlagsAndCollapse(node) local g = ImGui.GetCurrentContext() - IM_ASSERT(node.ParentNode == nil or node.ParentNode.ChildNodes[0] == node or node.ParentNode.ChildNodes[1] == node) + assert(node.ParentNode == nil or node.ParentNode.ChildNodes[0] == node or node.ParentNode.ChildNodes[1] == node) -- Inherit most flags if node.ParentNode then - node.SharedFlags = bit32.band(node.ParentNode.SharedFlags, ImGuiDockNodeFlags.SharedFlagsInheritMask_) + node.SharedFlags = bit32.band(node.ParentNode.SharedFlags, 4294967295 --[[ImGuiDockNodeFlags.SharedFlagsInheritMask_]]) end -- Recurse into children @@ -1991,22 +2025,22 @@ function ImGui.DockNodeUpdateFlagsAndCollapse(node) -- Remove inactive windows, collapse nodes -- Merge node flags overrides stored in windows - node.LocalFlagsInWindows = ImGuiDockNodeFlags.None + node.LocalFlagsInWindows = 0 --[[ImGuiDockNodeFlags.None]] local window_n = 1 while window_n <= node.Windows.Size do local window = node.Windows.Data[window_n] - IM_ASSERT(window.DockNode == node) + assert(window.DockNode == node) local node_was_active = (node.LastFrameActive + 1 == g.FrameCount) local remove = false remove = remove or (node_was_active and (window.WasActive == false)) -- Can't use 'window.LastFrameActive + 1 < g.FrameCount'. (see #9151) - remove = remove or (node_was_active and (node.WantCloseAll or node.WantCloseTabId == window.TabId) and window.HasCloseButton and bit32.band(window.Flags, ImGuiWindowFlags.UnsavedDocument) == 0) -- Submit all _expected_ closure from last frame + remove = remove or (node_was_active and (node.WantCloseAll or node.WantCloseTabId == window.TabId) and window.HasCloseButton and bit32.band(window.Flags, 262144 --[[ImGuiWindowFlags.UnsavedDocument]]) == 0) -- Submit all _expected_ closure from last frame remove = remove or window.DockTabWantClose if remove then window.DockTabWantClose = false if node.Windows.Size == 1 and not node:IsCentralNode() then ImGui.DockNodeHideHostWindow(node) - node.State = ImGuiDockNodeState.HostWindowHiddenBecauseSingleWindow + node.State = 1 --[[ImGuiDockNodeState.HostWindowHiddenBecauseSingleWindow]] ImGui.DockNodeRemoveWindow(node, window, node.ID) -- Will delete the node so it'll be invalid on return return end @@ -2022,24 +2056,24 @@ function ImGui.DockNodeUpdateFlagsAndCollapse(node) -- Auto-hide tab bar option local node_flags = node.MergedFlags - if node.WantHiddenTabBarUpdate and node.Windows.Size == 1 and bit32.band(node_flags, ImGuiDockNodeFlags.AutoHideTabBar) ~= 0 and not node:IsHiddenTabBar() then + if node.WantHiddenTabBarUpdate and node.Windows.Size == 1 and bit32.band(node_flags, 64 --[[ImGuiDockNodeFlags.AutoHideTabBar]]) ~= 0 and not node:IsHiddenTabBar() then node.WantHiddenTabBarToggle = true end node.WantHiddenTabBarUpdate = false -- Cancel toggling if we know our tab bar is enforced to be hidden at all times - if node.WantHiddenTabBarToggle and node.VisibleWindow and bit32.band(node.VisibleWindow.WindowClass.DockNodeFlagsOverrideSet, ImGuiDockNodeFlags.HiddenTabBar) ~= 0 then + if node.WantHiddenTabBarToggle and node.VisibleWindow and bit32.band(node.VisibleWindow.WindowClass.DockNodeFlagsOverrideSet, 8192 --[[ImGuiDockNodeFlags.HiddenTabBar]]) ~= 0 then node.WantHiddenTabBarToggle = false end -- Apply toggles at a single point of the frame (here!) local prev_local_flags = node.LocalFlags if node.Windows.Size > 1 then - node:SetLocalFlags(bit32.band(node.LocalFlags, bit32.bnot(ImGuiDockNodeFlags.HiddenTabBar))) + node:SetLocalFlags(bit32.band(node.LocalFlags, bit32.bnot(8192 --[[ImGuiDockNodeFlags.HiddenTabBar]]))) elseif node.WantHiddenTabBarToggle then - node:SetLocalFlags(bit32.bxor(node.LocalFlags, ImGuiDockNodeFlags.HiddenTabBar)) + node:SetLocalFlags(bit32.bxor(node.LocalFlags, 8192 --[[ImGuiDockNodeFlags.HiddenTabBar]])) end - if bit32.band(bit32.bxor(node.LocalFlags, prev_local_flags), ImGuiDockNodeFlags.SavedFlagsMask_) ~= 0 then + if bit32.band(bit32.bxor(node.LocalFlags, prev_local_flags), 261152 --[[ImGuiDockNodeFlags.SavedFlagsMask_]]) ~= 0 then ImGui.MarkIniSettingsDirty() -- Bit flaky to only do this here. Perhaps compare node flags every frame? #9380 end node.WantHiddenTabBarToggle = false @@ -2072,7 +2106,7 @@ end function ImGui.DockNodeStartMouseMovingWindow(node, window) local g = ImGui.GetCurrentContext() - IM_ASSERT(node.WantMouseMove == true) + assert(node.WantMouseMove == true) ImGui.StartMouseMovingWindow(window) ImVec2_Copy(g.ActiveIdClickOffset, g.IO.MouseClickedPos[0] - node.Pos) g.MovingWindow = window -- If we are docked into a non moveable root window, StartMouseMovingWindow() won't set g.MovingWindow. Override that decision. @@ -2131,7 +2165,7 @@ end function ImGui.DockNodeUpdate(node) local g = ImGui.GetCurrentContext() - IM_ASSERT(node.LastFrameActive ~= g.FrameCount) + assert(node.LastFrameActive ~= g.FrameCount) node.LastFrameAlive = g.FrameCount node.IsBgDrawnThisFrame = false @@ -2158,9 +2192,9 @@ function ImGui.DockNodeUpdate(node) local single_window = node.Windows.Data[1] node.Pos = ImVec2(single_window.Pos.x, single_window.Pos.y) node.Size = ImVec2(single_window.SizeFull.x, single_window.SizeFull.y) - node.AuthorityForPos = ImGuiDataAuthority.Window - node.AuthorityForSize = ImGuiDataAuthority.Window - node.AuthorityForViewport = ImGuiDataAuthority.Window + node.AuthorityForPos = 2 --[[ImGuiDataAuthority.Window]] + node.AuthorityForSize = 2 --[[ImGuiDataAuthority.Window]] + node.AuthorityForViewport = 2 --[[ImGuiDataAuthority.Window]] -- Transfer focus immediately so when we revert to a regular window it is immediately selected if node.HostWindow and g.NavWindow == node.HostWindow then @@ -2174,7 +2208,7 @@ function ImGui.DockNodeUpdate(node) end ImGui.DockNodeHideHostWindow(node) - node.State = ImGuiDockNodeState.HostWindowHiddenBecauseSingleWindow + node.State = 1 --[[ImGuiDockNodeState.HostWindowHiddenBecauseSingleWindow]] node.WantCloseAll = false node.WantCloseTabId = 0 node.HasCloseButton = false @@ -2198,13 +2232,13 @@ function ImGui.DockNodeUpdate(node) -- It would require a generalization of CalcWindowExpectedSize(), probably extracting code away from Begin(). -- In reality it isn't very important as user quickly ends up with size data in .ini file. if node.IsVisible and node.HostWindow == nil and node:IsFloatingNode() and node:IsLeafNode() then - IM_ASSERT(node.Windows.Size > 0) + assert(node.Windows.Size > 0) local ref_window = nil -- Note that we prune single-window-node settings on .ini loading, so this is generally 0 for them! if node.SelectedTabId ~= 0 then ref_window = ImGui.DockNodeFindWindowByID(node, node.SelectedTabId) end if ref_window == nil then ref_window = node.Windows.Data[1] end if ref_window.AutoFitFramesX > 0 or ref_window.AutoFitFramesY > 0 then - node.State = ImGuiDockNodeState.HostWindowHiddenBecauseWindowsAreResizing + node.State = 2 --[[ImGuiDockNodeState.HostWindowHiddenBecauseWindowsAreResizing]] return end end @@ -2212,14 +2246,14 @@ function ImGui.DockNodeUpdate(node) local node_flags = node.MergedFlags -- Decide if the node will have a close button and a window menu button - node.HasWindowMenuButton = (node.Windows.Size > 0) and bit32.band(node_flags, ImGuiDockNodeFlags.NoWindowMenuButton) == 0 + node.HasWindowMenuButton = (node.Windows.Size > 0) and bit32.band(node_flags, 16384 --[[ImGuiDockNodeFlags.NoWindowMenuButton]]) == 0 node.HasCloseButton = false for _, window in node.Windows:iter() do -- FIXME-DOCK: Setting DockIsActive here means that for single active window in a leaf node, DockIsActive will be cleared until the next Begin() call. node.HasCloseButton = node.HasCloseButton or window.HasCloseButton window.DockIsActive = (node.Windows.Size > 1) end - if bit32.band(node_flags, ImGuiDockNodeFlags.NoCloseButton) ~= 0 or not g.Style.DockingNodeHasCloseButton then + if bit32.band(node_flags, 32768 --[[ImGuiDockNodeFlags.NoCloseButton]]) ~= 0 or not g.Style.DockingNodeHasCloseButton then node.HasCloseButton = false end @@ -2228,7 +2262,7 @@ function ImGui.DockNodeUpdate(node) local beginned_into_host_window = false if node:IsDockSpace() then -- [Explicit root dockspace node] - IM_ASSERT(node.HostWindow) + assert(node.HostWindow) host_window = node.HostWindow else -- [Automatic root or child nodes] @@ -2236,21 +2270,21 @@ function ImGui.DockNodeUpdate(node) local ref_window = (node.Windows.Size > 0) and node.Windows.Data[1] or nil -- Sync Pos - if node.AuthorityForPos == ImGuiDataAuthority.Window and ref_window then + if node.AuthorityForPos == 2 --[[ImGuiDataAuthority.Window]] and ref_window then ImGui.SetNextWindowPos(ref_window.Pos) - elseif node.AuthorityForPos == ImGuiDataAuthority.DockNode then + elseif node.AuthorityForPos == 1 --[[ImGuiDataAuthority.DockNode]] then ImGui.SetNextWindowPos(node.Pos) end -- Sync Size - if node.AuthorityForSize == ImGuiDataAuthority.Window and ref_window then + if node.AuthorityForSize == 2 --[[ImGuiDataAuthority.Window]] and ref_window then ImGui.SetNextWindowSize(ref_window.SizeFull) - elseif node.AuthorityForSize == ImGuiDataAuthority.DockNode then + elseif node.AuthorityForSize == 1 --[[ImGuiDataAuthority.DockNode]] then ImGui.SetNextWindowSize(node.Size) end -- Sync Collapsed - if node.AuthorityForSize == ImGuiDataAuthority.Window and ref_window then + if node.AuthorityForSize == 2 --[[ImGuiDataAuthority.Window]] and ref_window then ImGui.SetNextWindowCollapsed(ref_window.Collapsed) end @@ -2258,13 +2292,13 @@ function ImGui.DockNodeUpdate(node) -- Begin into the host window local window_label = DockNodeGetHostWindowTitle(node) - local window_flags = bit32.bor(ImGuiWindowFlags.NoScrollbar, ImGuiWindowFlags.NoScrollWithMouse, ImGuiWindowFlags.DockNodeHost) - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.NoFocusOnAppearing) - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.NoSavedSettings, ImGuiWindowFlags.NoNavFocus, ImGuiWindowFlags.NoCollapse) - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.NoTitleBar) + local window_flags = bit32.bor(8 --[[ImGuiWindowFlags.NoScrollbar]], 16 --[[ImGuiWindowFlags.NoScrollWithMouse]], 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) + window_flags = bit32.bor(window_flags, 4096 --[[ImGuiWindowFlags.NoFocusOnAppearing]]) + window_flags = bit32.bor(window_flags, 256 --[[ImGuiWindowFlags.NoSavedSettings]], 131072 --[[ImGuiWindowFlags.NoNavFocus]], 32 --[[ImGuiWindowFlags.NoCollapse]]) + window_flags = bit32.bor(window_flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) ImGui.SetNextWindowBgAlpha(0.0) -- Don't set ImGuiWindowFlags.NoBackground because it disables borders - ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, ImVec2(0, 0)) + ImGui.PushStyleVar(2 --[[ImGuiStyleVar.WindowPadding]], ImVec2(0, 0)) ImGui.Begin(window_label, nil, window_flags) ImGui.PopStyleVar() beginned_into_host_window = true @@ -2283,15 +2317,15 @@ function ImGui.DockNodeUpdate(node) -- after the dock host window, losing their top-most status. if node.HostWindow.Appearing then ImGui.BringWindowToDisplayFront(node.HostWindow) end - node.AuthorityForPos = ImGuiDataAuthority.Auto - node.AuthorityForSize = ImGuiDataAuthority.Auto - node.AuthorityForViewport = ImGuiDataAuthority.Auto + node.AuthorityForPos = 0 --[[ImGuiDataAuthority.Auto]] + node.AuthorityForSize = 0 --[[ImGuiDataAuthority.Auto]] + node.AuthorityForViewport = 0 --[[ImGuiDataAuthority.Auto]] elseif node.ParentNode then host_window = node.ParentNode.HostWindow node.HostWindow = host_window - node.AuthorityForPos = ImGuiDataAuthority.Auto - node.AuthorityForSize = ImGuiDataAuthority.Auto - node.AuthorityForViewport = ImGuiDataAuthority.Auto + node.AuthorityForPos = 0 --[[ImGuiDataAuthority.Auto]] + node.AuthorityForSize = 0 --[[ImGuiDataAuthority.Auto]] + node.AuthorityForViewport = 0 --[[ImGuiDataAuthority.Auto]] end if node.WantMouseMove and node.HostWindow then ImGui.DockNodeStartMouseMovingWindow(node, node.HostWindow) @@ -2300,7 +2334,7 @@ function ImGui.DockNodeUpdate(node) node.RefViewportId = 0 -- Clear when we have a host window -- Update focused node (the one whose title bar is highlight) within a node tree - if node:IsSplitNode() then IM_ASSERT(node.TabBar == nil) end + if node:IsSplitNode() then assert(node.TabBar == nil) end if node:IsRootNode() then local p_window = g.NavWindow and g.NavWindow.RootWindow or nil while p_window ~= nil and p_window.DockNode ~= nil do @@ -2315,7 +2349,7 @@ function ImGui.DockNodeUpdate(node) -- Register a hit-test hole in the window unless we are currently dragging a window that is compatible with our dockspace local central_node = node.CentralNode - local central_node_hole = node:IsRootNode() and host_window ~= nil and bit32.band(node_flags, ImGuiDockNodeFlags.PassthruCentralNode) ~= 0 and central_node ~= nil and central_node:IsEmpty() + local central_node_hole = node:IsRootNode() and host_window ~= nil and bit32.band(node_flags, 8 --[[ImGuiDockNodeFlags.PassthruCentralNode]]) ~= 0 and central_node ~= nil and central_node:IsEmpty() local central_node_hole_register_hit_test_hole = central_node_hole if central_node_hole then local payload = ImGui.GetDragDropPayload() @@ -2327,7 +2361,7 @@ function ImGui.DockNodeUpdate(node) -- We add a little padding to match the "resize from edges" behavior and allow grabbing the splitter easily. -- (But we only add it if there's something else on the other side of the hole, otherwise for e.g. fullscreen -- covering passthru node we'd have a gap on the edge not covered by the hole) - IM_ASSERT(node:IsDockSpace()) -- We cannot pass this flag without the DockSpace() api. Testing this because we also setup the hole in host_window.ParentNode + assert(node:IsDockSpace()) -- We cannot pass this flag without the DockSpace() api. Testing this because we also setup the hole in host_window.ParentNode local root_node = ImGui.DockNodeGetRootNode(central_node) local root_rect = ImRect(root_node.Pos, root_node.Pos + root_node.Size) local hole_rect = ImRect(central_node.Pos, central_node.Pos + central_node.Size) @@ -2347,9 +2381,9 @@ function ImGui.DockNodeUpdate(node) -- Update position/size, process and draw resizing splitters if node:IsRootNode() and host_window then ImGui.DockNodeTreeUpdatePosSize(node, host_window.Pos, host_window.Size) - ImGui.PushStyleColor(ImGuiCol.Separator, g.Style.Colors[ImGuiCol.Border]) - ImGui.PushStyleColor(ImGuiCol.SeparatorActive, g.Style.Colors[ImGuiCol.ResizeGripActive]) - ImGui.PushStyleColor(ImGuiCol.SeparatorHovered, g.Style.Colors[ImGuiCol.ResizeGripHovered]) + ImGui.PushStyleColor(28 --[[ImGuiCol.Separator]], g.Style.Colors[5 --[[ImGuiCol.Border]]]) + ImGui.PushStyleColor(30 --[[ImGuiCol.SeparatorActive]], g.Style.Colors[33 --[[ImGuiCol.ResizeGripActive]]]) + ImGui.PushStyleColor(29 --[[ImGuiCol.SeparatorHovered]], g.Style.Colors[32 --[[ImGuiCol.ResizeGripHovered]]]) ImGui.DockNodeTreeUpdateSplitter(node) ImGui.PopStyleColor(3) end @@ -2357,7 +2391,7 @@ function ImGui.DockNodeUpdate(node) -- Draw empty node background (currently can only be the Central Node) if host_window and node:IsEmpty() and node.IsVisible then host_window.DrawList:ChannelsSetCurrent(DOCKING_HOST_DRAW_CHANNEL_BG) - node.LastBgColor = (bit32.band(node_flags, ImGuiDockNodeFlags.PassthruCentralNode) ~= 0) and 0 or ImGui.GetColorU32(ImGuiCol.DockingEmptyBg) + node.LastBgColor = (bit32.band(node_flags, 8 --[[ImGuiDockNodeFlags.PassthruCentralNode]]) ~= 0) and 0 or ImGui.GetColorU32(43 --[[ImGuiCol.DockingEmptyBg]]) if node.LastBgColor ~= 0 then host_window.DrawList:AddRectFilled(node.Pos, node.Pos + node.Size, node.LastBgColor) end @@ -2367,13 +2401,13 @@ function ImGui.DockNodeUpdate(node) -- Draw whole dockspace background if ImGuiDockNodeFlags.PassthruCentralNode if set. -- We need to draw a background at the root level if requested by ImGuiDockNodeFlags.PassthruCentralNode, but we will only know the correct pos/size -- _after_ processing the resizing splitters. So we are using the DrawList channel splitting facility to submit drawing primitives out of order! - local render_dockspace_bg = node:IsRootNode() and host_window ~= nil and bit32.band(node_flags, ImGuiDockNodeFlags.PassthruCentralNode) ~= 0 + local render_dockspace_bg = node:IsRootNode() and host_window ~= nil and bit32.band(node_flags, 8 --[[ImGuiDockNodeFlags.PassthruCentralNode]]) ~= 0 if render_dockspace_bg and node.IsVisible then host_window.DrawList:ChannelsSetCurrent(DOCKING_HOST_DRAW_CHANNEL_BG) if central_node_hole then - ImGui.RenderRectFilledWithHole(host_window.DrawList, node:Rect(), central_node:Rect(), ImGui.GetColorU32(ImGuiCol.WindowBg), 0.0) + ImGui.RenderRectFilledWithHole(host_window.DrawList, node:Rect(), central_node:Rect(), ImGui.GetColorU32(2 --[[ImGuiCol.WindowBg]]), 0.0) else - host_window.DrawList:AddRectFilled(node.Pos, node.Pos + node.Size, ImGui.GetColorU32(ImGuiCol.WindowBg), 0.0) + host_window.DrawList:AddRectFilled(node.Pos, node.Pos + node.Size, ImGui.GetColorU32(2 --[[ImGuiCol.WindowBg]]), 0.0) end end @@ -2425,8 +2459,8 @@ ImGui.GWindowDockStyleColors = GWindowDockStyleColors -- Compare TabItem nodes given the last known DockOrder (will persist in .ini file as hint), used to sort tabs when multiple tabs are added on the same frame. local function TabItemComparerByDockOrder(ta, tb) local a, b = ta.Window, tb.Window - local ao = (a.DockOrder == -1) and INT_MAX or a.DockOrder - local bo = (b.DockOrder == -1) and INT_MAX or b.DockOrder + local ao = (a.DockOrder == -1) and 2147483647 --[[INT_MAX]] or a.DockOrder + local bo = (b.DockOrder == -1) and 2147483647 --[[INT_MAX]] or b.DockOrder if ao ~= bo then return ao < bo end return a.BeginOrderWithinContext < b.BeginOrderWithinContext end @@ -2439,14 +2473,14 @@ end function ImGui.DockNodeWindowMenuHandler_Default(ctx, node, tab_bar) if tab_bar.Tabs.Size == 1 then -- "Hide tab bar" option. Being one of our rare user-facing string we pull it from a table. - if ImGui.MenuItem(ImGui.LocalizeGetMsg(ImGuiLocKey.DockingHideTabBar), nil, node:IsHiddenTabBar()) then + if ImGui.MenuItem(ImGui.LocalizeGetMsg(13 --[[ImGuiLocKey.DockingHideTabBar]]), nil, node:IsHiddenTabBar()) then node.WantHiddenTabBarToggle = true end else -- Display a selectable list of windows in this docking node for tab_n = 1, tab_bar.Tabs.Size do local tab = tab_bar.Tabs.Data[tab_n] - if bit32.band(tab.Flags, ImGuiTabItemFlags.Button) == 0 then + if bit32.band(tab.Flags, 2097152 --[[ImGuiTabItemFlags.Button]]) == 0 then if ImGui.Selectable(ImGui.TabBarGetTabName(tab_bar, tab), tab.ID == tab_bar.SelectedTabId) then ImGui.TabBarQueueFocus(tab_bar, tab) end @@ -2460,10 +2494,10 @@ end function ImGui.DockNodeWindowMenuUpdate(node, tab_bar) -- Try to position the menu so it is more likely to stays within the same viewport local g = ImGui.GetCurrentContext() - if g.Style.WindowMenuButtonPosition == ImGuiDir.Left then - ImGui.SetNextWindowPos(ImVec2(node.Pos.x, node.Pos.y + ImGui.GetFrameHeight()), ImGuiCond.Always, ImVec2(0.0, 0.0)) + if g.Style.WindowMenuButtonPosition == 0 --[[ImGuiDir.Left]] then + ImGui.SetNextWindowPos(ImVec2(node.Pos.x, node.Pos.y + ImGui.GetFrameHeight()), 1 --[[ImGuiCond.Always]], ImVec2(0.0, 0.0)) else - ImGui.SetNextWindowPos(ImVec2(node.Pos.x + node.Size.x, node.Pos.y + ImGui.GetFrameHeight()), ImGuiCond.Always, ImVec2(1.0, 0.0)) + ImGui.SetNextWindowPos(ImVec2(node.Pos.x + node.Size.x, node.Pos.y + ImGui.GetFrameHeight()), 1 --[[ImGuiCond.Always]], ImVec2(1.0, 0.0)) end if ImGui.BeginPopup("#WindowMenu") then node.IsFocused = true @@ -2475,12 +2509,12 @@ end -- User helper to append/amend into a dock node tab bar. Most commonly used to add e.g. a "+" button. function ImGui.DockNodeBeginAmendTabBar(node) if node.TabBar == nil or node.HostWindow == nil then return false end - if bit32.band(node.MergedFlags, ImGuiDockNodeFlags.KeepAliveOnly) ~= 0 then return false end + if bit32.band(node.MergedFlags, 1 --[[ImGuiDockNodeFlags.KeepAliveOnly]]) ~= 0 then return false end if node.TabBar.ID == 0 then return false end ImGui.Begin(node.HostWindow.Name) ImGui.PushOverrideID(node.ID) local ret = ImGui.BeginTabBarEx(node.TabBar, node.TabBar.BarRect, node.TabBar.Flags) - IM_ASSERT(ret) + assert(ret) return true end @@ -2501,7 +2535,7 @@ local function IsDockNodeTitleBarHighlighted(node, root_node) if g.NavWindow and root_node.LastFocusedNodeId == node.ID then -- FIXME: This could all be backed in RootWindowForTitleBarHighlight? Probably need to reorganize for both dock nodes + other RootWindowForTitleBarHighlight users (not-node) local parent_window = g.NavWindow.RootWindow - while bit32.band(parent_window.Flags, ImGuiWindowFlags.ChildMenu) ~= 0 do + while bit32.band(parent_window.Flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0 do parent_window = parent_window.ParentWindow.RootWindow end local parent_node = parent_window.DockNodeAsHost or parent_window.DockNode @@ -2545,7 +2579,7 @@ function ImGui.DockNodeUpdateTabBar(node, host_window) local backup_skip_item = host_window.SkipItems if not node:IsDockSpace() then host_window.SkipItems = false - host_window.DC.NavLayerCurrent = ImGuiNavLayer.Menu + host_window.DC.NavLayerCurrent = 1 --[[ImGuiNavLayer.Menu]] end -- Use PushOverrideID() instead of PushID() to use the node id _without_ the host window ID. @@ -2563,7 +2597,7 @@ function ImGui.DockNodeUpdateTabBar(node, host_window) node.IsFocused = is_focused local node_flags = node.MergedFlags - local has_window_menu_button = bit32.band(node_flags, ImGuiDockNodeFlags.NoWindowMenuButton) == 0 and (style.WindowMenuButtonPosition ~= ImGuiDir.None) + local has_window_menu_button = bit32.band(node_flags, 16384 --[[ImGuiDockNodeFlags.NoWindowMenuButton]]) == 0 and (style.WindowMenuButtonPosition ~= (-1) --[[ImGuiDir.None]]) -- In a dock node, the Collapse Button turns into the Window Menu button. -- FIXME-DOCK FIXME-OPT: Could we recycle popups id across multiple dock nodes? @@ -2584,13 +2618,13 @@ function ImGui.DockNodeUpdateTabBar(node, host_window) for window_n = 1, node.Windows.Size do local window = node.Windows.Data[window_n] if ImGui.TabBarFindTabByID(tab_bar, window.TabId) == nil then - ImGui.TabBarAddTab(tab_bar, ImGuiTabItemFlags.Unsorted, window) + ImGui.TabBarAddTab(tab_bar, 8388608 --[[ImGuiTabItemFlags.Unsorted]], window) end end -- Title bar if is_focused then node.LastFrameFocused = g.FrameCount end - local title_bar_col = ImGui.GetColorU32(host_window.Collapsed and ImGuiCol.TitleBgCollapsed or (is_focused and ImGuiCol.TitleBgActive or ImGuiCol.TitleBg)) + local title_bar_col = ImGui.GetColorU32(host_window.Collapsed and 12 --[[ImGuiCol.TitleBgCollapsed]] or (is_focused and 11 --[[ImGuiCol.TitleBgActive]] or 10 --[[ImGuiCol.TitleBg]])) local rounding_flags = ImGui.CalcRoundingFlagsForRectInRect(title_bar_rect, host_window:Rect(), g.Style.DockingSeparatorSize) host_window.DrawList:AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, host_window.WindowRounding, rounding_flags) @@ -2600,18 +2634,18 @@ function ImGui.DockNodeUpdateTabBar(node, host_window) ImGui.OpenPopup("#WindowMenu") end if ImGui.IsItemActive() then focus_tab_id = tab_bar.SelectedTabId end - if ImGui.IsItemHovered(bit32.bor(ImGuiHoveredFlags.ForTooltip, ImGuiHoveredFlags.DelayNormal)) and g.HoveredIdTimer > 0.5 then - ImGui.SetTooltip("%s", ImGui.LocalizeGetMsg(ImGuiLocKey.DockingDragToUndockOrMoveNode)) + if ImGui.IsItemHovered(bit32.bor(4096 --[[ImGuiHoveredFlags.ForTooltip]], 65536 --[[ImGuiHoveredFlags.DelayNormal]])) and g.HoveredIdTimer > 0.5 then + ImGui.SetTooltip("%s", ImGui.LocalizeGetMsg(15 --[[ImGuiLocKey.DockingDragToUndockOrMoveNode]])) end end -- If multiple tabs are appearing on the same frame, sort them based on their persistent DockOrder value local tabs_unsorted_start = tab_bar.Tabs.Size -- 0-based local tab_n = tab_bar.Tabs.Size - 1 - while tab_n >= 0 and bit32.band(tab_bar.Tabs.Data[tab_n + 1].Flags, ImGuiTabItemFlags.Unsorted) ~= 0 do + while tab_n >= 0 and bit32.band(tab_bar.Tabs.Data[tab_n + 1].Flags, 8388608 --[[ImGuiTabItemFlags.Unsorted]]) ~= 0 do -- FIXME-DOCK: Consider only clearing the flag after the tab has been alive for a few consecutive frames, allowing late comers to not break sorting? local t = tab_bar.Tabs.Data[tab_n + 1] - t.Flags = bit32.band(t.Flags, bit32.bnot(ImGuiTabItemFlags.Unsorted)) + t.Flags = bit32.band(t.Flags, bit32.bnot(8388608 --[[ImGuiTabItemFlags.Unsorted]])) tabs_unsorted_start = tab_n tab_n = tab_n - 1 end @@ -2637,12 +2671,12 @@ function ImGui.DockNodeUpdateTabBar(node, host_window) end -- Begin tab bar - local tab_bar_flags = bit32.bor(ImGuiTabBarFlags.Reorderable, ImGuiTabBarFlags.AutoSelectNewTabs) -- | ImGuiTabBarFlags.NoTabListScrollingButtons) - tab_bar_flags = bit32.bor(tab_bar_flags, ImGuiTabBarFlags.SaveSettings, ImGuiTabBarFlags.DockNode) - tab_bar_flags = bit32.bor(tab_bar_flags, ImGuiTabBarFlags.FittingPolicyMixed) -- Enforce default policy. Since 1.92.2 this is now reasonable. May expose later if needed. (#8800, #3421) - tab_bar_flags = bit32.bor(tab_bar_flags, ImGuiTabBarFlags.DrawSelectedOverline) + local tab_bar_flags = bit32.bor(1 --[[ImGuiTabBarFlags.Reorderable]], 2 --[[ImGuiTabBarFlags.AutoSelectNewTabs]]) -- | ImGuiTabBarFlags.NoTabListScrollingButtons) + tab_bar_flags = bit32.bor(tab_bar_flags, 4194304 --[[ImGuiTabBarFlags.SaveSettings]], 1048576 --[[ImGuiTabBarFlags.DockNode]]) + tab_bar_flags = bit32.bor(tab_bar_flags, 128 --[[ImGuiTabBarFlags.FittingPolicyMixed]]) -- Enforce default policy. Since 1.92.2 this is now reasonable. May expose later if needed. (#8800, #3421) + tab_bar_flags = bit32.bor(tab_bar_flags, 64 --[[ImGuiTabBarFlags.DrawSelectedOverline]]) if not host_window.Collapsed and is_focused then - tab_bar_flags = bit32.bor(tab_bar_flags, ImGuiTabBarFlags.IsFocused) + tab_bar_flags = bit32.bor(tab_bar_flags, 2097152 --[[ImGuiTabBarFlags.IsFocused]]) end tab_bar.ID = node.ID -- GetID("#TabBar") tab_bar.SeparatorMinX = node.Pos.x + host_window.WindowBorderSize -- Separator cover the whole node width @@ -2652,7 +2686,7 @@ function ImGui.DockNodeUpdateTabBar(node, host_window) -- Backup style colors local backup_style_cols = {} - for color_n = 0, ImGuiWindowDockStyleCol.COUNT - 1 do + for color_n = 0, 9 --[[ImGuiWindowDockStyleCol.COUNT]] - 1 do local c = g.Style.Colors[GWindowDockStyleColors[color_n]] backup_style_cols[color_n] = ImVec4(c.x, c.y, c.z, c.w) end @@ -2665,15 +2699,15 @@ function ImGui.DockNodeUpdateTabBar(node, host_window) if not (window.LastFrameActive + 1 < g.FrameCount and node_was_active) then local tab_item_flags = 0 tab_item_flags = bit32.bor(tab_item_flags, window.WindowClass.TabItemFlagsOverrideSet or 0) - if bit32.band(window.Flags, ImGuiWindowFlags.UnsavedDocument) ~= 0 then - tab_item_flags = bit32.bor(tab_item_flags, ImGuiTabItemFlags.UnsavedDocument) + if bit32.band(window.Flags, 262144 --[[ImGuiWindowFlags.UnsavedDocument]]) ~= 0 then + tab_item_flags = bit32.bor(tab_item_flags, 1 --[[ImGuiTabItemFlags.UnsavedDocument]]) end - if bit32.band(tab_bar.Flags, ImGuiTabBarFlags.NoCloseWithMiddleMouseButton) ~= 0 then - tab_item_flags = bit32.bor(tab_item_flags, ImGuiTabItemFlags.NoCloseWithMiddleMouseButton) + if bit32.band(tab_bar.Flags, 8 --[[ImGuiTabBarFlags.NoCloseWithMiddleMouseButton]]) ~= 0 then + tab_item_flags = bit32.bor(tab_item_flags, 4 --[[ImGuiTabItemFlags.NoCloseWithMiddleMouseButton]]) end -- Apply stored style overrides for the window - for color_n = 0, ImGuiWindowDockStyleCol.COUNT - 1 do + for color_n = 0, 9 --[[ImGuiWindowDockStyleCol.COUNT]] - 1 do ImVec4_Copy(g.Style.Colors[GWindowDockStyleColors[color_n]], ImGui.ColorConvertU32ToFloat4(window.DockStyle.Colors[color_n])) end @@ -2687,14 +2721,14 @@ function ImGui.DockNodeUpdateTabBar(node, host_window) window.DC.DockTabItemRect = ImRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max) -- Update navigation ID on menu layer - if g.NavWindow and g.NavWindow.RootWindow == window and bit32.band(window.DC.NavLayersActiveMask, bit32.lshift(1, ImGuiNavLayer.Menu)) == 0 then + if g.NavWindow and g.NavWindow.RootWindow == window and bit32.band(window.DC.NavLayersActiveMask, bit32.lshift(1, 1 --[[ImGuiNavLayer.Menu]])) == 0 then host_window.NavLastIds[1] = window.TabId end end end -- Restore style colors - for color_n = 0, ImGuiWindowDockStyleCol.COUNT - 1 do + for color_n = 0, 9 --[[ImGuiWindowDockStyleCol.COUNT]] - 1 do ImVec4_Copy(g.Style.Colors[GWindowDockStyleColors[color_n]], backup_style_cols[color_n]) end @@ -2710,9 +2744,9 @@ function ImGui.DockNodeUpdateTabBar(node, host_window) -- local close_button_is_visible = close_button_is_enabled -- Most people would expect this behavior of not even showing the button (leaving a hole since we can't claim that space as other windows in the tba bar have one) if close_button_is_visible then if not close_button_is_enabled then - ImGui.PushItemFlag(ImGuiItemFlags.Disabled, true) - local tc = style.Colors[ImGuiCol.Text] - ImGui.PushStyleColor(ImGuiCol.Text, ImVec4(tc.x, tc.y, tc.z, tc.w * 0.4)) + ImGui.PushItemFlag(64 --[[ImGuiItemFlags.Disabled]], true) + local tc = style.Colors[0 --[[ImGuiCol.Text]]] + ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], ImVec4(tc.x, tc.y, tc.z, tc.w * 0.4)) end if ImGui.CloseButton(host_window:GetID("#CLOSE"), close_button_pos) then node.WantCloseAll = true @@ -2733,7 +2767,7 @@ function ImGui.DockNodeUpdateTabBar(node, host_window) -- AllowOverlap mode required for appending into dock node tab bar, -- otherwise dragging window will steal HoveredId and amended tabs cannot get them. ImGui.KeepAliveID(title_bar_id) - local _, _, held = ImGui.ButtonBehavior(title_bar_rect, title_bar_id, ImGuiButtonFlags.AllowOverlap) + local _, _, held = ImGui.ButtonBehavior(title_bar_rect, title_bar_id, 4096 --[[ImGuiButtonFlags.AllowOverlap]]) if g.HoveredId == title_bar_id then g.LastItemData.ID = title_bar_id end if held then if ImGui.IsMouseClicked(0) then focus_tab_id = tab_bar.SelectedTabId end @@ -2768,13 +2802,13 @@ function ImGui.DockNodeUpdateTabBar(node, host_window) -- Restore SkipItems flag if not node:IsDockSpace() then - host_window.DC.NavLayerCurrent = ImGuiNavLayer.Main + host_window.DC.NavLayerCurrent = 0 --[[ImGuiNavLayer.Main]] host_window.SkipItems = backup_skip_item end end function ImGui.DockNodeAddTabBar(node) - IM_ASSERT(node.TabBar == nil) + assert(node.TabBar == nil) node.TabBar = ImGuiTabBar() end @@ -2844,9 +2878,9 @@ function ImGui.DockNodeCalcTabBarLayout(node) out_close_button_pos = ImVec2(r.Max.x - button_sz, r.Min.y + style.FramePadding.y) r.Max.x = r.Max.x - (button_sz + style.ItemInnerSpacing.x) end - if node.HasWindowMenuButton and style.WindowMenuButtonPosition == ImGuiDir.Left then + if node.HasWindowMenuButton and style.WindowMenuButtonPosition == 0 --[[ImGuiDir.Left]] then r.Min.x = r.Min.x + button_sz + style.ItemInnerSpacing.x - elseif node.HasWindowMenuButton and style.WindowMenuButtonPosition == ImGuiDir.Right then + elseif node.HasWindowMenuButton and style.WindowMenuButtonPosition == 1 --[[ImGuiDir.Right]] then window_menu_button_pos = ImVec2(r.Max.x - button_sz, r.Min.y + style.FramePadding.y) r.Max.x = r.Max.x - (button_sz + style.ItemInnerSpacing.x) end @@ -2857,7 +2891,7 @@ end function ImGui.DockNodeCalcSplitRects(pos_old, size_old, pos_new, size_new, dir, size_new_desired) local g = ImGui.GetCurrentContext() local dock_spacing = g.Style.ItemInnerSpacing.x - local axis = (dir == ImGuiDir.Left or dir == ImGuiDir.Right) and ImGuiAxis.X or ImGuiAxis.Y + local axis = (dir == 0 --[[ImGuiDir.Left]] or dir == 1 --[[ImGuiDir.Right]]) and 1 --[[ImGuiAxis.X]] or 2 --[[ImGuiAxis.Y]] local a, o = axis, 3 - axis -- the port's ImGuiAxis is 1-based (X=1,Y=2): it is directly the ImVec2 index pos_new[o] = pos_old[o] size_new[o] = size_old[o] @@ -2873,9 +2907,9 @@ function ImGui.DockNodeCalcSplitRects(pos_old, size_old, pos_new, size_new, dir, end -- Position each node - if dir == ImGuiDir.Right or dir == ImGuiDir.Down then + if dir == 1 --[[ImGuiDir.Right]] or dir == 3 --[[ImGuiDir.Down]] then pos_new[a] = pos_old[a] + size_old[a] + dock_spacing - elseif dir == ImGuiDir.Left or dir == ImGuiDir.Up then + elseif dir == 0 --[[ImGuiDir.Left]] or dir == 2 --[[ImGuiDir.Up]] then pos_new[a] = pos_old[a] pos_old[a] = pos_new[a] + size_new[a] + dock_spacing end @@ -2883,9 +2917,9 @@ end local function ImGetDirQuadrantFromDeltaLocal(dx, dy) if math.abs(dx) > math.abs(dy) then - return (dx > 0.0) and ImGuiDir.Right or ImGuiDir.Left + return (dx > 0.0) and 1 --[[ImGuiDir.Right]] or 0 --[[ImGuiDir.Left]] end - return (dy > 0.0) and ImGuiDir.Down or ImGuiDir.Up + return (dy > 0.0) and 3 --[[ImGuiDir.Down]] or 2 --[[ImGuiDir.Up]] end -- Retrieve the drop rectangles for a given direction or for the center + perform hit testing. @@ -2912,11 +2946,11 @@ function ImGui.DockNodeCalcDropRectsAndTestMousePos(parent, dir, outer_docking, local pc = parent:GetCenter() local c = ImVec2(ImTrunc(pc.x), ImTrunc(pc.y)) local out_r - if dir == ImGuiDir.None then out_r = ImRect(c.x - hs_w, c.y - hs_w, c.x + hs_w, c.y + hs_w) - elseif dir == ImGuiDir.Up then out_r = ImRect(c.x - hs_w, c.y - off.y - hs_h, c.x + hs_w, c.y - off.y + hs_h) - elseif dir == ImGuiDir.Down then out_r = ImRect(c.x - hs_w, c.y + off.y - hs_h, c.x + hs_w, c.y + off.y + hs_h) - elseif dir == ImGuiDir.Left then out_r = ImRect(c.x - off.x - hs_h, c.y - hs_w, c.x - off.x + hs_h, c.y + hs_w) - elseif dir == ImGuiDir.Right then out_r = ImRect(c.x + off.x - hs_h, c.y - hs_w, c.x + off.x + hs_h, c.y + hs_w) end + if dir == (-1) --[[ImGuiDir.None]] then out_r = ImRect(c.x - hs_w, c.y - hs_w, c.x + hs_w, c.y + hs_w) + elseif dir == 2 --[[ImGuiDir.Up]] then out_r = ImRect(c.x - hs_w, c.y - off.y - hs_h, c.x + hs_w, c.y - off.y + hs_h) + elseif dir == 3 --[[ImGuiDir.Down]] then out_r = ImRect(c.x - hs_w, c.y + off.y - hs_h, c.x + hs_w, c.y + off.y + hs_h) + elseif dir == 0 --[[ImGuiDir.Left]] then out_r = ImRect(c.x - off.x - hs_h, c.y - hs_w, c.x - off.x + hs_h, c.y + hs_w) + elseif dir == 1 --[[ImGuiDir.Right]] then out_r = ImRect(c.x + off.x - hs_h, c.y - hs_w, c.x + off.x + hs_h, c.y + hs_w) end if test_mouse_pos == nil then return false, out_r end @@ -2929,7 +2963,7 @@ function ImGui.DockNodeCalcDropRectsAndTestMousePos(parent, dir, outer_docking, local r_threshold_center = hs_w * 1.4 local r_threshold_sides = hs_w * (1.4 + 1.2) if mouse_delta_len2 < r_threshold_center * r_threshold_center then - return (dir == ImGuiDir.None), out_r + return (dir == (-1) --[[ImGuiDir.None]]), out_r end if mouse_delta_len2 < r_threshold_sides * r_threshold_sides then return (dir == ImGetDirQuadrantFromDeltaLocal(mdx, mdy)), out_r @@ -2948,7 +2982,7 @@ function ImGui.DockNodePreviewDockSetup(host_window, host_node, payload_window, -- Because the inactive leaf node doesn't have proper pos/size yet, we'll use the root node as reference. if payload_node == nil then payload_node = payload_window.DockNodeAsHost end local ref_node_for_rect = (host_node and not host_node.IsVisible) and ImGui.DockNodeGetRootNode(host_node) or host_node - if ref_node_for_rect then IM_ASSERT(ref_node_for_rect.IsVisible == true) end + if ref_node_for_rect then assert(ref_node_for_rect.IsVisible == true) end -- Filter, figure out where we are allowed to dock local src_node_flags = payload_node and payload_node.MergedFlags or payload_window.WindowClass.DockNodeFlagsOverrideSet @@ -2958,30 +2992,30 @@ function ImGui.DockNodePreviewDockSetup(host_window, host_node, payload_window, data.IsCenterAvailable = false elseif g.IO.ConfigDockingNoDockingOver then data.IsCenterAvailable = false - elseif bit32.band(dst_node_flags, ImGuiDockNodeFlags.NoDockingOverMe) ~= 0 then + elseif bit32.band(dst_node_flags, 1048576 --[[ImGuiDockNodeFlags.NoDockingOverMe]]) ~= 0 then data.IsCenterAvailable = false - elseif host_node and bit32.band(dst_node_flags, ImGuiDockNodeFlags.NoDockingOverCentralNode) ~= 0 and host_node:IsCentralNode() then + elseif host_node and bit32.band(dst_node_flags, 4 --[[ImGuiDockNodeFlags.NoDockingOverCentralNode]]) ~= 0 and host_node:IsCentralNode() then data.IsCenterAvailable = false elseif (not host_node or not host_node:IsEmpty()) and payload_node and payload_node:IsSplitNode() and (payload_node.OnlyNodeWithWindows == nil) then -- Is _visibly_ split? data.IsCenterAvailable = false - elseif bit32.band(src_node_flags, ImGuiDockNodeFlags.NoDockingOverOther) ~= 0 and (not host_node or not host_node:IsEmpty()) then + elseif bit32.band(src_node_flags, 2097152 --[[ImGuiDockNodeFlags.NoDockingOverOther]]) ~= 0 and (not host_node or not host_node:IsEmpty()) then data.IsCenterAvailable = false - elseif bit32.band(src_node_flags, ImGuiDockNodeFlags.NoDockingOverEmpty) ~= 0 and host_node and host_node:IsEmpty() then + elseif bit32.band(src_node_flags, 4194304 --[[ImGuiDockNodeFlags.NoDockingOverEmpty]]) ~= 0 and host_node and host_node:IsEmpty() then data.IsCenterAvailable = false end data.IsSidesAvailable = true - if bit32.band(dst_node_flags, ImGuiDockNodeFlags.NoDockingSplit) ~= 0 or g.IO.ConfigDockingNoSplit then + if bit32.band(dst_node_flags, 16 --[[ImGuiDockNodeFlags.NoDockingSplit]]) ~= 0 or g.IO.ConfigDockingNoSplit then data.IsSidesAvailable = false elseif not is_outer_docking and host_node and host_node.ParentNode == nil and host_node:IsCentralNode() then data.IsSidesAvailable = false - elseif bit32.band(src_node_flags, ImGuiDockNodeFlags.NoDockingSplitOther) ~= 0 then + elseif bit32.band(src_node_flags, 524288 --[[ImGuiDockNodeFlags.NoDockingSplitOther]]) ~= 0 then data.IsSidesAvailable = false end -- Build a tentative future node (reuse same structure because it is practical. Shape will be readjusted when previewing a split) data.FutureNode.HasCloseButton = (host_node and host_node.HasCloseButton or (not host_node and host_window.HasCloseButton)) or payload_window.HasCloseButton - data.FutureNode.HasWindowMenuButton = host_node and true or (bit32.band(host_window.Flags, ImGuiWindowFlags.NoCollapse) == 0) + data.FutureNode.HasWindowMenuButton = host_node and true or (bit32.band(host_window.Flags, 32 --[[ImGuiWindowFlags.NoCollapse]]) == 0) local rp = ref_node_for_rect and ref_node_for_rect.Pos or host_window.Pos local rs = ref_node_for_rect and ref_node_for_rect.Size or host_window.Size data.FutureNode.Pos = ImVec2(rp.x, rp.y) @@ -2989,11 +3023,11 @@ function ImGui.DockNodePreviewDockSetup(host_window, host_node, payload_window, -- Calculate drop shapes geometry for allowed splitting directions data.SplitNode = host_node - data.SplitDir = ImGuiDir.None + data.SplitDir = (-1) --[[ImGuiDir.None]] data.IsSplitDirExplicit = false if not host_window.Collapsed then - for dir = ImGuiDir.None, ImGuiDir.COUNT - 1 do - if not ((dir == ImGuiDir.None and not data.IsCenterAvailable) or (dir ~= ImGuiDir.None and not data.IsSidesAvailable)) then + for dir = (-1) --[[ImGuiDir.None]], 4 --[[ImGuiDir.COUNT]] - 1 do + if not ((dir == (-1) --[[ImGuiDir.None]] and not data.IsCenterAvailable) or (dir ~= (-1) --[[ImGuiDir.None]] and not data.IsSidesAvailable)) then local hit, r = ImGui.DockNodeCalcDropRectsAndTestMousePos(data.FutureNode:Rect(), dir, is_outer_docking, g.IO.MousePos) data.DropRectsDraw[dir + 1] = r if hit then @@ -3005,16 +3039,16 @@ function ImGui.DockNodePreviewDockSetup(host_window, host_node, payload_window, end -- When docking without holding Shift, we only allow and preview docking when hovering over a drop rect or over the title bar - data.IsDropAllowed = (data.SplitDir ~= ImGuiDir.None) or data.IsCenterAvailable + data.IsDropAllowed = (data.SplitDir ~= (-1) --[[ImGuiDir.None]]) or data.IsCenterAvailable if not is_explicit_target and not data.IsSplitDirExplicit and not g.IO.ConfigDockingWithShift then data.IsDropAllowed = false end -- Calculate split area data.SplitRatio = 0.0 - if data.SplitDir ~= ImGuiDir.None then + if data.SplitDir ~= (-1) --[[ImGuiDir.None]] then local split_dir = data.SplitDir - local split_axis = (split_dir == ImGuiDir.Left or split_dir == ImGuiDir.Right) and ImGuiAxis.X or ImGuiAxis.Y + local split_axis = (split_dir == 0 --[[ImGuiDir.Left]] or split_dir == 1 --[[ImGuiDir.Right]]) and 1 --[[ImGuiAxis.X]] or 2 --[[ImGuiAxis.Y]] local pos_new, pos_old = ImVec2(0, 0), ImVec2(data.FutureNode.Pos.x, data.FutureNode.Pos.y) local size_new, size_old = ImVec2(0, 0), ImVec2(data.FutureNode.Size.x, data.FutureNode.Size.y) ImGui.DockNodeCalcSplitRects(pos_old, size_old, pos_new, size_new, split_dir, payload_window.Size) @@ -3023,13 +3057,13 @@ function ImGui.DockNodePreviewDockSetup(host_window, host_node, payload_window, local split_ratio = ImSaturate(size_new[split_axis] / data.FutureNode.Size[split_axis]) data.FutureNode.Pos = pos_new data.FutureNode.Size = size_new - data.SplitRatio = (split_dir == ImGuiDir.Right or split_dir == ImGuiDir.Down) and (1.0 - split_ratio) or split_ratio + data.SplitRatio = (split_dir == 1 --[[ImGuiDir.Right]] or split_dir == 3 --[[ImGuiDir.Down]]) and (1.0 - split_ratio) or split_ratio end end function ImGui.DockNodePreviewDockRender(host_window, host_node, root_payload, data) local g = ImGui.GetCurrentContext() - IM_ASSERT(g.CurrentWindow == host_window) -- Because we rely on font size to calculate tab sizes + assert(g.CurrentWindow == host_window) -- Because we rely on font size to calculate tab sizes -- With this option, we only display the preview on the target viewport, and the payload viewport is made transparent. -- To compensate for the single layer obstructed by the payload, we'll increase the alpha of the preview nodes. @@ -3038,19 +3072,19 @@ function ImGui.DockNodePreviewDockRender(host_window, host_node, root_payload, d local overlay_draw_lists = { ImGui.GetForegroundDrawList(host_window.Viewport) } -- Draw main preview rectangle - local overlay_col_main = ImGui.GetColorU32(ImGuiCol.DockingPreview, is_transparent_payload and 0.60 or 0.40) - local overlay_col_drop = ImGui.GetColorU32(ImGuiCol.DockingPreview, is_transparent_payload and 0.90 or 0.70) - local overlay_col_drop_hovered = ImGui.GetColorU32(ImGuiCol.DockingPreview, is_transparent_payload and 1.20 or 1.00) - local overlay_col_lines = ImGui.GetColorU32(ImGuiCol.NavWindowingHighlight, is_transparent_payload and 0.80 or 0.60) + local overlay_col_main = ImGui.GetColorU32(42 --[[ImGuiCol.DockingPreview]], is_transparent_payload and 0.60 or 0.40) + local overlay_col_drop = ImGui.GetColorU32(42 --[[ImGuiCol.DockingPreview]], is_transparent_payload and 0.90 or 0.70) + local overlay_col_drop_hovered = ImGui.GetColorU32(42 --[[ImGuiCol.DockingPreview]], is_transparent_payload and 1.20 or 1.00) + local overlay_col_lines = ImGui.GetColorU32(60 --[[ImGuiCol.NavWindowingHighlight]], is_transparent_payload and 0.80 or 0.60) -- Display area preview local can_preview_tabs = (root_payload.DockNodeAsHost == nil or root_payload.DockNodeAsHost.Windows.Size > 0) if data.IsDropAllowed then local overlay_rect = data.FutureNode:Rect() - if data.SplitDir == ImGuiDir.None and can_preview_tabs then + if data.SplitDir == (-1) --[[ImGuiDir.None]] and can_preview_tabs then overlay_rect.Min.y = overlay_rect.Min.y + ImGui.GetFrameHeight() end - if data.SplitDir ~= ImGuiDir.None or data.IsCenterAvailable then + if data.SplitDir ~= (-1) --[[ImGuiDir.None]] or data.IsCenterAvailable then for _, dl in ipairs(overlay_draw_lists) do dl:AddRectFilled(overlay_rect.Min, overlay_rect.Max, overlay_col_main, host_window.WindowRounding, ImGui.CalcRoundingFlagsForRectInRect(overlay_rect, host_window:Rect(), g.Style.DockingSeparatorSize)) end @@ -3058,7 +3092,7 @@ function ImGui.DockNodePreviewDockRender(host_window, host_node, root_payload, d end -- Display tab shape/label preview unless we are splitting node (it generally makes the situation harder to read) - if data.IsDropAllowed and can_preview_tabs and data.SplitDir == ImGuiDir.None and data.IsCenterAvailable then + if data.IsDropAllowed and can_preview_tabs and data.SplitDir == (-1) --[[ImGuiDir.None]] and data.IsCenterAvailable then -- Compute target tab bar geometry so we can locate our preview tabs local _, tab_bar_rect = ImGui.DockNodeCalcTabBarLayout(data.FutureNode) local tab_pos = ImVec2(tab_bar_rect.Min.x, tab_bar_rect.Min.y) @@ -3068,13 +3102,13 @@ function ImGui.DockNodePreviewDockRender(host_window, host_node, root_payload, d else tab_pos.x = tab_pos.x + g.Style.ItemInnerSpacing.x + ImGui.TabItemCalcSize(host_node.Windows.Data[1]).x end - elseif bit32.band(host_window.Flags, ImGuiWindowFlags.DockNodeHost) == 0 then + elseif bit32.band(host_window.Flags, 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) == 0 then tab_pos.x = tab_pos.x + g.Style.ItemInnerSpacing.x + ImGui.TabItemCalcSize(host_window).x -- Account for slight offset which will be added when changing from title bar to tab bar end -- Draw tab shape/label preview (payload may be a loose window or a host window carrying multiple tabbed windows) if root_payload.DockNodeAsHost then - IM_ASSERT(root_payload.DockNodeAsHost.Windows.Size <= root_payload.DockNodeAsHost.TabBar.Tabs.Size) + assert(root_payload.DockNodeAsHost.Windows.Size <= root_payload.DockNodeAsHost.TabBar.Tabs.Size) end local tab_bar_with_payload = root_payload.DockNodeAsHost and root_payload.DockNodeAsHost.TabBar or nil local payload_count = tab_bar_with_payload and tab_bar_with_payload.Tabs.Size or 1 @@ -3086,13 +3120,13 @@ function ImGui.DockNodePreviewDockRender(host_window, host_node, root_payload, d local tab_size = ImGui.TabItemCalcSize(payload_window) local tab_bb = ImRect(tab_pos.x, tab_pos.y, tab_pos.x + tab_size.x, tab_pos.y + tab_size.y) tab_pos.x = tab_pos.x + tab_size.x + g.Style.ItemInnerSpacing.x - local overlay_col_text = ImGui.GetColorU32(payload_window.DockStyle.Colors[ImGuiWindowDockStyleCol.Text], 1.0, true) - local overlay_col_tabs = ImGui.GetColorU32(payload_window.DockStyle.Colors[ImGuiWindowDockStyleCol.TabSelected], 1.0, true) - local overlay_col_unsaved_marker = ImGui.GetColorU32(payload_window.DockStyle.Colors[ImGuiWindowDockStyleCol.UnsavedMarker], 1.0, true) - ImGui.PushStyleColor(ImGuiCol.Text, ImGui.ColorConvertU32ToFloat4(overlay_col_text)) - ImGui.PushStyleColor(ImGuiCol.UnsavedMarker, ImGui.ColorConvertU32ToFloat4(overlay_col_unsaved_marker)) + local overlay_col_text = ImGui.GetColorU32(payload_window.DockStyle.Colors[0 --[[ImGuiWindowDockStyleCol.Text]]], 1.0, true) + local overlay_col_tabs = ImGui.GetColorU32(payload_window.DockStyle.Colors[3 --[[ImGuiWindowDockStyleCol.TabSelected]]], 1.0, true) + local overlay_col_unsaved_marker = ImGui.GetColorU32(payload_window.DockStyle.Colors[8 --[[ImGuiWindowDockStyleCol.UnsavedMarker]]], 1.0, true) + ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], ImGui.ColorConvertU32ToFloat4(overlay_col_text)) + ImGui.PushStyleColor(58 --[[ImGuiCol.UnsavedMarker]], ImGui.ColorConvertU32ToFloat4(overlay_col_unsaved_marker)) for _, dl in ipairs(overlay_draw_lists) do - local tab_flags = bit32.band(payload_window.Flags, ImGuiWindowFlags.UnsavedDocument) ~= 0 and ImGuiTabItemFlags.UnsavedDocument or 0 + local tab_flags = bit32.band(payload_window.Flags, 262144 --[[ImGuiWindowFlags.UnsavedDocument]]) ~= 0 and 1 --[[ImGuiTabItemFlags.UnsavedDocument]] or 0 local contains = tab_bar_rect:Contains(tab_bb) if not contains then dl:PushClipRect(tab_bar_rect.Min, tab_bar_rect.Max) end ImGui.TabItemBackground(dl, tab_bb, tab_flags, overlay_col_tabs) @@ -3107,7 +3141,7 @@ function ImGui.DockNodePreviewDockRender(host_window, host_node, root_payload, d -- Display drop boxes local scale = g.Style._MainScale or 1.0 -- FIXME-DPI local overlay_rounding = ImMax(math.floor(3.0 * scale), g.Style.FrameRounding) - for dir = ImGuiDir.None, ImGuiDir.COUNT - 1 do + for dir = (-1) --[[ImGuiDir.None]], 4 --[[ImGuiDir.COUNT]] - 1 do local draw_r = data.DropRectsDraw[dir + 1] if not IsRectInverted(draw_r) then local draw_r_in = ImRect(draw_r.Min, draw_r.Max) @@ -3119,17 +3153,17 @@ function ImGui.DockNodePreviewDockRender(host_window, host_node, root_payload, d local center = ImVec2(math.floor(cc.x), math.floor(cc.y)) dl:AddRectFilled(draw_r.Min, draw_r.Max, overlay_col, overlay_rounding) dl:AddRect(draw_r_in.Min, draw_r_in.Max, overlay_col_lines, overlay_rounding, thickness) - if dir == ImGuiDir.Left or dir == ImGuiDir.Right then + if dir == 0 --[[ImGuiDir.Left]] or dir == 1 --[[ImGuiDir.Right]] then dl:AddLineV(center.x, draw_r_in.Min.y, draw_r_in.Max.y, overlay_col_lines, thickness) end - if dir == ImGuiDir.Up or dir == ImGuiDir.Down then + if dir == 2 --[[ImGuiDir.Up]] or dir == 3 --[[ImGuiDir.Down]] then dl:AddLineH(draw_r_in.Min.x, draw_r_in.Max.x, center.y, overlay_col_lines, thickness) end end end -- Stop after ImGuiDir.None - if (host_node and bit32.band(host_node.MergedFlags, ImGuiDockNodeFlags.NoDockingSplit) ~= 0) or g.IO.ConfigDockingNoSplit then + if (host_node and bit32.band(host_node.MergedFlags, 16 --[[ImGuiDockNodeFlags.NoDockingSplit]]) ~= 0) or g.IO.ConfigDockingNoSplit then return end end @@ -3149,7 +3183,7 @@ end function ImGui.DockNodeTreeSplit(ctx, parent_node, split_axis, split_inheritor_child_idx, split_ratio, new_node) local g = ImGui.GetCurrentContext() - IM_ASSERT(split_axis ~= ImGuiAxis.None) + assert(split_axis ~= 0 --[[ImGuiAxis.None]]) local child_0 = (new_node and split_inheritor_child_idx ~= 0) and new_node or ImGui.DockContextAddNode(ctx, 0) child_0.ParentNode = parent_node @@ -3164,13 +3198,13 @@ function ImGui.DockNodeTreeSplit(ctx, parent_node, split_axis, split_inheritor_c parent_node.ChildNodes[split_inheritor_child_idx].VisibleWindow = parent_node.VisibleWindow parent_node.SplitAxis = split_axis parent_node.VisibleWindow = nil - parent_node.AuthorityForPos = ImGuiDataAuthority.DockNode - parent_node.AuthorityForSize = ImGuiDataAuthority.DockNode + parent_node.AuthorityForPos = 1 --[[ImGuiDataAuthority.DockNode]] + parent_node.AuthorityForSize = 1 --[[ImGuiDataAuthority.DockNode]] local a = split_axis local size_avail = parent_node.Size[a] - g.Style.DockingSeparatorSize size_avail = ImMax(size_avail, g.Style.WindowMinSize[a] * 2.0) - IM_ASSERT(size_avail > 0.0) -- If you created a node manually with DockBuilderAddNode(), you need to also call DockBuilderSetNodeSize() before splitting. + assert(size_avail > 0.0) -- If you created a node manually with DockBuilderAddNode(), you need to also call DockBuilderSetNodeSize() before splitting. child_0.SizeRef = ImVec2(parent_node.Size.x, parent_node.Size.y) child_1.SizeRef = ImVec2(parent_node.Size.x, parent_node.Size.y) child_0.SizeRef[a] = ImTrunc(size_avail * split_ratio) @@ -3182,10 +3216,10 @@ function ImGui.DockNodeTreeSplit(ctx, parent_node, split_axis, split_inheritor_c ImGui.DockNodeTreeUpdatePosSize(parent_node, parent_node.Pos, parent_node.Size) -- Flags transfer (e.g. this is where we transfer the ImGuiDockNodeFlags.CentralNode property) - child_0.SharedFlags = bit32.band(parent_node.SharedFlags, ImGuiDockNodeFlags.SharedFlagsInheritMask_) - child_1.SharedFlags = bit32.band(parent_node.SharedFlags, ImGuiDockNodeFlags.SharedFlagsInheritMask_) - child_inheritor.LocalFlags = bit32.band(parent_node.LocalFlags, ImGuiDockNodeFlags.LocalFlagsTransferMask_) - parent_node.LocalFlags = bit32.band(parent_node.LocalFlags, bit32.bnot(ImGuiDockNodeFlags.LocalFlagsTransferMask_)) + child_0.SharedFlags = bit32.band(parent_node.SharedFlags, 4294967295 --[[ImGuiDockNodeFlags.SharedFlagsInheritMask_]]) + child_1.SharedFlags = bit32.band(parent_node.SharedFlags, 4294967295 --[[ImGuiDockNodeFlags.SharedFlagsInheritMask_]]) + child_inheritor.LocalFlags = bit32.band(parent_node.LocalFlags, 260208 --[[ImGuiDockNodeFlags.LocalFlagsTransferMask_]]) + parent_node.LocalFlags = bit32.band(parent_node.LocalFlags, bit32.bnot(260208 --[[ImGuiDockNodeFlags.LocalFlagsTransferMask_]])) child_0:UpdateMergedFlags() child_1:UpdateMergedFlags() parent_node:UpdateMergedFlags() @@ -3198,11 +3232,11 @@ function ImGui.DockNodeTreeMerge(ctx, parent_node, merge_lead_child) -- When called from DockContextProcessUndockNode() it is possible that one of the child is nil. local child_0 = parent_node.ChildNodes[0] local child_1 = parent_node.ChildNodes[1] - IM_ASSERT(child_0 or child_1) - IM_ASSERT(merge_lead_child == child_0 or merge_lead_child == child_1) + assert(child_0 or child_1) + assert(merge_lead_child == child_0 or merge_lead_child == child_1) if (child_0 and child_0.Windows.Size > 0) or (child_1 and child_1.Windows.Size > 0) then - IM_ASSERT(parent_node.TabBar == nil) - IM_ASSERT(parent_node.Windows.Size == 0) + assert(parent_node.TabBar == nil) + assert(parent_node.Windows.Size == 0) end local backup_last_explicit_size = ImVec2(parent_node.SizeRef.x, parent_node.SizeRef.y) @@ -3216,14 +3250,14 @@ function ImGui.DockNodeTreeMerge(ctx, parent_node, merge_lead_child) DockSettingsRenameNodeReferences(child_1.ID, parent_node.ID) end ImGui.DockNodeApplyPosSizeToWindows(parent_node) - parent_node.AuthorityForPos = ImGuiDataAuthority.Auto - parent_node.AuthorityForSize = ImGuiDataAuthority.Auto - parent_node.AuthorityForViewport = ImGuiDataAuthority.Auto + parent_node.AuthorityForPos = 0 --[[ImGuiDataAuthority.Auto]] + parent_node.AuthorityForSize = 0 --[[ImGuiDataAuthority.Auto]] + parent_node.AuthorityForViewport = 0 --[[ImGuiDataAuthority.Auto]] parent_node.VisibleWindow = merge_lead_child.VisibleWindow parent_node.SizeRef = backup_last_explicit_size -- Flags transfer - local M = ImGuiDockNodeFlags.LocalFlagsTransferMask_ + local M = 260208 --[[ImGuiDockNodeFlags.LocalFlagsTransferMask_]] parent_node.LocalFlags = bit32.band(parent_node.LocalFlags, bit32.bnot(M)) -- Preserve Dockspace flag parent_node.LocalFlags = bit32.bor(parent_node.LocalFlags, bit32.band(child_0 and child_0.LocalFlags or 0, M)) parent_node.LocalFlags = bit32.bor(parent_node.LocalFlags, bit32.band(child_1 and child_1.LocalFlags or 0, M)) @@ -3342,7 +3376,7 @@ function ImGui.DockNodeTreeUpdateSplitter(node) if child_0.IsVisible and child_1.IsVisible then -- Bounding box of the splitter cover the space between both nodes (w = Spacing, h = Size[xy^1] for when splitting horizontally) local axis = node.SplitAxis - IM_ASSERT(axis ~= ImGuiAxis.None) + assert(axis ~= 0 --[[ImGuiAxis.None]]) local a, o = axis, 3 - axis -- the port's ImGuiAxis is 1-based (X=1,Y=2): it is directly the ImVec2 index local bb = ImRect(ImVec2(child_0.Pos.x, child_0.Pos.y), ImVec2(child_1.Pos.x, child_1.Pos.y)) bb.Min[a] = bb.Min[a] + child_0.Size[a] @@ -3350,10 +3384,10 @@ function ImGui.DockNodeTreeUpdateSplitter(node) -- if g.IO.KeyCtrl then GetForegroundDrawList(g.CurrentWindow.Viewport):AddRect(bb.Min, bb.Max, IM_COL32(255,0,255,255)) end local merged_flags = bit32.bor(child_0.MergedFlags, child_1.MergedFlags) -- Merged flags for BOTH childs - local no_resize_axis_flag = (axis == ImGuiAxis.X) and ImGuiDockNodeFlags.NoResizeX or ImGuiDockNodeFlags.NoResizeY - if bit32.band(merged_flags, ImGuiDockNodeFlags.NoResize) ~= 0 or bit32.band(merged_flags, no_resize_axis_flag) ~= 0 then + local no_resize_axis_flag = (axis == 1 --[[ImGuiAxis.X]]) and 65536 --[[ImGuiDockNodeFlags.NoResizeX]] or 131072 --[[ImGuiDockNodeFlags.NoResizeY]] + if bit32.band(merged_flags, 32 --[[ImGuiDockNodeFlags.NoResize]]) ~= 0 or bit32.band(merged_flags, no_resize_axis_flag) ~= 0 then local window = g.CurrentWindow - window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(ImGuiCol.Separator), g.Style.FrameRounding) + window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(28 --[[ImGuiCol.Separator]]), g.Style.FrameRounding) else -- bb.Min[axis] = bb.Min[axis] + 1 -- Display a little inward so highlight doesn't connect with nearby tabs on the neighbor node. -- bb.Max[axis] = bb.Max[axis] - 1 @@ -3381,7 +3415,7 @@ function ImGui.DockNodeTreeUpdateSplitter(node) local cur_size_1 = child_1.Size[a] local min_size_0 = resize_limits[0] - child_0.Pos[a] local min_size_1 = child_1.Pos[a] + child_1.Size[a] - resize_limits[1] - local bg_col = ImGui.GetColorU32(ImGuiCol.WindowBg) + local bg_col = ImGui.GetColorU32(2 --[[ImGuiCol.WindowBg]]) local changed changed, cur_size_0, cur_size_1 = ImGui.SplitterBehavior(bb, ImGui.GetID("##Splitter"), axis, cur_size_0, cur_size_1, min_size_0, min_size_1, g.WindowsBorderHoverPadding, WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER, bg_col) if changed then @@ -3454,7 +3488,7 @@ end function ImGui.SetWindowDock(window, dock_id, cond) -- Test condition (NB: bit 0 is always true) and clear flags for next time if cond and cond ~= 0 and bit32.band(window.SetWindowDockAllowFlags, cond) == 0 then return end - window.SetWindowDockAllowFlags = bit32.band(window.SetWindowDockAllowFlags, bit32.bnot(bit32.bor(ImGuiCond.Once, ImGuiCond.FirstUseEver, ImGuiCond.Appearing))) + window.SetWindowDockAllowFlags = bit32.band(window.SetWindowDockAllowFlags, bit32.bnot(bit32.bor(2 --[[ImGuiCond.Once]], 4 --[[ImGuiCond.FirstUseEver]], 8 --[[ImGuiCond.Appearing]]))) if window.DockId == dock_id then return end @@ -3465,7 +3499,7 @@ function ImGui.SetWindowDock(window, dock_id, cond) -- Policy: Find central node or latest focused node. We first move back to our root node. new_node = ImGui.DockNodeGetRootNode(new_node) if new_node.CentralNode then - IM_ASSERT(new_node.CentralNode:IsCentralNode()) + assert(new_node.CentralNode:IsCentralNode()) dock_id = new_node.CentralNode.ID else dock_id = new_node.LastFocusedNodeId @@ -3487,37 +3521,37 @@ function ImGui.DockSpace(dockspace_id, size_arg, flags, window_class) if flags == nil then flags = 0 end local g = ImGui.GetCurrentContext() local window = ImGui.GetCurrentWindowRead() - if bit32.band(g.IO.ConfigFlags, ImGuiConfigFlags.DockingEnable) == 0 then return 0 end + if bit32.band(g.IO.ConfigFlags, 128 --[[ImGuiConfigFlags.DockingEnable]]) == 0 then return 0 end -- Early out if parent window is hidden/collapsed -- This is faster but also DockNodeUpdateTabBar() relies on TabBarLayout() running (which won't if SkipItems=true) to set NextSelectedTabId = 0). See #2960. -- If for whichever reason this is causing problem we would need to ensure that DockNodeUpdateTabBar() ends up clearing NextSelectedTabId even if SkipItems=true. - if window.SkipItems then flags = bit32.bor(flags, ImGuiDockNodeFlags.KeepAliveOnly) end - if bit32.band(flags, ImGuiDockNodeFlags.KeepAliveOnly) == 0 then window = ImGui.GetCurrentWindow() end -- call to set window.WriteAccessed = true; + if window.SkipItems then flags = bit32.bor(flags, 1 --[[ImGuiDockNodeFlags.KeepAliveOnly]]) end + if bit32.band(flags, 1 --[[ImGuiDockNodeFlags.KeepAliveOnly]]) == 0 then window = ImGui.GetCurrentWindow() end -- call to set window.WriteAccessed = true; - IM_ASSERT(bit32.band(flags, ImGuiDockNodeFlags.DockSpace) == 0) -- Flag is automatically set by DockSpace() as LocalFlags, not SharedFlags! - IM_ASSERT(bit32.band(flags, ImGuiDockNodeFlags.CentralNode) == 0) -- Flag is automatically set by DockSpace() as LocalFlags, not SharedFlags! (#8145) + assert(bit32.band(flags, 1024 --[[ImGuiDockNodeFlags.DockSpace]]) == 0) -- Flag is automatically set by DockSpace() as LocalFlags, not SharedFlags! + assert(bit32.band(flags, 2048 --[[ImGuiDockNodeFlags.CentralNode]]) == 0) -- Flag is automatically set by DockSpace() as LocalFlags, not SharedFlags! (#8145) - IM_ASSERT(dockspace_id ~= 0) + assert(dockspace_id ~= 0) local node = ImGui.DockContextFindNodeByID(g, dockspace_id) if node == nil then node = ImGui.DockContextAddNode(g, dockspace_id) - node:SetLocalFlags(ImGuiDockNodeFlags.CentralNode) + node:SetLocalFlags(2048 --[[ImGuiDockNodeFlags.CentralNode]]) end node.SharedFlags = flags node.WindowClass = window_class or ImGuiWindowClass() -- When a DockSpace transitioned form implicit to explicit this may be called a second time -- It is possible that the node has already been claimed by a docked window which appeared before the DockSpace() node, so we overwrite IsDockSpace again. - if node.LastFrameActive == g.FrameCount and bit32.band(flags, ImGuiDockNodeFlags.KeepAliveOnly) == 0 then - IM_ASSERT(node:IsDockSpace() == false, "Cannot call DockSpace() twice a frame with the same ID") - node:SetLocalFlags(bit32.bor(node.LocalFlags, ImGuiDockNodeFlags.DockSpace)) + if node.LastFrameActive == g.FrameCount and bit32.band(flags, 1 --[[ImGuiDockNodeFlags.KeepAliveOnly]]) == 0 then + assert(node:IsDockSpace() == false, "Cannot call DockSpace() twice a frame with the same ID") + node:SetLocalFlags(bit32.bor(node.LocalFlags, 1024 --[[ImGuiDockNodeFlags.DockSpace]])) return dockspace_id end - node:SetLocalFlags(bit32.bor(node.LocalFlags, ImGuiDockNodeFlags.DockSpace)) + node:SetLocalFlags(bit32.bor(node.LocalFlags, 1024 --[[ImGuiDockNodeFlags.DockSpace]])) -- Keep alive mode, this is allow windows docked into this node so stay docked even if they are not visible - if bit32.band(flags, ImGuiDockNodeFlags.KeepAliveOnly) ~= 0 then + if bit32.band(flags, 1 --[[ImGuiDockNodeFlags.KeepAliveOnly]]) ~= 0 then node.LastFrameAlive = g.FrameCount return dockspace_id end @@ -3526,7 +3560,7 @@ function ImGui.DockSpace(dockspace_id, size_arg, flags, window_class) local size = ImVec2(ImTrunc(size_arg.x), ImTrunc(size_arg.y)) if size.x <= 0.0 then size.x = ImMax(content_avail.x + size.x, 4.0) end -- Arbitrary minimum child size (0.0f causing too much issues) if size.y <= 0.0 then size.y = ImMax(content_avail.y + size.y, 4.0) end - IM_ASSERT(size.x > 0.0 and size.y > 0.0) + assert(size.x > 0.0 and size.y > 0.0) node.Pos = ImVec2(window.DC.CursorPos.x, window.DC.CursorPos.y) node.Size = ImVec2(size.x, size.y) @@ -3537,14 +3571,14 @@ function ImGui.DockSpace(dockspace_id, size_arg, flags, window_class) -- FIXME-DOCK: Why do we need a child window to host a dockspace, could we host it in the existing window? -- FIXME-DOCK: What is the reason for not simply calling BeginChild()? (OK to have a reason but should be commented) - local window_flags = bit32.bor(ImGuiWindowFlags.ChildWindow, ImGuiWindowFlags.DockNodeHost) - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.NoSavedSettings, ImGuiWindowFlags.NoResize, ImGuiWindowFlags.NoCollapse, ImGuiWindowFlags.NoTitleBar) - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.NoScrollbar, ImGuiWindowFlags.NoScrollWithMouse) - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.NoBackground) + local window_flags = bit32.bor(16777216 --[[ImGuiWindowFlags.ChildWindow]], 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) + window_flags = bit32.bor(window_flags, 256 --[[ImGuiWindowFlags.NoSavedSettings]], 2 --[[ImGuiWindowFlags.NoResize]], 32 --[[ImGuiWindowFlags.NoCollapse]], 1 --[[ImGuiWindowFlags.NoTitleBar]]) + window_flags = bit32.bor(window_flags, 8 --[[ImGuiWindowFlags.NoScrollbar]], 16 --[[ImGuiWindowFlags.NoScrollWithMouse]]) + window_flags = bit32.bor(window_flags, 128 --[[ImGuiWindowFlags.NoBackground]]) local title = string.format("%s/DockSpace_%08X", window.Name, dockspace_id) - ImGui.PushStyleVar(ImGuiStyleVar.ChildBorderSize, 0.0) + ImGui.PushStyleVar(8 --[[ImGuiStyleVar.ChildBorderSize]], 0.0) ImGui.Begin(title, nil, window_flags) ImGui.PopStyleVar() @@ -3553,7 +3587,7 @@ function ImGui.DockSpace(dockspace_id, size_arg, flags, window_class) host_window.ChildId = window:GetID(title) node.OnlyNodeWithWindows = nil - IM_ASSERT(node:IsRootNode()) + assert(node:IsRootNode()) -- We need to handle the rare case were a central node is missing. -- This can happen if the node was first created manually with DockBuilderAddNode() but _without_ the ImGuiDockNodeFlags.Dockspace. @@ -3562,7 +3596,7 @@ function ImGui.DockSpace(dockspace_id, size_arg, flags, window_class) -- The specific sub-property of _CentralNode we are interested in recovering here is the "Don't delete when empty" property, -- as it doesn't make sense for an empty dockspace to not have this property. if node:IsLeafNode() and not node:IsCentralNode() then - node:SetLocalFlags(bit32.bor(node.LocalFlags, ImGuiDockNodeFlags.CentralNode)) + node:SetLocalFlags(bit32.bor(node.LocalFlags, 2048 --[[ImGuiDockNodeFlags.CentralNode]])) end -- Update the node @@ -3572,9 +3606,9 @@ function ImGui.DockSpace(dockspace_id, size_arg, flags, window_class) local bb = ImRect(node.Pos, node.Pos + size) ImGui.ItemSize(size) - ImGui.ItemAdd(bb, dockspace_id, nil, ImGuiItemFlags.NoNav) -- Not a nav point (could be, would need to draw the nav rect and replicate/refactor activation from BeginChild(), but seems like CTRL+Tab works better here?) - if bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HoveredRect) ~= 0 and ImGui.IsWindowChildOf(g.HoveredWindow, host_window, false, true) then -- To fullfill IsItemHovered(), similar to EndChild() - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HoveredWindow) + ImGui.ItemAdd(bb, dockspace_id, nil, 2 --[[ImGuiItemFlags.NoNav]]) -- Not a nav point (could be, would need to draw the nav rect and replicate/refactor activation from BeginChild(), but seems like CTRL+Tab works better here?) + if bit32.band(g.LastItemData.StatusFlags, 1 --[[ImGuiItemStatusFlags.HoveredRect]]) ~= 0 and ImGui.IsWindowChildOf(g.HoveredWindow, host_window, false, true) then -- To fullfill IsItemHovered(), similar to EndChild() + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 128 --[[ImGuiItemStatusFlags.HoveredWindow]]) end return dockspace_id @@ -3595,23 +3629,23 @@ function ImGui.DockSpaceOverViewport(dockspace_id, viewport, dockspace_flags, wi ImGui.SetNextWindowViewport(viewport.ID) local host_window_flags = 0 - host_window_flags = bit32.bor(host_window_flags, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoCollapse, ImGuiWindowFlags.NoResize, ImGuiWindowFlags.NoMove, ImGuiWindowFlags.NoDocking) - host_window_flags = bit32.bor(host_window_flags, ImGuiWindowFlags.NoBringToFrontOnFocus, ImGuiWindowFlags.NoNavFocus) - if bit32.band(dockspace_flags, ImGuiDockNodeFlags.PassthruCentralNode) ~= 0 then - host_window_flags = bit32.bor(host_window_flags, ImGuiWindowFlags.NoBackground) + host_window_flags = bit32.bor(host_window_flags, 1 --[[ImGuiWindowFlags.NoTitleBar]], 32 --[[ImGuiWindowFlags.NoCollapse]], 2 --[[ImGuiWindowFlags.NoResize]], 4 --[[ImGuiWindowFlags.NoMove]], 524288 --[[ImGuiWindowFlags.NoDocking]]) + host_window_flags = bit32.bor(host_window_flags, 8192 --[[ImGuiWindowFlags.NoBringToFrontOnFocus]], 131072 --[[ImGuiWindowFlags.NoNavFocus]]) + if bit32.band(dockspace_flags, 8 --[[ImGuiDockNodeFlags.PassthruCentralNode]]) ~= 0 then + host_window_flags = bit32.bor(host_window_flags, 128 --[[ImGuiWindowFlags.NoBackground]]) end -- FIXME-OPT: When using ImGuiDockNodeFlags.KeepAliveOnly with DockSpaceOverViewport() we might be able to spare submitting the window, -- since DockSpace() with that flag doesn't need a window. We'd only need to compute the default ID accordingly. - if bit32.band(dockspace_flags, ImGuiDockNodeFlags.KeepAliveOnly) ~= 0 then - host_window_flags = bit32.bor(host_window_flags, ImGuiWindowFlags.NoMouseInputs) + if bit32.band(dockspace_flags, 1 --[[ImGuiDockNodeFlags.KeepAliveOnly]]) ~= 0 then + host_window_flags = bit32.bor(host_window_flags, 512 --[[ImGuiWindowFlags.NoMouseInputs]]) end local label = string.format("WindowOverViewport_%08X", viewport.ID) - ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 0.0) - ImGui.PushStyleVar(ImGuiStyleVar.WindowBorderSize, 0.0) - ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, ImVec2(0.0, 0.0)) + ImGui.PushStyleVar(3 --[[ImGuiStyleVar.WindowRounding]], 0.0) + ImGui.PushStyleVar(4 --[[ImGuiStyleVar.WindowBorderSize]], 0.0) + ImGui.PushStyleVar(2 --[[ImGuiStyleVar.WindowPadding]], ImVec2(0.0, 0.0)) ImGui.Begin(label, nil, host_window_flags) ImGui.PopStyleVar(3) @@ -3654,7 +3688,7 @@ function ImGui.DockBuilderDockWindow(window_name, node_id) if window then -- Apply to created window local prev_node_id = window.DockId - ImGui.SetWindowDock(window, node_id, ImGuiCond.Always) + ImGui.SetWindowDock(window, node_id, 1 --[[ImGuiCond.Always]]) if window.DockId ~= prev_node_id then window.DockOrder = -1 end else -- Apply to settings @@ -3679,16 +3713,16 @@ function ImGui.DockBuilderSetNodePos(node_id, pos) local node = ImGui.DockContextFindNodeByID(ImGui.GetCurrentContext(), node_id) if node == nil then return end node.Pos = ImVec2(pos.x, pos.y) - node.AuthorityForPos = ImGuiDataAuthority.DockNode + node.AuthorityForPos = 1 --[[ImGuiDataAuthority.DockNode]] end function ImGui.DockBuilderSetNodeSize(node_id, size) local node = ImGui.DockContextFindNodeByID(ImGui.GetCurrentContext(), node_id) if node == nil then return end - IM_ASSERT(size.x > 0.0 and size.y > 0.0) + assert(size.x > 0.0 and size.y > 0.0) node.Size = ImVec2(size.x, size.y) node.SizeRef = ImVec2(size.x, size.y) - node.AuthorityForSize = ImGuiDataAuthority.DockNode + node.AuthorityForSize = 1 --[[ImGuiDataAuthority.DockNode]] end -- Make sure to use the ImGuiDockNodeFlags.DockSpace flag to create a dockspace node! Otherwise this will create a floating node! @@ -3705,8 +3739,8 @@ function ImGui.DockBuilderAddNode(node_id, flags) if node_id ~= 0 then ImGui.DockBuilderRemoveNode(node_id) end local node - if bit32.band(flags, ImGuiDockNodeFlags.DockSpace) ~= 0 then - ImGui.DockSpace(node_id, ImVec2(0, 0), bit32.bor(bit32.band(flags, bit32.bnot(ImGuiDockNodeFlags.DockSpace)), ImGuiDockNodeFlags.KeepAliveOnly)) + if bit32.band(flags, 1024 --[[ImGuiDockNodeFlags.DockSpace]]) ~= 0 then + ImGui.DockSpace(node_id, ImVec2(0, 0), bit32.bor(bit32.band(flags, bit32.bnot(1024 --[[ImGuiDockNodeFlags.DockSpace]])), 1 --[[ImGuiDockNodeFlags.KeepAliveOnly]])) node = ImGui.DockContextFindNodeByID(g, node_id) else node = ImGui.DockContextAddNode(g, node_id) @@ -3726,7 +3760,7 @@ function ImGui.DockBuilderRemoveNode(node_id) node = ImGui.DockContextFindNodeByID(g, node_id) if node == nil then return end if node:IsCentralNode() and node.ParentNode then - node.ParentNode:SetLocalFlags(bit32.bor(node.ParentNode.LocalFlags, ImGuiDockNodeFlags.CentralNode)) + node.ParentNode:SetLocalFlags(bit32.bor(node.ParentNode.LocalFlags, 2048 --[[ImGuiDockNodeFlags.CentralNode]])) end ImGui.DockContextRemoveNode(g, node, true) end @@ -3740,8 +3774,8 @@ function ImGui.DockBuilderRemoveNodeChildNodes(root_id) if root_id ~= 0 and root_node == nil then return end local has_central_node = false - local backup_root_node_authority_for_pos = root_node and root_node.AuthorityForPos or ImGuiDataAuthority.Auto - local backup_root_node_authority_for_size = root_node and root_node.AuthorityForSize or ImGuiDataAuthority.Auto + local backup_root_node_authority_for_pos = root_node and root_node.AuthorityForPos or 0 --[[ImGuiDataAuthority.Auto]] + local backup_root_node_authority_for_size = root_node and root_node.AuthorityForSize or 0 --[[ImGuiDataAuthority.Auto]] -- Process active windows local nodes_to_remove = {} @@ -3796,7 +3830,7 @@ function ImGui.DockBuilderRemoveNodeChildNodes(root_id) dc.Requests:clear() elseif has_central_node then root_node.CentralNode = root_node - root_node:SetLocalFlags(bit32.bor(root_node.LocalFlags, ImGuiDockNodeFlags.CentralNode)) + root_node:SetLocalFlags(bit32.bor(root_node.LocalFlags, 2048 --[[ImGuiDockNodeFlags.CentralNode]])) end end @@ -3822,7 +3856,7 @@ function ImGui.DockBuilderRemoveNodeDockedWindows(root_id, clear_settings_refs) if want_removal then local backup_dock_id = window.DockId ImGui.DockContextProcessUndockWindow(g, window, clear_settings_refs) - if not clear_settings_refs then IM_ASSERT(window.DockId == backup_dock_id) end + if not clear_settings_refs then assert(window.DockId == backup_dock_id) end end end end @@ -3833,11 +3867,11 @@ end --- @return ImGuiID id_at_dir, ImGuiID id_at_opposite_dir function ImGui.DockBuilderSplitNode(id, split_dir, size_ratio_for_node_at_dir) local g = ImGui.GetCurrentContext() - IM_ASSERT(split_dir ~= ImGuiDir.None) + assert(split_dir ~= (-1) --[[ImGuiDir.None]]) local node = ImGui.DockContextFindNodeByID(g, id) if node == nil then - IM_ASSERT(node ~= nil) + assert(node ~= nil) return 0, 0 end @@ -3847,11 +3881,11 @@ function ImGui.DockBuilderSplitNode(id, split_dir, size_ratio_for_node_at_dir) req.DockTargetNode = node req.DockPayload = nil req.DockSplitDir = split_dir - req.DockSplitRatio = ImSaturate((split_dir == ImGuiDir.Left or split_dir == ImGuiDir.Up) and size_ratio_for_node_at_dir or (1.0 - size_ratio_for_node_at_dir)) + req.DockSplitRatio = ImSaturate((split_dir == 0 --[[ImGuiDir.Left]] or split_dir == 2 --[[ImGuiDir.Up]]) and size_ratio_for_node_at_dir or (1.0 - size_ratio_for_node_at_dir)) req.DockSplitOuter = false ImGui.DockContextProcessDock(g, req) - local first = (split_dir == ImGuiDir.Left or split_dir == ImGuiDir.Up) + local first = (split_dir == 0 --[[ImGuiDir.Left]] or split_dir == 2 --[[ImGuiDir.Up]]) local id_at_dir = node.ChildNodes[first and 0 or 1].ID local id_at_opposite_dir = node.ChildNodes[first and 1 or 0].ID return id_at_dir, id_at_opposite_dir @@ -3862,7 +3896,7 @@ local function DockBuilderCopyNodeRec(src_node, dst_node_id_if_known, out_node_r local dst_node = ImGui.DockContextAddNode(g, dst_node_id_if_known) dst_node.SharedFlags = src_node.SharedFlags dst_node.LocalFlags = src_node.LocalFlags - dst_node.LocalFlagsInWindows = ImGuiDockNodeFlags.None + dst_node.LocalFlagsInWindows = 0 --[[ImGuiDockNodeFlags.None]] dst_node.Pos = ImVec2(src_node.Pos.x, src_node.Pos.y) dst_node.Size = ImVec2(src_node.Size.x, src_node.Size.y) dst_node.SizeRef = ImVec2(src_node.SizeRef.x, src_node.SizeRef.y) @@ -3884,18 +3918,18 @@ end --- @param out_node_remap_pairs table # 1-based array, cleared and filled with (src_id, dst_id) pairs function ImGui.DockBuilderCopyNode(src_node_id, dst_node_id, out_node_remap_pairs) local g = ImGui.GetCurrentContext() - IM_ASSERT(src_node_id ~= 0) - IM_ASSERT(dst_node_id ~= 0) - IM_ASSERT(out_node_remap_pairs ~= nil) + assert(src_node_id ~= 0) + assert(dst_node_id ~= 0) + assert(out_node_remap_pairs ~= nil) ImGui.DockBuilderRemoveNode(dst_node_id) local src_node = ImGui.DockContextFindNodeByID(g, src_node_id) - IM_ASSERT(src_node ~= nil) + assert(src_node ~= nil) for k in pairs(out_node_remap_pairs) do out_node_remap_pairs[k] = nil end DockBuilderCopyNodeRec(src_node, dst_node_id, out_node_remap_pairs) - IM_ASSERT((#out_node_remap_pairs % 2) == 0) + assert((#out_node_remap_pairs % 2) == 0) end function ImGui.DockBuilderCopyWindowSettings(src_name, dst_name) @@ -3926,10 +3960,10 @@ end -- FIXME: Will probably want to change this signature, in particular how the window remapping pairs are passed. --- @param in_window_remap_pairs table # 1-based array of window names: src0, dst0, src1, dst1, ... function ImGui.DockBuilderCopyDockSpace(src_dockspace_id, dst_dockspace_id, in_window_remap_pairs) - IM_ASSERT(src_dockspace_id ~= 0) - IM_ASSERT(dst_dockspace_id ~= 0) - IM_ASSERT(in_window_remap_pairs ~= nil) - IM_ASSERT((#in_window_remap_pairs % 2) == 0) + assert(src_dockspace_id ~= 0) + assert(dst_dockspace_id ~= 0) + assert(in_window_remap_pairs ~= nil) + assert((#in_window_remap_pairs % 2) == 0) -- Duplicate entire dock -- FIXME: When overwriting dst_dockspace_id, windows that aren't part of our dockspace window class but that are docked in a same node will be split apart, @@ -4015,7 +4049,7 @@ end function ImGui.GetWindowAlwaysWantOwnTabBar(window) local g = ImGui.GetCurrentContext() if g.IO.ConfigDockingAlwaysTabBar or window.WindowClass.DockingAlwaysTabBar then - if bit32.band(window.Flags, bit32.bor(ImGuiWindowFlags.ChildWindow, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoDocking)) == 0 then + if bit32.band(window.Flags, bit32.bor(16777216 --[[ImGuiWindowFlags.ChildWindow]], 1 --[[ImGuiWindowFlags.NoTitleBar]], 524288 --[[ImGuiWindowFlags.NoDocking]])) == 0 then if not window.IsFallbackWindow then return true end -- We don't support AlwaysTabBar on the fallback/implicit window to avoid unused dock-node overhead/noise end end @@ -4025,7 +4059,7 @@ end function ImGui.DockContextBindNodeToWindow(ctx, window) local g = ctx local node = ImGui.DockContextFindNodeByID(ctx, window.DockId) - IM_ASSERT(window.DockNode == nil) + assert(window.DockNode == nil) -- We should not be docking into a split node (SetWindowDock should avoid this) if node and node:IsSplitNode() then @@ -4036,9 +4070,9 @@ function ImGui.DockContextBindNodeToWindow(ctx, window) -- Create node if node == nil then node = ImGui.DockContextAddNode(ctx, window.DockId) - node.AuthorityForPos = ImGuiDataAuthority.Window - node.AuthorityForSize = ImGuiDataAuthority.Window - node.AuthorityForViewport = ImGuiDataAuthority.Window + node.AuthorityForPos = 2 --[[ImGuiDataAuthority.Window]] + node.AuthorityForSize = 2 --[[ImGuiDataAuthority.Window]] + node.AuthorityForViewport = 2 --[[ImGuiDataAuthority.Window]] node.LastFrameAlive = g.FrameCount end @@ -4051,7 +4085,7 @@ function ImGui.DockContextBindNodeToWindow(ctx, window) while not ancestor_node.IsVisible and ancestor_node.ParentNode do ancestor_node = ancestor_node.ParentNode end - IM_ASSERT(ancestor_node.Size.x > 0.0 and ancestor_node.Size.y > 0.0) + assert(ancestor_node.Size.x > 0.0 and ancestor_node.Size.y > 0.0) ImGui.DockNodeUpdateHasCentralNodeChild(ImGui.DockNodeGetRootNode(ancestor_node)) ImGui.DockNodeTreeUpdatePosSize(ancestor_node, ancestor_node.Pos, ancestor_node.Size, node) end @@ -4060,13 +4094,13 @@ function ImGui.DockContextBindNodeToWindow(ctx, window) local node_was_visible = node.IsVisible ImGui.DockNodeAddWindow(node, window, true) node.IsVisible = node_was_visible -- Don't mark visible right away (so DockContextEndFrame() doesn't render it, maybe other side effects? will see) - IM_ASSERT(node == window.DockNode) + assert(node == window.DockNode) return node end local function StoreDockStyleForWindow(window) local g = ImGui.GetCurrentContext() - for color_n = 0, ImGuiWindowDockStyleCol.COUNT - 1 do + for color_n = 0, 9 --[[ImGuiWindowDockStyleCol.COUNT]] - 1 do window.DockStyle.Colors[color_n] = ImGui.ColorConvertFloat4ToU32(g.Style.Colors[GWindowDockStyleColors[color_n]]) end end @@ -4085,14 +4119,14 @@ function ImGui.BeginDocked(window, p_open) local auto_dock_node = ImGui.GetWindowAlwaysWantOwnTabBar(window) if auto_dock_node then if window.DockId == 0 then - IM_ASSERT(window.DockNode == nil) + assert(window.DockNode == nil) window.DockId = ImGui.DockContextGenNodeID(g) end else -- Calling SetNextWindowPos() undock windows by default (by setting PosUndock) local want_undock = false - want_undock = want_undock or bit32.band(window.Flags, ImGuiWindowFlags.NoDocking) ~= 0 - want_undock = want_undock or (bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasPos) ~= 0 and bit32.band(window.SetWindowPosAllowFlags, g.NextWindowData.PosCond) ~= 0 and g.NextWindowData.PosUndock) + want_undock = want_undock or bit32.band(window.Flags, 524288 --[[ImGuiWindowFlags.NoDocking]]) ~= 0 + want_undock = want_undock or (bit32.band(g.NextWindowData.HasFlags, 1 --[[ImGuiNextWindowDataFlags.HasPos]]) ~= 0 and bit32.band(window.SetWindowPosAllowFlags, g.NextWindowData.PosCond) ~= 0 and g.NextWindowData.PosUndock) if want_undock then ImGui.DockContextProcessUndockWindow(g, window) return p_open @@ -4101,7 +4135,7 @@ function ImGui.BeginDocked(window, p_open) -- Bind to our dock node local node = window.DockNode - if node ~= nil then IM_ASSERT(window.DockId == node.ID) end + if node ~= nil then assert(window.DockId == node.ID) end if window.DockId ~= 0 and node == nil then node = ImGui.DockContextBindNodeToWindow(g, window) if node == nil then return p_open end @@ -4127,7 +4161,7 @@ function ImGui.BeginDocked(window, p_open) -- and never create neither a host window neither a tab bar. -- FIXME-DOCK: replace .HostWindow nil compare with something more explicit (~was initially intended as a first frame test) if node.HostWindow == nil then - if node.State == ImGuiDockNodeState.HostWindowHiddenBecauseWindowsAreResizing then + if node.State == 2 --[[ImGuiDockNodeState.HostWindowHiddenBecauseWindowsAreResizing]] then window.DockIsActive = true end if node.Windows.Size > 1 and window.Appearing then -- Only hide appearing window @@ -4137,13 +4171,13 @@ function ImGui.BeginDocked(window, p_open) end -- We can have zero-sized nodes (e.g. children of a small-size dockspace) - IM_ASSERT(node.HostWindow) - IM_ASSERT(node:IsLeafNode()) - IM_ASSERT(node.Size.x >= 0.0 and node.Size.y >= 0.0) - node.State = ImGuiDockNodeState.HostWindowVisible + assert(node.HostWindow) + assert(node:IsLeafNode()) + assert(node.Size.x >= 0.0 and node.Size.y >= 0.0) + node.State = 3 --[[ImGuiDockNodeState.HostWindowVisible]] -- Undock if we are submitted earlier than the host window - if bit32.band(node.MergedFlags, ImGuiDockNodeFlags.KeepAliveOnly) == 0 and window.BeginOrderWithinContext < node.HostWindow.BeginOrderWithinContext then + if bit32.band(node.MergedFlags, 1 --[[ImGuiDockNodeFlags.KeepAliveOnly]]) == 0 and window.BeginOrderWithinContext < node.HostWindow.BeginOrderWithinContext then ImGui.DockContextProcessUndockWindow(g, window) return p_open end @@ -4155,19 +4189,19 @@ function ImGui.BeginDocked(window, p_open) window.DockIsActive = true window.DockNodeIsVisible = true window.DockTabIsVisible = false - if bit32.band(node.MergedFlags, ImGuiDockNodeFlags.KeepAliveOnly) ~= 0 then return p_open end + if bit32.band(node.MergedFlags, 1 --[[ImGuiDockNodeFlags.KeepAliveOnly]]) ~= 0 then return p_open end -- When the window is selected we mark it as visible. if node.VisibleWindow == window then window.DockTabIsVisible = true end -- Update window flag - IM_ASSERT(bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) == 0) - window.Flags = bit32.bor(window.Flags, ImGuiWindowFlags.ChildWindow, ImGuiWindowFlags.NoResize) - window.ChildFlags = bit32.bor(window.ChildFlags, ImGuiChildFlags.AlwaysUseWindowPadding) + assert(bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0) + window.Flags = bit32.bor(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]], 2 --[[ImGuiWindowFlags.NoResize]]) + window.ChildFlags = bit32.bor(window.ChildFlags, 2 --[[ImGuiChildFlags.AlwaysUseWindowPadding]]) if node:IsHiddenTabBar() or node:IsNoTabBar() then - window.Flags = bit32.bor(window.Flags, ImGuiWindowFlags.NoTitleBar) + window.Flags = bit32.bor(window.Flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) else - window.Flags = bit32.band(window.Flags, bit32.bnot(ImGuiWindowFlags.NoTitleBar)) -- Clear the NoTitleBar flag in case the user set it: confusingly enough we need a title bar height so we are correctly offset, but it won't be displayed! + window.Flags = bit32.band(window.Flags, bit32.bnot(1 --[[ImGuiWindowFlags.NoTitleBar]])) -- Clear the NoTitleBar flag in case the user set it: confusingly enough we need a title bar height so we are correctly offset, but it won't be displayed! end -- Save new dock order only if the window has been visible once already @@ -4188,9 +4222,9 @@ end function ImGui.BeginDockableDragDropSource(window) local g = ImGui.GetCurrentContext() - IM_ASSERT(g.ActiveId == window.MoveId) - IM_ASSERT(g.MovingWindow == window) - IM_ASSERT(g.CurrentWindow == window) + assert(g.ActiveId == window.MoveId) + assert(g.MovingWindow == window) + assert(g.CurrentWindow == window) -- 0: Hold SHIFT to disable docking, 1: Hold SHIFT to enable docking. if g.IO.ConfigDockingWithShift ~= g.IO.KeyShift then @@ -4198,16 +4232,16 @@ function ImGui.BeginDockableDragDropSource(window) -- We cannot set for HoveredWindowUnderMovingWindow ~= nil here, as it is only valid/useful when drag and drop is already active -- (because of the 'is_mouse_dragging_with_an_expected_destination' logic in UpdateViewportsNewFrame() function) if g.IO.ConfigDockingWithShift and g.MouseStationaryTimer >= 1.0 and g.ActiveId >= 1 then - ImGui.SetTooltip("%s", ImGui.LocalizeGetMsg(ImGuiLocKey.DockingHoldShiftToDock)) + ImGui.SetTooltip("%s", ImGui.LocalizeGetMsg(14 --[[ImGuiLocKey.DockingHoldShiftToDock]])) end return end g.LastItemData.ID = window.MoveId window = window.RootWindowDockTree - IM_ASSERT(bit32.band(window.Flags, ImGuiWindowFlags.NoDocking) == 0) + assert(bit32.band(window.Flags, 524288 --[[ImGuiWindowFlags.NoDocking]]) == 0) local is_drag_docking = g.IO.ConfigDockingWithShift or ImRect(0, 0, window.SizeFull.x, ImGui.GetFrameHeight()):Contains(g.ActiveIdClickOffset) -- FIXME-DOCKING: Need to make this stateful and explicit - local drag_drop_flags = bit32.bor(ImGuiDragDropFlags.SourceNoPreviewTooltip, ImGuiDragDropFlags.SourceNoHoldToOpenOthers, ImGuiDragDropFlags.PayloadAutoExpire, ImGuiDragDropFlags.PayloadNoCrossContext, ImGuiDragDropFlags.PayloadNoCrossProcess) + local drag_drop_flags = bit32.bor(1 --[[ImGuiDragDropFlags.SourceNoPreviewTooltip]], 4 --[[ImGuiDragDropFlags.SourceNoHoldToOpenOthers]], 32 --[[ImGuiDragDropFlags.PayloadAutoExpire]], 64 --[[ImGuiDragDropFlags.PayloadNoCrossContext]], 128 --[[ImGuiDragDropFlags.PayloadNoCrossProcess]]) if is_drag_docking and ImGui.BeginDragDropSource(drag_drop_flags) then ImGui.SetDragDropPayload(IMGUI_PAYLOAD_TYPE_WINDOW, window) ImGui.EndDragDropSource() @@ -4219,7 +4253,7 @@ function ImGui.BeginDockableDragDropTarget(window) local g = ImGui.GetCurrentContext() --IM_ASSERT(window.RootWindowDockTree == window) -- May also be a DockSpace - IM_ASSERT(bit32.band(window.Flags, ImGuiWindowFlags.NoDocking) == 0) + assert(bit32.band(window.Flags, 524288 --[[ImGuiWindowFlags.NoDocking]]) == 0) if not g.DragDropActive then return end --GetForegroundDrawList(window):AddRect(window.Pos, window.Pos + window.Size, IM_COL32(255, 255, 0, 255)) if not ImGui.BeginDragDropTargetCustom(window:Rect(), window.ID) then return end @@ -4233,7 +4267,7 @@ function ImGui.BeginDockableDragDropTarget(window) end local payload_window = payload.Data - if ImGui.AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_WINDOW, bit32.bor(ImGuiDragDropFlags.AcceptBeforeDelivery, ImGuiDragDropFlags.AcceptNoDrawDefaultRect)) then + if ImGui.AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_WINDOW, bit32.bor(1024 --[[ImGuiDragDropFlags.AcceptBeforeDelivery]], 2048 --[[ImGuiDragDropFlags.AcceptNoDrawDefaultRect]])) then -- Select target node -- (Important: we cannot use g.HoveredDockNode here! Because each of our target node have filters based on payload, each candidate drop target will do its own evaluation) local dock_into_floating_window = false @@ -4380,7 +4414,7 @@ DockSettingsHandler_ReadLine = function(ctx, handler, entry, line) line = line:sub(9) elseif line:sub(1, 9) == "DockSpace" then line = line:sub(10) - node.Flags = bit32.bor(node.Flags, ImGuiDockNodeFlags.DockSpace) + node.Flags = bit32.bor(node.Flags, 1024 --[[ImGuiDockNodeFlags.DockSpace]]) else return end @@ -4412,18 +4446,18 @@ DockSettingsHandler_ReadLine = function(ctx, handler, entry, line) end local c = take(" Split=(%a)") if c then - if c == "X" then node.SplitAxis = ImGuiAxis.X elseif c == "Y" then node.SplitAxis = ImGuiAxis.Y end + if c == "X" then node.SplitAxis = 1 --[[ImGuiAxis.X]] elseif c == "Y" then node.SplitAxis = 2 --[[ImGuiAxis.Y]] end end local function flag(name, f) local x = take(" " .. name .. "=(%-?%d+)") if x and tonumber(x) ~= 0 then node.Flags = bit32.bor(node.Flags, f) end end - flag("NoResize", ImGuiDockNodeFlags.NoResize) - flag("CentralNode", ImGuiDockNodeFlags.CentralNode) - flag("NoTabBar", ImGuiDockNodeFlags.NoTabBar) - flag("HiddenTabBar", ImGuiDockNodeFlags.HiddenTabBar) - flag("NoWindowMenuButton", ImGuiDockNodeFlags.NoWindowMenuButton) - flag("NoCloseButton", ImGuiDockNodeFlags.NoCloseButton) + flag("NoResize", 32 --[[ImGuiDockNodeFlags.NoResize]]) + flag("CentralNode", 2048 --[[ImGuiDockNodeFlags.CentralNode]]) + flag("NoTabBar", 4096 --[[ImGuiDockNodeFlags.NoTabBar]]) + flag("HiddenTabBar", 8192 --[[ImGuiDockNodeFlags.HiddenTabBar]]) + flag("NoWindowMenuButton", 16384 --[[ImGuiDockNodeFlags.NoWindowMenuButton]]) + flag("NoCloseButton", 32768 --[[ImGuiDockNodeFlags.NoCloseButton]]) v = take(" Selected=0x(%x+)") if v then node.SelectedTabId = tonumber(v, 16) end if node.ParentNodeId ~= 0 then @@ -4439,9 +4473,9 @@ local function DockSettingsHandler_DockNodeToSettings(dc, node, depth) node_settings.ParentNodeId = node.ParentNode and node.ParentNode.ID or 0 node_settings.ParentWindowId = (node:IsDockSpace() and node.HostWindow and node.HostWindow.ParentWindow) and node.HostWindow.ParentWindow.ID or 0 node_settings.SelectedTabId = node.SelectedTabId - node_settings.SplitAxis = node:IsSplitNode() and node.SplitAxis or ImGuiAxis.None + node_settings.SplitAxis = node:IsSplitNode() and node.SplitAxis or 0 --[[ImGuiAxis.None]] node_settings.Depth = depth - node_settings.Flags = bit32.band(node.LocalFlags, ImGuiDockNodeFlags.SavedFlagsMask_) + node_settings.Flags = bit32.band(node.LocalFlags, 261152 --[[ImGuiDockNodeFlags.SavedFlagsMask_]]) node_settings.Pos = ImVec2(ImTrunc(node.Pos.x), ImTrunc(node.Pos.y)) node_settings.Size = ImVec2(ImTrunc(node.Size.x), ImTrunc(node.Size.y)) node_settings.SizeRef = ImVec2(ImTrunc(node.SizeRef.x), ImTrunc(node.SizeRef.y)) @@ -4453,7 +4487,7 @@ end DockSettingsHandler_WriteAll = function(ctx, handler, buf) local g = ctx local dc = ctx.DockContext - if bit32.band(g.IO.ConfigFlags, ImGuiConfigFlags.DockingEnable) == 0 then return end + if bit32.band(g.IO.ConfigFlags, 128 --[[ImGuiConfigFlags.DockingEnable]]) == 0 then return end -- Gather settings data -- (unlike our windows settings, because nodes are always built we can do a full rewrite of the SettingsNode buffer) @@ -4471,7 +4505,7 @@ DockSettingsHandler_WriteAll = function(ctx, handler, buf) -- Write to text buffer buf:appendf("[%s][Data]\n", handler.TypeName) for _, s in dc.NodesSettings:iter() do - buf:append(string.rep(" ", s.Depth * 2) .. ((bit32.band(s.Flags, ImGuiDockNodeFlags.DockSpace) ~= 0) and "DockSpace" or "DockNode ") .. string.rep(" ", (max_depth - s.Depth) * 2)) -- Text align nodes to facilitate looking at .ini file + buf:append(string.rep(" ", s.Depth * 2) .. ((bit32.band(s.Flags, 1024 --[[ImGuiDockNodeFlags.DockSpace]]) ~= 0) and "DockSpace" or "DockNode ") .. string.rep(" ", (max_depth - s.Depth) * 2)) -- Text align nodes to facilitate looking at .ini file buf:appendf(" ID=0x%08X", s.ID) if s.ParentNodeId ~= 0 then buf:appendf(" Parent=0x%08X SizeRef=%d,%d", s.ParentNodeId, s.SizeRef.x, s.SizeRef.y) @@ -4479,13 +4513,13 @@ DockSettingsHandler_WriteAll = function(ctx, handler, buf) if s.ParentWindowId ~= 0 then buf:appendf(" Window=0x%08X", s.ParentWindowId) end buf:appendf(" Pos=%d,%d Size=%d,%d", s.Pos.x, s.Pos.y, s.Size.x, s.Size.y) end - if s.SplitAxis ~= ImGuiAxis.None then buf:appendf(" Split=%s", (s.SplitAxis == ImGuiAxis.X) and "X" or "Y") end - if bit32.band(s.Flags, ImGuiDockNodeFlags.NoResize) ~= 0 then buf:append(" NoResize=1") end - if bit32.band(s.Flags, ImGuiDockNodeFlags.CentralNode) ~= 0 then buf:append(" CentralNode=1") end - if bit32.band(s.Flags, ImGuiDockNodeFlags.NoTabBar) ~= 0 then buf:append(" NoTabBar=1") end - if bit32.band(s.Flags, ImGuiDockNodeFlags.HiddenTabBar) ~= 0 then buf:append(" HiddenTabBar=1") end - if bit32.band(s.Flags, ImGuiDockNodeFlags.NoWindowMenuButton) ~= 0 then buf:append(" NoWindowMenuButton=1") end - if bit32.band(s.Flags, ImGuiDockNodeFlags.NoCloseButton) ~= 0 then buf:append(" NoCloseButton=1") end + if s.SplitAxis ~= 0 --[[ImGuiAxis.None]] then buf:appendf(" Split=%s", (s.SplitAxis == 1 --[[ImGuiAxis.X]]) and "X" or "Y") end + if bit32.band(s.Flags, 32 --[[ImGuiDockNodeFlags.NoResize]]) ~= 0 then buf:append(" NoResize=1") end + if bit32.band(s.Flags, 2048 --[[ImGuiDockNodeFlags.CentralNode]]) ~= 0 then buf:append(" CentralNode=1") end + if bit32.band(s.Flags, 4096 --[[ImGuiDockNodeFlags.NoTabBar]]) ~= 0 then buf:append(" NoTabBar=1") end + if bit32.band(s.Flags, 8192 --[[ImGuiDockNodeFlags.HiddenTabBar]]) ~= 0 then buf:append(" HiddenTabBar=1") end + if bit32.band(s.Flags, 16384 --[[ImGuiDockNodeFlags.NoWindowMenuButton]]) ~= 0 then buf:append(" NoWindowMenuButton=1") end + if bit32.band(s.Flags, 32768 --[[ImGuiDockNodeFlags.NoCloseButton]]) ~= 0 then buf:append(" NoCloseButton=1") end if s.SelectedTabId ~= 0 then buf:appendf(" Selected=0x%08X", s.SelectedTabId) end buf:append("\n") end @@ -4529,8 +4563,8 @@ end function ImGui.SetNextWindowDockID(id, cond) local g = ImGui.GetCurrentContext() - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasDock) - g.NextWindowData.DockCond = (cond and cond ~= 0) and cond or ImGuiCond.Always + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 4096 --[[ImGuiNextWindowDataFlags.HasDock]]) + g.NextWindowData.DockCond = (cond and cond ~= 0) and cond or 1 --[[ImGuiCond.Always]] g.NextWindowData.DockId = id end @@ -4538,7 +4572,7 @@ end function ImGui.StartMouseMovingWindowOrNode(window, node, undock) local g = ImGui.GetCurrentContext() local can_undock_node = false - if undock and node ~= nil and node.VisibleWindow and bit32.band(node.VisibleWindow.Flags, ImGuiWindowFlags.NoMove) == 0 and bit32.band(node.MergedFlags, ImGuiDockNodeFlags.NoUndocking) == 0 then + if undock and node ~= nil and node.VisibleWindow and bit32.band(node.VisibleWindow.Flags, 4 --[[ImGuiWindowFlags.NoMove]]) == 0 and bit32.band(node.MergedFlags, 128 --[[ImGuiDockNodeFlags.NoUndocking]]) == 0 then -- Can undock if: -- - part of a hierarchy with more than one visible node (if only one is visible, we'll just move the root window) -- - part of a dockspace node hierarchy: so we can undock the last single visible node too. Undocking from a fixed/central node will create a new node and copy windows. @@ -4561,7 +4595,7 @@ end -- and because the saved space means that the left-most tab label can stay at exactly the same position as the label of a loose window. function ImGui.RenderArrowDockMenu(draw_list, p_min, sz, col) draw_list:AddRectFilled(p_min + ImVec2(sz * 0.20, sz * 0.15), p_min + ImVec2(sz * 0.80, sz * 0.30), col) - ImGui.RenderArrowPointingAt(draw_list, p_min + ImVec2(sz * 0.50, sz * 0.85), ImVec2(sz * 0.30, sz * 0.40), ImGuiDir.Down, col) + ImGui.RenderArrowPointingAt(draw_list, p_min + ImVec2(sz * 0.50, sz * 0.85), ImVec2(sz * 0.30, sz * 0.40), 3 --[[ImGuiDir.Down]], col) end -- Upstream CollapseButton (docking branch): replaces the port's simpler version @@ -4572,22 +4606,22 @@ function ImGui.CollapseButton(id, pos, dock_node) local bb = ImRect(pos, pos + ImVec2(g.FontSize, g.FontSize)) local is_clipped = not ImGui.ItemAdd(bb, id) - local pressed, hovered, held = ImGui.ButtonBehavior(bb, id, ImGuiButtonFlags.None) + local pressed, hovered, held = ImGui.ButtonBehavior(bb, id, 0 --[[ImGuiButtonFlags.None]]) if is_clipped then return pressed end -- Render --local is_dock_menu = (window.DockNodeAsHost and not window.Collapsed) - local bg_col = ImGui.GetColorU32((held and hovered) and ImGuiCol.ButtonActive or (hovered and ImGuiCol.ButtonHovered or ImGuiCol.Button)) - local text_col = ImGui.GetColorU32(ImGuiCol.Text) + local bg_col = ImGui.GetColorU32((held and hovered) and 24 --[[ImGuiCol.ButtonActive]] or (hovered and 23 --[[ImGuiCol.ButtonHovered]] or 22 --[[ImGuiCol.Button]])) + local text_col = ImGui.GetColorU32(0 --[[ImGuiCol.Text]]) if hovered or held then window.DrawList:AddRectFilled(bb.Min, bb.Max, bg_col) end - ImGui.RenderNavCursor(bb, id, ImGuiNavRenderCursorFlags and ImGuiNavRenderCursorFlags.Compact or nil) + ImGui.RenderNavCursor(bb, id, ImGuiNavRenderCursorFlags and 2 --[[ImGuiNavRenderCursorFlags.Compact]] or nil) if dock_node then ImGui.RenderArrowDockMenu(window.DrawList, bb.Min, g.FontSize, text_col) else - ImGui.RenderArrow(window.DrawList, bb.Min, text_col, window.Collapsed and ImGuiDir.Right or ImGuiDir.Down, 1.0) + ImGui.RenderArrow(window.DrawList, bb.Min, text_col, window.Collapsed and 1 --[[ImGuiDir.Right]] or 3 --[[ImGuiDir.Down]], 1.0) end -- Switch to moving the window after mouse is moved beyond the initial drag threshold @@ -4607,22 +4641,22 @@ function ImGui.SplitterBehavior(bb, id, axis, size1, size2, min_size1, min_size2 local g = ImGui.GetCurrentContext() local window = g.CurrentWindow - if not ImGui.ItemAdd(bb, id, nil, ImGuiItemFlags.NoNav) then return false, size1, size2 end + if not ImGui.ItemAdd(bb, id, nil, 2 --[[ImGuiItemFlags.NoNav]]) then return false, size1, size2 end -- FIXME: AFAIK the only leftover reason for passing ImGuiButtonFlags.AllowOverlap here is -- to allow caller of SplitterBehavior() to call SetItemAllowOverlap() after the item. -- Nowadays we would instead want to use SetNextItemAllowOverlap() before the item. - local button_flags = bit32.bor(ImGuiButtonFlags.FlattenChildren, ImGuiButtonFlags.AllowOverlap) + local button_flags = bit32.bor(2048 --[[ImGuiButtonFlags.FlattenChildren]], 4096 --[[ImGuiButtonFlags.AllowOverlap]]) local bb_interact = ImRect(bb.Min, bb.Max) - bb_interact:Expand(axis == ImGuiAxis.Y and ImVec2(0.0, hover_extend) or ImVec2(hover_extend, 0.0)) + bb_interact:Expand(axis == 2 --[[ImGuiAxis.Y]] and ImVec2(0.0, hover_extend) or ImVec2(hover_extend, 0.0)) local _, hovered, held = ImGui.ButtonBehavior(bb_interact, id, button_flags) if hovered then - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HoveredRect) -- for IsItemHovered(), because bb_interact is larger than bb + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 1 --[[ImGuiItemStatusFlags.HoveredRect]]) -- for IsItemHovered(), because bb_interact is larger than bb end if held or (hovered and g.HoveredIdPreviousFrame == id and g.HoveredIdTimer >= hover_visibility_delay) then - ImGui.SetMouseCursor(axis == ImGuiAxis.Y and ImGuiMouseCursor.ResizeNS or ImGuiMouseCursor.ResizeEW) + ImGui.SetMouseCursor(axis == 2 --[[ImGuiAxis.Y]] and 3 --[[ImGuiMouseCursor.ResizeNS]] or 4 --[[ImGuiMouseCursor.ResizeEW]]) end local bb_render = ImRect(bb.Min, bb.Max) @@ -4640,16 +4674,16 @@ function ImGui.SplitterBehavior(bb, id, axis, size1, size2, min_size1, min_size2 if mouse_delta ~= 0.0 then size1 = ImMax(size1 + mouse_delta, min_size1) size2 = ImMax(size2 - mouse_delta, min_size2) - bb_render:Translate(axis == ImGuiAxis.X and ImVec2(mouse_delta, 0.0) or ImVec2(0.0, mouse_delta)) + bb_render:Translate(axis == 1 --[[ImGuiAxis.X]] and ImVec2(mouse_delta, 0.0) or ImVec2(0.0, mouse_delta)) ImGui.MarkItemEdited(id) end end -- Render at new position - if bit32.band(bg_col, IM_COL32_A_MASK) ~= 0 then + if bit32.band(bg_col, 4278190080 --[[IM_COL32_A_MASK]]) ~= 0 then window.DrawList:AddRectFilled(bb_render.Min, bb_render.Max, bg_col, 0.0) end - local col = ImGui.GetColorU32(held and ImGuiCol.SeparatorActive or ((hovered and g.HoveredIdTimer >= hover_visibility_delay) and ImGuiCol.SeparatorHovered or ImGuiCol.Separator)) + local col = ImGui.GetColorU32(held and 30 --[[ImGuiCol.SeparatorActive]] or ((hovered and g.HoveredIdTimer >= hover_visibility_delay) and 29 --[[ImGuiCol.SeparatorHovered]] or 28 --[[ImGuiCol.Separator]])) window.DrawList:AddRectFilled(bb_render.Min, bb_render.Max, col, 0.0) return held, size1, size2 @@ -4820,8 +4854,8 @@ function MT.ImGuiStyle:ScaleAllSizes(scale_factor) self.TabBorderSize = ImTrunc(self.TabBorderSize * scale_factor) self.TabMinWidthBase = ImTrunc(self.TabMinWidthBase * scale_factor) self.TabMinWidthShrink = ImTrunc(self.TabMinWidthShrink * scale_factor) - self.TabCloseButtonMinWidthSelected = (self.TabCloseButtonMinWidthSelected > 0.0 and self.TabCloseButtonMinWidthSelected ~= FLT_MAX) and ImTrunc(self.TabCloseButtonMinWidthSelected * scale_factor) or self.TabCloseButtonMinWidthSelected - self.TabCloseButtonMinWidthUnselected = (self.TabCloseButtonMinWidthUnselected > 0.0 and self.TabCloseButtonMinWidthUnselected ~= FLT_MAX) and ImTrunc(self.TabCloseButtonMinWidthUnselected * scale_factor) or self.TabCloseButtonMinWidthUnselected + self.TabCloseButtonMinWidthSelected = (self.TabCloseButtonMinWidthSelected > 0.0 and self.TabCloseButtonMinWidthSelected ~= 3.4028234663853e+38 --[[FLT_MAX]]) and ImTrunc(self.TabCloseButtonMinWidthSelected * scale_factor) or self.TabCloseButtonMinWidthSelected + self.TabCloseButtonMinWidthUnselected = (self.TabCloseButtonMinWidthUnselected > 0.0 and self.TabCloseButtonMinWidthUnselected ~= 3.4028234663853e+38 --[[FLT_MAX]]) and ImTrunc(self.TabCloseButtonMinWidthUnselected * scale_factor) or self.TabCloseButtonMinWidthUnselected self.TabBarBorderSize = ImTrunc(self.TabBarBorderSize * scale_factor) self.TabBarOverlineSize = ImTrunc(self.TabBarOverlineSize * scale_factor) self.TreeLinesSize = ImTrunc(self.TreeLinesSize * scale_factor) @@ -4869,19 +4903,19 @@ local function GetResizeBorderRect(window, border_n, perp_padding, thickness) if thickness == 0.0 then ImVec2_CopyV(rect.Max, rect.Max.x - 1, rect.Max.y - 1) end - if border_n == ImGuiDir.Left then + if border_n == 0 --[[ImGuiDir.Left]] then return ImRect(rect.Min.x - thickness, rect.Min.y + perp_padding, rect.Min.x + thickness, rect.Max.y - perp_padding) end - if border_n == ImGuiDir.Right then + if border_n == 1 --[[ImGuiDir.Right]] then return ImRect(rect.Max.x - thickness, rect.Min.y + perp_padding, rect.Max.x + thickness, rect.Max.y - perp_padding) end - if border_n == ImGuiDir.Up then + if border_n == 2 --[[ImGuiDir.Up]] then return ImRect(rect.Min.x + perp_padding, rect.Min.y - thickness, rect.Max.x - perp_padding, rect.Min.y + thickness) end - if border_n == ImGuiDir.Down then + if border_n == 3 --[[ImGuiDir.Down]] then return ImRect(rect.Min.x + perp_padding, rect.Max.y - thickness, rect.Max.x - perp_padding, rect.Max.y + thickness) end - IM_ASSERT(false) + assert(false) return ImRect() end @@ -5020,7 +5054,7 @@ function ImStd.ImTextCharFromUtf8(in_text, pos, in_text_end) local e = 0 e = bit32.lshift((out_char < mins[len + 1]) and 1 or 0, 6) -- non-canonical encoding e = bit32.bor(e, bit32.lshift((bit32.rshift(out_char, 11) == 0x1b) and 1 or 0, 7)) -- surrogate half? - e = bit32.bor(e, bit32.lshift((out_char > IM_UNICODE_CODEPOINT_MAX) and 1 or 0, 8)) -- out of range we can store in ImWchar (FIXME: May evolve) + e = bit32.bor(e, bit32.lshift((out_char > 65535 --[[IM_UNICODE_CODEPOINT_MAX]]) and 1 or 0, 8)) -- out of range we can store in ImWchar (FIXME: May evolve) e = bit32.bor(e, bit32.rshift(bit32.band(s[2], 0xc0), 2)) e = bit32.bor(e, bit32.rshift(bit32.band(s[3], 0xc0), 4)) e = bit32.bor(e, bit32.rshift(s[4], 6)) @@ -5033,7 +5067,7 @@ function ImStd.ImTextCharFromUtf8(in_text, pos, in_text_end) -- All available bytes (at most `len` bytes) are consumed on incomplete/invalid second to last bytes. -- Invalid or incomplete input may consume less bytes than wanted, therefore every byte has to be inspected in s. wanted = ImMin(wanted, (s[1] ~= 0 and 1 or 0) + (s[2] ~= 0 and 1 or 0) + (s[3] ~= 0 and 1 or 0) + (s[4] ~= 0 and 1 or 0)) - out_char = IM_UNICODE_CODEPOINT_INVALID + out_char = 65533 --[[IM_UNICODE_CODEPOINT_INVALID]] end return wanted, out_char @@ -5127,7 +5161,7 @@ function ImStd.ImTextFindValidUtf8CodepointEnd(text, in_text_start, in_text_end, local prev_c_len, prev_c = ImStd.ImTextCharFromUtf8(text, prev, in_text_end) -- Check if the previous character is valid and fits within the range - if prev_c ~= IM_UNICODE_CODEPOINT_INVALID and prev_c_len <= (in_p - prev) then + if prev_c ~= 65533 --[[IM_UNICODE_CODEPOINT_INVALID]] and prev_c_len <= (in_p - prev) then return in_p end return prev @@ -5309,8 +5343,8 @@ function ImGui.UpdateCurrentFontSize(restore_font_size_after_scaling) -- - We started rounding in 1.90 WIP (18991) as our layout system currently doesn't support non-rounded font size well yet. -- - We may support it better later and remove this rounding. final_size = ImGui.GetRoundedFontSize(final_size) - final_size = ImClamp(final_size, 4.0, IMGUI_FONT_SIZE_MAX) - if (g.Font ~= nil and bit32.band(g.IO.BackendFlags, ImGuiBackendFlags.RendererHasTextures) ~= 0) then + final_size = ImClamp(final_size, 4.0, 512 --[[IMGUI_FONT_SIZE_MAX]]) + if (g.Font ~= nil and bit32.band(g.IO.BackendFlags, 16 --[[ImGuiBackendFlags.RendererHasTextures]]) ~= 0) then g.Font.CurrentRasterizerDensity = g.FontRasterizerDensity end g.FontSize = final_size @@ -5336,7 +5370,7 @@ function ImGui.SetCurrentFont(font, font_size_before_scaling, font_size_after_sc ImGui.UpdateCurrentFontSize(font_size_after_scaling) if font ~= nil then - IM_ASSERT(font and font:IsLoaded()) -- Font Atlas not created. Did you call io.Fonts:GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ? + assert(font and font:IsLoaded()) -- Font Atlas not created. Did you call io.Fonts:GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ? local atlas = font.OwnerAtlas g.DrawListSharedData.FontAtlas = atlas g.DrawListSharedData.Font = font @@ -5355,8 +5389,8 @@ function ImGui.PushFont(font, font_size_base) font = g.Font end - IM_ASSERT(font ~= nil) - IM_ASSERT(font_size_base >= 0.0) + assert(font ~= nil) + assert(font_size_base >= 0.0) g.FontStack:push_back(ImFontStackData(font, g.FontSizeBase, g.FontSize)) @@ -5385,7 +5419,7 @@ end function ImGui.UpdateTexturesNewFrame() -- Cannot update every atlases based on atlas's FrameCount < g.FrameCount, because an atlas may be shared by multiple contexts with different frame count. local g = GImGui - local has_textures = bit32.band(g.IO.BackendFlags, ImGuiBackendFlags.RendererHasTextures) ~= 0 + local has_textures = bit32.band(g.IO.BackendFlags, 16 --[[ImGuiBackendFlags.RendererHasTextures]]) ~= 0 for _, atlas in g.FontAtlases:iter() do if (atlas.OwnerContext == g) then ImFontAtlasUpdateNewFrame(atlas, g.FrameCount, has_textures) @@ -5394,8 +5428,8 @@ function ImGui.UpdateTexturesNewFrame() -- Otherwise, calling ImGui.CreateContext() without parameter will create an atlas owned by the context. -- (2) If you have multiple font atlases, make sure the 'atlas.RendererHasTextures' as specified in the ImFontAtlasUpdateNewFrame() call matches for that. -- (3) If you have multiple imgui contexts, they also need to have a matching value for ImGuiBackendFlags.RendererHasTextures. - IM_ASSERT(atlas.Builder ~= nil and atlas.Builder.FrameCount ~= -1) - IM_ASSERT(atlas.RendererHasTextures == has_textures) + assert(atlas.Builder ~= nil and atlas.Builder.FrameCount ~= -1) + assert(atlas.RendererHasTextures == has_textures) end end @@ -5423,7 +5457,7 @@ end function ImGui.UpdateFontsNewFrame() local g = GImGui - if (bit32.band(g.IO.BackendFlags, ImGuiBackendFlags.RendererHasTextures) == 0) then + if (bit32.band(g.IO.BackendFlags, 16 --[[ImGuiBackendFlags.RendererHasTextures]]) == 0) then for _, atlas in g.FontAtlases:iter() do atlas.Locked = true end @@ -5447,7 +5481,7 @@ function ImGui.UpdateFontsNewFrame() local font_stack_data = ImFontStackData(font, g.Style.FontSizeBase, g.Style.FontSizeBase) -- <--- Will restore FontSize ImGui.SetCurrentFont(font_stack_data.Font, font_stack_data.FontSizeBeforeScaling, 0.0) -- <--- but use 0.0f to enable scale g.FontStack:push_back(font_stack_data) - IM_ASSERT(g.Font:IsLoaded()) + assert(g.Font:IsLoaded()) end function ImGui.UpdateFontsEndFrame() @@ -5468,7 +5502,7 @@ end function ImGui.RegisterFontAtlas(atlas) local g = GImGui if (g.FontAtlases.Size == 0) then - IM_ASSERT(atlas == g.IO.Fonts) + assert(atlas == g.IO.Fonts) end atlas.RefCount = atlas.RefCount + 1 g.FontAtlases:push_back(atlas) @@ -5481,7 +5515,7 @@ end --- @param atlas ImFontAtlas function ImGui.UnregisterFontAtlas(atlas) local g = GImGui - IM_ASSERT(atlas.RefCount > 0) + assert(atlas.RefCount > 0) ImFontAtlasRemoveDrawListSharedData(atlas, g.DrawListSharedData) g.FontAtlases:find_erase(atlas) atlas.RefCount = atlas.RefCount - 1 @@ -5548,7 +5582,7 @@ local GLocalizationEntriesEnUS = { function ImGui.Initialize() local g = GImGui - IM_ASSERT(not g.Initialized and not g.SettingsLoaded) + assert(not g.Initialized and not g.SettingsLoaded) -- Add .ini handle for ImGuiWindow and ImGuiTable types ImGui.WindowSettingsAddSettingsHandler() @@ -5563,17 +5597,17 @@ function ImGui.Initialize() viewport.ID = IMGUI_VIEWPORT_DEFAULT_ID viewport.Idx = 1 viewport.PlatformWindowCreated = true - viewport.Flags = ImGuiViewportFlags.OwnedByApp + viewport.Flags = 4 --[[ImGuiViewportFlags.OwnedByApp]] g.Viewports:push_back(viewport) g.ViewportCreatedCount = g.ViewportCreatedCount + 1 g.PlatformIO.Viewports:push_back(g.Viewports.Data[1]) -- Build KeysMayBeCharInput[] lookup table (1 bit per named key) - for key = ImGuiKey.NamedKey_BEGIN, ImGuiKey.NamedKey_END - 1 do - if (key >= ImGuiKey.K0 and key <= ImGuiKey.K9) or (key >= ImGuiKey.A and key <= ImGuiKey.Z) or (key >= ImGuiKey.Keypad0 and key <= ImGuiKey.Keypad9) - or key == ImGuiKey.Tab or key == ImGuiKey.Space or key == ImGuiKey.Apostrophe or key == ImGuiKey.Comma or key == ImGuiKey.Minus or key == ImGuiKey.Period - or key == ImGuiKey.Slash or key == ImGuiKey.Semicolon or key == ImGuiKey.Equal or key == ImGuiKey.LeftBracket or key == ImGuiKey.RightBracket or key == ImGuiKey.GraveAccent - or key == ImGuiKey.KeypadDecimal or key == ImGuiKey.KeypadDivide or key == ImGuiKey.KeypadMultiply or key == ImGuiKey.KeypadSubtract or key == ImGuiKey.KeypadAdd or key == ImGuiKey.KeypadEqual then + for key = 512 --[[ImGuiKey.NamedKey_BEGIN]], 667 --[[ImGuiKey.NamedKey_END]] - 1 do + if (key >= 536 --[[ImGuiKey.K0]] and key <= 545 --[[ImGuiKey.K9]]) or (key >= 546 --[[ImGuiKey.A]] and key <= 571 --[[ImGuiKey.Z]]) or (key >= 612 --[[ImGuiKey.Keypad0]] and key <= 621 --[[ImGuiKey.Keypad9]]) + or key == 512 --[[ImGuiKey.Tab]] or key == 524 --[[ImGuiKey.Space]] or key == 596 --[[ImGuiKey.Apostrophe]] or key == 597 --[[ImGuiKey.Comma]] or key == 598 --[[ImGuiKey.Minus]] or key == 599 --[[ImGuiKey.Period]] + or key == 600 --[[ImGuiKey.Slash]] or key == 601 --[[ImGuiKey.Semicolon]] or key == 602 --[[ImGuiKey.Equal]] or key == 603 --[[ImGuiKey.LeftBracket]] or key == 605 --[[ImGuiKey.RightBracket]] or key == 606 --[[ImGuiKey.GraveAccent]] + or key == 622 --[[ImGuiKey.KeypadDecimal]] or key == 623 --[[ImGuiKey.KeypadDivide]] or key == 624 --[[ImGuiKey.KeypadMultiply]] or key == 625 --[[ImGuiKey.KeypadSubtract]] or key == 626 --[[ImGuiKey.KeypadAdd]] or key == 628 --[[ImGuiKey.KeypadEqual]] then g.KeysMayBeCharInput:SetBit(key + 1) end end @@ -5681,14 +5715,14 @@ local function ApplyWindowSettings(window, settings) window.Collapsed = settings.Collapsed window.DockId = settings.DockId or 0 window.DockOrder = settings.DockOrder or -1 - SetWindowConditionAllowFlags(window, ImGuiCond.FirstUseEver, false) + SetWindowConditionAllowFlags(window, 4 --[[ImGuiCond.FirstUseEver]], false) end -- So first call to CalcWindowContentSizes() doesn't return crazy values ImVec2_Copy(window.DC.CursorStartPos, window.Pos) ImVec2_Copy(window.DC.CursorMaxPos, window.Pos) ImVec2_Copy(window.DC.IdealMaxPos, window.Pos) - if (bit32.band(window.Flags, ImGuiWindowFlags.AlwaysAutoResize) ~= 0) then + if (bit32.band(window.Flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) ~= 0) then window.AutoFitFramesX = 2; window.AutoFitFramesY = 2 window.AutoFitOnlyGrows = false else @@ -5710,7 +5744,7 @@ local function InitOrLoadWindowSettings(window, settings) ImVec2_Copy(window.Size, ImVec2(0, 0)) ImVec2_Copy(window.SizeFull, ImVec2(0, 0)) ImVec2_Copy(window.ViewportPos, main_viewport.Pos) - window.SetWindowPosAllowFlags = bit32.bor(ImGuiCond.Always, ImGuiCond.Once, ImGuiCond.FirstUseEver, ImGuiCond.Appearing) + window.SetWindowPosAllowFlags = bit32.bor(1 --[[ImGuiCond.Always]], 2 --[[ImGuiCond.Once]], 4 --[[ImGuiCond.FirstUseEver]], 8 --[[ImGuiCond.Appearing]]) window.SetWindowSizeAllowFlags = window.SetWindowPosAllowFlags window.SetWindowCollapsedAllowFlags = window.SetWindowPosAllowFlags window.SetWindowDockAllowFlags = window.SetWindowPosAllowFlags @@ -5738,7 +5772,7 @@ local function CreateNewWindow(name, flags) g.WindowsById[window_id] = window local settings = nil - if bit32.band(window.Flags, ImGuiWindowFlags.NoSavedSettings) == 0 then + if bit32.band(window.Flags, 256 --[[ImGuiWindowFlags.NoSavedSettings]]) == 0 then settings = ImGui.FindWindowSettingsByWindow(window) if settings ~= nil then window.SettingsOffset = g.SettingsWindows:index_from_ptr(settings) @@ -5747,7 +5781,7 @@ local function CreateNewWindow(name, flags) InitOrLoadWindowSettings(window, settings) - if bit32.band(flags, ImGuiWindowFlags.NoBringToFrontOnFocus) ~= 0 then + if bit32.band(flags, 8192 --[[ImGuiWindowFlags.NoBringToFrontOnFocus]]) ~= 0 then g.Windows:push_front(window) -- Quite slow but rare and only once else g.Windows:push_back(window) @@ -5800,7 +5834,7 @@ end --- @param window? ImGuiWindow function ImGui.MarkIniSettingsDirty(window) local g = GImGui - if window ~= nil and bit32.band(window.Flags, ImGuiWindowFlags.NoSavedSettings) ~= 0 then return end + if window ~= nil and bit32.band(window.Flags, 256 --[[ImGuiWindowFlags.NoSavedSettings]]) ~= 0 then return end if g.SettingsDirtyTimer <= 0.0 then g.SettingsDirtyTimer = g.IO.IniSavingRate end @@ -5809,7 +5843,7 @@ end --- @param handler ImGuiSettingsHandler function ImGui.AddSettingsHandler(handler) local g = GImGui - IM_ASSERT(ImGui.FindSettingsHandler(handler.TypeName) == nil) + assert(ImGui.FindSettingsHandler(handler.TypeName) == nil) if handler.TypeHash == 0 or handler.TypeHash == nil then handler.TypeHash = ImHashStr(handler.TypeName) end g.SettingsHandlers:push_back(handler) end @@ -5861,7 +5895,7 @@ end -- Set ini_size==0 (or nil) to use the whole string (Lua strings know their length). function ImGui.LoadIniSettingsFromMemory(ini_data, ini_size) local g = GImGui - IM_ASSERT(g.Initialized) + assert(g.Initialized) --IM_ASSERT(not g.WithinFrameScope, "Cannot be called between NewFrame() and EndFrame()") --IM_ASSERT(g.SettingsLoaded == false and g.FrameCount == 0) @@ -5942,7 +5976,7 @@ function ImGui.ClearWindowSettings(name) --IMGUI_DEBUG_LOG("ClearWindowSettings('%s')\n", name) local window = ImGui.FindWindowByName(name) if window ~= nil then - window.Flags = bit32.bor(window.Flags, ImGuiWindowFlags.NoSavedSettings) + window.Flags = bit32.bor(window.Flags, 256 --[[ImGuiWindowFlags.NoSavedSettings]]) InitOrLoadWindowSettings(window, nil) if window.DockId and window.DockId ~= 0 and ImGui.DockContextProcessUndockWindow then ImGui.DockContextProcessUndockWindow(GImGui, window, true) @@ -6014,13 +6048,13 @@ local function WindowSettingsHandler_WriteAll(ctx, handler, buf) -- (if a window wasn't opened in this session we preserve its settings) local g = ctx for _, window in g.Windows:iter() do - if bit32.band(window.Flags, ImGuiWindowFlags.NoSavedSettings) == 0 then + if bit32.band(window.Flags, 256 --[[ImGuiWindowFlags.NoSavedSettings]]) == 0 then local settings = ImGui.FindWindowSettingsByWindow(window) if not settings then settings = ImGui.CreateNewWindowSettings(window.Name) window.SettingsOffset = g.SettingsWindows:index_from_ptr(settings) end - IM_ASSERT(settings.ID == window.ID) + assert(settings.ID == window.ID) ImVec2_CopyV(settings.Pos, ImTrunc(window.Pos.x - window.ViewportPos.x), ImTrunc(window.Pos.y - window.ViewportPos.y)) ImVec2_CopyV(settings.Size, ImTrunc(window.SizeFull.x), ImTrunc(window.SizeFull.y)) settings.ViewportId = window.ViewportId or 0 @@ -6163,14 +6197,14 @@ end function ImGui.LogBegin(flags, auto_open_depth) local g = GImGui local window = g.CurrentWindow - IM_ASSERT(g.LogEnabled == false) + assert(g.LogEnabled == false) g.LogEnabled = true; g.ItemUnclipByLog = true g.LogFlags = flags g.LogWindow = window g.LogNextPrefix = nil; g.LogNextSuffix = nil g.LogDepthRef = window.DC.TreeDepth g.LogDepthToExpand = ((auto_open_depth or -1) >= 0) and auto_open_depth or g.LogDepthToExpandDefault - g.LogLinePosY = FLT_MAX + g.LogLinePosY = 3.4028234663853e+38 --[[FLT_MAX]] g.LogLineFirstItem = true g.LogBuffer = ImGuiTextBuffer() end @@ -6185,7 +6219,7 @@ end function ImGui.LogToTTY(auto_open_depth) local g = GImGui if g.LogEnabled then return end - ImGui.LogBegin(ImGuiLogFlags.OutputTTY, auto_open_depth or -1) + ImGui.LogBegin(1 --[[ImGuiLogFlags.OutputTTY]], auto_open_depth or -1) g.LogFile = "stdout" end @@ -6199,25 +6233,25 @@ end function ImGui.LogToClipboard(auto_open_depth) local g = GImGui if g.LogEnabled then return end - ImGui.LogBegin(ImGuiLogFlags.OutputClipboard, auto_open_depth or -1) + ImGui.LogBegin(8 --[[ImGuiLogFlags.OutputClipboard]], auto_open_depth or -1) end function ImGui.LogToBuffer(auto_open_depth) local g = GImGui if g.LogEnabled then return end - ImGui.LogBegin(ImGuiLogFlags.OutputBuffer, auto_open_depth or -1) + ImGui.LogBegin(4 --[[ImGuiLogFlags.OutputBuffer]], auto_open_depth or -1) end function ImGui.LogFinish() local g = GImGui if not g.LogEnabled then return end ImGui.LogText("\n") - local out = bit32.band(g.LogFlags, ImGuiLogFlags.OutputMask_) - if out == ImGuiLogFlags.OutputClipboard then + local out = bit32.band(g.LogFlags, 15 --[[ImGuiLogFlags.OutputMask_]]) + if out == 8 --[[ImGuiLogFlags.OutputClipboard]] then if not g.LogBuffer:empty() then ImGui.SetClipboardText(g.LogBuffer:c_str()) end end g.LogEnabled = false; g.ItemUnclipByLog = false - g.LogFlags = ImGuiLogFlags.None + g.LogFlags = 0 --[[ImGuiLogFlags.None]] g.LogFile = nil g.LogBuffer = ImGuiTextBuffer() end @@ -6230,7 +6264,7 @@ function ImGui.LogButtons() local log_to_tty = ImGui.Button("Log To TTY"); ImGui.SameLine() local log_to_file = ImGui.Button("Log To File"); ImGui.SameLine() local log_to_clipboard = ImGui.Button("Log To Clipboard"); ImGui.SameLine() - ImGui.PushItemFlag(ImGuiItemFlags.NoTabStop, true) + ImGui.PushItemFlag(1 --[[ImGuiItemFlags.NoTabStop]], true) ImGui.SetNextItemWidth(ImGui.CalcTextSize("999").x) g.LogDepthToExpandDefault = ImGui.SliderInt("Default Depth", g.LogDepthToExpandDefault, 0, 9, nil) ImGui.PopItemFlag() @@ -6311,7 +6345,7 @@ function ImGui.IsMouseDragPastThreshold(button, lock_threshold) if lock_threshold == nil then lock_threshold = -1.0 end local g = GImGui - IM_ASSERT(button >= 0 and button < 3) -- IM_COUNTOF(g.IO.MouseDown) + assert(button >= 0 and button < 3) -- IM_COUNTOF(g.IO.MouseDown) if lock_threshold < 0.0 then lock_threshold = g.IO.MouseDragThreshold end @@ -6324,7 +6358,7 @@ function ImGui.IsMouseDragging(button, lock_threshold) if lock_threshold == nil then lock_threshold = -1.0 end local g = GImGui - IM_ASSERT(button >= 0 and button < 3) -- IM_COUNTOF(g.IO.MouseDown) + assert(button >= 0 and button < 3) -- IM_COUNTOF(g.IO.MouseDown) if not g.IO.MouseDown[button] then return false end @@ -6348,22 +6382,22 @@ end function ImGui.ItemHandleShortcut(id) local g = GImGui local flags = g.NextItemData.ShortcutFlags - IM_ASSERT(bit32.band(flags, bit32.bnot(ImGuiInputFlags.SupportedBySetNextItemShortcut)) == 0) -- Passing flags not supported by SetNextItemShortcut()! + assert(bit32.band(flags, bit32.bnot(523519 --[[ImGuiInputFlags.SupportedBySetNextItemShortcut]])) == 0) -- Passing flags not supported by SetNextItemShortcut()! - if bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.Disabled) ~= 0 then + if bit32.band(g.LastItemData.ItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) ~= 0 then return end - if bit32.band(flags, ImGuiInputFlags.Tooltip) ~= 0 then - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HasShortcut) + if bit32.band(flags, 262144 --[[ImGuiInputFlags.Tooltip]]) ~= 0 then + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 1024 --[[ImGuiItemStatusFlags.HasShortcut]]) g.LastItemData.Shortcut = g.NextItemData.Shortcut end - if not ImGui.Shortcut(g.NextItemData.Shortcut, bit32.band(flags, ImGuiInputFlags.SupportedByShortcut), id) or g.NavActivateId ~= 0 then + if not ImGui.Shortcut(g.NextItemData.Shortcut, bit32.band(flags, 261375 --[[ImGuiInputFlags.SupportedByShortcut]]), id) or g.NavActivateId ~= 0 then return end -- FIXME: Generalize Activation queue? g.NavActivateId = id -- Will effectively disable clipping. - g.NavActivateFlags = bit32.bor(ImGuiActivateFlags.PreferInput, ImGuiActivateFlags.FromShortcut) + g.NavActivateFlags = bit32.bor(1 --[[ImGuiActivateFlags.PreferInput]], 16 --[[ImGuiActivateFlags.FromShortcut]]) -- if (g.ActiveId == 0 || g.ActiveId == id) g.NavActivateDownId = id g.NavActivatePressedId = id @@ -6397,7 +6431,7 @@ function ImGui.ItemAdd(bb, id, nav_bb_arg, extra_flags) r = last_item_data.NavRect r.Min.x = nav_bb.Min.x; r.Min.y = nav_bb.Min.y; r.Max.x = nav_bb.Max.x; r.Max.y = nav_bb.Max.y last_item_data.ItemFlags = bit32.bor(g.CurrentItemFlags, next_item_data.ItemFlagsSet, extra_flags) - last_item_data.StatusFlags = ImGuiItemStatusFlags.None + last_item_data.StatusFlags = 0 --[[ImGuiItemStatusFlags.None]] -- Note: we don't copy 'g.NextItemData.SelectionUserData' to an hypothetical g.LastItemData.SelectionUserData: since the former is not cleared. if id ~= 0 then @@ -6415,27 +6449,27 @@ function ImGui.ItemAdd(bb, id, nav_bb_arg, extra_flags) -- to reach unclipped widgets. This would work if user had explicit scrolling control (e.g. mapped on a stick). -- We intentionally don't check if g.NavWindow ~= nil because g.NavAnyRequest should only be set when it is non nil. -- If we crash on a nil g.NavWindow we need to fix the bug elsewhere. - if bit32.band(last_item_data.ItemFlags, ImGuiItemFlags.NoNav) == 0 then + if bit32.band(last_item_data.ItemFlags, 2 --[[ImGuiItemFlags.NoNav]]) == 0 then -- FIXME-NAV: investigate changing the window tests into a simple 'if (g.NavFocusScopeId == g.CurrentFocusScopeId)' test. window.DC.NavLayersActiveMaskNext = bit32.bor(window.DC.NavLayersActiveMaskNext, bit32.lshift(1, window.DC.NavLayerCurrent)) if g.NavId == id or g.NavAnyRequest then if g.NavWindow.RootWindowForNav == window.RootWindowForNav then - if window == g.NavWindow or bit32.band(bit32.bor(window.ChildFlags, g.NavWindow.ChildFlags), ImGuiChildFlags.NavFlattened) ~= 0 then + if window == g.NavWindow or bit32.band(bit32.bor(window.ChildFlags, g.NavWindow.ChildFlags), 256 --[[ImGuiChildFlags.NavFlattened]]) ~= 0 then ImGui.NavProcessItem() end end end end - if bit32.band(next_item_data.HasFlags, ImGuiNextItemDataFlags.HasShortcut) ~= 0 then + if bit32.band(next_item_data.HasFlags, 4 --[[ImGuiNextItemDataFlags.HasShortcut]]) ~= 0 then ImGui.ItemHandleShortcut(id) end end -- Lightweight clear of SetNextItemXXX data. - next_item_data.HasFlags = ImGuiNextItemDataFlags.None - next_item_data.ItemFlagsSet = ImGuiItemFlags.None + next_item_data.HasFlags = 0 --[[ImGuiNextItemDataFlags.None]] + next_item_data.ItemFlagsSet = 0 --[[ImGuiItemFlags.None]] -- Clipping test -- (this is an inline copy of IsClippedEx() so we can reuse the is_rect_visible value, otherwise we'd do 'if (IsClippedEx(bb, id)) return false') @@ -6454,11 +6488,11 @@ function ImGui.ItemAdd(bb, id, nav_bb_arg, extra_flags) -- We need to calculate this now to take account of the current clipping rectangle (as items like Selectable may change them) if is_rect_visible then - last_item_data.StatusFlags = bit32.bor(last_item_data.StatusFlags, ImGuiItemStatusFlags.Visible) + last_item_data.StatusFlags = bit32.bor(last_item_data.StatusFlags, 256 --[[ImGuiItemStatusFlags.Visible]]) end if ImGui.IsMouseHoveringRect(bb.Min, bb.Max) then - last_item_data.StatusFlags = bit32.bor(last_item_data.StatusFlags, ImGuiItemStatusFlags.HoveredRect) + last_item_data.StatusFlags = bit32.bor(last_item_data.StatusFlags, 1 --[[ImGuiItemStatusFlags.HoveredRect]]) end return true @@ -6561,7 +6595,7 @@ function ImGui.ItemSize(size_or_bb, text_baseline_y) dc.IsSameLine = false -- Horizontal layout mode - if (dc.LayoutType == ImGuiLayoutType.Horizontal) then + if (dc.LayoutType == 0 --[[ImGuiLayoutType.Horizontal]]) then ImGui.SameLine() end end @@ -6636,7 +6670,7 @@ end --- @param item_width float function ImGui.SetNextItemWidth(item_width) local g = GImGui - g.NextItemData.HasFlags = bit32.bor(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasWidth) + g.NextItemData.HasFlags = bit32.bor(g.NextItemData.HasFlags, 1 --[[ImGuiNextItemDataFlags.HasWidth]]) g.NextItemData.Width = item_width end @@ -6650,7 +6684,7 @@ function ImGui.PushItemWidth(item_width) local n = stack.Size + 1 if n > stack.Capacity then stack:push_back(window.DC.ItemWidth) else stack.Data[n] = window.DC.ItemWidth; stack.Size = n end window.DC.ItemWidth = (item_width == 0.0) and window.DC.ItemWidthDefault or item_width - g.NextItemData.HasFlags = bit32.band(g.NextItemData.HasFlags, bit32.bnot(ImGuiNextItemDataFlags.HasWidth)) + g.NextItemData.HasFlags = bit32.band(g.NextItemData.HasFlags, bit32.bnot(1 --[[ImGuiNextItemDataFlags.HasWidth]])) end function ImGui.PopItemWidth() @@ -6670,7 +6704,7 @@ end function ImGui.PushMultiItemsWidths(components, w_full) local g = GImGui local window = g.CurrentWindow - IM_ASSERT(components > 0) + assert(components > 0) local style = g.Style window.DC.ItemWidthStack:push_back(window.DC.ItemWidth) -- Backup current width local w_items = w_full - style.ItemInnerSpacing.x * (components - 1) @@ -6681,7 +6715,7 @@ function ImGui.PushMultiItemsWidths(components, w_full) prev_split = next_split end window.DC.ItemWidth = ImMax(prev_split, 1.0) - g.NextItemData.HasFlags = bit32.band(g.NextItemData.HasFlags, bit32.bnot(ImGuiNextItemDataFlags.HasWidth)) + g.NextItemData.HasFlags = bit32.band(g.NextItemData.HasFlags, bit32.bnot(1 --[[ImGuiNextItemDataFlags.HasWidth]])) end --- @return float @@ -6842,7 +6876,7 @@ function ImGui.BeginGroup() ImVec2_Copy(window.DC.CursorMaxPos, window.DC.CursorPos) ImVec2_CopyV(window.DC.CurrLineSize, 0.0, 0.0) if (g.LogEnabled) then - g.LogLinePosY = -FLT_MAX -- To enforce a carriage return + g.LogLinePosY = -3.4028234663853e+38 --[[FLT_MAX]] -- To enforce a carriage return end end @@ -6850,10 +6884,10 @@ end function ImGui.EndGroup() local g = GImGui local window = g.CurrentWindow - IM_ASSERT(g.GroupStack.Size > 0) -- Mismatched BeginGroup()/EndGroup() calls + assert(g.GroupStack.Size > 0) -- Mismatched BeginGroup()/EndGroup() calls local group_data = g.GroupStack:back() - IM_ASSERT(group_data.WindowID == window.ID) -- EndGroup() in wrong window? + assert(group_data.WindowID == window.ID) -- EndGroup() in wrong window? if (window.DC.IsSetPos) then -- TODO: ImGui.ErrorCheckUsingSetCursorPosToExtendParentBoundaries() @@ -6870,7 +6904,7 @@ function ImGui.EndGroup() window.DC.CurrLineTextBaseOffset = group_data.BackupCurrLineTextBaseOffset window.DC.IsSameLine = group_data.BackupIsSameLine if (g.LogEnabled) then - g.LogLinePosY = -FLT_MAX -- To enforce a carriage return + g.LogLinePosY = -3.4028234663853e+38 --[[FLT_MAX]] -- To enforce a carriage return end if (not group_data.EmitItem) then @@ -6880,7 +6914,7 @@ function ImGui.EndGroup() window.DC.CurrLineTextBaseOffset = ImMax(window.DC.PrevLineTextBaseOffset, group_data.BackupCurrLineTextBaseOffset) -- FIXME: Incorrect, we should grab the base offset from the *first line* of the group but it is hard to obtain now. ImGui.ItemSize(group_bb:GetSize()) - ImGui.ItemAdd(group_bb, 0, nil, ImGuiItemFlags.NoTabStop) + ImGui.ItemAdd(group_bb, 0, nil, 1 --[[ImGuiItemFlags.NoTabStop]]) -- If the current ActiveId was declared within the boundary of our group, we copy it to LastItemId so IsItemActive(), IsItemDeactivated() etc. will be functional on the entire group. -- It would be neater if we replaced window.DC.LastItemId by e.g. 'bool LastItemIsActive', but would put a little more burden on individual widgets. @@ -6898,18 +6932,18 @@ function ImGui.EndGroup() -- Forward Hovered flag local group_contains_curr_hovered_id = (group_data.BackupHoveredIdIsAlive == false) and g.HoveredId ~= 0 if group_contains_curr_hovered_id then - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HoveredWindow) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 128 --[[ImGuiItemStatusFlags.HoveredWindow]]) end -- Forward Edited flag if g.AnyIdHasBeenEditedThisFrame and not group_data.BackupAnyIdHasBeenEditedThisFrame then - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.Edited) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 4 --[[ImGuiItemStatusFlags.Edited]]) end -- Forward Deactivated flag - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HasDeactivated) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 32 --[[ImGuiItemStatusFlags.HasDeactivated]]) if group_contains_deactivated_id then - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.Deactivated) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 64 --[[ImGuiItemStatusFlags.Deactivated]]) end g.GroupStack:pop_back() @@ -6926,7 +6960,7 @@ function ImGui.CalcItemWidth() local window = g.CurrentWindow local w - if bit32.band(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasWidth) ~= 0 then + if bit32.band(g.NextItemData.HasFlags, 1 --[[ImGuiNextItemDataFlags.HasWidth]]) ~= 0 then w = g.NextItemData.Width else w = window.DC.ItemWidth @@ -7010,8 +7044,8 @@ end function ImGui.IsItemDeactivated() local g = GImGui - if bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HasDeactivated) ~= 0 then - return bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.Deactivated) ~= 0 + if bit32.band(g.LastItemData.StatusFlags, 32 --[[ImGuiItemStatusFlags.HasDeactivated]]) ~= 0 then + return bit32.band(g.LastItemData.StatusFlags, 64 --[[ImGuiItemStatusFlags.Deactivated]]) ~= 0 end return g.DeactivatedItemData.ID == g.LastItemData.ID and g.LastItemData.ID ~= 0 and g.DeactivatedItemData.ElapseFrame >= g.FrameCount end @@ -7037,11 +7071,11 @@ end --- @param mouse_button? ImGuiMouseButton function ImGui.IsItemClicked(mouse_button) if mouse_button == nil then mouse_button = 0 end - return ImGui.IsMouseClicked(mouse_button) and ImGui.IsItemHovered(ImGuiHoveredFlags.None) + return ImGui.IsMouseClicked(mouse_button) and ImGui.IsItemHovered(0 --[[ImGuiHoveredFlags.None]]) end function ImGui.IsItemToggledOpen() - return bit32.band(GImGui.LastItemData.StatusFlags, ImGuiItemStatusFlags.ToggledOpen) ~= 0 + return bit32.band(GImGui.LastItemData.StatusFlags, 16 --[[ImGuiItemStatusFlags.ToggledOpen]]) ~= 0 end -- Call after a Selectable() or TreeNode() items inside a BeginMultiSelect()/EndMultiSelect() scope. @@ -7052,8 +7086,8 @@ end -- Prefer using 'if (IsItemClicked() && !IsItemToggledOpen())' for a manual reimplementation of selection. function ImGui.IsItemToggledSelection() local g = GImGui - IM_ASSERT(g.CurrentMultiSelect ~= nil) -- Can only be used inside a BeginMultiSelect()/EndMultiSelect() - return bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.ToggledSelection) ~= 0 + assert(g.CurrentMultiSelect ~= nil) -- Can only be used inside a BeginMultiSelect()/EndMultiSelect() + return bit32.band(g.LastItemData.StatusFlags, 8 --[[ImGuiItemStatusFlags.ToggledSelection]]) ~= 0 end -- IMPORTANT: If you are trying to check whether your mouse should be dispatched to Dear ImGui or to your underlying app, @@ -7074,11 +7108,11 @@ function ImGui.IsAnyItemFocused() end function ImGui.IsItemVisible() - return bit32.band(GImGui.LastItemData.StatusFlags, ImGuiItemStatusFlags.Visible) ~= 0 + return bit32.band(GImGui.LastItemData.StatusFlags, 256 --[[ImGuiItemStatusFlags.Visible]]) ~= 0 end function ImGui.IsItemEdited() - return bit32.band(GImGui.LastItemData.StatusFlags, ImGuiItemStatusFlags.Edited) ~= 0 + return bit32.band(GImGui.LastItemData.StatusFlags, 4 --[[ImGuiItemStatusFlags.Edited]]) ~= 0 end -- Allow next item to be overlapped by subsequent items. @@ -7086,7 +7120,7 @@ end -- so if a following items overwrite it our interactions will naturally be disabled. function ImGui.SetNextItemAllowOverlap() local g = GImGui - g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, ImGuiItemFlags.AllowOverlap) + g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, 16384 --[[ImGuiItemFlags.AllowOverlap]]) end function ImGui.GetItemID() @@ -7132,14 +7166,14 @@ function ImGui.FocusWindow(window, flags) local g = GImGui -- Modal check? - if bit32.band(flags, ImGuiFocusRequestFlags.UnlessBelowModal) ~= 0 and g.NavWindow ~= window then -- Early out in common case. + if bit32.band(flags, 2 --[[ImGuiFocusRequestFlags.UnlessBelowModal]]) ~= 0 and g.NavWindow ~= window then -- Early out in common case. local blocking_modal = ImGui.FindBlockingModal(window) if blocking_modal then -- This block would typically be reached in two situations: -- - API call to FocusWindow() with a window under a modal and ImGuiFocusRequestFlags.UnlessBelowModal flag. -- - User clicking on void or anything behind a modal while a modal is open (window == nil) -- IMGUI_DEBUG_LOG_FOCUS("[focus] FocusWindow(\"%s\", UnlessBelowModal): prevented by \"%s\".", window ? window->Name : "", blocking_modal->Name) - if window and window == window.RootWindow and bit32.band(window.Flags, ImGuiWindowFlags.NoBringToFrontOnFocus) == 0 then + if window and window == window.RootWindow and bit32.band(window.Flags, 8192 --[[ImGuiWindowFlags.NoBringToFrontOnFocus]]) == 0 then ImGui.BringWindowToDisplayBehind(window, blocking_modal) -- Still bring right under modal. (FIXME: Could move in focus list too?) end ImGui.ClosePopupsOverWindow(ImGui.GetTopMostPopupModal(), false) -- Note how we need to use GetTopMostPopupModal() aad NOT blocking_modal, to handle nested modals @@ -7148,7 +7182,7 @@ function ImGui.FocusWindow(window, flags) end -- Find last focused child (if any) and focus it instead. - if bit32.band(flags, ImGuiFocusRequestFlags.RestoreFocusedChild) ~= 0 and window ~= nil then + if bit32.band(flags, 1 --[[ImGuiFocusRequestFlags.RestoreFocusedChild]]) ~= 0 and window ~= nil then window = ImGui.NavRestoreLastChildNavWindow(window) end @@ -7159,17 +7193,17 @@ function ImGui.FocusWindow(window, flags) g.NavMousePosDirty = true end g.NavId = window and window.NavLastIds[0] or 0 -- Restore NavId - g.NavLayer = ImGuiNavLayer.Main + g.NavLayer = 0 --[[ImGuiNavLayer.Main]] ImGui.SetNavFocusScope(window and window.NavRootFocusScopeId or 0) g.NavIdIsAlive = false - g.NavLastValidSelectionUserData = ImGuiSelectionUserData_Invalid + g.NavLastValidSelectionUserData = (-1) --[[ImGuiSelectionUserData_Invalid]] -- Close popups if any ImGui.ClosePopupsOverWindow(window, false) end -- Move the root window to the top of the pile - IM_ASSERT(window == nil or window.RootWindowDockTree ~= nil) + assert(window == nil or window.RootWindowDockTree ~= nil) local focus_front_window = window and window.RootWindow or nil local display_front_window = window and window.RootWindowDockTree or nil local dock_node = window and window.DockNode or nil @@ -7198,7 +7232,7 @@ function ImGui.FocusWindow(window, flags) -- Bring to front ImGui.BringWindowToFocusFront(focus_front_window) - if bit32.band(bit32.bor(window.Flags, focus_front_window.Flags, display_front_window.Flags), ImGuiWindowFlags.NoBringToFrontOnFocus) == 0 then + if bit32.band(bit32.bor(window.Flags, focus_front_window.Flags, display_front_window.Flags), 8192 --[[ImGuiWindowFlags.NoBringToFrontOnFocus]]) == 0 then ImGui.BringWindowToDisplayFront(display_front_window) end end @@ -7209,8 +7243,8 @@ function ImGui.FindWindowFocusIndex(window) local g = GImGui -- IM_UNUSED(g) local order = window.FocusOrder - IM_ASSERT(window.RootWindow == window) -- No child window (not testing _ChildWindow because of docking) - IM_ASSERT(g.WindowsFocusOrder.Data[order] == window) + assert(window.RootWindow == window) -- No child window (not testing _ChildWindow because of docking) + assert(g.WindowsFocusOrder.Data[order] == window) return order end @@ -7220,7 +7254,7 @@ end --- @param window ImGuiWindow --- @return bool function ImGui.IsWindowNavFocusable(window) - return window.WasActive and window == window.RootWindow and bit32.band(window.Flags, ImGuiWindowFlags.NoNavFocus) == 0 + return window.WasActive and window == window.RootWindow and bit32.band(window.Flags, 131072 --[[ImGuiWindowFlags.NoNavFocus]]) == 0 end --- @param i_start int @@ -7243,15 +7277,15 @@ end function ImGui.UpdateWindowInFocusOrderList(window, just_created, new_flags) local g = GImGui - local new_is_explicit_child = (bit32.band(new_flags, ImGuiWindowFlags.ChildWindow) ~= 0) and ((bit32.band(new_flags, ImGuiWindowFlags.Popup) == 0) or (bit32.band(new_flags, ImGuiWindowFlags.ChildMenu) ~= 0)) + local new_is_explicit_child = (bit32.band(new_flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0) and ((bit32.band(new_flags, 67108864 --[[ImGuiWindowFlags.Popup]]) == 0) or (bit32.band(new_flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0)) local child_flag_changed = (new_is_explicit_child ~= window.IsExplicitChild) if (just_created or child_flag_changed) and not new_is_explicit_child then - IM_ASSERT(not g.WindowsFocusOrder:contains(window)) + assert(not g.WindowsFocusOrder:contains(window)) g.WindowsFocusOrder:push_back(window) window.FocusOrder = g.WindowsFocusOrder.Size elseif not just_created and child_flag_changed and new_is_explicit_child then - IM_ASSERT(g.WindowsFocusOrder.Data[window.FocusOrder] == window) + assert(g.WindowsFocusOrder.Data[window.FocusOrder] == window) for n = window.FocusOrder + 1, g.WindowsFocusOrder.Size do g.WindowsFocusOrder.Data[n].FocusOrder = g.WindowsFocusOrder.Data[n].FocusOrder - 1 @@ -7267,10 +7301,10 @@ end --- @param window? ImGuiWindow function ImGui.BringWindowToFocusFront(window) local g = GImGui - IM_ASSERT(window == window.RootWindow) + assert(window == window.RootWindow) local cur_order = window.FocusOrder - IM_ASSERT(g.WindowsFocusOrder.Data[cur_order] == window) + assert(g.WindowsFocusOrder.Data[cur_order] == window) if g.WindowsFocusOrder:back() == window then return @@ -7281,7 +7315,7 @@ function ImGui.BringWindowToFocusFront(window) for n = cur_order, new_order - 1 do g.WindowsFocusOrder.Data[n] = g.WindowsFocusOrder.Data[n + 1] g.WindowsFocusOrder.Data[n].FocusOrder = g.WindowsFocusOrder.Data[n].FocusOrder - 1 - IM_ASSERT(g.WindowsFocusOrder.Data[n].FocusOrder == n) + assert(g.WindowsFocusOrder.Data[n].FocusOrder == n) end g.WindowsFocusOrder.Data[new_order] = window @@ -7313,7 +7347,7 @@ end --- @param window ImGuiWindow --- @param behind_window ImGuiWindow function ImGui.BringWindowToDisplayBehind(window, behind_window) - IM_ASSERT(window ~= nil and behind_window ~= nil) + assert(window ~= nil and behind_window ~= nil) local g = GImGui window = window.RootWindow behind_window = behind_window.RootWindow @@ -7330,7 +7364,7 @@ function ImGui.FocusTopMostWindowUnderOne(under_this_window, ignore_window, filt if under_this_window ~= nil then -- Aim at root window behind us, if we are in a child window that's our own root (see #4640) local offset = -1 - while bit32.band(under_this_window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 do + while bit32.band(under_this_window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 do under_this_window = under_this_window.ParentWindow offset = 0 end @@ -7347,7 +7381,7 @@ function ImGui.FocusTopMostWindowUnderOne(under_this_window, ignore_window, filt if filter_viewport ~= nil and window.Viewport ~= filter_viewport then break end - if bit32.band(window.Flags, bit32.bor(ImGuiWindowFlags.NoMouseInputs, ImGuiWindowFlags.NoNavInputs)) ~= bit32.bor(ImGuiWindowFlags.NoMouseInputs, ImGuiWindowFlags.NoNavInputs) then + if bit32.band(window.Flags, bit32.bor(512 --[[ImGuiWindowFlags.NoMouseInputs]], 65536 --[[ImGuiWindowFlags.NoNavInputs]])) ~= bit32.bor(512 --[[ImGuiWindowFlags.NoMouseInputs]], 65536 --[[ImGuiWindowFlags.NoNavInputs]]) then -- FIXME-DOCK: When ImGuiFocusRequestFlags.RestoreFocusedChild is set... -- This is failing (lagging by one frame) for docked windows. -- If A and B are docked into window and B disappear, at the NewFrame() call site window.NavLastChildNavWindow will still point to B. @@ -7366,7 +7400,7 @@ end --- @param window ImGuiWindow function ImGui.SetFocusID(id, window) local g = GImGui - IM_ASSERT(id ~= 0) + assert(id ~= 0) if g.NavWindow ~= window then ImGui.SetNavWindow(window) @@ -7382,20 +7416,20 @@ function ImGui.SetFocusID(id, window) if g.LastItemData.ID == id then ImRect_Copy(window.NavRectRel[nav_layer], ImGui.WindowRectAbsToRel(window, g.LastItemData.NavRect)) end - g.NavIdItemFlags = (g.LastItemData.ID == id) and g.LastItemData.ItemFlags or ImGuiItemFlags.None + g.NavIdItemFlags = (g.LastItemData.ID == id) and g.LastItemData.ItemFlags or 0 --[[ImGuiItemFlags.None]] if id == g.ActiveIdIsAlive then g.NavIdIsAlive = true end - if g.ActiveIdSource == ImGuiInputSource.Keyboard or g.ActiveIdSource == ImGuiInputSource.Gamepad then + if g.ActiveIdSource == 2 --[[ImGuiInputSource.Keyboard]] or g.ActiveIdSource == 3 --[[ImGuiInputSource.Gamepad]] then g.NavHighlightItemUnderNav = true elseif g.IO.ConfigNavCursorVisibleAuto then g.NavCursorVisible = false end -- Clear preferred scoring position (NavMoveRequestApplyResult() will tend to restore it) - ImGui.NavClearPreferredPosForAxis(ImGuiAxis.X) - ImGui.NavClearPreferredPosForAxis(ImGuiAxis.Y) + ImGui.NavClearPreferredPosForAxis(1 --[[ImGuiAxis.X]]) + ImGui.NavClearPreferredPosForAxis(2 --[[ImGuiAxis.Y]]) end -- This is not 100% symmetric with StartMouseMovingWindow(). @@ -7410,7 +7444,7 @@ function ImGui.StopMouseMovingWindow() if window and window.Viewport then -- Try to merge the window back into the main viewport. -- This works because MouseViewport should be ~= MovingWindow.Viewport on release (as per code in UpdateViewports) - if bit32.band(g.ConfigFlagsCurrFrame, ImGuiConfigFlags.ViewportsEnable) ~= 0 then + if bit32.band(g.ConfigFlagsCurrFrame, 1024 --[[ImGuiConfigFlags.ViewportsEnable]]) ~= 0 then ImGui.UpdateTryMergeWindowIntoHostViewport(window.RootWindowDockTree, g.MouseViewport) end @@ -7420,9 +7454,9 @@ function ImGui.StopMouseMovingWindow() end -- Clear the NoInputs window flag set by the Viewport system in AddUpdateViewport() - local window_can_use_inputs = bit32.band(window.Flags, ImGuiWindowFlags.NoMouseInputs) == 0 or bit32.band(window.Flags, ImGuiWindowFlags.NoNavInputs) == 0 + local window_can_use_inputs = bit32.band(window.Flags, 512 --[[ImGuiWindowFlags.NoMouseInputs]]) == 0 or bit32.band(window.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) == 0 if window_can_use_inputs then - window.Viewport.Flags = bit32.band(window.Viewport.Flags, bit32.bnot(ImGuiViewportFlags.NoInputs)) + window.Viewport.Flags = bit32.band(window.Viewport.Flags, bit32.bnot(128 --[[ImGuiViewportFlags.NoInputs]])) end end @@ -7486,9 +7520,9 @@ function ImGui.SetActiveID(id, window) if g.NavActivateId == id or g.NavJustMovedToId == id then g.ActiveIdSource = g.NavInputSource else - g.ActiveIdSource = ImGuiInputSource.Mouse + g.ActiveIdSource = 1 --[[ImGuiInputSource.Mouse]] end - IM_ASSERT(g.ActiveIdSource ~= ImGuiInputSource.None) + assert(g.ActiveIdSource ~= 0 --[[ImGuiInputSource.None]]) end -- Clear declaration of inputs claimed by the widget @@ -7523,7 +7557,7 @@ function ImGui.PushOverrideID(id) local g = GImGui local window = g.CurrentWindow if g.DebugHookIdInfoId == id and id ~= 0 then - ImGui.DebugHookIdInfo(id, ImGuiDataType.ID, nil) + ImGui.DebugHookIdInfo(id, 12 --[[ImGuiDataType.ID]], nil) end -- [Luau] inline window.IDStack:push_back(id) local stack = window.IDStack @@ -7556,7 +7590,7 @@ function MT.ImGuiWindow:GetID(id) end local g = GImGui if g.DebugHookIdInfoId == h and h ~= 0 then - ImGui.DebugHookIdInfo(h, (type(id) == "string") and ImGuiDataType.String or ImGuiDataType.S32, id) + ImGui.DebugHookIdInfo(h, (type(id) == "string") and 9 --[[ImGuiDataType.String]] or 4 --[[ImGuiDataType.S32]], id) end return h end @@ -7604,7 +7638,7 @@ function ImGui.GetIDWithSeed(a, b, c) id = ImHashStr(a, b and (b - 1) or nil, c) end if GImGui.DebugHookIdInfoId == id and id ~= 0 then - ImGui.DebugHookIdInfo(id, (type(a) == "number") and ImGuiDataType.S32 or ImGuiDataType.String, (b and type(a) == "string") and string.sub(a, 1, b - 1) or a) + ImGui.DebugHookIdInfo(id, (type(a) == "number") and 4 --[[ImGuiDataType.S32]] or 9 --[[ImGuiDataType.String]], (b and type(a) == "string") and string.sub(a, 1, b - 1) or a) end return id end @@ -7625,10 +7659,10 @@ end --- @return float local function CalcDelayFromHoveredFlags(flags) local g = GImGui - if bit32.band(flags, ImGuiHoveredFlags.DelayNormal) ~= 0 then + if bit32.band(flags, 65536 --[[ImGuiHoveredFlags.DelayNormal]]) ~= 0 then return g.Style.HoverDelayNormal end - if bit32.band(flags, ImGuiHoveredFlags.DelayShort) ~= 0 then + if bit32.band(flags, 32768 --[[ImGuiHoveredFlags.DelayShort]]) ~= 0 then return g.Style.HoverDelayShort end return 0.0 @@ -7638,8 +7672,8 @@ end --- @param shared_flags ImGuiHoveredFlags local function ApplyHoverFlagsForTooltip(user_flags, shared_flags) -- Allow instance flags to override shared flags - if bit32.band(user_flags, bit32.bor(ImGuiHoveredFlags.DelayNone, ImGuiHoveredFlags.DelayShort, ImGuiHoveredFlags.DelayNormal)) ~= 0 then - shared_flags = bit32.band(shared_flags, bit32.bnot(bit32.bor(ImGuiHoveredFlags.DelayNone, ImGuiHoveredFlags.DelayShort, ImGuiHoveredFlags.DelayNormal))) + if bit32.band(user_flags, bit32.bor(16384 --[[ImGuiHoveredFlags.DelayNone]], 32768 --[[ImGuiHoveredFlags.DelayShort]], 65536 --[[ImGuiHoveredFlags.DelayNormal]])) ~= 0 then + shared_flags = bit32.band(shared_flags, bit32.bnot(bit32.bor(16384 --[[ImGuiHoveredFlags.DelayNone]], 32768 --[[ImGuiHoveredFlags.DelayShort]], 65536 --[[ImGuiHoveredFlags.DelayNormal]]))) end return bit32.bor(user_flags, shared_flags) end @@ -7651,11 +7685,11 @@ function ImGui.MarkItemEdited(id) local g = GImGui -- IM_ASSERT(g.LastItemData.ID == id) -- Failing cases include: "widgets_inputtext_scrolling", "widgets_inputtext_multiline_status", "widgets_selectable_input" = case of e.g TempInputText() overlayed manually with different ID (#2718) - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.EditedInternal) - if bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.NoMarkEdited) ~= 0 then + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 2048 --[[ImGuiItemStatusFlags.EditedInternal]]) + if bit32.band(g.LastItemData.ItemFlags, 65536 --[[ImGuiItemFlags.NoMarkEdited]]) ~= 0 then return end - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.Edited) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 4 --[[ImGuiItemStatusFlags.Edited]]) if g.ActiveId == id or g.ActiveId == 0 then -- FIXME: Can't we fully rely on LastItemData yet? @@ -7670,10 +7704,10 @@ function ImGui.MarkItemEdited(id) -- We accept a MarkItemEdited() on drag and drop targets (see https://github.com/ocornut/imgui/issues/1875#issuecomment-978243343) -- We accept 'ActiveIdPreviousFrame == id' for InputText() returning an edit after it has been taken ActiveId away (#4714) -- FIXME: This assert is getting a bit meaningless over time. It helped detect some unusual use cases but eventually it is becoming an unnecessary restriction. - IM_ASSERT(g.DragDropActive or g.ActiveId == id or g.ActiveId == 0 or g.DeactivatedItemData.ID == id or g.ActiveIdPreviousFrame == id or g.NavJustMovedToId or (g.CurrentMultiSelect ~= nil and g.BoxSelectState.IsActive)) + assert(g.DragDropActive or g.ActiveId == id or g.ActiveId == 0 or g.DeactivatedItemData.ID == id or g.ActiveIdPreviousFrame == id or g.NavJustMovedToId or (g.CurrentMultiSelect ~= nil and g.BoxSelectState.IsActive)) -- IM_ASSERT(g.CurrentWindow.DC.LastItemId == id) - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.Edited) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 4 --[[ImGuiItemStatusFlags.Edited]]) end --- @param window ImGuiWindow @@ -7688,9 +7722,9 @@ function ImGui.IsWindowContentHoverable(window, flags) -- For the purpose of those flags we differentiate "standard popup" from "modal popup" -- NB: The 'else' is important because Modal windows are also Popups. local want_inhibit = false - if bit32.band(focused_root_window.Flags, ImGuiWindowFlags.Modal) ~= 0 then + if bit32.band(focused_root_window.Flags, 134217728 --[[ImGuiWindowFlags.Modal]]) ~= 0 then want_inhibit = true - elseif (bit32.band(focused_root_window.Flags, ImGuiWindowFlags.Popup) ~= 0) and (bit32.band(flags, ImGuiHoveredFlags.AllowWhenBlockedByPopup) == 0) then + elseif (bit32.band(focused_root_window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0) and (bit32.band(flags, 32 --[[ImGuiHoveredFlags.AllowWhenBlockedByPopup]]) == 0) then want_inhibit = true end @@ -7723,27 +7757,27 @@ function ImGui.IsItemHovered(flags) local g = GImGui local window = g.CurrentWindow - IM_ASSERT_USER_ERROR(bit32.band(flags, bit32.bnot(ImGuiHoveredFlags.AllowedMaskForIsItemHovered)) == 0, "Invalid flags for IsItemHovered()!") + IM_ASSERT_USER_ERROR(bit32.band(flags, bit32.bnot(262048 --[[ImGuiHoveredFlags.AllowedMaskForIsItemHovered]])) == 0, "Invalid flags for IsItemHovered()!") - if g.NavHighlightItemUnderNav and g.NavCursorVisible and bit32.band(flags, ImGuiHoveredFlags.NoNavOverride) == 0 then + if g.NavHighlightItemUnderNav and g.NavCursorVisible and bit32.band(flags, 2048 --[[ImGuiHoveredFlags.NoNavOverride]]) == 0 then if not ImGui.IsItemFocused() then return false end - if bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.Disabled) ~= 0 and bit32.band(flags, ImGuiHoveredFlags.AllowWhenDisabled) == 0 then + if bit32.band(g.LastItemData.ItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) ~= 0 and bit32.band(flags, 1024 --[[ImGuiHoveredFlags.AllowWhenDisabled]]) == 0 then return false end - if bit32.band(flags, ImGuiHoveredFlags.ForTooltip) ~= 0 then + if bit32.band(flags, 4096 --[[ImGuiHoveredFlags.ForTooltip]]) ~= 0 then flags = ApplyHoverFlagsForTooltip(flags, g.Style.HoverFlagsForTooltipNav) end else -- Test for bounding box overlap, as updated as ItemAdd() local status_flags = g.LastItemData.StatusFlags - if bit32.band(status_flags, ImGuiItemStatusFlags.HoveredRect) == 0 then + if bit32.band(status_flags, 1 --[[ImGuiItemStatusFlags.HoveredRect]]) == 0 then return false end - if bit32.band(flags, ImGuiHoveredFlags.ForTooltip) ~= 0 then + if bit32.band(flags, 4096 --[[ImGuiHoveredFlags.ForTooltip]]) ~= 0 then flags = ApplyHoverFlagsForTooltip(flags, g.Style.HoverFlagsForTooltipMouse) end @@ -7753,15 +7787,15 @@ function ImGui.IsItemHovered(flags) -- [2017/10/16] Reverted commit 344d48be3 and testing RootWindow instead. I believe it is correct to NOT test for RootWindow but this leaves us unable -- to use IsItemHovered() after EndChild() itself. Until a solution is found I believe reverting to the test from 2017/09/27 is safe since this was -- the test that has been running for a long while. - if g.HoveredWindow ~= window and bit32.band(status_flags, ImGuiItemStatusFlags.HoveredWindow) == 0 then - if bit32.band(flags, ImGuiHoveredFlags.AllowWhenOverlappedByWindow) == 0 then + if g.HoveredWindow ~= window and bit32.band(status_flags, 128 --[[ImGuiItemStatusFlags.HoveredWindow]]) == 0 then + if bit32.band(flags, 512 --[[ImGuiHoveredFlags.AllowWhenOverlappedByWindow]]) == 0 then return false end end -- Test if another item is active (e.g. being dragged) local id = g.LastItemData.ID - if bit32.band(flags, ImGuiHoveredFlags.AllowWhenBlockedByActiveItem) == 0 then + if bit32.band(flags, 128 --[[ImGuiHoveredFlags.AllowWhenBlockedByActiveItem]]) == 0 then if g.ActiveId ~= 0 and g.ActiveId ~= id and not g.ActiveIdAllowOverlap and not g.ActiveIdFromShortcut then -- When ActiveId == MoveId it means that either: -- - (1) user clicked on void _or_ an item with no id, which triggers moving window (ActiveId is set even when window has _NoMove flag) @@ -7783,12 +7817,12 @@ function ImGui.IsItemHovered(flags) -- Test if interactions on this window are blocked by an active popup or modal. -- The ImGuiHoveredFlags.AllowWhenBlockedByPopup flag will be tested here. - if not ImGui.IsWindowContentHoverable(window, flags) and bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.NoWindowHoverableCheck) == 0 then + if not ImGui.IsWindowContentHoverable(window, flags) and bit32.band(g.LastItemData.ItemFlags, 8192 --[[ImGuiItemFlags.NoWindowHoverableCheck]]) == 0 then return false end -- Test if the item is disabled - if bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.Disabled) ~= 0 and bit32.band(flags, ImGuiHoveredFlags.AllowWhenDisabled) == 0 then + if bit32.band(g.LastItemData.ItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) ~= 0 and bit32.band(flags, 1024 --[[ImGuiHoveredFlags.AllowWhenDisabled]]) == 0 then return false end @@ -7800,8 +7834,8 @@ function ImGui.IsItemHovered(flags) end -- Test if using AllowOverlap and overlapped - if bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.AllowOverlap) ~= 0 and id ~= 0 then - if bit32.band(flags, ImGuiHoveredFlags.AllowWhenOverlappedByItem) == 0 then + if bit32.band(g.LastItemData.ItemFlags, 16384 --[[ImGuiItemFlags.AllowOverlap]]) ~= 0 and id ~= 0 then + if bit32.band(flags, 256 --[[ImGuiHoveredFlags.AllowWhenOverlappedByItem]]) == 0 then if g.HoveredIdPreviousFrame ~= g.LastItemData.ID then return false end @@ -7812,14 +7846,14 @@ function ImGui.IsItemHovered(flags) -- Handle hover delay -- (some ideas: https://www.nngroup.com/articles/timing-exposing-content) local delay = CalcDelayFromHoveredFlags(flags) - if delay > 0.0 or bit32.band(flags, ImGuiHoveredFlags.Stationary) ~= 0 then + if delay > 0.0 or bit32.band(flags, 8192 --[[ImGuiHoveredFlags.Stationary]]) ~= 0 then local hover_delay_id if g.LastItemData.ID ~= 0 then hover_delay_id = g.LastItemData.ID else hover_delay_id = window:GetIDFromPos(g.LastItemData.Rect.Min) end - if bit32.band(flags, ImGuiHoveredFlags.NoSharedDelay) ~= 0 and g.HoverItemDelayIdPreviousFrame ~= hover_delay_id then + if bit32.band(flags, 131072 --[[ImGuiHoveredFlags.NoSharedDelay]]) ~= 0 and g.HoverItemDelayIdPreviousFrame ~= hover_delay_id then g.HoverItemDelayTimer = 0.0 end g.HoverItemDelayId = hover_delay_id @@ -7827,7 +7861,7 @@ function ImGui.IsItemHovered(flags) -- When changing hovered item we requires a bit of stationary delay before activating hover timer, -- but once unlocked on a given item we also moving. -- if (g.HoverDelayTimer >= delay && (g.HoverDelayTimer - g.IO.DeltaTime < delay || g.MouseStationaryTimer - g.IO.DeltaTime < g.Style.HoverStationaryDelay)) { IMGUI_DEBUG_LOG("HoverDelayTimer = %f/%f, MouseStationaryTimer = %f\n", g.HoverDelayTimer, delay, g.MouseStationaryTimer); } - if bit32.band(flags, ImGuiHoveredFlags.Stationary) ~= 0 and g.HoverItemUnlockedStationaryId ~= hover_delay_id then + if bit32.band(flags, 8192 --[[ImGuiHoveredFlags.Stationary]]) ~= 0 and g.HoverItemUnlockedStationaryId ~= hover_delay_id then return false end @@ -7857,10 +7891,10 @@ function ImGui.ItemHoverable(bb, id, item_flags) -- Detect ID conflicts -- (this is specifically done here by comparing on hover because it allows us a detection of duplicates that is algorithmically extra cheap, 1 u32 compare per item. No O(log N) lookup whatsoever) if not IMGUI_DISABLE_DEBUG_TOOLS then - if id ~= 0 and g.HoveredIdPreviousFrame == id and bit32.band(item_flags, ImGuiItemFlags.AllowDuplicateId) == 0 then + if id ~= 0 and g.HoveredIdPreviousFrame == id and bit32.band(item_flags, 32 --[[ImGuiItemFlags.AllowDuplicateId]]) == 0 then g.HoveredIdPreviousFrameItemCount = g.HoveredIdPreviousFrameItemCount + 1 if g.DebugDrawIdConflictsId == id then - window.DrawList:AddRect(bb.Min - ImVec2(1, 1), bb.Max + ImVec2(1, 1), IM_COL32(255, 0, 0, 255), 0.0, 2.0, ImDrawFlags.None) + window.DrawList:AddRect(bb.Min - ImVec2(1, 1), bb.Max + ImVec2(1, 1), IM_COL32(255, 0, 0, 255), 0.0, 2.0, 0 --[[ImDrawFlags.None]]) end end end @@ -7884,7 +7918,7 @@ end end -- We are done with rectangle culling so we can perform heavier checks now. - if (bit32.band(item_flags, ImGuiItemFlags.NoWindowHoverableCheck) == 0) and not ImGui.IsWindowContentHoverable(window, ImGuiHoveredFlags.None) then + if (bit32.band(item_flags, 8192 --[[ImGuiItemFlags.NoWindowHoverableCheck]]) == 0) and not ImGui.IsWindowContentHoverable(window, 0 --[[ImGuiHoveredFlags.None]]) then g.HoveredIdIsDisabled = true return false end @@ -7893,7 +7927,7 @@ end -- hover test in widgets code. We could also decide to split this function is two. if id ~= 0 then -- Drag source doesn't report as hovered - if g.DragDropActive and g.DragDropPayload.SourceId == id and (bit32.band(g.DragDropSourceFlags, ImGuiDragDropFlags.SourceNoDisableHover) == 0) then + if g.DragDropActive and g.DragDropPayload.SourceId == id and (bit32.band(g.DragDropSourceFlags, 2 --[[ImGuiDragDropFlags.SourceNoDisableHover]]) == 0) then return false end @@ -7901,7 +7935,7 @@ end -- AllowOverlap mode (rarely used) requires previous frame HoveredId to be nil or to match. -- This allows using patterns where a later submitted widget overlaps a previous one. Generally perceived as a front-to-back hit-test. - if bit32.band(item_flags, ImGuiItemFlags.AllowOverlap) ~= 0 then + if bit32.band(item_flags, 16384 --[[ImGuiItemFlags.AllowOverlap]]) ~= 0 then g.HoveredIdAllowOverlap = true if g.HoveredIdPreviousFrame ~= id then return false @@ -7910,15 +7944,15 @@ end -- Display shortcut (only works with mouse) -- (ImGuiItemStatusFlags.HasShortcut in LastItemData denotes we want a tooltip) - if id == g.LastItemData.ID and (bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HasShortcut) ~= 0) and g.ActiveId ~= id then - if ImGui.IsItemHovered(bit32.bor(ImGuiHoveredFlags.ForTooltip, ImGuiHoveredFlags.DelayNormal)) then + if id == g.LastItemData.ID and (bit32.band(g.LastItemData.StatusFlags, 1024 --[[ImGuiItemStatusFlags.HasShortcut]]) ~= 0) and g.ActiveId ~= id then + if ImGui.IsItemHovered(bit32.bor(4096 --[[ImGuiHoveredFlags.ForTooltip]], 65536 --[[ImGuiHoveredFlags.DelayNormal]])) then ImGui.SetTooltip("%s", ImGui.GetKeyChordName(g.LastItemData.Shortcut)) end end end -- When disabled we'll return false but still set HoveredId - if bit32.band(item_flags, ImGuiItemFlags.Disabled) ~= 0 then + if bit32.band(item_flags, 64 --[[ImGuiItemFlags.Disabled]]) ~= 0 then -- Release active id if turning disabled if g.ActiveId == id and id ~= 0 then ImGui.ClearActiveID() @@ -7927,7 +7961,7 @@ end return false end - if g.NavHighlightItemUnderNav and (bit32.band(item_flags, ImGuiItemFlags.NoNavDisableMouseHover) == 0) then + if g.NavHighlightItemUnderNav and (bit32.band(item_flags, 32768 --[[ImGuiItemFlags.NoNavDisableMouseHover]]) == 0) then return false end @@ -7986,15 +8020,15 @@ end -- FIXME: Should in theory be called "AddCharacterEvent()" to be consistent with new API --- @param c unsigned_int function MT.ImGuiIO:AddInputCharacter(c) - IM_ASSERT(self.Ctx ~= nil) + assert(self.Ctx ~= nil) local g = self.Ctx if c == 0 or not self.AppAcceptingEvents then return end local e = ImGuiInputEvent() - e.Type = ImGuiInputEventType.Text - e.Source = ImGuiInputSource.Keyboard + e.Type = 6 --[[ImGuiInputEventType.Text]] + e.Source = 2 --[[ImGuiInputSource.Keyboard]] e.EventId = g.InputEventsNextEventId g.InputEventsNextEventId = g.InputEventsNextEventId + 1 e.Text = ImGuiInputEventText() @@ -8013,7 +8047,7 @@ function MT.ImGuiIO:AddInputCharacterUTF16(c) if bit32.band(c, 0xFC00) == 0xD800 then -- High surrogate, must save if self.InputQueueSurrogate ~= 0 then - self:AddInputCharacter(IM_UNICODE_CODEPOINT_INVALID) + self:AddInputCharacter(65533 --[[IM_UNICODE_CODEPOINT_INVALID]]) end self.InputQueueSurrogate = c return @@ -8022,10 +8056,10 @@ function MT.ImGuiIO:AddInputCharacterUTF16(c) local cp = c if self.InputQueueSurrogate ~= 0 then if bit32.band(c, 0xFC00) ~= 0xDC00 then -- Invalid low surrogate - self:AddInputCharacter(IM_UNICODE_CODEPOINT_INVALID) + self:AddInputCharacter(65533 --[[IM_UNICODE_CODEPOINT_INVALID]]) else -- #if IM_UNICODE_CODEPOINT_MAX == 0xFFFF - cp = IM_UNICODE_CODEPOINT_INVALID -- Codepoint will not fit in ImWchar + cp = 65533 --[[IM_UNICODE_CODEPOINT_INVALID]] -- Codepoint will not fit in ImWchar -- #endif end @@ -8036,7 +8070,7 @@ end -- Clear all incoming events. function MT.ImGuiIO:ClearEventsQueue() - IM_ASSERT(self.Ctx ~= nil) + assert(self.Ctx ~= nil) local g = GImGui g.InputEventsQueue:clear() end @@ -8044,9 +8078,9 @@ end -- Clear current keyboard/gamepad state + current frame text input buffer. Equivalent to releasing all keys/buttons. function MT.ImGuiIO:ClearInputKeys() local g = self.Ctx - for key = ImGuiKey.NamedKey_BEGIN, ImGuiKey.NamedKey_END - 1 do + for key = 512 --[[ImGuiKey.NamedKey_BEGIN]], 667 --[[ImGuiKey.NamedKey_END]] - 1 do if not ImGui.IsMouseKey(key) then - local key_data = g.IO.KeysData[key - ImGuiKey.NamedKey_BEGIN] + local key_data = g.IO.KeysData[key - 512 --[[ImGuiKey.NamedKey_BEGIN]]] key_data.Down = false key_data.DownDuration = -1.0 key_data.DownDurationPrev = -1.0 @@ -8056,13 +8090,13 @@ function MT.ImGuiIO:ClearInputKeys() self.KeyShift = false self.KeyAlt = false self.KeySuper = false - self.KeyMods = ImGuiMod_None + self.KeyMods = 0 --[[ImGuiMod_None]] self.InputQueueCharacters:resize(0) -- Behavior of old ClearInputCharacters(). end function MT.ImGuiIO:ClearInputMouse() - for key = ImGuiKey_Mouse_BEGIN, ImGuiKey_Mouse_END - 1 do - local key_data = self.KeysData[key - ImGuiKey.NamedKey_BEGIN] + for key = 656 --[[ImGuiKey_Mouse_BEGIN]], 663 --[[ImGuiKey_Mouse_END]] - 1 do + local key_data = self.KeysData[key - 512 --[[ImGuiKey.NamedKey_BEGIN]]] if key_data then key_data.Down = false key_data.DownDuration = -1.0 @@ -8070,7 +8104,7 @@ function MT.ImGuiIO:ClearInputMouse() end end - self.MousePos = ImVec2(-FLT_MAX, -FLT_MAX) + self.MousePos = ImVec2(-3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]]) for n = 0, 2 do -- IM_COUNTOF(MouseDown) self.MouseDown[n] = false @@ -8094,8 +8128,8 @@ function MT.ImGuiIO:FindLatestInputEvent(ctx, type, arg) local e = g.InputEventsQueue.Data[n] if e.Type ~= type then - elseif type == ImGuiInputEventType.Key and e.Key.Key ~= arg then - elseif type == ImGuiInputEventType.MouseButton and e.MouseButton.Button ~= arg then + elseif type == 5 --[[ImGuiInputEventType.Key]] and e.Key.Key ~= arg then + elseif type == 3 --[[ImGuiInputEventType.MouseButton]] and e.MouseButton.Button ~= arg then else return e end @@ -8115,28 +8149,28 @@ end --- @param analog_value float function MT.ImGuiIO:AddKeyAnalogEvent(key, down, analog_value) -- if (e->Down) { IMGUI_DEBUG_LOG_IO("AddKeyEvent() Key='%s' %d, NativeKeycode = %d, NativeScancode = %d\n", ImGui::GetKeyName(e->Key), e->Down, e->NativeKeycode, e->NativeScancode); } - IM_ASSERT(self.Ctx ~= nil) - if key == ImGuiKey.None or not self.AppAcceptingEvents then + assert(self.Ctx ~= nil) + if key == 0 --[[ImGuiKey.None]] or not self.AppAcceptingEvents then return end local g = self.Ctx - IM_ASSERT(ImGui.IsNamedKeyOrMod(key)) -- Backend needs to pass a valid ImGuiKey constant. 0..511 values are legacy native key codes which are not accepted by this API. - IM_ASSERT(ImGui.IsAliasKey(key) == false) -- Backend cannot submit ImGuiKey.MouseXXX values they are automatically inferred from AddMouseXXX() events. + assert(ImGui.IsNamedKeyOrMod(key)) -- Backend needs to pass a valid ImGuiKey constant. 0..511 values are legacy native key codes which are not accepted by this API. + assert(ImGui.IsAliasKey(key) == false) -- Backend cannot submit ImGuiKey.MouseXXX values they are automatically inferred from AddMouseXXX() events. -- MacOS: swap Cmd(Super) and Ctrl if (g.IO.ConfigMacOSXBehaviors) then - if (key == ImGuiMod_Super) then key = ImGuiMod_Ctrl - elseif (key == ImGuiMod_Ctrl) then key = ImGuiMod_Super - elseif (key == ImGuiKey.LeftSuper) then key = ImGuiKey.LeftCtrl - elseif (key == ImGuiKey.RightSuper) then key = ImGuiKey.RightCtrl - elseif (key == ImGuiKey.LeftCtrl) then key = ImGuiKey.LeftSuper - elseif (key == ImGuiKey.RightCtrl) then key = ImGuiKey.RightSuper + if (key == 32768 --[[ImGuiMod_Super]]) then key = 4096 --[[ImGuiMod_Ctrl]] + elseif (key == 4096 --[[ImGuiMod_Ctrl]]) then key = 32768 --[[ImGuiMod_Super]] + elseif (key == 530 --[[ImGuiKey.LeftSuper]]) then key = 527 --[[ImGuiKey.LeftCtrl]] + elseif (key == 534 --[[ImGuiKey.RightSuper]]) then key = 531 --[[ImGuiKey.RightCtrl]] + elseif (key == 527 --[[ImGuiKey.LeftCtrl]]) then key = 530 --[[ImGuiKey.LeftSuper]] + elseif (key == 531 --[[ImGuiKey.RightCtrl]]) then key = 534 --[[ImGuiKey.RightSuper]] end end -- Filter duplicate (in particular: key mods and gamepad analog values are commonly spammed) - local latest_event = self:FindLatestInputEvent(g, ImGuiInputEventType.Key, key) + local latest_event = self:FindLatestInputEvent(g, 5 --[[ImGuiInputEventType.Key]], key) local key_data = ImGui.GetKeyData(g, key) local latest_key_down = latest_event and latest_event.Key.Down or key_data.Down local latest_key_analog = latest_event and latest_event.Key.AnalogValue or key_data.AnalogValue @@ -8146,8 +8180,8 @@ function MT.ImGuiIO:AddKeyAnalogEvent(key, down, analog_value) -- Add event local e = ImGuiInputEvent() - e.Type = ImGuiInputEventType.Key - e.Source = ImGui.IsGamepadKey(key) and ImGuiInputSource.Gamepad or ImGuiInputSource.Keyboard + e.Type = 5 --[[ImGuiInputEventType.Key]] + e.Source = ImGui.IsGamepadKey(key) and 3 --[[ImGuiInputSource.Gamepad]] or 2 --[[ImGuiInputSource.Keyboard]] e.EventId = g.InputEventsNextEventId g.InputEventsNextEventId = g.InputEventsNextEventId + 1 e.Key = ImGuiInputEventKey() @@ -8176,14 +8210,14 @@ end -- This is so that duplicate events (e.g. Windows sending extraneous WM_MOUSEMOVE) gets filtered and are not leading to actual source changes. --- @param source ImGuiMouseSource function MT.ImGuiIO:AddMouseSourceEvent(source) - IM_ASSERT(self.Ctx ~= nil) + assert(self.Ctx ~= nil) local g = self.Ctx g.InputEventsNextMouseSource = source end --- @param viewport_id ImGuiID function MT.ImGuiIO:AddMouseViewportEvent(viewport_id) - IM_ASSERT(self.Ctx ~= nil) + assert(self.Ctx ~= nil) local g = self.Ctx -- IM_ASSERT(g.IO.BackendFlags & ImGuiBackendFlags.HasMouseHoveredViewport) if (not self.AppAcceptingEvents) then @@ -8191,7 +8225,7 @@ function MT.ImGuiIO:AddMouseViewportEvent(viewport_id) end -- Filter duplicate - local latest_event = self:FindLatestInputEvent(g, ImGuiInputEventType.MouseViewport) + local latest_event = self:FindLatestInputEvent(g, 4 --[[ImGuiInputEventType.MouseViewport]]) local latest_viewport_id if latest_event then latest_viewport_id = latest_event.MouseViewport.HoveredViewportID @@ -8203,8 +8237,8 @@ function MT.ImGuiIO:AddMouseViewportEvent(viewport_id) end local e = ImGuiInputEvent() - e.Type = ImGuiInputEventType.MouseViewport - e.Source = ImGuiInputSource.Mouse + e.Type = 4 --[[ImGuiInputEventType.MouseViewport]] + e.Source = 1 --[[ImGuiInputSource.Mouse]] e.MouseViewport = ImGuiInputEventMouseViewport() e.MouseViewport.HoveredViewportID = viewport_id g.InputEventsQueue:push_back(e) @@ -8212,18 +8246,18 @@ end --- @param focused bool function MT.ImGuiIO:AddFocusEvent(focused) - IM_ASSERT(self.Ctx ~= nil) + assert(self.Ctx ~= nil) local g = self.Ctx -- Filter duplicate - local latest_event = self:FindLatestInputEvent(g, ImGuiInputEventType.Focus) + local latest_event = self:FindLatestInputEvent(g, 7 --[[ImGuiInputEventType.Focus]]) local latest_focused = latest_event and latest_event.AppFocused.Focused or (not g.IO.AppFocusLost) if latest_focused == focused or (self.ConfigDebugIgnoreFocusLoss and not focused) then return end local e = ImGuiInputEvent() - e.Type = ImGuiInputEventType.Focus + e.Type = 7 --[[ImGuiInputEventType.Focus]] e.EventId = g.InputEventsNextEventId g.InputEventsNextEventId = g.InputEventsNextEventId + 1 e.AppFocused = ImGuiInputEventAppFocused() @@ -8235,7 +8269,7 @@ end --- @param x float --- @param y float function MT.ImGuiIO:AddMousePosEvent(x, y) - IM_ASSERT(self.Ctx ~= nil) + assert(self.Ctx ~= nil) if not self.AppAcceptingEvents then return end @@ -8244,24 +8278,24 @@ function MT.ImGuiIO:AddMousePosEvent(x, y) -- Apply same flooring as UpdateMouseInputs() local x_val = x - if x > -FLT_MAX then + if x > -3.4028234663853e+38 --[[FLT_MAX]] then x_val = ImFloor(x) end local y_val = y - if y > -FLT_MAX then + if y > -3.4028234663853e+38 --[[FLT_MAX]] then y_val = ImFloor(y) end -- Filter duplicate - local latest_event = self:FindLatestInputEvent(g, ImGuiInputEventType.MousePos) + local latest_event = self:FindLatestInputEvent(g, 1 --[[ImGuiInputEventType.MousePos]]) local latest_pos = latest_event and ImVec2(latest_event.MousePos.PosX, latest_event.MousePos.PosY) or self.MousePos if latest_pos.x == x_val and latest_pos.y == y_val then return end local e = ImGuiInputEvent() - e.Type = ImGuiInputEventType.MousePos - e.Source = ImGuiInputSource.Mouse + e.Type = 1 --[[ImGuiInputEventType.MousePos]] + e.Source = 1 --[[ImGuiInputSource.Mouse]] e.EventId = g.InputEventsNextEventId g.InputEventsNextEventId = g.InputEventsNextEventId + 1 e.MousePos = ImGuiInputEventMousePos() @@ -8274,9 +8308,9 @@ end --- @param mouse_button ImGuiMouseButton --- @param down bool function MT.ImGuiIO:AddMouseButtonEvent(mouse_button, down) - IM_ASSERT(self.Ctx ~= nil) + assert(self.Ctx ~= nil) local g = self.Ctx - IM_ASSERT(mouse_button >= 0 and mouse_button < ImGuiMouseButton.COUNT) + assert(mouse_button >= 0 and mouse_button < 5 --[[ImGuiMouseButton.COUNT]]) if not self.AppAcceptingEvents then return end @@ -8291,7 +8325,7 @@ function MT.ImGuiIO:AddMouseButtonEvent(mouse_button, down) end -- Filter duplicate - local latest_event = self:FindLatestInputEvent(g, ImGuiInputEventType.MouseButton, mouse_button) + local latest_event = self:FindLatestInputEvent(g, 3 --[[ImGuiInputEventType.MouseButton]], mouse_button) local latest_button_down = latest_event and latest_event.MouseButton.Down or self.MouseDown[mouse_button] if latest_button_down == down then return @@ -8301,7 +8335,7 @@ function MT.ImGuiIO:AddMouseButtonEvent(mouse_button, down) -- - Note that this is actual physical Ctrl which is ImGuiMod_Super for us. -- - At this point we want from !down to down, so this is handling the initial press. if self.ConfigMacOSXBehaviors and mouse_button == 0 and down then - local latest_super_event = self:FindLatestInputEvent(g, ImGuiInputEventType.Key, ImGuiMod_Super) + local latest_super_event = self:FindLatestInputEvent(g, 5 --[[ImGuiInputEventType.Key]], 32768 --[[ImGuiMod_Super]]) if latest_super_event and latest_super_event.Key.Down or self.KeySuper then -- IMGUI_DEBUG_LOG_IO("[io] Super+Left Click aliased into Right Click\n") self.MouseCtrlLeftAsRightClick = true @@ -8311,8 +8345,8 @@ function MT.ImGuiIO:AddMouseButtonEvent(mouse_button, down) end local e = ImGuiInputEvent() - e.Type = ImGuiInputEventType.MouseButton - e.Source = ImGuiInputSource.Mouse + e.Type = 3 --[[ImGuiInputEventType.MouseButton]] + e.Source = 1 --[[ImGuiInputSource.Mouse]] e.EventId = g.InputEventsNextEventId g.InputEventsNextEventId = g.InputEventsNextEventId + 1 e.MouseButton = ImGuiInputEventMouseButton() @@ -8326,7 +8360,7 @@ end --- @param wheel_x float --- @param wheel_y float function MT.ImGuiIO:AddMouseWheelEvent(wheel_x, wheel_y) - IM_ASSERT(self.Ctx ~= nil) + assert(self.Ctx ~= nil) local g = self.Ctx -- Filter duplicate (unlike most events, wheel values are relative and easy to filter) if not self.AppAcceptingEvents or (wheel_x == 0 and wheel_y == 0) then @@ -8334,8 +8368,8 @@ function MT.ImGuiIO:AddMouseWheelEvent(wheel_x, wheel_y) end local e = ImGuiInputEvent() - e.Type = ImGuiInputEventType.MouseWheel - e.Source = ImGuiInputSource.Mouse + e.Type = 2 --[[ImGuiInputEventType.MouseWheel]] + e.Source = 1 --[[ImGuiInputSource.Mouse]] e.EventId = g.InputEventsNextEventId g.InputEventsNextEventId = g.InputEventsNextEventId + 1 e.MouseWheel = ImGuiInputEventMouseWheel() @@ -8414,25 +8448,25 @@ end --- @param key ImGuiKey local function GetModForLRModKey(key) - if key == ImGuiKey.LeftCtrl or key == ImGuiKey.RightCtrl then - return ImGuiMod_Ctrl + if key == 527 --[[ImGuiKey.LeftCtrl]] or key == 531 --[[ImGuiKey.RightCtrl]] then + return 4096 --[[ImGuiMod_Ctrl]] end - if key == ImGuiKey.LeftShift or key == ImGuiKey.RightShift then - return ImGuiMod_Shift + if key == 528 --[[ImGuiKey.LeftShift]] or key == 532 --[[ImGuiKey.RightShift]] then + return 8192 --[[ImGuiMod_Shift]] end - if key == ImGuiKey.LeftAlt or key == ImGuiKey.RightAlt then - return ImGuiMod_Alt + if key == 529 --[[ImGuiKey.LeftAlt]] or key == 533 --[[ImGuiKey.RightAlt]] then + return 16384 --[[ImGuiMod_Alt]] end - if key == ImGuiKey.LeftSuper or key == ImGuiKey.RightSuper then - return ImGuiMod_Super + if key == 530 --[[ImGuiKey.LeftSuper]] or key == 534 --[[ImGuiKey.RightSuper]] then + return 32768 --[[ImGuiMod_Super]] end - return ImGuiMod_None + return 0 --[[ImGuiMod_None]] end --- @param key_chord ImGuiKeyChord function ImGui.FixupKeyChord(key_chord) -- Add ImGuiMod_XXXX when a corresponding ImGuiKey.LeftXXX/ImGuiKey.RightXXX is specified. - local key = bit32.band(key_chord, bit32.bnot(ImGuiMod_Mask_)) + local key = bit32.band(key_chord, bit32.bnot(61440 --[[ImGuiMod_Mask_]])) if ImGui.IsLRModKey(key) then key_chord = bit32.bor(key_chord, GetModForLRModKey(key)) end @@ -8446,12 +8480,12 @@ function ImGui.GetKeyData(ctx, key) if ctx == nil then ctx = GImGui end -- Special storage location for mods - if bit32.band(key, ImGuiMod_Mask_) ~= 0 then + if bit32.band(key, 61440 --[[ImGuiMod_Mask_]]) ~= 0 then key = ImGui.ConvertSingleModFlagToKey(key) end - IM_ASSERT(ImGui.IsNamedKey(key), "Support for user key indices was dropped in favor of ImGuiKey. Please update backend & user code.") - local idx = key - ImGuiKey.NamedKey_BEGIN + assert(ImGui.IsNamedKey(key), "Support for user key indices was dropped in favor of ImGuiKey. Please update backend & user code.") + local idx = key - 512 --[[ImGuiKey.NamedKey_BEGIN]] return ctx.IO.KeysData[idx], idx end @@ -8479,14 +8513,14 @@ function ImGui.TestKeyOwner(key, owner_id) end local g = GImGui --- @cast g ImGuiContext - if g.ActiveIdUsingAllKeyboardKeys and owner_id ~= g.ActiveId and owner_id ~= ImGuiKeyOwner_Any then - if key >= ImGuiKey_Keyboard_BEGIN and key < ImGuiKey_Keyboard_END then + if g.ActiveIdUsingAllKeyboardKeys and owner_id ~= g.ActiveId and owner_id ~= 0 --[[ImGuiKeyOwner_Any]] then + if key >= 512 --[[ImGuiKey_Keyboard_BEGIN]] and key < 632 --[[ImGuiKey_Keyboard_END]] then return false end end local owner_data = ImGui.GetKeyOwnerData(g, key) - if owner_id == ImGuiKeyOwner_Any then + if owner_id == 0 --[[ImGuiKeyOwner_Any]] then return not owner_data.LockThisFrame end @@ -8497,7 +8531,7 @@ function ImGui.TestKeyOwner(key, owner_id) if owner_data.LockThisFrame then return false end - if owner_data.OwnerCurr ~= ImGuiKeyOwner_NoOwner then + if owner_data.OwnerCurr ~= 4294967295 --[[ImGuiKeyOwner_NoOwner]] then return false end end @@ -8510,7 +8544,7 @@ end --- @param key ImGuiKey --- @param owner_id? ImGuiID function ImGui.IsKeyDown(key, owner_id) - if owner_id == nil then owner_id = ImGuiKeyOwner_Any end + if owner_id == nil then owner_id = 0 --[[ImGuiKeyOwner_Any]] end local key_data = ImGui.GetKeyData(nil, key) if not key_data.Down then @@ -8527,14 +8561,14 @@ end function ImGui.IsKeyPressed(key, is_repeat) if is_repeat == nil then is_repeat = true end - return ImGui.IsKeyPressedEx(key, is_repeat and ImGuiInputFlags.Repeat or ImGuiInputFlags.None, ImGuiKeyOwner_Any) + return ImGui.IsKeyPressedEx(key, is_repeat and 1 --[[ImGuiInputFlags.Repeat]] or 0 --[[ImGuiInputFlags.None]], 0 --[[ImGuiKeyOwner_Any]]) end --- @param key ImGuiKey --- @param owner_id? ImGuiID --- @return bool function ImGui.IsKeyReleased(key, owner_id) - if owner_id == nil then owner_id = ImGuiKeyOwner_Any end + if owner_id == nil then owner_id = 0 --[[ImGuiKeyOwner_Any]] end local key_data = ImGui.GetKeyData(nil, key) if key_data.DownDurationPrev < 0.0 or key_data.Down then @@ -8563,26 +8597,26 @@ function ImGui.IsKeyPressedEx(key, flags, owner_id) if t < 0.0 then return false end - IM_ASSERT(bit32.band(flags, bit32.bnot(ImGuiInputFlags.SupportedByIsKeyPressed)) == 0) -- Passing flags not supported by this function! - if bit32.band(flags, bit32.bor(ImGuiInputFlags.RepeatRateMask_, ImGuiInputFlags.RepeatUntilMask_)) ~= 0 then -- Setting any _RepeatXXX option enables _Repeat - flags = bit32.bor(flags, ImGuiInputFlags.Repeat) + assert(bit32.band(flags, bit32.bnot(255 --[[ImGuiInputFlags.SupportedByIsKeyPressed]])) == 0) -- Passing flags not supported by this function! + if bit32.band(flags, bit32.bor(14 --[[ImGuiInputFlags.RepeatRateMask_]], 240 --[[ImGuiInputFlags.RepeatUntilMask_]])) ~= 0 then -- Setting any _RepeatXXX option enables _Repeat + flags = bit32.bor(flags, 1 --[[ImGuiInputFlags.Repeat]]) end local pressed = (t == 0.0) - if not pressed and bit32.band(flags, ImGuiInputFlags.Repeat) ~= 0 then + if not pressed and bit32.band(flags, 1 --[[ImGuiInputFlags.Repeat]]) ~= 0 then local repeat_delay, repeat_rate = ImGui.GetTypematicRepeatRate(flags) pressed = (t > repeat_delay) and (ImGui.GetKeyPressedAmount(key, repeat_delay, repeat_rate) > 0) - if pressed and bit32.band(flags, ImGuiInputFlags.RepeatUntilMask_) ~= 0 then + if pressed and bit32.band(flags, 240 --[[ImGuiInputFlags.RepeatUntilMask_]]) ~= 0 then -- Slightly bias 'key_pressed_time' as DownDuration is an accumulation of DeltaTime which we compare to an absolute time value. -- Ideally we'd replace DownDuration with KeyPressedTime but it would break user's code. local key_pressed_time = g.Time - t + 0.00001 - if bit32.band(flags, ImGuiInputFlags.RepeatUntilKeyModsChange) ~= 0 and g.LastKeyModsChangeTime > key_pressed_time then + if bit32.band(flags, 32 --[[ImGuiInputFlags.RepeatUntilKeyModsChange]]) ~= 0 and g.LastKeyModsChangeTime > key_pressed_time then pressed = false end - if bit32.band(flags, ImGuiInputFlags.RepeatUntilKeyModsChangeFromNone) ~= 0 and g.LastKeyModsChangeFromNoneTime > key_pressed_time then + if bit32.band(flags, 64 --[[ImGuiInputFlags.RepeatUntilKeyModsChangeFromNone]]) ~= 0 and g.LastKeyModsChangeFromNoneTime > key_pressed_time then pressed = false end - if bit32.band(flags, ImGuiInputFlags.RepeatUntilOtherKeyPress) ~= 0 and g.LastKeyboardKeyPressTime > key_pressed_time then + if bit32.band(flags, 128 --[[ImGuiInputFlags.RepeatUntilOtherKeyPress]]) ~= 0 and g.LastKeyboardKeyPressTime > key_pressed_time then pressed = false end end @@ -8601,16 +8635,16 @@ end -- TODO: -- Return untranslated names: on macOS, Cmd key will show as Ctrl, Ctrl key will show as super. function ImGui.GetKeyChordName(key_chord) - local key = bit32.band(key_chord, bit32.bnot(ImGuiMod_Mask_)) + local key = bit32.band(key_chord, bit32.bnot(61440 --[[ImGuiMod_Mask_]])) if ImGui.IsLRModKey(key) then key_chord = bit32.band(key_chord, bit32.bnot(GetModForLRModKey(key))) -- Return "Ctrl+LeftShift" instead of "Ctrl+Shift+LeftShift" end - local s = ((bit32.band(key_chord, ImGuiMod_Ctrl) ~= 0) and "Ctrl+" or "") - .. ((bit32.band(key_chord, ImGuiMod_Shift) ~= 0) and "Shift+" or "") - .. ((bit32.band(key_chord, ImGuiMod_Alt) ~= 0) and "Alt+" or "") - .. ((bit32.band(key_chord, ImGuiMod_Super) ~= 0) and "Super+" or "") - .. ((key ~= ImGuiKey.None or key_chord == ImGuiKey.None) and ImGui.GetKeyName(key) or "") - if key == ImGuiKey.None and key_chord ~= 0 and #s > 0 then + local s = ((bit32.band(key_chord, 4096 --[[ImGuiMod_Ctrl]]) ~= 0) and "Ctrl+" or "") + .. ((bit32.band(key_chord, 8192 --[[ImGuiMod_Shift]]) ~= 0) and "Shift+" or "") + .. ((bit32.band(key_chord, 16384 --[[ImGuiMod_Alt]]) ~= 0) and "Alt+" or "") + .. ((bit32.band(key_chord, 32768 --[[ImGuiMod_Super]]) ~= 0) and "Super+" or "") + .. ((key ~= 0 --[[ImGuiKey.None]] or key_chord == 0 --[[ImGuiKey.None]]) and ImGui.GetKeyName(key) or "") + if key == 0 --[[ImGuiKey.None]] and key_chord ~= 0 and #s > 0 then s = string.sub(s, 1, #s - 1) -- Remove trailing '+' end return s @@ -8644,33 +8678,33 @@ local GKeyNames = { --- @param key ImGuiKey --- @return string function ImGui.GetKeyName(key) - if key == ImGuiKey.None then + if key == 0 --[[ImGuiKey.None]] then return "None" end - IM_ASSERT(ImGui.IsNamedKeyOrMod(key), "Support for user key indices was dropped in favor of ImGuiKey. Please update backend and user code.") - if bit32.band(key, ImGuiMod_Mask_) ~= 0 then + assert(ImGui.IsNamedKeyOrMod(key), "Support for user key indices was dropped in favor of ImGuiKey. Please update backend and user code.") + if bit32.band(key, 61440 --[[ImGuiMod_Mask_]]) ~= 0 then key = ImGui.ConvertSingleModFlagToKey(key) end if not ImGui.IsNamedKey(key) then return "Unknown" end - return GKeyNames[key - ImGuiKey.NamedKey_BEGIN + 1] or "Unknown" + return GKeyNames[key - 512 --[[ImGuiKey.NamedKey_BEGIN]] + 1] or "Unknown" end --- @param key ImGuiKey --- @return ImGuiID function ImGui.GetKeyOwner(key) if not ImGui.IsNamedKeyOrMod(key) then - return ImGuiKeyOwner_NoOwner + return 4294967295 --[[ImGuiKeyOwner_NoOwner]] end local g = GImGui local owner_data = ImGui.GetKeyOwnerData(g, key) local owner_id = owner_data.OwnerCurr - if g.ActiveIdUsingAllKeyboardKeys and owner_id ~= g.ActiveId and owner_id ~= ImGuiKeyOwner_Any then - if key >= ImGuiKey_Keyboard_BEGIN and key < ImGuiKey_Keyboard_END then - return ImGuiKeyOwner_NoOwner + if g.ActiveIdUsingAllKeyboardKeys and owner_id ~= g.ActiveId and owner_id ~= 0 --[[ImGuiKeyOwner_Any]] then + if key >= 512 --[[ImGuiKey_Keyboard_BEGIN]] and key < 632 --[[ImGuiKey_Keyboard_END]] then + return 4294967295 --[[ImGuiKeyOwner_NoOwner]] end end @@ -8718,9 +8752,9 @@ end --- @return float repeat_rate function ImGui.GetTypematicRepeatRate(flags) local g = GImGui - flags = bit32.band(flags, ImGuiInputFlags.RepeatRateMask_) - if flags == ImGuiInputFlags.RepeatRateNavMove then repeat_delay = g.IO.KeyRepeatDelay * 0.72; repeat_rate = g.IO.KeyRepeatRate * 0.80; return repeat_delay, repeat_rate - elseif flags == ImGuiInputFlags.RepeatRateNavTweak then repeat_delay = g.IO.KeyRepeatDelay * 0.72; repeat_rate = g.IO.KeyRepeatRate * 0.30; return repeat_delay, repeat_rate + flags = bit32.band(flags, 14 --[[ImGuiInputFlags.RepeatRateMask_]]) + if flags == 4 --[[ImGuiInputFlags.RepeatRateNavMove]] then repeat_delay = g.IO.KeyRepeatDelay * 0.72; repeat_rate = g.IO.KeyRepeatRate * 0.80; return repeat_delay, repeat_rate + elseif flags == 8 --[[ImGuiInputFlags.RepeatRateNavTweak]] then repeat_delay = g.IO.KeyRepeatDelay * 0.72; repeat_rate = g.IO.KeyRepeatRate * 0.30; return repeat_delay, repeat_rate else repeat_delay = g.IO.KeyRepeatDelay * 1.00; repeat_rate = g.IO.KeyRepeatRate * 1.00; return repeat_delay, repeat_rate end end @@ -8747,18 +8781,18 @@ end function ImGui.UpdateKeyRoutingTable(rt) local g = GImGui --[[@as ImGuiContext]] rt.EntriesNext:resize(0) - for key = ImGuiKey.NamedKey_BEGIN, ImGuiKey.NamedKey_END - 1 do + for key = 512 --[[ImGuiKey.NamedKey_BEGIN]], 667 --[[ImGuiKey.NamedKey_END]] - 1 do local new_routing_start_idx = rt.EntriesNext.Size + 1 local routing_entry - local old_routing_idx = rt.Index[key - ImGuiKey.NamedKey_BEGIN + 1] + local old_routing_idx = rt.Index[key - 512 --[[ImGuiKey.NamedKey_BEGIN]] + 1] while old_routing_idx ~= -1 do repeat routing_entry = rt.Entries[old_routing_idx] routing_entry.RoutingCurrScore = routing_entry.RoutingNextScore routing_entry.RoutingCurr = routing_entry.RoutingNext -- Update entry - routing_entry.RoutingNext = ImGuiKeyOwner_NoOwner + routing_entry.RoutingNext = 4294967295 --[[ImGuiKeyOwner_NoOwner]] routing_entry.RoutingNextScore = 0 - if routing_entry.RoutingCurr == ImGuiKeyOwner_NoOwner then + if routing_entry.RoutingCurr == 4294967295 --[[ImGuiKeyOwner_NoOwner]] then break end @@ -8768,7 +8802,7 @@ function ImGui.UpdateKeyRoutingTable(rt) -- This is the result of previous frame's SetShortcutRouting() call. if routing_entry.Mods == g.IO.KeyMods then local owner_data = ImGui.GetKeyOwnerData(g, key) - if owner_data.OwnerCurr == ImGuiKeyOwner_NoOwner then + if owner_data.OwnerCurr == 4294967295 --[[ImGuiKeyOwner_NoOwner]] then owner_data.OwnerCurr = routing_entry.RoutingCurr -- IMGUI_DEBUG_LOG("SetKeyOwner(%s, owner_id=0x%08X) via Routing\n", GetKeyName(key), routing_entry->RoutingCurr); end @@ -8780,7 +8814,7 @@ function ImGui.UpdateKeyRoutingTable(rt) end -- Rewrite linked-list - rt.Index[key - ImGuiKey.NamedKey_BEGIN + 1] = (new_routing_start_idx <= rt.EntriesNext.Size and new_routing_start_idx or -1) + rt.Index[key - 512 --[[ImGuiKey.NamedKey_BEGIN]] + 1] = (new_routing_start_idx <= rt.EntriesNext.Size and new_routing_start_idx or -1) for n = new_routing_start_idx, rt.EntriesNext.Size do rt.EntriesNext[n].NextEntryIndex = (n + 1 <= rt.EntriesNext.Size) and (n + 1) or -1 end @@ -8792,7 +8826,7 @@ end --- @param owner_id ImGuiID local function GetRoutingIdFromOwnerId(owner_id) local g = GImGui - return (owner_id ~= ImGuiKeyOwner_NoOwner and owner_id ~= ImGuiKeyOwner_Any) and owner_id or g.CurrentFocusScopeId + return (owner_id ~= 4294967295 --[[ImGuiKeyOwner_NoOwner]] and owner_id ~= 0 --[[ImGuiKeyOwner_Any]]) and owner_id or g.CurrentFocusScopeId end --- @param key_chord ImGuiKeyChord @@ -8806,17 +8840,17 @@ function ImGui.GetShortcutRoutingData(key_chord) -- - Shortcut(ImGuiMod_Ctrl | ImGuiMod_Shift) -- Not legal local g = GImGui local rt = g.KeysRoutingTable - local key = bit32.band(key_chord, bit32.bnot(ImGuiMod_Mask_)) - local mods = bit32.band(key_chord, ImGuiMod_Mask_) - if key == ImGuiKey.None then + local key = bit32.band(key_chord, bit32.bnot(61440 --[[ImGuiMod_Mask_]])) + local mods = bit32.band(key_chord, 61440 --[[ImGuiMod_Mask_]]) + if key == 0 --[[ImGuiKey.None]] then key = ImGui.ConvertSingleModFlagToKey(mods) end - IM_ASSERT(ImGui.IsNamedKey(key)) + assert(ImGui.IsNamedKey(key)) -- Get (in the majority of case, the linked list will have one element so this should be 2 reads. -- Subsequent elements will be contiguous in memory as list is sorted/rebuilt in NewFrame). local routing_data - local idx = rt.Index[key - ImGuiKey.NamedKey_BEGIN + 1] + local idx = rt.Index[key - 512 --[[ImGuiKey.NamedKey_BEGIN]] + 1] while idx ~= -1 do routing_data = rt.Entries.Data[idx] if routing_data.Mods == mods then @@ -8831,8 +8865,8 @@ function ImGui.GetShortcutRoutingData(key_chord) rt.Entries:push_back(ImGuiKeyRoutingData()) routing_data = rt.Entries[routing_data_idx] routing_data.Mods = mods - routing_data.NextEntryIndex = rt.Index[key - ImGuiKey.NamedKey_BEGIN + 1] -- Setup linked list - rt.Index[key - ImGuiKey.NamedKey_BEGIN + 1] = routing_data_idx + routing_data.NextEntryIndex = rt.Index[key - 512 --[[ImGuiKey.NamedKey_BEGIN]] + 1] -- Setup linked list + rt.Index[key - 512 --[[ImGuiKey.NamedKey_BEGIN]] + 1] = routing_data_idx return routing_data end @@ -8851,7 +8885,7 @@ end --- @param flags ImGuiInputFlags local function CalcRoutingScore(focus_scope_id, owner_id, flags) local g = GImGui - if bit32.band(flags, ImGuiInputFlags.RouteFocused) ~= 0 then + if bit32.band(flags, 2048 --[[ImGuiInputFlags.RouteFocused]]) ~= 0 then -- ActiveID gets high priority -- (we don't check g.ActiveIdUsingAllKeys here. Routing is applied but if input ownership is tested later it may discard it) if owner_id ~= 0 and g.ActiveId == owner_id then @@ -8870,7 +8904,7 @@ local function CalcRoutingScore(focus_scope_id, owner_id, flags) end for index_in_focus_path = 1, g.NavFocusRoute.Size do if g.NavFocusRoute.Data[index_in_focus_path].ID == focus_scope_id then - if bit32.band(flags, ImGuiInputFlags.RouteOverActive) ~= 0 then -- && g.ActiveId != 0 && g.ActiveId != owner_id) + if bit32.band(flags, 32768 --[[ImGuiInputFlags.RouteOverActive]]) ~= 0 then -- && g.ActiveId != 0 && g.ActiveId != owner_id) return 599 - (index_in_focus_path - 1) else return 199 - (index_in_focus_path - 1) @@ -8878,24 +8912,24 @@ local function CalcRoutingScore(focus_scope_id, owner_id, flags) end end return 0 - elseif bit32.band(flags, ImGuiInputFlags.RouteActive) ~= 0 then + elseif bit32.band(flags, 1024 --[[ImGuiInputFlags.RouteActive]]) ~= 0 then if owner_id ~= 0 and g.ActiveId == owner_id then return 300 end return 0 - elseif bit32.band(flags, ImGuiInputFlags.RouteGlobal) ~= 0 then - if bit32.band(flags, ImGuiInputFlags.RouteOverActive) ~= 0 then + elseif bit32.band(flags, 4096 --[[ImGuiInputFlags.RouteGlobal]]) ~= 0 then + if bit32.band(flags, 32768 --[[ImGuiInputFlags.RouteOverActive]]) ~= 0 then return 400 end if owner_id ~= 0 and g.ActiveId == owner_id then return 300 end - if bit32.band(flags, ImGuiInputFlags.RouteOverFocused) ~= 0 then + if bit32.band(flags, 16384 --[[ImGuiInputFlags.RouteOverFocused]]) ~= 0 then return 200 end return 1 end - IM_ASSERT(false) + assert(false) return 0 end @@ -8908,15 +8942,15 @@ local function IsKeyChordPotentiallyCharInput(key_chord) local g = GImGui -- When the right mods are pressed it cannot be a char input so we won't filter the shortcut out. - local mods = bit32.band(key_chord, ImGuiMod_Mask_) - local ignore_char_inputs = ((bit32.band(mods, ImGuiMod_Ctrl) ~= 0) and (bit32.band(mods, ImGuiMod_Alt) == 0)) or (g.IO.ConfigMacOSXBehaviors and (bit32.band(mods, ImGuiMod_Ctrl) ~= 0)) + local mods = bit32.band(key_chord, 61440 --[[ImGuiMod_Mask_]]) + local ignore_char_inputs = ((bit32.band(mods, 4096 --[[ImGuiMod_Ctrl]]) ~= 0) and (bit32.band(mods, 16384 --[[ImGuiMod_Alt]]) == 0)) or (g.IO.ConfigMacOSXBehaviors and (bit32.band(mods, 4096 --[[ImGuiMod_Ctrl]]) ~= 0)) if ignore_char_inputs then return false end -- Return true for A-Z, 0-9 and other keys associated to char inputs. Other keys such as F1-F12 won't be filtered. - local key = bit32.band(key_chord, bit32.bnot(ImGuiMod_Mask_)) - if key == ImGuiKey.None then + local key = bit32.band(key_chord, bit32.bnot(61440 --[[ImGuiMod_Mask_]])) + if key == 0 --[[ImGuiKey.None]] then return false end return g.KeysMayBeCharInput:TestBit(key + 1) -- TestBit requires 1-based index @@ -8933,17 +8967,17 @@ end function ImGui.SetShortcutRouting(key_chord, flags, owner_id) local g = GImGui - if bit32.band(flags, ImGuiInputFlags.RouteTypeMask_) == 0 then - flags = bit32.bor(flags, ImGuiInputFlags.RouteGlobal, ImGuiInputFlags.RouteOverFocused, ImGuiInputFlags.RouteOverActive) -- IMPORTANT: This is the default for SetShortcutRouting() but NOT Shortcut() + if bit32.band(flags, 15360 --[[ImGuiInputFlags.RouteTypeMask_]]) == 0 then + flags = bit32.bor(flags, 4096 --[[ImGuiInputFlags.RouteGlobal]], 16384 --[[ImGuiInputFlags.RouteOverFocused]], 32768 --[[ImGuiInputFlags.RouteOverActive]]) -- IMPORTANT: This is the default for SetShortcutRouting() but NOT Shortcut() else - IM_ASSERT(ImIsPowerOfTwo(bit32.band(flags, ImGuiInputFlags.RouteTypeMask_))) -- Check that only 1 routing flag is used + assert(ImIsPowerOfTwo(bit32.band(flags, 15360 --[[ImGuiInputFlags.RouteTypeMask_]]))) -- Check that only 1 routing flag is used end - IM_ASSERT(owner_id ~= ImGuiKeyOwner_Any and owner_id ~= ImGuiKeyOwner_NoOwner) - if bit32.band(flags, bit32.bor(ImGuiInputFlags.RouteOverFocused, ImGuiInputFlags.RouteUnlessBgFocused)) ~= 0 then - IM_ASSERT(bit32.band(flags, ImGuiInputFlags.RouteGlobal) ~= 0) + assert(owner_id ~= 0 --[[ImGuiKeyOwner_Any]] and owner_id ~= 4294967295 --[[ImGuiKeyOwner_NoOwner]]) + if bit32.band(flags, bit32.bor(16384 --[[ImGuiInputFlags.RouteOverFocused]], 65536 --[[ImGuiInputFlags.RouteUnlessBgFocused]])) ~= 0 then + assert(bit32.band(flags, 4096 --[[ImGuiInputFlags.RouteGlobal]]) ~= 0) end - if bit32.band(flags, ImGuiInputFlags.RouteOverActive) ~= 0 then - IM_ASSERT(bit32.band(flags, bit32.bor(ImGuiInputFlags.RouteGlobal, ImGuiInputFlags.RouteFocused)) ~= 0) + if bit32.band(flags, 32768 --[[ImGuiInputFlags.RouteOverActive]]) ~= 0 then + assert(bit32.band(flags, bit32.bor(4096 --[[ImGuiInputFlags.RouteGlobal]], 2048 --[[ImGuiInputFlags.RouteFocused]])) ~= 0) end -- Add ImGuiMod_XXXX when a corresponding ImGuiKey.LeftXXX/ImGuiKey.RightXXX is specified. @@ -8954,21 +8988,21 @@ function ImGui.SetShortcutRouting(key_chord, flags, owner_id) -- IM_DEBUG_BREAK() end - if bit32.band(flags, ImGuiInputFlags.RouteUnlessBgFocused) ~= 0 then + if bit32.band(flags, 65536 --[[ImGuiInputFlags.RouteUnlessBgFocused]]) ~= 0 then if g.NavWindow == nil then return false end end -- Note how ImGuiInputFlags.RouteAlways won't set routing and thus won't set owner. May want to rework this? - if bit32.band(flags, ImGuiInputFlags.RouteAlways) ~= 0 then + if bit32.band(flags, 8192 --[[ImGuiInputFlags.RouteAlways]]) ~= 0 then -- IMGUI_DEBUG_LOG_INPUTROUTING("SetShortcutRouting(%s, flags=%04X, owner_id=0x%08X) -> always, no register", ImGui.GetKeyChordName(key_chord), flags, owner_id) return true end -- Specific culling when there's an active item. if g.ActiveId ~= 0 and g.ActiveId ~= owner_id then - if bit32.band(flags, ImGuiInputFlags.RouteActive) ~= 0 then + if bit32.band(flags, 1024 --[[ImGuiInputFlags.RouteActive]]) ~= 0 then return false end @@ -8983,12 +9017,12 @@ function ImGui.SetShortcutRouting(key_chord, flags, owner_id) end -- ActiveIdUsingAllKeyboardKeys trumps all for ActiveId - if bit32.band(flags, ImGuiInputFlags.RouteOverActive) == 0 and g.ActiveIdUsingAllKeyboardKeys then - local key = bit32.band(key_chord, bit32.bnot(ImGuiMod_Mask_)) - if key == ImGuiKey.None then - key = ImGui.ConvertSingleModFlagToKey(bit32.band(key_chord, ImGuiMod_Mask_)) + if bit32.band(flags, 32768 --[[ImGuiInputFlags.RouteOverActive]]) == 0 and g.ActiveIdUsingAllKeyboardKeys then + local key = bit32.band(key_chord, bit32.bnot(61440 --[[ImGuiMod_Mask_]])) + if key == 0 --[[ImGuiKey.None]] then + key = ImGui.ConvertSingleModFlagToKey(bit32.band(key_chord, 61440 --[[ImGuiMod_Mask_]])) end - if key >= ImGuiKey_Keyboard_BEGIN and key < ImGuiKey_Keyboard_END then + if key >= 512 --[[ImGuiKey_Keyboard_BEGIN]] and key < 632 --[[ImGuiKey_Keyboard_END]] then return false end end @@ -8996,7 +9030,7 @@ function ImGui.SetShortcutRouting(key_chord, flags, owner_id) -- Where do we evaluate route for? local focus_scope_id = g.CurrentFocusScopeId - if bit32.band(flags, ImGuiInputFlags.RouteFromRootWindow) ~= 0 then + if bit32.band(flags, 131072 --[[ImGuiInputFlags.RouteFromRootWindow]]) ~= 0 then focus_scope_id = g.CurrentWindow.RootWindow.ID -- See PushFocusScope() call in Begin() end @@ -9046,10 +9080,10 @@ end --- @param button ImGuiMouseButton --- @param owner_id? ImGuiID function ImGui.IsMouseDown(button, owner_id) - if owner_id == nil then owner_id = ImGuiKeyOwner_Any end + if owner_id == nil then owner_id = 0 --[[ImGuiKeyOwner_Any]] end local g = GImGui - IM_ASSERT(button >= 0 and button < 3) -- IM_COUNTOF(g.IO.MouseDown) + assert(button >= 0 and button < 3) -- IM_COUNTOF(g.IO.MouseDown) return g.IO.MouseDown[button] and ImGui.TestKeyOwner(ImGui.MouseButtonToKey(button), owner_id) -- Should be same as IsKeyDown(MouseButtonToKey(button), owner_id), but this allows legacy code hijacking the io.Mousedown[] array. end @@ -9058,7 +9092,7 @@ end function ImGui.IsMouseClicked(button, is_repeat) if is_repeat == nil then is_repeat = false end - return ImGui.IsMouseClickedEx(button, is_repeat and ImGuiInputFlags.Repeat or ImGuiInputFlags.None, ImGuiKeyOwner_Any) + return ImGui.IsMouseClickedEx(button, is_repeat and 1 --[[ImGuiInputFlags.Repeat]] or 0 --[[ImGuiInputFlags.None]], 0 --[[ImGuiKeyOwner_Any]]) end --- @param button ImGuiMouseButton @@ -9066,10 +9100,10 @@ end --- @param owner_id? ImGuiID @native function ImGui.IsMouseClickedEx(button, flags, owner_id) - if owner_id == nil then owner_id = ImGuiKeyOwner_Any end + if owner_id == nil then owner_id = 0 --[[ImGuiKeyOwner_Any]] end local g = GImGui - IM_ASSERT(button >= 0 and button < 3) -- IM_COUNTOF(g.IO.MouseDown) + assert(button >= 0 and button < 3) -- IM_COUNTOF(g.IO.MouseDown) if not g.IO.MouseDown[button] then -- In theory this should already be encoded as (DownDuration < 0.0f), but testing this facilitates eating mechanism (until we finish work on key ownership) return false @@ -9078,9 +9112,9 @@ function ImGui.IsMouseClickedEx(button, flags, owner_id) if t < 0.0 then return false end - IM_ASSERT(bit32.band(flags, bit32.bnot(ImGuiInputFlags.SupportedByIsMouseClicked)) == 0) -- Passing flags not supported by this function! -- FIXME: Could support RepeatRate and RepeatUntil flags here. + assert(bit32.band(flags, bit32.bnot(1 --[[ImGuiInputFlags.SupportedByIsMouseClicked]])) == 0) -- Passing flags not supported by this function! -- FIXME: Could support RepeatRate and RepeatUntil flags here. - local is_repeat = (bit32.band(flags, ImGuiInputFlags.Repeat) ~= 0) + local is_repeat = (bit32.band(flags, 1 --[[ImGuiInputFlags.Repeat]]) ~= 0) local pressed = (t == 0.0) or (is_repeat and t > g.IO.KeyRepeatDelay and ImGui.CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, g.IO.KeyRepeatDelay, g.IO.KeyRepeatRate) > 0) if not pressed then @@ -9097,10 +9131,10 @@ end --- @param button ImGuiMouseButton --- @param owner_id? ImGuiID function ImGui.IsMouseReleased(button, owner_id) - if owner_id == nil then owner_id = ImGuiKeyOwner_Any end + if owner_id == nil then owner_id = 0 --[[ImGuiKeyOwner_Any]] end local g = GImGui - IM_ASSERT(button >= 0 and button < 3) -- IM_COUNTOF(g.IO.MouseDown) + assert(button >= 0 and button < 3) -- IM_COUNTOF(g.IO.MouseDown) return g.IO.MouseReleased[button] and ImGui.TestKeyOwner(ImGui.MouseButtonToKey(button), owner_id) -- Should be same as IsKeyReleased(MouseButtonToKey(button), owner_id) end @@ -9113,7 +9147,7 @@ end function ImGui.IsMouseReleasedWithDelay(button, delay) if delay == nil then delay = -1.0 end local g = GImGui - IM_ASSERT(button >= 0 and button < 3) + assert(button >= 0 and button < 3) if ImGui.IsMouseDown(button) then return false end @@ -9127,16 +9161,16 @@ end --- @param button ImGuiMouseButton --- @param owner_id? ImGuiID function ImGui.IsMouseDoubleClicked(button, owner_id) - if owner_id == nil then owner_id = ImGuiKeyOwner_Any end + if owner_id == nil then owner_id = 0 --[[ImGuiKeyOwner_Any]] end local g = GImGui - IM_ASSERT(button >= 0 and button < 3) + assert(button >= 0 and button < 3) return g.IO.MouseClickedCount[button] == 2 and ImGui.TestKeyOwner(ImGui.MouseButtonToKey(button), owner_id) end --- @param button ImGuiMouseButton function ImGui.GetMouseClickedCount(button) local g = GImGui - IM_ASSERT(button >= 0 and button < 3) + assert(button >= 0 and button < 3) return g.IO.MouseClickedCount[button] end @@ -9144,7 +9178,7 @@ end --- @param mouse_button ImGuiMouseButton local function LastItemOverlayButtonForNullId(mouse_button) local g = GImGui - IM_ASSERT(g.LastItemData.ID == 0) + assert(g.LastItemData.ID == 0) local window = g.CurrentWindow local id = window:GetIDFromRectangle(g.LastItemData.Rect) if g.IO.MouseClicked[mouse_button] and ImGui.ItemHoverable(g.LastItemData.Rect, id, g.LastItemData.ItemFlags) then @@ -9227,7 +9261,7 @@ function ImGui.GetMouseDragDelta(button, lock_threshold) if button == nil then button = 0 end if lock_threshold == nil then lock_threshold = -1.0 end local g = GImGui - IM_ASSERT(button >= 0 and button < 3) + assert(button >= 0 and button < 3) if lock_threshold < 0.0 then lock_threshold = g.IO.MouseDragThreshold end @@ -9245,7 +9279,7 @@ end function ImGui.ResetMouseDragDelta(button) if button == nil then button = 0 end local g = GImGui - IM_ASSERT(button >= 0 and button < 3) + assert(button >= 0 and button < 3) -- NB: We don't need to reset g.IO.MouseDragMaxDistanceSqr ImVec2_Copy(g.IO.MouseClickedPos[button], g.IO.MousePos) end @@ -9282,7 +9316,7 @@ function ImGui.UpdateInputEvents(trickle_fast_inputs) while event_n <= g.InputEventsQueue.Size do repeat local e = g.InputEventsQueue.Data[event_n] - if e.Type == ImGuiInputEventType.MousePos then + if e.Type == 1 --[[ImGuiInputEventType.MousePos]] then if g.IO.WantSetMousePos then break end @@ -9294,21 +9328,21 @@ function ImGui.UpdateInputEvents(trickle_fast_inputs) io.MousePos = event_pos io.MouseSource = e.MousePos.MouseSource mouse_moved = true - elseif e.Type == ImGuiInputEventType.MouseButton then + elseif e.Type == 3 --[[ImGuiInputEventType.MouseButton]] then -- Trickling Rule: Stop processing queued events if we got multiple action on the same button local button = e.MouseButton.Button - IM_ASSERT(button >= 0 and button < ImGuiMouseButton.COUNT) + assert(button >= 0 and button < 5 --[[ImGuiMouseButton.COUNT]]) if trickle_fast_inputs and ((bit32.band(mouse_button_changed, bit32.lshift(1, button)) ~= 0) or mouse_wheeled) then stop_3231 = true; break end - if trickle_fast_inputs and e.MouseButton.MouseSource == ImGuiMouseSource.TouchScreen and mouse_moved then -- #2702: TouchScreen have no initial hover. + if trickle_fast_inputs and e.MouseButton.MouseSource == 1 --[[ImGuiMouseSource.TouchScreen]] and mouse_moved then -- #2702: TouchScreen have no initial hover. stop_3231 = true; break end io.MouseDown[button] = e.MouseButton.Down io.MouseSource = e.MouseButton.MouseSource mouse_button_changed = bit32.bor(mouse_button_changed, bit32.lshift(1, button)) - elseif e.Type == ImGuiInputEventType.MouseWheel then + elseif e.Type == 2 --[[ImGuiInputEventType.MouseWheel]] then -- Trickling Rule: Stop processing queued events if we got multiple action on the event if trickle_fast_inputs and (mouse_moved or mouse_button_changed ~= 0) then stop_3231 = true; break @@ -9318,16 +9352,16 @@ function ImGui.UpdateInputEvents(trickle_fast_inputs) io.MouseWheel = io.MouseWheel + e.MouseWheel.WheelY io.MouseSource = e.MouseWheel.MouseSource mouse_wheeled = true - elseif e.Type == ImGuiInputEventType.MouseViewport then + elseif e.Type == 4 --[[ImGuiInputEventType.MouseViewport]] then io.MouseHoveredViewport = e.MouseViewport.HoveredViewportID - elseif e.Type == ImGuiInputEventType.Key then + elseif e.Type == 5 --[[ImGuiInputEventType.Key]] then -- Trickling Rule: Stop processing queued events if we got multiple action on the same button - if bit32.band(io.ConfigFlags, ImGuiConfigFlags.NoKeyboard) ~= 0 then + if bit32.band(io.ConfigFlags, 64 --[[ImGuiConfigFlags.NoKeyboard]]) ~= 0 then break end local key = e.Key.Key - IM_ASSERT(key ~= ImGuiKey.None) + assert(key ~= 0 --[[ImGuiKey.None]]) -- TODO: Also gets 0-based index here, consider making key_data storage 1-based local key_data, key_data_index = ImGui.GetKeyData(g, key) @@ -9351,8 +9385,8 @@ function ImGui.UpdateInputEvents(trickle_fast_inputs) key_data.Down = e.Key.Down key_data.AnalogValue = e.Key.AnalogValue - elseif e.Type == ImGuiInputEventType.Text then - if bit32.band(io.ConfigFlags, ImGuiConfigFlags.NoKeyboard) ~= 0 then + elseif e.Type == 6 --[[ImGuiInputEventType.Text]] then + if bit32.band(io.ConfigFlags, 64 --[[ImGuiConfigFlags.NoKeyboard]]) ~= 0 then break end -- Trickling Rule: Stop processing queued events if keys/mouse have been interacted with @@ -9363,17 +9397,17 @@ function ImGui.UpdateInputEvents(trickle_fast_inputs) stop_3231 = true; break end local c = e.Text.Char - io.InputQueueCharacters:push_back((c <= IM_UNICODE_CODEPOINT_MAX) and c or IM_UNICODE_CODEPOINT_INVALID) + io.InputQueueCharacters:push_back((c <= 65535 --[[IM_UNICODE_CODEPOINT_MAX]]) and c or 65533 --[[IM_UNICODE_CODEPOINT_INVALID]]) if trickle_interleaved_nonchar_keys_and_text then text_inputted = true end - elseif e.Type == ImGuiInputEventType.Focus then + elseif e.Type == 7 --[[ImGuiInputEventType.Focus]] then -- We intentionally overwrite this and process in NewFrame(), in order to give a chance -- to multi-viewports backends to queue AddFocusEvent(false) + AddFocusEvent(true) in same frame. local focus_lost = not e.AppFocused.Focused io.AppFocusLost = focus_lost else - IM_ASSERT(false, "Unknown event!") + assert(false, "Unknown event!") end until true @@ -9418,8 +9452,8 @@ function ImGui.SetKeyOwner(key, owner_id, flags) if flags == nil then flags = 0 end local g = GImGui --- @cast g ImGuiContext - IM_ASSERT(ImGui.IsNamedKeyOrMod(key) and (owner_id ~= ImGuiKeyOwner_Any or (bit32.band(flags, bit32.bor(ImGuiInputFlags.LockThisFrame, ImGuiInputFlags.LockUntilRelease)) ~= 0)), "Can only use _Any with _LockXXX flags (to eat a key away without an ID to retrieve it)") - IM_ASSERT(bit32.band(flags, bit32.bnot(ImGuiInputFlags.SupportedBySetKeyOwner)) == 0, "Passing flags not supported by this function!") + assert(ImGui.IsNamedKeyOrMod(key) and (owner_id ~= 0 --[[ImGuiKeyOwner_Any]] or (bit32.band(flags, bit32.bor(1048576 --[[ImGuiInputFlags.LockThisFrame]], 2097152 --[[ImGuiInputFlags.LockUntilRelease]])) ~= 0)), "Can only use _Any with _LockXXX flags (to eat a key away without an ID to retrieve it)") + assert(bit32.band(flags, bit32.bnot(3145728 --[[ImGuiInputFlags.SupportedBySetKeyOwner]])) == 0, "Passing flags not supported by this function!") -- IMGUI_DEBUG_LOG("SetKeyOwner(%s, owner_id=0x%08X, flags=%08X)\n", GetKeyName(key), owner_id, flags) local owner_data = ImGui.GetKeyOwnerData(g, key) @@ -9428,8 +9462,8 @@ function ImGui.SetKeyOwner(key, owner_id, flags) -- We cannot lock by default as it would likely break lots of legacy code. -- In the case of using LockUntilRelease while key is not down we still lock during the frame (no key_data.Down test) - owner_data.LockUntilRelease = (bit32.band(flags, ImGuiInputFlags.LockUntilRelease) ~= 0) - owner_data.LockThisFrame = (bit32.band(flags, ImGuiInputFlags.LockThisFrame) ~= 0) or owner_data.LockUntilRelease + owner_data.LockUntilRelease = (bit32.band(flags, 2097152 --[[ImGuiInputFlags.LockUntilRelease]]) ~= 0) + owner_data.LockThisFrame = (bit32.band(flags, 1048576 --[[ImGuiInputFlags.LockThisFrame]]) ~= 0) or owner_data.LockUntilRelease end -- Rarely used helper @@ -9439,20 +9473,20 @@ end function ImGui.SetKeyOwnersForKeyChord(key_chord, owner_id, flags) if flags == nil then flags = 0 end - if bit32.band(key_chord, ImGuiMod_Ctrl) ~= 0 then - ImGui.SetKeyOwner(ImGuiMod_Ctrl, owner_id, flags) + if bit32.band(key_chord, 4096 --[[ImGuiMod_Ctrl]]) ~= 0 then + ImGui.SetKeyOwner(4096 --[[ImGuiMod_Ctrl]], owner_id, flags) end - if bit32.band(key_chord, ImGuiMod_Shift) ~= 0 then - ImGui.SetKeyOwner(ImGuiMod_Shift, owner_id, flags) + if bit32.band(key_chord, 8192 --[[ImGuiMod_Shift]]) ~= 0 then + ImGui.SetKeyOwner(8192 --[[ImGuiMod_Shift]], owner_id, flags) end - if bit32.band(key_chord, ImGuiMod_Alt) ~= 0 then - ImGui.SetKeyOwner(ImGuiMod_Alt, owner_id, flags) + if bit32.band(key_chord, 16384 --[[ImGuiMod_Alt]]) ~= 0 then + ImGui.SetKeyOwner(16384 --[[ImGuiMod_Alt]], owner_id, flags) end - if bit32.band(key_chord, ImGuiMod_Super) ~= 0 then - ImGui.SetKeyOwner(ImGuiMod_Super, owner_id, flags) + if bit32.band(key_chord, 32768 --[[ImGuiMod_Super]]) ~= 0 then + ImGui.SetKeyOwner(32768 --[[ImGuiMod_Super]], owner_id, flags) end - if bit32.band(key_chord, bit32.bnot(ImGuiMod_Mask_)) ~= 0 then - ImGui.SetKeyOwner(bit32.band(key_chord, bit32.bnot(ImGuiMod_Mask_)), owner_id, flags) + if bit32.band(key_chord, bit32.bnot(61440 --[[ImGuiMod_Mask_]])) ~= 0 then + ImGui.SetKeyOwner(bit32.band(key_chord, bit32.bnot(61440 --[[ImGuiMod_Mask_]])), owner_id, flags) end end @@ -9465,22 +9499,22 @@ end --- @param key ImGuiKey --- @param flags? ImGuiInputFlags function ImGui.SetItemKeyOwner(key, flags) - if flags == nil then flags = ImGuiInputFlags.None end + if flags == nil then flags = 0 --[[ImGuiInputFlags.None]] end local g = GImGui local id = g.LastItemData.ID if id == 0 or (g.HoveredId ~= id and g.ActiveId ~= id) then return false end - if bit32.band(flags, ImGuiInputFlags.CondMask_) == 0 then - flags = bit32.bor(flags, ImGuiInputFlags.CondDefault_) + if bit32.band(flags, 12582912 --[[ImGuiInputFlags.CondMask_]]) == 0 then + flags = bit32.bor(flags, 12582912 --[[ImGuiInputFlags.CondDefault_]]) end - if (g.HoveredId == id and bit32.band(flags, ImGuiInputFlags.CondHovered) ~= 0) or (g.ActiveId == id and bit32.band(flags, ImGuiInputFlags.CondActive) ~= 0) then - IM_ASSERT(bit32.band(flags, bit32.bnot(ImGuiInputFlags.SupportedBySetItemKeyOwner)) == 0) -- Passing flags not supported by this function! + if (g.HoveredId == id and bit32.band(flags, 4194304 --[[ImGuiInputFlags.CondHovered]]) ~= 0) or (g.ActiveId == id and bit32.band(flags, 8388608 --[[ImGuiInputFlags.CondActive]]) ~= 0) then + assert(bit32.band(flags, bit32.bnot(15728640 --[[ImGuiInputFlags.SupportedBySetItemKeyOwner]])) == 0) -- Passing flags not supported by this function! if not ImGui.TestKeyOwner(key, id) then return false end - ImGui.SetKeyOwner(key, id, bit32.band(flags, bit32.bnot(ImGuiInputFlags.CondMask_))) + ImGui.SetKeyOwner(key, id, bit32.band(flags, bit32.bnot(12582912 --[[ImGuiInputFlags.CondMask_]]))) return true end return false @@ -9493,17 +9527,17 @@ end function ImGui.IsKeyChordPressed(key_chord, flags, owner_id) local g = GImGui key_chord = ImGui.FixupKeyChord(key_chord) - local mods = bit32.band(key_chord, ImGuiMod_Mask_) + local mods = bit32.band(key_chord, 61440 --[[ImGuiMod_Mask_]]) if g.IO.KeyMods ~= mods then return false end -- Special storage location for mods - local key = bit32.band(key_chord, bit32.bnot(ImGuiMod_Mask_)) - if key == ImGuiKey.None then + local key = bit32.band(key_chord, bit32.bnot(61440 --[[ImGuiMod_Mask_]])) + if key == 0 --[[ImGuiKey.None]] then key = ImGui.ConvertSingleModFlagToKey(mods) end - if not ImGui.IsKeyPressedEx(key, bit32.band(flags, ImGuiInputFlags.RepeatMask_), owner_id) then + if not ImGui.IsKeyPressedEx(key, bit32.band(flags, 255 --[[ImGuiInputFlags.RepeatMask_]]), owner_id) then return false end return true @@ -9515,7 +9549,7 @@ function ImGui.SetNextItemShortcut(key_chord, flags) if flags == nil then flags = 0 end local g = GImGui - g.NextItemData.HasFlags = bit32.bor(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasShortcut) + g.NextItemData.HasFlags = bit32.bor(g.NextItemData.HasFlags, 4 --[[ImGuiNextItemDataFlags.HasShortcut]]) g.NextItemData.Shortcut = key_chord g.NextItemData.ShortcutFlags = flags end @@ -9528,17 +9562,17 @@ function ImGui.Shortcut(key_chord, flags, owner_id) -- IMGUI_DEBUG_LOG("Shortcut(%s, flags=%X, owner_id=0x%08X)\n", ImGui.GetKeyChordName(key_chord, g.TempBuffer.Data, g.TempBuffer.Size), flags, owner_id) -- When using (owner_id == 0/Any): SetShortcutRouting() will use CurrentFocusScopeId and filter with this, so IsKeyPressed() is fine with he 0/Any. - if bit32.band(flags, ImGuiInputFlags.RouteTypeMask_) == 0 then - flags = bit32.bor(flags, ImGuiInputFlags.RouteFocused) + if bit32.band(flags, 15360 --[[ImGuiInputFlags.RouteTypeMask_]]) == 0 then + flags = bit32.bor(flags, 2048 --[[ImGuiInputFlags.RouteFocused]]) end -- Using 'owner_id == ImGuiKeyOwner_Any/0': auto-assign an owner based on current focus scope (each window has its focus scope by default) -- Effectively makes Shortcut() always input-owner aware. - if owner_id == ImGuiKeyOwner_Any or owner_id == ImGuiKeyOwner_NoOwner then + if owner_id == 0 --[[ImGuiKeyOwner_Any]] or owner_id == 4294967295 --[[ImGuiKeyOwner_NoOwner]] then owner_id = GetRoutingIdFromOwnerId(owner_id) end - if bit32.band(g.CurrentItemFlags, ImGuiItemFlags.Disabled) ~= 0 then + if bit32.band(g.CurrentItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) ~= 0 then return false end @@ -9549,8 +9583,8 @@ function ImGui.Shortcut(key_chord, flags, owner_id) -- Default repeat behavior for Shortcut() -- So e.g. pressing Ctrl+W and releasing Ctrl while holding W will not trigger the W shortcut. - if bit32.band(flags, ImGuiInputFlags.Repeat) ~= 0 and bit32.band(flags, ImGuiInputFlags.RepeatUntilMask_) == 0 then - flags = bit32.bor(flags, ImGuiInputFlags.RepeatUntilKeyModsChange) + if bit32.band(flags, 1 --[[ImGuiInputFlags.Repeat]]) ~= 0 and bit32.band(flags, 240 --[[ImGuiInputFlags.RepeatUntilMask_]]) == 0 then + flags = bit32.bor(flags, 32 --[[ImGuiInputFlags.RepeatUntilKeyModsChange]]) end if not ImGui.IsKeyChordPressed(key_chord, flags, owner_id) then @@ -9558,9 +9592,9 @@ function ImGui.Shortcut(key_chord, flags, owner_id) end -- Claim mods during the press - ImGui.SetKeyOwnersForKeyChord(bit32.band(key_chord, ImGuiMod_Mask_), owner_id) + ImGui.SetKeyOwnersForKeyChord(bit32.band(key_chord, 61440 --[[ImGuiMod_Mask_]]), owner_id) - IM_ASSERT(bit32.band(flags, bit32.bnot(ImGuiInputFlags.SupportedByShortcut)) == 0) -- Passing flags not supported by this function! + assert(bit32.band(flags, bit32.bnot(261375 --[[ImGuiInputFlags.SupportedByShortcut]])) == 0) -- Passing flags not supported by this function! return true end @@ -9580,29 +9614,29 @@ local function CalcWindowMinSize(window) local size_min = ImVec2() - if (bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0) and (bit32.band(window.Flags, ImGuiWindowFlags.Popup) == 0) then - if bit32.band(window.ChildFlags, ImGuiChildFlags.ResizeX) ~= 0 then + if (bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0) and (bit32.band(window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) == 0) then + if bit32.band(window.ChildFlags, 4 --[[ImGuiChildFlags.ResizeX]]) ~= 0 then size_min.x = g.Style.WindowMinSize.x else - size_min.x = IMGUI_WINDOW_HARD_MIN_SIZE + size_min.x = 4 --[[IMGUI_WINDOW_HARD_MIN_SIZE]] end - if bit32.band(window.ChildFlags, ImGuiChildFlags.ResizeY) ~= 0 then + if bit32.band(window.ChildFlags, 8 --[[ImGuiChildFlags.ResizeY]]) ~= 0 then size_min.y = g.Style.WindowMinSize.y else - size_min.y = IMGUI_WINDOW_HARD_MIN_SIZE + size_min.y = 4 --[[IMGUI_WINDOW_HARD_MIN_SIZE]] end else - if bit32.band(window.Flags, ImGuiWindowFlags.AlwaysAutoResize) == 0 then + if bit32.band(window.Flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) == 0 then size_min.x = g.Style.WindowMinSize.x else - size_min.x = IMGUI_WINDOW_HARD_MIN_SIZE + size_min.x = 4 --[[IMGUI_WINDOW_HARD_MIN_SIZE]] end - if bit32.band(window.Flags, ImGuiWindowFlags.AlwaysAutoResize) == 0 then + if bit32.band(window.Flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) == 0 then size_min.y = g.Style.WindowMinSize.y else - size_min.y = IMGUI_WINDOW_HARD_MIN_SIZE + size_min.y = 4 --[[IMGUI_WINDOW_HARD_MIN_SIZE]] end end @@ -9623,7 +9657,7 @@ local function CalcWindowSizeAfterConstraint(window, size_desired) local new_size = ImVec2() ImVec2_Copy(new_size, size_desired) - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasSizeConstraint) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 16 --[[ImGuiNextWindowDataFlags.HasSizeConstraint]]) ~= 0 then -- See comments in SetNextWindowSizeConstraints() for details about setting size_min an size_max. local cr = ImRect() ImRect_Copy(cr, g.NextWindowData.SizeConstraintRect) @@ -9689,8 +9723,8 @@ local function CalcWindowAutoFitSize(window, size_contents, axis_mask) -- Determine maximum window size -- Child windows are laid within their parent (unless they are also popups/menus) and thus have no restriction - local size_max = ImVec2(FLT_MAX, FLT_MAX) - if bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) == 0 or bit32.band(window.Flags, ImGuiWindowFlags.Popup) ~= 0 then + local size_max = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]) + if bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0 or bit32.band(window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 then if not window.ViewportOwned then size_max = ImGui.GetMainViewport().WorkSize - style.DisplaySafeAreaPadding * 2.0 end @@ -9700,7 +9734,7 @@ local function CalcWindowAutoFitSize(window, size_contents, axis_mask) end end - if bit32.band(window.Flags, ImGuiWindowFlags.Tooltip) ~= 0 then + if bit32.band(window.Flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0 then -- Tooltip always resize (up to maximum size) return ImMin(size_desired, size_max) else @@ -9712,8 +9746,8 @@ local function CalcWindowAutoFitSize(window, size_contents, axis_mask) local size_auto_fit_after_constraint = CalcWindowSizeAfterConstraint(window, size_auto_fit) local size_contents_for_scrollbar_x = (bit32.band(axis_mask, 1) ~= 0) and size_contents.x or window.ContentSize.x -- See #9352. In theory this should use same logic as `window.ScrollbarY = ...` codepath in Begin(). Needs some plumbling. local size_contents_for_scrollbar_y = (bit32.band(axis_mask, 2) ~= 0) and size_contents.y or window.ContentSize.y - local will_have_scrollbar_x = (size_auto_fit_after_constraint.x < size_contents_for_scrollbar_x + size_pad.x + decoration_w_without_scrollbars and bit32.band(window.Flags, ImGuiWindowFlags.NoScrollbar) == 0 and bit32.band(window.Flags, ImGuiWindowFlags.HorizontalScrollbar) ~= 0) or bit32.band(window.Flags, ImGuiWindowFlags.AlwaysHorizontalScrollbar) ~= 0 - local will_have_scrollbar_y = (size_auto_fit_after_constraint.y < size_contents_for_scrollbar_y + size_pad.y + decoration_h_without_scrollbars and bit32.band(window.Flags, ImGuiWindowFlags.NoScrollbar) == 0) or bit32.band(window.Flags, ImGuiWindowFlags.AlwaysVerticalScrollbar) ~= 0 + local will_have_scrollbar_x = (size_auto_fit_after_constraint.x < size_contents_for_scrollbar_x + size_pad.x + decoration_w_without_scrollbars and bit32.band(window.Flags, 8 --[[ImGuiWindowFlags.NoScrollbar]]) == 0 and bit32.band(window.Flags, 2048 --[[ImGuiWindowFlags.HorizontalScrollbar]]) ~= 0) or bit32.band(window.Flags, 32768 --[[ImGuiWindowFlags.AlwaysHorizontalScrollbar]]) ~= 0 + local will_have_scrollbar_y = (size_auto_fit_after_constraint.y < size_contents_for_scrollbar_y + size_pad.y + decoration_h_without_scrollbars and bit32.band(window.Flags, 8 --[[ImGuiWindowFlags.NoScrollbar]]) == 0) or bit32.band(window.Flags, 16384 --[[ImGuiWindowFlags.AlwaysVerticalScrollbar]]) ~= 0 if will_have_scrollbar_x then size_auto_fit.y = size_auto_fit.y + style.ScrollbarSize end @@ -9738,12 +9772,12 @@ end --- @param window ImGuiWindow --- @return ImGuiCol local function GetWindowBgColorIdx(window) - if bit32.band(window.Flags, bit32.bor(ImGuiWindowFlags.Tooltip, ImGuiWindowFlags.Popup)) ~= 0 then - return ImGuiCol.PopupBg - elseif bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 and not window.DockIsActive then - return ImGuiCol.ChildBg + if bit32.band(window.Flags, bit32.bor(33554432 --[[ImGuiWindowFlags.Tooltip]], 67108864 --[[ImGuiWindowFlags.Popup]])) ~= 0 then + return 4 --[[ImGuiCol.PopupBg]] + elseif bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 and not window.DockIsActive then + return 3 --[[ImGuiCol.ChildBg]] else - return ImGuiCol.WindowBg + return 2 --[[ImGuiCol.WindowBg]] end end @@ -9756,7 +9790,7 @@ local function CalcResizePosSizeFromAnyCorner(window, corner_target_arg, corner_ local corner_target = ImVec2() ImVec2_Copy(corner_target, corner_target_arg) - if bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 then -- Clamp resizing of childs within parent + if bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 then -- Clamp resizing of childs within parent local parent_window = window.ParentWindow local parent_flags = parent_window.Flags @@ -9764,10 +9798,10 @@ local function CalcResizePosSizeFromAnyCorner(window, corner_target_arg, corner_ ImRect_Copy(limit_rect, parent_window.InnerRect) limit_rect:Expand(ImVec2(-ImMax(parent_window.WindowPadding.x, parent_window.WindowBorderSize), -ImMax(parent_window.WindowPadding.y, parent_window.WindowBorderSize))) - if (bit32.band(parent_flags, bit32.bor(ImGuiWindowFlags.HorizontalScrollbar, ImGuiWindowFlags.AlwaysHorizontalScrollbar)) == 0) or (bit32.band(parent_flags, ImGuiWindowFlags.NoScrollbar) ~= 0) then + if (bit32.band(parent_flags, bit32.bor(2048 --[[ImGuiWindowFlags.HorizontalScrollbar]], 32768 --[[ImGuiWindowFlags.AlwaysHorizontalScrollbar]])) == 0) or (bit32.band(parent_flags, 8 --[[ImGuiWindowFlags.NoScrollbar]]) ~= 0) then corner_target.x = ImClamp(corner_target.x, limit_rect.Min.x, limit_rect.Max.x) end - if bit32.band(parent_flags, ImGuiWindowFlags.NoScrollbar) ~= 0 then + if bit32.band(parent_flags, 8 --[[ImGuiWindowFlags.NoScrollbar]]) ~= 0 then corner_target.y = ImClamp(corner_target.y, limit_rect.Min.y, limit_rect.Max.y) end end @@ -9799,10 +9833,10 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c local g = GImGui local flags = window.Flags - if (bit32.band(flags, ImGuiWindowFlags.NoResize) ~= 0 or window.AutoFitFramesX > 0 or window.AutoFitFramesY > 0) then + if (bit32.band(flags, 2 --[[ImGuiWindowFlags.NoResize]]) ~= 0 or window.AutoFitFramesX > 0 or window.AutoFitFramesY > 0) then return 0, -1, -1 end - if (bit32.band(flags, ImGuiWindowFlags.AlwaysAutoResize) ~= 0 and bit32.band(window.ChildFlags, bit32.bor(ImGuiChildFlags.ResizeX, ImGuiChildFlags.ResizeY)) == 0) then + if (bit32.band(flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) ~= 0 and bit32.band(window.ChildFlags, bit32.bor(4 --[[ImGuiChildFlags.ResizeX]], 8 --[[ImGuiChildFlags.ResizeY]])) == 0) then return 0, -1, -1 end if window.WasActive == false then -- Early out to avoid running this code for e.g. a hidden implicit/fallback Debug window. @@ -9819,8 +9853,8 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c ImGui.PushID("#RESIZE") - local pos_target = ImVec2(FLT_MAX, FLT_MAX) - local size_target = ImVec2(FLT_MAX, FLT_MAX) + local pos_target = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]) + local size_target = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]) -- Clip mouse interaction rectangles within the viewport rectangle (in practice the narrowing is going to happen most of the time). -- - Not narrowing would mostly benefit the situation where OS windows _without_ decoration have a threshold for hovering when outside their limits. @@ -9828,7 +9862,7 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c -- - When decoration are enabled we typically benefit from that distance, but then our resize elements would be conflicting with OS resize elements, so we also narrow. -- - Note that we are unable to tell if the platform setup allows hovering with a distance threshold (on Win32, decorated window have such threshold). -- We only clip interaction so we overwrite window.ClipRect, cannot call PushClipRect() yet as DrawList is not yet setup. - local clip_with_viewport_rect = bit32.band(g.IO.BackendFlags, ImGuiBackendFlags.HasMouseHoveredViewport) == 0 or g.IO.MouseHoveredViewport ~= window.ViewportId or bit32.band(window.Viewport.Flags, ImGuiViewportFlags.NoDecoration) == 0 + local clip_with_viewport_rect = bit32.band(g.IO.BackendFlags, 4096 --[[ImGuiBackendFlags.HasMouseHoveredViewport]]) == 0 or g.IO.MouseHoveredViewport ~= window.ViewportId or bit32.band(window.Viewport.Flags, 8 --[[ImGuiViewportFlags.NoDecoration]]) == 0 if (clip_with_viewport_rect) then ImRect_Copy(window.ClipRect, window.Viewport:GetMainRect()) end @@ -9836,7 +9870,7 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c local clamp_rect = ImRect() ImRect_Copy(clamp_rect, visibility_rect) - local window_move_from_title_bar = (bit32.band(window.BgClickFlags, ImGuiWindowBgClickFlags.Move) == 0) and (bit32.band(window.Flags, ImGuiWindowFlags.NoTitleBar) == 0) + local window_move_from_title_bar = (bit32.band(window.BgClickFlags, 1 --[[ImGuiWindowBgClickFlags.Move]]) == 0) and (bit32.band(window.Flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) == 0) if window_move_from_title_bar then clamp_rect.Min.y = clamp_rect.Min.y - window.TitleBarHeight end @@ -9856,12 +9890,12 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c local resize_grip_id = window:GetID(resize_grip_n) -- == GetWindowResizeCornerID() - ImGui.ItemAdd(resize_rect, resize_grip_id, nil, ImGuiItemFlags.NoNav) - local _, hovered, held = ImGui.ButtonBehavior(resize_rect, resize_grip_id, bit32.bor(ImGuiButtonFlags.FlattenChildren, ImGuiButtonFlags.NoNavFocus)) + ImGui.ItemAdd(resize_rect, resize_grip_id, nil, 2 --[[ImGuiItemFlags.NoNav]]) + local _, hovered, held = ImGui.ButtonBehavior(resize_rect, resize_grip_id, bit32.bor(2048 --[[ImGuiButtonFlags.FlattenChildren]], 262144 --[[ImGuiButtonFlags.NoNavFocus]])) -- GetForegroundDrawList(window):AddRect(resize_rect.Min, resize_rect.Max, IM_COL32(255, 255, 0, 255)) if hovered or held then - ImGui.SetMouseCursor((bit32.band(resize_grip_n, 1) ~= 0) and ImGuiMouseCursor.ResizeNESW or ImGuiMouseCursor.ResizeNWSE) + ImGui.SetMouseCursor((bit32.band(resize_grip_n, 1) ~= 0) and 5 --[[ImGuiMouseCursor.ResizeNESW]] or 6 --[[ImGuiMouseCursor.ResizeNWSE]]) end if held and g.IO.MouseDoubleClicked[0] then @@ -9873,8 +9907,8 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c elseif held then -- Resize from any of the four corners -- We don't use an incremental MouseDelta but rather compute an absolute target size based on mouse position - local clamp_min = ImVec2((corner_pos.x == 1.0) and clamp_rect.Min.x or -FLT_MAX, (corner_pos.y == 1.0) and clamp_rect.Min.y or -FLT_MAX) - local clamp_max = ImVec2((corner_pos.x == 0.0) and clamp_rect.Max.x or FLT_MAX, (corner_pos.y == 0.0) and clamp_rect.Max.y or FLT_MAX) + local clamp_min = ImVec2((corner_pos.x == 1.0) and clamp_rect.Min.x or -3.4028234663853e+38 --[[FLT_MAX]], (corner_pos.y == 1.0) and clamp_rect.Min.y or -3.4028234663853e+38 --[[FLT_MAX]]) + local clamp_max = ImVec2((corner_pos.x == 0.0) and clamp_rect.Max.x or 3.4028234663853e+38 --[[FLT_MAX]], (corner_pos.y == 0.0) and clamp_rect.Max.y or 3.4028234663853e+38 --[[FLT_MAX]]) local corner_target = g.IO.MousePos - g.ActiveIdClickOffset + ImLerp(def.InnerDir * grip_hover_outer_size, def.InnerDir * -grip_hover_inner_size, def.CornerPosN) -- Corner of the window corresponding to our corner grip corner_target = ImClamp(corner_target, clamp_min, clamp_max) @@ -9883,16 +9917,16 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c end -- Only lower-left grip is visible before hovering/activating - local resize_grip_visible = held or hovered or (resize_grip_n == 0 and bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) == 0) + local resize_grip_visible = held or hovered or (resize_grip_n == 0 and bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0) if resize_grip_visible then local color if held then - color = ImGui.GetColorU32(ImGuiCol.ResizeGripActive) + color = ImGui.GetColorU32(33 --[[ImGuiCol.ResizeGripActive]]) else if hovered then - color = ImGui.GetColorU32(ImGuiCol.ResizeGripHovered) + color = ImGui.GetColorU32(32 --[[ImGuiCol.ResizeGripHovered]]) else - color = ImGui.GetColorU32(ImGuiCol.ResizeGrip) + color = ImGui.GetColorU32(31 --[[ImGuiCol.ResizeGrip]]) end end resize_grip_col[resize_grip_n + 1] = color @@ -9900,9 +9934,9 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c end local resize_border_mask = 0x00 - if bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 then - local mask_x = (bit32.band(window.ChildFlags, ImGuiChildFlags.ResizeX) ~= 0) and 0x02 or 0 - local mask_y = (bit32.band(window.ChildFlags, ImGuiChildFlags.ResizeY) ~= 0) and 0x08 or 0 + if bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 then + local mask_x = (bit32.band(window.ChildFlags, 4 --[[ImGuiChildFlags.ResizeX]]) ~= 0) and 0x02 or 0 + local mask_y = (bit32.band(window.ChildFlags, 8 --[[ImGuiChildFlags.ResizeY]]) ~= 0) and 0x08 or 0 resize_border_mask = bit32.bor(mask_x, mask_y) else resize_border_mask = g.IO.ConfigWindowsResizeFromEdges and 0x0F or 0x00 @@ -9916,23 +9950,23 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c local def = ImGuiResizeBorderDef[border_n + 1] local axis - if border_n == ImGuiDir.Left or border_n == ImGuiDir.Right then - axis = ImGuiAxis.X + if border_n == 0 --[[ImGuiDir.Left]] or border_n == 1 --[[ImGuiDir.Right]] then + axis = 1 --[[ImGuiAxis.X]] else - axis = ImGuiAxis.Y + axis = 2 --[[ImGuiAxis.Y]] end local border_rect = GetResizeBorderRect(window, border_n, grip_hover_inner_size, g.WindowsBorderHoverPadding) local border_id = window:GetID(border_n + 4) -- == GetWindowResizeBorderID() - ImGui.ItemAdd(border_rect, border_id, nil, ImGuiItemFlags.NoNav) - local _, hovered, held = ImGui.ButtonBehavior(border_rect, border_id, bit32.bor(ImGuiButtonFlags.FlattenChildren, ImGuiButtonFlags.NoNavFocus)) + ImGui.ItemAdd(border_rect, border_id, nil, 2 --[[ImGuiItemFlags.NoNav]]) + local _, hovered, held = ImGui.ButtonBehavior(border_rect, border_id, bit32.bor(2048 --[[ImGuiButtonFlags.FlattenChildren]], 262144 --[[ImGuiButtonFlags.NoNavFocus]])) -- GetForegroundDrawList(window):AddRect(border_rect.Min, border_rect.Max, IM_COL32(255, 255, 0, 255)) if hovered and g.HoveredIdTimer <= WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER then hovered = false end if hovered or held then - ImGui.SetMouseCursor((axis == ImGuiAxis.X) and ImGuiMouseCursor.ResizeEW or ImGuiMouseCursor.ResizeNS) + ImGui.SetMouseCursor((axis == 1 --[[ImGuiAxis.X]]) and 4 --[[ImGuiMouseCursor.ResizeEW]] or 3 --[[ImGuiMouseCursor.ResizeNS]]) end if held and g.IO.MouseDoubleClicked[0] then -- Double-clicking bottom or right border auto-fit on this axis @@ -9955,7 +9989,7 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c g.WindowResizeRelativeMode = false end - if (bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0) and g.WindowResizeBorderExpectedRect ~= border_rect then + if (bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0) and g.WindowResizeBorderExpectedRect ~= border_rect then g.WindowResizeRelativeMode = true end @@ -9981,8 +10015,8 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c end -- Clamp, apply - local clamp_min = ImVec2((border_n == ImGuiDir.Right) and clamp_rect.Min.x or -FLT_MAX, (border_n == ImGuiDir.Down or (border_n == ImGuiDir.Up and window_move_from_title_bar)) and clamp_rect.Min.y or -FLT_MAX) - local clamp_max = ImVec2((border_n == ImGuiDir.Left) and clamp_rect.Max.x or FLT_MAX, (border_n == ImGuiDir.Up) and clamp_rect.Max.y or FLT_MAX) + local clamp_min = ImVec2((border_n == 1 --[[ImGuiDir.Right]]) and clamp_rect.Min.x or -3.4028234663853e+38 --[[FLT_MAX]], (border_n == 3 --[[ImGuiDir.Down]] or (border_n == 2 --[[ImGuiDir.Up]] and window_move_from_title_bar)) and clamp_rect.Min.y or -3.4028234663853e+38 --[[FLT_MAX]]) + local clamp_max = ImVec2((border_n == 0 --[[ImGuiDir.Left]]) and clamp_rect.Max.x or 3.4028234663853e+38 --[[FLT_MAX]], (border_n == 2 --[[ImGuiDir.Up]]) and clamp_rect.Max.y or 3.4028234663853e+38 --[[FLT_MAX]]) border_target = ImClamp(border_target, clamp_min, clamp_max) if not ignore_resize then @@ -10001,24 +10035,24 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c ImGui.PopID() -- Restore nav layer - window.DC.NavLayerCurrent = ImGuiNavLayer.Main + window.DC.NavLayerCurrent = 0 --[[ImGuiNavLayer.Main]] -- Apply back modified position/size to window - if size_target.x ~= FLT_MAX and (window.Size.x ~= size_target.x or window.SizeFull.x ~= size_target.x) then + if size_target.x ~= 3.4028234663853e+38 --[[FLT_MAX]] and (window.Size.x ~= size_target.x or window.SizeFull.x ~= size_target.x) then window.Size.x = size_target.x window.SizeFull.x = size_target.x end - if size_target.y ~= FLT_MAX and (window.Size.y ~= size_target.y or window.SizeFull.y ~= size_target.y) then + if size_target.y ~= 3.4028234663853e+38 --[[FLT_MAX]] and (window.Size.y ~= size_target.y or window.SizeFull.y ~= size_target.y) then window.Size.y = size_target.y window.SizeFull.y = size_target.y end - if pos_target.x ~= FLT_MAX and window.Pos.x ~= ImFloor(pos_target.x) then + if pos_target.x ~= 3.4028234663853e+38 --[[FLT_MAX]] and window.Pos.x ~= ImFloor(pos_target.x) then window.Pos.x = ImFloor(pos_target.x) end - if pos_target.y ~= FLT_MAX and window.Pos.y ~= ImFloor(pos_target.y) then + if pos_target.y ~= 3.4028234663853e+38 --[[FLT_MAX]] and window.Pos.y ~= ImFloor(pos_target.y) then window.Pos.y = ImFloor(pos_target.y) end @@ -10105,7 +10139,7 @@ function ImGui.RenderText(pos, text, text_begin, text_end, hide_text_after_hash) end if text ~= "" and text_display_end > 1 then - window.DrawList:AddText(g.Font, g.FontSize, pos, ImGui.GetColorU32(ImGuiCol.Text), text, text_begin, text_display_end, 0.0) + window.DrawList:AddText(g.Font, g.FontSize, pos, ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), text, text_begin, text_display_end, 0.0) if g.LogEnabled then -- ImGui.LogRenderedText(&pos, text, text_display_end); end @@ -10125,7 +10159,7 @@ function ImGui.RenderTextWrapped(pos, text, text_end, wrap_width) end if text ~= "" then - window.DrawList:AddText(g.Font, g.FontSize, pos, ImGui.GetColorU32(ImGuiCol.Text), text, 1, text_end, wrap_width) + window.DrawList:AddText(g.Font, g.FontSize, pos, ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), text, 1, text_end, wrap_width) end end @@ -10173,9 +10207,9 @@ function ImGui.RenderTextClippedEx(draw_list, pos_min, pos_max, text, text_begin if (need_clipping) then local fine_clip_rect = RenderTextClippedEx_fine_clip fine_clip_rect.x = clip_min.x; fine_clip_rect.y = clip_min.y; fine_clip_rect.z = clip_max.x; fine_clip_rect.w = clip_max.y - draw_list:AddText(nil, 0.0, pos, ImGui.GetColorU32(ImGuiCol.Text), text, text_begin, text_display_end, 0.0, fine_clip_rect) + draw_list:AddText(nil, 0.0, pos, ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), text, text_begin, text_display_end, 0.0, fine_clip_rect) else - draw_list:AddText(nil, 0.0, pos, ImGui.GetColorU32(ImGuiCol.Text), text, text_begin, text_display_end, 0.0, nil) + draw_list:AddText(nil, 0.0, pos, ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), text, text_begin, text_display_end, 0.0, nil) end end @@ -10210,17 +10244,17 @@ end --- @param rounding? float @native function ImGui.RenderNavCursor(bb, id, flags, rounding) - if flags == nil then flags = ImGuiNavRenderCursorFlags.None end + if flags == nil then flags = 0 --[[ImGuiNavRenderCursorFlags.None]] end if rounding == nil then rounding = -1.0 end local g = GImGui if id ~= g.NavId then return end - if not g.NavCursorVisible and bit32.band(flags, ImGuiNavRenderCursorFlags.AlwaysDraw) == 0 then + if not g.NavCursorVisible and bit32.band(flags, 4 --[[ImGuiNavRenderCursorFlags.AlwaysDraw]]) == 0 then return end - if id == g.LastItemData.ID and bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.NoNav) ~= 0 then + if id == g.LastItemData.ID and bit32.band(g.LastItemData.ItemFlags, 2 --[[ImGuiItemFlags.NoNav]]) ~= 0 then return end @@ -10240,8 +10274,8 @@ function ImGui.RenderNavCursor(bb, id, flags, rounding) display_rect:ClipWith(window.ClipRect) local scale_factor = ImGui.GetScale() -- FIXME-DPI local thickness = ImTrunc(ImMax(2.0, 1.5 * scale_factor)) - if bit32.band(flags, ImGuiNavRenderCursorFlags.Compact) ~= 0 then - window.DrawList:AddRect(display_rect.Min, display_rect.Max, ImGui.GetColorU32(ImGuiCol.NavCursor), rounding, thickness) + if bit32.band(flags, 2 --[[ImGuiNavRenderCursorFlags.Compact]]) ~= 0 then + window.DrawList:AddRect(display_rect.Min, display_rect.Max, ImGui.GetColorU32(59 --[[ImGuiCol.NavCursor]]), rounding, thickness) else local distance = ImTrunc(3.0 + thickness * 0.5) display_rect:Expand(ImVec2(distance, distance)) @@ -10249,7 +10283,7 @@ function ImGui.RenderNavCursor(bb, id, flags, rounding) if not fully_visible then window.DrawList:PushClipRect(display_rect.Min, display_rect.Max) end - window.DrawList:AddRect(display_rect.Min, display_rect.Max, ImGui.GetColorU32(ImGuiCol.NavCursor), rounding, thickness) + window.DrawList:AddRect(display_rect.Min, display_rect.Max, ImGui.GetColorU32(59 --[[ImGuiCol.NavCursor]]), rounding, thickness) if not fully_visible then window.DrawList:PopClipRect() end @@ -10271,8 +10305,8 @@ local uv_fill = {ImVec2(), ImVec2()} --- @param col_shadow ImU32 function ImGui.RenderMouseCursor(base_pos, base_scale, mouse_cursor, col_fill, col_border, col_shadow) local g = GImGui - if mouse_cursor <= ImGuiMouseCursor.None or mouse_cursor >= ImGuiMouseCursor.COUNT then -- We intentionally accept out of bound values. - mouse_cursor = ImGuiMouseCursor.Arrow + if mouse_cursor <= (-1) --[[ImGuiMouseCursor.None]] or mouse_cursor >= 11 --[[ImGuiMouseCursor.COUNT]] then -- We intentionally accept out of bound values. + mouse_cursor = 0 --[[ImGuiMouseCursor.Arrow]] end local font_atlas = g.DrawListSharedData.FontAtlas @@ -10296,9 +10330,9 @@ function ImGui.RenderMouseCursor(base_pos, base_scale, mouse_cursor, col_fill, c draw_list:AddImage(tex_ref, pos + ImVec2(2, 0) * scale, pos + (ImVec2(2, 0) + size) * scale, uv_fill[1], uv_fill[2], col_shadow) draw_list:AddImage(tex_ref, pos, pos + size * scale, uv_fill[1], uv_fill[2], col_border) draw_list:AddImage(tex_ref, pos, pos + size * scale, uv_border[1], uv_border[2], col_fill) - if mouse_cursor == ImGuiMouseCursor.Wait or mouse_cursor == ImGuiMouseCursor.Progress then - local a_min = ImFmod(g.Time * 5.0, 2.0 * IM_PI) - local a_max = a_min + IM_PI * 1.65 + if mouse_cursor == 8 --[[ImGuiMouseCursor.Wait]] or mouse_cursor == 9 --[[ImGuiMouseCursor.Progress]] then + local a_min = ImFmod(g.Time * 5.0, 2.0 * 3.141592653589793 --[[IM_PI]]) + local a_max = a_min + 3.141592653589793 --[[IM_PI]] * 1.65 draw_list:PathArcTo(pos + ImVec2(14, -1) * scale, 6.0 * scale, a_min, a_max) draw_list:PathStroke(col_fill, 3.0 * scale) end @@ -10363,7 +10397,7 @@ function ImGui.RenderTextEllipsis(draw_list, pos_min, pos_max, ellipsis_max_x, t ImGui.RenderTextClippedEx(draw_list, pos_min, pos_max, text, 1, text_end_ellipsis, text_size, ImVec2(0.0, 0.0)) local cpu_fine_clip_rect = ImVec4(pos_min.x, pos_min.y, pos_max.x, pos_max.y) local ellipsis_pos = ImTrunc(ImVec2(pos_min.x + text_size_clipped_x, pos_min.y)) - font:RenderChar(draw_list, font_size, ellipsis_pos, ImGui.GetColorU32(ImGuiCol.Text), font.EllipsisChar, cpu_fine_clip_rect) + font:RenderChar(draw_list, font_size, ellipsis_pos, ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), font.EllipsisChar, cpu_fine_clip_rect) else ImGui.RenderTextClippedEx(draw_list, pos_min, pos_max, text, 1, text_end_full, text_size, ImVec2(0.0, 0.0)) end @@ -10391,8 +10425,8 @@ function ImGui.RenderFrame(p_min, p_max, fill_col, borders, rounding) local border_size = g.Style.FrameBorderSize if borders and border_size > 0 then - window.DrawList:AddRect(p_min + ImVec2(1, 1), p_max + ImVec2(1, 1), ImGui.GetColorU32(ImGuiCol.BorderShadow), rounding, border_size, 0) - window.DrawList:AddRect(p_min, p_max, ImGui.GetColorU32(ImGuiCol.Border), rounding, border_size, 0) + window.DrawList:AddRect(p_min + ImVec2(1, 1), p_max + ImVec2(1, 1), ImGui.GetColorU32(6 --[[ImGuiCol.BorderShadow]]), rounding, border_size, 0) + window.DrawList:AddRect(p_min, p_max, ImGui.GetColorU32(5 --[[ImGuiCol.Border]]), rounding, border_size, 0) end end @@ -10405,8 +10439,8 @@ function ImGui.RenderFrameBorder(p_min, p_max, rounding) local window = g.CurrentWindow local border_size = g.Style.FrameBorderSize if border_size > 0.0 then - window.DrawList:AddRect(p_min + ImVec2(1, 1), p_max + ImVec2(1, 1), ImGui.GetColorU32(ImGuiCol.BorderShadow), rounding, border_size, 0) - window.DrawList:AddRect(p_min, p_max, ImGui.GetColorU32(ImGuiCol.Border), rounding, border_size, 0) + window.DrawList:AddRect(p_min + ImVec2(1, 1), p_max + ImVec2(1, 1), ImGui.GetColorU32(6 --[[ImGuiCol.BorderShadow]]), rounding, border_size, 0) + window.DrawList:AddRect(p_min, p_max, ImGui.GetColorU32(5 --[[ImGuiCol.Border]]), rounding, border_size, 0) end end @@ -10430,33 +10464,33 @@ local function RenderWindowOuterSingleBorder(window, border_n, border_col, borde local def = ImGuiResizeBorderDef[border_n + 1] local rounding = window.WindowRounding local border_r = GetResizeBorderRect(window, border_n, rounding, 0.0) - window.DrawList:PathArcTo(ImLerp(border_r.Min, border_r.Max, def.SegmentN1) + ImVec2(0.5, 0.5) + def.InnerDir * rounding, rounding, def.OuterAngle - IM_PI * 0.25, def.OuterAngle) - window.DrawList:PathArcTo(ImLerp(border_r.Min, border_r.Max, def.SegmentN2) + ImVec2(0.5, 0.5) + def.InnerDir * rounding, rounding, def.OuterAngle, def.OuterAngle + IM_PI * 0.25) + window.DrawList:PathArcTo(ImLerp(border_r.Min, border_r.Max, def.SegmentN1) + ImVec2(0.5, 0.5) + def.InnerDir * rounding, rounding, def.OuterAngle - 3.141592653589793 --[[IM_PI]] * 0.25, def.OuterAngle) + window.DrawList:PathArcTo(ImLerp(border_r.Min, border_r.Max, def.SegmentN2) + ImVec2(0.5, 0.5) + def.InnerDir * rounding, rounding, def.OuterAngle, def.OuterAngle + 3.141592653589793 --[[IM_PI]] * 0.25) window.DrawList:PathStroke(border_col, border_size) end local function RenderWindowOuterBorders(window) local g = GImGui local border_size = window.WindowBorderSize - local border_col = ImGui.GetColorU32(ImGuiCol.Border) - if border_size > 0.0 and (bit32.band(window.Flags, ImGuiWindowFlags.NoBackground) == 0) then + local border_col = ImGui.GetColorU32(5 --[[ImGuiCol.Border]]) + if border_size > 0.0 and (bit32.band(window.Flags, 128 --[[ImGuiWindowFlags.NoBackground]]) == 0) then window.DrawList:AddRect(window.Pos, window.Pos + window.Size, border_col, window.WindowRounding, window.WindowBorderSize, 0) elseif border_size > 0.0 then - if bit32.band(window.ChildFlags, ImGuiChildFlags.ResizeX) ~= 0 then -- Similar code as 'resize_border_mask' computation in UpdateWindowManualResize() but we specifically only always draw explicit child resize border. + if bit32.band(window.ChildFlags, 4 --[[ImGuiChildFlags.ResizeX]]) ~= 0 then -- Similar code as 'resize_border_mask' computation in UpdateWindowManualResize() but we specifically only always draw explicit child resize border. RenderWindowOuterSingleBorder(window, 1, border_col, border_size) end - if bit32.band(window.ChildFlags, ImGuiChildFlags.ResizeY) ~= 0 then + if bit32.band(window.ChildFlags, 8 --[[ImGuiChildFlags.ResizeY]]) ~= 0 then RenderWindowOuterSingleBorder(window, 3, border_col, border_size) end end if window.ResizeBorderHovered ~= -1 or window.ResizeBorderHeld ~= -1 then local border_n = (window.ResizeBorderHeld ~= -1) and window.ResizeBorderHeld or window.ResizeBorderHovered - local border_col_resizing = ImGui.GetColorU32((window.ResizeBorderHeld ~= -1) and ImGuiCol.SeparatorActive or ImGuiCol.SeparatorHovered) + local border_col_resizing = ImGui.GetColorU32((window.ResizeBorderHeld ~= -1) and 30 --[[ImGuiCol.SeparatorActive]] or 29 --[[ImGuiCol.SeparatorHovered]]) RenderWindowOuterSingleBorder(window, border_n, border_col_resizing, ImMax(2.0, window.WindowBorderSize)) -- Thicker than usual end - if g.Style.FrameBorderSize > 0 and (bit32.band(window.Flags, ImGuiWindowFlags.NoTitleBar) == 0) and not window.DockIsActive then + 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) end @@ -10485,37 +10519,37 @@ local function RenderWindowDecorations(window, title_bar_rect, title_bar_is_high local backup_border_size = style.FrameBorderSize g.Style.FrameBorderSize = window.WindowBorderSize - local title_bar_col = ImGui.GetColorU32((title_bar_is_highlight and g.NavCursorVisible) and ImGuiCol.TitleBgActive or ImGuiCol.TitleBgCollapsed) + local title_bar_col = ImGui.GetColorU32((title_bar_is_highlight and g.NavCursorVisible) and 11 --[[ImGuiCol.TitleBgActive]] or 12 --[[ImGuiCol.TitleBgCollapsed]]) ImGui.RenderFrame(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, true, window_rounding) g.Style.FrameBorderSize = backup_border_size else -- Window background - if bit32.band(flags, ImGuiWindowFlags.NoBackground) == 0 then + if bit32.band(flags, 128 --[[ImGuiWindowFlags.NoBackground]]) == 0 then local bg_col = ImGui.GetColorU32(GetWindowBgColorIdx(window)) -- Adjust alpha. For docking local override_alpha = false local alpha = 1.0 - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasBgAlpha) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 64 --[[ImGuiNextWindowDataFlags.HasBgAlpha]]) ~= 0 then alpha = g.NextWindowData.BgAlphaVal override_alpha = true end if override_alpha then - bg_col = bit32.bor(bit32.band(bg_col, bit32.bnot(IM_COL32_A_MASK)), bit32.lshift(IM_F32_TO_INT8_SAT(alpha), IM_COL32_A_SHIFT)) + bg_col = bit32.bor(bit32.band(bg_col, bit32.bnot(4278190080 --[[IM_COL32_A_MASK]])), bit32.lshift(IM_F32_TO_INT8_SAT(alpha), 24 --[[IM_COL32_A_SHIFT]])) end -- Render, for docked windows and host windows we ensure BG goes before decorations if window.DockIsActive then window.DockNode.LastBgColor = bg_col end - if bit32.band(flags, ImGuiWindowFlags.DockNodeHost) ~= 0 then bg_col = 0 end + if bit32.band(flags, 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) ~= 0 then bg_col = 0 end - if bit32.band(bg_col, IM_COL32_A_MASK) ~= 0 then + if bit32.band(bg_col, 4278190080 --[[IM_COL32_A_MASK]]) ~= 0 then local bg_rect = ImRect(window.Pos + ImVec2(0, window.TitleBarHeight), window.Pos + window.Size) local bg_rounding_flags if window.DockIsActive then bg_rounding_flags = ImGui.CalcRoundingFlagsForRectInRect(bg_rect, window.DockNode.HostWindow:Rect(), 0.0) else - bg_rounding_flags = (bit32.band(flags, ImGuiWindowFlags.NoTitleBar) ~= 0) and ImDrawFlags.RoundCornersAll or ImDrawFlags.RoundCornersBottom + bg_rounding_flags = (bit32.band(flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) ~= 0) and 240 --[[ImDrawFlags.RoundCornersAll]] or 192 --[[ImDrawFlags.RoundCornersBottom]] end local bg_draw_list = window.DockIsActive and window.DockNode.HostWindow.DrawList or window.DrawList if window.DockIsActive then bg_draw_list:ChannelsSetCurrent(0) end @@ -10528,18 +10562,18 @@ local function RenderWindowDecorations(window, title_bar_rect, title_bar_is_high -- Title bar -- (when docked, DockNode are drawing their own title bar. Individual windows however do NOT set the _NoTitleBar flag, -- in order for their pos/size to be matching their undocking state.) - if bit32.band(flags, ImGuiWindowFlags.NoTitleBar) == 0 and not window.DockIsActive then - local title_bar_col = ImGui.GetColorU32(title_bar_is_highlight and ImGuiCol.TitleBgActive or ImGuiCol.TitleBg) - window.DrawList:AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, window_rounding, ImDrawFlags.RoundCornersTop) + if bit32.band(flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) == 0 and not window.DockIsActive then + local title_bar_col = ImGui.GetColorU32(title_bar_is_highlight and 11 --[[ImGuiCol.TitleBgActive]] or 10 --[[ImGuiCol.TitleBg]]) + window.DrawList:AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, window_rounding, 48 --[[ImDrawFlags.RoundCornersTop]]) end -- Menu bar - if bit32.band(flags, ImGuiWindowFlags.MenuBar) ~= 0 then + if bit32.band(flags, 1024 --[[ImGuiWindowFlags.MenuBar]]) ~= 0 then local menu_bar_rect = window:MenuBarRect() 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(ImGuiCol.MenuBarBg), (bit32.band(flags, ImGuiWindowFlags.NoTitleBar) ~= 0) and window_rounding or 0.0, ImDrawFlags.RoundCornersTop) + 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.RoundCornersTop]]) 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(ImGuiCol.Border), style.FrameBorderSize) + 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) end end @@ -10552,7 +10586,7 @@ local function RenderWindowDecorations(window, title_bar_rect, title_bar_is_high local r = ImRect(p, p + ImVec2(unhide_sz_hit, unhide_sz_hit)) local unhide_id = window:GetID("#UNHIDE") ImGui.KeepAliveID(unhide_id) - local pressed, hovered, held = ImGui.ButtonBehavior(r, unhide_id, ImGuiButtonFlags.FlattenChildren) + local pressed, hovered, held = ImGui.ButtonBehavior(r, unhide_id, 2048 --[[ImGuiButtonFlags.FlattenChildren]]) if pressed then node.WantHiddenTabBarToggle = true elseif held and ImGui.IsMouseDragging(0) then @@ -10560,24 +10594,24 @@ local function RenderWindowDecorations(window, title_bar_rect, title_bar_is_high end -- FIXME-DOCK: Ideally we'd use ImGuiCol.TitleBgActive/ImGuiCol.TitleBg here, but neither is guaranteed to be visible enough at this sort of size.. - local col = ImGui.GetColorU32(((held and hovered) or (node.IsFocused and not hovered)) and ImGuiCol.ButtonActive or (hovered and ImGuiCol.ButtonHovered or ImGuiCol.Button)) + local col = ImGui.GetColorU32(((held and hovered) or (node.IsFocused and not hovered)) and 24 --[[ImGuiCol.ButtonActive]] or (hovered and 23 --[[ImGuiCol.ButtonHovered]] or 22 --[[ImGuiCol.Button]])) window.DrawList:AddTriangleFilled(p, p + ImVec2(unhide_sz_draw, 0.0), p + ImVec2(0.0, unhide_sz_draw), col) end -- Scrollbars if window.ScrollbarX then - ImGui.Scrollbar(ImGuiAxis.X) + ImGui.Scrollbar(1 --[[ImGuiAxis.X]]) end if window.ScrollbarY then - ImGui.Scrollbar(ImGuiAxis.Y) + ImGui.Scrollbar(2 --[[ImGuiAxis.Y]]) end -- Render resize grips (after their input handling so we don't have a frame of latency) - if handle_borders_and_resize_grips and (bit32.band(flags, ImGuiWindowFlags.NoResize) == 0) then + if handle_borders_and_resize_grips and (bit32.band(flags, 2 --[[ImGuiWindowFlags.NoResize]]) == 0) then for resize_grip_n = 1, #ImGuiResizeGripDef do repeat local col = resize_grip_col[resize_grip_n] - if bit32.band(col, IM_COL32_A_MASK) == 0 then + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then break end @@ -10599,7 +10633,7 @@ local function RenderWindowDecorations(window, title_bar_rect, title_bar_is_high end end - window.DC.NavLayerCurrent = ImGuiNavLayer.Main + window.DC.NavLayerCurrent = 0 --[[ImGuiNavLayer.Main]] end ImGui.RenderWindowOuterBorders = RenderWindowOuterBorders @@ -10617,13 +10651,13 @@ local function RenderWindowTitleBarContents(window, title_bar_rect, name, open) local flags = window.Flags local has_close_button = (open ~= nil) - local has_collapse_button = bit32.band(flags, ImGuiWindowFlags.NoCollapse) == 0 and (style.WindowMenuButtonPosition ~= ImGuiDir.None) + local has_collapse_button = bit32.band(flags, 32 --[[ImGuiWindowFlags.NoCollapse]]) == 0 and (style.WindowMenuButtonPosition ~= (-1) --[[ImGuiDir.None]]) -- Close & Collapse button are on the Menu NavLayer and don't default focus (unless there's nothing else on that layer) -- FIXME-NAV: Might want (or not?) to set the equivalent of ImGuiButtonFlags.NoNavFocus so that mouse clicks on standard title bar items don't necessarily set nav/keyboard ref? local item_flags_backup = g.CurrentItemFlags - g.CurrentItemFlags = bit32.bor(g.CurrentItemFlags, ImGuiItemFlags.NoNavDefaultFocus) - window.DC.NavLayerCurrent = ImGuiNavLayer.Menu + g.CurrentItemFlags = bit32.bor(g.CurrentItemFlags, 4 --[[ImGuiItemFlags.NoNavDefaultFocus]]) + window.DC.NavLayerCurrent = 1 --[[ImGuiNavLayer.Menu]] -- Layout buttons -- FIXME: Would be nice to generalize the subtleties expressed here into reusable code. @@ -10636,11 +10670,11 @@ local function RenderWindowTitleBarContents(window, title_bar_rect, name, open) close_button_pos = ImVec2(title_bar_rect.Max.x - pad_r - button_sz, title_bar_rect.Min.y + style.FramePadding.y) pad_r = pad_r + button_sz + style.ItemInnerSpacing.x end - if has_collapse_button and style.WindowMenuButtonPosition == ImGuiDir.Right then + if has_collapse_button and style.WindowMenuButtonPosition == 1 --[[ImGuiDir.Right]] then collapse_button_pos = ImVec2(title_bar_rect.Max.x - pad_r - button_sz, title_bar_rect.Min.y + style.FramePadding.y) pad_r = pad_r + button_sz + style.ItemInnerSpacing.x end - if has_collapse_button and style.WindowMenuButtonPosition == ImGuiDir.Left then + if has_collapse_button and style.WindowMenuButtonPosition == 0 --[[ImGuiDir.Left]] then collapse_button_pos = ImVec2(title_bar_rect.Min.x + pad_l, title_bar_rect.Min.y + style.FramePadding.y) pad_l = pad_l + button_sz + style.ItemInnerSpacing.x end @@ -10655,19 +10689,19 @@ local function RenderWindowTitleBarContents(window, title_bar_rect, name, open) -- Close button if has_close_button then local backup_item_flags = g.CurrentItemFlags - g.CurrentItemFlags = bit32.bor(g.CurrentItemFlags, ImGuiItemFlags.NoFocus) + g.CurrentItemFlags = bit32.bor(g.CurrentItemFlags, 131072 --[[ImGuiItemFlags.NoFocus]]) if ImGui.CloseButton(window:GetID("#CLOSE"), close_button_pos) then open = false end g.CurrentItemFlags = backup_item_flags end - window.DC.NavLayerCurrent = ImGuiNavLayer.Main + window.DC.NavLayerCurrent = 0 --[[ImGuiNavLayer.Main]] g.CurrentItemFlags = item_flags_backup -- Title bar text (with: horizontal alignment, avoiding collapse/close button, optional "unsaved document" marker) -- FIXME: Refactor text alignment facilities along with RenderText helpers, this is WAY too much messy code.. - local marker_size_x = (bit32.band(flags, ImGuiWindowFlags.UnsavedDocument) ~= 0) and (button_sz * 0.80) or 0.0 + local marker_size_x = (bit32.band(flags, 262144 --[[ImGuiWindowFlags.UnsavedDocument]]) ~= 0) and (button_sz * 0.80) or 0.0 local text_size = ImGui.CalcTextSize(name, nil, true) + ImVec2(marker_size_x, 0.0) -- As a nice touch we try to ensure that centered title text doesn't get affected by visibility of Close/Collapse button, @@ -10688,12 +10722,12 @@ local function RenderWindowTitleBarContents(window, title_bar_rect, name, open) local layout_r = ImRect(title_bar_rect.Min.x + pad_l, title_bar_rect.Min.y, title_bar_rect.Max.x - pad_r, title_bar_rect.Max.y) local clip_r = ImRect(layout_r.Min.x, layout_r.Min.y, ImMin(layout_r.Max.x + g.Style.ItemInnerSpacing.x, title_bar_rect.Max.x), layout_r.Max.y) - if bit32.band(flags, ImGuiWindowFlags.UnsavedDocument) ~= 0 then + if bit32.band(flags, 262144 --[[ImGuiWindowFlags.UnsavedDocument]]) ~= 0 then local marker_pos = ImVec2() marker_pos.x = ImClamp(layout_r.Min.x + (layout_r:GetWidth() - text_size.x) * style.WindowTitleAlign.x + text_size.x, layout_r.Min.x, layout_r.Max.x) marker_pos.y = (layout_r.Min.y + layout_r.Max.y) * 0.5 if marker_pos.x > layout_r.Min.x then - ImGui.RenderBullet(window.DrawList, marker_pos, ImGui.GetColorU32(ImGuiCol.UnsavedMarker)) + ImGui.RenderBullet(window.DrawList, marker_pos, ImGui.GetColorU32(58 --[[ImGuiCol.UnsavedMarker]])) clip_r.Max.x = ImMin(clip_r.Max.x, marker_pos.x - math.floor(marker_size_x * 0.5)) end end @@ -10715,21 +10749,21 @@ function ImGui.UpdateWindowParentAndRootLinks(window, flags, parent_window) window.RootWindowForTitleBarHighlight = window window.RootWindowForNav = window - if parent_window and (bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0) and (bit32.band(flags, ImGuiWindowFlags.Tooltip) == 0) then + if parent_window and (bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0) and (bit32.band(flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) == 0) then window.RootWindowDockTree = parent_window.RootWindowDockTree - if not window.DockIsActive and (bit32.band(parent_window.Flags, ImGuiWindowFlags.DockNodeHost) == 0) then + if not window.DockIsActive and (bit32.band(parent_window.Flags, 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) == 0) then window.RootWindow = parent_window.RootWindow end end - if parent_window and (bit32.band(flags, ImGuiWindowFlags.Popup) ~= 0) then + if parent_window and (bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0) then window.RootWindowPopupTree = parent_window.RootWindowPopupTree end - if parent_window and (bit32.band(flags, ImGuiWindowFlags.Modal) == 0) and (bit32.band(flags, bit32.bor(ImGuiWindowFlags.ChildWindow, ImGuiWindowFlags.Popup, ImGuiWindowFlags.Tooltip)) ~= 0) then -- FIXME: simply use _NoTitleBar ? + if parent_window and (bit32.band(flags, 134217728 --[[ImGuiWindowFlags.Modal]]) == 0) and (bit32.band(flags, bit32.bor(16777216 --[[ImGuiWindowFlags.ChildWindow]], 67108864 --[[ImGuiWindowFlags.Popup]], 33554432 --[[ImGuiWindowFlags.Tooltip]])) ~= 0) then -- FIXME: simply use _NoTitleBar ? window.RootWindowForTitleBarHighlight = parent_window.RootWindowForTitleBarHighlight end - while bit32.band(window.RootWindowForNav.ChildFlags, ImGuiChildFlags.NavFlattened) ~= 0 do - IM_ASSERT(window.RootWindowForNav.ParentWindow ~= nil) + while bit32.band(window.RootWindowForNav.ChildFlags, 256 --[[ImGuiChildFlags.NavFlattened]]) ~= 0 do + assert(window.RootWindowForNav.ParentWindow ~= nil) window.RootWindowForNav = window.RootWindowForNav.ParentWindow end end @@ -10741,11 +10775,11 @@ function ImGui.UpdateWindowSkipRefresh(window) local g = GImGui window.SkipRefresh = false - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasRefreshPolicy) == 0 then + if bit32.band(g.NextWindowData.HasFlags, 1024 --[[ImGuiNextWindowDataFlags.HasRefreshPolicy]]) == 0 then return end - if bit32.band(g.NextWindowData.RefreshFlagsVal, ImGuiWindowRefreshFlags.TryToAvoidRefresh) ~= 0 then + if bit32.band(g.NextWindowData.RefreshFlagsVal, 1 --[[ImGuiWindowRefreshFlags.TryToAvoidRefresh]]) ~= 0 then -- [Port] SetNextWindowCached(): refresh on any change since the last refresh (and one frame after being busy) if g.NextWindowData.CacheKeySet then local function related(w) return w ~= nil and (w.RootWindow == window.RootWindow or ImGui.IsWindowWithinBeginStackOf(w.RootWindow, window)) end @@ -10753,7 +10787,7 @@ function ImGui.UpdateWindowSkipRefresh(window) local c, key, ds, tex = window.CacheSnap, g.NextWindowData.CacheKeyVal, g.IO.DisplaySize, g.IO.Fonts.TexData if busy or c == nil or c.Busy or c.Key ~= key or c.Tex ~= tex or c.Collapsed ~= window.Collapsed or c.PosX ~= window.Pos.x or c.PosY ~= window.Pos.y or c.SizeX ~= window.SizeFull.x or c.SizeY ~= window.SizeFull.y - or c.ScrollX ~= window.Scroll.x or c.ScrollY ~= window.Scroll.y or window.ScrollTarget.x < FLT_MAX or window.ScrollTarget.y < FLT_MAX + or c.ScrollX ~= window.Scroll.x or c.ScrollY ~= window.Scroll.y or window.ScrollTarget.x < 3.4028234663853e+38 --[[FLT_MAX]] or window.ScrollTarget.y < 3.4028234663853e+38 --[[FLT_MAX]] or c.DisplayX ~= ds.x or c.DisplayY ~= ds.y then c = c or {} window.CacheSnap = c @@ -10773,12 +10807,12 @@ function ImGui.UpdateWindowSkipRefresh(window) if window.Hidden then -- If was hidden (previous frame) return end - if bit32.band(g.NextWindowData.RefreshFlagsVal, ImGuiWindowRefreshFlags.RefreshOnHover) ~= 0 and g.HoveredWindow then + if bit32.band(g.NextWindowData.RefreshFlagsVal, 2 --[[ImGuiWindowRefreshFlags.RefreshOnHover]]) ~= 0 and g.HoveredWindow then if window.RootWindow == g.HoveredWindow.RootWindow or ImGui.IsWindowWithinBeginStackOf(g.HoveredWindow.RootWindow, window) then return end end - if bit32.band(g.NextWindowData.RefreshFlagsVal, ImGuiWindowRefreshFlags.RefreshOnFocus) ~= 0 and g.NavWindow then + if bit32.band(g.NextWindowData.RefreshFlagsVal, 4 --[[ImGuiWindowRefreshFlags.RefreshOnFocus]]) ~= 0 and g.NavWindow then if window.RootWindow == g.NavWindow.RootWindow or ImGui.IsWindowWithinBeginStackOf(g.NavWindow.RootWindow, window) then return end @@ -10808,7 +10842,7 @@ local function SetCurrentWindow(window) g.CurrentTable = (window and window.DC.CurrentTableIdx ~= -1) and g.Tables:GetByIndex(window.DC.CurrentTableIdx) or nil if window then - if bit32.band(g.IO.BackendFlags, ImGuiBackendFlags.RendererHasTextures) ~= 0 then + if bit32.band(g.IO.BackendFlags, 16 --[[ImGuiBackendFlags.RendererHasTextures]]) ~= 0 then local viewport = window.Viewport g.FontRasterizerDensity = (viewport.FramebufferScale.x ~= 0.0) and viewport.FramebufferScale.x or g.IO.DisplayFramebufferScale.x end @@ -10884,9 +10918,9 @@ function ImGui.SetWindowPos(window, pos, cond) return end - IM_ASSERT(cond == 0 or ImIsPowerOfTwo(cond)) -- Make sure the user doesn't attempt to combine multiple condition flags. - window.SetWindowPosAllowFlags = bit32.band(window.SetWindowPosAllowFlags, bit32.bnot(bit32.bor(ImGuiCond.Once, ImGuiCond.FirstUseEver, ImGuiCond.Appearing))) - ImVec2_Copy(window.SetWindowPosVal, ImVec2(FLT_MAX, FLT_MAX)) + assert(cond == 0 or ImIsPowerOfTwo(cond)) -- Make sure the user doesn't attempt to combine multiple condition flags. + window.SetWindowPosAllowFlags = bit32.band(window.SetWindowPosAllowFlags, bit32.bnot(bit32.bor(2 --[[ImGuiCond.Once]], 4 --[[ImGuiCond.FirstUseEver]], 8 --[[ImGuiCond.Appearing]]))) + ImVec2_Copy(window.SetWindowPosVal, ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]])) -- Set local old_pos = ImVec2() @@ -10926,14 +10960,14 @@ function ImGui.SetWindowSize(window, size, cond) return end - IM_ASSERT(cond == 0 or ImIsPowerOfTwo(cond)) -- Make sure the user doesn't attempt to combine multiple condition flags. - window.SetWindowSizeAllowFlags = bit32.band(window.SetWindowSizeAllowFlags, bit32.bnot(bit32.bor(ImGuiCond.Once, ImGuiCond.FirstUseEver, ImGuiCond.Appearing))) + assert(cond == 0 or ImIsPowerOfTwo(cond)) -- Make sure the user doesn't attempt to combine multiple condition flags. + window.SetWindowSizeAllowFlags = bit32.band(window.SetWindowSizeAllowFlags, bit32.bnot(bit32.bor(2 --[[ImGuiCond.Once]], 4 --[[ImGuiCond.FirstUseEver]], 8 --[[ImGuiCond.Appearing]]))) -- Enable auto-fit (not done in BeginChild() path unless appearing or combined with ImGuiChildFlags.AlwaysAutoResize) - if bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) == 0 or window.Appearing or bit32.band(window.ChildFlags, ImGuiChildFlags.AlwaysAutoResize) ~= 0 then + if bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0 or window.Appearing or bit32.band(window.ChildFlags, 64 --[[ImGuiChildFlags.AlwaysAutoResize]]) ~= 0 then window.AutoFitFramesX = (size.x <= 0.0) and 2 or 0 end - if bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) == 0 or window.Appearing or bit32.band(window.ChildFlags, ImGuiChildFlags.AlwaysAutoResize) ~= 0 then + if bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0 or window.Appearing or bit32.band(window.ChildFlags, 64 --[[ImGuiChildFlags.AlwaysAutoResize]]) ~= 0 then window.AutoFitFramesY = (size.y <= 0.0) and 2 or 0 end @@ -10968,7 +11002,7 @@ function ImGui.SetWindowCollapsed(window, collapsed, cond) if cond ~= 0 and bit32.band(window.SetWindowCollapsedAllowFlags, cond) == 0 then return end - window.SetWindowCollapsedAllowFlags = bit32.band(window.SetWindowCollapsedAllowFlags, bit32.bnot(bit32.bor(ImGuiCond.Once, ImGuiCond.FirstUseEver, ImGuiCond.Appearing))) + window.SetWindowCollapsedAllowFlags = bit32.band(window.SetWindowCollapsedAllowFlags, bit32.bnot(bit32.bor(2 --[[ImGuiCond.Once]], 4 --[[ImGuiCond.FirstUseEver]], 8 --[[ImGuiCond.Appearing]]))) -- Queue applying in Begin() if window.WantCollapseToggle then @@ -10981,7 +11015,7 @@ end --- @param pos ImVec2 --- @param size ImVec2 function ImGui.SetWindowHitTestHole(window, pos, size) - IM_ASSERT(window.HitTestHoleSize.x == 0) -- We don't support multiple holes/hit test filters + assert(window.HitTestHoleSize.x == 0) -- We don't support multiple holes/hit test filters window.HitTestHoleSize = ImVec2(math.floor(size.x), math.floor(size.y)) window.HitTestHoleOffset = ImVec2(math.floor(pos.x - window.Pos.x), math.floor(pos.y - window.Pos.y)) end @@ -11041,12 +11075,12 @@ function ImGui.SetNextWindowPos(pos, cond, pivot) if pivot == nil then pivot = ImVec2(0, 0) end local g = GImGui - IM_ASSERT(cond == 0 or ImIsPowerOfTwo(cond)) -- Make sure the user doesn't attempt to combine multiple condition flags. + assert(cond == 0 or ImIsPowerOfTwo(cond)) -- Make sure the user doesn't attempt to combine multiple condition flags. - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasPos) + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 1 --[[ImGuiNextWindowDataFlags.HasPos]]) ImVec2_Copy(g.NextWindowData.PosVal, pos) ImVec2_Copy(g.NextWindowData.PosPivotVal, pivot) - g.NextWindowData.PosCond = (cond ~= 0) and cond or ImGuiCond.Always + g.NextWindowData.PosCond = (cond ~= 0) and cond or 1 --[[ImGuiCond.Always]] g.NextWindowData.PosUndock = true end @@ -11056,11 +11090,11 @@ function ImGui.SetNextWindowSize(size, cond) if cond == nil then cond = 0 end local g = GImGui - IM_ASSERT(cond == 0 or ImIsPowerOfTwo(cond)) -- Make sure the user doesn't attempt to combine multiple condition flags. + assert(cond == 0 or ImIsPowerOfTwo(cond)) -- Make sure the user doesn't attempt to combine multiple condition flags. - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasSize) + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 2 --[[ImGuiNextWindowDataFlags.HasSize]]) ImVec2_Copy(g.NextWindowData.SizeVal, size) - g.NextWindowData.SizeCond = (cond ~= 0) and cond or ImGuiCond.Always + g.NextWindowData.SizeCond = (cond ~= 0) and cond or 1 --[[ImGuiCond.Always]] end -- For each axis: @@ -11073,7 +11107,7 @@ end --- @param custom_callback_user_data? any function ImGui.SetNextWindowSizeConstraints(size_min, size_max, custom_callback, custom_callback_user_data) local g = GImGui - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasSizeConstraint) + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 16 --[[ImGuiNextWindowDataFlags.HasSizeConstraint]]) g.NextWindowData.SizeConstraintRect = ImRect(size_min, size_max) g.NextWindowData.SizeCallback = custom_callback g.NextWindowData.SizeCallbackUserData = custom_callback_user_data @@ -11082,7 +11116,7 @@ end --- @param alpha float function ImGui.SetNextWindowBgAlpha(alpha) local g = GImGui - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasBgAlpha) + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 64 --[[ImGuiNextWindowDataFlags.HasBgAlpha]]) g.NextWindowData.BgAlphaVal = alpha end @@ -11111,8 +11145,8 @@ end -- FIXME: It might be undesirable that this will likely disable KeyOwner-aware shortcuts systems. Consider a more fine-tuned version if needed? function ImGui.SetActiveIdUsingAllKeyboardKeys() local g = GImGui - IM_ASSERT(g.ActiveId ~= 0) - g.ActiveIdUsingNavDirMask = (bit32.lshift(1, ImGuiDir.COUNT) - 1) + assert(g.ActiveId ~= 0) + g.ActiveIdUsingNavDirMask = (bit32.lshift(1, 4 --[[ImGuiDir.COUNT]]) - 1) g.ActiveIdUsingAllKeyboardKeys = true ImGui.NavMoveRequestCancel() end @@ -11137,69 +11171,69 @@ end function ImGui.BeginChildEx(name, id, size_arg, child_flags, window_flags) local g = GImGui local parent_window = g.CurrentWindow - IM_ASSERT(id ~= 0) + assert(id ~= 0) if child_flags == nil then child_flags = 0 end if window_flags == nil then window_flags = 0 end if size_arg == nil then size_arg = ImVec2(0, 0) end - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasChildFlags) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 512 --[[ImGuiNextWindowDataFlags.HasChildFlags]]) ~= 0 then child_flags = bit32.band(bit32.bor(child_flags, g.NextWindowData.ChildFlagsSet), bit32.bnot(g.NextWindowData.ChildFlagsClear)) end -- Sanity check as it is likely that some user will accidentally pass ImGuiWindowFlags into the ImGuiChildFlags argument. - local ImGuiChildFlags_SupportedMask_ = bit32.bor(ImGuiChildFlags.Borders, ImGuiChildFlags.AlwaysUseWindowPadding, ImGuiChildFlags.ResizeX, ImGuiChildFlags.ResizeY, ImGuiChildFlags.AutoResizeX, ImGuiChildFlags.AutoResizeY, ImGuiChildFlags.AlwaysAutoResize, ImGuiChildFlags.FrameStyle, ImGuiChildFlags.NavFlattened) + local ImGuiChildFlags_SupportedMask_ = bit32.bor(1 --[[ImGuiChildFlags.Borders]], 2 --[[ImGuiChildFlags.AlwaysUseWindowPadding]], 4 --[[ImGuiChildFlags.ResizeX]], 8 --[[ImGuiChildFlags.ResizeY]], 16 --[[ImGuiChildFlags.AutoResizeX]], 32 --[[ImGuiChildFlags.AutoResizeY]], 64 --[[ImGuiChildFlags.AlwaysAutoResize]], 128 --[[ImGuiChildFlags.FrameStyle]], 256 --[[ImGuiChildFlags.NavFlattened]]) -- IM_UNUSED(ImGuiChildFlags_SupportedMask_) - IM_ASSERT(bit32.band(child_flags, bit32.bnot(ImGuiChildFlags_SupportedMask_)) == 0, "Illegal ImGuiChildFlags value. Did you pass ImGuiWindowFlags values instead of ImGuiChildFlags?") - IM_ASSERT(bit32.band(window_flags, ImGuiWindowFlags.AlwaysAutoResize) == 0, "Cannot specify ImGuiWindowFlags.AlwaysAutoResize for BeginChild(). Use ImGuiChildFlags.AlwaysAutoResize!") - if bit32.band(child_flags, ImGuiChildFlags.AlwaysAutoResize) ~= 0 then - IM_ASSERT(bit32.band(child_flags, bit32.bor(ImGuiChildFlags.ResizeX, ImGuiChildFlags.ResizeY)) == 0, "Cannot use ImGuiChildFlags.ResizeX or ImGuiChildFlags.ResizeY with ImGuiChildFlags.AlwaysAutoResize!") - IM_ASSERT(bit32.band(child_flags, bit32.bor(ImGuiChildFlags.AutoResizeX, ImGuiChildFlags.AutoResizeY)) ~= 0, "Must use ImGuiChildFlags.AutoResizeX or ImGuiChildFlags.AutoResizeY with ImGuiChildFlags.AlwaysAutoResize!") + assert(bit32.band(child_flags, bit32.bnot(ImGuiChildFlags_SupportedMask_)) == 0, "Illegal ImGuiChildFlags value. Did you pass ImGuiWindowFlags values instead of ImGuiChildFlags?") + assert(bit32.band(window_flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) == 0, "Cannot specify ImGuiWindowFlags.AlwaysAutoResize for BeginChild(). Use ImGuiChildFlags.AlwaysAutoResize!") + if bit32.band(child_flags, 64 --[[ImGuiChildFlags.AlwaysAutoResize]]) ~= 0 then + assert(bit32.band(child_flags, bit32.bor(4 --[[ImGuiChildFlags.ResizeX]], 8 --[[ImGuiChildFlags.ResizeY]])) == 0, "Cannot use ImGuiChildFlags.ResizeX or ImGuiChildFlags.ResizeY with ImGuiChildFlags.AlwaysAutoResize!") + assert(bit32.band(child_flags, bit32.bor(16 --[[ImGuiChildFlags.AutoResizeX]], 32 --[[ImGuiChildFlags.AutoResizeY]])) ~= 0, "Must use ImGuiChildFlags.AutoResizeX or ImGuiChildFlags.AutoResizeY with ImGuiChildFlags.AlwaysAutoResize!") end - if bit32.band(child_flags, ImGuiChildFlags.AutoResizeX) ~= 0 then - child_flags = bit32.band(child_flags, bit32.bnot(ImGuiChildFlags.ResizeX)) + if bit32.band(child_flags, 16 --[[ImGuiChildFlags.AutoResizeX]]) ~= 0 then + child_flags = bit32.band(child_flags, bit32.bnot(4 --[[ImGuiChildFlags.ResizeX]])) end - if bit32.band(child_flags, ImGuiChildFlags.AutoResizeY) ~= 0 then - child_flags = bit32.band(child_flags, bit32.bnot(ImGuiChildFlags.ResizeY)) + if bit32.band(child_flags, 32 --[[ImGuiChildFlags.AutoResizeY]]) ~= 0 then + child_flags = bit32.band(child_flags, bit32.bnot(8 --[[ImGuiChildFlags.ResizeY]])) end -- Set window flags - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.ChildWindow, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoDocking) - window_flags = bit32.bor(window_flags, bit32.band(parent_window.Flags, ImGuiWindowFlags.NoMove)) -- Inherit the NoMove flag - if bit32.band(child_flags, bit32.bor(ImGuiChildFlags.AutoResizeX, ImGuiChildFlags.AutoResizeY, ImGuiChildFlags.AlwaysAutoResize)) ~= 0 then - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.AlwaysAutoResize) -- FIXME: Would be sane to not make single-axis flag set this. (#9355) + window_flags = bit32.bor(window_flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]], 1 --[[ImGuiWindowFlags.NoTitleBar]], 524288 --[[ImGuiWindowFlags.NoDocking]]) + window_flags = bit32.bor(window_flags, bit32.band(parent_window.Flags, 4 --[[ImGuiWindowFlags.NoMove]])) -- Inherit the NoMove flag + if bit32.band(child_flags, bit32.bor(16 --[[ImGuiChildFlags.AutoResizeX]], 32 --[[ImGuiChildFlags.AutoResizeY]], 64 --[[ImGuiChildFlags.AlwaysAutoResize]])) ~= 0 then + window_flags = bit32.bor(window_flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) -- FIXME: Would be sane to not make single-axis flag set this. (#9355) end - if bit32.band(child_flags, bit32.bor(ImGuiChildFlags.ResizeX, ImGuiChildFlags.ResizeY)) == 0 then - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.NoResize, ImGuiWindowFlags.NoSavedSettings) + if bit32.band(child_flags, bit32.bor(4 --[[ImGuiChildFlags.ResizeX]], 8 --[[ImGuiChildFlags.ResizeY]])) == 0 then + window_flags = bit32.bor(window_flags, 2 --[[ImGuiWindowFlags.NoResize]], 256 --[[ImGuiWindowFlags.NoSavedSettings]]) end -- Special framed style - if bit32.band(child_flags, ImGuiChildFlags.FrameStyle) ~= 0 then - ImGui.PushStyleColor(ImGuiCol.ChildBg, g.Style.Colors[ImGuiCol.FrameBg]) - ImGui.PushStyleVar(ImGuiStyleVar.ChildRounding, g.Style.FrameRounding) - ImGui.PushStyleVar(ImGuiStyleVar.ChildBorderSize, g.Style.FrameBorderSize) - ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, g.Style.FramePadding) - child_flags = bit32.bor(child_flags, ImGuiChildFlags.Borders, ImGuiChildFlags.AlwaysUseWindowPadding) - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.NoMove) + if bit32.band(child_flags, 128 --[[ImGuiChildFlags.FrameStyle]]) ~= 0 then + ImGui.PushStyleColor(3 --[[ImGuiCol.ChildBg]], g.Style.Colors[7 --[[ImGuiCol.FrameBg]]]) + ImGui.PushStyleVar(7 --[[ImGuiStyleVar.ChildRounding]], g.Style.FrameRounding) + ImGui.PushStyleVar(8 --[[ImGuiStyleVar.ChildBorderSize]], g.Style.FrameBorderSize) + ImGui.PushStyleVar(2 --[[ImGuiStyleVar.WindowPadding]], g.Style.FramePadding) + child_flags = bit32.bor(child_flags, 1 --[[ImGuiChildFlags.Borders]], 2 --[[ImGuiChildFlags.AlwaysUseWindowPadding]]) + window_flags = bit32.bor(window_flags, 4 --[[ImGuiWindowFlags.NoMove]]) end -- Forward size -- Important: Begin() has special processing to switch condition to ImGuiCond.FirstUseEver for a given axis when ImGuiChildFlags.ResizeXXX is set. -- (the alternative would to store conditional flags per axis, which is possible but more code) local size_avail = ImGui.GetContentRegionAvail() - local size_default = ImVec2((bit32.band(child_flags, ImGuiChildFlags.AutoResizeX) ~= 0) and 0.0 or size_avail.x, (bit32.band(child_flags, ImGuiChildFlags.AutoResizeY) ~= 0) and 0.0 or size_avail.y) + local size_default = ImVec2((bit32.band(child_flags, 16 --[[ImGuiChildFlags.AutoResizeX]]) ~= 0) and 0.0 or size_avail.x, (bit32.band(child_flags, 32 --[[ImGuiChildFlags.AutoResizeY]]) ~= 0) and 0.0 or size_avail.y) local size = ImGui.CalcItemSize(size_arg, size_default.x, size_default.y) -- A SetNextWindowSize() call always has priority (#8020) -- (since the code in Begin() never supported SizeVal==0.0 aka auto-resize via SetNextWindowSize() call, we don't support it here for now) -- FIXME: We only support ImGuiCond.Always in this path. Supporting other paths would requires to obtain window pointer. - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasSize) ~= 0 and bit32.band(g.NextWindowData.SizeCond, ImGuiCond.Always) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 2 --[[ImGuiNextWindowDataFlags.HasSize]]) ~= 0 and bit32.band(g.NextWindowData.SizeCond, 1 --[[ImGuiCond.Always]]) ~= 0 then if g.NextWindowData.SizeVal.x > 0.0 then size.x = g.NextWindowData.SizeVal.x - child_flags = bit32.band(child_flags, bit32.bnot(ImGuiChildFlags.ResizeX)) + child_flags = bit32.band(child_flags, bit32.bnot(4 --[[ImGuiChildFlags.ResizeX]])) end if g.NextWindowData.SizeVal.y > 0.0 then size.y = g.NextWindowData.SizeVal.y - child_flags = bit32.band(child_flags, bit32.bnot(ImGuiChildFlags.ResizeY)) + child_flags = bit32.band(child_flags, bit32.bnot(8 --[[ImGuiChildFlags.ResizeY]])) end end ImGui.SetNextWindowSize(size) @@ -11220,7 +11254,7 @@ function ImGui.BeginChildEx(name, id, size_arg, child_flags, window_flags) -- Set style local backup_border_size = g.Style.ChildBorderSize - if bit32.band(child_flags, ImGuiChildFlags.Borders) == 0 then + if bit32.band(child_flags, 1 --[[ImGuiChildFlags.Borders]]) == 0 then g.Style.ChildBorderSize = 0.0 end @@ -11230,7 +11264,7 @@ function ImGui.BeginChildEx(name, id, size_arg, child_flags, window_flags) -- Restore style g.Style.ChildBorderSize = backup_border_size - if bit32.band(child_flags, ImGuiChildFlags.FrameStyle) ~= 0 then + if bit32.band(child_flags, 128 --[[ImGuiChildFlags.FrameStyle]]) ~= 0 then ImGui.PopStyleVar(3) ImGui.PopStyleColor() end @@ -11250,7 +11284,7 @@ function ImGui.BeginChildEx(name, id, size_arg, child_flags, window_flags) if g.ActiveId == temp_id_for_activation then ImGui.ClearActiveID() end - if g.NavActivateId == id and bit32.band(child_flags, ImGuiChildFlags.NavFlattened) == 0 and (child_window.DC.NavLayersActiveMask ~= 0 or child_window.DC.NavWindowHasScrollY) then + if g.NavActivateId == id and bit32.band(child_flags, 256 --[[ImGuiChildFlags.NavFlattened]]) == 0 and (child_window.DC.NavLayersActiveMask ~= 0 or child_window.DC.NavWindowHasScrollY) then ImGui.FocusWindow(child_window) ImGui.NavInitWindow(child_window, false) ImGui.SetActiveID(temp_id_for_activation, child_window) -- Steal ActiveId with another arbitrary id so that key-press won't activate child item @@ -11269,7 +11303,7 @@ end --- @param window_flags? ImGuiWindowFlags --- @return bool # visible (always call EndChild()!) function ImGui.BeginChild(str_id_or_id, size_arg, child_flags, window_flags) - if child_flags == true then child_flags = ImGuiChildFlags.Borders elseif not child_flags then child_flags = 0 end + if child_flags == true then child_flags = 1 --[[ImGuiChildFlags.Borders]] elseif not child_flags then child_flags = 0 end if type(str_id_or_id) == "number" then return ImGui.BeginChildEx(nil, str_id_or_id, size_arg, child_flags, window_flags) end @@ -11289,7 +11323,7 @@ function ImGui.EndChild() local child_window = g.CurrentWindow local backup_within_end_child_id = g.WithinEndChildID - IM_ASSERT(bit32.band(child_window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0) -- Mismatched BeginChild()/EndChild() calls + assert(bit32.band(child_window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0) -- Mismatched BeginChild()/EndChild() calls g.WithinEndChildID = child_window.ID local child_size = ImVec2(child_window.Size.x, child_window.Size.y) @@ -11298,20 +11332,20 @@ function ImGui.EndChild() local parent_window = g.CurrentWindow local bb = ImRect(parent_window.DC.CursorPos, parent_window.DC.CursorPos + child_size) ImGui.ItemSize(child_size) - local nav_flattened = bit32.band(child_window.ChildFlags, ImGuiChildFlags.NavFlattened) ~= 0 + local nav_flattened = bit32.band(child_window.ChildFlags, 256 --[[ImGuiChildFlags.NavFlattened]]) ~= 0 if (child_window.DC.NavLayersActiveMask ~= 0 or child_window.DC.NavWindowHasScrollY) and not nav_flattened then ImGui.ItemAdd(bb, child_window.ChildId) ImGui.RenderNavCursor(bb, child_window.ChildId) -- When browsing a window that has no activable items (scroll only) we keep a highlight on the child (pass g.NavId to trick into always displaying) if child_window.DC.NavLayersActiveMask == 0 and child_window == g.NavWindow then - ImGui.RenderNavCursor(ImRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2)), g.NavId, ImGuiNavRenderCursorFlags.Compact) + ImGui.RenderNavCursor(ImRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2)), g.NavId, 2 --[[ImGuiNavRenderCursorFlags.Compact]]) end else -- Not navigable into -- - This is a bit of a fringe use case, mostly useful for undecorated, non-scrolling contents childs, or empty childs. -- - We could later decide to not apply this path if ImGuiChildFlags.FrameStyle or ImGuiChildFlags.Borders is set. - ImGui.ItemAdd(bb, child_window.ChildId, nil, ImGuiItemFlags.NoNav) + ImGui.ItemAdd(bb, child_window.ChildId, nil, 2 --[[ImGuiItemFlags.NoNav]]) -- But when flattened we directly reach items, adjust active layer mask accordingly if nav_flattened then @@ -11319,7 +11353,7 @@ function ImGui.EndChild() end end if g.HoveredWindow == child_window then - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HoveredWindow) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 128 --[[ImGuiItemStatusFlags.HoveredWindow]]) end child_window.DC.ChildItemStatusFlags = g.LastItemData.StatusFlags -- SetLastItemDataForChildWindowItem(child_window, child_window:Rect()) -- Not needed, effectively done by ItemAdd() @@ -11328,7 +11362,7 @@ function ImGui.EndChild() end g.WithinEndChildID = backup_within_end_child_id - g.LogLinePosY = -FLT_MAX -- To enforce a carriage return + g.LogLinePosY = -3.4028234663853e+38 --[[FLT_MAX]] -- To enforce a carriage return end --- @param flags ImGuiChildFlags @@ -11336,7 +11370,7 @@ end function ImGui.SetNextWindowChildFlags(flags, enabled) local g = GImGui local nwd = g.NextWindowData - if bit32.band(nwd.HasFlags, ImGuiNextWindowDataFlags.HasChildFlags) == 0 then + if bit32.band(nwd.HasFlags, 512 --[[ImGuiNextWindowDataFlags.HasChildFlags]]) == 0 then nwd.ChildFlagsSet = 0; nwd.ChildFlagsClear = 0 end if enabled then @@ -11346,7 +11380,7 @@ function ImGui.SetNextWindowChildFlags(flags, enabled) nwd.ChildFlagsSet = bit32.band(nwd.ChildFlagsSet, bit32.bnot(flags)) nwd.ChildFlagsClear = bit32.bor(nwd.ChildFlagsClear, flags) end - nwd.HasFlags = bit32.bor(nwd.HasFlags, ImGuiNextWindowDataFlags.HasChildFlags) + nwd.HasFlags = bit32.bor(nwd.HasFlags, 512 --[[ImGuiNextWindowDataFlags.HasChildFlags]]) end --- @param flags ImGuiWindowFlags @@ -11354,7 +11388,7 @@ end function ImGui.SetNextWindowFlags(flags, enabled) local g = GImGui local nwd = g.NextWindowData - if bit32.band(nwd.HasFlags, ImGuiNextWindowDataFlags.HasWindowFlags) == 0 then + if bit32.band(nwd.HasFlags, 256 --[[ImGuiNextWindowDataFlags.HasWindowFlags]]) == 0 then nwd.WindowFlagsSet = 0; nwd.WindowFlagsClear = 0 end if enabled then @@ -11364,7 +11398,7 @@ function ImGui.SetNextWindowFlags(flags, enabled) nwd.WindowFlagsSet = bit32.band(nwd.WindowFlagsSet, bit32.bnot(flags)) nwd.WindowFlagsClear = bit32.bor(nwd.WindowFlagsClear, flags) end - nwd.HasFlags = bit32.bor(nwd.HasFlags, ImGuiNextWindowDataFlags.HasWindowFlags) + nwd.HasFlags = bit32.bor(nwd.HasFlags, 256 --[[ImGuiNextWindowDataFlags.HasWindowFlags]]) end -- Content size = inner scrollable rectangle, padded with WindowPadding. @@ -11372,14 +11406,14 @@ end --- @param size ImVec2 function ImGui.SetNextWindowContentSize(size) local g = GImGui - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasContentSize) + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 4 --[[ImGuiNextWindowDataFlags.HasContentSize]]) ImVec2_CopyV(g.NextWindowData.ContentSizeVal, ImTrunc(size.x), ImTrunc(size.y)) end --- @param scroll ImVec2 function ImGui.SetNextWindowScroll(scroll) local g = GImGui - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasScroll) + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 128 --[[ImGuiNextWindowDataFlags.HasScroll]]) ImVec2_Copy(g.NextWindowData.ScrollVal, scroll) end @@ -11388,28 +11422,28 @@ end function ImGui.SetNextWindowCollapsed(collapsed, cond) if cond == nil then cond = 0 end local g = GImGui - IM_ASSERT(cond == 0 or ImIsPowerOfTwo(cond)) -- Make sure the user doesn't attempt to combine multiple condition flags. - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasCollapsed) + assert(cond == 0 or ImIsPowerOfTwo(cond)) -- Make sure the user doesn't attempt to combine multiple condition flags. + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 8 --[[ImGuiNextWindowDataFlags.HasCollapsed]]) g.NextWindowData.CollapsedVal = collapsed - g.NextWindowData.CollapsedCond = (cond ~= 0) and cond or ImGuiCond.Always + g.NextWindowData.CollapsedCond = (cond ~= 0) and cond or 1 --[[ImGuiCond.Always]] end function ImGui.SetNextWindowFocus() local g = GImGui - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasFocus) + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 32 --[[ImGuiNextWindowDataFlags.HasFocus]]) end --- @param id ImGuiID function ImGui.SetNextWindowViewport(id) local g = GImGui - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasViewport) + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 2048 --[[ImGuiNextWindowDataFlags.HasViewport]]) g.NextWindowData.ViewportId = id end --- @param window_class ImGuiWindowClass function ImGui.SetNextWindowClass(window_class) local g = GImGui - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasWindowClass) + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 8192 --[[ImGuiNextWindowDataFlags.HasWindowClass]]) local wc = ImGuiWindowClass() for k, v in pairs(window_class) do wc[k] = v end -- C++ copies the struct g.NextWindowData.WindowClass = wc @@ -11419,7 +11453,7 @@ end --- @param flags ImGuiWindowRefreshFlags function ImGui.SetNextWindowRefreshPolicy(flags) local g = GImGui - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasRefreshPolicy) + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 1024 --[[ImGuiNextWindowDataFlags.HasRefreshPolicy]]) g.NextWindowData.RefreshFlagsVal = flags g.NextWindowData.CacheKeySet = false end @@ -11432,7 +11466,7 @@ end -- Anything else that changes the contents (style, fonts, time) must be part of `key`. function ImGui.SetNextWindowCached(key) local g = GImGui - ImGui.SetNextWindowRefreshPolicy(bit32.bor(ImGuiWindowRefreshFlags.TryToAvoidRefresh, ImGuiWindowRefreshFlags.RefreshOnHover, ImGuiWindowRefreshFlags.RefreshOnFocus)) + ImGui.SetNextWindowRefreshPolicy(bit32.bor(1 --[[ImGuiWindowRefreshFlags.TryToAvoidRefresh]], 2 --[[ImGuiWindowRefreshFlags.RefreshOnHover]], 4 --[[ImGuiWindowRefreshFlags.RefreshOnFocus]])) g.NextWindowData.CacheKeySet = true g.NextWindowData.CacheKeyVal = key end @@ -11449,7 +11483,7 @@ end -- Prefer using PushFont(nil, style.FontSizeBase * factor), or use style.FontScaleMain to scale all windows. --- @param scale float function ImGui.SetWindowFontScale(scale) - IM_ASSERT(scale > 0.0) + assert(scale > 0.0) local window = ImGui.GetCurrentWindow() window.FontWindowScale = scale ImGui.UpdateCurrentFontSize(0.0) @@ -11471,11 +11505,11 @@ function ImGui.StartMouseMovingWindow(window) ImGui.SetActiveIdUsingAllKeyboardKeys() local can_move_window = true - if bit32.band(window.Flags, ImGuiWindowFlags.NoMove) ~= 0 or bit32.band(window.RootWindowDockTree.Flags, ImGuiWindowFlags.NoMove) ~= 0 then + if bit32.band(window.Flags, 4 --[[ImGuiWindowFlags.NoMove]]) ~= 0 or bit32.band(window.RootWindowDockTree.Flags, 4 --[[ImGuiWindowFlags.NoMove]]) ~= 0 then can_move_window = false end local node = window.DockNodeAsHost - if node and node.VisibleWindow and bit32.band(node.VisibleWindow.Flags, ImGuiWindowFlags.NoMove) ~= 0 then + if node and node.VisibleWindow and bit32.band(node.VisibleWindow.Flags, 4 --[[ImGuiWindowFlags.NoMove]]) ~= 0 then can_move_window = false end if can_move_window then @@ -11495,7 +11529,7 @@ function ImGui.UpdateMouseMovingWindowNewFrame() -- We actually want to move the root window. g.MovingWindow == window we clicked on (could be a child window). -- We track it to preserve Focus and so that generally ActiveIdWindow == MovingWindow and ActiveId == MovingWindow.MoveId for consistency. ImGui.KeepAliveID(g.ActiveId) - IM_ASSERT(g.MovingWindow and g.MovingWindow.RootWindowDockTree) + assert(g.MovingWindow and g.MovingWindow.RootWindowDockTree) local moving_window = g.MovingWindow.RootWindowDockTree @@ -11504,7 +11538,7 @@ function ImGui.UpdateMouseMovingWindowNewFrame() if g.IO.MouseDown[0] and ImGui.IsMousePosValid(g.IO.MousePos) and not window_disappeared then local pos = g.IO.MousePos - g.ActiveIdClickOffset if moving_window.Pos.x ~= pos.x or moving_window.Pos.y ~= pos.y then - ImGui.SetWindowPos(moving_window, pos, ImGuiCond.Always) + ImGui.SetWindowPos(moving_window, pos, 1 --[[ImGuiCond.Always]]) if moving_window.Viewport and moving_window.ViewportOwned then -- Synchronize viewport immediately because some overlays may relies on clipping rectangle before we Begin() into the window. ImVec2_Copy(moving_window.Viewport.Pos, pos) moving_window.Viewport:UpdateWorkRect() @@ -11539,20 +11573,20 @@ function ImGui.IsPopupOpen(id, popup_flags) if popup_flags == nil then popup_flags = 0 end if type(id) == "string" then -- str_id overload: with AnyPopupId the id must be 0, otherwise it is hashed with the current window's ID stack - id = (bit32.band(popup_flags, ImGuiPopupFlags.AnyPopupId) ~= 0) and 0 or g.CurrentWindow:GetID(id) + id = (bit32.band(popup_flags, 1024 --[[ImGuiPopupFlags.AnyPopupId]]) ~= 0) and 0 or g.CurrentWindow:GetID(id) end - if bit32.band(popup_flags, ImGuiPopupFlags.AnyPopupId) ~= 0 then + if bit32.band(popup_flags, 1024 --[[ImGuiPopupFlags.AnyPopupId]]) ~= 0 then -- Return true if any popup is open at the current BeginPopup() level of the popup stack -- This may be used to e.g. test for another popups already opened to handle popups priorities at the same level. - IM_ASSERT(id == 0) - if bit32.band(popup_flags, ImGuiPopupFlags.AnyPopupLevel) ~= 0 then + assert(id == 0) + if bit32.band(popup_flags, 2048 --[[ImGuiPopupFlags.AnyPopupLevel]]) ~= 0 then return g.OpenPopupStack.Size > 0 else return g.OpenPopupStack.Size > g.BeginPopupStack.Size end else - if bit32.band(popup_flags, ImGuiPopupFlags.AnyPopupLevel) ~= 0 then + if bit32.band(popup_flags, 2048 --[[ImGuiPopupFlags.AnyPopupLevel]]) ~= 0 then -- Return true if the popup is open anywhere in the popup stack for n = 1, g.OpenPopupStack.Size do if g.OpenPopupStack.Data[n].PopupId == id then @@ -11574,7 +11608,7 @@ function ImGui.GetTopMostPopupModal() for n = g.OpenPopupStack.Size, 1, -1 do local popup = g.OpenPopupStack.Data[n].Window if popup then - if bit32.band(popup.Flags, ImGuiWindowFlags.Modal) ~= 0 then + if bit32.band(popup.Flags, 134217728 --[[ImGuiWindowFlags.Modal]]) ~= 0 then return popup end end @@ -11601,7 +11635,7 @@ function ImGui.UpdateMouseMovingWindowEndFrame() -- Click on empty space to focus window and start moving -- (after we're done with all our widgets, so e.g. clicking on docking tab-bar which have set HoveredId already and not get us here!) - if ImGui.IsMouseClickedEx(0, ImGuiInputFlags.None, ImGuiKeyOwner_NoOwner) then + if ImGui.IsMouseClickedEx(0, 0 --[[ImGuiInputFlags.None]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) then -- Handle the edge case of a popup being closed while clicking in its empty space. -- If we try to focus it, FocusWindow() > ClosePopupsOverWindow() will accidentally close any parent popups because they are not linked together any more. local hovered_root @@ -11610,8 +11644,8 @@ function ImGui.UpdateMouseMovingWindowEndFrame() else hovered_root = nil end - local is_closed_popup = hovered_root and (bit32.band(hovered_root.Flags, ImGuiWindowFlags.Popup) ~= 0) and not ImGui.IsPopupOpen(hovered_root.PopupId, ImGuiPopupFlags.AnyPopupLevel) - local is_queued_focus_request = g.NavMoveSubmitted and (bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.FocusApi) ~= 0) + local is_closed_popup = hovered_root and (bit32.band(hovered_root.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0) and not ImGui.IsPopupOpen(hovered_root.PopupId, 2048 --[[ImGuiPopupFlags.AnyPopupLevel]]) + local is_queued_focus_request = g.NavMoveSubmitted and (bit32.band(g.NavMoveFlags, 512 --[[ImGuiNavMoveFlags.FocusApi]]) ~= 0) if hovered_window ~= nil and not is_closed_popup and not is_queued_focus_request then ImGui.StartMouseMovingWindow(hovered_window) @@ -11620,8 +11654,8 @@ function ImGui.UpdateMouseMovingWindowEndFrame() -- Please note how StartMouseMovingWindow() and StopMouseMovingWindow() and not entirely symmetrical, at the later doesn't clear ActiveId. -- Cancel moving if clicked outside of title bar - if bit32.band(hovered_window.BgClickFlags, ImGuiWindowBgClickFlags.Move) == 0 then -- set by io.ConfigWindowsMoveFromTitleBarOnly - if bit32.band(hovered_root.Flags, ImGuiWindowFlags.NoTitleBar) == 0 then + if bit32.band(hovered_window.BgClickFlags, 1 --[[ImGuiWindowBgClickFlags.Move]]) == 0 then -- set by io.ConfigWindowsMoveFromTitleBarOnly + if bit32.band(hovered_root.Flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) == 0 then if not hovered_root:TitleBarRect():Contains(g.IO.MouseClickedPos[0]) then g.MovingWindow = nil end @@ -11636,14 +11670,14 @@ function ImGui.UpdateMouseMovingWindowEndFrame() end elseif hovered_window == nil and g.NavWindow ~= nil then -- Clicking on void disable focus - ImGui.FocusWindow(nil, ImGuiFocusRequestFlags.UnlessBelowModal) + ImGui.FocusWindow(nil, 2 --[[ImGuiFocusRequestFlags.UnlessBelowModal]]) end end -- With right mouse button we close popups without changing focus based on where the mouse is aimed -- Instead, focus will be restored to the window under the bottom-most closed popup. -- (The left mouse button path calls FocusWindow on the hovered window, which will lead NewFrame->ClosePopupsOverWindow to trigger) - if g.HoveredId == 0 and ImGui.IsMouseClickedEx(1, ImGuiInputFlags.None, ImGuiKeyOwner_NoOwner) then + if g.HoveredId == 0 and ImGui.IsMouseClickedEx(1, 0 --[[ImGuiInputFlags.None]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) then -- Find the top-most window between HoveredWindow and the top-most Modal Window. -- This is where we can trim the popup stack. local modal = ImGui.GetTopMostPopupModal() @@ -11702,9 +11736,9 @@ function ImGui.Begin(name, open, flags) local g = GImGui local style = g.Style - IM_ASSERT(name ~= nil and name ~= "") -- Window name required - IM_ASSERT(g.WithinFrameScope) -- Forgot to call ImGui.NewFrame() - IM_ASSERT(g.FrameCountEnded ~= g.FrameCount) -- Called ImGui.Render() or ImGui.EndFrame() and haven't called ImGui.NewFrame() again yet + assert(name ~= nil and name ~= "") -- Window name required + assert(g.WithinFrameScope) -- Forgot to call ImGui.NewFrame() + assert(g.FrameCountEnded ~= g.FrameCount) -- Called ImGui.Render() or ImGui.EndFrame() and haven't called ImGui.NewFrame() again yet -- Find or create local window = ImGui.FindWindowByName(name) @@ -11713,13 +11747,13 @@ function ImGui.Begin(name, open, flags) window = CreateNewWindow(name, flags) --- @cast window ImGuiWindow end - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasWindowFlags) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 256 --[[ImGuiNextWindowDataFlags.HasWindowFlags]]) ~= 0 then flags = bit32.band(bit32.bor(flags, g.NextWindowData.WindowFlagsSet), bit32.bnot(g.NextWindowData.WindowFlagsClear)) end -- Automatically disable manual moving/resizing when NoInputs is set - if bit32.band(flags, ImGuiWindowFlags.NoInputs) == ImGuiWindowFlags.NoInputs then - flags = bit32.bor(flags, ImGuiWindowFlags.NoMove, ImGuiWindowFlags.NoResize) + if bit32.band(flags, 197120 --[[ImGuiWindowFlags.NoInputs]]) == 197120 --[[ImGuiWindowFlags.NoInputs]] then + flags = bit32.bor(flags, 4 --[[ImGuiWindowFlags.NoMove]], 2 --[[ImGuiWindowFlags.NoResize]]) end local current_frame = g.FrameCount @@ -11728,7 +11762,7 @@ function ImGui.Begin(name, open, flags) -- Update the Appearing flag (note: the BeginDocked() path may also set this to true later) local window_just_activated_by_user = (window.LastFrameActive < (current_frame - 1)) -- Not using !WasActive because the implicit "Debug" window would always toggle off->on - if bit32.band(flags, ImGuiWindowFlags.Popup) ~= 0 then + if bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 then local popup_ref = g.OpenPopupStack.Data[g.BeginPopupStack.Size + 1] window_just_activated_by_user = window_just_activated_by_user or (window.PopupId ~= popup_ref.PopupId) -- We recycle popups so treat window as activated if popup id changed window_just_activated_by_user = window_just_activated_by_user or (window ~= popup_ref.Window) @@ -11740,11 +11774,11 @@ function ImGui.Begin(name, open, flags) ImGui.UpdateWindowInFocusOrderList(window, window_just_created, flags) window.Appearing = window_just_activated_by_user if (window.Appearing) then - SetWindowConditionAllowFlags(window, ImGuiCond.Appearing, true) + SetWindowConditionAllowFlags(window, 8 --[[ImGuiCond.Appearing]], true) end window.FlagsPreviousFrame = window.Flags window.Flags = flags - window.ChildFlags = (bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasChildFlags) ~= 0) and g.NextWindowData.ChildFlagsSet or 0 + window.ChildFlags = (bit32.band(g.NextWindowData.HasFlags, 512 --[[ImGuiNextWindowDataFlags.HasChildFlags]]) ~= 0) and g.NextWindowData.ChildFlagsSet or 0 window.LastFrameActive = current_frame window.LastTimeActive = g.Time window.BeginOrderWithinParent = 0 @@ -11756,8 +11790,8 @@ function ImGui.Begin(name, open, flags) -- Docking -- (NB: during the frame dock nodes are created, it is possible that (window->DockIsActive == false) even though (window->DockNode->Windows.Size > 1) - IM_ASSERT(window.DockNode == nil or window.DockNodeAsHost == nil) -- Cannot be both - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasDock) ~= 0 then + assert(window.DockNode == nil or window.DockNodeAsHost == nil) -- Cannot be both + if bit32.band(g.NextWindowData.HasFlags, 4096 --[[ImGuiNextWindowDataFlags.HasDock]]) ~= 0 then ImGui.SetWindowDock(window, g.NextWindowData.DockId, g.NextWindowData.DockCond) end if first_begin_of_the_frame then @@ -11773,14 +11807,14 @@ function ImGui.Begin(name, open, flags) open = ImGui.BeginDocked(window, open) flags = window.Flags if window.DockIsActive then - IM_ASSERT(window.DockNode ~= nil) - g.NextWindowData.HasFlags = bit32.band(g.NextWindowData.HasFlags, bit32.bnot(ImGuiNextWindowDataFlags.HasSizeConstraint)) -- Docking currently override constraints + assert(window.DockNode ~= nil) + g.NextWindowData.HasFlags = bit32.band(g.NextWindowData.HasFlags, bit32.bnot(16 --[[ImGuiNextWindowDataFlags.HasSizeConstraint]])) -- Docking currently override constraints end -- Amend the Appearing flag if window.DockTabIsVisible and not dock_tab_was_visible and dock_node_was_visible and not window.Appearing and not window_was_appearing then window.Appearing = true - SetWindowConditionAllowFlags(window, ImGuiCond.Appearing, true) + SetWindowConditionAllowFlags(window, 8 --[[ImGuiCond.Appearing]], true) end end end @@ -11796,7 +11830,7 @@ function ImGui.Begin(name, open, flags) end local parent_window if first_begin_of_the_frame then - if (bit32.band(flags, bit32.bor(ImGuiWindowFlags.ChildWindow, ImGuiWindowFlags.Popup, ImGuiWindowFlags.Tooltip)) ~= 0) then + if (bit32.band(flags, bit32.bor(16777216 --[[ImGuiWindowFlags.ChildWindow]], 67108864 --[[ImGuiWindowFlags.Popup]], 33554432 --[[ImGuiWindowFlags.Tooltip]])) ~= 0) then parent_window = parent_window_in_stack else parent_window = nil @@ -11817,12 +11851,12 @@ function ImGui.Begin(name, open, flags) local window_stack_data = g.CurrentWindowStack.Data[g.CurrentWindowStack.Size] window_stack_data.Window = window ImGuiLastItemData_Copy(window_stack_data.ParentLastItemDataBackup, g.LastItemData) - window_stack_data.DisabledOverrideReenable = (bit32.band(flags, ImGuiWindowFlags.Tooltip) ~= 0) and (bit32.band(g.CurrentItemFlags, ImGuiItemFlags.Disabled) ~= 0) + window_stack_data.DisabledOverrideReenable = (bit32.band(flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0) and (bit32.band(g.CurrentItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) ~= 0) window_stack_data.DisabledOverrideReenableAlphaBackup = 0.0 window_stack_data.StackSizesInBegin = ImGuiErrorRecoveryState() ImGui.ErrorRecoveryStoreState(window_stack_data.StackSizesInBegin) g.StackSizesInBeginForCurrentWindow = window_stack_data.StackSizesInBegin - if bit32.band(flags, ImGuiWindowFlags.ChildMenu) ~= 0 then + if bit32.band(flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0 then g.BeginMenuDepth = g.BeginMenuDepth + 1 end @@ -11840,7 +11874,7 @@ function ImGui.Begin(name, open, flags) window.ParentWindowForFocusRoute = nil end if window.ParentWindowForFocusRoute == nil and window.DockNode ~= nil then - if bit32.band(window.DockNode.MergedFlags, ImGuiDockNodeFlags.DockedWindowsInFocusRoute) ~= 0 then + if bit32.band(window.DockNode.MergedFlags, 262144 --[[ImGuiDockNodeFlags.DockedWindowsInFocusRoute]]) ~= 0 then window.ParentWindowForFocusRoute = window.DockNode.HostWindow end end @@ -11858,11 +11892,11 @@ function ImGui.Begin(name, open, flags) end -- Add to focus scope stack - ImGui.PushFocusScope((bit32.band(window.ChildFlags, ImGuiChildFlags.NavFlattened) ~= 0) and g.CurrentFocusScopeId or window.ID) + ImGui.PushFocusScope((bit32.band(window.ChildFlags, 256 --[[ImGuiChildFlags.NavFlattened]]) ~= 0) and g.CurrentFocusScopeId or window.ID) window.NavRootFocusScopeId = g.CurrentFocusScopeId -- Add to popup stacks: update OpenPopupStack[] data, push to BeginPopupStack[] - if bit32.band(flags, ImGuiWindowFlags.Popup) ~= 0 then + if bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 then local popup_ref = g.OpenPopupStack.Data[g.BeginPopupStack.Size + 1] popup_ref.Window = window popup_ref.ParentNavLayer = parent_window_in_stack.DC.NavLayerCurrent @@ -11875,30 +11909,30 @@ function ImGui.Begin(name, open, flags) local window_pos_set_by_api = false local window_size_x_set_by_api = false local window_size_y_set_by_api = false - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasPos) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 1 --[[ImGuiNextWindowDataFlags.HasPos]]) ~= 0 then window_pos_set_by_api = (bit32.band(window.SetWindowPosAllowFlags, g.NextWindowData.PosCond) ~= 0) if window_pos_set_by_api and ImLengthSqr(g.NextWindowData.PosPivotVal) > 1e-5 then -- May be processed on the next frame if this is our first frame and we are measuring size -- FIXME: Look into removing the branch so everything can go through this same code path for consistency. ImVec2_Copy(window.SetWindowPosVal, g.NextWindowData.PosVal) ImVec2_Copy(window.SetWindowPosPivot, g.NextWindowData.PosPivotVal) - window.SetWindowPosAllowFlags = bit32.band(window.SetWindowPosAllowFlags, bit32.bnot(bit32.bor(ImGuiCond.Once, ImGuiCond.FirstUseEver, ImGuiCond.Appearing))) + window.SetWindowPosAllowFlags = bit32.band(window.SetWindowPosAllowFlags, bit32.bnot(bit32.bor(2 --[[ImGuiCond.Once]], 4 --[[ImGuiCond.FirstUseEver]], 8 --[[ImGuiCond.Appearing]]))) else ImGui.SetWindowPos(window, g.NextWindowData.PosVal, g.NextWindowData.PosCond) end end - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasSize) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 2 --[[ImGuiNextWindowDataFlags.HasSize]]) ~= 0 then window_size_x_set_by_api = (bit32.band(window.SetWindowSizeAllowFlags, g.NextWindowData.SizeCond) ~= 0) and (g.NextWindowData.SizeVal.x > 0.0) window_size_y_set_by_api = (bit32.band(window.SetWindowSizeAllowFlags, g.NextWindowData.SizeCond) ~= 0) and (g.NextWindowData.SizeVal.y > 0.0) - if (bit32.band(window.ChildFlags, ImGuiChildFlags.ResizeX) ~= 0 and bit32.band(window.SetWindowSizeAllowFlags, ImGuiCond.FirstUseEver) == 0) then -- Axis-specific conditions for BeginChild() + if (bit32.band(window.ChildFlags, 4 --[[ImGuiChildFlags.ResizeX]]) ~= 0 and bit32.band(window.SetWindowSizeAllowFlags, 4 --[[ImGuiCond.FirstUseEver]]) == 0) then -- Axis-specific conditions for BeginChild() g.NextWindowData.SizeVal.x = window.SizeFull.x end - if (bit32.band(window.ChildFlags, ImGuiChildFlags.ResizeY) ~= 0 and bit32.band(window.SetWindowSizeAllowFlags, ImGuiCond.FirstUseEver) == 0) then + if (bit32.band(window.ChildFlags, 8 --[[ImGuiChildFlags.ResizeY]]) ~= 0 and bit32.band(window.SetWindowSizeAllowFlags, 4 --[[ImGuiCond.FirstUseEver]]) == 0) then g.NextWindowData.SizeVal.y = window.SizeFull.y end ImGui.SetWindowSize(window, g.NextWindowData.SizeVal, g.NextWindowData.SizeCond); end - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasScroll) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 128 --[[ImGuiNextWindowDataFlags.HasScroll]]) ~= 0 then if g.NextWindowData.ScrollVal.x >= 0.0 then window.ScrollTarget.x = g.NextWindowData.ScrollVal.x window.ScrollTargetCenterRatio.x = 0.0 @@ -11908,22 +11942,22 @@ function ImGui.Begin(name, open, flags) window.ScrollTargetCenterRatio.y = 0.0 end end - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasContentSize) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 4 --[[ImGuiNextWindowDataFlags.HasContentSize]]) ~= 0 then ImVec2_Copy(window.ContentSizeExplicit, g.NextWindowData.ContentSizeVal) elseif first_begin_of_the_frame then window.ContentSizeExplicit = ImVec2(0.0, 0.0) end - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasWindowClass) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 8192 --[[ImGuiNextWindowDataFlags.HasWindowClass]]) ~= 0 then window.WindowClass = g.NextWindowData.WindowClass end - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasCollapsed) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 8 --[[ImGuiNextWindowDataFlags.HasCollapsed]]) ~= 0 then ImGui.SetWindowCollapsed(window, g.NextWindowData.CollapsedVal, g.NextWindowData.CollapsedCond) end - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasFocus) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 32 --[[ImGuiNextWindowDataFlags.HasFocus]]) ~= 0 then ImGui.FocusWindow(window) end if window.Appearing then - SetWindowConditionAllowFlags(window, ImGuiCond.Appearing, false) + SetWindowConditionAllowFlags(window, 8 --[[ImGuiCond.Appearing]], false) end -- [EXPERIMENTAL] Skip Refresh mode @@ -11940,18 +11974,18 @@ function ImGui.Begin(name, open, flags) -- When reusing window again multiple times a frame, just append content (don't need to setup again) if first_begin_of_the_frame and not window.SkipRefresh then -- Initialize - local window_is_child_tooltip = (bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0 and bit32.band(flags, ImGuiWindowFlags.Tooltip) ~= 0) -- FIXME-WIP: Undocumented behavior of Child+Tooltip for pinned tooltip (#1345) + local window_is_child_tooltip = (bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 and bit32.band(flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0) -- FIXME-WIP: Undocumented behavior of Child+Tooltip for pinned tooltip (#1345) local window_just_appearing_after_hidden_for_resize = (window.HiddenFramesCannotSkipItems > 0) window.Active = true window.HasCloseButton = (open ~= nil) - ImRect_CopyFromV4(window.ClipRect, ImVec4(-FLT_MAX, -FLT_MAX, FLT_MAX, FLT_MAX)) + ImRect_CopyFromV4(window.ClipRect, ImVec4(-3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]])) window.IDStack:resize(1) window.DrawList:_ResetForNewFrame() window.DC.CurrentTableIdx = -1 - if bit32.band(flags, ImGuiWindowFlags.DockNodeHost) ~= 0 then + if bit32.band(flags, 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) ~= 0 then window.DrawList:ChannelsSplit(2) window.DrawList:ChannelsSetCurrent(1) -- DOCKING_HOST_DRAW_CHANNEL_FG: Render decorations on channel 1 as we will render the backgrounds manually later end @@ -11986,9 +12020,9 @@ function ImGui.Begin(name, open, flags) -- Hide popup/tooltip window when re-opening while we measure size (because we recycle the windows) -- We reset Size/ContentSize for reappearing popups/tooltips early in this function, so further code won't be tempted to use the old size. - if window_just_activated_by_user and bit32.band(flags, bit32.bor(ImGuiWindowFlags.Popup, ImGuiWindowFlags.Tooltip)) ~= 0 then + if window_just_activated_by_user and bit32.band(flags, bit32.bor(67108864 --[[ImGuiWindowFlags.Popup]], 33554432 --[[ImGuiWindowFlags.Tooltip]])) ~= 0 then window.HiddenFramesCannotSkipItems = 1 - if bit32.band(flags, ImGuiWindowFlags.AlwaysAutoResize) ~= 0 then + if bit32.band(flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) ~= 0 then if not window_size_x_set_by_api then window.SizeFull.x = 0.0 window.Size.x = 0.0 @@ -12013,14 +12047,14 @@ function ImGui.Begin(name, open, flags) -- LOCK BORDER SIZE AND PADDING FOR THE FRAME (so that altering them doesn't cause inconsistencies) -- We read Style data after the call to UpdateSelectWindowViewport() which might be swapping the style. - if not window.DockIsActive and bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0 then + if not window.DockIsActive and bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 then window.WindowBorderSize = style.ChildBorderSize else - window.WindowBorderSize = (bit32.band(flags, bit32.bor(ImGuiWindowFlags.Popup, ImGuiWindowFlags.Tooltip)) ~= 0 and bit32.band(flags, ImGuiWindowFlags.Modal) == 0) and style.PopupBorderSize or style.WindowBorderSize + window.WindowBorderSize = (bit32.band(flags, bit32.bor(67108864 --[[ImGuiWindowFlags.Popup]], 33554432 --[[ImGuiWindowFlags.Tooltip]])) ~= 0 and bit32.band(flags, 134217728 --[[ImGuiWindowFlags.Modal]]) == 0) and style.PopupBorderSize or style.WindowBorderSize end window.WindowPadding = style.WindowPadding - if not window.DockIsActive and (bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0) and (bit32.band(flags, ImGuiWindowFlags.Popup) == 0) and (bit32.band(window.ChildFlags, ImGuiChildFlags.AlwaysUseWindowPadding) == 0) and window.WindowBorderSize == 0.0 then - if bit32.band(flags, ImGuiWindowFlags.MenuBar) ~= 0 then + if not window.DockIsActive and (bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0) and (bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) == 0) and (bit32.band(window.ChildFlags, 2 --[[ImGuiChildFlags.AlwaysUseWindowPadding]]) == 0) and window.WindowBorderSize == 0.0 then + if bit32.band(flags, 1024 --[[ImGuiWindowFlags.MenuBar]]) ~= 0 then window.WindowPadding = ImVec2(0.0, style.WindowPadding.y) else window.WindowPadding = ImVec2(0.0, 0.0) @@ -12031,19 +12065,19 @@ function ImGui.Begin(name, open, flags) window.DC.MenuBarOffset.x = ImMax(ImMax(window.WindowPadding.x, style.ItemSpacing.x), g.NextWindowData.MenuBarOffsetMinVal.x) window.DC.MenuBarOffset.y = g.NextWindowData.MenuBarOffsetMinVal.y - if bit32.band(flags, ImGuiWindowFlags.NoTitleBar) ~= 0 then + if bit32.band(flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) ~= 0 then window.TitleBarHeight = 0.0 else window.TitleBarHeight = g.FontSize + g.Style.FramePadding.y * 2.0 end - if bit32.band(flags, ImGuiWindowFlags.MenuBar) ~= 0 then + if bit32.band(flags, 1024 --[[ImGuiWindowFlags.MenuBar]]) ~= 0 then window.MenuBarHeight = window.DC.MenuBarOffset.y + g.FontSize + g.Style.FramePadding.y * 2.0 else window.MenuBarHeight = 0.0 end - window.TitleBarHeight = (bit32.band(flags, ImGuiWindowFlags.NoTitleBar) ~= 0) and 0 or g.FontSize + g.Style.FramePadding.y * 2 + window.TitleBarHeight = (bit32.band(flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) ~= 0) and 0 or g.FontSize + g.Style.FramePadding.y * 2 window.FontRefSize = g.FontSize -- Lock this to discourage calling window:CalcFontSize() outside of current window. @@ -12060,14 +12094,14 @@ function ImGui.Begin(name, open, flags) -- Collapse window by double-clicking on title bar -- At this point we don't have a clipping rectangle setup yet, so we can use the title bar area for hit detection and drawing - if bit32.band(flags, ImGuiWindowFlags.NoTitleBar) == 0 and bit32.band(flags, ImGuiWindowFlags.NoCollapse) == 0 and not window.DockIsActive then + if bit32.band(flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) == 0 and bit32.band(flags, 32 --[[ImGuiWindowFlags.NoCollapse]]) == 0 and not window.DockIsActive then -- We don't use a regular button+id to test for double-click on title bar (mostly due to legacy reason, could be fixed), -- so verify that we don't have items over the title bar. local title_bar_rect = window:TitleBarRect() if g.HoveredWindow == window and g.HoveredId == 0 and g.HoveredIdPreviousFrame == 0 and g.ActiveId == 0 and ImGui.IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max) then - if g.IO.MouseClickedCount[0] == 2 and ImGui.GetKeyOwner(ImGuiKey.MouseLeft) == ImGuiKeyOwner_NoOwner then + if g.IO.MouseClickedCount[0] == 2 and ImGui.GetKeyOwner(656 --[[ImGuiKey.MouseLeft]]) == 4294967295 --[[ImGuiKeyOwner_NoOwner]] then window.WantCollapseToggle = true - ImGui.SetKeyOwner(ImGuiKey.MouseLeft, window.MoveId) -- Claim input the same way ButtonBehavior() does. Prevent a same-frame move from triggering other items. (#9439) + ImGui.SetKeyOwner(656 --[[ImGuiKey.MouseLeft]], window.MoveId) -- Claim input the same way ButtonBehavior() does. Prevent a same-frame move from triggering other items. (#9439) end end if window.WantCollapseToggle then @@ -12100,17 +12134,17 @@ function ImGui.Begin(name, open, flags) -- - We still process initial auto-fit on collapsed windows to get a window width, but otherwise don't honor ImGuiWindowFlags.AlwaysAutoResize when collapsed. -- - Auto-fit may only grow window during the first few frames. do - local size_auto_fit_x_always = not window_size_x_set_by_api and (bit32.band(flags, ImGuiWindowFlags.AlwaysAutoResize) ~= 0) and not window.Collapsed - local size_auto_fit_y_always = not window_size_y_set_by_api and (bit32.band(flags, ImGuiWindowFlags.AlwaysAutoResize) ~= 0) and not window.Collapsed + local size_auto_fit_x_always = not window_size_x_set_by_api and (bit32.band(flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) ~= 0) and not window.Collapsed + local size_auto_fit_y_always = not window_size_y_set_by_api and (bit32.band(flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) ~= 0) and not window.Collapsed local size_auto_fit_x_current = not window_size_x_set_by_api and (window.AutoFitFramesX > 0) local size_auto_fit_y_current = not window_size_y_set_by_api and (window.AutoFitFramesY > 0) local size_auto_fit_mask = 0 if size_auto_fit_x_always or size_auto_fit_x_current then - size_auto_fit_mask = bit32.bor(size_auto_fit_mask, bit32.lshift(1, ImGuiAxis.X - 1)) + size_auto_fit_mask = bit32.bor(size_auto_fit_mask, bit32.lshift(1, 1 --[[ImGuiAxis.X]] - 1)) end if size_auto_fit_y_always or size_auto_fit_y_current then - size_auto_fit_mask = bit32.bor(size_auto_fit_mask, bit32.lshift(1, ImGuiAxis.Y - 1)) + size_auto_fit_mask = bit32.bor(size_auto_fit_mask, bit32.lshift(1, 2 --[[ImGuiAxis.Y]] - 1)) end local size_auto_fit = CalcWindowAutoFitSize(window, window.ContentSizeIdeal, size_auto_fit_mask) @@ -12148,45 +12182,45 @@ function ImGui.Begin(name, open, flags) -- Apply minimum/maximum window size constraints and final size ImVec2_Copy(window.SizeFull, CalcWindowSizeAfterConstraint(window, window.SizeFull)) - ImVec2_Copy(window.Size, (window.Collapsed and bit32.band(flags, ImGuiWindowFlags.ChildWindow) == 0) and window:TitleBarRect():GetSize() or window.SizeFull) + ImVec2_Copy(window.Size, (window.Collapsed and bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0) and window:TitleBarRect():GetSize() or window.SizeFull) -- POSITION -- Popup latch its initial position, will position itself when it appears next frame if window_just_activated_by_user then - window.AutoPosLastDirection = ImGuiDir.None - if bit32.band(flags, ImGuiWindowFlags.Popup) ~= 0 and bit32.band(flags, ImGuiWindowFlags.Modal) == 0 and not window_pos_set_by_api then -- FIXME: BeginPopup() could use SetNextWindowPos() + window.AutoPosLastDirection = (-1) --[[ImGuiDir.None]] + if bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 and bit32.band(flags, 134217728 --[[ImGuiWindowFlags.Modal]]) == 0 and not window_pos_set_by_api then -- FIXME: BeginPopup() could use SetNextWindowPos() ImVec2_Copy(window.Pos, g.BeginPopupStack:back().OpenPopupPos) end end -- Position child window - if bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0 then - IM_ASSERT(parent_window and parent_window.Active) + if bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 then + assert(parent_window and parent_window.Active) window.BeginOrderWithinParent = parent_window.DC.ChildWindows.Size parent_window.DC.ChildWindows:push_back(window) - if (bit32.band(flags, ImGuiWindowFlags.Popup) == 0) and not window_pos_set_by_api and not window_is_child_tooltip then + if (bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) == 0) and not window_pos_set_by_api and not window_is_child_tooltip then ImVec2_Copy(window.Pos, parent_window.DC.CursorPos) end end - local window_pos_with_pivot = (window.SetWindowPosVal.x ~= FLT_MAX and window.HiddenFramesCannotSkipItems == 0) + local window_pos_with_pivot = (window.SetWindowPosVal.x ~= 3.4028234663853e+38 --[[FLT_MAX]] and window.HiddenFramesCannotSkipItems == 0) if window_pos_with_pivot then ImGui.SetWindowPos(window, window.SetWindowPosVal - window.Size * window.SetWindowPosPivot, 0) -- Position given a pivot (e.g. for centering) - elseif (bit32.band(flags, ImGuiWindowFlags.ChildMenu) ~= 0) then + elseif (bit32.band(flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0) then ImVec2_Copy(window.Pos, ImGui.FindBestWindowPosForPopup(window)) - elseif (bit32.band(flags, ImGuiWindowFlags.Popup) ~= 0) and not window_pos_set_by_api and window_just_appearing_after_hidden_for_resize then + elseif (bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0) and not window_pos_set_by_api and window_just_appearing_after_hidden_for_resize then ImVec2_Copy(window.Pos, ImGui.FindBestWindowPosForPopup(window)) - elseif (bit32.band(flags, ImGuiWindowFlags.Tooltip) ~= 0) and not window_pos_set_by_api and not window_is_child_tooltip then + elseif (bit32.band(flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0) and not window_pos_set_by_api and not window_is_child_tooltip then ImVec2_Copy(window.Pos, ImGui.FindBestWindowPosForPopup(window)) end -- Late create viewport if we don't fit within our current host viewport. - if window.ViewportAllowPlatformMonitorExtend >= 0 and not window.ViewportOwned and bit32.band(window.Viewport.Flags, ImGuiViewportFlags.IsMinimized) == 0 then + if window.ViewportAllowPlatformMonitorExtend >= 0 and not window.ViewportOwned and bit32.band(window.Viewport.Flags, 4096 --[[ImGuiViewportFlags.IsMinimized]]) == 0 then if not window.Viewport:GetMainRect():Contains(window:Rect()) then -- This is based on the assumption that the DPI will be known ahead (same as the DPI of the selection done in UpdateSelectWindowViewport) -- local old_viewport = window.Viewport - window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.Pos, window.Size, ImGuiViewportFlags.NoFocusOnAppearing) + window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.Pos, window.Size, 32 --[[ImGuiViewportFlags.NoFocusOnAppearing]]) -- FIXME-DPI -- IM_ASSERT(old_viewport.DpiScale == window.Viewport.DpiScale) -- FIXME-DPI: Something went wrong @@ -12209,10 +12243,10 @@ function ImGui.Begin(name, open, flags) -- Clamp position/size so window stays visible within its viewport or monitor -- Ignore zero-sized display explicitly to avoid losing positions if a window manager reports zero-sized window when initializing or minimizing. -- FIXME: Similar to code in GetWindowAllowedExtentRect() - if not window_pos_set_by_api and bit32.band(flags, ImGuiWindowFlags.ChildWindow) == 0 then + if not window_pos_set_by_api and bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0 then if not window.ViewportOwned and viewport_rect:GetWidth() > 0 and viewport_rect:GetHeight() > 0.0 then local size_for_clamping_y = window.Size.y - if bit32.band(window.BgClickFlags, ImGuiWindowBgClickFlags.Move) == 0 and bit32.band(window.Flags, ImGuiWindowFlags.NoTitleBar) == 0 then + if bit32.band(window.BgClickFlags, 1 --[[ImGuiWindowBgClickFlags.Move]]) == 0 and bit32.band(window.Flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) == 0 then size_for_clamping_y = window.TitleBarHeight end window.Pos.x = ImClamp(window.Pos.x, visibility_rect.Min.x - window.Size.x, visibility_rect.Max.x) @@ -12223,22 +12257,22 @@ function ImGui.Begin(name, open, flags) -- Apply window focus (new and reactivated windows are moved to front) local want_focus = false - if (window_just_activated_by_user and bit32.band(flags, ImGuiWindowFlags.NoFocusOnAppearing) == 0) then - if bit32.band(flags, ImGuiWindowFlags.Popup) ~= 0 then + if (window_just_activated_by_user and bit32.band(flags, 4096 --[[ImGuiWindowFlags.NoFocusOnAppearing]]) == 0) then + if bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 then want_focus = true - elseif (window.DockIsActive or bit32.band(flags, ImGuiWindowFlags.ChildWindow) == 0) and bit32.band(flags, ImGuiWindowFlags.Tooltip) == 0 then + elseif (window.DockIsActive or bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0) and bit32.band(flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) == 0 then want_focus = true end end -- Lock window rounding for the frame (so that altering them doesn't cause inconsistencies) -- Large values tend to lead to variety of artifacts and are not recommended. - if bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0 and not window.DockIsActive then + if bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 and not window.DockIsActive then window.WindowRounding = style.ChildRounding elseif window.RootWindowDockTree.ViewportOwned then window.WindowRounding = 0.0 else - if (bit32.band(flags, ImGuiWindowFlags.Popup) ~= 0 and bit32.band(flags, ImGuiWindowFlags.Modal) == 0) then + if (bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 and bit32.band(flags, 134217728 --[[ImGuiWindowFlags.Modal]]) == 0) then window.WindowRounding = style.PopupRounding else window.WindowRounding = style.WindowRounding @@ -12249,7 +12283,7 @@ function ImGui.Begin(name, open, flags) -- 'window.SkipItems' is not updated yet so for child windows we rely on ParentWindow to avoid submitting decorations. (#8815) -- Whenever we add support for full decorated child windows we will likely make this logic more general. local handle_borders_and_resize_grips = (window.DockNodeAsHost ~= nil or not window.DockIsActive) - if bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0 and window.ParentWindow.SkipItems then + if bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 and window.ParentWindow.SkipItems then handle_borders_and_resize_grips = false end @@ -12259,8 +12293,8 @@ function ImGui.Begin(name, open, flags) local resize_grip_col = {0, 0, 0, 0} local resize_grip_count - if (bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0) and (bit32.band(flags, ImGuiWindowFlags.Popup) == 0) then - if (bit32.band(window.ChildFlags, ImGuiChildFlags.ResizeX) ~= 0) and (bit32.band(window.ChildFlags, ImGuiChildFlags.ResizeY) ~= 0) then + if (bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0) and (bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) == 0) then + if (bit32.band(window.ChildFlags, 4 --[[ImGuiChildFlags.ResizeX]]) ~= 0) and (bit32.band(window.ChildFlags, 8 --[[ImGuiChildFlags.ResizeY]]) ~= 0) then resize_grip_count = 1 else resize_grip_count = 0 @@ -12274,10 +12308,10 @@ function ImGui.Begin(name, open, flags) local auto_fit_mask auto_fit_mask, border_hovered, border_held = UpdateWindowManualResize(window, resize_grip_count, resize_grip_col, visibility_rect) if auto_fit_mask ~= 0 then - if bit32.band(auto_fit_mask, bit32.lshift(1, ImGuiAxis.X - 1)) ~= 0 then + if bit32.band(auto_fit_mask, bit32.lshift(1, 1 --[[ImGuiAxis.X]] - 1)) ~= 0 then use_current_size_for_scrollbar_x = true end - if bit32.band(auto_fit_mask, bit32.lshift(1, ImGuiAxis.Y - 1)) ~= 0 then + if bit32.band(auto_fit_mask, bit32.lshift(1, 2 --[[ImGuiAxis.Y]] - 1)) ~= 0 then use_current_size_for_scrollbar_y = true end end @@ -12317,8 +12351,8 @@ function ImGui.Begin(name, open, flags) local scrollbar_x_prev = window.ScrollbarX -- local scrollbar_y_from_last_frame = window.ScrollbarY -- FIXME: May want to use that in the ScrollbarX expression? How many pros vs cons? - window.ScrollbarY = (bit32.band(flags, ImGuiWindowFlags.AlwaysVerticalScrollbar) ~= 0) or ((needed_size_from_last_frame.y > size_for_scrollbars_y) and not (bit32.band(flags, ImGuiWindowFlags.NoScrollbar) ~= 0)) - window.ScrollbarX = (bit32.band(flags, ImGuiWindowFlags.AlwaysHorizontalScrollbar) ~= 0) or ((needed_size_from_last_frame.x > size_for_scrollbars_x - (window.ScrollbarY and style.ScrollbarSize or 0.0)) and not (bit32.band(flags, ImGuiWindowFlags.NoScrollbar) ~= 0) and (bit32.band(flags, ImGuiWindowFlags.HorizontalScrollbar) ~= 0)) + window.ScrollbarY = (bit32.band(flags, 16384 --[[ImGuiWindowFlags.AlwaysVerticalScrollbar]]) ~= 0) or ((needed_size_from_last_frame.y > size_for_scrollbars_y) and not (bit32.band(flags, 8 --[[ImGuiWindowFlags.NoScrollbar]]) ~= 0)) + window.ScrollbarX = (bit32.band(flags, 32768 --[[ImGuiWindowFlags.AlwaysHorizontalScrollbar]]) ~= 0) or ((needed_size_from_last_frame.x > size_for_scrollbars_x - (window.ScrollbarY and style.ScrollbarSize or 0.0)) and not (bit32.band(flags, 8 --[[ImGuiWindowFlags.NoScrollbar]]) ~= 0) and (bit32.band(flags, 2048 --[[ImGuiWindowFlags.HorizontalScrollbar]]) ~= 0)) -- Track when ScrollbarX visibility keeps toggling, which is a sign of a feedback loop, and stabilize by enforcing visibility (#3285, #8488) -- (Feedback loops of this sort can manifest in various situations, but combining horizontal + vertical scrollbar + using a clipper with varying width items is one frequent cause. @@ -12339,7 +12373,7 @@ function ImGui.Begin(name, open, flags) window.ScrollbarXStabilizeEnabled = scrollbar_x_stabilize if window.ScrollbarX and not window.ScrollbarY then - window.ScrollbarY = (needed_size_from_last_frame.y > size_for_scrollbars_y - style.ScrollbarSize) and not (bit32.band(flags, ImGuiWindowFlags.NoScrollbar) ~= 0) + window.ScrollbarY = (needed_size_from_last_frame.y > size_for_scrollbars_y - style.ScrollbarSize) and not (bit32.band(flags, 8 --[[ImGuiWindowFlags.NoScrollbar]]) ~= 0) end window.ScrollbarSizes = ImVec2(window.ScrollbarY and style.ScrollbarSize or 0.0, window.ScrollbarX and style.ScrollbarSize or 0.0) @@ -12359,7 +12393,7 @@ function ImGui.Begin(name, open, flags) -- - Begin() initial clipping rect for drawing window background and borders. -- - Begin() clipping whole child local host_rect - if (bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0 and bit32.band(flags, ImGuiWindowFlags.Popup) == 0 and not window_is_child_tooltip) then + if (bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 and bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) == 0 and not window_is_child_tooltip) then host_rect = parent_window.ClipRect else host_rect = viewport_rect @@ -12392,7 +12426,7 @@ function ImGui.Begin(name, open, flags) -- Note that if our window is collapsed we will end up with an inverted (~null) clipping rectangle which is the correct behavior. -- Affected by window/frame border size. Used by: -- - Begin() initial clip rect - local top_border_size = ((bit32.band(flags, ImGuiWindowFlags.MenuBar) ~= 0 or bit32.band(flags, ImGuiWindowFlags.NoTitleBar) == 0) and style.FrameBorderSize or window.WindowBorderSize) + local top_border_size = ((bit32.band(flags, 1024 --[[ImGuiWindowFlags.MenuBar]]) ~= 0 or bit32.band(flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) == 0) and style.FrameBorderSize or window.WindowBorderSize) -- Try to match the fact that our border is drawn centered over the window rectangle, rather than inner. -- This is why we do a *0.5 here. We don't currently even technically support large values for WindowBorderSize, @@ -12413,13 +12447,13 @@ function ImGui.Begin(name, open, flags) -- Apply scrolling ImVec2_Copy(window.Scroll, CalcNextScrollFromScrollTargetAndClamp(window)) - ImVec2_CopyV(window.ScrollTarget, FLT_MAX, FLT_MAX) + ImVec2_CopyV(window.ScrollTarget, 3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]) window.DecoInnerSizeX1 = 0.0; window.DecoInnerSizeY1 = 0.0 -- DRAWING -- Setup draw list and outer clipping rectangle - IM_ASSERT(window.DrawList.CmdBuffer.Size == 1 and window.DrawList.CmdBuffer.Data[1].ElemCount == 0) + assert(window.DrawList.CmdBuffer.Size == 1 and window.DrawList.CmdBuffer.Data[1].ElemCount == 0) window.DrawList:PushTexture(g.Font.OwnerAtlas.TexRef) ImGui.PushClipRect(host_rect.Min, host_rect.Max, false) @@ -12429,7 +12463,7 @@ function ImGui.Begin(name, open, flags) local is_undocked_or_docked_visible = not window.DockIsActive or window.DockTabIsVisible if is_undocked_or_docked_visible then local render_decorations_in_parent = false - if (bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0) and (bit32.band(flags, ImGuiWindowFlags.Popup) == 0) and not window_is_child_tooltip then + if (bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0) and (bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) == 0) and not window_is_child_tooltip then -- - We test overlap with the previous child window only (testing all would end up being O(log N) not a good investment here) -- - We disable this when the parent window has zero vertices, which is a common pattern leading to laying out multiple overlapping childs local previous_child @@ -12472,8 +12506,8 @@ function ImGui.Begin(name, open, flags) -- - Columns() for right-most edge -- - TreeNode(), CollapsingHeader() for right-most edge -- - BeginTabBar() for right-most edge - local allow_scrollbar_x = (bit32.band(flags, ImGuiWindowFlags.NoScrollbar) == 0) and (bit32.band(flags, ImGuiWindowFlags.HorizontalScrollbar) ~= 0) - local allow_scrollbar_y = (bit32.band(flags, ImGuiWindowFlags.NoScrollbar) == 0) + local allow_scrollbar_x = (bit32.band(flags, 8 --[[ImGuiWindowFlags.NoScrollbar]]) == 0) and (bit32.band(flags, 2048 --[[ImGuiWindowFlags.HorizontalScrollbar]]) ~= 0) + local allow_scrollbar_y = (bit32.band(flags, 8 --[[ImGuiWindowFlags.NoScrollbar]]) == 0) local work_rect_size_x if window.ContentSizeExplicit.x ~= 0.0 then @@ -12532,7 +12566,7 @@ function ImGui.Begin(name, open, flags) window.DC.IsSameLine = false window.DC.IsSetPos = false - window.DC.NavLayerCurrent = ImGuiNavLayer.Main + window.DC.NavLayerCurrent = 0 --[[ImGuiNavLayer.Main]] window.DC.NavLayersActiveMask = window.DC.NavLayersActiveMaskNext window.DC.NavLayersActiveMaskNext = 0x00 window.DC.NavIsScrollPushableX = true @@ -12547,16 +12581,16 @@ function ImGui.Begin(name, open, flags) window.DC.ChildWindows:resize(0) window.DC.StateStorage = window.StateStorage window.DC.CurrentColumns = nil - window.DC.LayoutType = ImGuiLayoutType.Vertical - window.DC.ParentLayoutType = (parent_window ~= nil) and parent_window.DC.LayoutType or ImGuiLayoutType.Vertical + window.DC.LayoutType = 1 --[[ImGuiLayoutType.Vertical]] + window.DC.ParentLayoutType = (parent_window ~= nil) and parent_window.DC.LayoutType or 1 --[[ImGuiLayoutType.Vertical]] -- Default item width. Make it proportional to window size if window can be manually resized. -- (we cannot use AutoFitFramesX/AutoFitFramesY which is a temporary state) local is_resizable_width - if bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0 and not window.DockIsActive then - is_resizable_width = (window.Size.x > 0.0) and (bit32.band(window.ChildFlags, bit32.bor(ImGuiChildFlags.AutoResizeX, ImGuiChildFlags.AlwaysAutoResize)) == 0) + if bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 and not window.DockIsActive then + is_resizable_width = (window.Size.x > 0.0) and (bit32.band(window.ChildFlags, bit32.bor(16 --[[ImGuiChildFlags.AutoResizeX]], 64 --[[ImGuiChildFlags.AlwaysAutoResize]])) == 0) else - is_resizable_width = (window.Size.x > 0.0) and (bit32.band(flags, ImGuiWindowFlags.AlwaysAutoResize) == 0) + is_resizable_width = (window.Size.x > 0.0) and (bit32.band(flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) == 0) end if is_resizable_width then @@ -12568,8 +12602,8 @@ function ImGui.Begin(name, open, flags) window.DC.ItemWidthStack:resize(0) window.DC.TextWrapPos = -1.0 -- Disabled window.DC.TextWrapPosStack:resize(0) - if bit32.band(flags, ImGuiWindowFlags.Modal) ~= 0 then - window.DC.ModalDimBgColor = ImGui.ColorConvertFloat4ToU32(ImGui.GetStyleColorVec4(ImGuiCol.ModalWindowDimBg)) + if bit32.band(flags, 134217728 --[[ImGuiWindowFlags.Modal]]) ~= 0 then + window.DC.ModalDimBgColor = ImGui.ColorConvertFloat4ToU32(ImGui.GetStyleColorVec4(62 --[[ImGuiCol.ModalWindowDimBg]])) end if window.AutoFitFramesX > 0 then @@ -12587,7 +12621,7 @@ function ImGui.Begin(name, open, flags) -- - Avoid focusing a window that is created outside of a modal. This will prevent active modal from being closed. -- - Position window behind the modal that is not a begin-parent of this window. if want_focus then - ImGui.FocusWindow(window, ImGuiFocusRequestFlags.UnlessBelowModal) + ImGui.FocusWindow(window, 2 --[[ImGuiFocusRequestFlags.UnlessBelowModal]]) end if want_focus and window == g.NavWindow then ImGui.NavInitWindow(window, false) -- <-- this is in the way for us to be able to defer and sort reappearing FocusWindow() calls @@ -12597,36 +12631,36 @@ function ImGui.Begin(name, open, flags) -- [EXPERIMENTAL] Breaks on nested Begin/End pairs. We need to work that out and add better logging scope. -- [EXPERIMENTAL] Text outputs has many issues. if g.IO.ConfigWindowsCopyContentsWithCtrlC then - if g.NavWindow and g.NavWindow.RootWindow == window and g.ActiveId == 0 and ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.C)) then + if g.NavWindow and g.NavWindow.RootWindow == window and g.ActiveId == 0 and ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 548 --[[ImGuiKey.C]])) then ImGui.LogToClipboard(0) end end -- Title bar - if bit32.band(flags, ImGuiWindowFlags.NoTitleBar) == 0 and not window.DockIsActive then + if bit32.band(flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) == 0 and not window.DockIsActive then open = RenderWindowTitleBarContents(window, ImRect(title_bar_rect.Min.x + window.WindowBorderSize, title_bar_rect.Min.y, title_bar_rect.Max.x - window.WindowBorderSize, title_bar_rect.Max.y), name, open) - elseif bit32.band(flags, ImGuiWindowFlags.NoTitleBar) == 0 and window.DockIsActive then + elseif bit32.band(flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) == 0 and window.DockIsActive then ImGui.LogText("%s\n", string.sub(window.Name, 1, ImGui.FindRenderedTextEnd(window.Name) - 1)) end -- Clear hit test shape every frame window.HitTestHoleSize.x = 0; window.HitTestHoleSize.y = 0 - if bit32.band(flags, ImGuiWindowFlags.Tooltip) ~= 0 then + if bit32.band(flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0 then g.TooltipPreviousWindow = window end - if bit32.band(g.IO.ConfigFlags, ImGuiConfigFlags.DockingEnable) ~= 0 then + if bit32.band(g.IO.ConfigFlags, 128 --[[ImGuiConfigFlags.DockingEnable]]) ~= 0 then -- Docking: Dragging a dockable window (or any of its child) turns it into a drag and drop source. -- We need to do this _before_ we overwrite window.DC.LastItemId below because BeginDockableDragDropSource() also overwrites it. - if g.MovingWindow == window and bit32.band(window.RootWindowDockTree.Flags, ImGuiWindowFlags.NoDocking) == 0 then + if g.MovingWindow == window and bit32.band(window.RootWindowDockTree.Flags, 524288 --[[ImGuiWindowFlags.NoDocking]]) == 0 then ImGui.BeginDockableDragDropSource(window) end -- Docking: Any dockable window can act as a target. For dock node hosts we call BeginDockableDragDropTarget() in DockNodeUpdate() instead. - if g.DragDropActive and bit32.band(flags, ImGuiWindowFlags.NoDocking) == 0 then + if g.DragDropActive and bit32.band(flags, 524288 --[[ImGuiWindowFlags.NoDocking]]) == 0 then if g.MovingWindow == nil or g.MovingWindow.RootWindowDockTree ~= window then - if window == window.RootWindowDockTree and bit32.band(window.Flags, ImGuiWindowFlags.DockNodeHost) == 0 then + if window == window.RootWindowDockTree and bit32.band(window.Flags, 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) == 0 then ImGui.BeginDockableDragDropTarget(window) end end @@ -12636,18 +12670,18 @@ function ImGui.Begin(name, open, flags) -- Set default BgClickFlags -- This is set at the end of this function, so UpdateWindowManualResize()/ClampWindowPos() may use last-frame value if overridden by user code. -- FIXME: The general intent is that we will later expose config options to default to enable scrolling + select scrolling mouse button. - if bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0 then + if bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 then window.BgClickFlags = parent_window.BgClickFlags else - window.BgClickFlags = g.IO.ConfigWindowsMoveFromTitleBarOnly and ImGuiWindowBgClickFlags.None or ImGuiWindowBgClickFlags.Move + window.BgClickFlags = g.IO.ConfigWindowsMoveFromTitleBarOnly and 0 --[[ImGuiWindowBgClickFlags.None]] or 1 --[[ImGuiWindowBgClickFlags.Move]] end -- We fill last item data based on Title Bar/Tab, in order for IsItemHovered() and IsItemActive() to be usable after Begin(). -- This is useful to allow creating context menus on title bar only, etc. - window.DC.WindowItemStatusFlags = ImGuiItemStatusFlags.None + window.DC.WindowItemStatusFlags = 0 --[[ImGuiItemStatusFlags.None]] if ImGui.IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max, false) then - window.DC.WindowItemStatusFlags = bit32.bor(window.DC.WindowItemStatusFlags, ImGuiItemStatusFlags.HoveredRect) + window.DC.WindowItemStatusFlags = bit32.bor(window.DC.WindowItemStatusFlags, 1 --[[ImGuiItemStatusFlags.HoveredRect]]) end ImGui.SetLastItemDataForWindow(window, title_bar_rect) else @@ -12663,7 +12697,7 @@ function ImGui.Begin(name, open, flags) ImGui.SetLastItemDataForWindow(window, window:TitleBarRect()) end - if bit32.band(flags, ImGuiWindowFlags.DockNodeHost) == 0 and not window.SkipRefresh then + if bit32.band(flags, 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) == 0 and not window.SkipRefresh then ImGui.PushClipRect(window.InnerClipRect.Min, window.InnerClipRect.Max, true) -- [Roblox backend] content clip + scroll origin: lets the backend move scrolled content instead of redrawing it local dl, cr = window.DrawList, window.DrawList._CmdHeader.ClipRect @@ -12690,12 +12724,12 @@ function ImGui.Begin(name, open, flags) end end - if (bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0) and (bit32.band(flags, ImGuiWindowFlags.ChildMenu) == 0) then + if (bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0) and (bit32.band(flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) == 0) then -- Child window can be out of sight and have "negative" clip windows. -- Mark them as collapsed so commands are skipped earlier (we can't manually collapse them because they have no title bar). - IM_ASSERT((bit32.band(flags, ImGuiWindowFlags.NoTitleBar) ~= 0) or window.DockIsActive) + assert((bit32.band(flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) ~= 0) or window.DockIsActive) - local nav_request = (bit32.band(window.ChildFlags, ImGuiChildFlags.NavFlattened) ~= 0) and (g.NavAnyRequest and g.NavWindow and g.NavWindow.RootWindowForNav == window.RootWindowForNav) + local nav_request = (bit32.band(window.ChildFlags, 256 --[[ImGuiChildFlags.NavFlattened]]) ~= 0) and (g.NavAnyRequest and g.NavWindow and g.NavWindow.RootWindowForNav == window.RootWindowForNav) if not g.LogEnabled and not nav_request then if window.OuterRectClipped.Min.x >= window.OuterRectClipped.Max.x or window.OuterRectClipped.Min.y >= window.OuterRectClipped.Max.y then @@ -12728,7 +12762,7 @@ function ImGui.Begin(name, open, flags) -- Disable inputs for requested number of frames if window.DisableInputsFrames > 0 then window.DisableInputsFrames = window.DisableInputsFrames - 1 - window.Flags = bit32.bor(window.Flags, ImGuiWindowFlags.NoInputs) + window.Flags = bit32.bor(window.Flags, 197120 --[[ImGuiWindowFlags.NoInputs]]) end -- Update the SkipItems flag, used to early out of all items functions (no layout required) @@ -12766,10 +12800,10 @@ function ImGui.End() local window_stack_data = g.CurrentWindowStack:back() -- Error checking: verify that user doesn't directly call End() on a child window. - if bit32.band(window.Flags, ImGuiWindowFlags.Popup) ~= 0 then + if bit32.band(window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 then IM_ASSERT_USER_ERROR(g.WithinEndPopupID == window.ID, "Must call EndPopup() and not End()!") end - if bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 and bit32.band(window.Flags, ImGuiWindowFlags.DockNodeHost) == 0 and not window.DockIsActive then + if bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 and bit32.band(window.Flags, 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) == 0 and not window.DockIsActive then IM_ASSERT_USER_ERROR(g.WithinEndChildID == window.ID, "Must call EndChild() and not End()!") end @@ -12777,7 +12811,7 @@ function ImGui.End() if window.DC.CurrentColumns then ImGui.EndColumns() end - if bit32.band(window.Flags, ImGuiWindowFlags.DockNodeHost) == 0 and not window.SkipRefresh then -- Pop inner window clip rectangle + if bit32.band(window.Flags, 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) == 0 and not window.SkipRefresh then -- Pop inner window clip rectangle ImGui.PopClipRect() end ImGui.PopFocusScope() @@ -12787,7 +12821,7 @@ function ImGui.End() end if (window.SkipRefresh) then - IM_ASSERT(window.DrawList == nil) + assert(window.DrawList == nil) window.DrawList = window.DrawListInst end if window.CacheSkipItemsBackup ~= nil then -- [Port] SetNextWindowCached() @@ -12814,10 +12848,10 @@ function ImGui.End() -- Pop from window stack ImGuiLastItemData_Copy(g.LastItemData, window_stack_data.ParentLastItemDataBackup) - if bit32.band(window.Flags, ImGuiWindowFlags.ChildMenu) ~= 0 then + if bit32.band(window.Flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0 then g.BeginMenuDepth = g.BeginMenuDepth - 1 end - if bit32.band(window.Flags, ImGuiWindowFlags.Popup) ~= 0 then + if bit32.band(window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 then g.BeginPopupStack:pop_back() end @@ -12845,7 +12879,7 @@ end function ImGui.PushItemFlag(option, enabled) local g = GImGui local item_flags = g.CurrentItemFlags - IM_ASSERT(item_flags == g.ItemFlagsStack:back()) + assert(item_flags == g.ItemFlagsStack:back()) if enabled then item_flags = bit32.bor(item_flags, option) @@ -12876,13 +12910,13 @@ function ImGui.BeginDisabled(disabled) if disabled == nil then disabled = true end local g = GImGui - local was_disabled = bit32.band(g.CurrentItemFlags, ImGuiItemFlags.Disabled) ~= 0 + local was_disabled = bit32.band(g.CurrentItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) ~= 0 if not was_disabled and disabled then g.DisabledAlphaBackup = g.Style.Alpha g.Style.Alpha = g.Style.Alpha * g.Style.DisabledAlpha -- PushStyleVar(ImGuiStyleVar.Alpha, g.Style.Alpha * g.Style.DisabledAlpha) end if was_disabled or disabled then - g.CurrentItemFlags = bit32.bor(g.CurrentItemFlags, ImGuiItemFlags.Disabled) + g.CurrentItemFlags = bit32.bor(g.CurrentItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) end g.ItemFlagsStack:push_back(g.CurrentItemFlags) -- FIXME-OPT: can we simply skip this and use DisabledStackSize? g.DisabledStackSize = g.DisabledStackSize + 1 @@ -12892,11 +12926,11 @@ function ImGui.EndDisabled() local g = GImGui IM_ASSERT_USER_ERROR_RET(g.DisabledStackSize > 0, "Calling EndDisabled() too many times!") g.DisabledStackSize = g.DisabledStackSize - 1 - local was_disabled = bit32.band(g.CurrentItemFlags, ImGuiItemFlags.Disabled) ~= 0 + local was_disabled = bit32.band(g.CurrentItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) ~= 0 -- PopItemFlag() g.ItemFlagsStack:pop_back() g.CurrentItemFlags = g.ItemFlagsStack:back() - if was_disabled and bit32.band(g.CurrentItemFlags, ImGuiItemFlags.Disabled) == 0 then + if was_disabled and bit32.band(g.CurrentItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) == 0 then g.Style.Alpha = g.DisabledAlphaBackup -- PopStyleVar() end end @@ -12906,18 +12940,18 @@ end -- The whole code for this is awkward, will reevaluate if we find a way to implement SetNextItemDisabled(). function ImGui.BeginDisabledOverrideReenable() local g = GImGui - IM_ASSERT(bit32.band(g.CurrentItemFlags, ImGuiItemFlags.Disabled) ~= 0) + assert(bit32.band(g.CurrentItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) ~= 0) g.CurrentWindowStack.Data[g.CurrentWindowStack.Size].DisabledOverrideReenableAlphaBackup = g.Style.Alpha g.Style.Alpha = g.DisabledAlphaBackup - g.CurrentItemFlags = bit32.band(g.CurrentItemFlags, bit32.bnot(ImGuiItemFlags.Disabled)) + g.CurrentItemFlags = bit32.band(g.CurrentItemFlags, bit32.bnot(64 --[[ImGuiItemFlags.Disabled]])) g.ItemFlagsStack:push_back(g.CurrentItemFlags) g.DisabledStackSize = g.DisabledStackSize + 1 end function ImGui.EndDisabledOverrideReenable() local g = GImGui - IM_ASSERT(g.DisabledStackSize > 0) + assert(g.DisabledStackSize > 0) g.DisabledStackSize = g.DisabledStackSize - 1 g.ItemFlagsStack:pop_back() g.CurrentItemFlags = g.ItemFlagsStack:back() @@ -12944,7 +12978,7 @@ local function FindHoveredWindowEx(pos, find_first_and_in_any_viewport) if (find_first_and_in_any_viewport == false and g.MovingWindow) then backup_moving_window_viewport = g.MovingWindow.Viewport g.MovingWindow.Viewport = g.MouseViewport - if (bit32.band(g.MovingWindow.Flags, ImGuiWindowFlags.NoMouseInputs) == 0) then + if (bit32.band(g.MovingWindow.Flags, 512 --[[ImGuiWindowFlags.NoMouseInputs]]) == 0) then hovered_window = g.MovingWindow end end @@ -12960,18 +12994,18 @@ local function FindHoveredWindowEx(pos, find_first_and_in_any_viewport) if not window.WasActive or window.Hidden then break end - if bit32.band(window.Flags, ImGuiWindowFlags.NoMouseInputs) ~= 0 then + if bit32.band(window.Flags, 512 --[[ImGuiWindowFlags.NoMouseInputs]]) ~= 0 then break end - IM_ASSERT(window.Viewport) + assert(window.Viewport) if (window.Viewport ~= g.MouseViewport) then break end -- Using the clipped AABB, a child window will typically be clipped by its parent (not always) local hit_padding - if bit32.band(window.Flags, bit32.bor(ImGuiWindowFlags.NoResize, ImGuiWindowFlags.AlwaysAutoResize)) ~= 0 then + if bit32.band(window.Flags, bit32.bor(2 --[[ImGuiWindowFlags.NoResize]], 64 --[[ImGuiWindowFlags.AlwaysAutoResize]])) ~= 0 then hit_padding = padding_regular else hit_padding = padding_for_resize @@ -13033,7 +13067,7 @@ function ImGui.UpdateHoveredWindowAndCaptureFlags(mouse_pos) -- - We also support the moved window toggling the NoInputs flag after moving has started in order to be able to detect windows below it, which is useful for e.g. docking mechanisms. local clear_hovered_windows = false g.HoveredWindow, g.HoveredWindowUnderMovingWindow = FindHoveredWindowEx(mouse_pos, false) - IM_ASSERT(g.HoveredWindow == nil or g.HoveredWindow == g.MovingWindow or g.HoveredWindow.Viewport == g.MouseViewport) + assert(g.HoveredWindow == nil or g.HoveredWindow == g.MovingWindow or g.HoveredWindow.Viewport == g.MouseViewport) g.HoveredWindowBeforeClear = g.HoveredWindow -- Modal windows prevents mouse from hovering behind them. @@ -13043,7 +13077,7 @@ function ImGui.UpdateHoveredWindowAndCaptureFlags(mouse_pos) end -- Disabled mouse hovering (we don't currently clear MousePos, we could) - if bit32.band(io.ConfigFlags, ImGuiConfigFlags.NoMouse) ~= 0 then + if bit32.band(io.ConfigFlags, 16 --[[ImGuiConfigFlags.NoMouse]]) ~= 0 then clear_hovered_windows = true end @@ -13073,7 +13107,7 @@ function ImGui.UpdateHoveredWindowAndCaptureFlags(mouse_pos) -- If mouse was first clicked outside of ImGui bounds we also cancel out hovering. -- FIXME: For patterns of drag and drop across OS windows, we may need to rework/remove this test (first committed 311c0ca9 on 2015/02) - local mouse_dragging_extern_payload = g.DragDropActive and bit32.band(g.DragDropSourceFlags, ImGuiDragDropFlags.SourceExtern) ~= 0 + local mouse_dragging_extern_payload = g.DragDropActive and bit32.band(g.DragDropSourceFlags, 16 --[[ImGuiDragDropFlags.SourceExtern]]) ~= 0 if not mouse_avail and not mouse_dragging_extern_payload then clear_hovered_windows = true end @@ -13095,10 +13129,10 @@ function ImGui.UpdateHoveredWindowAndCaptureFlags(mouse_pos) -- Update io.WantCaptureKeyboard for the user application (true = dispatch keyboard info to Dear ImGui only, false = dispatch keyboard info to Dear ImGui + underlying app) io.WantCaptureKeyboard = false - if bit32.band(io.ConfigFlags, ImGuiConfigFlags.NoKeyboard) == 0 then + if bit32.band(io.ConfigFlags, 64 --[[ImGuiConfigFlags.NoKeyboard]]) == 0 then if (g.ActiveId ~= 0) or (modal_window ~= nil) then io.WantCaptureKeyboard = true - elseif io.NavActive and bit32.band(io.ConfigFlags, ImGuiConfigFlags.NavEnableKeyboard) ~= 0 and io.ConfigNavCaptureKeyboard then + elseif io.NavActive and bit32.band(io.ConfigFlags, 1 --[[ImGuiConfigFlags.NavEnableKeyboard]]) ~= 0 and io.ConfigNavCaptureKeyboard then io.WantCaptureKeyboard = true end end @@ -13114,7 +13148,7 @@ end --- @param v bool --- @param analog_value float function ImGui.UpdateAliasKey(key, v, analog_value) - IM_ASSERT(ImGui.IsAliasKey(key)) + assert(ImGui.IsAliasKey(key)) local key_data = ImGui.GetKeyData(nil, key) key_data.Down = v key_data.AnalogValue = analog_value @@ -13126,10 +13160,10 @@ function ImGui.GetMergedModsFromKeys() -- Bypass IsKeyDown() for the unlikely case where user used a ImGuiInputFlags.LockXXXX on those. local mods = 0 - if ImGui.GetKeyData(g, ImGuiMod_Ctrl).Down then mods = bit32.bor(mods, ImGuiMod_Ctrl) end - if ImGui.GetKeyData(g, ImGuiMod_Shift).Down then mods = bit32.bor(mods, ImGuiMod_Shift) end - if ImGui.GetKeyData(g, ImGuiMod_Alt).Down then mods = bit32.bor(mods, ImGuiMod_Alt) end - if ImGui.GetKeyData(g, ImGuiMod_Super).Down then mods = bit32.bor(mods, ImGuiMod_Super) end + if ImGui.GetKeyData(g, 4096 --[[ImGuiMod_Ctrl]]).Down then mods = bit32.bor(mods, 4096 --[[ImGuiMod_Ctrl]]) end + if ImGui.GetKeyData(g, 8192 --[[ImGuiMod_Shift]]).Down then mods = bit32.bor(mods, 8192 --[[ImGuiMod_Shift]]) end + if ImGui.GetKeyData(g, 16384 --[[ImGuiMod_Alt]]).Down then mods = bit32.bor(mods, 16384 --[[ImGuiMod_Alt]]) end + if ImGui.GetKeyData(g, 32768 --[[ImGuiMod_Super]]).Down then mods = bit32.bor(mods, 32768 --[[ImGuiMod_Super]]) end return mods end @@ -13138,7 +13172,7 @@ function ImGui.UpdateKeyboardInputs() local g = GImGui local io = g.IO - if bit32.band(io.ConfigFlags, ImGuiConfigFlags.NoKeyboard) ~= 0 then + if bit32.band(io.ConfigFlags, 64 --[[ImGuiConfigFlags.NoKeyboard]]) ~= 0 then io:ClearInputKeys() end @@ -13146,8 +13180,8 @@ function ImGui.UpdateKeyboardInputs() for n = 0, 2 do -- TODO: ImGuiMouseButton.COUNT - 1 ImGui.UpdateAliasKey(ImGui.MouseButtonToKey(n), io.MouseDown[n], io.MouseDown[n] and 1.0 or 0.0) end - ImGui.UpdateAliasKey(ImGuiKey.MouseWheelX, io.MouseWheelH ~= 0.0, io.MouseWheelH) - ImGui.UpdateAliasKey(ImGuiKey.MouseWheelY, io.MouseWheel ~= 0.0, io.MouseWheel) + ImGui.UpdateAliasKey(661 --[[ImGuiKey.MouseWheelX]], io.MouseWheelH ~= 0.0, io.MouseWheelH) + ImGui.UpdateAliasKey(662 --[[ImGuiKey.MouseWheelY]], io.MouseWheel ~= 0.0, io.MouseWheel) -- Synchronize io.KeyMods and io.KeyCtrl/io.KeyShift/etc. values. -- - New backends (1.87+): send io.AddKeyEvent(ImGuiMod_XXX) -> -> (here) deriving io.KeyMods + io.KeyXXX from key array. @@ -13155,10 +13189,10 @@ function ImGui.UpdateKeyboardInputs() -- So with legacy backends the 4 values will do a unnecessary back-and-forth but it makes the code simpler and future facing. local prev_key_mods = io.KeyMods io.KeyMods = ImGui.GetMergedModsFromKeys() - io.KeyCtrl = bit32.band(io.KeyMods, ImGuiMod_Ctrl) ~= 0 - io.KeyShift = bit32.band(io.KeyMods, ImGuiMod_Shift) ~= 0 - io.KeyAlt = bit32.band(io.KeyMods, ImGuiMod_Alt) ~= 0 - io.KeySuper = bit32.band(io.KeyMods, ImGuiMod_Super) ~= 0 + io.KeyCtrl = bit32.band(io.KeyMods, 4096 --[[ImGuiMod_Ctrl]]) ~= 0 + io.KeyShift = bit32.band(io.KeyMods, 8192 --[[ImGuiMod_Shift]]) ~= 0 + io.KeyAlt = bit32.band(io.KeyMods, 16384 --[[ImGuiMod_Alt]]) ~= 0 + io.KeySuper = bit32.band(io.KeyMods, 32768 --[[ImGuiMod_Super]]) ~= 0 if prev_key_mods ~= io.KeyMods then g.LastKeyModsChangeTime = g.Time end @@ -13167,16 +13201,16 @@ function ImGui.UpdateKeyboardInputs() end -- Clear gamepad data if disabled - if bit32.band(io.BackendFlags, ImGuiBackendFlags.HasGamepad) == 0 then - for key = ImGuiKey_Gamepad_BEGIN, ImGuiKey_Gamepad_END - 1 do - io.KeysData[key - ImGuiKey.NamedKey_BEGIN].Down = false - io.KeysData[key - ImGuiKey.NamedKey_BEGIN].AnalogValue = 0.0 + if bit32.band(io.BackendFlags, 1 --[[ImGuiBackendFlags.HasGamepad]]) == 0 then + for key = 632 --[[ImGuiKey_Gamepad_BEGIN]], 656 --[[ImGuiKey_Gamepad_END]] - 1 do + io.KeysData[key - 512 --[[ImGuiKey.NamedKey_BEGIN]]].Down = false + io.KeysData[key - 512 --[[ImGuiKey.NamedKey_BEGIN]]].AnalogValue = 0.0 end end -- Update keys - for key = ImGuiKey.NamedKey_BEGIN, ImGuiKey.NamedKey_END - 1 do - local key_data = io.KeysData[key - ImGuiKey.NamedKey_BEGIN] + for key = 512 --[[ImGuiKey.NamedKey_BEGIN]], 667 --[[ImGuiKey.NamedKey_END]] - 1 do + local key_data = io.KeysData[key - 512 --[[ImGuiKey.NamedKey_BEGIN]]] key_data.DownDurationPrev = key_data.DownDuration if key_data.Down then if key_data.DownDuration < 0.0 then @@ -13190,19 +13224,19 @@ function ImGui.UpdateKeyboardInputs() if key_data.DownDuration == 0.0 then if ImGui.IsKeyboardKey(key) then g.LastKeyboardKeyPressTime = g.Time - elseif key == ImGuiKey.ReservedForModCtrl or key == ImGuiKey.ReservedForModShift or key == ImGuiKey.ReservedForModAlt or key == ImGuiKey.ReservedForModSuper then + elseif key == 663 --[[ImGuiKey.ReservedForModCtrl]] or key == 664 --[[ImGuiKey.ReservedForModShift]] or key == 665 --[[ImGuiKey.ReservedForModAlt]] or key == 666 --[[ImGuiKey.ReservedForModSuper]] then g.LastKeyboardKeyPressTime = g.Time end end end -- Update keys/input owner (named keys only): one entry per key - for key = ImGuiKey.NamedKey_BEGIN, ImGuiKey.NamedKey_END - 1 do - local key_data = io.KeysData[key - ImGuiKey.NamedKey_BEGIN] - local owner_data = g.KeysOwnerData[key - ImGuiKey.NamedKey_BEGIN] + for key = 512 --[[ImGuiKey.NamedKey_BEGIN]], 667 --[[ImGuiKey.NamedKey_END]] - 1 do + local key_data = io.KeysData[key - 512 --[[ImGuiKey.NamedKey_BEGIN]]] + local owner_data = g.KeysOwnerData[key - 512 --[[ImGuiKey.NamedKey_BEGIN]]] owner_data.OwnerCurr = owner_data.OwnerNext if not key_data.Down then -- Important: ownership is released on the frame after a release. Ensure a 'MouseDown -> CloseWindow -> MouseUp' chain doesn't lead to someone else seeing the MouseUp. - owner_data.OwnerNext = ImGuiKeyOwner_NoOwner + owner_data.OwnerNext = 4294967295 --[[ImGuiKeyOwner_NoOwner]] end owner_data.LockThisFrame = owner_data.LockUntilRelease and key_data.Down owner_data.LockUntilRelease = owner_data.LockUntilRelease and key_data.Down -- Clear LockUntilRelease when key is not Down anymore @@ -13241,7 +13275,7 @@ function ImGui.UpdateMouseInputs() -- Update stationary timer. -- FIXME: May need to rework again to have some tolerance for occasional small movement, while being functional on high-framerates. - local mouse_stationary_threshold = (io.MouseSource == ImGuiMouseSource.Mouse) and 2.0 or 3.0 -- Slightly higher threshold for ImGuiMouseSource.TouchScreen/ImGuiMouseSource.Pen, may need rework. + local mouse_stationary_threshold = (io.MouseSource == 0 --[[ImGuiMouseSource.Mouse]]) and 2.0 or 3.0 -- Slightly higher threshold for ImGuiMouseSource.TouchScreen/ImGuiMouseSource.Pen, may need rework. local mouse_stationary = (ImLengthSqr(io.MouseDelta) <= mouse_stationary_threshold * mouse_stationary_threshold) g.MouseStationaryTimer = mouse_stationary and (g.MouseStationaryTimer + io.DeltaTime) or 0.0 -- IMGUI_DEBUG_LOG("%.4f\n", g.MouseStationaryTimer) @@ -13345,17 +13379,17 @@ local function FindBestWheelingWindow(wheel) -- For each axis, find window in the hierarchy that may want to use scrolling local g = GImGui local windows = {nil, nil} - for axis = ImGuiAxis.X, ImGuiAxis.Y do + for axis = 1 --[[ImGuiAxis.X]], 2 --[[ImGuiAxis.Y]] do if wheel[axis] ~= 0.0 then windows[axis] = g.HoveredWindow local window = g.HoveredWindow - while bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 do + while bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 do -- Bubble up into parent window if: -- - a child window doesn't allow any scrolling. -- - a child window has the ImGuiWindowFlags.NoScrollWithMouse flag. -- -- - a child window doesn't need scrolling because it is already at the edge for the direction we are going in (FIXME-WIP) local has_scrolling = (window.ScrollMax[axis] ~= 0.0) - local inputs_disabled = (bit32.band(window.Flags, ImGuiWindowFlags.NoScrollWithMouse) ~= 0) and not (bit32.band(window.Flags, ImGuiWindowFlags.NoMouseInputs) ~= 0) + local inputs_disabled = (bit32.band(window.Flags, 16 --[[ImGuiWindowFlags.NoScrollWithMouse]]) ~= 0) and not (bit32.band(window.Flags, 512 --[[ImGuiWindowFlags.NoMouseInputs]]) ~= 0) -- local scrolling_past_limits = (wheel_v < 0.0) and (window.Scroll[axis] <= 0.0) or (window.Scroll[axis] >= window.ScrollMax[axis]) if has_scrolling and not inputs_disabled then -- and not scrolling_past_limits @@ -13413,12 +13447,12 @@ function ImGui.UpdateMouseWheel() local owner_id = mouse_window.ID local wheel = ImVec2() - wheel.x = ImGui.TestKeyOwner(ImGuiKey.MouseWheelX, owner_id) and g.IO.MouseWheelH or 0.0 - wheel.y = ImGui.TestKeyOwner(ImGuiKey.MouseWheelY, owner_id) and g.IO.MouseWheel or 0.0 + wheel.x = ImGui.TestKeyOwner(661 --[[ImGuiKey.MouseWheelX]], owner_id) and g.IO.MouseWheelH or 0.0 + wheel.y = ImGui.TestKeyOwner(662 --[[ImGuiKey.MouseWheelY]], owner_id) and g.IO.MouseWheel or 0.0 -- IMGUI_DEBUG_LOG("MouseWheel X:%.3f Y:%.3f\n", wheel_x, wheel_y) if g.WheelingWindow ~= nil then - ImGui.SetKeyOwner(ImGuiKey.MouseWheelX, owner_id) - ImGui.SetKeyOwner(ImGuiKey.MouseWheelY, owner_id) + ImGui.SetKeyOwner(661 --[[ImGuiKey.MouseWheelX]], owner_id) + ImGui.SetKeyOwner(662 --[[ImGuiKey.MouseWheelY]], owner_id) end -- Zoom / Scale window @@ -13468,14 +13502,14 @@ function ImGui.UpdateMouseWheel() window = FindBestWheelingWindow(wheel) end if window then - if not (bit32.band(window.Flags, ImGuiWindowFlags.NoScrollWithMouse) ~= 0) and not (bit32.band(window.Flags, ImGuiWindowFlags.NoMouseInputs) ~= 0) then + if not (bit32.band(window.Flags, 16 --[[ImGuiWindowFlags.NoScrollWithMouse]]) ~= 0) and not (bit32.band(window.Flags, 512 --[[ImGuiWindowFlags.NoMouseInputs]]) ~= 0) then local do_scroll = { wheel.x ~= 0.0 and window.ScrollMax.x ~= 0.0, wheel.y ~= 0.0 and window.ScrollMax.y ~= 0.0 } - if do_scroll[ImGuiAxis.X] and do_scroll[ImGuiAxis.Y] then - do_scroll[(g.WheelingAxisAvg.x > g.WheelingAxisAvg.y) and ImGuiAxis.Y or ImGuiAxis.X] = false + if do_scroll[1 --[[ImGuiAxis.X]]] and do_scroll[2 --[[ImGuiAxis.Y]]] then + do_scroll[(g.WheelingAxisAvg.x > g.WheelingAxisAvg.y) and 2 --[[ImGuiAxis.Y]] or 1 --[[ImGuiAxis.X]]] = false end - if do_scroll[ImGuiAxis.X] then + if do_scroll[1 --[[ImGuiAxis.X]]] then LockWheelingWindow(window, wheel.x) local max_step = window.InnerRect:GetWidth() * 0.67 local scroll_step = ImTrunc(ImMin(2 * window.FontRefSize, max_step)) @@ -13483,7 +13517,7 @@ function ImGui.UpdateMouseWheel() g.WheelingWindowScrolledFrame = g.FrameCount end - if do_scroll[ImGuiAxis.Y] then + if do_scroll[2 --[[ImGuiAxis.Y]]] then LockWheelingWindow(window, wheel.y) local max_step = window.InnerRect:GetHeight() * 0.67 local scroll_step = ImTrunc(ImMin(5 * window.FontRefSize, max_step)) @@ -13498,25 +13532,25 @@ end -- FIXME-VIEWPORT: the concept of a single ClipRectFullscreen is not ideal! local function SetupDrawListSharedData() local g = GImGui - local virtual_space = ImRect(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX) + local virtual_space = ImRect(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]]) for _, viewport in g.Viewports:iter() do virtual_space:Add(viewport:GetMainRect()) end g.DrawListSharedData.ClipRectFullscreen = virtual_space:ToVec4() g.DrawListSharedData.CurveTessellationTol = g.Style.CurveTessellationTol g.DrawListSharedData:SetCircleTessellationMaxError(g.Style.CircleTessellationMaxError) - g.DrawListSharedData.InitialFlags = ImDrawListFlags.None + g.DrawListSharedData.InitialFlags = 0 --[[ImDrawListFlags.None]] if g.Style.AntiAliasedLines then - g.DrawListSharedData.InitialFlags = bit32.bor(g.DrawListSharedData.InitialFlags, ImDrawListFlags.AntiAliasedLines) + g.DrawListSharedData.InitialFlags = bit32.bor(g.DrawListSharedData.InitialFlags, 1 --[[ImDrawListFlags.AntiAliasedLines]]) end - if g.Style.AntiAliasedLinesUseTex and not bit32.band(g.IO.Fonts.Flags, ImFontAtlasFlags.NoBakedLines) then - g.DrawListSharedData.InitialFlags = bit32.bor(g.DrawListSharedData.InitialFlags, ImDrawListFlags.AntiAliasedLinesUseTex) + if g.Style.AntiAliasedLinesUseTex and not bit32.band(g.IO.Fonts.Flags, 4 --[[ImFontAtlasFlags.NoBakedLines]]) then + g.DrawListSharedData.InitialFlags = bit32.bor(g.DrawListSharedData.InitialFlags, 2 --[[ImDrawListFlags.AntiAliasedLinesUseTex]]) end if g.Style.AntiAliasedFill then - g.DrawListSharedData.InitialFlags = bit32.bor(g.DrawListSharedData.InitialFlags, ImDrawListFlags.AntiAliasedFill) + g.DrawListSharedData.InitialFlags = bit32.bor(g.DrawListSharedData.InitialFlags, 4 --[[ImDrawListFlags.AntiAliasedFill]]) end - if bit32.band(g.IO.BackendFlags, ImGuiBackendFlags.RendererHasVtxOffset) then - g.DrawListSharedData.InitialFlags = bit32.bor(g.DrawListSharedData.InitialFlags, ImDrawListFlags.AllowVtxOffset) + if bit32.band(g.IO.BackendFlags, 8 --[[ImGuiBackendFlags.RendererHasVtxOffset]]) then + g.DrawListSharedData.InitialFlags = bit32.bor(g.DrawListSharedData.InitialFlags, 8 --[[ImDrawListFlags.AllowVtxOffset]]) end g.DrawListSharedData.InitialFringeScale = 1.0 end @@ -13537,7 +13571,7 @@ local function InitViewportDrawData(viewport) -- FIXME: Note that we however do NOT attempt to report "zero drawlist / vertices" into the ImDrawData structure. -- This is because the work has been done already, and its wasted! We should fix that and add optimizations for -- it earlier in the pipeline, rather than pretend to hide the data at the end of the pipeline. - local is_minimized = bit32.band(viewport.Flags, ImGuiViewportFlags.IsMinimized) ~= 0 + local is_minimized = bit32.band(viewport.Flags, 4096 --[[ImGuiViewportFlags.IsMinimized]]) ~= 0 draw_data.Valid = true draw_data.FrameCount = g.FrameCount @@ -13616,7 +13650,7 @@ end local function GetViewportBgFgDrawList(viewport, drawlist_no, drawlist_name) -- Create the draw list on demand, because they are not frequently used for all viewports local g = GImGui - IM_ASSERT(drawlist_no <= 2) -- IM_COUNTOF(viewport->BgFgDrawLists) + assert(drawlist_no <= 2) -- IM_COUNTOF(viewport->BgFgDrawLists) local draw_list = viewport.BgFgDrawLists[drawlist_no] if draw_list == nil then draw_list = ImDrawList(g.DrawListSharedData) @@ -13664,11 +13698,11 @@ end --- @param rhs ImGuiWindow local function ChildWindowComparer(lhs, rhs) local a, b = lhs, rhs - local d = (bit32.band(a.Flags, ImGuiWindowFlags.Popup) ~= 0 and 1 or 0) - (bit32.band(b.Flags, ImGuiWindowFlags.Popup) ~= 0 and 1 or 0) + local d = (bit32.band(a.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 and 1 or 0) - (bit32.band(b.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 and 1 or 0) if d ~= 0 then return (d < 0) end - d = (bit32.band(a.Flags, ImGuiWindowFlags.Tooltip) ~= 0 and 1 or 0) - (bit32.band(b.Flags, ImGuiWindowFlags.Tooltip) ~= 0 and 1 or 0) + d = (bit32.band(a.Flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0 and 1 or 0) - (bit32.band(b.Flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0 and 1 or 0) if d ~= 0 then return (d < 0) end @@ -13708,7 +13742,7 @@ end --- @param window ImGuiWindow local function GetWindowDisplayLayer(window) - return (bit32.band(window.Flags, ImGuiWindowFlags.Tooltip) ~= 0) and 2 or 1 + return (bit32.band(window.Flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0) and 2 or 1 end -- Layer is locked for the root window, however child windows may use a different viewport (e.g. extruding menu) @@ -13743,7 +13777,7 @@ local function FlattenDrawDataIntoSingleLayer(builder) end function ImGui.NewFrame() - IM_ASSERT(GImGui ~= nil, "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?") + assert(GImGui ~= nil, "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?") local g = GImGui g.ConfigFlagsLastFrame = g.ConfigFlagsCurrFrame @@ -13768,7 +13802,7 @@ function ImGui.NewFrame() if g.FramerateSecPerFrameAccum > 0 then g.IO.Framerate = (1.0 / (g.FramerateSecPerFrameAccum / g.FramerateSecPerFrameCount)) else - g.IO.Framerate = FLT_MAX + g.IO.Framerate = 3.4028234663853e+38 --[[FLT_MAX]] end -- Process input queue (trickle as many events as possible), turn events into writes to IO structure @@ -13912,8 +13946,8 @@ function ImGui.NewFrame() g.DragDropAcceptIdPrev = g.DragDropAcceptIdCurr g.DragDropAcceptIdCurr = 0 g.DragDropAcceptFlagsPrev = g.DragDropAcceptFlagsCurr - g.DragDropAcceptFlagsCurr = ImGuiDragDropFlags.None - g.DragDropAcceptIdCurrRectSurface = FLT_MAX + g.DragDropAcceptFlagsCurr = 0 --[[ImGuiDragDropFlags.None]] + g.DragDropAcceptIdCurrRectSurface = 3.4028234663853e+38 --[[FLT_MAX]] g.DragDropWithinSource = false g.DragDropWithinTarget = false g.DragDropHoldJustPressedId = 0 @@ -13923,7 +13957,7 @@ function ImGui.NewFrame() -- 'if (GetDragDropPayload() ~= nil) then Shortcut(ImGuiKey.Escape, ImGuiInputFlags.RouteGlobal | ImGuiInputFlags.RouteOverActive) end -- but you will not get a return value from Shortcut() due to ActiveIdUsingAllKeyboardKeys logic. You can however poll IsKeyPressed(ImGuiKey.Escape) afterwards. local owner_id = (g.ActiveId ~= 0) and g.ActiveId or ImHashStr("##DragDropCancelHandler") - if ImGui.Shortcut(ImGuiKey.Escape, ImGuiInputFlags.RouteGlobal, owner_id) then + if ImGui.Shortcut(526 --[[ImGuiKey.Escape]], 4096 --[[ImGuiInputFlags.RouteGlobal]], owner_id) then ImGui.ClearActiveID() ImGui.ClearDragDrop() end @@ -13941,9 +13975,9 @@ function ImGui.NewFrame() ImGui.DockContextNewFrameUpdateUndocking(g) -- Mark all windows as not visible and compact unused memory. - IM_ASSERT(g.WindowsFocusOrder.Size <= g.Windows.Size) + assert(g.WindowsFocusOrder.Size <= g.Windows.Size) local gc_all = g.GcCompactAll or g.IO.ConfigMemoryCompactTimer < 0.0 - local memory_compact_start_time = gc_all and FLT_MAX or (g.Time - g.IO.ConfigMemoryCompactTimer) + local memory_compact_start_time = gc_all and 3.4028234663853e+38 --[[FLT_MAX]] or (g.Time - g.IO.ConfigMemoryCompactTimer) for _, window in g.Windows:iter() do window.WasActive = window.Active @@ -13973,7 +14007,7 @@ function ImGui.NewFrame() g.DimBgRatio = ImMax(g.DimBgRatio - g.IO.DeltaTime * 10.0, 0.0) end - g.MouseCursor = ImGuiMouseCursor.Arrow + g.MouseCursor = 0 --[[ImGuiMouseCursor.Arrow]] g.WantCaptureMouseNextFrame = -1 g.WantCaptureKeyboardNextFrame = -1 g.WantTextInputNextFrame = -1 @@ -14005,7 +14039,7 @@ function ImGui.NewFrame() -- Closing the focused window restore focus to the first active root window in descending z-order if (g.NavWindow and not g.NavWindow.WasActive) then - ImGui.FocusTopMostWindowUnderOne(nil, nil, nil, ImGuiFocusRequestFlags.RestoreFocusedChild) + ImGui.FocusTopMostWindowUnderOne(nil, nil, nil, 1 --[[ImGuiFocusRequestFlags.RestoreFocusedChild]]) end -- No window should be open at the beginning of the frame. @@ -14013,7 +14047,7 @@ function ImGui.NewFrame() g.CurrentWindowStack:resize(0) g.BeginPopupStack:resize(0) g.ItemFlagsStack:resize(0) - g.ItemFlagsStack:push_back(ImGuiItemFlags.Default_) -- Default flags + g.ItemFlagsStack:push_back(144 --[[ImGuiItemFlags.Default_]]) -- Default flags g.CurrentItemFlags = g.ItemFlagsStack:back() g.GroupStack:resize(0) @@ -14027,9 +14061,9 @@ function ImGui.NewFrame() -- We don't use "Debug" to avoid colliding with user trying to create a "Debug" window with custom flags. -- This fallback is particularly important as it prevents ImGui:: calls from crashing. g.WithinFrameScopeWithImplicitWindow = true - ImGui.SetNextWindowSize(ImVec2(400, 400), ImGuiCond.FirstUseEver) + ImGui.SetNextWindowSize(ImVec2(400, 400), 4 --[[ImGuiCond.FirstUseEver]]) ImGui.Begin("Debug##Default") - IM_ASSERT(g.CurrentWindow.IsFallbackWindow == true) + assert(g.CurrentWindow.IsFallbackWindow == true) -- Store stack sizes g.ErrorCountCurrentFrame = 0 @@ -14040,7 +14074,7 @@ end -- This is normally called by Render(). You may want to call it directly if you want to avoid calling Render() but the gain will be very minimal. function ImGui.EndFrame() local g = GImGui - IM_ASSERT(g.Initialized) + assert(g.Initialized) -- Don't process EndFrame() multiple times. if g.FrameCountEnded == g.FrameCount then @@ -14084,7 +14118,7 @@ function ImGui.EndFrame() -- Drag and Drop: Elapse payload (if delivered, or if source stops being submitted) if g.DragDropActive then local is_delivered = g.DragDropPayload.Delivery - local is_elapsed = (g.DragDropSourceFrameCount + 1 < g.FrameCount) and (bit32.band(g.DragDropSourceFlags, ImGuiDragDropFlags.PayloadAutoExpire) ~= 0 or g.DragDropMouseButton == -1 or not ImGui.IsMouseDown(g.DragDropMouseButton)) + local is_elapsed = (g.DragDropSourceFrameCount + 1 < g.FrameCount) and (bit32.band(g.DragDropSourceFlags, 32 --[[ImGuiDragDropFlags.PayloadAutoExpire]]) ~= 0 or g.DragDropMouseButton == -1 or not ImGui.IsMouseDown(g.DragDropMouseButton)) if is_delivered or is_elapsed then ImGui.ClearDragDrop() end end @@ -14093,7 +14127,7 @@ function ImGui.EndFrame() -- in the BeginDragDropSource() block of the dragged item, you can submit them from a safe single spot -- (e.g. end of your item loop, or before EndFrame) by reading payload data. -- In the typical case, the contents of drag tooltip should be possible to infer solely from payload data. - if g.DragDropActive and g.DragDropSourceFrameCount + 1 < g.FrameCount and (bit32.band(g.DragDropSourceFlags, ImGuiDragDropFlags.SourceNoPreviewTooltip) == 0) then + if g.DragDropActive and g.DragDropSourceFrameCount + 1 < g.FrameCount and (bit32.band(g.DragDropSourceFlags, 1 --[[ImGuiDragDropFlags.SourceNoPreviewTooltip]]) == 0) then g.DragDropWithinSource = true ImGui.SetTooltip("...") g.DragDropWithinSource = false @@ -14116,7 +14150,7 @@ function ImGui.EndFrame() g.WindowsTempSortBuffer:reserve(g.Windows.Size) for _, window in g.Windows:iter() do repeat - if window.Active and bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 then -- if a child is active its parent will add it + if window.Active and bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 then -- if a child is active its parent will add it break end @@ -14126,7 +14160,7 @@ function ImGui.EndFrame() end -- This usually assert if there is a mismatch between the ImGuiWindowFlags.ChildWindow / ParentWindow values and DC.ChildWindows[] in parents, aka we've done something wrong. - IM_ASSERT(g.Windows.Size == g.WindowsTempSortBuffer.Size) + assert(g.Windows.Size == g.WindowsTempSortBuffer.Size) g.Windows:swap(g.WindowsTempSortBuffer) g.IO.MetricsActiveWindows = g.WindowsActiveCount @@ -14151,7 +14185,7 @@ end -- it is the role of the ImGui_ImplXXXX_RenderDrawData() function provided by the renderer backend) function ImGui.Render() local g = GImGui - IM_ASSERT(g.Initialized) + assert(g.Initialized) if g.FrameCountEnded ~= g.FrameCount then ImGui.EndFrame() @@ -14174,10 +14208,10 @@ function ImGui.Render() -- Add ImDrawList to render local windows_to_render_top_most = {nil, nil} - windows_to_render_top_most[1] = (g.NavWindowingTarget and (bit32.band(g.NavWindowingTarget.Flags, ImGuiWindowFlags.NoBringToFrontOnFocus) == 0)) and g.NavWindowingTarget.RootWindowDockTree or nil + windows_to_render_top_most[1] = (g.NavWindowingTarget and (bit32.band(g.NavWindowingTarget.Flags, 8192 --[[ImGuiWindowFlags.NoBringToFrontOnFocus]]) == 0)) and g.NavWindowingTarget.RootWindowDockTree or nil windows_to_render_top_most[2] = g.NavWindowingTarget and g.NavWindowingListWindow or nil for _, window in g.Windows:iter() do - if ImGui.IsWindowActiveAndVisible(window) and (bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) == 0) and window ~= windows_to_render_top_most[1] and window ~= windows_to_render_top_most[2] then + if ImGui.IsWindowActiveAndVisible(window) and (bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0) and window ~= windows_to_render_top_most[1] and window ~= windows_to_render_top_most[2] then AddRootWindowToDrawData(window) end end @@ -14188,8 +14222,8 @@ function ImGui.Render() end -- Draw software mouse cursor if requested by io.MouseDrawCursor flag - if g.IO.MouseDrawCursor and g.MouseCursor ~= ImGuiMouseCursor.None then - ImGui.RenderMouseCursor(g.IO.MousePos, g.Style.MouseCursorScale, g.MouseCursor, IM_COL32_WHITE, IM_COL32_BLACK, IM_COL32(0, 0, 0, 48)) + if g.IO.MouseDrawCursor and g.MouseCursor ~= (-1) --[[ImGuiMouseCursor.None]] then + ImGui.RenderMouseCursor(g.IO.MousePos, g.Style.MouseCursorScale, g.MouseCursor, 4294967295 --[[IM_COL32_WHITE]], 4278190080 --[[IM_COL32_BLACK]], IM_COL32(0, 0, 0, 48)) end -- Setup ImDrawData structures for end-user @@ -14251,7 +14285,7 @@ function ImGui.CalcTextSizeEx(text, text_begin, text_end, hide_text_after_double if text == "" or (text_end and text_end <= text_begin) then return ImVec2(0.0, font_size) end - local text_size = ImFontCalcTextSizeEx(font, font_size, FLT_MAX, wrap_width, text, text_begin, text_display_end, text_display_end, nil, ImDrawTextFlags.None) -- [Luau] inline font:CalcTextSizeA() + local text_size = ImFontCalcTextSizeEx(font, font_size, 3.4028234663853e+38 --[[FLT_MAX]], wrap_width, text, text_begin, text_display_end, text_display_end, nil, 0 --[[ImDrawTextFlags.None]]) -- [Luau] inline font:CalcTextSizeA() -- Round -- (see 7b0bf230, 4622fa4b6, #791 for details about this.) @@ -14286,7 +14320,7 @@ function ImGui.Shutdown() for _, atlas in g.FontAtlases:iter() do ImGui.UnregisterFontAtlas(atlas) if atlas.OwnerContext == g then - IM_ASSERT(atlas.RefCount == 0, "Destroying context owning a ImFontAtlas which is still used elsewhere!") + assert(atlas.RefCount == 0, "Destroying context owning a ImFontAtlas which is still used elsewhere!") if atlas.RefCount == 0 then atlas.Locked = false end @@ -14326,7 +14360,7 @@ function ImGui.GetIO() return GImGui.IO end --- @return ImGuiPlatformIO function ImGui.GetPlatformIO() - IM_ASSERT(GImGui ~= nil, "No current context. Did you call ImGui.CreateContext() and ImGui.SetCurrentContext()?") + assert(GImGui ~= nil, "No current context. Did you call ImGui.CreateContext() and ImGui.SetCurrentContext()?") return GImGui.PlatformIO end @@ -14357,10 +14391,10 @@ end --- @param col_b ImU32 --- @return ImU32 function ImStd.ImAlphaBlendColors(col_a, col_b) - local t = bit32.band(bit32.rshift(col_b, IM_COL32_A_SHIFT), 0xFF) / 255.0 - local r = ImLerp(bit32.band(bit32.rshift(col_a, IM_COL32_R_SHIFT), 0xFF), bit32.band(bit32.rshift(col_b, IM_COL32_R_SHIFT), 0xFF), t) - local g = ImLerp(bit32.band(bit32.rshift(col_a, IM_COL32_G_SHIFT), 0xFF), bit32.band(bit32.rshift(col_b, IM_COL32_G_SHIFT), 0xFF), t) - local b = ImLerp(bit32.band(bit32.rshift(col_a, IM_COL32_B_SHIFT), 0xFF), bit32.band(bit32.rshift(col_b, IM_COL32_B_SHIFT), 0xFF), t) + local t = bit32.band(bit32.rshift(col_b, 24 --[[IM_COL32_A_SHIFT]]), 0xFF) / 255.0 + local r = ImLerp(bit32.band(bit32.rshift(col_a, 0 --[[IM_COL32_R_SHIFT]]), 0xFF), bit32.band(bit32.rshift(col_b, 0 --[[IM_COL32_R_SHIFT]]), 0xFF), t) + local g = ImLerp(bit32.band(bit32.rshift(col_a, 8 --[[IM_COL32_G_SHIFT]]), 0xFF), bit32.band(bit32.rshift(col_b, 8 --[[IM_COL32_G_SHIFT]]), 0xFF), t) + local b = ImLerp(bit32.band(bit32.rshift(col_a, 16 --[[IM_COL32_B_SHIFT]]), 0xFF), bit32.band(bit32.rshift(col_b, 16 --[[IM_COL32_B_SHIFT]]), 0xFF), t) return IM_COL32(r, g, b, 0xFF) end @@ -14369,10 +14403,10 @@ end --- @return ImVec4? function ImGui.ColorConvertU32ToFloat4(in_col, out_col) local s = 1.0 / 255.0 - local r = bit32.band(bit32.rshift(in_col, IM_COL32_R_SHIFT), 0xFF) * s - local g = bit32.band(bit32.rshift(in_col, IM_COL32_G_SHIFT), 0xFF) * s - local b = bit32.band(bit32.rshift(in_col, IM_COL32_B_SHIFT), 0xFF) * s - local a = bit32.band(bit32.rshift(in_col, IM_COL32_A_SHIFT), 0xFF) * s + local r = bit32.band(bit32.rshift(in_col, 0 --[[IM_COL32_R_SHIFT]]), 0xFF) * s + local g = bit32.band(bit32.rshift(in_col, 8 --[[IM_COL32_G_SHIFT]]), 0xFF) * s + local b = bit32.band(bit32.rshift(in_col, 16 --[[IM_COL32_B_SHIFT]]), 0xFF) * s + local a = bit32.band(bit32.rshift(in_col, 24 --[[IM_COL32_A_SHIFT]]), 0xFF) * s if out_col then out_col[1] = r; out_col[2] = g; out_col[3] = b; out_col[4] = a @@ -14465,7 +14499,7 @@ end ------------------------------------------------------------------------------- function ImGui.GetStyle() - IM_ASSERT(GImGui ~= nil, "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?") + assert(GImGui ~= nil, "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?") return GImGui.Style end @@ -14505,9 +14539,9 @@ function ImGui.GetColorU32(col, alpha_mul, col_is_u32) if alpha_mul >= 1.0 then return col end - local a = bit32.rshift(bit32.band(col, IM_COL32_A_MASK), IM_COL32_A_SHIFT) + local a = bit32.rshift(bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]), 24 --[[IM_COL32_A_SHIFT]]) a = math.floor(a * alpha_mul) -- We don't need to clamp 0..255 because alpha is in 0..1 range. - return bit32.bor(bit32.band(col, bit32.bnot(IM_COL32_A_MASK)), bit32.lshift(a, IM_COL32_A_SHIFT)) + return bit32.bor(bit32.band(col, bit32.bnot(4278190080 --[[IM_COL32_A_MASK]])), bit32.lshift(a, 24 --[[IM_COL32_A_SHIFT]])) end end @@ -14601,7 +14635,7 @@ local GStyleVarsInfo = { --- @param idx ImGuiStyleVar --- @return ImGuiStyleVarInfo function ImGui.GetStyleVarInfo(idx) - IM_ASSERT(idx >= 0 and idx < ImGuiStyleVar.COUNT) + assert(idx >= 0 and idx < 43 --[[ImGuiStyleVar.COUNT]]) -- IM_STATIC_ASSERT(IM_COUNTOF(GStyleVarsInfo) == ImGuiStyleVar.COUNT) return GStyleVarsInfo[idx + 1] end @@ -14612,9 +14646,9 @@ function ImGui.PushStyleVar(idx, val) local g = GImGui local var_info = ImGui.GetStyleVarInfo(idx) if type(val) == "number" then - IM_ASSERT_USER_ERROR_RET(var_info.DataType == ImGuiDataType.Float and var_info.Count == 1, "Calling PushStyleVar() with wrong type!") + IM_ASSERT_USER_ERROR_RET(var_info.DataType == 6 --[[ImGuiDataType.Float]] and var_info.Count == 1, "Calling PushStyleVar() with wrong type!") else -- ImVec2 - IM_ASSERT_USER_ERROR_RET(var_info.DataType == ImGuiDataType.Float and var_info.Count == 2, "Calling PushStyleVar() with wrong type!") + IM_ASSERT_USER_ERROR_RET(var_info.DataType == 6 --[[ImGuiDataType.Float]] and var_info.Count == 2, "Calling PushStyleVar() with wrong type!") end local var = g.Style[var_info.Key] g.StyleVarStack:push_back(ImGuiStyleMod(idx, var)) @@ -14630,7 +14664,7 @@ end function ImGui.PushStyleVarX(idx, val_x) local g = GImGui local var_info = ImGui.GetStyleVarInfo(idx) - IM_ASSERT_USER_ERROR_RET(var_info.DataType == ImGuiDataType.Float and var_info.Count == 2, "Calling PushStyleVarX() with wrong type!") + IM_ASSERT_USER_ERROR_RET(var_info.DataType == 6 --[[ImGuiDataType.Float]] and var_info.Count == 2, "Calling PushStyleVarX() with wrong type!") local pvar = g.Style[var_info.Key] g.StyleVarStack:push_back(ImGuiStyleMod(idx, pvar)) pvar.x = val_x @@ -14641,7 +14675,7 @@ end function ImGui.PushStyleVarY(idx, val_y) local g = GImGui local var_info = ImGui.GetStyleVarInfo(idx) - IM_ASSERT_USER_ERROR_RET(var_info.DataType == ImGuiDataType.Float and var_info.Count == 2, "Calling PushStyleVarY() with wrong type!") + IM_ASSERT_USER_ERROR_RET(var_info.DataType == 6 --[[ImGuiDataType.Float]] and var_info.Count == 2, "Calling PushStyleVarY() with wrong type!") local pvar = g.Style[var_info.Key] g.StyleVarStack:push_back(ImGuiStyleMod(idx, pvar)) pvar.y = val_y @@ -14661,9 +14695,9 @@ function ImGui.PopStyleVar(count) local backup = stack.Data[stack.Size] -- [Luau] inline back()/pop_back() local var_info = ImGui.GetStyleVarInfo(backup.VarIdx) local data = g.Style[var_info.Key] - if (var_info.DataType == ImGuiDataType.Float and var_info.Count == 1) then + if (var_info.DataType == 6 --[[ImGuiDataType.Float]] and var_info.Count == 1) then g.Style[var_info.Key] = backup.BackupVal[1] - elseif (var_info.DataType == ImGuiDataType.Float and var_info.Count == 2) then + elseif (var_info.DataType == 6 --[[ImGuiDataType.Float]] and var_info.Count == 2) then data.x = backup.BackupVal[1]; data.y = backup.BackupVal[2] end stack.Size = stack.Size - 1 @@ -14794,7 +14828,7 @@ end function ImGui.IsWindowHovered(flags) if flags == nil then flags = 0 end local g = GImGui - IM_ASSERT_USER_ERROR(bit32.band(flags, bit32.bnot(ImGuiHoveredFlags.AllowedMaskForIsWindowHovered)) == 0, "Invalid flags for IsWindowHovered()!") + IM_ASSERT_USER_ERROR(bit32.band(flags, bit32.bnot(12479 --[[ImGuiHoveredFlags.AllowedMaskForIsWindowHovered]])) == 0, "Invalid flags for IsWindowHovered()!") local ref_window = g.HoveredWindow local cur_window = g.CurrentWindow @@ -14802,16 +14836,16 @@ function ImGui.IsWindowHovered(flags) return false end - if bit32.band(flags, ImGuiHoveredFlags.AnyWindow) == 0 then - IM_ASSERT(cur_window) -- Not inside a Begin()/End() - local popup_hierarchy = bit32.band(flags, ImGuiHoveredFlags.NoPopupHierarchy) == 0 - local dock_hierarchy = bit32.band(flags, ImGuiHoveredFlags.DockHierarchy) ~= 0 - if bit32.band(flags, ImGuiHoveredFlags.RootWindow) ~= 0 then + if bit32.band(flags, 4 --[[ImGuiHoveredFlags.AnyWindow]]) == 0 then + assert(cur_window) -- Not inside a Begin()/End() + local popup_hierarchy = bit32.band(flags, 8 --[[ImGuiHoveredFlags.NoPopupHierarchy]]) == 0 + local dock_hierarchy = bit32.band(flags, 16 --[[ImGuiHoveredFlags.DockHierarchy]]) ~= 0 + if bit32.band(flags, 2 --[[ImGuiHoveredFlags.RootWindow]]) ~= 0 then cur_window = GetCombinedRootWindow(cur_window, popup_hierarchy, dock_hierarchy) end local result - if bit32.band(flags, ImGuiHoveredFlags.ChildWindows) ~= 0 then + if bit32.band(flags, 1 --[[ImGuiHoveredFlags.ChildWindows]]) ~= 0 then result = ImGui.IsWindowChildOf(ref_window, cur_window, popup_hierarchy, dock_hierarchy) else result = (ref_window == cur_window) @@ -14824,7 +14858,7 @@ function ImGui.IsWindowHovered(flags) if not ImGui.IsWindowContentHoverable(ref_window, flags) then return false end - if bit32.band(flags, ImGuiHoveredFlags.AllowWhenBlockedByActiveItem) == 0 then + if bit32.band(flags, 128 --[[ImGuiHoveredFlags.AllowWhenBlockedByActiveItem]]) == 0 then if g.ActiveId ~= 0 and not g.ActiveIdAllowOverlap and g.ActiveId ~= ref_window.MoveId then return false end @@ -14835,10 +14869,10 @@ function ImGui.IsWindowHovered(flags) -- to fulfill the possibility that multiple IsWindowHovered() with varying flag could return true -- for different windows of the hierarchy. Possibly need a Hash(Current+Flags) ==> (Timer) cache. -- We can implement this for _Stationary because the data is linked to HoveredWindow rather than CurrentWindow. - if bit32.band(flags, ImGuiHoveredFlags.ForTooltip) ~= 0 then + if bit32.band(flags, 4096 --[[ImGuiHoveredFlags.ForTooltip]]) ~= 0 then flags = ApplyHoverFlagsForTooltip(flags, g.Style.HoverFlagsForTooltipMouse) end - if bit32.band(flags, ImGuiHoveredFlags.Stationary) ~= 0 and g.HoverWindowUnlockedStationaryId ~= ref_window.ID then + if bit32.band(flags, 8192 --[[ImGuiHoveredFlags.Stationary]]) ~= 0 and g.HoverWindowUnlockedStationaryId ~= ref_window.ID then return false end @@ -14856,18 +14890,18 @@ function ImGui.IsWindowFocused(flags) if ref_window == nil then return false end - if bit32.band(flags, ImGuiFocusedFlags.AnyWindow) ~= 0 then + if bit32.band(flags, 4 --[[ImGuiFocusedFlags.AnyWindow]]) ~= 0 then return true end - IM_ASSERT(cur_window) -- Not inside a Begin()/End() - local popup_hierarchy = bit32.band(flags, ImGuiFocusedFlags.NoPopupHierarchy) == 0 - local dock_hierarchy = bit32.band(flags, ImGuiFocusedFlags.DockHierarchy) ~= 0 - if bit32.band(flags, ImGuiFocusedFlags.RootWindow) ~= 0 then + assert(cur_window) -- Not inside a Begin()/End() + local popup_hierarchy = bit32.band(flags, 8 --[[ImGuiFocusedFlags.NoPopupHierarchy]]) == 0 + local dock_hierarchy = bit32.band(flags, 16 --[[ImGuiFocusedFlags.DockHierarchy]]) ~= 0 + if bit32.band(flags, 2 --[[ImGuiFocusedFlags.RootWindow]]) ~= 0 then cur_window = GetCombinedRootWindow(cur_window, popup_hierarchy, dock_hierarchy) end - if bit32.band(flags, ImGuiFocusedFlags.ChildWindows) ~= 0 then + if bit32.band(flags, 1 --[[ImGuiFocusedFlags.ChildWindows]]) ~= 0 then return ImGui.IsWindowChildOf(ref_window, cur_window, popup_hierarchy, dock_hierarchy) else return ref_window == cur_window @@ -14931,9 +14965,9 @@ function CalcNextScrollFromScrollTargetAndClamp(window) ImVec2_Copy(scroll, window.Scroll) local decoration_size = ImVec2(window.DecoOuterSizeX1 + window.DecoInnerSizeX1 + window.DecoOuterSizeX2, window.DecoOuterSizeY1 + window.DecoInnerSizeY1 + window.DecoOuterSizeY2) - for axis_n = ImGuiAxis.X, ImGuiAxis.Y do - local axis = (axis_n == ImGuiAxis.X) and "x" or "y" -- [Luau] named key: ImVec2[1]/[2] go through IM_VEC2.__index - if window.ScrollTarget[axis] < FLT_MAX then + for axis_n = 1 --[[ImGuiAxis.X]], 2 --[[ImGuiAxis.Y]] do + local axis = (axis_n == 1 --[[ImGuiAxis.X]]) and "x" or "y" -- [Luau] named key: ImVec2[1]/[2] go through IM_VEC2.__index + if window.ScrollTarget[axis] < 3.4028234663853e+38 --[[FLT_MAX]] then local center_ratio = window.ScrollTargetCenterRatio[axis] local scroll_target = window.ScrollTarget[axis] @@ -14969,30 +15003,30 @@ function ImGui.ScrollToRectEx(window, item_rect, flags) -- GetForegroundDrawList(window):AddRect(scroll_rect.Min, scroll_rect.Max, IM_COL32_WHITE) -- [DEBUG] -- Check that only one behavior is selected per axis - IM_ASSERT(bit32.band(flags, ImGuiScrollFlags.MaskX_) == 0 or ImIsPowerOfTwo(bit32.band(flags, ImGuiScrollFlags.MaskX_))) - IM_ASSERT(bit32.band(flags, ImGuiScrollFlags.MaskY_) == 0 or ImIsPowerOfTwo(bit32.band(flags, ImGuiScrollFlags.MaskY_))) + assert(bit32.band(flags, 21 --[[ImGuiScrollFlags.MaskX_]]) == 0 or ImIsPowerOfTwo(bit32.band(flags, 21 --[[ImGuiScrollFlags.MaskX_]]))) + assert(bit32.band(flags, 42 --[[ImGuiScrollFlags.MaskY_]]) == 0 or ImIsPowerOfTwo(bit32.band(flags, 42 --[[ImGuiScrollFlags.MaskY_]]))) -- Defaults local in_flags = flags - if bit32.band(flags, ImGuiScrollFlags.MaskX_) == 0 and window.ScrollbarX then - flags = bit32.bor(flags, ImGuiScrollFlags.KeepVisibleEdgeX) + if bit32.band(flags, 21 --[[ImGuiScrollFlags.MaskX_]]) == 0 and window.ScrollbarX then + flags = bit32.bor(flags, 1 --[[ImGuiScrollFlags.KeepVisibleEdgeX]]) end - if bit32.band(flags, ImGuiScrollFlags.MaskY_) == 0 then - flags = bit32.bor(flags, window.Appearing and ImGuiScrollFlags.AlwaysCenterY or ImGuiScrollFlags.KeepVisibleEdgeY) + if bit32.band(flags, 42 --[[ImGuiScrollFlags.MaskY_]]) == 0 then + flags = bit32.bor(flags, window.Appearing and 32 --[[ImGuiScrollFlags.AlwaysCenterY]] or 2 --[[ImGuiScrollFlags.KeepVisibleEdgeY]]) end local fully_visible_x = item_rect.Min.x >= scroll_rect.Min.x and item_rect.Max.x <= scroll_rect.Max.x local fully_visible_y = item_rect.Min.y >= scroll_rect.Min.y and item_rect.Max.y <= scroll_rect.Max.y - local can_be_fully_visible_x = (item_rect:GetWidth() + g.Style.ItemSpacing.x * 2.0) <= scroll_rect:GetWidth() or (window.AutoFitFramesX > 0) or bit32.band(window.Flags, ImGuiWindowFlags.AlwaysAutoResize) ~= 0 - local can_be_fully_visible_y = (item_rect:GetHeight() + g.Style.ItemSpacing.y * 2.0) <= scroll_rect:GetHeight() or (window.AutoFitFramesY > 0) or bit32.band(window.Flags, ImGuiWindowFlags.AlwaysAutoResize) ~= 0 + local can_be_fully_visible_x = (item_rect:GetWidth() + g.Style.ItemSpacing.x * 2.0) <= scroll_rect:GetWidth() or (window.AutoFitFramesX > 0) or bit32.band(window.Flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) ~= 0 + local can_be_fully_visible_y = (item_rect:GetHeight() + g.Style.ItemSpacing.y * 2.0) <= scroll_rect:GetHeight() or (window.AutoFitFramesY > 0) or bit32.band(window.Flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) ~= 0 - if bit32.band(flags, ImGuiScrollFlags.KeepVisibleEdgeX) ~= 0 and not fully_visible_x then + if bit32.band(flags, 1 --[[ImGuiScrollFlags.KeepVisibleEdgeX]]) ~= 0 and not fully_visible_x then if item_rect.Min.x < scroll_rect.Min.x or not can_be_fully_visible_x then ImGui.SetScrollFromPosX(window, item_rect.Min.x - g.Style.ItemSpacing.x - window.Pos.x, 0.0) elseif item_rect.Max.x >= scroll_rect.Max.x then ImGui.SetScrollFromPosX(window, item_rect.Max.x + g.Style.ItemSpacing.x - window.Pos.x, 1.0) end - elseif (bit32.band(flags, ImGuiScrollFlags.KeepVisibleCenterX) ~= 0 and not fully_visible_x) or bit32.band(flags, ImGuiScrollFlags.AlwaysCenterX) ~= 0 then + elseif (bit32.band(flags, 4 --[[ImGuiScrollFlags.KeepVisibleCenterX]]) ~= 0 and not fully_visible_x) or bit32.band(flags, 16 --[[ImGuiScrollFlags.AlwaysCenterX]]) ~= 0 then if can_be_fully_visible_x then ImGui.SetScrollFromPosX(window, ImTrunc((item_rect.Min.x + item_rect.Max.x) * 0.5) - window.Pos.x, 0.5) else @@ -15000,13 +15034,13 @@ function ImGui.ScrollToRectEx(window, item_rect, flags) end end - if bit32.band(flags, ImGuiScrollFlags.KeepVisibleEdgeY) ~= 0 and not fully_visible_y then + if bit32.band(flags, 2 --[[ImGuiScrollFlags.KeepVisibleEdgeY]]) ~= 0 and not fully_visible_y then if item_rect.Min.y < scroll_rect.Min.y or not can_be_fully_visible_y then ImGui.SetScrollFromPosY(window, item_rect.Min.y - g.Style.ItemSpacing.y - window.Pos.y, 0.0) elseif item_rect.Max.y >= scroll_rect.Max.y then ImGui.SetScrollFromPosY(window, item_rect.Max.y + g.Style.ItemSpacing.y - window.Pos.y, 1.0) end - elseif (bit32.band(flags, ImGuiScrollFlags.KeepVisibleCenterY) ~= 0 and not fully_visible_y) or bit32.band(flags, ImGuiScrollFlags.AlwaysCenterY) ~= 0 then + elseif (bit32.band(flags, 8 --[[ImGuiScrollFlags.KeepVisibleCenterY]]) ~= 0 and not fully_visible_y) or bit32.band(flags, 32 --[[ImGuiScrollFlags.AlwaysCenterY]]) ~= 0 then if can_be_fully_visible_y then ImGui.SetScrollFromPosY(window, ImTrunc((item_rect.Min.y + item_rect.Max.y) * 0.5) - window.Pos.y, 0.5) else @@ -15018,13 +15052,13 @@ function ImGui.ScrollToRectEx(window, item_rect, flags) local delta_scroll = next_scroll - window.Scroll -- Also scroll parent window to keep us into view if necessary - if bit32.band(flags, ImGuiScrollFlags.NoScrollParent) == 0 and bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 then + if bit32.band(flags, 64 --[[ImGuiScrollFlags.NoScrollParent]]) == 0 and bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 then -- FIXME-SCROLL: May be an option? - if bit32.band(in_flags, bit32.bor(ImGuiScrollFlags.AlwaysCenterX, ImGuiScrollFlags.KeepVisibleCenterX)) ~= 0 then - in_flags = bit32.bor(bit32.band(in_flags, bit32.bnot(ImGuiScrollFlags.MaskX_)), ImGuiScrollFlags.KeepVisibleEdgeX) + if bit32.band(in_flags, bit32.bor(16 --[[ImGuiScrollFlags.AlwaysCenterX]], 4 --[[ImGuiScrollFlags.KeepVisibleCenterX]])) ~= 0 then + in_flags = bit32.bor(bit32.band(in_flags, bit32.bnot(21 --[[ImGuiScrollFlags.MaskX_]])), 1 --[[ImGuiScrollFlags.KeepVisibleEdgeX]]) end - if bit32.band(in_flags, bit32.bor(ImGuiScrollFlags.AlwaysCenterY, ImGuiScrollFlags.KeepVisibleCenterY)) ~= 0 then - in_flags = bit32.bor(bit32.band(in_flags, bit32.bnot(ImGuiScrollFlags.MaskY_)), ImGuiScrollFlags.KeepVisibleEdgeY) + if bit32.band(in_flags, bit32.bor(32 --[[ImGuiScrollFlags.AlwaysCenterY]], 8 --[[ImGuiScrollFlags.KeepVisibleCenterY]])) ~= 0 then + in_flags = bit32.bor(bit32.band(in_flags, bit32.bnot(42 --[[ImGuiScrollFlags.MaskY_]])), 2 --[[ImGuiScrollFlags.KeepVisibleEdgeY]]) end local parent_delta = ImGui.ScrollToRectEx(window.ParentWindow, ImRect(item_rect.Min - delta_scroll, item_rect.Max - delta_scroll), in_flags) delta_scroll = delta_scroll + parent_delta @@ -15127,7 +15161,7 @@ end function ImGui.SetScrollFromPosX(window, local_x, center_x_ratio) if type(window) == "number" then window, local_x, center_x_ratio = GImGui.CurrentWindow, window, local_x end if center_x_ratio == nil then center_x_ratio = 0.5 end - IM_ASSERT(center_x_ratio >= 0.0 and center_x_ratio <= 1.0) + assert(center_x_ratio >= 0.0 and center_x_ratio <= 1.0) window.ScrollTarget.x = IM_TRUNC(local_x - window.DecoOuterSizeX1 - window.DecoInnerSizeX1 + window.Scroll.x) -- Convert local position to scroll offset window.ScrollTargetCenterRatio.x = center_x_ratio window.ScrollTargetEdgeSnapDist.x = 0.0 @@ -15139,7 +15173,7 @@ end function ImGui.SetScrollFromPosY(window, local_y, center_y_ratio) if type(window) == "number" then window, local_y, center_y_ratio = GImGui.CurrentWindow, window, local_y end if center_y_ratio == nil then center_y_ratio = 0.5 end - IM_ASSERT(center_y_ratio >= 0.0 and center_y_ratio <= 1.0) + assert(center_y_ratio >= 0.0 and center_y_ratio <= 1.0) window.ScrollTarget.y = IM_TRUNC(local_y - window.DecoOuterSizeY1 - window.DecoInnerSizeY1 + window.Scroll.y) -- Convert local position to scroll offset window.ScrollTargetCenterRatio.y = center_y_ratio window.ScrollTargetEdgeSnapDist.y = 0.0 @@ -15162,9 +15196,9 @@ function ImGui.BeginTooltipEx(tooltip_flags, extra_window_flags) -- We call SetNextWindowPos() to enforce position and disable clamping. -- See FindBestWindowPosForPopup() for positioning logic of other tooltips (not drag and drop ones). -- local tooltip_pos = g.IO.MousePos - g.ActiveIdClickOffset - g.Style.WindowPadding - local is_touchscreen = (g.IO.MouseSource == ImGuiMouseSource.TouchScreen) + local is_touchscreen = (g.IO.MouseSource == 1 --[[ImGuiMouseSource.TouchScreen]]) - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasPos) == 0 then + if bit32.band(g.NextWindowData.HasFlags, 1 --[[ImGuiNextWindowDataFlags.HasPos]]) == 0 then local tooltip_pos if is_touchscreen then tooltip_pos = g.IO.MousePos + TOOLTIP_DEFAULT_OFFSET_TOUCH * g.Style.MouseCursorScale @@ -15173,18 +15207,18 @@ function ImGui.BeginTooltipEx(tooltip_flags, extra_window_flags) end local tooltip_pivot = is_touchscreen and TOOLTIP_DEFAULT_PIVOT_TOUCH or ImVec2(0.0, 0.0) - ImGui.SetNextWindowPos(tooltip_pos, ImGuiCond.None, tooltip_pivot) + ImGui.SetNextWindowPos(tooltip_pos, 0 --[[ImGuiCond.None]], tooltip_pivot) end - local bg_alpha = g.Style.Colors[ImGuiCol.PopupBg].w * 0.60 + local bg_alpha = g.Style.Colors[4 --[[ImGuiCol.PopupBg]]].w * 0.60 ImGui.SetNextWindowBgAlpha(bg_alpha) -- PushStyleVar(ImGuiStyleVar.Alpha, g.Style.Alpha * 0.60) -- This would be nice but e.g ColorButton with checkerboard has issue with transparent colors :( - tooltip_flags = bit32.bor(tooltip_flags, ImGuiTooltipFlags.OverridePrevious) + tooltip_flags = bit32.bor(tooltip_flags, 2 --[[ImGuiTooltipFlags.OverridePrevious]]) end -- Hide previous tooltip from being displayed. We can't easily "reset" the content of a window so we create a new one. - if (bit32.band(tooltip_flags, ImGuiTooltipFlags.OverridePrevious) ~= 0) and g.TooltipPreviousWindow ~= nil and g.TooltipPreviousWindow.Active and not ImGui.IsWindowInBeginStack(g.TooltipPreviousWindow) then + if (bit32.band(tooltip_flags, 2 --[[ImGuiTooltipFlags.OverridePrevious]]) ~= 0) and g.TooltipPreviousWindow ~= nil and g.TooltipPreviousWindow.Active and not ImGui.IsWindowInBeginStack(g.TooltipPreviousWindow) then -- IMGUI_DEBUG_LOG("[tooltip] '%s' already active, using +1 for this frame\n", window_name) ImGui.SetWindowHiddenAndSkipItemsForCurrentFrame(g.TooltipPreviousWindow) g.TooltipOverrideCount = g.TooltipOverrideCount + 1 @@ -15193,7 +15227,7 @@ function ImGui.BeginTooltipEx(tooltip_flags, extra_window_flags) local window_name_template = is_dragdrop_tooltip and "##Tooltip_DragDrop_%02d" or "##Tooltip_%02d" local window_name = ImFormatString(window_name_template, g.TooltipOverrideCount) - local flags = bit32.bor(ImGuiWindowFlags.Tooltip, ImGuiWindowFlags.NoInputs, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoMove, ImGuiWindowFlags.NoResize, ImGuiWindowFlags.NoSavedSettings, ImGuiWindowFlags.AlwaysAutoResize) + local flags = bit32.bor(33554432 --[[ImGuiWindowFlags.Tooltip]], 197120 --[[ImGuiWindowFlags.NoInputs]], 1 --[[ImGuiWindowFlags.NoTitleBar]], 4 --[[ImGuiWindowFlags.NoMove]], 2 --[[ImGuiWindowFlags.NoResize]], 256 --[[ImGuiWindowFlags.NoSavedSettings]], 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) ImGui.Begin(window_name, nil, bit32.bor(flags, extra_window_flags)) -- 2023-03-09: Added bool return value to the API, but currently always returning true. @@ -15205,25 +15239,25 @@ function ImGui.BeginTooltipEx(tooltip_flags, extra_window_flags) end function ImGui.BeginTooltip() - return ImGui.BeginTooltipEx(ImGuiTooltipFlags.None, ImGuiWindowFlags.None) + return ImGui.BeginTooltipEx(0 --[[ImGuiTooltipFlags.None]], 0 --[[ImGuiWindowFlags.None]]) end function ImGui.BeginItemTooltip() - if not ImGui.IsItemHovered(ImGuiHoveredFlags.ForTooltip) then + if not ImGui.IsItemHovered(4096 --[[ImGuiHoveredFlags.ForTooltip]]) then return false end - return ImGui.BeginTooltipEx(ImGuiTooltipFlags.None, ImGuiWindowFlags.None) + return ImGui.BeginTooltipEx(0 --[[ImGuiTooltipFlags.None]], 0 --[[ImGuiWindowFlags.None]]) end function ImGui.EndTooltip() - IM_ASSERT(bit32.band(ImGui.GetCurrentWindowRead().Flags, ImGuiWindowFlags.Tooltip) ~= 0) -- Mismatched BeginTooltip()/EndTooltip() calls + assert(bit32.band(ImGui.GetCurrentWindowRead().Flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0) -- Mismatched BeginTooltip()/EndTooltip() calls ImGui.End() end --- @param fmt string --- @param ... any function ImGui.SetTooltip(fmt, ...) - if not ImGui.BeginTooltipEx(ImGuiTooltipFlags.OverridePrevious, ImGuiWindowFlags.None) then + if not ImGui.BeginTooltipEx(2 --[[ImGuiTooltipFlags.OverridePrevious]], 0 --[[ImGuiWindowFlags.None]]) then return end ImGui.TextV(fmt, ...) @@ -15235,7 +15269,7 @@ end --- @param fmt string --- @param ... any function ImGui.SetItemTooltip(fmt, ...) - if ImGui.IsItemHovered(ImGuiHoveredFlags.ForTooltip) then + if ImGui.IsItemHovered(4096 --[[ImGuiHoveredFlags.ForTooltip]]) then ImGui.SetTooltip(fmt, ...) end end @@ -15269,7 +15303,7 @@ function ImGui.FindBlockingModal(window) repeat local popup_data = g.OpenPopupStack.Data[i] local popup_window = popup_data.Window - if popup_window == nil or bit32.band(popup_window.Flags, ImGuiWindowFlags.Modal) == 0 then + if popup_window == nil or bit32.band(popup_window.Flags, 134217728 --[[ImGuiWindowFlags.Modal]]) == 0 then break end if not popup_window.Active and not popup_window.WasActive then -- Check WasActive, because this code may run before popup renders on current frame, also check Active to handle newly created windows. @@ -15317,8 +15351,8 @@ function ImGui.OpenPopupEx(id, popup_flags) local parent_window = g.CurrentWindow local current_stack_size = g.BeginPopupStack.Size - if bit32.band(popup_flags, ImGuiPopupFlags.NoOpenOverExistingPopup) ~= 0 then - if ImGui.IsPopupOpen(0, ImGuiPopupFlags.AnyPopupId) then + if bit32.band(popup_flags, 128 --[[ImGuiPopupFlags.NoOpenOverExistingPopup]]) ~= 0 then + if ImGui.IsPopupOpen(0, 1024 --[[ImGuiPopupFlags.AnyPopupId]]) then return false end end @@ -15329,7 +15363,7 @@ function ImGui.OpenPopupEx(id, popup_flags) popup_ref.RestoreNavWindow = g.NavWindow -- When popup closes focus may be restored to NavWindow (depend on window type). popup_ref.OpenFrameCount = g.FrameCount popup_ref.OpenParentId = parent_window.IDStack:back() - ImVec2_Copy(popup_ref.OpenPopupPos, ImGui.NavCalcPreferredRefPos(ImGuiWindowFlags.Popup)) + ImVec2_Copy(popup_ref.OpenPopupPos, ImGui.NavCalcPreferredRefPos(67108864 --[[ImGuiWindowFlags.Popup]])) if ImGui.IsMousePosValid(g.IO.MousePos) then ImVec2_Copy(popup_ref.OpenMousePos, g.IO.MousePos) else @@ -15348,7 +15382,7 @@ function ImGui.OpenPopupEx(id, popup_flags) local keep_existing = false if g.OpenPopupStack.Data[current_stack_size + 1].PopupId == id then - if (g.OpenPopupStack.Data[current_stack_size + 1].OpenFrameCount == g.FrameCount - 1) or (bit32.band(popup_flags, ImGuiPopupFlags.NoReopen) ~= 0) then + if (g.OpenPopupStack.Data[current_stack_size + 1].OpenFrameCount == g.FrameCount - 1) or (bit32.band(popup_flags, 32 --[[ImGuiPopupFlags.NoReopen]]) ~= 0) then keep_existing = true end end @@ -15395,7 +15429,7 @@ function ImGui.ClosePopupsOverWindow(ref_window, restore_focus_to_window_under_p break end - IM_ASSERT(bit32.band(popup.Window.Flags, ImGuiWindowFlags.Popup) ~= 0) + assert(bit32.band(popup.Window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0) -- Trim the stack unless the popup is a direct parent of the reference window (the reference window is often the NavWindow) -- - Clicking/Focusing Window2 won't close Popup1: @@ -15436,7 +15470,7 @@ end function ImGui.ClosePopupToLevel(remaining, restore_focus_to_window_under_popup) local g = GImGui -- IMGUI_DEBUG_LOG_POPUP("[popup] ClosePopupToLevel(%d), restore_under=%d\n", remaining, restore_focus_to_window_under_popup) - IM_ASSERT(remaining >= 0 and remaining < g.OpenPopupStack.Size) + assert(remaining >= 0 and remaining < g.OpenPopupStack.Size) -- if bit32.band(g.DebugLogFlags, ImGuiDebugLogFlags.EventPopup) ~= 0 then -- for n = remaining + 1, g.OpenPopupStack.Size do -- local popup = g.OpenPopupStack.Data[n] @@ -15453,16 +15487,16 @@ function ImGui.ClosePopupToLevel(remaining, restore_focus_to_window_under_popup) if restore_focus_to_window_under_popup and prev_popup.Window then local popup_window = prev_popup.Window local focus_window - if bit32.band(popup_window.Flags, ImGuiWindowFlags.ChildMenu) ~= 0 then + if bit32.band(popup_window.Flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0 then focus_window = popup_window.ParentWindow else focus_window = prev_popup.RestoreNavWindow end if focus_window and not focus_window.WasActive then - ImGui.FocusTopMostWindowUnderOne(popup_window, nil, nil, ImGuiFocusRequestFlags.RestoreFocusedChild) -- Fallback + ImGui.FocusTopMostWindowUnderOne(popup_window, nil, nil, 1 --[[ImGuiFocusRequestFlags.RestoreFocusedChild]]) -- Fallback else - local focus_flags = (g.NavLayer == ImGuiNavLayer.Main) and ImGuiFocusRequestFlags.RestoreFocusedChild or ImGuiFocusRequestFlags.None + local focus_flags = (g.NavLayer == 0 --[[ImGuiNavLayer.Main]]) and 1 --[[ImGuiFocusRequestFlags.RestoreFocusedChild]] or 0 --[[ImGuiFocusRequestFlags.None]] ImGui.FocusWindow(focus_window, focus_flags) end end @@ -15481,8 +15515,8 @@ function ImGui.CloseCurrentPopup() local popup_window = g.OpenPopupStack.Data[popup_idx].Window local parent_popup_window = g.OpenPopupStack.Data[popup_idx - 1].Window local close_parent = false - if popup_window and bit32.band(popup_window.Flags, ImGuiWindowFlags.ChildMenu) ~= 0 then - if parent_popup_window and not (bit32.band(parent_popup_window.Flags, ImGuiWindowFlags.MenuBar) ~= 0) then + if popup_window and bit32.band(popup_window.Flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0 then + if parent_popup_window and not (bit32.band(parent_popup_window.Flags, 1024 --[[ImGuiWindowFlags.MenuBar]]) ~= 0) then close_parent = true end end @@ -15511,16 +15545,16 @@ end --- @param extra_window_flags ImGuiWindowFlags function ImGui.BeginPopupEx(id, extra_window_flags) local g = GImGui - if not ImGui.IsPopupOpen(id, ImGuiPopupFlags.None) then + if not ImGui.IsPopupOpen(id, 0 --[[ImGuiPopupFlags.None]]) then g.NextWindowData:ClearFlags() -- We behave like Begin() and need to consume those values return false end - IM_ASSERT(bit32.band(extra_window_flags, ImGuiWindowFlags.ChildMenu) == 0) -- Use BeginPopupMenuEx() + assert(bit32.band(extra_window_flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) == 0) -- Use BeginPopupMenuEx() local name = ImFormatString("##Popup_%08x", id) -- No recycling, so we can close/open during the same frame local is_open - _, is_open = ImGui.Begin(name, nil, bit32.bor(extra_window_flags, ImGuiWindowFlags.Popup, ImGuiWindowFlags.NoDocking)) + _, is_open = ImGui.Begin(name, nil, bit32.bor(extra_window_flags, 67108864 --[[ImGuiWindowFlags.Popup]], 524288 --[[ImGuiWindowFlags.NoDocking]])) if not is_open then -- NB: Begin can return false when the popup is completely clipped (e.g. zero size display) ImGui.EndPopup() @@ -15534,21 +15568,21 @@ end --- @param extra_window_flags ImGuiWindowFlags function ImGui.BeginPopupMenuEx(id, label, extra_window_flags) local g = GImGui - if not ImGui.IsPopupOpen(id, ImGuiPopupFlags.None) then + if not ImGui.IsPopupOpen(id, 0 --[[ImGuiPopupFlags.None]]) then g.NextWindowData:ClearFlags() -- We behave like Begin() and need to consume those values return false end -- As we bypass BeginChild(), set ImGuiChildFlags.AlwaysAutoResize as it is checked independently from ImGuiWindowFlags.AlwaysAutoResize for now (see #9355) -- Ideally we should remove setting ImGuiWindowFlags.AlwaysAutoResize in BeginChild(). - if bit32.band(extra_window_flags, ImGuiWindowFlags.ChildWindow) ~= 0 and bit32.band(extra_window_flags, ImGuiWindowFlags.AlwaysAutoResize) ~= 0 then - ImGui.SetNextWindowChildFlags(ImGuiChildFlags.AlwaysAutoResize, true) + if bit32.band(extra_window_flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 and bit32.band(extra_window_flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) ~= 0 then + ImGui.SetNextWindowChildFlags(64 --[[ImGuiChildFlags.AlwaysAutoResize]], true) end - IM_ASSERT(bit32.band(extra_window_flags, ImGuiWindowFlags.ChildMenu) ~= 0) + assert(bit32.band(extra_window_flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0) local name = ImFormatString("%s###Menu_%02d", label, g.BeginMenuDepth) -- Recycle windows based on depth local is_open - _, is_open = ImGui.Begin(name, nil, bit32.bor(extra_window_flags, ImGuiWindowFlags.Popup)) + _, is_open = ImGui.Begin(name, nil, bit32.bor(extra_window_flags, 67108864 --[[ImGuiWindowFlags.Popup]])) if not is_open then -- NB: Begin can return false when the popup is completely clipped (e.g. zero size display) ImGui.EndPopup() end @@ -15566,7 +15600,7 @@ function ImGui.BeginPopup(str_id, flags) g.NextWindowData:ClearFlags() -- We behave like Begin() and need to consume those values return false end - flags = bit32.bor(flags, ImGuiWindowFlags.AlwaysAutoResize, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoSavedSettings) + flags = bit32.bor(flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]], 1 --[[ImGuiWindowFlags.NoTitleBar]], 256 --[[ImGuiWindowFlags.NoSavedSettings]]) local id = g.CurrentWindow:GetID(str_id) return ImGui.BeginPopupEx(id, flags) end @@ -15574,18 +15608,18 @@ end function ImGui.EndPopup() local g = GImGui local window = g.CurrentWindow - IM_ASSERT_USER_ERROR_RET((bit32.band(window.Flags, ImGuiWindowFlags.Popup) ~= 0) and (g.BeginPopupStack.Size > 0), "Calling EndPopup() in wrong window!") + IM_ASSERT_USER_ERROR_RET((bit32.band(window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0) and (g.BeginPopupStack.Size > 0), "Calling EndPopup() in wrong window!") -- Make all menus and popups wrap around for now, may need to expose that policy (e.g. focus scope could include wrap/loop policy flags used by new move requests) if g.NavWindow == window then - ImGui.NavMoveRequestTryWrapping(window, ImGuiNavMoveFlags.LoopY) + ImGui.NavMoveRequestTryWrapping(window, 2 --[[ImGuiNavMoveFlags.LoopY]]) end -- Child-popups don't need to be laid out local backup_within_end_popup_id = g.WithinEndPopupID local backup_within_end_child_id = g.WithinEndChildID g.WithinEndPopupID = window.ID - if bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 then + if bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 then g.WithinEndChildID = window.ID end @@ -15612,10 +15646,10 @@ function ImGui.FindBestWindowPosForPopupEx(ref_pos, size, last_dir, r_outer, r_a local base_pos_clamped -- Combo Box policy (we want a connecting edge) - if policy == ImGuiPopupPositionPolicy.ComboBox then - local dir_preferred_order = {ImGuiDir.Down, ImGuiDir.Right, ImGuiDir.Left, ImGuiDir.Up} + if policy == 1 --[[ImGuiPopupPositionPolicy.ComboBox]] then + local dir_preferred_order = {3 --[[ImGuiDir.Down]], 1 --[[ImGuiDir.Right]], 0 --[[ImGuiDir.Left]], 2 --[[ImGuiDir.Up]]} - for n = (last_dir ~= ImGuiDir.None) and 0 or 1, ImGuiDir.COUNT do + for n = (last_dir ~= (-1) --[[ImGuiDir.None]]) and 0 or 1, 4 --[[ImGuiDir.COUNT]] do repeat local dir = (n == 0) and last_dir or dir_preferred_order[n] @@ -15624,10 +15658,10 @@ function ImGui.FindBestWindowPosForPopupEx(ref_pos, size, last_dir, r_outer, r_a end local pos - if dir == ImGuiDir.Down then pos = ImVec2(r_avoid.Min.x, r_avoid.Max.y) -- Below, Toward Right (default) - elseif dir == ImGuiDir.Right then pos = ImVec2(r_avoid.Min.x, r_avoid.Min.y - size.y) -- Above, Toward Right - elseif dir == ImGuiDir.Left then pos = ImVec2(r_avoid.Max.x - size.x, r_avoid.Max.y) -- Below, Toward Left - elseif dir == ImGuiDir.Up then pos = ImVec2(r_avoid.Max.x - size.x, r_avoid.Min.y - size.y) -- Above, Toward Left + if dir == 3 --[[ImGuiDir.Down]] then pos = ImVec2(r_avoid.Min.x, r_avoid.Max.y) -- Below, Toward Right (default) + elseif dir == 1 --[[ImGuiDir.Right]] then pos = ImVec2(r_avoid.Min.x, r_avoid.Min.y - size.y) -- Above, Toward Right + elseif dir == 0 --[[ImGuiDir.Left]] then pos = ImVec2(r_avoid.Max.x - size.x, r_avoid.Max.y) -- Below, Toward Left + elseif dir == 2 --[[ImGuiDir.Up]] then pos = ImVec2(r_avoid.Max.x - size.x, r_avoid.Min.y - size.y) -- Above, Toward Left end if not r_outer:Contains(ImRect(pos, pos + size)) then @@ -15643,10 +15677,10 @@ function ImGui.FindBestWindowPosForPopupEx(ref_pos, size, last_dir, r_outer, r_a -- Tooltip and Default popup policy -- (Always first try the direction we used on the last frame, if any) - if policy == ImGuiPopupPositionPolicy.Tooltip or policy == ImGuiPopupPositionPolicy.Default then - local dir_preferred_order = {ImGuiDir.Right, ImGuiDir.Down, ImGuiDir.Up, ImGuiDir.Left} + if policy == 2 --[[ImGuiPopupPositionPolicy.Tooltip]] or policy == 0 --[[ImGuiPopupPositionPolicy.Default]] then + local dir_preferred_order = {1 --[[ImGuiDir.Right]], 3 --[[ImGuiDir.Down]], 2 --[[ImGuiDir.Up]], 0 --[[ImGuiDir.Left]]} - for n = (last_dir ~= ImGuiDir.None) and 0 or 1, ImGuiDir.COUNT do + for n = (last_dir ~= (-1) --[[ImGuiDir.None]]) and 0 or 1, 4 --[[ImGuiDir.COUNT]] do repeat local dir = (n == 0) and last_dir or dir_preferred_order[n] @@ -15654,22 +15688,22 @@ function ImGui.FindBestWindowPosForPopupEx(ref_pos, size, last_dir, r_outer, r_a break end - local avail_w = ((dir == ImGuiDir.Left) and r_avoid.Min.x or r_outer.Max.x) - ((dir == ImGuiDir.Right) and r_avoid.Max.x or r_outer.Min.x) - local avail_h = ((dir == ImGuiDir.Up) and r_avoid.Min.y or r_outer.Max.y) - ((dir == ImGuiDir.Down) and r_avoid.Max.y or r_outer.Min.y) + local avail_w = ((dir == 0 --[[ImGuiDir.Left]]) and r_avoid.Min.x or r_outer.Max.x) - ((dir == 1 --[[ImGuiDir.Right]]) and r_avoid.Max.x or r_outer.Min.x) + local avail_h = ((dir == 2 --[[ImGuiDir.Up]]) and r_avoid.Min.y or r_outer.Max.y) - ((dir == 3 --[[ImGuiDir.Down]]) and r_avoid.Max.y or r_outer.Min.y) -- If there's not enough room on one axis, there's no point in positioning on a side on this axis (e.g. when not enough width, use a top/bottom position to maximize available width) - if avail_w < size.x and (dir == ImGuiDir.Left or dir == ImGuiDir.Right) then + if avail_w < size.x and (dir == 0 --[[ImGuiDir.Left]] or dir == 1 --[[ImGuiDir.Right]]) then break end - if avail_h < size.y and (dir == ImGuiDir.Up or dir == ImGuiDir.Down) then + if avail_h < size.y and (dir == 2 --[[ImGuiDir.Up]] or dir == 3 --[[ImGuiDir.Down]]) then break end base_pos_clamped = ImClamp(ref_pos, r_outer.Min, r_outer.Max - size) local pos = ImVec2() - pos.x = (dir == ImGuiDir.Left) and (r_avoid.Min.x - size.x) or ((dir == ImGuiDir.Right) and r_avoid.Max.x or base_pos_clamped.x) - pos.y = (dir == ImGuiDir.Up) and (r_avoid.Min.y - size.y) or ((dir == ImGuiDir.Down) and r_avoid.Max.y or base_pos_clamped.y) + pos.x = (dir == 0 --[[ImGuiDir.Left]]) and (r_avoid.Min.x - size.x) or ((dir == 1 --[[ImGuiDir.Right]]) and r_avoid.Max.x or base_pos_clamped.x) + pos.y = (dir == 2 --[[ImGuiDir.Up]]) and (r_avoid.Min.y - size.y) or ((dir == 3 --[[ImGuiDir.Down]]) and r_avoid.Max.y or base_pos_clamped.y) -- Clamp top-left corner of popup pos.x = ImMax(pos.x, r_outer.Min.x) @@ -15683,10 +15717,10 @@ function ImGui.FindBestWindowPosForPopupEx(ref_pos, size, last_dir, r_outer, r_a end -- Fallback when not enough room: - last_dir = ImGuiDir.None + last_dir = (-1) --[[ImGuiDir.None]] -- For tooltip we prefer avoiding the cursor at all cost even if it means that part of the tooltip won't be visible. - if policy == ImGuiPopupPositionPolicy.Tooltip then + if policy == 2 --[[ImGuiPopupPositionPolicy.Tooltip]] then return ref_pos + ImVec2(2, 2), last_dir end @@ -15729,7 +15763,7 @@ function ImGui.FindBestWindowPosForPopup(window) local r_outer = ImGui.GetPopupAllowedExtentRect(window) - if bit32.band(window.Flags, ImGuiWindowFlags.ChildMenu) ~= 0 then + if bit32.band(window.Flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0 then -- Child menus typically request _any_ position within the parent menu item, and then we move the new menu outside the parent bounds. -- This is how we end up with child menus appearing (most-commonly) on the right of the parent menu. local parent_window = window.ParentWindow @@ -15737,34 +15771,34 @@ function ImGui.FindBestWindowPosForPopup(window) local r_avoid if parent_window.DC.MenuBarAppending then - r_avoid = ImRect(-FLT_MAX, parent_window.ClipRect.Min.y, FLT_MAX, parent_window.ClipRect.Max.y) -- Avoid parent menu-bar. If we wanted multi-line menu-bar, we may instead want to have the calling window setup e.g. a NextWindowData.PosConstraintAvoidRect field + r_avoid = ImRect(-3.4028234663853e+38 --[[FLT_MAX]], parent_window.ClipRect.Min.y, 3.4028234663853e+38 --[[FLT_MAX]], parent_window.ClipRect.Max.y) -- Avoid parent menu-bar. If we wanted multi-line menu-bar, we may instead want to have the calling window setup e.g. a NextWindowData.PosConstraintAvoidRect field else - r_avoid = ImRect(parent_window.Pos.x + horizontal_overlap, -FLT_MAX, parent_window.Pos.x + parent_window.Size.x - horizontal_overlap - parent_window.ScrollbarSizes.x, FLT_MAX) + r_avoid = ImRect(parent_window.Pos.x + horizontal_overlap, -3.4028234663853e+38 --[[FLT_MAX]], parent_window.Pos.x + parent_window.Size.x - horizontal_overlap - parent_window.ScrollbarSizes.x, 3.4028234663853e+38 --[[FLT_MAX]]) end local pos - pos, window.AutoPosLastDirection = ImGui.FindBestWindowPosForPopupEx(window.Pos, window.Size, window.AutoPosLastDirection, r_outer, r_avoid, ImGuiPopupPositionPolicy.Default) + pos, window.AutoPosLastDirection = ImGui.FindBestWindowPosForPopupEx(window.Pos, window.Size, window.AutoPosLastDirection, r_outer, r_avoid, 0 --[[ImGuiPopupPositionPolicy.Default]]) return pos end - if bit32.band(window.Flags, ImGuiWindowFlags.Popup) ~= 0 then + if bit32.band(window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 then local pos - pos, window.AutoPosLastDirection = ImGui.FindBestWindowPosForPopupEx(window.Pos, window.Size, window.AutoPosLastDirection, r_outer, ImRect(window.Pos, window.Pos), ImGuiPopupPositionPolicy.Default) -- Ideally we'd disable r_avoid here + pos, window.AutoPosLastDirection = ImGui.FindBestWindowPosForPopupEx(window.Pos, window.Size, window.AutoPosLastDirection, r_outer, ImRect(window.Pos, window.Pos), 0 --[[ImGuiPopupPositionPolicy.Default]]) -- Ideally we'd disable r_avoid here return pos end - if bit32.band(window.Flags, ImGuiWindowFlags.Tooltip) ~= 0 then + if bit32.band(window.Flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0 then -- Position tooltip (always follows mouse + clamp within outer boundaries) -- FIXME: -- - Too many paths. One problem is that FindBestWindowPosForPopupEx() doesn't allow passing a suggested position (so touch screen path doesn't use it by default). -- - Drag and drop tooltips are not using this path either: BeginTooltipEx() manually sets their position. -- - Require some tidying up. In theory we could handle both cases in same location, but requires a bit of shuffling -- as drag and drop tooltips are calling SetNextWindowPos() leading to 'window_pos_set_by_api' being set in Begin(). - IM_ASSERT(g.CurrentWindow == window) + assert(g.CurrentWindow == window) local scale = g.Style.MouseCursorScale - local ref_pos = ImGui.NavCalcPreferredRefPos(ImGuiWindowFlags.Tooltip) + local ref_pos = ImGui.NavCalcPreferredRefPos(33554432 --[[ImGuiWindowFlags.Tooltip]]) - if g.IO.MouseSource == ImGuiMouseSource.TouchScreen and ImGui.NavCalcPreferredRefPosSource(ImGuiWindowFlags.Tooltip) == ImGuiInputSource.Mouse then + if g.IO.MouseSource == 1 --[[ImGuiMouseSource.TouchScreen]] and ImGui.NavCalcPreferredRefPosSource(33554432 --[[ImGuiWindowFlags.Tooltip]]) == 1 --[[ImGuiInputSource.Mouse]] then local tooltip_pos = ref_pos + TOOLTIP_DEFAULT_OFFSET_TOUCH * scale - TOOLTIP_DEFAULT_PIVOT_TOUCH * window.Size if r_outer:Contains(ImRect(tooltip_pos, tooltip_pos + window.Size)) then return tooltip_pos @@ -15781,11 +15815,11 @@ function ImGui.FindBestWindowPosForPopup(window) -- ImGui.GetForegroundDrawList():AddRect(r_avoid.Min, r_avoid.Max, IM_COL32(255, 0, 255, 255)) local pos - pos, window.AutoPosLastDirection = ImGui.FindBestWindowPosForPopupEx(tooltip_pos, window.Size, window.AutoPosLastDirection, r_outer, r_avoid, ImGuiPopupPositionPolicy.Tooltip) + pos, window.AutoPosLastDirection = ImGui.FindBestWindowPosForPopupEx(tooltip_pos, window.Size, window.AutoPosLastDirection, r_outer, r_avoid, 2 --[[ImGuiPopupPositionPolicy.Tooltip]]) return pos end - IM_ASSERT(false) + assert(false) return window.Pos end @@ -15793,12 +15827,12 @@ end --- @param flags ImGuiPopupFlags --- @return ImGuiMouseButton function ImGui.GetMouseButtonFromPopupFlags(flags) - IM_ASSERT(bit32.band(flags, ImGuiPopupFlags.InvalidMask_) == 0) - if bit32.band(flags, ImGuiPopupFlags.MouseButtonMask_) ~= 0 then - return bit32.rshift(bit32.band(flags, ImGuiPopupFlags.MouseButtonMask_), ImGuiPopupFlags.MouseButtonShift_) - 1 + assert(bit32.band(flags, 3 --[[ImGuiPopupFlags.InvalidMask_]]) == 0) + if bit32.band(flags, 12 --[[ImGuiPopupFlags.MouseButtonMask_]]) ~= 0 then + return bit32.rshift(bit32.band(flags, 12 --[[ImGuiPopupFlags.MouseButtonMask_]]), 2 --[[ImGuiPopupFlags.MouseButtonShift_]]) - 1 end - return ImGuiMouseButton.Right -- Default == 1 + return 1 --[[ImGuiMouseButton.Right]] -- Default == 1 end --- @param popup_flags ImGuiPopupFlags @@ -15807,7 +15841,7 @@ end function ImGui.IsPopupOpenRequestForItem(popup_flags, id) local g = GImGui local mouse_button = ImGui.GetMouseButtonFromPopupFlags(popup_flags) - if ImGui.IsMouseReleased(mouse_button) and ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenBlockedByPopup) then + if ImGui.IsMouseReleased(mouse_button) and ImGui.IsItemHovered(32 --[[ImGuiHoveredFlags.AllowWhenBlockedByPopup]]) then return true end if g.NavOpenContextMenuItemId == id and (ImGui.IsItemFocused() or id == g.CurrentWindow.MoveId) then @@ -15829,7 +15863,7 @@ function ImGui.OpenPopupOnItemClick(str_id, popup_flags) local window = g.CurrentWindow local id if str_id then id = window:GetID(str_id) else id = g.LastItemData.ID end -- If user hasn't passed an ID, we can use the LastItemID. Using LastItemID as a Popup ID won't conflict! - IM_ASSERT(id ~= 0) -- You cannot pass a nil str_id if the last item has no identifier (e.g. a Text() item) + assert(id ~= 0) -- You cannot pass a nil str_id if the last item has no identifier (e.g. a Text() item) return ImGui.OpenPopupEx(id, popup_flags) end @@ -15865,11 +15899,11 @@ function ImGui.BeginPopupContextItem(str_id, popup_flags) end local id if str_id then id = window:GetID(str_id) else id = g.LastItemData.ID end -- If user hasn't passed an ID, we can use the LastItem ID. Using LastItem ID as a Popup ID won't conflict! - IM_ASSERT(id ~= 0) -- You cannot pass a nil str_id if the last item has no identifier (e.g. a Text() item) + assert(id ~= 0) -- You cannot pass a nil str_id if the last item has no identifier (e.g. a Text() item) if ImGui.IsPopupOpenRequestForItem(popup_flags, g.LastItemData.ID) then ImGui.OpenPopupEx(id, popup_flags) end - return ImGui.BeginPopupEx(id, bit32.bor(ImGuiWindowFlags.AlwaysAutoResize, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoSavedSettings)) + return ImGui.BeginPopupEx(id, bit32.bor(64 --[[ImGuiWindowFlags.AlwaysAutoResize]], 1 --[[ImGuiWindowFlags.NoTitleBar]], 256 --[[ImGuiWindowFlags.NoSavedSettings]])) end ------------------------------------------------------------------------------- @@ -15923,7 +15957,7 @@ function ImGui.SetNavFocusScope(focus_scope_id) if focus_scope_id == 0 then return end - IM_ASSERT(g.NavWindow ~= nil) + assert(g.NavWindow ~= nil) -- Store current path (in reverse order) if focus_scope_id == g.CurrentFocusScopeId then @@ -15953,7 +15987,7 @@ function ImGui.SetNavFocusScope(focus_scope_id) g.NavFocusRoute:push_back(data) window = window.ParentWindowForFocusRoute end - IM_ASSERT(g.NavFocusRoute.Size < 100) -- Maximum depth is technically 251 as per CalcRoutingScore(): 254 - 3 + assert(g.NavFocusRoute.Size < 100) -- Maximum depth is technically 251 as per CalcRoutingScore(): 254 - 3 end function ImGui.SetItemDefaultFocus() @@ -15972,18 +16006,18 @@ function ImGui.SetItemDefaultFocus() -- Scroll could be done in NavInitRequestApplyResult() via an opt-in flag (we however don't want regular init requests to scroll) if not window.ClipRect:Contains(g.LastItemData.Rect) then - ImGui.ScrollToRectEx(window, g.LastItemData.Rect, ImGuiScrollFlags.None) + ImGui.ScrollToRectEx(window, g.LastItemData.Rect, 0 --[[ImGuiScrollFlags.None]]) end end -- (was called NavRestoreHighlightAfterMove() before 1.91.4) function ImGui.SetNavCursorVisibleAfterMove() local g = GImGui - if g.NavWindow and (bit32.band(g.NavWindow.Flags, ImGuiWindowFlags.NoNavInputs) ~= 0) then + if g.NavWindow and (bit32.band(g.NavWindow.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) ~= 0) then g.NavCursorVisible = false - elseif g.NavInputSource == ImGuiInputSource.Keyboard and (bit32.band(g.IO.ConfigFlags, ImGuiConfigFlags.NavEnableKeyboard) == 0) then + elseif g.NavInputSource == 2 --[[ImGuiInputSource.Keyboard]] and (bit32.band(g.IO.ConfigFlags, 1 --[[ImGuiConfigFlags.NavEnableKeyboard]]) == 0) then g.NavCursorVisible = false - elseif g.NavInputSource == ImGuiInputSource.Gamepad and (bit32.band(g.IO.ConfigFlags, ImGuiConfigFlags.NavEnableGamepad) == 0) then + elseif g.NavInputSource == 3 --[[ImGuiInputSource.Gamepad]] and (bit32.band(g.IO.ConfigFlags, 2 --[[ImGuiConfigFlags.NavEnableGamepad]]) == 0) then g.NavCursorVisible = false elseif g.IO.ConfigNavCursorVisibleAuto then g.NavCursorVisible = true @@ -15998,7 +16032,7 @@ function ImGui.SetNavWindow(window) if g.NavWindow ~= window then -- IMGUI_DEBUG_LOG_FOCUS("[focus] SetNavWindow(\"%s\")", window and window.Name or "") g.NavWindow = window - g.NavLastValidSelectionUserData = ImGuiSelectionUserData_Invalid + g.NavLastValidSelectionUserData = (-1) --[[ImGuiSelectionUserData_Invalid]] end g.NavInitRequest = false g.NavMoveSubmitted = false @@ -16009,7 +16043,7 @@ end --- @param axis ImGuiAxis function ImGui.NavClearPreferredPosForAxis(axis) local g = GImGui - g.NavWindow.RootWindowForNav.NavPreferredScoringPosRel[g.NavLayer][axis] = FLT_MAX + g.NavWindow.RootWindowForNav.NavPreferredScoringPosRel[g.NavLayer][axis] = 3.4028234663853e+38 --[[FLT_MAX]] end --- @param id ImGuiID @@ -16018,8 +16052,8 @@ end --- @param rect_rel ImRect function ImGui.SetNavID(id, nav_layer, focus_scope_id, rect_rel) local g = GImGui - IM_ASSERT(g.NavWindow ~= nil) - IM_ASSERT(nav_layer == ImGuiNavLayer.Main or nav_layer == ImGuiNavLayer.Menu) + assert(g.NavWindow ~= nil) + assert(nav_layer == 0 --[[ImGuiNavLayer.Main]] or nav_layer == 1 --[[ImGuiNavLayer.Menu]]) g.NavId = id g.NavLayer = nav_layer ImGui.SetNavFocusScope(focus_scope_id) @@ -16027,8 +16061,8 @@ function ImGui.SetNavID(id, nav_layer, focus_scope_id, rect_rel) ImRect_Copy(g.NavWindow.NavRectRel[nav_layer], rect_rel) -- Clear preferred scoring position (NavMoveRequestApplyResult() will tend to restore it) - ImGui.NavClearPreferredPosForAxis(ImGuiAxis.X) - ImGui.NavClearPreferredPosForAxis(ImGuiAxis.Y) + ImGui.NavClearPreferredPosForAxis(1 --[[ImGuiAxis.X]]) + ImGui.NavClearPreferredPosForAxis(2 --[[ImGuiAxis.Y]]) end -- FIXME: This could be replaced by updating a frame number in each window when (window == NavWindow) and (NavLayer == 0). @@ -16036,7 +16070,7 @@ end --- @param nav_window ImGuiWindow function ImGui.NavSaveLastChildNavWindowIntoParent(nav_window) local parent = nav_window - while parent and parent.RootWindow ~= parent and bit32.band(parent.Flags, bit32.bor(ImGuiWindowFlags.Popup, ImGuiWindowFlags.ChildMenu)) == 0 do + while parent and parent.RootWindow ~= parent and bit32.band(parent.Flags, bit32.bor(67108864 --[[ImGuiWindowFlags.Popup]], 268435456 --[[ImGuiWindowFlags.ChildMenu]])) == 0 do parent = parent.ParentWindow end if parent and parent ~= nav_window then @@ -16057,10 +16091,10 @@ end --- @param layer ImGuiNavLayer function ImGui.NavRestoreLayer(layer) local g = GImGui - if layer == ImGuiNavLayer.Main then + if layer == 0 --[[ImGuiNavLayer.Main]] then local prev_nav_window = g.NavWindow g.NavWindow = ImGui.NavRestoreLastChildNavWindow(g.NavWindow) -- FIXME-NAV: Should clear ongoing nav requests? - g.NavLastValidSelectionUserData = ImGuiSelectionUserData_Invalid + g.NavLastValidSelectionUserData = (-1) --[[ImGuiSelectionUserData_Invalid]] -- if (prev_nav_window) IMGUI_DEBUG_LOG_FOCUS("[focus] NavRestoreLayer: from \"%s\" to SetNavWindow(\"%s\")\n", prev_nav_window->Name, g.NavWindow->Name) end local window = g.NavWindow @@ -16076,14 +16110,14 @@ end function ImGui.NavHighlightActivated(id) local g = GImGui g.NavHighlightActivatedId = id - g.NavHighlightActivatedTimer = NAV_ACTIVATE_HIGHLIGHT_TIMER + g.NavHighlightActivatedTimer = 0.1 --[[NAV_ACTIVATE_HIGHLIGHT_TIMER]] end function ImGui.NavUpdateAnyRequestFlag() local g = GImGui g.NavAnyRequest = g.NavMoveScoringItems or g.NavInitRequest or (IMGUI_DEBUG_NAV_SCORING and g.NavWindow ~= nil) if g.NavAnyRequest then - IM_ASSERT(g.NavWindow ~= nil) + assert(g.NavWindow ~= nil) end end @@ -16093,16 +16127,16 @@ end function ImGui.NavInitWindow(window, force_reinit) -- FIXME: ChildWindow test here is wrong for docking local g = GImGui - IM_ASSERT(window == g.NavWindow) + assert(window == g.NavWindow) - if bit32.band(window.Flags, ImGuiWindowFlags.NoNavInputs) ~= 0 then + if bit32.band(window.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) ~= 0 then g.NavId = 0 ImGui.SetNavFocusScope(window.NavRootFocusScopeId) return end local init_for_nav = false - if window == window.RootWindow or bit32.band(window.Flags, ImGuiWindowFlags.Popup) ~= 0 or window.NavLastIds[0] == 0 or force_reinit then + if window == window.RootWindow or bit32.band(window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 or window.NavLastIds[0] == 0 or force_reinit then init_for_nav = true end -- IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: from NavInitWindow(), init_for_nav=%d, window=\"%s\", layer=%d", init_for_nav, window->Name, g.NavLayer) @@ -16127,14 +16161,14 @@ function ImGui.NavCalcPreferredRefPosSource(window_type) local window = g.NavWindow local activated_shortcut = g.ActiveId ~= 0 and g.ActiveIdFromShortcut and g.ActiveId == g.LastItemData.ID - if (bit32.band(window_type, ImGuiWindowFlags.Popup) ~= 0) and activated_shortcut then - return ImGuiInputSource.Keyboard + if (bit32.band(window_type, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0) and activated_shortcut then + return 2 --[[ImGuiInputSource.Keyboard]] end if not g.NavCursorVisible or not g.NavHighlightItemUnderNav or not window then - return ImGuiInputSource.Mouse + return 1 --[[ImGuiInputSource.Mouse]] else - return ImGuiInputSource.Keyboard -- or Nav in general + return 2 --[[ImGuiInputSource.Keyboard]] -- or Nav in general end end @@ -16146,7 +16180,7 @@ function ImGui.NavCalcPreferredRefPos(window_type) local window = g.NavWindow local source = ImGui.NavCalcPreferredRefPosSource(window_type) - if source == ImGuiInputSource.Mouse then + if source == 1 --[[ImGuiInputSource.Mouse]] then -- Mouse (we need a fallback in case the mouse becomes invalid after being used) -- The +1.0f offset when stored by OpenPopupEx() allows reopening this or another popup (same or another mouse button) while not moving the mouse, it is pretty standard. -- In theory we could move that +1.0f offset in OpenPopupEx() @@ -16157,14 +16191,14 @@ function ImGui.NavCalcPreferredRefPos(window_type) local activated_shortcut = g.ActiveId ~= 0 and g.ActiveIdFromShortcut and g.ActiveId == g.LastItemData.ID local ref_rect = ImRect() - if activated_shortcut and (bit32.band(window_type, ImGuiWindowFlags.Popup) ~= 0) then + if activated_shortcut and (bit32.band(window_type, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0) then ImRect_Copy(ref_rect, g.LastItemData.NavRect) elseif window ~= nil then ImRect_Copy(ref_rect, ImGui.WindowRectRelToAbs(window, window.NavRectRel[g.NavLayer])) end -- Take account of upcoming scrolling (maybe set mouse pos should be done in EndFrame?) - if window ~= nil and window.LastFrameActive ~= g.FrameCount and (window.ScrollTarget.x ~= FLT_MAX or window.ScrollTarget.y ~= FLT_MAX) then + if window ~= nil and window.LastFrameActive ~= g.FrameCount and (window.ScrollTarget.x ~= 3.4028234663853e+38 --[[FLT_MAX]] or window.ScrollTarget.y ~= 3.4028234663853e+38 --[[FLT_MAX]]) then local next_scroll = CalcNextScrollFromScrollTargetAndClamp(window) ref_rect:Translate(window.Scroll - next_scroll) end @@ -16185,15 +16219,15 @@ end --- @return float function ImGui.GetNavTweakPressedAmount(axis) local g = GImGui - local repeat_delay, repeat_rate = ImGui.GetTypematicRepeatRate(ImGuiInputFlags.RepeatRateNavTweak) + local repeat_delay, repeat_rate = ImGui.GetTypematicRepeatRate(8 --[[ImGuiInputFlags.RepeatRateNavTweak]]) local key_less, key_more - if g.NavInputSource == ImGuiInputSource.Gamepad then - key_less = (axis == ImGuiAxis.X) and ImGuiKey.GamepadDpadLeft or ImGuiKey.GamepadDpadUp - key_more = (axis == ImGuiAxis.X) and ImGuiKey.GamepadDpadRight or ImGuiKey.GamepadDpadDown + if g.NavInputSource == 3 --[[ImGuiInputSource.Gamepad]] then + key_less = (axis == 1 --[[ImGuiAxis.X]]) and 638 --[[ImGuiKey.GamepadDpadLeft]] or 640 --[[ImGuiKey.GamepadDpadUp]] + key_more = (axis == 1 --[[ImGuiAxis.X]]) and 639 --[[ImGuiKey.GamepadDpadRight]] or 641 --[[ImGuiKey.GamepadDpadDown]] else - key_less = (axis == ImGuiAxis.X) and ImGuiKey.LeftArrow or ImGuiKey.UpArrow - key_more = (axis == ImGuiAxis.X) and ImGuiKey.RightArrow or ImGuiKey.DownArrow + key_less = (axis == 1 --[[ImGuiAxis.X]]) and 513 --[[ImGuiKey.LeftArrow]] or 515 --[[ImGuiKey.UpArrow]] + key_more = (axis == 1 --[[ImGuiAxis.X]]) and 514 --[[ImGuiKey.RightArrow]] or 516 --[[ImGuiKey.DownArrow]] end local amount = ImGui.GetKeyPressedAmount(key_more, repeat_delay, repeat_rate) - ImGui.GetKeyPressedAmount(key_less, repeat_delay, repeat_rate) @@ -16213,8 +16247,8 @@ local nav_keyboard_keys_to_change_source = { ImGuiKey.Space, ImGuiKey.Enter, ImG --- @param focus_change_dir int function ImGui.NavUpdateWindowingTarget(focus_change_dir) local g = GImGui - IM_ASSERT(g.NavWindowingTarget) - if bit32.band(g.NavWindowingTarget.Flags, ImGuiWindowFlags.Modal) ~= 0 then + assert(g.NavWindowingTarget) + if bit32.band(g.NavWindowingTarget.Flags, 134217728 --[[ImGuiWindowFlags.Modal]]) ~= 0 then return end @@ -16243,10 +16277,10 @@ function ImGui.NavUpdateWindowingApplyFocus(apply_focus_window) ImGui.ClearActiveID() ImGui.SetNavCursorVisibleAfterMove() ImGui.ClosePopupsOverWindow(apply_focus_window, false) - ImGui.FocusWindow(apply_focus_window, ImGuiFocusRequestFlags.RestoreFocusedChild) - IM_ASSERT(g.NavWindow ~= nil) + ImGui.FocusWindow(apply_focus_window, 1 --[[ImGuiFocusRequestFlags.RestoreFocusedChild]]) + assert(g.NavWindow ~= nil) apply_focus_window = g.NavWindow - if apply_focus_window.NavLastIds[ImGuiNavLayer.Main] == 0 then -- FIXME: This is the equivalent of the 'if (g.NavId == 0) { NavInitWindow() }' in DockNodeUpdateTabBar(). + if apply_focus_window.NavLastIds[0 --[[ImGuiNavLayer.Main]]] == 0 then -- FIXME: This is the equivalent of the 'if (g.NavId == 0) { NavInitWindow() }' in DockNodeUpdateTabBar(). ImGui.NavInitWindow(apply_focus_window, false) end @@ -16257,8 +16291,8 @@ function ImGui.NavUpdateWindowingApplyFocus(apply_focus_window) -- FIXME-NAV: This should be done in NavInit.. or in FocusWindow... However in both of those cases, -- we won't have a guarantee that windows has been visible before and therefore NavLayersActiveMask* -- won't be valid. - if apply_focus_window.DC.NavLayersActiveMaskNext == bit32.lshift(1, ImGuiNavLayer.Menu) then - g.NavLayer = ImGuiNavLayer.Menu + if apply_focus_window.DC.NavLayersActiveMaskNext == bit32.lshift(1, 1 --[[ImGuiNavLayer.Menu]]) then + g.NavLayer = 1 --[[ImGuiNavLayer.Menu]] end -- Request OS level focus @@ -16296,19 +16330,19 @@ function ImGui.NavUpdateWindowing() -- Start Ctrl+Tab or Square+L/R window selection -- (g.ConfigNavWindowingKeyNext/g.ConfigNavWindowingKeyPrev defaults are ImGuiMod_Ctrl|ImGuiKey.Tab and ImGuiMod_Ctrl|ImGuiMod_Shift|ImGuiKey.Tab) local owner_id = ImHashStr("##NavUpdateWindowing") - local nav_gamepad_active = bit32.band(io.ConfigFlags, ImGuiConfigFlags.NavEnableGamepad) ~= 0 and bit32.band(io.BackendFlags, ImGuiBackendFlags.HasGamepad) ~= 0 - local nav_keyboard_active = bit32.band(io.ConfigFlags, ImGuiConfigFlags.NavEnableKeyboard) ~= 0 - local keyboard_next_window = allow_windowing and g.ConfigNavWindowingKeyNext ~= 0 and ImGui.Shortcut(g.ConfigNavWindowingKeyNext, bit32.bor(ImGuiInputFlags.Repeat, ImGuiInputFlags.RouteAlways), owner_id) - local keyboard_prev_window = allow_windowing and g.ConfigNavWindowingKeyPrev ~= 0 and ImGui.Shortcut(g.ConfigNavWindowingKeyPrev, bit32.bor(ImGuiInputFlags.Repeat, ImGuiInputFlags.RouteAlways), owner_id) - local start_toggling_with_gamepad = nav_gamepad_active and g.NavWindowingTarget == nil and ImGui.Shortcut(ImGuiKey.NavGamepadMenu, ImGuiInputFlags.RouteAlways, owner_id) + local nav_gamepad_active = bit32.band(io.ConfigFlags, 2 --[[ImGuiConfigFlags.NavEnableGamepad]]) ~= 0 and bit32.band(io.BackendFlags, 1 --[[ImGuiBackendFlags.HasGamepad]]) ~= 0 + local nav_keyboard_active = bit32.band(io.ConfigFlags, 1 --[[ImGuiConfigFlags.NavEnableKeyboard]]) ~= 0 + local keyboard_next_window = allow_windowing and g.ConfigNavWindowingKeyNext ~= 0 and ImGui.Shortcut(g.ConfigNavWindowingKeyNext, bit32.bor(1 --[[ImGuiInputFlags.Repeat]], 8192 --[[ImGuiInputFlags.RouteAlways]]), owner_id) + local keyboard_prev_window = allow_windowing and g.ConfigNavWindowingKeyPrev ~= 0 and ImGui.Shortcut(g.ConfigNavWindowingKeyPrev, bit32.bor(1 --[[ImGuiInputFlags.Repeat]], 8192 --[[ImGuiInputFlags.RouteAlways]]), owner_id) + local start_toggling_with_gamepad = nav_gamepad_active and g.NavWindowingTarget == nil and ImGui.Shortcut(634 --[[ImGuiKey.NavGamepadMenu]], 8192 --[[ImGuiInputFlags.RouteAlways]], owner_id) local start_windowing_with_gamepad = allow_windowing and start_toggling_with_gamepad local start_windowing_with_keyboard = allow_windowing and g.NavWindowingTarget == nil and (keyboard_next_window or keyboard_prev_window) -- Note: enabled even without NavEnableKeyboard! local just_started_windowing_from_null_focus = false if start_toggling_with_gamepad then g.NavWindowingToggleLayer = true -- Gamepad starts toggling layer - g.NavWindowingToggleKey = ImGuiKey.NavGamepadMenu - g.NavWindowingInputSource = ImGuiInputSource.Gamepad - g.NavInputSource = ImGuiInputSource.Gamepad + g.NavWindowingToggleKey = 634 --[[ImGuiKey.NavGamepadMenu]] + g.NavWindowingInputSource = 3 --[[ImGuiInputSource.Gamepad]] + g.NavInputSource = 3 --[[ImGuiInputSource.Gamepad]] end if start_windowing_with_gamepad or start_windowing_with_keyboard then local window = (g.NavWindow and ImGui.IsWindowNavFocusable(g.NavWindow)) and g.NavWindow or ImGui.FindWindowNavFocusable(g.WindowsFocusOrder.Size, 0, -1) @@ -16321,7 +16355,7 @@ function ImGui.NavUpdateWindowing() g.NavWindowingHighlightAlpha = 0.0 ImVec2_CopyV(g.NavWindowingAccumDeltaPos, 0.0, 0.0) ImVec2_CopyV(g.NavWindowingAccumDeltaSize, 0.0, 0.0) - g.NavWindowingInputSource = start_windowing_with_keyboard and ImGuiInputSource.Keyboard or ImGuiInputSource.Gamepad + g.NavWindowingInputSource = start_windowing_with_keyboard and 2 --[[ImGuiInputSource.Keyboard]] or 3 --[[ImGuiInputSource.Gamepad]] g.NavInputSource = g.NavWindowingInputSource if g.NavWindow == nil then just_started_windowing_from_null_focus = true @@ -16329,21 +16363,21 @@ function ImGui.NavUpdateWindowing() -- Manually register ownership of our mods. Using a global route in the Shortcut() calls instead would probably be correct but may have more side-effects. if keyboard_next_window or keyboard_prev_window then - ImGui.SetKeyOwnersForKeyChord(bit32.band(bit32.bor(g.ConfigNavWindowingKeyNext, g.ConfigNavWindowingKeyPrev), ImGuiMod_Mask_), owner_id) + ImGui.SetKeyOwnersForKeyChord(bit32.band(bit32.bor(g.ConfigNavWindowingKeyNext, g.ConfigNavWindowingKeyPrev), 61440 --[[ImGuiMod_Mask_]]), owner_id) end end end -- Gamepad update - if (g.NavWindowingTarget or g.NavWindowingToggleLayer) and g.NavWindowingInputSource == ImGuiInputSource.Gamepad then + if (g.NavWindowingTarget or g.NavWindowingToggleLayer) and g.NavWindowingInputSource == 3 --[[ImGuiInputSource.Gamepad]] then if g.NavWindowingTarget ~= nil then -- Highlight only appears after a brief time holding the button, so that a fast tap on ImGuiKey.NavGamepadMenu (to toggle NavLayer) doesn't add visual noise -- However inputs are accepted immediately, so you press ImGuiKey.NavGamepadMenu + L1/R1 fast. g.NavWindowingTimer = g.NavWindowingTimer + io.DeltaTime - g.NavWindowingHighlightAlpha = ImMax(g.NavWindowingHighlightAlpha, ImSaturate((g.NavWindowingTimer - NAV_WINDOWING_HIGHLIGHT_DELAY) / 0.05)) + g.NavWindowingHighlightAlpha = ImMax(g.NavWindowingHighlightAlpha, ImSaturate((g.NavWindowingTimer - 0.5 --[[NAV_WINDOWING_HIGHLIGHT_DELAY]]) / 0.05)) -- Select window to focus - local focus_change_dir = (ImGui.IsKeyPressedEx(ImGuiKey.GamepadL1, ImGuiInputFlags.None, ImGuiKeyOwner_Any) and 1 or 0) - (ImGui.IsKeyPressedEx(ImGuiKey.GamepadR1, ImGuiInputFlags.None, ImGuiKeyOwner_Any) and 1 or 0) + local focus_change_dir = (ImGui.IsKeyPressedEx(642 --[[ImGuiKey.GamepadL1]], 0 --[[ImGuiInputFlags.None]], 0 --[[ImGuiKeyOwner_Any]]) and 1 or 0) - (ImGui.IsKeyPressedEx(643 --[[ImGuiKey.GamepadR1]], 0 --[[ImGuiInputFlags.None]], 0 --[[ImGuiKeyOwner_Any]]) and 1 or 0) if focus_change_dir ~= 0 and not just_started_windowing_from_null_focus then ImGui.NavUpdateWindowingTarget(focus_change_dir) g.NavWindowingHighlightAlpha = 1.0 @@ -16351,7 +16385,7 @@ function ImGui.NavUpdateWindowing() end -- Single press toggles NavLayer, long press with L/R apply actual focus on release (until then the window was merely rendered top-most) - if not ImGui.IsKeyDown(ImGuiKey.NavGamepadMenu) then + if not ImGui.IsKeyDown(634 --[[ImGuiKey.NavGamepadMenu]]) then g.NavWindowingToggleLayer = g.NavWindowingToggleLayer and (g.NavWindowingHighlightAlpha < 1.0) -- Once button was held long enough we don't consider it a tap-to-toggle-layer press anymore. if g.NavWindowingToggleLayer and g.NavWindow then apply_toggle_layer = true @@ -16364,14 +16398,14 @@ function ImGui.NavUpdateWindowing() end -- Keyboard: Focus - if g.NavWindowingTarget and g.NavWindowingInputSource == ImGuiInputSource.Keyboard then + if g.NavWindowingTarget and g.NavWindowingInputSource == 2 --[[ImGuiInputSource.Keyboard]] then -- Visuals only appears after a brief time after pressing TAB the first time, so that a fast Ctrl+Tab doesn't add visual noise local shared_mods = bit32.band( - bit32.band((g.ConfigNavWindowingKeyNext ~= 0) and g.ConfigNavWindowingKeyNext or ImGuiMod_Mask_, (g.ConfigNavWindowingKeyPrev ~= 0) and g.ConfigNavWindowingKeyPrev or ImGuiMod_Mask_), - ImGuiMod_Mask_) - IM_ASSERT(shared_mods ~= 0) -- Next/Prev shortcut currently needs a shared modifier to "hold", otherwise Prev actions would keep cycling between two windows. + bit32.band((g.ConfigNavWindowingKeyNext ~= 0) and g.ConfigNavWindowingKeyNext or 61440 --[[ImGuiMod_Mask_]], (g.ConfigNavWindowingKeyPrev ~= 0) and g.ConfigNavWindowingKeyPrev or 61440 --[[ImGuiMod_Mask_]]), + 61440 --[[ImGuiMod_Mask_]]) + assert(shared_mods ~= 0) -- Next/Prev shortcut currently needs a shared modifier to "hold", otherwise Prev actions would keep cycling between two windows. g.NavWindowingTimer = g.NavWindowingTimer + io.DeltaTime - g.NavWindowingHighlightAlpha = ImMax(g.NavWindowingHighlightAlpha, ImSaturate((g.NavWindowingTimer - NAV_WINDOWING_HIGHLIGHT_DELAY) / 0.05)) -- 1.0f + g.NavWindowingHighlightAlpha = ImMax(g.NavWindowingHighlightAlpha, ImSaturate((g.NavWindowingTimer - 0.5 --[[NAV_WINDOWING_HIGHLIGHT_DELAY]]) / 0.05)) -- 1.0f if (keyboard_next_window or keyboard_prev_window) and not just_started_windowing_from_null_focus then ImGui.NavUpdateWindowingTarget(keyboard_next_window and -1 or 1) elseif bit32.band(io.KeyMods, shared_mods) ~= shared_mods then @@ -16380,21 +16414,21 @@ function ImGui.NavUpdateWindowing() end -- Keyboard: Press and Release Alt to toggle menu layer - local windowing_toggle_keys = { ImGuiKey.LeftAlt, ImGuiKey.RightAlt } + local windowing_toggle_keys = { 529 --[[ImGuiKey.LeftAlt]], 533 --[[ImGuiKey.RightAlt]] } local windowing_toggle_layer_start = false - if g.NavWindow and bit32.band(g.NavWindow.Flags, ImGuiWindowFlags.NoNavInputs) == 0 then + if g.NavWindow and bit32.band(g.NavWindow.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) == 0 then for _, windowing_toggle_key in ipairs(windowing_toggle_keys) do - if nav_keyboard_active and ImGui.IsKeyPressedEx(windowing_toggle_key, ImGuiInputFlags.None, ImGuiKeyOwner_NoOwner) then + if nav_keyboard_active and ImGui.IsKeyPressedEx(windowing_toggle_key, 0 --[[ImGuiInputFlags.None]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) then windowing_toggle_layer_start = true g.NavWindowingToggleLayer = true g.NavWindowingToggleKey = windowing_toggle_key - g.NavWindowingInputSource = ImGuiInputSource.Keyboard - g.NavInputSource = ImGuiInputSource.Keyboard + g.NavWindowingInputSource = 2 --[[ImGuiInputSource.Keyboard]] + g.NavInputSource = 2 --[[ImGuiInputSource.Keyboard]] break end end end - if g.NavWindowingToggleLayer and g.NavWindowingInputSource == ImGuiInputSource.Keyboard then + if g.NavWindowingToggleLayer and g.NavWindowingInputSource == 2 --[[ImGuiInputSource.Keyboard]] then -- We cancel toggling nav layer when any text has been typed (generally while holding Alt). (See #370) -- We cancel toggling nav layer when other modifiers are pressed. (See #4439) -- - AltGR is Alt+Ctrl on some layout but we can't reliably detect it (not all backends/systems/layout emit it as Alt+Ctrl). @@ -16403,7 +16437,7 @@ function ImGui.NavUpdateWindowing() g.NavWindowingToggleLayer = false elseif windowing_toggle_layer_start == false and g.LastKeyboardKeyPressTime == g.Time then g.NavWindowingToggleLayer = false - elseif ImGui.TestKeyOwner(g.NavWindowingToggleKey, ImGuiKeyOwner_NoOwner) == false or ImGui.TestKeyOwner(ImGuiMod_Alt, ImGuiKeyOwner_NoOwner) == false then + elseif ImGui.TestKeyOwner(g.NavWindowingToggleKey, 4294967295 --[[ImGuiKeyOwner_NoOwner]]) == false or ImGui.TestKeyOwner(16384 --[[ImGuiMod_Alt]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) == false then g.NavWindowingToggleLayer = false end @@ -16422,13 +16456,13 @@ function ImGui.NavUpdateWindowing() end -- Move window - if g.NavWindowingTarget and bit32.band(g.NavWindowingTarget.Flags, ImGuiWindowFlags.NoMove) == 0 then + if g.NavWindowingTarget and bit32.band(g.NavWindowingTarget.Flags, 4 --[[ImGuiWindowFlags.NoMove]]) == 0 then local nav_move_dir - if g.NavInputSource == ImGuiInputSource.Keyboard and not io.KeyShift then - nav_move_dir = ImGui.GetKeyMagnitude2d(ImGuiKey.LeftArrow, ImGuiKey.RightArrow, ImGuiKey.UpArrow, ImGuiKey.DownArrow) + if g.NavInputSource == 2 --[[ImGuiInputSource.Keyboard]] and not io.KeyShift then + nav_move_dir = ImGui.GetKeyMagnitude2d(513 --[[ImGuiKey.LeftArrow]], 514 --[[ImGuiKey.RightArrow]], 515 --[[ImGuiKey.UpArrow]], 516 --[[ImGuiKey.DownArrow]]) end - if g.NavInputSource == ImGuiInputSource.Gamepad then - nav_move_dir = ImGui.GetKeyMagnitude2d(ImGuiKey.GamepadLStickLeft, ImGuiKey.GamepadLStickRight, ImGuiKey.GamepadLStickUp, ImGuiKey.GamepadLStickDown) + if g.NavInputSource == 3 --[[ImGuiInputSource.Gamepad]] then + nav_move_dir = ImGui.GetKeyMagnitude2d(648 --[[ImGuiKey.GamepadLStickLeft]], 649 --[[ImGuiKey.GamepadLStickRight]], 650 --[[ImGuiKey.GamepadLStickUp]], 651 --[[ImGuiKey.GamepadLStickDown]]) end if nav_move_dir and (nav_move_dir.x ~= 0.0 or nav_move_dir.y ~= 0.0) then local NAV_MOVE_SPEED = 800.0 @@ -16438,7 +16472,7 @@ function ImGui.NavUpdateWindowing() local accum_floored = ImTrunc(g.NavWindowingAccumDeltaPos) if accum_floored.x ~= 0.0 or accum_floored.y ~= 0.0 then local moving_window = g.NavWindowingTarget.RootWindowDockTree - ImGui.SetWindowPos(moving_window, moving_window.Pos + accum_floored, ImGuiCond.Always) + ImGui.SetWindowPos(moving_window, moving_window.Pos + accum_floored, 1 --[[ImGuiCond.Always]]) ImVec2_Copy(g.NavWindowingAccumDeltaPos, g.NavWindowingAccumDeltaPos - accum_floored) end end @@ -16456,9 +16490,9 @@ function ImGui.NavUpdateWindowing() -- Move to parent menu if necessary local new_nav_window = g.NavWindow while new_nav_window.ParentWindow - and bit32.band(new_nav_window.DC.NavLayersActiveMask, bit32.lshift(1, ImGuiNavLayer.Menu)) == 0 - and bit32.band(new_nav_window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 - and bit32.band(new_nav_window.Flags, bit32.bor(ImGuiWindowFlags.Popup, ImGuiWindowFlags.ChildMenu)) == 0 do + and bit32.band(new_nav_window.DC.NavLayersActiveMask, bit32.lshift(1, 1 --[[ImGuiNavLayer.Menu]])) == 0 + and bit32.band(new_nav_window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 + and bit32.band(new_nav_window.Flags, bit32.bor(67108864 --[[ImGuiWindowFlags.Popup]], 268435456 --[[ImGuiWindowFlags.ChildMenu]])) == 0 do new_nav_window = new_nav_window.ParentWindow end if new_nav_window ~= g.NavWindow then @@ -16468,11 +16502,11 @@ function ImGui.NavUpdateWindowing() end -- Toggle layer - local new_nav_layer = (bit32.band(g.NavWindow.DC.NavLayersActiveMask, bit32.lshift(1, ImGuiNavLayer.Menu)) ~= 0) and bit32.bxor(g.NavLayer, 1) or ImGuiNavLayer.Main + local new_nav_layer = (bit32.band(g.NavWindow.DC.NavLayersActiveMask, bit32.lshift(1, 1 --[[ImGuiNavLayer.Menu]])) ~= 0) and bit32.bxor(g.NavLayer, 1) or 0 --[[ImGuiNavLayer.Main]] if new_nav_layer ~= g.NavLayer then -- Reinitialize navigation when entering menu bar with the Alt key (FIXME: could be a properly of the layer?) local preserve_layer_1_nav_id = (new_nav_window.DockNodeAsHost ~= nil) - if new_nav_layer == ImGuiNavLayer.Menu and not preserve_layer_1_nav_id then + if new_nav_layer == 1 --[[ImGuiNavLayer.Menu]] and not preserve_layer_1_nav_id then g.NavWindow.NavLastIds[new_nav_layer] = 0 end ImGui.NavRestoreLayer(new_nav_layer) @@ -16486,15 +16520,15 @@ function ImGui.NavUpdateContextMenuRequest() local io = g.IO g.NavOpenContextMenuItemId = 0 g.NavOpenContextMenuWindowId = 0 - local nav_keyboard_active = bit32.band(io.ConfigFlags, ImGuiConfigFlags.NavEnableKeyboard) ~= 0 - local nav_gamepad_active = bit32.band(io.ConfigFlags, ImGuiConfigFlags.NavEnableGamepad) ~= 0 + local nav_keyboard_active = bit32.band(io.ConfigFlags, 1 --[[ImGuiConfigFlags.NavEnableKeyboard]]) ~= 0 + local nav_gamepad_active = bit32.band(io.ConfigFlags, 2 --[[ImGuiConfigFlags.NavEnableGamepad]]) ~= 0 if (not nav_keyboard_active and not nav_gamepad_active) or g.NavWindow == nil then return end local request = false - request = request or (nav_keyboard_active and (ImGui.IsKeyReleased(ImGuiKey.Menu, ImGuiKeyOwner_NoOwner) or (ImGui.IsKeyPressedEx(ImGuiKey.F10, ImGuiInputFlags.None, ImGuiKeyOwner_NoOwner) and io.KeyMods == ImGuiMod_Shift))) - request = request or (nav_gamepad_active and ImGui.IsKeyPressedEx(ImGuiKey.NavGamepadContextMenu, ImGuiInputFlags.None, ImGuiKeyOwner_NoOwner)) + request = request or (nav_keyboard_active and (ImGui.IsKeyReleased(535 --[[ImGuiKey.Menu]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) or (ImGui.IsKeyPressedEx(581 --[[ImGuiKey.F10]], 0 --[[ImGuiInputFlags.None]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) and io.KeyMods == 8192 --[[ImGuiMod_Shift]]))) + request = request or (nav_gamepad_active and ImGui.IsKeyPressedEx(636 --[[ImGuiKey.NavGamepadContextMenu]], 0 --[[ImGuiInputFlags.None]], 4294967295 --[[ImGuiKeyOwner_NoOwner]])) if not request then return end @@ -16507,7 +16541,7 @@ function ImGui.NavUpdateContextMenuRequest() g.NavOpenContextMenuItemId = g.NavWindow.MoveId end - g.NavInputSource = ImGuiInputSource.Keyboard + g.NavInputSource = 2 --[[ImGuiInputSource.Keyboard]] ImGui.SetNavCursorVisibleAfterMove() end @@ -16518,11 +16552,11 @@ end --- @param scroll_flags ImGuiScrollFlags function ImGui.NavMoveRequestSubmit(move_dir, clip_dir, move_flags, scroll_flags) local g = GImGui - IM_ASSERT(g.NavWindow ~= nil) + assert(g.NavWindow ~= nil) -- IMGUI_DEBUG_LOG_NAV("[nav] NavMoveRequestSubmit: dir %c, window \"%s\"\n", "-WENS"[move_dir + 1], g.NavWindow->Name) - if bit32.band(move_flags, ImGuiNavMoveFlags.IsTabbing) ~= 0 then - move_flags = bit32.bor(move_flags, ImGuiNavMoveFlags.AllowCurrentNavId) + if bit32.band(move_flags, 1024 --[[ImGuiNavMoveFlags.IsTabbing]]) ~= 0 then + move_flags = bit32.bor(move_flags, 16 --[[ImGuiNavMoveFlags.AllowCurrentNavId]]) end g.NavMoveSubmitted = true; g.NavMoveScoringItems = true g.NavMoveDir = move_dir @@ -16531,7 +16565,7 @@ function ImGui.NavMoveRequestSubmit(move_dir, clip_dir, move_flags, scroll_flags g.NavMoveFlags = move_flags g.NavMoveScrollFlags = scroll_flags g.NavMoveForwardToNextFrame = false - g.NavMoveKeyMods = (bit32.band(move_flags, ImGuiNavMoveFlags.FocusApi) ~= 0) and 0 or g.IO.KeyMods + g.NavMoveKeyMods = (bit32.band(move_flags, 512 --[[ImGuiNavMoveFlags.FocusApi]]) ~= 0) and 0 or g.IO.KeyMods g.NavMoveResultLocal:Clear() g.NavMoveResultLocalVisible:Clear() g.NavMoveResultOther:Clear() @@ -16553,20 +16587,20 @@ function ImGui.NavBiasScoringRect(r, preferred_pos_rel, move_dir, move_flags) -- Initialize bias on departure if we don't have any. So mouse-click + arrow will record bias. -- - We default to L/U bias, so moving down from a large source item into several columns will land on left-most column. -- - But each successful move sets new bias on one axis, only cleared when using mouse. - if bit32.band(move_flags, ImGuiNavMoveFlags.Forwarded) == 0 then - if preferred_pos_rel.x == FLT_MAX then + if bit32.band(move_flags, 128 --[[ImGuiNavMoveFlags.Forwarded]]) == 0 then + if preferred_pos_rel.x == 3.4028234663853e+38 --[[FLT_MAX]] then preferred_pos_rel.x = ImMin(r.Min.x + 1.0, r.Max.x) - rel_to_abs_offset.x end - if preferred_pos_rel.y == FLT_MAX then + if preferred_pos_rel.y == 3.4028234663853e+38 --[[FLT_MAX]] then preferred_pos_rel.y = r:GetCenter().y - rel_to_abs_offset.y end end -- Apply general bias on the other axis - if (move_dir == ImGuiDir.Up or move_dir == ImGuiDir.Down) and preferred_pos_rel.x ~= FLT_MAX then + if (move_dir == 2 --[[ImGuiDir.Up]] or move_dir == 3 --[[ImGuiDir.Down]]) and preferred_pos_rel.x ~= 3.4028234663853e+38 --[[FLT_MAX]] then local new_x = preferred_pos_rel.x + rel_to_abs_offset.x r.Min.x = new_x; r.Max.x = new_x - elseif (move_dir == ImGuiDir.Left or move_dir == ImGuiDir.Right) and preferred_pos_rel.y ~= FLT_MAX then + elseif (move_dir == 0 --[[ImGuiDir.Left]] or move_dir == 1 --[[ImGuiDir.Right]]) and preferred_pos_rel.y ~= 3.4028234663853e+38 --[[FLT_MAX]] then local new_y = preferred_pos_rel.y + rel_to_abs_offset.y r.Min.y = new_y; r.Max.y = new_y end @@ -16580,27 +16614,27 @@ end function ImGui.NavUpdatePageUpPageDown() local g = GImGui local window = g.NavWindow - if bit32.band(window.Flags, ImGuiWindowFlags.NoNavInputs) ~= 0 or g.NavWindowingTarget ~= nil then + if bit32.band(window.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) ~= 0 or g.NavWindowingTarget ~= nil then return 0.0 end - local page_up_held = ImGui.IsKeyDown(ImGuiKey.PageUp, ImGuiKeyOwner_NoOwner) - local page_down_held = ImGui.IsKeyDown(ImGuiKey.PageDown, ImGuiKeyOwner_NoOwner) - local home_pressed = ImGui.IsKeyPressedEx(ImGuiKey.Home, ImGuiInputFlags.Repeat, ImGuiKeyOwner_NoOwner) - local end_pressed = ImGui.IsKeyPressedEx(ImGuiKey.End, ImGuiInputFlags.Repeat, ImGuiKeyOwner_NoOwner) + local page_up_held = ImGui.IsKeyDown(517 --[[ImGuiKey.PageUp]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) + local page_down_held = ImGui.IsKeyDown(518 --[[ImGuiKey.PageDown]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) + local home_pressed = ImGui.IsKeyPressedEx(519 --[[ImGuiKey.Home]], 1 --[[ImGuiInputFlags.Repeat]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) + local end_pressed = ImGui.IsKeyPressedEx(520 --[[ImGuiKey.End]], 1 --[[ImGuiInputFlags.Repeat]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) if page_up_held == page_down_held and home_pressed == end_pressed then -- Proceed if either (not both) are pressed, otherwise early out return 0.0 end - if g.NavLayer ~= ImGuiNavLayer.Main then - ImGui.NavRestoreLayer(ImGuiNavLayer.Main) + if g.NavLayer ~= 0 --[[ImGuiNavLayer.Main]] then + ImGui.NavRestoreLayer(0 --[[ImGuiNavLayer.Main]]) end - if bit32.band(window.DC.NavLayersActiveMask, bit32.lshift(1, ImGuiNavLayer.Main)) == 0 and window.DC.NavWindowHasScrollY then + if bit32.band(window.DC.NavLayersActiveMask, bit32.lshift(1, 0 --[[ImGuiNavLayer.Main]])) == 0 and window.DC.NavWindowHasScrollY then -- Fallback manual-scroll when window has no navigable item - if ImGui.IsKeyPressedEx(ImGuiKey.PageUp, ImGuiInputFlags.Repeat, ImGuiKeyOwner_NoOwner) then + if ImGui.IsKeyPressedEx(517 --[[ImGuiKey.PageUp]], 1 --[[ImGuiInputFlags.Repeat]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) then ImGui.SetScrollY(window, window.Scroll.y - window.InnerRect:GetHeight()) - elseif ImGui.IsKeyPressedEx(ImGuiKey.PageDown, ImGuiInputFlags.Repeat, ImGuiKeyOwner_NoOwner) then + elseif ImGui.IsKeyPressedEx(518 --[[ImGuiKey.PageDown]], 1 --[[ImGuiInputFlags.Repeat]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) then ImGui.SetScrollY(window, window.Scroll.y + window.InnerRect:GetHeight()) elseif home_pressed then ImGui.SetScrollY(window, 0.0) @@ -16611,16 +16645,16 @@ function ImGui.NavUpdatePageUpPageDown() local nav_rect_rel = window.NavRectRel[g.NavLayer] local page_offset_y = ImMax(0.0, window.InnerRect:GetHeight() - window.FontRefSize * 1.0 + nav_rect_rel:GetHeight()) local nav_scoring_rect_offset_y = 0.0 - if ImGui.IsKeyPressedEx(ImGuiKey.PageUp, ImGuiInputFlags.Repeat, ImGuiKeyOwner_NoOwner) then + if ImGui.IsKeyPressedEx(517 --[[ImGuiKey.PageUp]], 1 --[[ImGuiInputFlags.Repeat]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) then nav_scoring_rect_offset_y = -page_offset_y - g.NavMoveDir = ImGuiDir.Down -- Because our scoring rect is offset up, we request the down direction (so we can always land on the last item) - g.NavMoveClipDir = ImGuiDir.Up - g.NavMoveFlags = bit32.bor(ImGuiNavMoveFlags.AllowCurrentNavId, ImGuiNavMoveFlags.IsPageMove) -- ImGuiNavMoveFlags.AlsoScoreVisibleSet may be added later - elseif ImGui.IsKeyPressedEx(ImGuiKey.PageDown, ImGuiInputFlags.Repeat, ImGuiKeyOwner_NoOwner) then + g.NavMoveDir = 3 --[[ImGuiDir.Down]] -- Because our scoring rect is offset up, we request the down direction (so we can always land on the last item) + g.NavMoveClipDir = 2 --[[ImGuiDir.Up]] + g.NavMoveFlags = bit32.bor(16 --[[ImGuiNavMoveFlags.AllowCurrentNavId]], 2048 --[[ImGuiNavMoveFlags.IsPageMove]]) -- ImGuiNavMoveFlags.AlsoScoreVisibleSet may be added later + elseif ImGui.IsKeyPressedEx(518 --[[ImGuiKey.PageDown]], 1 --[[ImGuiInputFlags.Repeat]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) then nav_scoring_rect_offset_y = page_offset_y - g.NavMoveDir = ImGuiDir.Up -- Because our scoring rect is offset down, we request the up direction (so we can always land on the last item) - g.NavMoveClipDir = ImGuiDir.Down - g.NavMoveFlags = bit32.bor(ImGuiNavMoveFlags.AllowCurrentNavId, ImGuiNavMoveFlags.IsPageMove) -- ImGuiNavMoveFlags.AlsoScoreVisibleSet may be added later + g.NavMoveDir = 2 --[[ImGuiDir.Up]] -- Because our scoring rect is offset down, we request the up direction (so we can always land on the last item) + g.NavMoveClipDir = 3 --[[ImGuiDir.Down]] + g.NavMoveFlags = bit32.bor(16 --[[ImGuiNavMoveFlags.AllowCurrentNavId]], 2048 --[[ImGuiNavMoveFlags.IsPageMove]]) -- ImGuiNavMoveFlags.AlsoScoreVisibleSet may be added later elseif home_pressed then -- FIXME-NAV: handling of Home/End is assuming that the top/bottom most item will be visible with Scroll.y == 0/ScrollMax.y -- Scrolling will be handled via the ImGuiNavMoveFlags.ScrollToEdgeY flag, we don't scroll immediately to avoid scrolling happening before nav result. @@ -16629,16 +16663,16 @@ function ImGui.NavUpdatePageUpPageDown() if nav_rect_rel:IsInverted() then nav_rect_rel.Min.x = 0.0; nav_rect_rel.Max.x = 0.0 end - g.NavMoveDir = ImGuiDir.Down - g.NavMoveFlags = bit32.bor(ImGuiNavMoveFlags.AllowCurrentNavId, ImGuiNavMoveFlags.ScrollToEdgeY) + g.NavMoveDir = 3 --[[ImGuiDir.Down]] + g.NavMoveFlags = bit32.bor(16 --[[ImGuiNavMoveFlags.AllowCurrentNavId]], 64 --[[ImGuiNavMoveFlags.ScrollToEdgeY]]) -- FIXME-NAV: MoveClipDir left to _None, intentional? elseif end_pressed then nav_rect_rel.Min.y = window.ContentSize.y; nav_rect_rel.Max.y = window.ContentSize.y if nav_rect_rel:IsInverted() then nav_rect_rel.Min.x = 0.0; nav_rect_rel.Max.x = 0.0 end - g.NavMoveDir = ImGuiDir.Up - g.NavMoveFlags = bit32.bor(ImGuiNavMoveFlags.AllowCurrentNavId, ImGuiNavMoveFlags.ScrollToEdgeY) + g.NavMoveDir = 2 --[[ImGuiDir.Up]] + g.NavMoveFlags = bit32.bor(16 --[[ImGuiNavMoveFlags.AllowCurrentNavId]], 64 --[[ImGuiNavMoveFlags.ScrollToEdgeY]]) -- FIXME-NAV: MoveClipDir left to _None, intentional? end return nav_scoring_rect_offset_y @@ -16650,41 +16684,41 @@ function ImGui.NavUpdateCreateMoveRequest() local g = GImGui local io = g.IO local window = g.NavWindow - local nav_gamepad_active = bit32.band(io.ConfigFlags, ImGuiConfigFlags.NavEnableGamepad) ~= 0 and bit32.band(io.BackendFlags, ImGuiBackendFlags.HasGamepad) ~= 0 - local nav_keyboard_active = bit32.band(io.ConfigFlags, ImGuiConfigFlags.NavEnableKeyboard) ~= 0 + local nav_gamepad_active = bit32.band(io.ConfigFlags, 2 --[[ImGuiConfigFlags.NavEnableGamepad]]) ~= 0 and bit32.band(io.BackendFlags, 1 --[[ImGuiBackendFlags.HasGamepad]]) ~= 0 + local nav_keyboard_active = bit32.band(io.ConfigFlags, 1 --[[ImGuiConfigFlags.NavEnableKeyboard]]) ~= 0 if g.NavMoveForwardToNextFrame and window ~= nil then -- Forwarding previous request (which has been modified, e.g. wrap around menus rewrite the requests with a starting rectangle at the other side of the window) -- (preserve most state, which were already set by the NavMoveRequestForward() function) - IM_ASSERT(g.NavMoveDir ~= ImGuiDir.None and g.NavMoveClipDir ~= ImGuiDir.None) - IM_ASSERT(bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.Forwarded) ~= 0) + assert(g.NavMoveDir ~= (-1) --[[ImGuiDir.None]] and g.NavMoveClipDir ~= (-1) --[[ImGuiDir.None]]) + assert(bit32.band(g.NavMoveFlags, 128 --[[ImGuiNavMoveFlags.Forwarded]]) ~= 0) -- IMGUI_DEBUG_LOG_NAV("[nav] NavMoveRequestForward %d\n", g.NavMoveDir) else -- Initiate directional inputs request - g.NavMoveDir = ImGuiDir.None - g.NavMoveFlags = ImGuiNavMoveFlags.None - g.NavMoveScrollFlags = ImGuiScrollFlags.None - if window and not g.NavWindowingTarget and bit32.band(window.Flags, ImGuiWindowFlags.NoNavInputs) == 0 then - local repeat_mode = bit32.bor(ImGuiInputFlags.Repeat, ImGuiInputFlags.RepeatRateNavMove) - if not ImGui.IsActiveIdUsingNavDir(ImGuiDir.Left) and ((nav_gamepad_active and ImGui.IsKeyPressedEx(ImGuiKey.GamepadDpadLeft, repeat_mode, ImGuiKeyOwner_NoOwner)) or (nav_keyboard_active and ImGui.IsKeyPressedEx(ImGuiKey.LeftArrow, repeat_mode, ImGuiKeyOwner_NoOwner))) then g.NavMoveDir = ImGuiDir.Left end - if not ImGui.IsActiveIdUsingNavDir(ImGuiDir.Right) and ((nav_gamepad_active and ImGui.IsKeyPressedEx(ImGuiKey.GamepadDpadRight, repeat_mode, ImGuiKeyOwner_NoOwner)) or (nav_keyboard_active and ImGui.IsKeyPressedEx(ImGuiKey.RightArrow, repeat_mode, ImGuiKeyOwner_NoOwner))) then g.NavMoveDir = ImGuiDir.Right end - if not ImGui.IsActiveIdUsingNavDir(ImGuiDir.Up) and ((nav_gamepad_active and ImGui.IsKeyPressedEx(ImGuiKey.GamepadDpadUp, repeat_mode, ImGuiKeyOwner_NoOwner)) or (nav_keyboard_active and ImGui.IsKeyPressedEx(ImGuiKey.UpArrow, repeat_mode, ImGuiKeyOwner_NoOwner))) then g.NavMoveDir = ImGuiDir.Up end - if not ImGui.IsActiveIdUsingNavDir(ImGuiDir.Down) and ((nav_gamepad_active and ImGui.IsKeyPressedEx(ImGuiKey.GamepadDpadDown, repeat_mode, ImGuiKeyOwner_NoOwner)) or (nav_keyboard_active and ImGui.IsKeyPressedEx(ImGuiKey.DownArrow, repeat_mode, ImGuiKeyOwner_NoOwner))) then g.NavMoveDir = ImGuiDir.Down end + g.NavMoveDir = (-1) --[[ImGuiDir.None]] + g.NavMoveFlags = 0 --[[ImGuiNavMoveFlags.None]] + g.NavMoveScrollFlags = 0 --[[ImGuiScrollFlags.None]] + if window and not g.NavWindowingTarget and bit32.band(window.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) == 0 then + local repeat_mode = bit32.bor(1 --[[ImGuiInputFlags.Repeat]], 4 --[[ImGuiInputFlags.RepeatRateNavMove]]) + if not ImGui.IsActiveIdUsingNavDir(0 --[[ImGuiDir.Left]]) and ((nav_gamepad_active and ImGui.IsKeyPressedEx(638 --[[ImGuiKey.GamepadDpadLeft]], repeat_mode, 4294967295 --[[ImGuiKeyOwner_NoOwner]])) or (nav_keyboard_active and ImGui.IsKeyPressedEx(513 --[[ImGuiKey.LeftArrow]], repeat_mode, 4294967295 --[[ImGuiKeyOwner_NoOwner]]))) then g.NavMoveDir = 0 --[[ImGuiDir.Left]] end + if not ImGui.IsActiveIdUsingNavDir(1 --[[ImGuiDir.Right]]) and ((nav_gamepad_active and ImGui.IsKeyPressedEx(639 --[[ImGuiKey.GamepadDpadRight]], repeat_mode, 4294967295 --[[ImGuiKeyOwner_NoOwner]])) or (nav_keyboard_active and ImGui.IsKeyPressedEx(514 --[[ImGuiKey.RightArrow]], repeat_mode, 4294967295 --[[ImGuiKeyOwner_NoOwner]]))) then g.NavMoveDir = 1 --[[ImGuiDir.Right]] end + if not ImGui.IsActiveIdUsingNavDir(2 --[[ImGuiDir.Up]]) and ((nav_gamepad_active and ImGui.IsKeyPressedEx(640 --[[ImGuiKey.GamepadDpadUp]], repeat_mode, 4294967295 --[[ImGuiKeyOwner_NoOwner]])) or (nav_keyboard_active and ImGui.IsKeyPressedEx(515 --[[ImGuiKey.UpArrow]], repeat_mode, 4294967295 --[[ImGuiKeyOwner_NoOwner]]))) then g.NavMoveDir = 2 --[[ImGuiDir.Up]] end + if not ImGui.IsActiveIdUsingNavDir(3 --[[ImGuiDir.Down]]) and ((nav_gamepad_active and ImGui.IsKeyPressedEx(641 --[[ImGuiKey.GamepadDpadDown]], repeat_mode, 4294967295 --[[ImGuiKeyOwner_NoOwner]])) or (nav_keyboard_active and ImGui.IsKeyPressedEx(516 --[[ImGuiKey.DownArrow]], repeat_mode, 4294967295 --[[ImGuiKeyOwner_NoOwner]]))) then g.NavMoveDir = 3 --[[ImGuiDir.Down]] end end g.NavMoveClipDir = g.NavMoveDir - ImRect_Copy(g.NavScoringNoClipRect, ImRect(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX)) + ImRect_Copy(g.NavScoringNoClipRect, ImRect(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]])) end -- Update PageUp/PageDown/Home/End scroll -- FIXME-NAV: Consider enabling those keys even without the master ImGuiConfigFlags.NavEnableKeyboard flag? local scoring_page_offset_y = 0.0 - if window and g.NavMoveDir == ImGuiDir.None and nav_keyboard_active then + if window and g.NavMoveDir == (-1) --[[ImGuiDir.None]] and nav_keyboard_active then scoring_page_offset_y = ImGui.NavUpdatePageUpPageDown() end -- Submit g.NavMoveForwardToNextFrame = false - if g.NavMoveDir ~= ImGuiDir.None then + if g.NavMoveDir ~= (-1) --[[ImGuiDir.None]] then ImGui.NavMoveRequestSubmit(g.NavMoveDir, g.NavMoveClipDir, g.NavMoveFlags, g.NavMoveScrollFlags) end @@ -16701,9 +16735,9 @@ function ImGui.NavUpdateCreateMoveRequest() -- When using gamepad, we project the reference nav bounding box into window visible area. -- This is to allow resuming navigation inside the visible area after doing a large amount of scrolling, -- since with gamepad all movements are relative (can't focus a visible object like we can with the mouse). - if g.NavMoveSubmitted and g.NavInputSource == ImGuiInputSource.Gamepad and g.NavLayer == ImGuiNavLayer.Main and window ~= nil then -- and (g.NavMoveFlags & ImGuiNavMoveFlags_Forwarded)) - local clamp_x = bit32.band(g.NavMoveFlags, bit32.bor(ImGuiNavMoveFlags.LoopX, ImGuiNavMoveFlags.WrapX)) == 0 - local clamp_y = bit32.band(g.NavMoveFlags, bit32.bor(ImGuiNavMoveFlags.LoopY, ImGuiNavMoveFlags.WrapY)) == 0 + if g.NavMoveSubmitted and g.NavInputSource == 3 --[[ImGuiInputSource.Gamepad]] and g.NavLayer == 0 --[[ImGuiNavLayer.Main]] and window ~= nil then -- and (g.NavMoveFlags & ImGuiNavMoveFlags_Forwarded)) + local clamp_x = bit32.band(g.NavMoveFlags, bit32.bor(1 --[[ImGuiNavMoveFlags.LoopX]], 4 --[[ImGuiNavMoveFlags.WrapX]])) == 0 + local clamp_y = bit32.band(g.NavMoveFlags, bit32.bor(2 --[[ImGuiNavMoveFlags.LoopY]], 8 --[[ImGuiNavMoveFlags.WrapY]])) == 0 local inner_rect_rel = ImGui.WindowRectAbsToRel(window, ImRect(ImVec2(window.InnerRect.Min.x - 1, window.InnerRect.Min.y - 1), ImVec2(window.InnerRect.Max.x + 1, window.InnerRect.Max.y + 1))) -- Take account of changing scroll to handle triggering a new move request on a scrolling frame. (#6171) @@ -16715,10 +16749,10 @@ function ImGui.NavUpdateCreateMoveRequest() -- IMGUI_DEBUG_LOG_NAV("[nav] NavMoveRequest: clamp NavRectRel for gamepad move\n") local pad_x = ImMin(inner_rect_rel:GetWidth(), window.FontRefSize * 0.5) local pad_y = ImMin(inner_rect_rel:GetHeight(), window.FontRefSize * 0.5) -- Terrible approximation for the intent of starting navigation from first fully visible item - inner_rect_rel.Min.x = clamp_x and (inner_rect_rel.Min.x + pad_x) or -FLT_MAX - inner_rect_rel.Max.x = clamp_x and (inner_rect_rel.Max.x - pad_x) or FLT_MAX - inner_rect_rel.Min.y = clamp_y and (inner_rect_rel.Min.y + pad_y) or -FLT_MAX - inner_rect_rel.Max.y = clamp_y and (inner_rect_rel.Max.y - pad_y) or FLT_MAX + inner_rect_rel.Min.x = clamp_x and (inner_rect_rel.Min.x + pad_x) or -3.4028234663853e+38 --[[FLT_MAX]] + inner_rect_rel.Max.x = clamp_x and (inner_rect_rel.Max.x - pad_x) or 3.4028234663853e+38 --[[FLT_MAX]] + inner_rect_rel.Min.y = clamp_y and (inner_rect_rel.Min.y + pad_y) or -3.4028234663853e+38 --[[FLT_MAX]] + inner_rect_rel.Max.y = clamp_y and (inner_rect_rel.Max.y - pad_y) or 3.4028234663853e+38 --[[FLT_MAX]] window.NavRectRel[g.NavLayer]:ClipWithFull(inner_rect_rel) g.NavId = 0 end @@ -16734,10 +16768,10 @@ function ImGui.NavUpdateCreateMoveRequest() end scoring_rect = ImGui.WindowRectRelToAbs(window, nav_rect_rel) - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.IsPageMove) ~= 0 then + if bit32.band(g.NavMoveFlags, 2048 --[[ImGuiNavMoveFlags.IsPageMove]]) ~= 0 then -- When we start from a visible location, score visible items and prioritize this result. if window.InnerRect:Contains(scoring_rect) then - g.NavMoveFlags = bit32.bor(g.NavMoveFlags, ImGuiNavMoveFlags.AlsoScoreVisibleSet) + g.NavMoveFlags = bit32.bor(g.NavMoveFlags, 32 --[[ImGuiNavMoveFlags.AlsoScoreVisibleSet]]) end ImRect_Copy(g.NavScoringNoClipRect, scoring_rect) scoring_rect:TranslateY(scoring_page_offset_y) @@ -16748,7 +16782,7 @@ function ImGui.NavUpdateCreateMoveRequest() if g.NavMoveSubmitted then ImGui.NavBiasScoringRect(scoring_rect, window.RootWindowForNav.NavPreferredScoringPosRel[g.NavLayer], g.NavMoveDir, g.NavMoveFlags) end - IM_ASSERT(not scoring_rect:IsInverted()) -- Ensure we have a non-inverted bounding box here will allow us to remove extraneous ImFabs() calls in NavScoreItem(). + assert(not scoring_rect:IsInverted()) -- Ensure we have a non-inverted bounding box here will allow us to remove extraneous ImFabs() calls in NavScoreItem(). -- ImGui.GetForegroundDrawList():AddRectFilled(scoring_rect.Min - ImVec2(1, 1), scoring_rect.Max + ImVec2(1, 1), IM_COL32(255, 100, 0, 80)) -- [DEBUG] Post-bias -- if not g.NavScoringNoClipRect:IsInverted() then ImGui.GetForegroundDrawList():AddRectFilled(g.NavScoringNoClipRect.Min, g.NavScoringNoClipRect.Max, IM_COL32(100, 255, 0, 80)) end -- [DEBUG] end @@ -16759,12 +16793,12 @@ end function ImGui.NavUpdateCreateTabbingRequest() local g = GImGui local window = g.NavWindow - IM_ASSERT(g.NavMoveDir == ImGuiDir.None) - if window == nil or g.NavWindowingTarget ~= nil or bit32.band(window.Flags, ImGuiWindowFlags.NoNavInputs) ~= 0 or not g.ConfigNavEnableTabbing then + assert(g.NavMoveDir == (-1) --[[ImGuiDir.None]]) + if window == nil or g.NavWindowingTarget ~= nil or bit32.band(window.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) ~= 0 or not g.ConfigNavEnableTabbing then return end - local tab_pressed = ImGui.IsKeyPressedEx(ImGuiKey.Tab, ImGuiInputFlags.Repeat, ImGuiKeyOwner_NoOwner) and not g.IO.KeyCtrl and not g.IO.KeyAlt + local tab_pressed = ImGui.IsKeyPressedEx(512 --[[ImGuiKey.Tab]], 1 --[[ImGuiInputFlags.Repeat]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) and not g.IO.KeyCtrl and not g.IO.KeyAlt if not tab_pressed then return end @@ -16772,16 +16806,16 @@ function ImGui.NavUpdateCreateTabbingRequest() -- Initiate tabbing request -- (this is ALWAYS ENABLED, regardless of ImGuiConfigFlags.NavEnableKeyboard flag!) -- See NavProcessItemForTabbingRequest() for a description of the various forward/backward tabbing cases with and without wrapping. - local nav_keyboard_active = bit32.band(g.IO.ConfigFlags, ImGuiConfigFlags.NavEnableKeyboard) ~= 0 + local nav_keyboard_active = bit32.band(g.IO.ConfigFlags, 1 --[[ImGuiConfigFlags.NavEnableKeyboard]]) ~= 0 if nav_keyboard_active then g.NavTabbingDir = g.IO.KeyShift and -1 or ((g.NavCursorVisible == false and g.ActiveId == 0) and 0 or 1) else g.NavTabbingDir = g.IO.KeyShift and -1 or ((g.ActiveId == 0) and 0 or 1) end - local move_flags = bit32.bor(ImGuiNavMoveFlags.IsTabbing, ImGuiNavMoveFlags.Activate) - local scroll_flags = window.Appearing and bit32.bor(ImGuiScrollFlags.KeepVisibleEdgeX, ImGuiScrollFlags.AlwaysCenterY) or bit32.bor(ImGuiScrollFlags.KeepVisibleEdgeX, ImGuiScrollFlags.KeepVisibleEdgeY) - local clip_dir = (g.NavTabbingDir < 0) and ImGuiDir.Up or ImGuiDir.Down - ImGui.NavMoveRequestSubmit(ImGuiDir.None, clip_dir, move_flags, scroll_flags) -- FIXME-NAV: Once we refactor tabbing, add LegacyApi flag to not activate non-inputable. + local move_flags = bit32.bor(1024 --[[ImGuiNavMoveFlags.IsTabbing]], 4096 --[[ImGuiNavMoveFlags.Activate]]) + local scroll_flags = window.Appearing and bit32.bor(1 --[[ImGuiScrollFlags.KeepVisibleEdgeX]], 32 --[[ImGuiScrollFlags.AlwaysCenterY]]) or bit32.bor(1 --[[ImGuiScrollFlags.KeepVisibleEdgeX]], 2 --[[ImGuiScrollFlags.KeepVisibleEdgeY]]) + local clip_dir = (g.NavTabbingDir < 0) and 2 --[[ImGuiDir.Up]] or 3 --[[ImGuiDir.Down]] + ImGui.NavMoveRequestSubmit((-1) --[[ImGuiDir.None]], clip_dir, move_flags, scroll_flags) -- FIXME-NAV: Once we refactor tabbing, add LegacyApi flag to not activate non-inputable. g.NavTabbingCounter = -1 end @@ -16794,20 +16828,20 @@ function ImGui.NavUpdate() -- Set input source based on which keys are last pressed (as some features differs when used with Gamepad vs Keyboard) -- FIXME-NAV: Now that keys are separated maybe we can get rid of NavInputSource? - local nav_gamepad_active = bit32.band(io.ConfigFlags, ImGuiConfigFlags.NavEnableGamepad) ~= 0 and bit32.band(io.BackendFlags, ImGuiBackendFlags.HasGamepad) ~= 0 - if nav_gamepad_active and g.NavInputSource ~= ImGuiInputSource.Gamepad then + local nav_gamepad_active = bit32.band(io.ConfigFlags, 2 --[[ImGuiConfigFlags.NavEnableGamepad]]) ~= 0 and bit32.band(io.BackendFlags, 1 --[[ImGuiBackendFlags.HasGamepad]]) ~= 0 + if nav_gamepad_active and g.NavInputSource ~= 3 --[[ImGuiInputSource.Gamepad]] then for _, key in ipairs(nav_gamepad_keys_to_change_source) do if ImGui.IsKeyDown(key) then - g.NavInputSource = ImGuiInputSource.Gamepad + g.NavInputSource = 3 --[[ImGuiInputSource.Gamepad]] end end end - local nav_keyboard_active = bit32.band(io.ConfigFlags, ImGuiConfigFlags.NavEnableKeyboard) ~= 0 - if nav_keyboard_active and g.NavInputSource ~= ImGuiInputSource.Keyboard then + local nav_keyboard_active = bit32.band(io.ConfigFlags, 1 --[[ImGuiConfigFlags.NavEnableKeyboard]]) ~= 0 + if nav_keyboard_active and g.NavInputSource ~= 2 --[[ImGuiInputSource.Keyboard]] then for _, key in ipairs(nav_keyboard_keys_to_change_source) do if ImGui.IsKeyDown(key) then - g.NavInputSource = ImGuiInputSource.Keyboard + g.NavInputSource = 2 --[[ImGuiInputSource.Keyboard]] end end end @@ -16845,13 +16879,13 @@ function ImGui.NavUpdate() end end g.NavMousePosDirty = false - IM_ASSERT(g.NavLayer == ImGuiNavLayer.Main or g.NavLayer == ImGuiNavLayer.Menu) + assert(g.NavLayer == 0 --[[ImGuiNavLayer.Main]] or g.NavLayer == 1 --[[ImGuiNavLayer.Menu]]) -- Store our return window (for returning from Menu Layer to Main Layer) and clear it as soon as we step back in our own Layer 0 if g.NavWindow then ImGui.NavSaveLastChildNavWindowIntoParent(g.NavWindow) end - if g.NavWindow and g.NavWindow.NavLastChildNavWindow ~= nil and g.NavLayer == ImGuiNavLayer.Main then + if g.NavWindow and g.NavWindow.NavLastChildNavWindow ~= nil and g.NavLayer == 0 --[[ImGuiNavLayer.Main]] then g.NavWindow.NavLastChildNavWindow = nil end @@ -16859,7 +16893,7 @@ function ImGui.NavUpdate() ImGui.NavUpdateWindowing() -- Set output flags for user application - io.NavActive = (nav_keyboard_active or nav_gamepad_active) and g.NavWindow and bit32.band(g.NavWindow.Flags, ImGuiWindowFlags.NoNavInputs) == 0 + io.NavActive = (nav_keyboard_active or nav_gamepad_active) and g.NavWindow and bit32.band(g.NavWindow.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) == 0 io.NavVisible = (io.NavActive and g.NavId ~= 0 and g.NavCursorVisible) or (g.NavWindowingTarget ~= nil) -- Process NavCancel input (to close a popup, get back to parent, clear focus) @@ -16870,26 +16904,26 @@ function ImGui.NavUpdate() g.NavActivateId = 0 g.NavActivateDownId = 0 g.NavActivatePressedId = 0 - g.NavActivateFlags = ImGuiActivateFlags.None + g.NavActivateFlags = 0 --[[ImGuiActivateFlags.None]] - if g.NavId ~= 0 and g.NavCursorVisible and not g.NavWindowingTarget and g.NavWindow and bit32.band(g.NavWindow.Flags, ImGuiWindowFlags.NoNavInputs) == 0 then - local activate_down = (nav_keyboard_active and ImGui.IsKeyDown(ImGuiKey.Space, ImGuiKeyOwner_NoOwner)) or (nav_gamepad_active and ImGui.IsKeyDown(ImGuiKey.NavGamepadActivate, ImGuiKeyOwner_NoOwner)) - local activate_pressed = activate_down and ((nav_keyboard_active and ImGui.IsKeyPressedEx(ImGuiKey.Space, ImGuiInputFlags.None, ImGuiKeyOwner_NoOwner)) or (nav_gamepad_active and ImGui.IsKeyPressedEx(ImGuiKey.NavGamepadActivate, ImGuiInputFlags.None, ImGuiKeyOwner_NoOwner))) - local input_pressed_keyboard = nav_keyboard_active and (ImGui.IsKeyPressedEx(ImGuiKey.Enter, ImGuiInputFlags.None, ImGuiKeyOwner_NoOwner) or ImGui.IsKeyPressedEx(ImGuiKey.KeypadEnter, ImGuiInputFlags.None, ImGuiKeyOwner_NoOwner)) + if g.NavId ~= 0 and g.NavCursorVisible and not g.NavWindowingTarget and g.NavWindow and bit32.band(g.NavWindow.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) == 0 then + local activate_down = (nav_keyboard_active and ImGui.IsKeyDown(524 --[[ImGuiKey.Space]], 4294967295 --[[ImGuiKeyOwner_NoOwner]])) or (nav_gamepad_active and ImGui.IsKeyDown(ImGuiKey.NavGamepadActivate, 4294967295 --[[ImGuiKeyOwner_NoOwner]])) + local activate_pressed = activate_down and ((nav_keyboard_active and ImGui.IsKeyPressedEx(524 --[[ImGuiKey.Space]], 0 --[[ImGuiInputFlags.None]], 4294967295 --[[ImGuiKeyOwner_NoOwner]])) or (nav_gamepad_active and ImGui.IsKeyPressedEx(ImGuiKey.NavGamepadActivate, 0 --[[ImGuiInputFlags.None]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]))) + local input_pressed_keyboard = nav_keyboard_active and (ImGui.IsKeyPressedEx(525 --[[ImGuiKey.Enter]], 0 --[[ImGuiInputFlags.None]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) or ImGui.IsKeyPressedEx(627 --[[ImGuiKey.KeypadEnter]], 0 --[[ImGuiInputFlags.None]], 4294967295 --[[ImGuiKeyOwner_NoOwner]])) local input_pressed_gamepad = false - if activate_down and nav_gamepad_active and ImGui.IsKeyDown(ImGuiKey.NavGamepadActivate, ImGuiKeyOwner_NoOwner) and bit32.band(g.NavIdItemFlags, ImGuiItemFlags.Inputable) ~= 0 then -- requires ImGuiItemFlags.Inputable to avoid retriggering regular buttons. - if ImGui.GetKeyData(g, ImGuiKey.NavGamepadActivate).DownDurationPrev < NAV_ACTIVATE_INPUT_WITH_GAMEPAD_DELAY and ImGui.GetKeyData(g, ImGuiKey.NavGamepadActivate).DownDuration >= NAV_ACTIVATE_INPUT_WITH_GAMEPAD_DELAY then + if activate_down and nav_gamepad_active and ImGui.IsKeyDown(ImGuiKey.NavGamepadActivate, 4294967295 --[[ImGuiKeyOwner_NoOwner]]) and bit32.band(g.NavIdItemFlags, 1048576 --[[ImGuiItemFlags.Inputable]]) ~= 0 then -- requires ImGuiItemFlags.Inputable to avoid retriggering regular buttons. + if ImGui.GetKeyData(g, ImGuiKey.NavGamepadActivate).DownDurationPrev < 0.6 --[[NAV_ACTIVATE_INPUT_WITH_GAMEPAD_DELAY]] and ImGui.GetKeyData(g, ImGuiKey.NavGamepadActivate).DownDuration >= 0.6 --[[NAV_ACTIVATE_INPUT_WITH_GAMEPAD_DELAY]] then input_pressed_gamepad = true end end if g.ActiveId == 0 and activate_pressed then g.NavActivateId = g.NavId - g.NavActivateFlags = ImGuiActivateFlags.PreferTweak + g.NavActivateFlags = 2 --[[ImGuiActivateFlags.PreferTweak]] end if (g.ActiveId == 0 or g.ActiveId == g.NavId) and (input_pressed_keyboard or input_pressed_gamepad) then g.NavActivateId = g.NavId - g.NavActivateFlags = ImGuiActivateFlags.PreferInput + g.NavActivateFlags = 1 --[[ImGuiActivateFlags.PreferInput]] end if (g.ActiveId == 0 or g.ActiveId == g.NavId) and (activate_down or input_pressed_keyboard or input_pressed_gamepad) then -- FIXME-NAV: Unsure why input_pressed_xxx (migrated from input_down which was already dubious) g.NavActivateDownId = g.NavId @@ -16899,13 +16933,13 @@ function ImGui.NavUpdate() ImGui.NavHighlightActivated(g.NavId) end end - if g.NavWindow and bit32.band(g.NavWindow.Flags, ImGuiWindowFlags.NoNavInputs) ~= 0 then + if g.NavWindow and bit32.band(g.NavWindow.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) ~= 0 then g.NavCursorVisible = false elseif g.IO.ConfigNavCursorVisibleAlways and g.NavCursorHideFrames == 0 then g.NavCursorVisible = true end if g.NavActivateId ~= 0 then - IM_ASSERT(g.NavActivateDownId == g.NavActivateId) + assert(g.NavActivateDownId == g.NavActivateId) end -- Highlight @@ -16928,25 +16962,25 @@ function ImGui.NavUpdate() -- Process move requests ImGui.NavUpdateCreateMoveRequest() - if g.NavMoveDir == ImGuiDir.None then + if g.NavMoveDir == (-1) --[[ImGuiDir.None]] then ImGui.NavUpdateCreateTabbingRequest() end ImGui.NavUpdateAnyRequestFlag() g.NavIdIsAlive = false -- Scrolling - if g.NavWindow and bit32.band(g.NavWindow.Flags, ImGuiWindowFlags.NoNavInputs) == 0 and not g.NavWindowingTarget then + if g.NavWindow and bit32.band(g.NavWindow.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) == 0 and not g.NavWindowingTarget then -- *Fallback* manual-scroll with Nav directional keys when window has no navigable item local window = g.NavWindow local scroll_speed = IM_ROUND(window.FontRefSize * 100 * io.DeltaTime) -- We need round the scrolling speed because sub-pixel scroll isn't reliably supported. local move_dir = g.NavMoveDir - if window.DC.NavLayersActiveMask == 0x00 and window.DC.NavWindowHasScrollY and move_dir ~= ImGuiDir.None then - if move_dir == ImGuiDir.Left or move_dir == ImGuiDir.Right then - local delta = (move_dir == ImGuiDir.Left) and -1.0 or 1.0 + if window.DC.NavLayersActiveMask == 0x00 and window.DC.NavWindowHasScrollY and move_dir ~= (-1) --[[ImGuiDir.None]] then + if move_dir == 0 --[[ImGuiDir.Left]] or move_dir == 1 --[[ImGuiDir.Right]] then + local delta = (move_dir == 0 --[[ImGuiDir.Left]]) and -1.0 or 1.0 ImGui.SetScrollX(window, ImTrunc(window.Scroll.x + delta * scroll_speed)) end - if move_dir == ImGuiDir.Up or move_dir == ImGuiDir.Down then - local delta = (move_dir == ImGuiDir.Up) and -1.0 or 1.0 + if move_dir == 2 --[[ImGuiDir.Up]] or move_dir == 3 --[[ImGuiDir.Down]] then + local delta = (move_dir == 2 --[[ImGuiDir.Up]]) and -1.0 or 1.0 ImGui.SetScrollY(window, ImTrunc(window.Scroll.y + delta * scroll_speed)) end end @@ -16954,11 +16988,11 @@ function ImGui.NavUpdate() -- *Normal* Manual scroll with LStick -- Next movement request will clamp the NavId reference rectangle to the visible area, so navigation will resume within those bounds. if nav_gamepad_active then - local scroll_dir = ImGui.GetKeyMagnitude2d(ImGuiKey.GamepadLStickLeft, ImGuiKey.GamepadLStickRight, ImGuiKey.GamepadLStickUp, ImGuiKey.GamepadLStickDown) + local scroll_dir = ImGui.GetKeyMagnitude2d(648 --[[ImGuiKey.GamepadLStickLeft]], 649 --[[ImGuiKey.GamepadLStickRight]], 650 --[[ImGuiKey.GamepadLStickUp]], 651 --[[ImGuiKey.GamepadLStickDown]]) local tweak_factor = 1.0 - if ImGui.IsKeyDown(ImGuiKey.NavGamepadTweakSlow) then + if ImGui.IsKeyDown(642 --[[ImGuiKey.NavGamepadTweakSlow]]) then tweak_factor = 1.0 / 10.0 - elseif ImGui.IsKeyDown(ImGuiKey.NavGamepadTweakFast) then + elseif ImGui.IsKeyDown(643 --[[ImGuiKey.NavGamepadTweakFast]]) then tweak_factor = 10.0 end if scroll_dir.x ~= 0.0 and window.ScrollbarX then @@ -16979,8 +17013,8 @@ function ImGui.NavUpdate() -- Update mouse position if requested -- (This will take into account the possibility that a Scroll was queued in the window to offset our absolute mouse position before scroll has been applied) - if set_mouse_pos and io.ConfigNavMoveSetMousePos and bit32.band(io.BackendFlags, ImGuiBackendFlags.HasSetMousePos) ~= 0 then - ImGui.TeleportMousePos(ImGui.NavCalcPreferredRefPos(ImGuiWindowFlags.Popup)) + if set_mouse_pos and io.ConfigNavMoveSetMousePos and bit32.band(io.BackendFlags, 4 --[[ImGuiBackendFlags.HasSetMousePos]]) ~= 0 then + ImGui.TeleportMousePos(ImGui.NavCalcPreferredRefPos(67108864 --[[ImGuiWindowFlags.Popup]])) end -- [DEBUG] @@ -16995,35 +17029,35 @@ end -- - either to move most/all of those tests to the epilogue/end functions of the scope they are dealing with (e.g. exit child window in EndChild()) or in EndFrame(), to allow an earlier intercept function ImGui.NavUpdateCancelRequest() local g = GImGui - local nav_gamepad_active = bit32.band(g.IO.ConfigFlags, ImGuiConfigFlags.NavEnableGamepad) ~= 0 and bit32.band(g.IO.BackendFlags, ImGuiBackendFlags.HasGamepad) ~= 0 - local nav_keyboard_active = bit32.band(g.IO.ConfigFlags, ImGuiConfigFlags.NavEnableKeyboard) ~= 0 - if not (nav_keyboard_active and ImGui.IsKeyPressedEx(ImGuiKey.Escape, 0, ImGuiKeyOwner_NoOwner)) and not (nav_gamepad_active and ImGui.IsKeyPressedEx(ImGuiKey.NavGamepadCancel, 0, ImGuiKeyOwner_NoOwner)) then + local nav_gamepad_active = bit32.band(g.IO.ConfigFlags, 2 --[[ImGuiConfigFlags.NavEnableGamepad]]) ~= 0 and bit32.band(g.IO.BackendFlags, 1 --[[ImGuiBackendFlags.HasGamepad]]) ~= 0 + local nav_keyboard_active = bit32.band(g.IO.ConfigFlags, 1 --[[ImGuiConfigFlags.NavEnableKeyboard]]) ~= 0 + if not (nav_keyboard_active and ImGui.IsKeyPressedEx(526 --[[ImGuiKey.Escape]], 0, 4294967295 --[[ImGuiKeyOwner_NoOwner]])) and not (nav_gamepad_active and ImGui.IsKeyPressedEx(ImGuiKey.NavGamepadCancel, 0, 4294967295 --[[ImGuiKeyOwner_NoOwner]])) then return end -- IMGUI_DEBUG_LOG_NAV("[nav] NavUpdateCancelRequest()") if g.ActiveId ~= 0 then ImGui.ClearActiveID() - elseif g.NavLayer ~= ImGuiNavLayer.Main then + elseif g.NavLayer ~= 0 --[[ImGuiNavLayer.Main]] then -- Leave the "menu" layer - ImGui.NavRestoreLayer(ImGuiNavLayer.Main) + ImGui.NavRestoreLayer(0 --[[ImGuiNavLayer.Main]]) ImGui.SetNavCursorVisibleAfterMove() - elseif g.NavWindow and g.NavWindow ~= g.NavWindow.RootWindow and bit32.band(g.NavWindow.RootWindowForNav.Flags, ImGuiWindowFlags.Popup) == 0 and g.NavWindow.RootWindowForNav.ParentWindow then + elseif g.NavWindow and g.NavWindow ~= g.NavWindow.RootWindow and bit32.band(g.NavWindow.RootWindowForNav.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) == 0 and g.NavWindow.RootWindowForNav.ParentWindow then -- Exit child window local child_window = g.NavWindow.RootWindowForNav local parent_window = child_window.ParentWindow - IM_ASSERT(child_window.ChildId ~= 0) + assert(child_window.ChildId ~= 0) ImGui.FocusWindow(parent_window) - ImGui.SetNavID(child_window.ChildId, ImGuiNavLayer.Main, 0, ImGui.WindowRectAbsToRel(parent_window, child_window:Rect())) + ImGui.SetNavID(child_window.ChildId, 0 --[[ImGuiNavLayer.Main]], 0, ImGui.WindowRectAbsToRel(parent_window, child_window:Rect())) ImGui.SetNavCursorVisibleAfterMove() - elseif g.OpenPopupStack.Size > 0 and g.OpenPopupStack:back().Window ~= nil and bit32.band(g.OpenPopupStack:back().Window.Flags, ImGuiWindowFlags.Modal) == 0 then + elseif g.OpenPopupStack.Size > 0 and g.OpenPopupStack:back().Window ~= nil and bit32.band(g.OpenPopupStack:back().Window.Flags, 134217728 --[[ImGuiWindowFlags.Modal]]) == 0 then -- Close open popup/menu ImGui.ClosePopupToLevel(g.OpenPopupStack.Size - 1, true) else -- Clear NavLastId for popups but keep it for regular child window so we can leave one and come back where we were -- FIXME-NAV: This should happen on window appearing. if g.IO.ConfigNavEscapeClearFocusItem or g.IO.ConfigNavEscapeClearFocusWindow then - if g.NavWindow and bit32.band(g.NavWindow.Flags, ImGuiWindowFlags.Popup) ~= 0 then -- or not (g.NavWindow.Flags & ImGuiWindowFlags.ChildWindow) + if g.NavWindow and bit32.band(g.NavWindow.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 then -- or not (g.NavWindow.Flags & ImGuiWindowFlags.ChildWindow) g.NavWindow.NavLastIds[0] = 0 end end @@ -17045,9 +17079,9 @@ end local function ImGetDirQuadrantFromDelta(dx, dy) if ImFabs(dx) > ImFabs(dy) then - return (dx > 0.0) and ImGuiDir.Right or ImGuiDir.Left + return (dx > 0.0) and 1 --[[ImGuiDir.Right]] or 0 --[[ImGuiDir.Left]] end - return (dy > 0.0) and ImGuiDir.Down or ImGuiDir.Up + return (dy > 0.0) and 3 --[[ImGuiDir.Down]] or 2 --[[ImGuiDir.Up]] end local function NavScoreItemDistInterval(cand_min, cand_max, curr_min, curr_max) @@ -17079,7 +17113,7 @@ function ImGui.NavScoreItem(result, nav_bb) -- When entering through a NavFlattened border, we consider child window items as fully clipped for scoring if window.ParentWindow == g.NavWindow then - IM_ASSERT(bit32.band(bit32.bor(window.ChildFlags, g.NavWindow.ChildFlags), ImGuiChildFlags.NavFlattened) ~= 0) + assert(bit32.band(bit32.bor(window.ChildFlags, g.NavWindow.ChildFlags), 256 --[[ImGuiChildFlags.NavFlattened]]) ~= 0) if not window.ClipRect:Overlaps(cand) then return false end @@ -17122,7 +17156,7 @@ function ImGui.NavScoreItem(result, nav_bb) quadrant = ImGetDirQuadrantFromDelta(dcx, dcy) else -- Degenerate case: two overlapping buttons with same center, break ties arbitrarily (note that LastItemId here is really the _previous_ item order, but it doesn't matter) - quadrant = (g.LastItemData.ID < g.NavId) and ImGuiDir.Left or ImGuiDir.Right + quadrant = (g.LastItemData.ID < g.NavId) and 0 --[[ImGuiDir.Left]] or 1 --[[ImGuiDir.Right]] end local move_dir = g.NavMoveDir @@ -17145,7 +17179,7 @@ function ImGui.NavScoreItem(result, nav_bb) -- Still tied! we need to be extra-careful to make sure everything gets linked properly. We consistently break ties by symbolically moving "later" items -- (with higher index) to the right/downwards by an infinitesimal amount since we the current "best" button already (so it must have a lower index), -- this is fairly easy. This rule ensures that all buttons with dx==dy==0 will end up being linked in order of appearance along the x axis. - if (((move_dir == ImGuiDir.Up or move_dir == ImGuiDir.Down) and dby) or dbx) < 0.0 then -- moving bj to the right/down decreases distance + if (((move_dir == 2 --[[ImGuiDir.Up]] or move_dir == 3 --[[ImGuiDir.Down]]) and dby) or dbx) < 0.0 then -- moving bj to the right/down decreases distance new_best = true end end @@ -17157,9 +17191,9 @@ function ImGui.NavScoreItem(result, nav_bb) -- This is just to avoid buttons having no links in a particular direction when there's a suitable neighbor. you get good graphs without this too. -- 2017/09/29: FIXME: This now currently only enabled inside menu bars, ideally we'd disable it everywhere. Menus in particular need to catch failure. For general navigation it feels awkward. -- Disabling it may lead to disconnected graphs when nodes are very spaced out on different axis. Perhaps consider offering this as an option? - if result.DistBox == FLT_MAX and dist_axial < result.DistAxial then -- Check axial match - if g.NavLayer == ImGuiNavLayer.Menu and bit32.band(g.NavWindow.Flags, ImGuiWindowFlags.ChildMenu) == 0 then - if (move_dir == ImGuiDir.Left and dax < 0.0) or (move_dir == ImGuiDir.Right and dax > 0.0) or (move_dir == ImGuiDir.Up and day < 0.0) or (move_dir == ImGuiDir.Down and day > 0.0) then + if result.DistBox == 3.4028234663853e+38 --[[FLT_MAX]] and dist_axial < result.DistAxial then -- Check axial match + if g.NavLayer == 1 --[[ImGuiNavLayer.Menu]] and bit32.band(g.NavWindow.Flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) == 0 then + if (move_dir == 0 --[[ImGuiDir.Left]] and dax < 0.0) or (move_dir == 1 --[[ImGuiDir.Right]] and dax > 0.0) or (move_dir == 2 --[[ImGuiDir.Up]] and day < 0.0) or (move_dir == 3 --[[ImGuiDir.Down]] and day > 0.0) then result.DistAxial = dist_axial new_best = true end @@ -17178,8 +17212,8 @@ function ImGui.NavApplyItemToResult(result) result.FocusScopeId = g.CurrentFocusScopeId result.ItemFlags = g.LastItemData.ItemFlags ImRect_Copy(result.RectRel, ImGui.WindowRectAbsToRel(window, g.LastItemData.NavRect)) - if bit32.band(result.ItemFlags, ImGuiItemFlags.HasSelectionUserData) ~= 0 then - IM_ASSERT(g.NextItemData.SelectionUserData ~= ImGuiSelectionUserData_Invalid) + if bit32.band(result.ItemFlags, 2097152 --[[ImGuiItemFlags.HasSelectionUserData]]) ~= 0 then + assert(g.NextItemData.SelectionUserData ~= (-1) --[[ImGuiSelectionUserData_Invalid]]) result.SelectionUserData = g.NextItemData.SelectionUserData -- INTENTIONAL: At this point this field is not cleared in NextItemData. Avoid unnecessary copy to LastItemData. end end @@ -17205,7 +17239,7 @@ end function ImGui.NavProcessItemForTabbingRequest(id, item_flags, move_flags) local g = GImGui - if bit32.band(move_flags, ImGuiNavMoveFlags.FocusApi) == 0 then + if bit32.band(move_flags, 512 --[[ImGuiNavMoveFlags.FocusApi]]) == 0 then if g.NavLayer ~= g.CurrentWindow.DC.NavLayerCurrent then return end @@ -17218,10 +17252,10 @@ function ImGui.NavProcessItemForTabbingRequest(id, item_flags, move_flags) -- - Tabbing with _NavEnableKeyboard (space/enter/arrows): goes through every item. -- - Tabbing without _NavEnableKeyboard: goes through inputable items only. local can_stop - if bit32.band(move_flags, ImGuiNavMoveFlags.FocusApi) ~= 0 then + if bit32.band(move_flags, 512 --[[ImGuiNavMoveFlags.FocusApi]]) ~= 0 then can_stop = true else - can_stop = bit32.band(item_flags, ImGuiItemFlags.NoTabStop) == 0 and (bit32.band(g.IO.ConfigFlags, ImGuiConfigFlags.NavEnableKeyboard) ~= 0 or bit32.band(item_flags, ImGuiItemFlags.Inputable) ~= 0) + can_stop = bit32.band(item_flags, 1 --[[ImGuiItemFlags.NoTabStop]]) == 0 and (bit32.band(g.IO.ConfigFlags, 1 --[[ImGuiConfigFlags.NavEnableKeyboard]]) ~= 0 or bit32.band(item_flags, 1048576 --[[ImGuiItemFlags.Inputable]]) ~= 0) end -- Always store in NavMoveResultLocal (unlike directional request which uses NavMoveResultOther on sibling/flattened windows) @@ -17277,9 +17311,9 @@ function ImGui.NavProcessItem() end -- Process Init Request - if g.NavInitRequest and g.NavLayer == window.DC.NavLayerCurrent and bit32.band(item_flags, ImGuiItemFlags.Disabled) == 0 then + if g.NavInitRequest and g.NavLayer == window.DC.NavLayerCurrent and bit32.band(item_flags, 64 --[[ImGuiItemFlags.Disabled]]) == 0 then -- Even if 'ImGuiItemFlags.NoNavDefaultFocus' is on (typically collapse/close button) we record the first ResultId so they can be used as a fallback - local candidate_for_nav_default_focus = bit32.band(item_flags, ImGuiItemFlags.NoNavDefaultFocus) == 0 + local candidate_for_nav_default_focus = bit32.band(item_flags, 4 --[[ImGuiItemFlags.NoNavDefaultFocus]]) == 0 if candidate_for_nav_default_focus or g.NavInitResult.ID == 0 then ImGui.NavApplyItemToResult(g.NavInitResult) end @@ -17291,12 +17325,12 @@ function ImGui.NavProcessItem() -- Process Move Request (scoring for navigation) -- FIXME-NAV: Consider policy for double scoring (scoring from NavScoringRect + scoring from a rect wrapped according to current wrapping policy) - if g.NavMoveScoringItems and bit32.band(item_flags, ImGuiItemFlags.Disabled) == 0 then - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.FocusApi) ~= 0 or bit32.band(window.Flags, ImGuiWindowFlags.NoNavInputs) == 0 then - local is_tabbing = bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.IsTabbing) ~= 0 + if g.NavMoveScoringItems and bit32.band(item_flags, 64 --[[ImGuiItemFlags.Disabled]]) == 0 then + if bit32.band(g.NavMoveFlags, 512 --[[ImGuiNavMoveFlags.FocusApi]]) ~= 0 or bit32.band(window.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) == 0 then + local is_tabbing = bit32.band(g.NavMoveFlags, 1024 --[[ImGuiNavMoveFlags.IsTabbing]]) ~= 0 if is_tabbing then ImGui.NavProcessItemForTabbingRequest(id, item_flags, g.NavMoveFlags) - elseif g.NavId ~= id or bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.AllowCurrentNavId) ~= 0 then + elseif g.NavId ~= id or bit32.band(g.NavMoveFlags, 16 --[[ImGuiNavMoveFlags.AllowCurrentNavId]]) ~= 0 then local result = (window == g.NavWindow) and g.NavMoveResultLocal or g.NavMoveResultOther if ImGui.NavScoreItem(result, nav_bb) then ImGui.NavApplyItemToResult(result) @@ -17304,7 +17338,7 @@ function ImGui.NavProcessItem() -- Features like PageUp/PageDown need to maintain a separate score for the visible set of items. local VISIBLE_RATIO = 0.70 - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.AlsoScoreVisibleSet) ~= 0 then + if bit32.band(g.NavMoveFlags, 32 --[[ImGuiNavMoveFlags.AlsoScoreVisibleSet]]) ~= 0 then local r = window.InnerRect -- window.ClipRect if r:Overlaps(nav_bb) then if ImClamp(nav_bb.Max.y, r.Min.y, r.Max.y) - ImClamp(nav_bb.Min.y, r.Min.y, r.Max.y) >= (nav_bb.Max.y - nav_bb.Min.y) * VISIBLE_RATIO then @@ -17328,8 +17362,8 @@ function ImGui.NavProcessItem() g.NavFocusScopeId = g.CurrentFocusScopeId g.NavIdIsAlive = true g.NavIdItemFlags = item_flags - if bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.HasSelectionUserData) ~= 0 then - IM_ASSERT(g.NextItemData.SelectionUserData ~= ImGuiSelectionUserData_Invalid) + if bit32.band(g.LastItemData.ItemFlags, 2097152 --[[ImGuiItemFlags.HasSelectionUserData]]) ~= 0 then + assert(g.NextItemData.SelectionUserData ~= (-1) --[[ImGuiSelectionUserData_Invalid]]) g.NavLastValidSelectionUserData = g.NextItemData.SelectionUserData -- INTENTIONAL: At this point this field is not cleared in NextItemData. Avoid unnecessary copy to LastItemData. end window.NavRectRel[window.DC.NavLayerCurrent] = ImGui.WindowRectAbsToRel(window, nav_bb) -- Store item bounding box (relative to window position) @@ -17350,7 +17384,7 @@ function ImGui.NavInitRequestApplyResult() g.NavJustMovedToFocusScopeId = result.FocusScopeId g.NavJustMovedToKeyMods = 0 g.NavJustMovedToIsTabbing = false - g.NavJustMovedToHasSelectionData = bit32.band(result.ItemFlags, ImGuiItemFlags.HasSelectionUserData) ~= 0 + g.NavJustMovedToHasSelectionData = bit32.band(result.ItemFlags, 2097152 --[[ImGuiItemFlags.HasSelectionUserData]]) ~= 0 end -- Apply result from previous navigation init request (will typically select the first item, unless SetItemDefaultFocus() has been called) @@ -17358,7 +17392,7 @@ function ImGui.NavInitRequestApplyResult() -- IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: ApplyResult: NavID 0x%08X in Layer %d Window \"%s\"\n", result->ID, g.NavLayer, g.NavWindow->Name) ImGui.SetNavID(result.ID, g.NavLayer, result.FocusScopeId, result.RectRel) g.NavIdIsAlive = true -- Mark as alive from previous frame as we got a result - if result.SelectionUserData ~= ImGuiSelectionUserData_Invalid then + if result.SelectionUserData ~= (-1) --[[ImGuiSelectionUserData_Invalid]] then g.NavLastValidSelectionUserData = result.SelectionUserData end if g.NavInitRequestFromMove then @@ -17381,19 +17415,19 @@ function ImGui.NavMoveRequestApplyResult() end -- Tabbing forward wrap - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.IsTabbing) ~= 0 and result == nil then + if bit32.band(g.NavMoveFlags, 1024 --[[ImGuiNavMoveFlags.IsTabbing]]) ~= 0 and result == nil then if (g.NavTabbingCounter == 1 or g.NavTabbingDir == 0) and g.NavTabbingResultFirst.ID ~= 0 then result = g.NavTabbingResultFirst end end -- In a situation when there are no results but NavId != 0, re-enable the Navigation highlight (because g.NavId is not considered as a possible result) - local axis = (g.NavMoveDir == ImGuiDir.Up or g.NavMoveDir == ImGuiDir.Down) and ImGuiAxis.Y or ImGuiAxis.X + local axis = (g.NavMoveDir == 2 --[[ImGuiDir.Up]] or g.NavMoveDir == 3 --[[ImGuiDir.Down]]) and 2 --[[ImGuiAxis.Y]] or 1 --[[ImGuiAxis.X]] if result == nil then - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.IsTabbing) ~= 0 then - g.NavMoveFlags = bit32.bor(g.NavMoveFlags, ImGuiNavMoveFlags.NoSetNavCursorVisible) + if bit32.band(g.NavMoveFlags, 1024 --[[ImGuiNavMoveFlags.IsTabbing]]) ~= 0 then + g.NavMoveFlags = bit32.bor(g.NavMoveFlags, 16384 --[[ImGuiNavMoveFlags.NoSetNavCursorVisible]]) end - if g.NavId ~= 0 and bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.NoSetNavCursorVisible) == 0 then + if g.NavId ~= 0 and bit32.band(g.NavMoveFlags, 16384 --[[ImGuiNavMoveFlags.NoSetNavCursorVisible]]) == 0 then ImGui.SetNavCursorVisibleAfterMove() end ImGui.NavClearPreferredPosForAxis(axis) -- On a failed move, clear preferred pos for this axis. @@ -17402,7 +17436,7 @@ function ImGui.NavMoveRequestApplyResult() end -- PageUp/PageDown behavior first jumps to the bottom/top mostly visible item, _otherwise_ use the result from the previous/next page. - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.AlsoScoreVisibleSet) ~= 0 + if bit32.band(g.NavMoveFlags, 32 --[[ImGuiNavMoveFlags.AlsoScoreVisibleSet]]) ~= 0 and g.NavMoveResultLocalVisible.ID ~= 0 and g.NavMoveResultLocalVisible.ID ~= g.NavId then result = g.NavMoveResultLocalVisible end @@ -17414,16 +17448,16 @@ function ImGui.NavMoveRequestApplyResult() result = g.NavMoveResultOther end end - IM_ASSERT(g.NavWindow and result.Window) + assert(g.NavWindow and result.Window) -- Scroll to keep newly navigated item fully into view. - if g.NavLayer == ImGuiNavLayer.Main then + if g.NavLayer == 0 --[[ImGuiNavLayer.Main]] then local rect_abs = ImGui.WindowRectRelToAbs(result.Window, result.RectRel) ImGui.ScrollToRectEx(result.Window, rect_abs, g.NavMoveScrollFlags) - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.ScrollToEdgeY) ~= 0 then + if bit32.band(g.NavMoveFlags, 64 --[[ImGuiNavMoveFlags.ScrollToEdgeY]]) ~= 0 then -- FIXME: Should remove this? Or make more precise: use ScrollToRectEx() with edge? - local scroll_target = (g.NavMoveDir == ImGuiDir.Up) and result.Window.ScrollMax.y or 0.0 + local scroll_target = (g.NavMoveDir == 2 --[[ImGuiDir.Up]]) and result.Window.ScrollMax.y or 0.0 ImGui.SetScrollY(result.Window, scroll_target) end end @@ -17431,26 +17465,26 @@ function ImGui.NavMoveRequestApplyResult() if g.NavWindow ~= result.Window then -- IMGUI_DEBUG_LOG_FOCUS("[focus] NavMoveRequest: SetNavWindow(\"%s\")\n", result->Window->Name) g.NavWindow = result.Window - g.NavLastValidSelectionUserData = ImGuiSelectionUserData_Invalid + g.NavLastValidSelectionUserData = (-1) --[[ImGuiSelectionUserData_Invalid]] end -- Clear active id unless requested not to -- FIXME: ImGuiNavMoveFlags.NoClearActiveId is currently unused as we don't have a clear strategy to preserve active id after interaction, -- so this is mostly provided as a gateway for further experiments (see #1418, #2890) - if g.ActiveId ~= result.ID and bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.NoClearActiveId) == 0 then + if g.ActiveId ~= result.ID and bit32.band(g.NavMoveFlags, 32768 --[[ImGuiNavMoveFlags.NoClearActiveId]]) == 0 then ImGui.ClearActiveID() end -- Don't set NavJustMovedToId if just landed on the same spot (which may happen with ImGuiNavMoveFlags.AllowCurrentNavId) -- PageUp/PageDown however sets always set NavJustMovedTo (vs Home/End which doesn't) mimicking Windows behavior. - if (g.NavId ~= result.ID or bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.IsPageMove) ~= 0) - and bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.NoSelect) == 0 then + if (g.NavId ~= result.ID or bit32.band(g.NavMoveFlags, 2048 --[[ImGuiNavMoveFlags.IsPageMove]]) ~= 0) + and bit32.band(g.NavMoveFlags, 8192 --[[ImGuiNavMoveFlags.NoSelect]]) == 0 then g.NavJustMovedFromFocusScopeId = g.NavFocusScopeId g.NavJustMovedToId = result.ID g.NavJustMovedToFocusScopeId = result.FocusScopeId g.NavJustMovedToKeyMods = g.NavMoveKeyMods - g.NavJustMovedToIsTabbing = bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.IsTabbing) ~= 0 - g.NavJustMovedToHasSelectionData = bit32.band(result.ItemFlags, ImGuiItemFlags.HasSelectionUserData) ~= 0 + g.NavJustMovedToIsTabbing = bit32.band(g.NavMoveFlags, 1024 --[[ImGuiNavMoveFlags.IsTabbing]]) ~= 0 + g.NavJustMovedToHasSelectionData = bit32.band(result.ItemFlags, 2097152 --[[ImGuiItemFlags.HasSelectionUserData]]) ~= 0 -- IMGUI_DEBUG_LOG_NAV("[nav] NavJustMovedFromFocusScopeId = 0x%08X, NavJustMovedToFocusScopeId = 0x%08X\n", g.NavJustMovedFromFocusScopeId, g.NavJustMovedToFocusScopeId) end @@ -17460,37 +17494,37 @@ function ImGui.NavMoveRequestApplyResult() local preferred_scoring_pos_rel = ImVec2() ImVec2_Copy(preferred_scoring_pos_rel, root_for_nav.NavPreferredScoringPosRel[g.NavLayer]) ImGui.SetNavID(result.ID, g.NavLayer, result.FocusScopeId, result.RectRel) - if result.SelectionUserData ~= ImGuiSelectionUserData_Invalid then + if result.SelectionUserData ~= (-1) --[[ImGuiSelectionUserData_Invalid]] then g.NavLastValidSelectionUserData = result.SelectionUserData end -- Restore last preferred position for current axis -- (storing in RootWindowForNav-> as the info is desirable at the beginning of a Move Request. In theory all storage should use RootWindowForNav..) - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.IsTabbing) == 0 then + if bit32.band(g.NavMoveFlags, 1024 --[[ImGuiNavMoveFlags.IsTabbing]]) == 0 then preferred_scoring_pos_rel[axis] = result.RectRel:GetCenter()[axis] ImVec2_Copy(root_for_nav.NavPreferredScoringPosRel[g.NavLayer], preferred_scoring_pos_rel) end -- Tabbing: Activates Inputable, otherwise only Focus - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.IsTabbing) ~= 0 - and bit32.band(result.ItemFlags, ImGuiItemFlags.Inputable) == 0 then - g.NavMoveFlags = bit32.band(g.NavMoveFlags, bit32.bnot(ImGuiNavMoveFlags.Activate)) + if bit32.band(g.NavMoveFlags, 1024 --[[ImGuiNavMoveFlags.IsTabbing]]) ~= 0 + and bit32.band(result.ItemFlags, 1048576 --[[ImGuiItemFlags.Inputable]]) == 0 then + g.NavMoveFlags = bit32.band(g.NavMoveFlags, bit32.bnot(4096 --[[ImGuiNavMoveFlags.Activate]])) end -- Activate - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.Activate) ~= 0 then + if bit32.band(g.NavMoveFlags, 4096 --[[ImGuiNavMoveFlags.Activate]]) ~= 0 then g.NavNextActivateId = result.ID - g.NavNextActivateFlags = ImGuiActivateFlags.None - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.FocusApi) ~= 0 then - g.NavNextActivateFlags = bit32.bor(g.NavNextActivateFlags, ImGuiActivateFlags.FromFocusApi) + g.NavNextActivateFlags = 0 --[[ImGuiActivateFlags.None]] + if bit32.band(g.NavMoveFlags, 512 --[[ImGuiNavMoveFlags.FocusApi]]) ~= 0 then + g.NavNextActivateFlags = bit32.bor(g.NavNextActivateFlags, 32 --[[ImGuiActivateFlags.FromFocusApi]]) end - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.IsTabbing) ~= 0 then - g.NavNextActivateFlags = bit32.bor(g.NavNextActivateFlags, ImGuiActivateFlags.PreferInput, ImGuiActivateFlags.TryToPreserveState, ImGuiActivateFlags.FromTabbing) + if bit32.band(g.NavMoveFlags, 1024 --[[ImGuiNavMoveFlags.IsTabbing]]) ~= 0 then + g.NavNextActivateFlags = bit32.bor(g.NavNextActivateFlags, 1 --[[ImGuiActivateFlags.PreferInput]], 4 --[[ImGuiActivateFlags.TryToPreserveState]], 8 --[[ImGuiActivateFlags.FromTabbing]]) end end -- Make nav cursor visible - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.NoSetNavCursorVisible) == 0 then + if bit32.band(g.NavMoveFlags, 16384 --[[ImGuiNavMoveFlags.NoSetNavCursorVisible]]) == 0 then ImGui.SetNavCursorVisibleAfterMove() end end @@ -17510,10 +17544,10 @@ function ImGui.NavMoveRequestResolveWithPastTreeNode(result, tree_node_data) local g = GImGui g.NavMoveScoringItems = false g.LastItemData.ID = tree_node_data.ID - g.LastItemData.ItemFlags = bit32.band(tree_node_data.ItemFlags, bit32.bnot(ImGuiItemFlags.HasSelectionUserData)) -- Losing SelectionUserData, recovered next-frame (cheaper). + g.LastItemData.ItemFlags = bit32.band(tree_node_data.ItemFlags, bit32.bnot(2097152 --[[ImGuiItemFlags.HasSelectionUserData]])) -- Losing SelectionUserData, recovered next-frame (cheaper). ImRect_Copy(g.LastItemData.NavRect, tree_node_data.NavRect) ImGui.NavApplyItemToResult(result) -- Result this instead of implementing a NavApplyPastTreeNodeToResult() - ImGui.NavClearPreferredPosForAxis(ImGuiAxis.Y) + ImGui.NavClearPreferredPosForAxis(2 --[[ImGuiAxis.Y]]) ImGui.NavUpdateAnyRequestFlag() end @@ -17531,12 +17565,12 @@ end --- @param scroll_flags ImGuiScrollFlags function ImGui.NavMoveRequestForward(move_dir, clip_dir, move_flags, scroll_flags) local g = GImGui - IM_ASSERT(g.NavMoveForwardToNextFrame == false) + assert(g.NavMoveForwardToNextFrame == false) ImGui.NavMoveRequestCancel() g.NavMoveForwardToNextFrame = true g.NavMoveDir = move_dir g.NavMoveClipDir = clip_dir - g.NavMoveFlags = bit32.bor(move_flags, ImGuiNavMoveFlags.Forwarded) + g.NavMoveFlags = bit32.bor(move_flags, 128 --[[ImGuiNavMoveFlags.Forwarded]]) g.NavMoveScrollFlags = scroll_flags end @@ -17546,12 +17580,12 @@ end --- @param wrap_flags ImGuiNavMoveFlags function ImGui.NavMoveRequestTryWrapping(window, wrap_flags) local g = GImGui - IM_ASSERT(bit32.band(wrap_flags, ImGuiNavMoveFlags.WrapMask_) ~= 0 and bit32.band(wrap_flags, bit32.bnot(ImGuiNavMoveFlags.WrapMask_)) == 0) -- Call with _WrapX, _WrapY, _LoopX, _LoopY + assert(bit32.band(wrap_flags, 15 --[[ImGuiNavMoveFlags.WrapMask_]]) ~= 0 and bit32.band(wrap_flags, bit32.bnot(15 --[[ImGuiNavMoveFlags.WrapMask_]])) == 0) -- Call with _WrapX, _WrapY, _LoopX, _LoopY -- In theory we should test for NavMoveRequestButNoResultYet() but there's no point doing it: -- as NavEndFrame() will do the same test. It will end up calling NavUpdateCreateWrappingRequest(). if g.NavWindow == window and g.NavMoveScoringItems and g.NavLayer == window.DC.NavLayerCurrent then - g.NavMoveFlags = bit32.bor(bit32.band(g.NavMoveFlags, bit32.bnot(ImGuiNavMoveFlags.WrapMask_)), wrap_flags) + g.NavMoveFlags = bit32.bor(bit32.band(g.NavMoveFlags, bit32.bnot(15 --[[ImGuiNavMoveFlags.WrapMask_]])), wrap_flags) end end @@ -17665,7 +17699,7 @@ function ImGui.SetCurrentViewport(current_window, viewport) g.CurrentDpiScale = viewport and viewport.DpiScale or 1.0 g.CurrentViewport = viewport - IM_ASSERT(g.CurrentDpiScale > 0.0 and g.CurrentDpiScale < 99.0) -- Typical correct values would be between 1.0f and 4.0f + assert(g.CurrentDpiScale > 0.0 and g.CurrentDpiScale < 99.0) -- Typical correct values would be between 1.0f and 4.0f -- IMGUI_DEBUG_LOG_VIEWPORT("[viewport] SetCurrentViewport changed '%s' 0x%08X", current_window and current_window.Name or "NULL", viewport and viewport.ID or 0) if g.IO.ConfigDpiScaleFonts then @@ -17697,11 +17731,11 @@ end function ImGui.GetWindowAlwaysWantOwnViewport(window) -- Tooltips and menus are not automatically forced into their own viewport when the NoMerge flag is set, however the multiplication of viewports makes them more likely to protrude and create their own. local g = GImGui - if g.IO.ConfigViewportsNoAutoMerge or (bit32.band(window.WindowClass.ViewportFlagsOverrideSet, ImGuiViewportFlags.NoAutoMerge) ~= 0) then - if bit32.band(g.ConfigFlagsCurrFrame, ImGuiConfigFlags.ViewportsEnable) ~= 0 then + if g.IO.ConfigViewportsNoAutoMerge or (bit32.band(window.WindowClass.ViewportFlagsOverrideSet, 512 --[[ImGuiViewportFlags.NoAutoMerge]]) ~= 0) then + if bit32.band(g.ConfigFlagsCurrFrame, 1024 --[[ImGuiConfigFlags.ViewportsEnable]]) ~= 0 then if not window.DockIsActive then - if bit32.band(window.Flags, bit32.bor(ImGuiWindowFlags.ChildWindow, ImGuiWindowFlags.ChildMenu, ImGuiWindowFlags.Tooltip)) == 0 then - if bit32.band(window.Flags, ImGuiWindowFlags.Popup) == 0 or bit32.band(window.Flags, ImGuiWindowFlags.Modal) ~= 0 then + if bit32.band(window.Flags, bit32.bor(16777216 --[[ImGuiWindowFlags.ChildWindow]], 268435456 --[[ImGuiWindowFlags.ChildMenu]], 33554432 --[[ImGuiWindowFlags.Tooltip]])) == 0 then + if bit32.band(window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) == 0 or bit32.band(window.Flags, 134217728 --[[ImGuiWindowFlags.Modal]]) ~= 0 then return true end end @@ -17719,7 +17753,7 @@ end function ImGui.IsViewportAbove(potential_above, potential_below) -- If ImGuiBackendFlags.HasParentViewport if set, ->ParentViewport chain should be accurate. local g = GImGui - if bit32.band(g.IO.BackendFlags, ImGuiBackendFlags.HasParentViewport) ~= 0 then + if bit32.band(g.IO.BackendFlags, 8192 --[[ImGuiBackendFlags.HasParentViewport]]) ~= 0 then local v = potential_above --[[@as ImGuiViewport]] while v ~= nil and v.ParentViewport do if v.ParentViewport == potential_below then @@ -17743,16 +17777,16 @@ end --- @param viewport_dst ImGuiViewportP function ImGui.UpdateTryMergeWindowIntoHostViewport(window, viewport_dst) local g = GImGui - IM_ASSERT(window == window.RootWindowDockTree) + assert(window == window.RootWindowDockTree) local viewport_src = window.Viewport -- Current viewport if viewport_src == viewport_dst then return false end - if bit32.band(viewport_dst.Flags, ImGuiViewportFlags.CanHostOtherWindows) == 0 then + if bit32.band(viewport_dst.Flags, 2048 --[[ImGuiViewportFlags.CanHostOtherWindows]]) == 0 then return false end - if bit32.band(viewport_dst.Flags, ImGuiViewportFlags.IsMinimized) ~= 0 then + if bit32.band(viewport_dst.Flags, 4096 --[[ImGuiViewportFlags.IsMinimized]]) ~= 0 then return false end if not viewport_dst:GetMainRect():Contains(window:Rect()) then @@ -17791,7 +17825,7 @@ function ImGui.UpdateTryMergeWindowIntoHostViewport(window, viewport_dst) ImGui.SetWindowViewport(window, viewport_dst) - if bit32.band(window.Flags, ImGuiWindowFlags.NoBringToFrontOnFocus) == 0 then + if bit32.band(window.Flags, 8192 --[[ImGuiWindowFlags.NoBringToFrontOnFocus]]) == 0 then ImGui.BringWindowToDisplayFront(window) end @@ -17816,14 +17850,14 @@ end function ImGui.TranslateWindowsInViewport(viewport, old_pos, new_pos, old_size, new_size) local g = GImGui -- IMGUI_DEBUG_LOG_VIEWPORT("[viewport] TranslateWindowsInViewport 0x%08X", viewport.ID) - IM_ASSERT(viewport.Window == nil and (bit32.band(viewport.Flags, ImGuiViewportFlags.CanHostOtherWindows) ~= 0)) + assert(viewport.Window == nil and (bit32.band(viewport.Flags, 2048 --[[ImGuiViewportFlags.CanHostOtherWindows]]) ~= 0)) -- 1) We test if ImGuiConfigFlags.ViewportsEnable was just toggled, which allows us to conveniently -- translate imgui windows from OS-window-local to absolute coordinates or vice-versa. -- 2) If it's not going to fit into the new size, keep it at same absolute position. -- One problem with this is that most Win32 applications doesn't update their render while dragging, -- and so the window will appear to teleport when releasing the mouse. - local translate_all_windows = (bit32.band(g.ConfigFlagsCurrFrame, ImGuiConfigFlags.ViewportsEnable) ~= bit32.band(g.ConfigFlagsLastFrame, ImGuiConfigFlags.ViewportsEnable)) + local translate_all_windows = (bit32.band(g.ConfigFlagsCurrFrame, 1024 --[[ImGuiConfigFlags.ViewportsEnable]]) ~= bit32.band(g.ConfigFlagsLastFrame, 1024 --[[ImGuiConfigFlags.ViewportsEnable]])) local test_still_fit_rect = ImRect(old_pos, old_pos + old_size) local delta_pos = new_pos - old_pos @@ -17843,7 +17877,7 @@ function ImGui.FindHoveredViewportFromPlatformWindowStack(mouse_platform_pos) local g = GImGui local best_candidate = nil for _, viewport in g.Viewports:iter() do - if bit32.band(viewport.Flags, bit32.bor(ImGuiViewportFlags.NoInputs, ImGuiViewportFlags.IsMinimized)) == 0 and viewport:GetMainRect():Contains(mouse_platform_pos) then + if bit32.band(viewport.Flags, bit32.bor(128 --[[ImGuiViewportFlags.NoInputs]], 4096 --[[ImGuiViewportFlags.IsMinimized]])) == 0 and viewport:GetMainRect():Contains(mouse_platform_pos) then if best_candidate == nil or best_candidate.LastFocusedStampCount < viewport.LastFocusedStampCount then if viewport.PlatformWindowCreated then best_candidate = viewport @@ -17858,11 +17892,11 @@ end -- Note that this is running even if 'ImGuiConfigFlags.ViewportsEnable' is not set, in order to clear unused viewports (if any) and update monitor info. function ImGui.UpdateViewportsNewFrame() local g = GImGui - IM_ASSERT(g.PlatformIO.Viewports.Size <= g.Viewports.Size) + assert(g.PlatformIO.Viewports.Size <= g.Viewports.Size) -- Update Minimized status (we need it first in order to decide if we'll apply Pos/Size of the main viewport) -- Update Focused status - local viewports_enabled = (bit32.band(g.ConfigFlagsCurrFrame, ImGuiConfigFlags.ViewportsEnable) ~= 0) + local viewports_enabled = (bit32.band(g.ConfigFlagsCurrFrame, 1024 --[[ImGuiConfigFlags.ViewportsEnable]]) ~= 0) if viewports_enabled then local focused_viewport = nil @@ -17873,9 +17907,9 @@ function ImGui.UpdateViewportsNewFrame() if g.PlatformIO.Platform_GetWindowMinimized and platform_funcs_available then local is_minimized = g.PlatformIO.Platform_GetWindowMinimized(viewport) if is_minimized then - viewport.Flags = bit32.bor(viewport.Flags, ImGuiViewportFlags.IsMinimized) + viewport.Flags = bit32.bor(viewport.Flags, 4096 --[[ImGuiViewportFlags.IsMinimized]]) else - viewport.Flags = bit32.band(viewport.Flags, bit32.bnot(ImGuiViewportFlags.IsMinimized)) + viewport.Flags = bit32.band(viewport.Flags, bit32.bnot(4096 --[[ImGuiViewportFlags.IsMinimized]])) end end @@ -17884,9 +17918,9 @@ function ImGui.UpdateViewportsNewFrame() if g.PlatformIO.Platform_GetWindowFocus and platform_funcs_available then local is_focused = g.PlatformIO.Platform_GetWindowFocus(viewport) if is_focused then - viewport.Flags = bit32.bor(viewport.Flags, ImGuiViewportFlags.IsFocused) + viewport.Flags = bit32.bor(viewport.Flags, 8192 --[[ImGuiViewportFlags.IsFocused]]) else - viewport.Flags = bit32.band(viewport.Flags, bit32.bnot(ImGuiViewportFlags.IsFocused)) + viewport.Flags = bit32.band(viewport.Flags, bit32.bnot(8192 --[[ImGuiViewportFlags.IsFocused]])) end if is_focused then focused_viewport = viewport @@ -17917,7 +17951,7 @@ function ImGui.UpdateViewportsNewFrame() if apply_imgui_focus_on_focused_viewport and g.IO.ConfigViewportsPlatformFocusSetsImGuiFocus then focused_viewport.LastFocusedHadNavWindow = focused_viewport.LastFocusedHadNavWindow or (g.NavWindow ~= nil and g.NavWindow.Viewport == focused_viewport) -- Update so a window changing viewport won't lose focus. - local focus_request_flags = bit32.bor(ImGuiFocusRequestFlags.UnlessBelowModal, ImGuiFocusRequestFlags.RestoreFocusedChild) + local focus_request_flags = bit32.bor(2 --[[ImGuiFocusRequestFlags.UnlessBelowModal]], 1 --[[ImGuiFocusRequestFlags.RestoreFocusedChild]]) if focused_viewport.Window ~= nil then ImGui.FocusWindow(focused_viewport.Window, focus_request_flags) elseif focused_viewport.LastFocusedHadNavWindow then @@ -17936,8 +17970,8 @@ function ImGui.UpdateViewportsNewFrame() -- Create/update main viewport with current platform position. -- FIXME-VIEWPORT: Size is driven by backend/user code for backward-compatibility but we should aim to make this more consistent. local main_viewport = g.Viewports.Data[1] - IM_ASSERT(main_viewport.ID == IMGUI_VIEWPORT_DEFAULT_ID) - IM_ASSERT(main_viewport.Window == nil) + assert(main_viewport.ID == IMGUI_VIEWPORT_DEFAULT_ID) + assert(main_viewport.Window == nil) local main_viewport_pos if viewports_enabled then @@ -17948,15 +17982,15 @@ function ImGui.UpdateViewportsNewFrame() local main_viewport_size = g.IO.DisplaySize local main_viewport_framebuffer_scale = g.IO.DisplayFramebufferScale - if viewports_enabled and (bit32.band(main_viewport.Flags, ImGuiViewportFlags.IsMinimized) ~= 0) then + if viewports_enabled and (bit32.band(main_viewport.Flags, 4096 --[[ImGuiViewportFlags.IsMinimized]]) ~= 0) then ImVec2_Copy(main_viewport_pos, main_viewport.Pos) -- Preserve last pos/size when minimized (FIXME: We don't do the same for Size outside of the viewport path) ImVec2_Copy(main_viewport_size, main_viewport.Size) main_viewport_framebuffer_scale = main_viewport.FramebufferScale end - ImGui.AddUpdateViewport(nil, IMGUI_VIEWPORT_DEFAULT_ID, main_viewport_pos, main_viewport_size, bit32.bor(ImGuiViewportFlags.OwnedByApp, ImGuiViewportFlags.CanHostOtherWindows)) + ImGui.AddUpdateViewport(nil, IMGUI_VIEWPORT_DEFAULT_ID, main_viewport_pos, main_viewport_size, bit32.bor(4 --[[ImGuiViewportFlags.OwnedByApp]], 2048 --[[ImGuiViewportFlags.CanHostOtherWindows]])) - local memory_compact_start_time = (g.GcCompactAll or g.IO.ConfigMemoryCompactTimer < 0.0) and FLT_MAX or (g.Time - g.IO.ConfigMemoryCompactTimer) + local memory_compact_start_time = (g.GcCompactAll or g.IO.ConfigMemoryCompactTimer < 0.0) and 3.4028234663853e+38 --[[FLT_MAX]] or (g.Time - g.IO.ConfigMemoryCompactTimer) g.CurrentDpiScale = 0.0 g.CurrentViewport = nil @@ -17977,7 +18011,7 @@ function ImGui.UpdateViewportsNewFrame() if viewports_enabled then -- Update Position and Size (from Platform Window to ImGui) if requested. -- We do it early in the frame instead of waiting for UpdatePlatformWindows() to avoid a frame of lag when moving/resizing using OS facilities. - if (bit32.band(viewport.Flags, ImGuiViewportFlags.IsMinimized) == 0) and platform_funcs_available then + if (bit32.band(viewport.Flags, 4096 --[[ImGuiViewportFlags.IsMinimized]]) == 0) and platform_funcs_available then -- Viewport->WorkPos and WorkSize will be updated below if viewport.PlatformRequestMove then ImVec2_Copy(viewport.Pos, g.PlatformIO.Platform_GetWindowPos(viewport)) @@ -18005,7 +18039,7 @@ function ImGui.UpdateViewportsNewFrame() if g.PlatformIO.Platform_GetWindowWorkAreaInsets ~= nil and platform_funcs_available then local insets = g.PlatformIO.Platform_GetWindowWorkAreaInsets(viewport) - IM_ASSERT(insets.x >= 0.0 and insets.y >= 0.0 and insets.z >= 0.0 and insets.w >= 0.0) + assert(insets.x >= 0.0 and insets.y >= 0.0 and insets.z >= 0.0 and insets.w >= 0.0) viewport.BuildWorkInsetMin = ImVec2(insets.x, insets.y) viewport.BuildWorkInsetMax = ImVec2(insets.z, insets.w) end @@ -18025,7 +18059,7 @@ function ImGui.UpdateViewportsNewFrame() -- Translate Dear ImGui windows when a Host Viewport has been moved -- (This additionally keeps windows at the same place when ImGuiConfigFlags.ViewportsEnable is toggled!) local viewport_delta_pos = viewport.Pos - viewport.LastPos - if (bit32.band(viewport.Flags, ImGuiViewportFlags.CanHostOtherWindows) ~= 0) and (viewport_delta_pos.x ~= 0.0 or viewport_delta_pos.y ~= 0.0) then + if (bit32.band(viewport.Flags, 2048 --[[ImGuiViewportFlags.CanHostOtherWindows]]) ~= 0) and (viewport_delta_pos.x ~= 0.0 or viewport_delta_pos.y ~= 0.0) then ImGui.TranslateWindowsInViewport(viewport, viewport.LastPos, viewport.Pos, viewport.LastSize, viewport.Size) end @@ -18039,7 +18073,7 @@ function ImGui.UpdateViewportsNewFrame() new_dpi_scale = (viewport.DpiScale ~= 0.0) and viewport.DpiScale or 1.0 end - IM_ASSERT(new_dpi_scale > 0.0 and new_dpi_scale < 99.0) -- Typical correct values would be between 1.0f and 4.0f + assert(new_dpi_scale > 0.0 and new_dpi_scale < 99.0) -- Typical correct values would be between 1.0f and 4.0f if viewport.DpiScale ~= 0.0 and new_dpi_scale ~= viewport.DpiScale then local scale_factor = new_dpi_scale / viewport.DpiScale @@ -18064,7 +18098,7 @@ function ImGui.UpdateViewportsNewFrame() end -- Update fallback monitor - g.PlatformMonitorsFullWorkRect = ImRect(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX) + g.PlatformMonitorsFullWorkRect = ImRect(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]]) if g.PlatformIO.Monitors.Size == 0 then local monitor = g.FallbackMonitor @@ -18095,9 +18129,9 @@ function ImGui.UpdateViewportsNewFrame() -- Note that 'viewport_hovered' should skip over any viewport that has the ImGuiViewportFlags.NoInputs flags set. local viewport_hovered = nil - if bit32.band(g.IO.BackendFlags, ImGuiBackendFlags.HasMouseHoveredViewport) ~= 0 then + if bit32.band(g.IO.BackendFlags, 4096 --[[ImGuiBackendFlags.HasMouseHoveredViewport]]) ~= 0 then viewport_hovered = g.IO.MouseHoveredViewport and ImGui.FindViewportByID(g.IO.MouseHoveredViewport) or nil - if viewport_hovered and (bit32.band(viewport_hovered.Flags, ImGuiViewportFlags.NoInputs) ~= 0) then + if viewport_hovered and (bit32.band(viewport_hovered.Flags, 128 --[[ImGuiViewportFlags.NoInputs]]) ~= 0) then viewport_hovered = ImGui.FindHoveredViewportFromPlatformWindowStack(g.IO.MousePos) -- Backend failed to handle _NoInputs viewport: revert to our fallback. end else @@ -18134,12 +18168,12 @@ function ImGui.UpdateViewportsNewFrame() end if is_mouse_dragging_with_an_expected_destination or g.ActiveId == 0 or not ImGui.IsAnyMouseDown() then - if viewport_hovered ~= nil and viewport_hovered ~= g.MouseViewport and (bit32.band(viewport_hovered.Flags, ImGuiViewportFlags.NoInputs) == 0) then + if viewport_hovered ~= nil and viewport_hovered ~= g.MouseViewport and (bit32.band(viewport_hovered.Flags, 128 --[[ImGuiViewportFlags.NoInputs]]) == 0) then g.MouseViewport = viewport_hovered end end - IM_ASSERT(g.MouseViewport ~= nil) + assert(g.MouseViewport ~= nil) end -- Update user-facing viewport list (g.Viewports -> g.PlatformIO.Viewports after filtering out some) @@ -18160,7 +18194,7 @@ function ImGui.UpdateViewportsEndFrame() break end if i > 1 then - IM_ASSERT(viewport.Window ~= nil) + assert(viewport.Window ~= nil) end g.PlatformIO.Viewports:push_back(viewport) @@ -18179,19 +18213,19 @@ end --- @return ImGuiViewportP function ImGui.AddUpdateViewport(window, id, pos, size, flags) local g = GImGui - IM_ASSERT(id ~= 0) + assert(id ~= 0) - flags = bit32.bor(flags, ImGuiViewportFlags.IsPlatformWindow) + flags = bit32.bor(flags, 1 --[[ImGuiViewportFlags.IsPlatformWindow]]) if window ~= nil then - local window_can_use_inputs = (bit32.band(window.Flags, bit32.bor(ImGuiWindowFlags.NoMouseInputs, ImGuiWindowFlags.NoNavInputs)) == 0) + local window_can_use_inputs = (bit32.band(window.Flags, bit32.bor(512 --[[ImGuiWindowFlags.NoMouseInputs]], 65536 --[[ImGuiWindowFlags.NoNavInputs]])) == 0) if g.MovingWindow and g.MovingWindow.RootWindowDockTree == window then - flags = bit32.bor(flags, ImGuiViewportFlags.NoInputs, ImGuiViewportFlags.NoFocusOnAppearing) + flags = bit32.bor(flags, 128 --[[ImGuiViewportFlags.NoInputs]], 32 --[[ImGuiViewportFlags.NoFocusOnAppearing]]) end if not window_can_use_inputs then - flags = bit32.bor(flags, ImGuiViewportFlags.NoInputs) + flags = bit32.bor(flags, 128 --[[ImGuiViewportFlags.NoInputs]]) end - if bit32.band(window.Flags, ImGuiWindowFlags.NoFocusOnAppearing) ~= 0 then - flags = bit32.bor(flags, ImGuiViewportFlags.NoFocusOnAppearing) + if bit32.band(window.Flags, 4096 --[[ImGuiWindowFlags.NoFocusOnAppearing]]) ~= 0 then + flags = bit32.bor(flags, 32 --[[ImGuiViewportFlags.NoFocusOnAppearing]]) end end @@ -18208,7 +18242,7 @@ function ImGui.AddUpdateViewport(window, id, pos, size, flags) if not viewport.PlatformRequestResize or viewport.ID == IMGUI_VIEWPORT_DEFAULT_ID then ImVec2_Copy(viewport.Size, size) end - viewport.Flags = bit32.bor(flags, bit32.band(viewport.Flags, bit32.bor(ImGuiViewportFlags.IsMinimized, ImGuiViewportFlags.IsFocused))) -- Preserve existing flags + viewport.Flags = bit32.bor(flags, bit32.band(viewport.Flags, bit32.bor(4096 --[[ImGuiViewportFlags.IsMinimized]], 8192 --[[ImGuiViewportFlags.IsFocused]]))) -- Preserve existing flags if prev_pos.x ~= viewport.Pos.x or prev_pos.y ~= viewport.Pos.y or prev_size.x ~= viewport.Size.x or prev_size.y ~= viewport.Size.y then ImGui.UpdateViewportPlatformMonitor(viewport) end @@ -18247,7 +18281,7 @@ function ImGui.AddUpdateViewport(window, id, pos, size, flags) viewport.Window = window viewport.LastFrameActive = g.FrameCount viewport:UpdateWorkRect() - IM_ASSERT(window == nil or viewport.ID == window.ID) + assert(window == nil or viewport.ID == window.ID) if window ~= nil then window.ViewportOwned = true @@ -18275,8 +18309,8 @@ function ImGui.DestroyViewport(viewport) -- Destroy IMGUI_DEBUG_LOG_VIEWPORT("[viewport] Delete Viewport %08X '%s'", viewport.ID, viewport.Window and viewport.Window.Name or "n/a") ImGui.DestroyPlatformWindow(viewport) -- In most circumstances the platform window will already be destroyed here. - IM_ASSERT(not g.PlatformIO.Viewports:contains(viewport)) - IM_ASSERT(g.Viewports.Data[viewport.Idx] == viewport) + assert(not g.PlatformIO.Viewports:contains(viewport)) + assert(g.Viewports.Data[viewport.Idx] == viewport) g.Viewports:erase(viewport.Idx) -- IM_DELETE(viewport) end @@ -18290,19 +18324,19 @@ function ImGui.WindowSelectViewport(window) -- Restore main viewport if multi-viewport is not supported by the backend local main_viewport = ImGui.GetMainViewport() --[[@as ImGuiViewportP]] - if bit32.band(g.ConfigFlagsCurrFrame, ImGuiConfigFlags.ViewportsEnable) == 0 then + if bit32.band(g.ConfigFlagsCurrFrame, 1024 --[[ImGuiConfigFlags.ViewportsEnable]]) == 0 then ImGui.SetWindowViewport(window, main_viewport) return end window.ViewportOwned = false -- Appearing popups reset their viewport so they can inherit again - if bit32.band(flags, bit32.bor(ImGuiWindowFlags.Popup, ImGuiWindowFlags.Tooltip)) ~= 0 and window.Appearing then + if bit32.band(flags, bit32.bor(67108864 --[[ImGuiWindowFlags.Popup]], 33554432 --[[ImGuiWindowFlags.Tooltip]])) ~= 0 and window.Appearing then window.Viewport = nil window.ViewportId = 0 end - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasViewport) == 0 then + if bit32.band(g.NextWindowData.HasFlags, 2048 --[[ImGuiNextWindowDataFlags.HasViewport]]) == 0 then -- By default inherit from parent window if window.Viewport == nil and window.ParentWindow and (not window.ParentWindow.IsFallbackWindow or window.ParentWindow.WasActive) then window.Viewport = window.ParentWindow.Viewport @@ -18311,39 +18345,39 @@ function ImGui.WindowSelectViewport(window) -- Attempt to restore saved viewport id (= window that hasn't been activated yet), try to restore the viewport based on saved 'window->ViewportPos' restored from .ini file if window.Viewport == nil and window.ViewportId ~= 0 then window.Viewport = ImGui.FindViewportByID(window.ViewportId) --[[@as ImGuiViewportP]] - if window.Viewport == nil and window.ViewportPos.x ~= FLT_MAX and window.ViewportPos.y ~= FLT_MAX then - window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.ViewportPos, window.Size, ImGuiViewportFlags.None) + if window.Viewport == nil and window.ViewportPos.x ~= 3.4028234663853e+38 --[[FLT_MAX]] and window.ViewportPos.y ~= 3.4028234663853e+38 --[[FLT_MAX]] then + window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.ViewportPos, window.Size, 0 --[[ImGuiViewportFlags.None]]) end end end local lock_viewport = false - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasViewport) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 2048 --[[ImGuiNextWindowDataFlags.HasViewport]]) ~= 0 then -- Code explicitly request a viewport window.Viewport = ImGui.FindViewportByID(g.NextWindowData.ViewportId) --[[@as ImGuiViewportP]] window.ViewportId = g.NextWindowData.ViewportId -- Store ID even if Viewport isn't resolved yet. - if window.Viewport and bit32.band(window.Flags, ImGuiWindowFlags.DockNodeHost) ~= 0 and window.Viewport.Window ~= nil then + if window.Viewport and bit32.band(window.Flags, 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) ~= 0 and window.Viewport.Window ~= nil then window.Viewport.Window = window window.Viewport.ID = window.ID window.ViewportId = window.ID -- Overwrite ID (always owned by node) end lock_viewport = true - elseif bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0 or bit32.band(flags, ImGuiWindowFlags.ChildMenu) ~= 0 then + elseif bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 or bit32.band(flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0 then -- Always inherit viewport from parent window if window.DockNode and window.DockNode.HostWindow then - IM_ASSERT(window.DockNode.HostWindow.Viewport == window.ParentWindow.Viewport) + assert(window.DockNode.HostWindow.Viewport == window.ParentWindow.Viewport) end window.Viewport = window.ParentWindow.Viewport elseif window.DockNode and window.DockNode.HostWindow then -- This covers the "always inherit viewport from parent window" case for when a window reattach to a node that was just created mid-frame window.Viewport = window.DockNode.HostWindow.Viewport - elseif bit32.band(flags, ImGuiWindowFlags.Tooltip) ~= 0 then + elseif bit32.band(flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0 then window.Viewport = g.MouseViewport elseif ImGui.GetWindowAlwaysWantOwnViewport(window) then - window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.Pos, window.Size, ImGuiViewportFlags.None) + window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.Pos, window.Size, 0 --[[ImGuiViewportFlags.None]]) elseif g.MovingWindow and g.MovingWindow.RootWindowDockTree == window and ImGui.IsMousePosValid() then if window.Viewport ~= nil and window.Viewport.Window == window then - window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.Pos, window.Size, ImGuiViewportFlags.None) + window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.Pos, window.Size, 0 --[[ImGuiViewportFlags.None]]) end else -- Merge into host viewport? @@ -18359,28 +18393,28 @@ function ImGui.WindowSelectViewport(window) if window.Viewport == nil then --- @cast main_viewport ImGuiViewportP if not ImGui.UpdateTryMergeWindowIntoHostViewport(window, main_viewport) then - window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.Pos, window.Size, ImGuiViewportFlags.None) + window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.Pos, window.Size, 0 --[[ImGuiViewportFlags.None]]) end end -- Mark window as allowed to protrude outside of its viewport and into the current monitor if not lock_viewport then - if bit32.band(flags, bit32.bor(ImGuiWindowFlags.Tooltip, ImGuiWindowFlags.Popup)) ~= 0 then + if bit32.band(flags, bit32.bor(33554432 --[[ImGuiWindowFlags.Tooltip]], 67108864 --[[ImGuiWindowFlags.Popup]])) ~= 0 then -- We need to take account of the possibility that mouse may become invalid. -- Popups/Tooltip always set ViewportAllowPlatformMonitorExtend so GetWindowAllowedExtentRect() will return full monitor bounds. - local mouse_ref = bit32.band(flags, ImGuiWindowFlags.Tooltip) ~= 0 and g.IO.MousePos or g.BeginPopupStack.Data[g.BeginPopupStack.Size].OpenMousePos + local mouse_ref = bit32.band(flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0 and g.IO.MousePos or g.BeginPopupStack.Data[g.BeginPopupStack.Size].OpenMousePos local use_mouse_ref = not g.NavCursorVisible or not g.NavHighlightItemUnderNav or not g.NavWindow local mouse_valid = ImGui.IsMousePosValid(mouse_ref) - if (window.Appearing or bit32.band(flags, bit32.bor(ImGuiWindowFlags.Tooltip, ImGuiWindowFlags.ChildMenu)) ~= 0) and (not use_mouse_ref or mouse_valid) then + if (window.Appearing or bit32.band(flags, bit32.bor(33554432 --[[ImGuiWindowFlags.Tooltip]], 268435456 --[[ImGuiWindowFlags.ChildMenu]])) ~= 0) and (not use_mouse_ref or mouse_valid) then local pos_to_use = (use_mouse_ref and mouse_valid) and mouse_ref or ImGui.NavCalcPreferredRefPos(window.Flags) window.ViewportAllowPlatformMonitorExtend = ImGui.FindPlatformMonitorForPos(pos_to_use) else window.ViewportAllowPlatformMonitorExtend = window.Viewport.PlatformMonitor end - elseif window.Viewport and window ~= window.Viewport.Window and window.Viewport.Window and bit32.band(flags, ImGuiWindowFlags.ChildWindow) == 0 and window.DockNode == nil then + elseif window.Viewport and window ~= window.Viewport.Window and window.Viewport.Window and bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0 and window.DockNode == nil then -- When called from Begin() we don't have access to a proper version of the Hidden flag yet, so we replicate this code. local will_be_visible = (window.DockIsActive and not window.DockTabIsVisible) and false or true - if bit32.band(window.Flags, ImGuiWindowFlags.DockNodeHost) ~= 0 and window.Viewport.LastFrameActive < g.FrameCount and will_be_visible then + if bit32.band(window.Flags, 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) ~= 0 and window.Viewport.LastFrameActive < g.FrameCount and will_be_visible then -- Steal/transfer ownership IMGUI_DEBUG_LOG_VIEWPORT("[viewport] Window '%s' steal Viewport %08X from Window '%s'", window.Name, window.Viewport.ID, window.Viewport.Window.Name) window.Viewport.Window = window @@ -18388,9 +18422,9 @@ function ImGui.WindowSelectViewport(window) window.Viewport.LastNameHash = 0 elseif not ImGui.UpdateTryMergeWindowIntoHostViewports(window) then -- Merge? -- New viewport - window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.Pos, window.Size, ImGuiViewportFlags.NoFocusOnAppearing) + window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.Pos, window.Size, 32 --[[ImGuiViewportFlags.NoFocusOnAppearing]]) end - elseif window.ViewportAllowPlatformMonitorExtend < 0 and bit32.band(flags, ImGuiWindowFlags.ChildWindow) == 0 then + elseif window.ViewportAllowPlatformMonitorExtend < 0 and bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0 then -- Regular (non-child, non-popup) windows by default are also allowed to protrude -- Child windows are kept contained within their parent. window.ViewportAllowPlatformMonitorExtend = window.Viewport.PlatformMonitor @@ -18440,22 +18474,22 @@ function ImGui.WindowSyncOwnedViewport(window, parent_window_in_stack) end -- Update common viewport flags - local viewport_flags_to_clear = bit32.bor(ImGuiViewportFlags.TopMost, ImGuiViewportFlags.NoTaskBarIcon, ImGuiViewportFlags.NoDecoration, ImGuiViewportFlags.NoRendererClear) + local viewport_flags_to_clear = bit32.bor(1024 --[[ImGuiViewportFlags.TopMost]], 16 --[[ImGuiViewportFlags.NoTaskBarIcon]], 8 --[[ImGuiViewportFlags.NoDecoration]], 256 --[[ImGuiViewportFlags.NoRendererClear]]) local viewport_flags = bit32.band(window.Viewport.Flags, bit32.bnot(viewport_flags_to_clear)) local window_flags = window.Flags - local is_modal = bit32.band(window_flags, ImGuiWindowFlags.Modal) ~= 0 - local is_short_lived_floating_window = bit32.band(window_flags, bit32.bor(ImGuiWindowFlags.ChildMenu, ImGuiWindowFlags.Tooltip, ImGuiWindowFlags.Popup)) ~= 0 + local is_modal = bit32.band(window_flags, 134217728 --[[ImGuiWindowFlags.Modal]]) ~= 0 + local is_short_lived_floating_window = bit32.band(window_flags, bit32.bor(268435456 --[[ImGuiWindowFlags.ChildMenu]], 33554432 --[[ImGuiWindowFlags.Tooltip]], 67108864 --[[ImGuiWindowFlags.Popup]])) ~= 0 - if bit32.band(window_flags, ImGuiWindowFlags.Tooltip) ~= 0 then - viewport_flags = bit32.bor(viewport_flags, ImGuiViewportFlags.TopMost) + if bit32.band(window_flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0 then + viewport_flags = bit32.bor(viewport_flags, 1024 --[[ImGuiViewportFlags.TopMost]]) end if (g.IO.ConfigViewportsNoTaskBarIcon or is_short_lived_floating_window) and not is_modal then - viewport_flags = bit32.bor(viewport_flags, ImGuiViewportFlags.NoTaskBarIcon) + viewport_flags = bit32.bor(viewport_flags, 16 --[[ImGuiViewportFlags.NoTaskBarIcon]]) end if g.IO.ConfigViewportsNoDecoration or is_short_lived_floating_window then - viewport_flags = bit32.bor(viewport_flags, ImGuiViewportFlags.NoDecoration) + viewport_flags = bit32.bor(viewport_flags, 8 --[[ImGuiViewportFlags.NoDecoration]]) end -- Not correct to set modal as topmost because: @@ -18470,7 +18504,7 @@ function ImGui.WindowSyncOwnedViewport(window, parent_window_in_stack) -- Setting _NoFocusOnClick would technically prevent us from bringing back to front in case they are being covered by an OS window from a different app, -- but it shouldn't be much of a problem considering those are already popups that are closed when clicking elsewhere. if is_short_lived_floating_window and not is_modal then - viewport_flags = bit32.bor(viewport_flags, ImGuiViewportFlags.NoFocusOnAppearing, ImGuiViewportFlags.NoFocusOnClick) + viewport_flags = bit32.bor(viewport_flags, 32 --[[ImGuiViewportFlags.NoFocusOnAppearing]], 64 --[[ImGuiViewportFlags.NoFocusOnClick]]) end -- We can overwrite viewport flags using ImGuiWindowClass (advanced users) @@ -18484,8 +18518,8 @@ function ImGui.WindowSyncOwnedViewport(window, parent_window_in_stack) -- We can also tell the backend that clearing the platform window won't be necessary, -- as our window background is filling the viewport and we have disabled BgAlpha. -- FIXME: Work on support for per-viewport transparency (#2766) - if bit32.band(window_flags, ImGuiWindowFlags.NoBackground) == 0 then - viewport_flags = bit32.bor(viewport_flags, ImGuiViewportFlags.NoRendererClear) + if bit32.band(window_flags, 128 --[[ImGuiWindowFlags.NoBackground]]) == 0 then + viewport_flags = bit32.bor(viewport_flags, 256 --[[ImGuiViewportFlags.NoRendererClear]]) end window.Viewport.Flags = viewport_flags @@ -18498,7 +18532,7 @@ function ImGui.WindowSyncOwnedViewport(window, parent_window_in_stack) if window.Viewport.ParentViewportId ~= old_parent_viewport_id then window.Viewport.ParentViewport = ImGui.FindViewportByID(window.Viewport.ParentViewportId) --[[@as ImGuiViewport]] end - elseif bit32.band(window_flags, bit32.bor(ImGuiWindowFlags.Popup, ImGuiWindowFlags.Tooltip)) ~= 0 and parent_window_in_stack and (not parent_window_in_stack.IsFallbackWindow or parent_window_in_stack.WasActive) then + elseif bit32.band(window_flags, bit32.bor(67108864 --[[ImGuiWindowFlags.Popup]], 33554432 --[[ImGuiWindowFlags.Tooltip]])) ~= 0 and parent_window_in_stack and (not parent_window_in_stack.IsFallbackWindow or parent_window_in_stack.WasActive) then window.Viewport.ParentViewport = parent_window_in_stack.Viewport window.Viewport.ParentViewportId = parent_window_in_stack.Viewport.ID else @@ -18515,10 +18549,10 @@ end -- This will handle the creation/update of all OS windows via function defined in the ImGuiPlatformIO api. function ImGui.UpdatePlatformWindows() local g = GImGui - IM_ASSERT(g.FrameCountEnded == g.FrameCount, "Forgot to call Render() or EndFrame() before UpdatePlatformWindows()?") - IM_ASSERT(g.FrameCountPlatformEnded < g.FrameCount) + assert(g.FrameCountEnded == g.FrameCount, "Forgot to call Render() or EndFrame() before UpdatePlatformWindows()?") + assert(g.FrameCountPlatformEnded < g.FrameCount) g.FrameCountPlatformEnded = g.FrameCount - if bit32.band(g.ConfigFlagsCurrFrame, ImGuiConfigFlags.ViewportsEnable) == 0 then + if bit32.band(g.ConfigFlagsCurrFrame, 1024 --[[ImGuiConfigFlags.ViewportsEnable]]) == 0 then return end @@ -18553,8 +18587,8 @@ function ImGui.UpdatePlatformWindows() end g.PlatformWindowsCreatedCount = g.PlatformWindowsCreatedCount + 1 viewport.LastNameHash = 0 - ImVec2_CopyV(viewport.LastPlatformPos, FLT_MAX, FLT_MAX) - ImVec2_CopyV(viewport.LastPlatformSize, FLT_MAX, FLT_MAX) -- By clearing those we'll enforce a call to Platform_SetWindowPos/Size below, before Platform_ShowWindow (FIXME: Is that necessary?) + ImVec2_CopyV(viewport.LastPlatformPos, 3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]) + ImVec2_CopyV(viewport.LastPlatformSize, 3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]) -- By clearing those we'll enforce a call to Platform_SetWindowPos/Size below, before Platform_ShowWindow (FIXME: Is that necessary?) ImVec2_Copy(viewport.LastRendererSize, viewport.Size) -- We don't need to call Renderer_SetWindowSize() as it is expected Renderer_CreateWindow() already did it. viewport.PlatformWindowCreated = true end @@ -18601,7 +18635,7 @@ function ImGui.UpdatePlatformWindows() if is_new_platform_window then -- On startup ensure new platform window don't steal focus (give it a few frames, as nested contents may lead to viewport being created a few frames late) if g.FrameCount < 3 then - viewport.Flags = bit32.bor(viewport.Flags, ImGuiViewportFlags.NoFocusOnAppearing) + viewport.Flags = bit32.bor(viewport.Flags, 32 --[[ImGuiViewportFlags.NoFocusOnAppearing]]) end -- Show window @@ -18638,7 +18672,7 @@ function ImGui.RenderPlatformWindowsDefault(platform_render_arg, renderer_render -- First pass: render all windows for i = 2, platform_io.Viewports.Size do local viewport = platform_io.Viewports.Data[i] - if bit32.band(viewport.Flags, ImGuiViewportFlags.IsMinimized) == 0 then + if bit32.band(viewport.Flags, 4096 --[[ImGuiViewportFlags.IsMinimized]]) == 0 then if platform_io.Platform_RenderWindow then platform_io.Platform_RenderWindow(viewport, platform_render_arg) end @@ -18651,7 +18685,7 @@ function ImGui.RenderPlatformWindowsDefault(platform_render_arg, renderer_render -- Second pass: swap buffers for all windows for i = 2, platform_io.Viewports.Size do local viewport = platform_io.Viewports.Data[i] - if bit32.band(viewport.Flags, ImGuiViewportFlags.IsMinimized) == 0 then + if bit32.band(viewport.Flags, 4096 --[[ImGuiViewportFlags.IsMinimized]]) == 0 then if platform_io.Platform_SwapBuffers then platform_io.Platform_SwapBuffers(viewport, platform_render_arg) end @@ -18749,7 +18783,7 @@ function ImGui.DestroyPlatformWindow(viewport) if g.PlatformIO.Platform_DestroyWindow then g.PlatformIO.Platform_DestroyWindow(viewport) end - IM_ASSERT(viewport.RendererUserData == nil and viewport.PlatformUserData == nil) + assert(viewport.RendererUserData == nil and viewport.PlatformUserData == nil) -- Don't clear PlatformWindowCreated for the main viewport, as we initially set that up to true in Initialize() -- The righter way may be to leave it to the backend to set this flag all-together, and made the flag public. @@ -18757,7 +18791,7 @@ function ImGui.DestroyPlatformWindow(viewport) viewport.PlatformWindowCreated = false end else - IM_ASSERT(viewport.RendererUserData == nil and viewport.PlatformUserData == nil and viewport.PlatformHandle == nil) + assert(viewport.RendererUserData == nil and viewport.PlatformUserData == nil and viewport.PlatformHandle == nil) end viewport.RendererUserData = nil viewport.PlatformUserData = nil @@ -18794,12 +18828,12 @@ function ImGui.DebugRenderViewportThumbnail(draw_list, viewport, bb) local scale = bb:GetSize() / viewport.Size local off = bb.Min - viewport.Pos * scale - local alpha_mul = (bit32.band(viewport.Flags, ImGuiViewportFlags.IsMinimized) ~= 0) and 0.30 or 1.00 - window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(ImGuiCol.Border, alpha_mul * 0.40)) + local alpha_mul = (bit32.band(viewport.Flags, 4096 --[[ImGuiViewportFlags.IsMinimized]]) ~= 0) and 0.30 or 1.00 + window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(5 --[[ImGuiCol.Border]], alpha_mul * 0.40)) for _, thumb_window in g.Windows:iter() do repeat - if not thumb_window.WasActive or bit32.band(thumb_window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 then + if not thumb_window.WasActive or bit32.band(thumb_window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 then break end if thumb_window.Viewport ~= viewport then @@ -18813,15 +18847,15 @@ function ImGui.DebugRenderViewportThumbnail(draw_list, viewport, bb) thumb_r:ClipWithFull(bb) title_r:ClipWithFull(bb) local window_is_focused = g.NavWindow and thumb_window.RootWindowForTitleBarHighlight == g.NavWindow.RootWindowForTitleBarHighlight - window.DrawList:AddRectFilled(thumb_r.Min, thumb_r.Max, ImGui.GetColorU32(ImGuiCol.WindowBg, alpha_mul)) - window.DrawList:AddRectFilled(title_r.Min, title_r.Max, ImGui.GetColorU32(window_is_focused and ImGuiCol.TitleBgActive or ImGuiCol.TitleBg, alpha_mul)) - window.DrawList:AddRect(thumb_r.Min, thumb_r.Max, ImGui.GetColorU32(ImGuiCol.Border, alpha_mul)) - window.DrawList:AddText(g.Font, g.FontSize * 1.0, title_r.Min, ImGui.GetColorU32(ImGuiCol.Text, alpha_mul), thumb_window.Name, 1, ImGui.FindRenderedTextEnd(thumb_window.Name)) + window.DrawList:AddRectFilled(thumb_r.Min, thumb_r.Max, ImGui.GetColorU32(2 --[[ImGuiCol.WindowBg]], alpha_mul)) + window.DrawList:AddRectFilled(title_r.Min, title_r.Max, ImGui.GetColorU32(window_is_focused and 11 --[[ImGuiCol.TitleBgActive]] or 10 --[[ImGuiCol.TitleBg]], alpha_mul)) + window.DrawList:AddRect(thumb_r.Min, thumb_r.Max, ImGui.GetColorU32(5 --[[ImGuiCol.Border]], alpha_mul)) + window.DrawList:AddText(g.Font, g.FontSize * 1.0, title_r.Min, ImGui.GetColorU32(0 --[[ImGuiCol.Text]], alpha_mul), thumb_window.Name, 1, ImGui.FindRenderedTextEnd(thumb_window.Name)) until true end - draw_list:AddRect(bb.Min, bb.Max, ImGui.GetColorU32(ImGuiCol.Border, alpha_mul)) + draw_list:AddRect(bb.Min, bb.Max, ImGui.GetColorU32(5 --[[ImGuiCol.Border]], alpha_mul)) if viewport.ID == g.DebugMetricsConfig.HighlightViewportID then window.DrawList:AddRect(bb.Min, bb.Max, IM_COL32(255, 255, 0, 255)) end @@ -18833,7 +18867,7 @@ function ImGui.RenderViewportsThumbnails() -- Draw monitor and calculate their boundaries local SCALE = 1.0 / 8.0 - local bb_full = ImRect(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX) + local bb_full = ImRect(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]]) for _, monitor in g.PlatformIO.Monitors:iter() do bb_full:Add(ImRect(monitor.MainPos, monitor.MainPos + monitor.MainSize)) end @@ -18842,8 +18876,8 @@ function ImGui.RenderViewportsThumbnails() local off = p - bb_full.Min * SCALE for _, monitor in g.PlatformIO.Monitors:iter() do local monitor_draw_bb = ImRect(off + monitor.MainPos * SCALE, off + (monitor.MainPos + monitor.MainSize) * SCALE) - window.DrawList:AddRect(monitor_draw_bb.Min, monitor_draw_bb.Max, (g.DebugMetricsConfig.HighlightMonitorIdx == g.PlatformIO.Monitors:index_from_ptr(monitor)) and IM_COL32(255, 255, 0, 255) or ImGui.GetColorU32(ImGuiCol.Border), 4.0) - window.DrawList:AddRectFilled(monitor_draw_bb.Min, monitor_draw_bb.Max, ImGui.GetColorU32(ImGuiCol.Border, 0.10), 4.0) + window.DrawList:AddRect(monitor_draw_bb.Min, monitor_draw_bb.Max, (g.DebugMetricsConfig.HighlightMonitorIdx == g.PlatformIO.Monitors:index_from_ptr(monitor)) and IM_COL32(255, 255, 0, 255) or ImGui.GetColorU32(5 --[[ImGuiCol.Border]]), 4.0) + window.DrawList:AddRectFilled(monitor_draw_bb.Min, monitor_draw_bb.Max, ImGui.GetColorU32(5 --[[ImGuiCol.Border]], 0.10), 4.0) end -- Draw viewports @@ -18879,7 +18913,7 @@ end function ImGui.ErrorCheckUsingSetCursorPosToExtendParentBoundaries() local g = GImGui local window = g.CurrentWindow - IM_ASSERT(window.DC.IsSetPos) + assert(window.DC.IsSetPos) window.DC.IsSetPos = false if window.DC.CursorPos.x <= window.DC.CursorMaxPos.x and window.DC.CursorPos.y <= window.DC.CursorMaxPos.y then return end if window.SkipItems then return end @@ -18893,7 +18927,7 @@ end ------------------------------------------------------------------------------- local function GetWindowDisplayLayer(window) - return (bit32.band(window.Flags, ImGuiWindowFlags.Tooltip) ~= 0) and 1 or 0 + return (bit32.band(window.Flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0) and 1 or 0 end --- @return int # 0-based display index (like upstream), -1 if not found @@ -18918,7 +18952,7 @@ function ImGui.FindBottomMostVisibleWindowWithinBeginStack(parent_window) local bottom_most_visible_window = parent_window for i = ImGui.FindWindowDisplayIndex(parent_window), 0, -1 do local window = g.Windows.Data[i + 1] - if bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) == 0 then + if bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0 then if not ImGui.IsWindowWithinBeginStackOf(window, parent_window) then break end if ImGui.IsWindowActiveAndVisible(window) and GetWindowDisplayLayer(window) <= GetWindowDisplayLayer(parent_window) then bottom_most_visible_window = window @@ -18933,7 +18967,7 @@ function ImGui.GetTopMostAndVisiblePopupModal() local g = GImGui for n = g.OpenPopupStack.Size, 1, -1 do local popup = g.OpenPopupStack.Data[n].Window - if popup and bit32.band(popup.Flags, ImGuiWindowFlags.Modal) ~= 0 and ImGui.IsWindowActiveAndVisible(popup) then + if popup and bit32.band(popup.Flags, 134217728 --[[ImGuiWindowFlags.Modal]]) ~= 0 and ImGui.IsWindowActiveAndVisible(popup) then return popup end end @@ -18941,7 +18975,7 @@ function ImGui.GetTopMostAndVisiblePopupModal() end function ImGui.RenderDimmedBackgroundBehindWindow(window, col) - if bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end local viewport = window.Viewport local viewport_rect = viewport:GetMainRect() -- Draw behind window by moving the draw command at the FRONT of the draw list @@ -18975,9 +19009,9 @@ function ImGui.RenderDimmedBackgrounds() ImGui.RenderDimmedBackgroundBehindWindow(dim_behind_window, ImGui.GetColorU32(modal_window.DC.ModalDimBgColor, g.DimBgRatio, true)) elseif dim_bg_for_window_list then -- Draw dimming behind Ctrl+Tab target window and behind Ctrl+Tab UI window - ImGui.RenderDimmedBackgroundBehindWindow(g.NavWindowingTargetAnim, ImGui.GetColorU32(ImGuiCol.NavWindowingDimBg, g.DimBgRatio)) + ImGui.RenderDimmedBackgroundBehindWindow(g.NavWindowingTargetAnim, ImGui.GetColorU32(61 --[[ImGuiCol.NavWindowingDimBg]], g.DimBgRatio)) if g.NavWindowingListWindow ~= nil and g.NavWindowingListWindow.Active and g.NavWindowingListWindow.Viewport and g.NavWindowingListWindow.Viewport ~= g.NavWindowingTargetAnim.Viewport then - ImGui.RenderDimmedBackgroundBehindWindow(g.NavWindowingListWindow, ImGui.GetColorU32(ImGuiCol.NavWindowingDimBg, g.DimBgRatio)) + ImGui.RenderDimmedBackgroundBehindWindow(g.NavWindowingListWindow, ImGui.GetColorU32(61 --[[ImGuiCol.NavWindowingDimBg]], g.DimBgRatio)) end -- Draw border around Ctrl+Tab target window @@ -18990,7 +19024,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(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, 0, 3.0) -- FIXME-DPI window.DrawList:PopClipRect() end end @@ -19000,7 +19034,7 @@ function ImGui.ClosePopupsExceptModals() local popup_count_to_keep = g.OpenPopupStack.Size while popup_count_to_keep > 0 do local window = g.OpenPopupStack.Data[popup_count_to_keep].Window - if not window or bit32.band(window.Flags, ImGuiWindowFlags.Modal) ~= 0 then break end + if not window or bit32.band(window.Flags, 134217728 --[[ImGuiWindowFlags.Modal]]) ~= 0 then break end popup_count_to_keep = popup_count_to_keep - 1 end if popup_count_to_keep < g.OpenPopupStack.Size then -- This test is not required but it allows to set a convenient breakpoint on the statement below @@ -19018,7 +19052,7 @@ function ImGui.BeginPopupModal(name, p_open, flags) local g = GImGui local window = g.CurrentWindow local id = window:GetID(name) - if not ImGui.IsPopupOpen(id, ImGuiPopupFlags.None) then + if not ImGui.IsPopupOpen(id, 0 --[[ImGuiPopupFlags.None]]) then g.NextWindowData:ClearFlags() -- We behave like Begin() and need to consume those values if p_open then p_open = false end return false, p_open @@ -19027,12 +19061,12 @@ function ImGui.BeginPopupModal(name, p_open, flags) -- Center modal windows by default for increased visibility -- (this won't really last as settings will kick in, and is mostly for backward compatibility. user may do the same themselves) -- FIXME: Should test for (PosCond & window.SetWindowPosAllowFlags) with the upcoming window. - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasPos) == 0 then + if bit32.band(g.NextWindowData.HasFlags, 1 --[[ImGuiNextWindowDataFlags.HasPos]]) == 0 then local viewport = window.WasActive and window.Viewport or ImGui.GetMainViewport() -- FIXME-VIEWPORT: What may be our reference viewport? - ImGui.SetNextWindowPos(viewport:GetCenter(), ImGuiCond.FirstUseEver, ImVec2(0.5, 0.5)) + ImGui.SetNextWindowPos(viewport:GetCenter(), 4 --[[ImGuiCond.FirstUseEver]], ImVec2(0.5, 0.5)) end - flags = bit32.bor(flags, ImGuiWindowFlags.Popup, ImGuiWindowFlags.Modal, ImGuiWindowFlags.NoCollapse, ImGuiWindowFlags.NoDocking) + flags = bit32.bor(flags, 67108864 --[[ImGuiWindowFlags.Popup]], 134217728 --[[ImGuiWindowFlags.Modal]], 32 --[[ImGuiWindowFlags.NoCollapse]], 524288 --[[ImGuiWindowFlags.NoDocking]]) local is_open p_open, is_open = ImGui.Begin(name, p_open, flags) if not is_open or (p_open ~= nil and not p_open) then -- NB: is_open can be 'false' when the popup is completely clipped (e.g. zero size display) @@ -19046,8 +19080,8 @@ end function ImGui.IsPopupOpenRequestForWindow(popup_flags) local g = GImGui local mouse_button = ImGui.GetMouseButtonFromPopupFlags(popup_flags) - if ImGui.IsMouseReleased(mouse_button, ImGuiKeyOwner_NoOwner) and ImGui.IsWindowHovered(ImGuiHoveredFlags.AllowWhenBlockedByPopup) then - if bit32.band(popup_flags, ImGuiPopupFlags.NoOpenOverItems) == 0 or not ImGui.IsAnyItemHovered() then + if ImGui.IsMouseReleased(mouse_button, 4294967295 --[[ImGuiKeyOwner_NoOwner]]) and ImGui.IsWindowHovered(32 --[[ImGuiHoveredFlags.AllowWhenBlockedByPopup]]) then + if bit32.band(popup_flags, 256 --[[ImGuiPopupFlags.NoOpenOverItems]]) == 0 or not ImGui.IsAnyItemHovered() then return true end end @@ -19064,7 +19098,7 @@ function ImGui.BeginPopupContextWindow(str_id, popup_flags) if not str_id then str_id = "window_context" end local id = window:GetID(str_id) if ImGui.IsPopupOpenRequestForWindow(popup_flags) then ImGui.OpenPopupEx(id, popup_flags) end - return ImGui.BeginPopupEx(id, bit32.bor(ImGuiWindowFlags.AlwaysAutoResize, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoSavedSettings)) + return ImGui.BeginPopupEx(id, bit32.bor(64 --[[ImGuiWindowFlags.AlwaysAutoResize]], 1 --[[ImGuiWindowFlags.NoTitleBar]], 256 --[[ImGuiWindowFlags.NoSavedSettings]])) end function ImGui.BeginPopupContextVoid(str_id, popup_flags) @@ -19074,16 +19108,16 @@ function ImGui.BeginPopupContextVoid(str_id, popup_flags) if not str_id then str_id = "void_context" end local id = window:GetID(str_id) -- FIXME: Use a global ID? local mouse_button = ImGui.GetMouseButtonFromPopupFlags(popup_flags) - if ImGui.IsMouseReleased(mouse_button, id) and not ImGui.IsWindowHovered(ImGuiHoveredFlags.AnyWindow) then + if ImGui.IsMouseReleased(mouse_button, id) and not ImGui.IsWindowHovered(4 --[[ImGuiHoveredFlags.AnyWindow]]) then if ImGui.GetTopMostPopupModal() == nil then ImGui.OpenPopupEx(id, popup_flags) end end - return ImGui.BeginPopupEx(id, bit32.bor(ImGuiWindowFlags.AlwaysAutoResize, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoSavedSettings)) + return ImGui.BeginPopupEx(id, bit32.bor(64 --[[ImGuiWindowFlags.AlwaysAutoResize]], 1 --[[ImGuiWindowFlags.NoTitleBar]], 256 --[[ImGuiWindowFlags.NoSavedSettings]])) end function ImGui.BeginTooltipHidden() local g = GImGui - local _, ret = ImGui.Begin("##Tooltip_Hidden", nil, bit32.bor(ImGuiWindowFlags.Tooltip, ImGuiWindowFlags.NoInputs, ImGuiWindowFlags.NoTitleBar, - ImGuiWindowFlags.NoMove, ImGuiWindowFlags.NoResize, ImGuiWindowFlags.NoSavedSettings, ImGuiWindowFlags.AlwaysAutoResize)) + local _, ret = ImGui.Begin("##Tooltip_Hidden", nil, bit32.bor(33554432 --[[ImGuiWindowFlags.Tooltip]], 197120 --[[ImGuiWindowFlags.NoInputs]], 1 --[[ImGuiWindowFlags.NoTitleBar]], + 4 --[[ImGuiWindowFlags.NoMove]], 2 --[[ImGuiWindowFlags.NoResize]], 256 --[[ImGuiWindowFlags.NoSavedSettings]], 64 --[[ImGuiWindowFlags.AlwaysAutoResize]])) ImGui.SetWindowHiddenAndSkipItemsForCurrentFrame(g.CurrentWindow) return ret end @@ -19105,7 +19139,7 @@ function ImGui.SetKeyboardFocusHere(offset) if offset == nil then offset = 0 end local g = GImGui local window = g.CurrentWindow - IM_ASSERT(offset >= -1) -- -1 is allowed but not below + assert(offset >= -1) -- -1 is allowed but not below -- It makes sense in the vast majority of cases to never interrupt a drag and drop. -- When we refactor this function into ActivateItem() we may want to make this an option. @@ -19117,9 +19151,9 @@ function ImGui.SetKeyboardFocusHere(offset) ImGui.SetNavWindow(window) - local move_flags = bit32.bor(ImGuiNavMoveFlags.IsTabbing, ImGuiNavMoveFlags.Activate, ImGuiNavMoveFlags.FocusApi, ImGuiNavMoveFlags.NoSetNavCursorVisible) - local scroll_flags = window.Appearing and bit32.bor(ImGuiScrollFlags.KeepVisibleEdgeX, ImGuiScrollFlags.AlwaysCenterY) or bit32.bor(ImGuiScrollFlags.KeepVisibleEdgeX, ImGuiScrollFlags.KeepVisibleEdgeY) - ImGui.NavMoveRequestSubmit(ImGuiDir.None, (offset < 0) and ImGuiDir.Up or ImGuiDir.Down, move_flags, scroll_flags) -- FIXME-NAV: Once we refactor tabbing, add LegacyApi flag to not activate non-inputable. + local move_flags = bit32.bor(1024 --[[ImGuiNavMoveFlags.IsTabbing]], 4096 --[[ImGuiNavMoveFlags.Activate]], 512 --[[ImGuiNavMoveFlags.FocusApi]], 16384 --[[ImGuiNavMoveFlags.NoSetNavCursorVisible]]) + local scroll_flags = window.Appearing and bit32.bor(1 --[[ImGuiScrollFlags.KeepVisibleEdgeX]], 32 --[[ImGuiScrollFlags.AlwaysCenterY]]) or bit32.bor(1 --[[ImGuiScrollFlags.KeepVisibleEdgeX]], 2 --[[ImGuiScrollFlags.KeepVisibleEdgeY]]) + ImGui.NavMoveRequestSubmit((-1) --[[ImGuiDir.None]], (offset < 0) and 2 --[[ImGuiDir.Up]] or 3 --[[ImGuiDir.Down]], move_flags, scroll_flags) -- FIXME-NAV: Once we refactor tabbing, add LegacyApi flag to not activate non-inputable. if offset == -1 then ImGui.NavMoveRequestResolveWithLastItem(g.NavMoveResultLocal) else @@ -19135,22 +19169,22 @@ function ImGui.FocusItem() if g.DragDropActive or g.MovingWindow ~= nil then -- FIXME: Opt-in flags for this? return end - local move_flags = bit32.bor(ImGuiNavMoveFlags.IsTabbing, ImGuiNavMoveFlags.FocusApi, ImGuiNavMoveFlags.NoSetNavCursorVisible, ImGuiNavMoveFlags.NoSelect) - local scroll_flags = window.Appearing and bit32.bor(ImGuiScrollFlags.KeepVisibleEdgeX, ImGuiScrollFlags.AlwaysCenterY) or bit32.bor(ImGuiScrollFlags.KeepVisibleEdgeX, ImGuiScrollFlags.KeepVisibleEdgeY) + local move_flags = bit32.bor(1024 --[[ImGuiNavMoveFlags.IsTabbing]], 512 --[[ImGuiNavMoveFlags.FocusApi]], 16384 --[[ImGuiNavMoveFlags.NoSetNavCursorVisible]], 8192 --[[ImGuiNavMoveFlags.NoSelect]]) + local scroll_flags = window.Appearing and bit32.bor(1 --[[ImGuiScrollFlags.KeepVisibleEdgeX]], 32 --[[ImGuiScrollFlags.AlwaysCenterY]]) or bit32.bor(1 --[[ImGuiScrollFlags.KeepVisibleEdgeX]], 2 --[[ImGuiScrollFlags.KeepVisibleEdgeY]]) ImGui.SetNavWindow(window) - ImGui.NavMoveRequestSubmit(ImGuiDir.None, ImGuiDir.Up, move_flags, scroll_flags) + ImGui.NavMoveRequestSubmit((-1) --[[ImGuiDir.None]], 2 --[[ImGuiDir.Up]], move_flags, scroll_flags) ImGui.NavMoveRequestResolveWithLastItem(g.NavMoveResultLocal) end function ImGui.ActivateItemByID(id) local g = GImGui g.NavNextActivateId = id - g.NavNextActivateFlags = ImGuiActivateFlags.None + g.NavNextActivateFlags = 0 --[[ImGuiActivateFlags.None]] end function ImGui.SetNavCursorVisible(visible) local g = GImGui - if g.NavWindow and bit32.band(g.NavWindow.Flags, ImGuiWindowFlags.NoNavInputs) ~= 0 then + if g.NavWindow and bit32.band(g.NavWindow.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) ~= 0 then visible = false elseif g.IO.ConfigNavCursorVisibleAlways then visible = true @@ -19185,10 +19219,10 @@ local NAV_WINDOWING_LIST_APPEAR_DELAY = 0.15 -- Window has already passed the IsWindowNavFocusable() local function GetFallbackWindowNameForWindowingList(window) - if bit32.band(window.Flags, ImGuiWindowFlags.Popup) ~= 0 then + if bit32.band(window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 then return "(Popup)" end - if bit32.band(window.Flags, ImGuiWindowFlags.MenuBar) ~= 0 and window.Name == "##MainMenuBar" then + if bit32.band(window.Flags, 1024 --[[ImGuiWindowFlags.MenuBar]]) ~= 0 and window.Name == "##MainMenuBar" then return "(Main menu bar)" end if window.DockNodeAsHost then @@ -19200,21 +19234,21 @@ end -- Overlay displayed when using Ctrl+Tab. Called by EndFrame(). function ImGui.NavUpdateWindowingOverlay() local g = GImGui - IM_ASSERT(g.NavWindowingTarget ~= nil) + assert(g.NavWindowingTarget ~= nil) if g.NavWindowingTimer < NAV_WINDOWING_LIST_APPEAR_DELAY then return end local viewport = ImGui.GetMainViewport() - ImGui.SetNextWindowSizeConstraints(ImVec2(viewport.Size.x * 0.20, viewport.Size.y * 0.20), ImVec2(FLT_MAX, FLT_MAX)) - ImGui.SetNextWindowPos(viewport:GetCenter(), ImGuiCond.Always, ImVec2(0.5, 0.5)) - ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, g.Style.WindowPadding * 2.0) - ImGui.Begin("##NavWindowingOverlay", nil, bit32.bor(ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoFocusOnAppearing, ImGuiWindowFlags.NoResize, ImGuiWindowFlags.NoMove, ImGuiWindowFlags.NoInputs, ImGuiWindowFlags.AlwaysAutoResize, ImGuiWindowFlags.NoSavedSettings)) + ImGui.SetNextWindowSizeConstraints(ImVec2(viewport.Size.x * 0.20, viewport.Size.y * 0.20), ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]])) + ImGui.SetNextWindowPos(viewport:GetCenter(), 1 --[[ImGuiCond.Always]], ImVec2(0.5, 0.5)) + ImGui.PushStyleVar(2 --[[ImGuiStyleVar.WindowPadding]], g.Style.WindowPadding * 2.0) + ImGui.Begin("##NavWindowingOverlay", nil, bit32.bor(1 --[[ImGuiWindowFlags.NoTitleBar]], 4096 --[[ImGuiWindowFlags.NoFocusOnAppearing]], 2 --[[ImGuiWindowFlags.NoResize]], 4 --[[ImGuiWindowFlags.NoMove]], 197120 --[[ImGuiWindowFlags.NoInputs]], 64 --[[ImGuiWindowFlags.AlwaysAutoResize]], 256 --[[ImGuiWindowFlags.NoSavedSettings]])) g.NavWindowingListWindow = g.CurrentWindow for n = g.WindowsFocusOrder.Size, 1, -1 do local window = g.WindowsFocusOrder.Data[n] - IM_ASSERT(window ~= nil) -- Fix static analyzers + assert(window ~= nil) -- Fix static analyzers if ImGui.IsWindowNavFocusable(window) then local label = window.Name if ImGui.FindRenderedTextEnd(label) == 1 then @@ -19240,37 +19274,37 @@ local function NavUpdateCreateWrappingRequest() -- local move_axis = (g.NavMoveDir == ImGuiDir.Up or g.NavMoveDir == ImGuiDir.Down) and ImGuiAxis.Y or ImGuiAxis.X -- Menu layer does not maintain scrolling / content size (#9178) - local wrap_size = (g.NavLayer == ImGuiNavLayer.Menu) and window.Size or (window.ContentSize + window.WindowPadding) + local wrap_size = (g.NavLayer == 1 --[[ImGuiNavLayer.Menu]]) and window.Size or (window.ContentSize + window.WindowPadding) - if g.NavMoveDir == ImGuiDir.Left and bit32.band(move_flags, bit32.bor(ImGuiNavMoveFlags.WrapX, ImGuiNavMoveFlags.LoopX)) ~= 0 then + if g.NavMoveDir == 0 --[[ImGuiDir.Left]] and bit32.band(move_flags, bit32.bor(4 --[[ImGuiNavMoveFlags.WrapX]], 1 --[[ImGuiNavMoveFlags.LoopX]])) ~= 0 then bb_rel.Min.x = wrap_size.x; bb_rel.Max.x = wrap_size.x - if bit32.band(move_flags, ImGuiNavMoveFlags.WrapX) ~= 0 then + if bit32.band(move_flags, 4 --[[ImGuiNavMoveFlags.WrapX]]) ~= 0 then bb_rel:TranslateY(-bb_rel:GetHeight()) -- Previous row - clip_dir = ImGuiDir.Up + clip_dir = 2 --[[ImGuiDir.Up]] end do_forward = true end - if g.NavMoveDir == ImGuiDir.Right and bit32.band(move_flags, bit32.bor(ImGuiNavMoveFlags.WrapX, ImGuiNavMoveFlags.LoopX)) ~= 0 then + if g.NavMoveDir == 1 --[[ImGuiDir.Right]] and bit32.band(move_flags, bit32.bor(4 --[[ImGuiNavMoveFlags.WrapX]], 1 --[[ImGuiNavMoveFlags.LoopX]])) ~= 0 then bb_rel.Min.x = -window.WindowPadding.x; bb_rel.Max.x = -window.WindowPadding.x - if bit32.band(move_flags, ImGuiNavMoveFlags.WrapX) ~= 0 then + if bit32.band(move_flags, 4 --[[ImGuiNavMoveFlags.WrapX]]) ~= 0 then bb_rel:TranslateY(bb_rel:GetHeight()) -- Next row - clip_dir = ImGuiDir.Down + clip_dir = 3 --[[ImGuiDir.Down]] end do_forward = true end - if g.NavMoveDir == ImGuiDir.Up and bit32.band(move_flags, bit32.bor(ImGuiNavMoveFlags.WrapY, ImGuiNavMoveFlags.LoopY)) ~= 0 then + if g.NavMoveDir == 2 --[[ImGuiDir.Up]] and bit32.band(move_flags, bit32.bor(8 --[[ImGuiNavMoveFlags.WrapY]], 2 --[[ImGuiNavMoveFlags.LoopY]])) ~= 0 then bb_rel.Min.y = wrap_size.y; bb_rel.Max.y = wrap_size.y - if bit32.band(move_flags, ImGuiNavMoveFlags.WrapY) ~= 0 then + if bit32.band(move_flags, 8 --[[ImGuiNavMoveFlags.WrapY]]) ~= 0 then bb_rel:TranslateX(-bb_rel:GetWidth()) -- Previous column - clip_dir = ImGuiDir.Left + clip_dir = 0 --[[ImGuiDir.Left]] end do_forward = true end - if g.NavMoveDir == ImGuiDir.Down and bit32.band(move_flags, bit32.bor(ImGuiNavMoveFlags.WrapY, ImGuiNavMoveFlags.LoopY)) ~= 0 then + if g.NavMoveDir == 3 --[[ImGuiDir.Down]] and bit32.band(move_flags, bit32.bor(8 --[[ImGuiNavMoveFlags.WrapY]], 2 --[[ImGuiNavMoveFlags.LoopY]])) ~= 0 then bb_rel.Min.y = -window.WindowPadding.y; bb_rel.Max.y = -window.WindowPadding.y - if bit32.band(move_flags, ImGuiNavMoveFlags.WrapY) ~= 0 then + if bit32.band(move_flags, 8 --[[ImGuiNavMoveFlags.WrapY]]) ~= 0 then bb_rel:TranslateX(bb_rel:GetWidth()) -- Next column - clip_dir = ImGuiDir.Right + clip_dir = 1 --[[ImGuiDir.Right]] end do_forward = true end @@ -19278,8 +19312,8 @@ local function NavUpdateCreateWrappingRequest() return end window.NavRectRel[g.NavLayer] = bb_rel - ImGui.NavClearPreferredPosForAxis(ImGuiAxis.X) - ImGui.NavClearPreferredPosForAxis(ImGuiAxis.Y) + ImGui.NavClearPreferredPosForAxis(1 --[[ImGuiAxis.X]]) + ImGui.NavClearPreferredPosForAxis(2 --[[ImGuiAxis.Y]]) ImGui.NavMoveRequestForward(g.NavMoveDir, clip_dir, move_flags, g.NavMoveScrollFlags) end @@ -19294,7 +19328,7 @@ function ImGui.NavEndFrame() -- Perform wrap-around in menus -- FIXME-NAV: Wrap may need to apply a weight bias on the other axis. e.g. 4x4 grid with 2 last items missing on last item won't handle LoopY/WrapY correctly. -- FIXME-NAV: Wrap (not Loop) support could be handled by the scoring function and then WrapX would function without an extra frame. - if g.NavWindow and ImGui.NavMoveRequestButNoResultYet() and bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.WrapMask_) ~= 0 and bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.Forwarded) == 0 then + if g.NavWindow and ImGui.NavMoveRequestButNoResultYet() and bit32.band(g.NavMoveFlags, 15 --[[ImGuiNavMoveFlags.WrapMask_]]) ~= 0 and bit32.band(g.NavMoveFlags, 128 --[[ImGuiNavMoveFlags.Forwarded]]) == 0 then NavUpdateCreateWrappingRequest() end end @@ -19463,7 +19497,7 @@ local function ImGuiListClipper_SortAndFuseRanges(ranges, offset) -- Now fuse ranges together as much as possible. local i = 2 + offset while i <= ranges.Size do - IM_ASSERT(not d[i].PosToIndexConvert and not d[i - 1].PosToIndexConvert) + assert(not d[i].PosToIndexConvert and not d[i - 1].PosToIndexConvert) if d[i - 1].Max < d[i].Min then i = i + 1 else @@ -19495,7 +19529,7 @@ local function ImGuiListClipper_SeekCursorAndSetupPrevLine(clipper, pos_y, line_ ImGui.TableEndRow(tbl) end local row_increase = math.floor((off_y / line_height) + 0.5) - if row_increase > 0 and bit32.band(clipper.Flags, ImGuiListClipperFlags.NoSetTableRowCounters) == 0 then -- If your clipper item height is ~= from actual table row height, consider using ImGuiListClipperFlags.NoSetTableRowCounters. See #8886. + if row_increase > 0 and bit32.band(clipper.Flags, 1 --[[ImGuiListClipperFlags.NoSetTableRowCounters]]) == 0 then -- If your clipper item height is ~= from actual table row height, consider using ImGuiListClipperFlags.NoSetTableRowCounters. See #8886. tbl.CurrentRow = tbl.CurrentRow + row_increase tbl.RowBgColorCounter = tbl.RowBgColorCounter + row_increase end @@ -19548,12 +19582,12 @@ function MT.ImGuiListClipper:End() if data then -- In theory here we should assert that we are already at the right position, but it seems saner to just seek at the end and not assert/crash the user. local g = self.Ctx - if self.ItemsCount >= 0 and self.ItemsCount < INT_MAX and self.DisplayStart >= 0 then + if self.ItemsCount >= 0 and self.ItemsCount < 2147483647 --[[INT_MAX]] and self.DisplayStart >= 0 then self:SeekCursorForItem(self.ItemsCount) end -- Restore temporary buffer and fix back pointers which may be invalidated when nesting - IM_ASSERT(data.ListClipper == self) + assert(data.ListClipper == self) data.StepNo = data.Ranges.Size g.ClipperTempDataStacked = g.ClipperTempDataStacked - 1 if g.ClipperTempDataStacked > 0 then @@ -19571,8 +19605,8 @@ function MT.ImGuiListClipper:IncludeItemByIndex(item_index) self:IncludeItemsByI function MT.ImGuiListClipper:IncludeItemsByIndex(item_begin, item_end) local data = self.TempData - IM_ASSERT(self.DisplayStart < 0) -- Only allowed after Begin() and if there has not been a specified range yet. - IM_ASSERT(item_begin <= item_end) + assert(self.DisplayStart < 0) -- Only allowed after Begin() and if there has not been a specified range yet. + assert(item_begin <= item_end) if item_begin < item_end then data.Ranges:push_back(ClipperRangeFromIndices(item_begin, item_end)) end @@ -19591,7 +19625,7 @@ local function ImGuiListClipper_StepInternal(clipper) local g = clipper.Ctx local window = g.CurrentWindow local data = clipper.TempData - IM_ASSERT(data ~= nil, "Called ImGuiListClipper::Step() too many times, or before ImGuiListClipper::Begin() ?") + assert(data ~= nil, "Called ImGuiListClipper::Step() too many times, or before ImGuiListClipper::Begin() ?") local tbl = g.CurrentTable if tbl and tbl.IsInsideRow then @@ -19631,10 +19665,10 @@ local function ImGuiListClipper_StepInternal(clipper) -- Step 1: Let the clipper infer height from first range if clipper.ItemsHeight <= 0.0 then - IM_ASSERT(data.StepNo == 1) + assert(data.StepNo == 1) -- (no float precision mitigation needed: Luau numbers are doubles) clipper.ItemsHeight = (window.DC.CursorPos.y - clipper.StartPosY) / (clipper.DisplayEnd - clipper.DisplayStart) - if clipper.ItemsHeight == 0.0 and clipper.ItemsCount == INT_MAX then -- Accept that no item have been submitted if in indeterminate mode. + if clipper.ItemsHeight == 0.0 and clipper.ItemsCount == 2147483647 --[[INT_MAX]] then -- Accept that no item have been submitted if in indeterminate mode. return false end if clipper.ItemsHeight <= 0.0 then @@ -19656,15 +19690,15 @@ local function ImGuiListClipper_StepInternal(clipper) else -- Add range selected to be included for navigation local is_nav_request = (g.NavMoveScoringItems and g.NavWindow and g.NavWindow.RootWindowForNav == window.RootWindowForNav) and true or false - local nav_off_min = (is_nav_request and g.NavMoveClipDir == ImGuiDir.Up) and -1 or 0 - local nav_off_max = (is_nav_request and g.NavMoveClipDir == ImGuiDir.Down) and 1 or 0 + local nav_off_min = (is_nav_request and g.NavMoveClipDir == 2 --[[ImGuiDir.Up]]) and -1 or 0 + local nav_off_max = (is_nav_request and g.NavMoveClipDir == 3 --[[ImGuiDir.Down]]) and 1 or 0 if is_nav_request then data.Ranges:push_back(ClipperRangeFromPositions(g.NavScoringRect.Min.y, g.NavScoringRect.Max.y, nav_off_min, nav_off_max)) if not g.NavScoringNoClipRect:IsInverted() then data.Ranges:push_back(ClipperRangeFromPositions(g.NavScoringNoClipRect.Min.y, g.NavScoringNoClipRect.Max.y, nav_off_min, nav_off_max)) end end - if is_nav_request and bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.IsTabbing) ~= 0 and g.NavTabbingDir == -1 then + if is_nav_request and bit32.band(g.NavMoveFlags, 1024 --[[ImGuiNavMoveFlags.IsTabbing]]) ~= 0 and g.NavTabbingDir == -1 then data.Ranges:push_back(ClipperRangeFromIndices(clipper.ItemsCount - 1, clipper.ItemsCount)) end @@ -19730,7 +19764,7 @@ local function ImGuiListClipper_StepInternal(clipper) -- After the last step: Let the clipper validate that we have reached the expected Y position (corresponding to element DisplayEnd), -- Advance the cursor to the end of the list and then returns 'false' to end the loop. - if clipper.ItemsCount < INT_MAX then + if clipper.ItemsCount < 2147483647 --[[INT_MAX]] then clipper:SeekCursorForItem(clipper.ItemsCount) end return false @@ -19798,7 +19832,7 @@ function ImGui.ErrorRecoveryTryToRecoverState(state_in) -- - Begin/End and BeginChild/EndChild logic is KNOWN TO BE INCONSISTENT WITH ALL OTHER BEGIN/END FUNCTIONS. -- - We will fix that in a future major update. local window = g.CurrentWindow - if bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 then + if bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 then if g.CurrentTable ~= nil and g.CurrentTable.InnerWindow == g.CurrentWindow then IM_ASSERT_USER_ERROR(false, "Missing EndTable()") ImGui.EndTable() @@ -19849,21 +19883,21 @@ function ImGui.ErrorRecoveryTryToRecoverWindowState(state_in) IM_ASSERT_USER_ERROR(false, "Missing EndGroup()") ImGui.EndGroup() end - IM_ASSERT(g.GroupStack.Size == state_in.SizeOfGroupStack) + assert(g.GroupStack.Size == state_in.SizeOfGroupStack) while window.IDStack.Size > state_in.SizeOfIDStack do IM_ASSERT_USER_ERROR(false, "Missing PopID()") ImGui.PopID() end while g.DisabledStackSize > state_in.SizeOfDisabledStack do IM_ASSERT_USER_ERROR(false, "Missing EndDisabled()") - if bit32.band(g.CurrentItemFlags, ImGuiItemFlags.Disabled) ~= 0 then + if bit32.band(g.CurrentItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) ~= 0 then ImGui.EndDisabled() else ImGui.EndDisabledOverrideReenable() g.CurrentWindowStack:back().DisabledOverrideReenable = false end end - IM_ASSERT(g.DisabledStackSize == state_in.SizeOfDisabledStack) + assert(g.DisabledStackSize == state_in.SizeOfDisabledStack) while g.ColorStack.Size > state_in.SizeOfColorStack do IM_ASSERT_USER_ERROR(false, "Missing PopStyleColor()") ImGui.PopStyleColor() @@ -19901,7 +19935,7 @@ function ImGui.DebugLog(fmt, ...) if nl ~= "" then lines[#lines + 1] = "" end if part == "" and nl == "" then break end end - if bit32.band(g.DebugLogFlags, ImGuiDebugLogFlags.OutputToTTY) ~= 0 then + if bit32.band(g.DebugLogFlags, 1048576 --[[ImGuiDebugLogFlags.OutputToTTY]]) ~= 0 then print((string.gsub(str, "\n$", ""))) end end @@ -19993,12 +20027,12 @@ function ImGui.BeginErrorTooltip() local g = GImGui local window = ImGui.FindWindowByName("##Tooltip_Error") local use_locked_pos = g.IO.KeyCtrl and window ~= nil and window.WasActive - local c = g.Style.Colors[ImGuiCol.PopupBg] - ImGui.PushStyleColor(ImGuiCol.PopupBg, ImVec4(ImLerp(c.x, 1.0, 0.15), ImLerp(c.y, 0.0, 0.15), ImLerp(c.z, 0.0, 0.15), ImLerp(c.w, 1.0, 0.15))) + local c = g.Style.Colors[4 --[[ImGuiCol.PopupBg]]] + ImGui.PushStyleColor(4 --[[ImGuiCol.PopupBg]], ImVec4(ImLerp(c.x, 1.0, 0.15), ImLerp(c.y, 0.0, 0.15), ImLerp(c.z, 0.0, 0.15), ImLerp(c.w, 1.0, 0.15))) if use_locked_pos then ImGui.SetNextWindowPos(g.ErrorTooltipLockedPos) end - local _, is_visible = ImGui.Begin("##Tooltip_Error", nil, bit32.bor(ImGuiWindowFlags.Tooltip, ImGuiWindowFlags.NoDecoration, ImGuiWindowFlags.NoMove, ImGuiWindowFlags.NoResize, ImGuiWindowFlags.NoSavedSettings, ImGuiWindowFlags.AlwaysAutoResize)) + local _, is_visible = ImGui.Begin("##Tooltip_Error", nil, bit32.bor(33554432 --[[ImGuiWindowFlags.Tooltip]], 43 --[[ImGuiWindowFlags.NoDecoration]], 4 --[[ImGuiWindowFlags.NoMove]], 2 --[[ImGuiWindowFlags.NoResize]], 256 --[[ImGuiWindowFlags.NoSavedSettings]], 64 --[[ImGuiWindowFlags.AlwaysAutoResize]])) ImGui.PopStyleColor() if is_visible and g.CurrentWindow.BeginCount == 1 then ImGui.SeparatorText("MESSAGE FROM DEAR IMGUI") @@ -20059,7 +20093,7 @@ function ImGui.ShowFontSelector(label) if ImGui.BeginCombo(label, font_current:GetDebugName()) then for i, font in io.Fonts.Fonts:iter() do ImGui.PushID(i) - if ImGui.Selectable(font:GetDebugName(), font == font_current, ImGuiSelectableFlags.SelectOnNav) then io.FontDefault = font end + if ImGui.Selectable(font:GetDebugName(), font == font_current, 64 --[[ImGuiSelectableFlags.SelectOnNav]]) then io.FontDefault = font end if font == font_current then ImGui.SetItemDefaultFocus() end ImGui.PopID() end @@ -20085,7 +20119,7 @@ end function ImGui.DebugNodeFontGlyphsForSrcMask(font, baked, src_mask) local draw_list = ImGui.GetWindowDrawList() - local glyph_col = ImGui.GetColorU32(ImGuiCol.Text) + local glyph_col = ImGui.GetColorU32(0 --[[ImGuiCol.Text]]) local cell_size = baked.Size * 1 local cell_spacing = ImGui.GetStyle().ItemSpacing.y -- [port] only scans loaded codepoints (IndexLookup range) instead of the whole 0..0xFFFF range @@ -20221,9 +20255,9 @@ function ImGui.DebugNodeTexture(tex, int_id, highlight_rect) if ImGui.TreeNode("", "Texture #%03d (%dx%d pixels)", tex.UniqueID or 0, tex.Width, tex.Height) then local cfg = g.DebugMetricsConfig _, cfg.ShowTextureUsedRect = ImGui.Checkbox("Show used rect", cfg.ShowTextureUsedRect) - ImGui.PushStyleVar(ImGuiStyleVar.ImageBorderSize, math.max(1.0, g.Style.ImageBorderSize)) + ImGui.PushStyleVar(24 --[[ImGuiStyleVar.ImageBorderSize]], math.max(1.0, g.Style.ImageBorderSize)) local p = ImGui.GetCursorScreenPos() - if tex.Status == ImTextureStatus.WantDestroy or tex.Status == ImTextureStatus.Destroyed then + if tex.Status == 4 --[[ImTextureStatus.WantDestroy]] or tex.Status == 1 --[[ImTextureStatus.Destroyed]] then ImGui.Dummy(ImVec2(tex.Width, tex.Height)) else local ref = ImTextureRef(); ref._TexData = tex @@ -20253,7 +20287,7 @@ function ImGui.ShowFontAtlas(atlas) local io = g.IO local style = g.Style ImGui.BeginDisabled() - ImGui.CheckboxFlags("io.BackendFlags: RendererHasTextures", io.BackendFlags, ImGuiBackendFlags.RendererHasTextures) + ImGui.CheckboxFlags("io.BackendFlags: RendererHasTextures", io.BackendFlags, 16 --[[ImGuiBackendFlags.RendererHasTextures]]) ImGui.EndDisabled() ImGui.ShowFontSelector("Font") local changed @@ -20310,7 +20344,7 @@ function ImGui.ShowFontAtlas(atlas) -- Texture list -- (ensure the last texture always use the same ID, so we can keep it open neatly) for tex_n, tex in atlas.TexList:iter() do - if tex_n == atlas.TexList.Size then ImGui.SetNextItemOpen(true, ImGuiCond.Once) end + if tex_n == atlas.TexList.Size then ImGui.SetNextItemOpen(true, 2 --[[ImGuiCond.Once]]) end ImGui.DebugNodeTexture(tex, atlas.TexList.Size - tex_n, nil) end end @@ -20342,8 +20376,8 @@ end function ImGui.ShowDebugLogWindow(p_open) local g = ImGui.GetCurrentContext() - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasSize) == 0 then - ImGui.SetNextWindowSize(ImVec2(0.0, ImGui.GetFontSize() * 12.0), ImGuiCond.FirstUseEver) + if bit32.band(g.NextWindowData.HasFlags, 2 --[[ImGuiNextWindowDataFlags.HasSize]]) == 0 then + ImGui.SetNextWindowSize(ImVec2(0.0, ImGui.GetFontSize() * 12.0), 4 --[[ImGuiCond.FirstUseEver]]) end local visible p_open, visible = ImGui.Begin("Dear ImGui Debug Log", p_open) @@ -20377,7 +20411,7 @@ function ImGui.ShowDebugLogWindow(p_open) ImGui.EndPopup() end - ImGui.BeginChild("##log", ImVec2(0.0, 0.0), ImGuiChildFlags.Borders, bit32.bor(ImGuiWindowFlags.AlwaysVerticalScrollbar, ImGuiWindowFlags.AlwaysHorizontalScrollbar)) + ImGui.BeginChild("##log", ImVec2(0.0, 0.0), 1 --[[ImGuiChildFlags.Borders]], bit32.bor(16384 --[[ImGuiWindowFlags.AlwaysVerticalScrollbar]], 32768 --[[ImGuiWindowFlags.AlwaysHorizontalScrollbar]])) local backup_log_flags = g.DebugLogFlags g.DebugLogFlags = bit32.band(g.DebugLogFlags, bit32.bnot(L.EventClipper)) local lines = g.DebugLogLines or { "" } @@ -20404,7 +20438,7 @@ local function PathQuery(g) if q == nil then q = { MainID = 0, Active = false, Complete = false, Step = -1, Results = {} } g.DebugItemPathQuery = q - g.DebugIDStackTool = { LastActiveFrame = -1, OptHexEncodeNonAsciiChars = true, OptCopyToClipboardOnCtrlC = false, CopyToClipboardLastTime = -FLT_MAX } + g.DebugIDStackTool = { LastActiveFrame = -1, OptHexEncodeNonAsciiChars = true, OptCopyToClipboardOnCtrlC = false, CopyToClipboardLastTime = -3.4028234663853e+38 --[[FLT_MAX]] } end return q end @@ -20473,8 +20507,8 @@ function ImGui.DebugHookIdInfo(id, data_type, data_id) local info = query.Results[query.Step + 1] if info == nil or info.ID ~= id then return end if info.Desc == nil then - if data_type == ImGuiDataType.S32 then info.Desc = string.format("%d", data_id) - elseif data_type == ImGuiDataType.String then info.Desc = tostring(data_id) + if data_type == 4 --[[ImGuiDataType.S32]] then info.Desc = string.format("%d", data_id) + elseif data_type == 9 --[[ImGuiDataType.String]] then info.Desc = tostring(data_id) else info.Desc = string.format("0x%08X [override]", id) end -- PushOverrideID() is often used to avoid hashing twice, which would lead to 2 calls to DebugHookIdInfo(). We prioritize the first one. end info.QuerySuccess = true @@ -20491,7 +20525,7 @@ local function FormatLevelInfo(g, query, n, format_for_ui) local info = query.Results[n + 1] local window = (info.Desc == nil and n == 0) and ImGui.FindWindowByID(info.ID) or nil if window then return string.format(format_for_ui and "\"%s\" [window]" or "%s", SkipUncontributingPrefix(window.Name)) end -- Source: window name (because the root ID don't call GetID() and so doesn't get hooked) - if info.QuerySuccess then return string.format((format_for_ui and info.DataType == ImGuiDataType.String) and "\"%s\"" or "%s", SkipUncontributingPrefix(info.Desc)) end -- Source: GetID() hooks (prioritize over ItemInfo() because we frequently use patterns like: PushID(str), Button("") where they both have same id) + if info.QuerySuccess then return string.format((format_for_ui and info.DataType == 9 --[[ImGuiDataType.String]]) and "\"%s\"" or "%s", SkipUncontributingPrefix(info.Desc)) end -- Source: GetID() hooks (prioritize over ItemInfo() because we frequently use patterns like: PushID(str), Button("") where they both have same id) if query.Step < #query.Results then return "" end -- Only start using fallback below when all queries are done, so during queries we don't flickering ??? markers. return "???" end @@ -20513,8 +20547,8 @@ end -- ID Stack Tool: Display UI function ImGui.ShowIDStackToolWindow(p_open) local g = ImGui.GetCurrentContext() - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasSize) == 0 then - ImGui.SetNextWindowSize(ImVec2(0.0, ImGui.GetFontSize() * 8.0), ImGuiCond.FirstUseEver) + if bit32.band(g.NextWindowData.HasFlags, 2 --[[ImGuiNextWindowDataFlags.HasSize]]) == 0 then + ImGui.SetNextWindowSize(ImVec2(0.0, ImGui.GetFontSize() * 8.0), 4 --[[ImGuiCond.FirstUseEver]]) end local visible p_open, visible = ImGui.Begin("Dear ImGui ID Stack Tool", p_open) @@ -20532,14 +20566,14 @@ function ImGui.ShowIDStackToolWindow(p_open) -- Ctrl+C to copy path local time_since_copy = g.Time - tool.CopyToClipboardLastTime - ImGui.PushStyleVarY(ImGuiStyleVar.FramePadding, 0.0) + ImGui.PushStyleVarY(11 --[[ImGuiStyleVar.FramePadding]], 0.0) _, tool.OptHexEncodeNonAsciiChars = ImGui.Checkbox("Hex-encode non-ASCII", tool.OptHexEncodeNonAsciiChars) ImGui.SameLine() _, tool.OptCopyToClipboardOnCtrlC = ImGui.Checkbox("Ctrl+C: copy path", tool.OptCopyToClipboardOnCtrlC) ImGui.PopStyleVar() ImGui.SameLine() ImGui.TextColored((time_since_copy >= 0.0 and time_since_copy < 0.75 and math.fmod(time_since_copy, 0.25) < 0.25 * 0.5) and ImVec4(1.0, 1.0, 0.3, 1.0) or ImVec4(), "*COPIED*") - if tool.OptCopyToClipboardOnCtrlC and ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.C), bit32.bor(ImGuiInputFlags.RouteGlobal, ImGuiInputFlags.RouteOverFocused)) then + if tool.OptCopyToClipboardOnCtrlC and ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 548 --[[ImGuiKey.C]]), bit32.bor(4096 --[[ImGuiInputFlags.RouteGlobal]], 16384 --[[ImGuiInputFlags.RouteOverFocused]])) then tool.CopyToClipboardLastTime = g.Time ImGui.SetClipboardText(result_path) end @@ -20547,11 +20581,11 @@ function ImGui.ShowIDStackToolWindow(p_open) ImGui.Separator() -- Display decorated stack - if #query.Results > 0 and ImGui.BeginTable("##table", 3, ImGuiTableFlags.Borders) then + if #query.Results > 0 and ImGui.BeginTable("##table", 3, 1920 --[[ImGuiTableFlags.Borders]]) then local id_width = ImGui.CalcTextSize("0xDDDDDDDD").x - ImGui.TableSetupColumn("Seed", ImGuiTableColumnFlags.WidthFixed, id_width) - ImGui.TableSetupColumn("PushID", ImGuiTableColumnFlags.WidthStretch) - ImGui.TableSetupColumn("Result", ImGuiTableColumnFlags.WidthFixed, id_width) + ImGui.TableSetupColumn("Seed", 16 --[[ImGuiTableColumnFlags.WidthFixed]], id_width) + ImGui.TableSetupColumn("PushID", 8 --[[ImGuiTableColumnFlags.WidthStretch]]) + ImGui.TableSetupColumn("Result", 16 --[[ImGuiTableColumnFlags.WidthFixed]], id_width) ImGui.TableHeadersRow() for n = 0, #query.Results - 1 do local info = query.Results[n + 1] @@ -20561,7 +20595,7 @@ function ImGui.ShowIDStackToolWindow(p_open) ImGui.TextUnformatted(FormatLevelInfo(g, query, n, true)) ImGui.TableNextColumn() ImGui.Text("0x%08X", info.ID) - if n == #query.Results - 1 then ImGui.TableSetBgColor(ImGuiTableBgTarget.CellBg, ImGui.GetColorU32(ImGuiCol.Header)) end + if n == #query.Results - 1 then ImGui.TableSetBgColor(3 --[[ImGuiTableBgTarget.CellBg]], ImGui.GetColorU32(25 --[[ImGuiCol.Header]])) end end ImGui.EndTable() end @@ -20647,7 +20681,7 @@ function ImGui.DebugNodeDrawList(window, viewport, draw_list, label) local function ShowMesh(show_mesh, show_aabb) if not fg_draw_list then return end local clip_rect = ImRect(cr.x, cr.y, cr.z, cr.w) - local vtxs_rect = ImRect(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX) + 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 for i = base, base + pcmd.ElemCount - 1, 3 do local tri = {} @@ -20657,7 +20691,7 @@ function ImGui.DebugNodeDrawList(window, viewport, draw_list, label) tri[n + 1] = ImVec2(ImDrawVtx_Pos(vtx, vi)) vtxs_rect:Add(tri[n + 1]) end - if show_mesh then fg_draw_list:AddPolyline(tri, 3, IM_COL32(255, 255, 0, 255), 1.0, ImDrawFlags.Closed) end -- In yellow: mesh triangles + if show_mesh then fg_draw_list:AddPolyline(tri, 3, IM_COL32(255, 255, 0, 255), 1.0, 512 --[[ImDrawFlags.Closed]]) end -- In yellow: mesh triangles end if show_aabb then fg_draw_list:AddRect(ImTrunc(clip_rect.Min), ImTrunc(clip_rect.Max), IM_COL32(255, 0, 255, 255)) -- In pink: clipping rectangle submitted to GPU @@ -20686,7 +20720,7 @@ function ImGui.DebugNodeTabBar(tab_bar, label) names[#names + 1] = "'" .. (ImGui.TabBarGetTabName and ImGui.TabBarGetTabName(tab_bar, tab) or "?") .. "'" end local buf = string.format("%s 0x%08X (%d tabs)%s { %s%s", label, tab_bar.ID, tab_bar.Tabs.Size, is_active and "" or " *Inactive*", table.concat(names, ", "), (tab_bar.Tabs.Size > 3) and " ... }" or " } ") - if not is_active then ImGui.PushStyleColor(ImGuiCol.Text, g.Style.Colors[ImGuiCol.TextDisabled]) end + if not is_active then ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], g.Style.Colors[1 --[[ImGuiCol.TextDisabled]]]) end local open = ImGui.TreeNode(label, "%s", buf) if not is_active then ImGui.PopStyleColor() end if is_active and ImGui.IsItemHovered() then @@ -20726,9 +20760,9 @@ function ImGui.DebugNodeTableSettings(settings, tbl) ImGui.BulletText("ColumnsCount: %d (max %d)", settings.ColumnsCount, settings.ColumnsCountMax) for n = 0, settings.ColumnsCount - 1 do local c = settings.Columns[n] - local dir = (c.SortOrder ~= -1) and c.SortDirection or ImGuiSortDirection.None + local dir = (c.SortOrder ~= -1) and c.SortDirection or 0 --[[ImGuiSortDirection.None]] ImGui.BulletText("Column %d Order %d SortOrder %2d %s Vis %d %s %7.3f ID 0x%08X", n, c.DisplayOrder, c.SortOrder, - (dir == ImGuiSortDirection.Ascending) and "Asc" or ((dir == ImGuiSortDirection.Descending) and "Des" or "---"), c.IsEnabled, (c.IsStretch ~= 0) and "Weight" or "Width ", c.WidthOrWeight, c.ID) + (dir == 1 --[[ImGuiSortDirection.Ascending]]) and "Asc" or ((dir == 2 --[[ImGuiSortDirection.Descending]]) and "Des" or "---"), c.IsEnabled, (c.IsStretch ~= 0) and "Weight" or "Width ", c.WidthOrWeight, c.ID) end ImGui.TreePop() end @@ -20737,7 +20771,7 @@ end function ImGui.DebugNodeTable(tbl) local g = ImGui.GetCurrentContext() local is_active = (tbl.LastFrameActive >= g.FrameCount - 2) -- Note that fully clipped early out scrolling tables will appear as inactive here. - if not is_active then ImGui.PushStyleColor(ImGuiCol.Text, g.Style.Colors[ImGuiCol.TextDisabled]) end + if not is_active then ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], g.Style.Colors[1 --[[ImGuiCol.TextDisabled]]]) end local open = ImGui.TreeNode(tostring(tbl), "Table 0x%08X (%d columns, in '%s')%s", tbl.ID, tbl.ColumnsCount, tbl.OuterWindow and tbl.OuterWindow.Name or "?", is_active and "" or " *Inactive*") if not is_active then ImGui.PopStyleColor() end if ImGui.IsItemHovered() then YellowRect(tbl.OuterWindow, tbl.OuterRect.Min, tbl.OuterRect.Max) end @@ -20755,7 +20789,7 @@ function ImGui.DebugNodeTable(tbl) end local sum_weights = 0.0 for n = 0, tbl.ColumnsCount - 1 do - if bit32.band(tbl.Columns[n].Flags, ImGuiTableColumnFlags.WidthStretch) ~= 0 then sum_weights = sum_weights + tbl.Columns[n].StretchWeight end + if bit32.band(tbl.Columns[n].Flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0 then sum_weights = sum_weights + tbl.Columns[n].StretchWeight end end for n = 0, tbl.ColumnsCount - 1 do local c = tbl.Columns[n] @@ -20769,7 +20803,7 @@ function ImGui.DebugNodeTable(tbl) c.WidthGiven, c.WidthRequest, c.WidthAuto, c.StretchWeight, (c.StretchWeight > 0.0 and sum_weights > 0) and (c.StretchWeight / sum_weights) * 100.0 or 0.0, c.MinX, c.MaxX, c.MaxX - c.MinX, c.ClipRect.Min.x, c.ClipRect.Max.x, c.ClipRect.Max.x - c.ClipRect.Min.x, c.ContentMaxXFrozen - c.WorkMinX, c.ContentMaxXUnfrozen - c.WorkMinX, c.ContentMaxXHeadersUsed - c.WorkMinX, c.ContentMaxXHeadersIdeal - c.WorkMinX, - c.SortOrder, (c.SortDirection == ImGuiSortDirection.Ascending) and " (Asc)" or ((c.SortDirection == ImGuiSortDirection.Descending) and " (Des)" or ""), tonumber(c.UserData) or 0, c.Flags, + c.SortOrder, (c.SortDirection == 1 --[[ImGuiSortDirection.Ascending]]) and " (Asc)" or ((c.SortDirection == 2 --[[ImGuiSortDirection.Descending]]) and " (Des)" or ""), tonumber(c.UserData) or 0, c.Flags, (bit32.band(c.Flags, CF.WidthStretch) ~= 0) and "WidthStretch " or "", (bit32.band(c.Flags, CF.WidthFixed) ~= 0) and "WidthFixed " or "", (bit32.band(c.Flags, CF.NoResize) ~= 0) and "NoResize " or "") ImGui.Bullet() ImGui.Selectable(buf) @@ -20784,7 +20818,7 @@ end local function DebugNodeDockNodeFlags(flags, label, enabled) local D = ImGuiDockNodeFlags ImGui.PushID(label) - ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, ImVec2(0.0, 0.0)) + ImGui.PushStyleVar(11 --[[ImGuiStyleVar.FramePadding]], ImVec2(0.0, 0.0)) ImGui.Text("%s:", label) if not enabled then ImGui.BeginDisabled() end for _, n in ipairs({ "NoResize", "NoResizeX", "NoResizeY", "NoTabBar", "HiddenTabBar", "NoWindowMenuButton", "NoCloseButton", "DockedWindowsInFocusRoute", @@ -20802,13 +20836,13 @@ function ImGui.DebugNodeDockNode(node, label) local g = ImGui.GetCurrentContext() local is_alive = (g.FrameCount - node.LastFrameAlive < 2) -- Submitted with ImGuiDockNodeFlags.KeepAliveOnly local is_active = (g.FrameCount - node.LastFrameActive < 2) -- Submitted - if not is_alive then ImGui.PushStyleColor(ImGuiCol.Text, g.Style.Colors[ImGuiCol.TextDisabled]) end - local tree_node_flags = node.IsFocused and ImGuiTreeNodeFlags.Selected or ImGuiTreeNodeFlags.None + if not is_alive then ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], g.Style.Colors[1 --[[ImGuiCol.TextDisabled]]]) end + local tree_node_flags = node.IsFocused and 1 --[[ImGuiTreeNodeFlags.Selected]] or 0 --[[ImGuiTreeNodeFlags.None]] local open if node.Windows.Size > 0 then open = ImGui.TreeNodeEx(node.ID, tree_node_flags, "%s 0x%04X%s: %d windows (vis: '%s')", label, node.ID, node.IsVisible and "" or " (hidden)", node.Windows.Size, node.VisibleWindow and node.VisibleWindow.Name or "NULL") else - local kind = (node.SplitAxis == ImGuiAxis.X) and "horizontal split" or ((node.SplitAxis == ImGuiAxis.Y) and "vertical split" or "empty") + local kind = (node.SplitAxis == 1 --[[ImGuiAxis.X]]) and "horizontal split" or ((node.SplitAxis == 2 --[[ImGuiAxis.Y]]) and "vertical split" or "empty") open = ImGui.TreeNodeEx(node.ID, tree_node_flags, "%s 0x%04X%s: %s (vis: '%s')", label, node.ID, node.IsVisible and "" or " (hidden)", kind, node.VisibleWindow and node.VisibleWindow.Name or "NULL") end if not is_alive then ImGui.PopStyleColor() end @@ -20849,8 +20883,8 @@ function ImGui.DebugNodeWindow(window, label) end local g = ImGui.GetCurrentContext() local is_active = window.WasActive - local tree_node_flags = (window == g.NavWindow) and ImGuiTreeNodeFlags.Selected or ImGuiTreeNodeFlags.None - if not is_active then ImGui.PushStyleColor(ImGuiCol.Text, g.Style.Colors[ImGuiCol.TextDisabled]) end + local tree_node_flags = (window == g.NavWindow) and 1 --[[ImGuiTreeNodeFlags.Selected]] or 0 --[[ImGuiTreeNodeFlags.None]] + if not is_active then ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], g.Style.Colors[1 --[[ImGuiCol.TextDisabled]]]) end local open = ImGui.TreeNodeEx(label, tree_node_flags, "%s '%s'%s", label, window.Name, is_active and "" or " *Inactive*") if not is_active then ImGui.PopStyleColor() end if ImGui.IsItemHovered() and is_active then YellowRect(window, window.Pos, window.Pos + window.Size) end @@ -20933,7 +20967,7 @@ end function ImGui.DebugNodeViewport(viewport) local g = ImGui.GetCurrentContext() - ImGui.SetNextItemOpen(true, ImGuiCond.Once) + ImGui.SetNextItemOpen(true, 2 --[[ImGuiCond.Once]]) local open = ImGui.TreeNode(viewport.ID, "Viewport #%d, ID: 0x%08X, Parent: 0x%08X, Window: \"%s\"", viewport.Idx or 0, viewport.ID, viewport.ParentViewportId or 0, viewport.Window and viewport.Window.Name or "N/A") if ImGui.IsItemHovered() then g.DebugMetricsConfig.HighlightViewportID = viewport.ID end if open then @@ -20951,7 +20985,7 @@ end -- Helper tool to diagnose between text encoding issues and font loading issues. Pass your UTF-8 string and verify that there are correct. function ImGui.DebugTextEncoding(str) ImGui.Text("Text: \"%s\"", str) - if not ImGui.BeginTable("##DebugTextEncoding", 4, bit32.bor(ImGuiTableFlags.Borders, ImGuiTableFlags.RowBg, ImGuiTableFlags.SizingFixedFit, ImGuiTableFlags.Resizable)) then return end + if not ImGui.BeginTable("##DebugTextEncoding", 4, bit32.bor(1920 --[[ImGuiTableFlags.Borders]], 64 --[[ImGuiTableFlags.RowBg]], 8192 --[[ImGuiTableFlags.SizingFixedFit]], 1 --[[ImGuiTableFlags.Resizable]])) then return end ImGui.TableSetupColumn("Offset") ImGui.TableSetupColumn("UTF-8") ImGui.TableSetupColumn("Glyph") @@ -21029,7 +21063,7 @@ function ImGui.ShowMetricsWindow(p_open) end -- Basic info - ImGui.Text("Dear ImGui %s (%d)", IMGUI_VERSION, IMGUI_VERSION_NUM) + ImGui.Text("Dear ImGui %s (%d)", IMGUI_VERSION, 19298 --[[IMGUI_VERSION_NUM]]) ImGui.Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0 / math.max(io.Framerate, 0.0001), io.Framerate) ImGui.Text("%d vertices, %d indices (%d triangles)", io.MetricsRenderVertices, io.MetricsRenderIndices, math.floor(io.MetricsRenderIndices / 3)) ImGui.Text("%d visible windows, %d current allocations", io.MetricsRenderWindows, g.DebugAllocInfo.TotalAllocCount - g.DebugAllocInfo.TotalFreeCount) @@ -21075,7 +21109,7 @@ function ImGui.ShowMetricsWindow(p_open) ImGui.SameLine(); MetricsHelpMarker("You can also call ImGui::DebugTextEncoding() from your code with a given string to test that your UTF-8 encoding settings are correct.") if cfg.ShowTextEncodingViewer then MetricsEncodingBuf = MetricsEncodingBuf or DemoBuf("", 64) - ImGui.SetNextItemWidth(-FLT_MIN) + ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) ImGui.InputText("##DebugTextEncodingBuf", MetricsEncodingBuf, 64) local str = DemoBufStr(MetricsEncodingBuf) if str ~= "" then ImGui.DebugTextEncoding(str) end @@ -21120,7 +21154,7 @@ function ImGui.ShowMetricsWindow(p_open) -- Viewports if ImGui.TreeNode("Viewports", "Viewports (%d)", g.Viewports.Size) then - ImGui.SetNextItemOpen(true, ImGuiCond.Once) + ImGui.SetNextItemOpen(true, 2 --[[ImGuiCond.Once]]) if ImGui.TreeNode("Windows Minimap") then ImGui.RenderViewportsThumbnails() ImGui.TreePop() @@ -21227,7 +21261,7 @@ function ImGui.ShowMetricsWindow(p_open) end local ini = g.SettingsIniData or "" if ImGui.TreeNode("SettingsIniData", "Settings unpacked data (.ini): %d bytes", #ini) then - ImGui.InputTextMultiline("##Ini", DemoBuf(ini, #ini + 1), #ini + 1, ImVec2(-FLT_MIN, ImGui.GetTextLineHeight() * 20), ImGuiInputTextFlags.ReadOnly) + ImGui.InputTextMultiline("##Ini", DemoBuf(ini, #ini + 1), #ini + 1, ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], ImGui.GetTextLineHeight() * 20), 512 --[[ImGuiInputTextFlags.ReadOnly]]) ImGui.TreePop() end ImGui.TreePop() @@ -21239,15 +21273,15 @@ function ImGui.ShowMetricsWindow(p_open) -- User code should never have to go through such hoops! You can generally iterate between ImGuiKey.NamedKey_BEGIN and ImGuiKey.NamedKey_END. ImGui.Indent() ImGui.Text("Keys down:") - for key = ImGuiKey.NamedKey_BEGIN, ImGuiKey.NamedKey_END - 1 do + for key = 512 --[[ImGuiKey.NamedKey_BEGIN]], 667 --[[ImGuiKey.NamedKey_END]] - 1 do if ImGui.IsKeyDown(key) then ImGui.SameLine(); ImGui.Text("\"%s\"", ImGui.GetKeyName(key)) end end ImGui.Text("Keys pressed:") - for key = ImGuiKey.NamedKey_BEGIN, ImGuiKey.NamedKey_END - 1 do + for key = 512 --[[ImGuiKey.NamedKey_BEGIN]], 667 --[[ImGuiKey.NamedKey_END]] - 1 do if ImGui.IsKeyPressed(key) then ImGui.SameLine(); ImGui.Text("\"%s\"", ImGui.GetKeyName(key)) end end ImGui.Text("Keys released:") - for key = ImGuiKey.NamedKey_BEGIN, ImGuiKey.NamedKey_END - 1 do + for key = 512 --[[ImGuiKey.NamedKey_BEGIN]], 667 --[[ImGuiKey.NamedKey_END]] - 1 do if ImGui.IsKeyReleased(key) then ImGui.SameLine(); ImGui.Text("\"%s\"", ImGui.GetKeyName(key)) end end ImGui.Text("Keys mods: %s%s%s%s", io.KeyCtrl and "Ctrl " or "", io.KeyShift and "Shift " or "", io.KeyAlt and "Alt " or "", io.KeySuper and "Super " or "") @@ -21316,7 +21350,7 @@ function ImGui.ShowMetricsWindow(p_open) local r = GetWindowRect(window, cfg.ShowWindowsRectsType) draw_list:AddRect(r.Min, r.Max, IM_COL32(255, 0, 128, 255)) end - if cfg.ShowWindowsBeginOrder and bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) == 0 then + if cfg.ShowWindowsBeginOrder and bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0 then local font_size = ImGui.GetFontSize() draw_list:AddRectFilled(window.Pos, window.Pos + ImVec2(font_size, font_size), IM_COL32(200, 100, 100, 255)) draw_list:AddText(window.Pos, IM_COL32(255, 255, 255, 255), tostring(window.BeginOrderWithinContext)) @@ -21492,7 +21526,7 @@ function ShowDockingDisabledMessage() ImGui.Text("Set io.ConfigFlags |= ImGuiConfigFlags_DockingEnable in your code, or ") ImGui.SameLine(0.0, 0.0) if ImGui.SmallButton("click here") then - io.ConfigFlags = bit32.bor(io.ConfigFlags, ImGuiConfigFlags.DockingEnable) + io.ConfigFlags = bit32.bor(io.ConfigFlags, 128 --[[ImGuiConfigFlags.DockingEnable]]) end end @@ -21658,7 +21692,7 @@ function ImGuiDemoWindowData() -- Other data DisableSections = false, LiveEditOverride = false, - LiveEditFlags = ImGuiItemFlags.LiveEditOnInputText or 0, + LiveEditFlags = 128 --[[ImGuiItemFlags.LiveEditOnInputText]] or 0, DemoTree = nil, } end @@ -21751,13 +21785,13 @@ function ExampleImageViewerData() end function ExampleImageViewer_DrawOptions(data) - ImGui.SetNextItemShortcut(ImGuiKey.G, ImGuiInputFlags.Tooltip) -- | ImGuiInputFlags.RouteGlobal + ImGui.SetNextItemShortcut(552 --[[ImGuiKey.G]], 262144 --[[ImGuiInputFlags.Tooltip]]) -- | ImGuiInputFlags.RouteGlobal _, data.GridEnabled = ImGui.Checkbox("Grid", data.GridEnabled) ImGui.SameLine() ImGui.SetNextItemWidth(ImGui.GetFontSize() * 10.0) local zoom_100 = data.Zoom * 100.0 local changed - zoom_100, changed = ImGui.DragFloat("##Zoom", zoom_100, 5.0, data.ZoomMin * 100.0, data.ZoomMax * 100.0, "%.0f%%", ImGuiSliderFlags.AlwaysClamp) + zoom_100, changed = ImGui.DragFloat("##Zoom", zoom_100, 5.0, data.ZoomMin * 100.0, data.ZoomMax * 100.0, "%.0f%%", 1536 --[[ImGuiSliderFlags.AlwaysClamp]]) if changed then data.Zoom = zoom_100 / 100.0 end @@ -21767,7 +21801,7 @@ function ExampleImageViewer_DrawCanvas(data, canvas_size, image_tex_ref, image_w local io = ImGui.GetIO() local platform_io = ImGui.GetPlatformIO() local draw_list = ImGui.GetWindowDrawList() - IM_ASSERT(canvas_size.x >= 0.0 and canvas_size.y >= 0.0) + assert(canvas_size.x >= 0.0 and canvas_size.y >= 0.0) -- Layout canvas ImGui.InvisibleButton("##Canvas", canvas_size) @@ -21780,7 +21814,7 @@ function ExampleImageViewer_DrawCanvas(data, canvas_size, image_tex_ref, image_w data.ViewReset = false -- Handle inputs - if ImGui.SetItemKeyOwner(ImGuiKey.MouseWheelY) then + if ImGui.SetItemKeyOwner(662 --[[ImGuiKey.MouseWheelY]]) then if io.MouseWheel ~= 0.0 then data.Zoom = DemoClamp(data.Zoom * (1.0 + io.MouseWheel * 0.10), data.ZoomMin, data.ZoomMax) end @@ -21947,7 +21981,7 @@ local function DemoWindowConfiguration(io) ImGui.Text("<>") end -- Prevent both being checked - if ImGui.IsKeyPressed(ImGuiKey.Space) or DemoHas(io.ConfigFlags, F.NoKeyboard) then + if ImGui.IsKeyPressed(524 --[[ImGuiKey.Space]]) or DemoHas(io.ConfigFlags, F.NoKeyboard) then io.ConfigFlags = bit32.band(io.ConfigFlags, bit32.bnot(F.NoMouse)) end end @@ -22149,7 +22183,7 @@ end function ImGui.ShowDemoWindow(p_open) -- Exceptionally add an extra assert here for people confused about initial Dear ImGui setup -- Most functions would normally just assert/crash if the context is missing. - IM_ASSERT(ImGui.GetCurrentContext() ~= nil, "Missing Dear ImGui context. Refer to examples app!") + assert(ImGui.GetCurrentContext() ~= nil, "Missing Dear ImGui context. Refer to examples app!") local data = demo_data @@ -22206,8 +22240,8 @@ function ImGui.ShowDemoWindow(p_open) -- We specify a default position/size in case there's no data in the .ini file. -- We only do it to make the demo applications a little more welcoming, but typically this isn't required. local main_viewport = ImGui.GetMainViewport() - ImGui.SetNextWindowPos(ImVec2(main_viewport.WorkPos.x + 650, main_viewport.WorkPos.y + 20), ImGuiCond.FirstUseEver) - ImGui.SetNextWindowSize(ImVec2(550, 680), ImGuiCond.FirstUseEver) + ImGui.SetNextWindowPos(ImVec2(main_viewport.WorkPos.x + 650, main_viewport.WorkPos.y + 20), 4 --[[ImGuiCond.FirstUseEver]]) + ImGui.SetNextWindowSize(ImVec2(550, 680), 4 --[[ImGuiCond.FirstUseEver]]) -- Main body of the Demo window starts here. local visible @@ -22236,7 +22270,7 @@ function ImGui.ShowDemoWindow(p_open) -- Menu Bar DemoWindowMenuBar(data) - ImGui.Text("Dear ImGui says hello! (%s) (%d)", IMGUI_VERSION or "WIP", IMGUI_VERSION_NUM or 0) + ImGui.Text("Dear ImGui says hello! (%s) (%d)", IMGUI_VERSION or "WIP", 19298 --[[IMGUI_VERSION_NUM]] or 0) ImGui.Spacing() if ImGui.CollapsingHeader("Help") then @@ -22324,8 +22358,8 @@ function DemoWindowWidgets(data) ImGui.BeginDisabled() end if override_liveedit then - ImGui.PushItemFlag(ImGuiItemFlags.LiveEditOnInputText, DemoHas(data.LiveEditFlags, ImGuiItemFlags.LiveEditOnInputText)) - ImGui.PushItemFlag(ImGuiItemFlags.LiveEditOnInputScalar, DemoHas(data.LiveEditFlags, ImGuiItemFlags.LiveEditOnInputScalar)) + ImGui.PushItemFlag(128 --[[ImGuiItemFlags.LiveEditOnInputText]], DemoHas(data.LiveEditFlags, 128 --[[ImGuiItemFlags.LiveEditOnInputText]])) + ImGui.PushItemFlag(256 --[[ImGuiItemFlags.LiveEditOnInputScalar]], DemoHas(data.LiveEditFlags, 256 --[[ImGuiItemFlags.LiveEditOnInputScalar]])) end Sub(DemoWindowWidgetsBasic, "Basic") @@ -22569,11 +22603,11 @@ local function DemoWindowLayout_ChildWindows() -- Child 1: no border, enable horizontal scrollbar do - local window_flags = ImGuiWindowFlags.HorizontalScrollbar + local window_flags = 2048 --[[ImGuiWindowFlags.HorizontalScrollbar]] if SL.disable_mouse_wheel then - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.NoScrollWithMouse) + window_flags = bit32.bor(window_flags, 16 --[[ImGuiWindowFlags.NoScrollWithMouse]]) end - BeginChild("ChildL", ImVec2(ImGui.GetContentRegionAvail().x * 0.5, 260), ImGuiChildFlags.None, window_flags) + BeginChild("ChildL", ImVec2(ImGui.GetContentRegionAvail().x * 0.5, 260), 0 --[[ImGuiChildFlags.None]], window_flags) for i = 0, 99 do ImGui.Text("%04d: scrollable region", i) end @@ -22584,15 +22618,15 @@ local function DemoWindowLayout_ChildWindows() -- Child 2: rounded border do - local window_flags = ImGuiWindowFlags.None + local window_flags = 0 --[[ImGuiWindowFlags.None]] if SL.disable_mouse_wheel then - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.NoScrollWithMouse) + window_flags = bit32.bor(window_flags, 16 --[[ImGuiWindowFlags.NoScrollWithMouse]]) end if not SL.disable_menu then - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.MenuBar) + window_flags = bit32.bor(window_flags, 1024 --[[ImGuiWindowFlags.MenuBar]]) end - ImGui.PushStyleVar(ImGuiStyleVar.ChildRounding, 5.0) - BeginChild("ChildR", ImVec2(0, 260), ImGuiChildFlags.Borders, window_flags) + ImGui.PushStyleVar(7 --[[ImGuiStyleVar.ChildRounding]], 5.0) + BeginChild("ChildR", ImVec2(0, 260), 1 --[[ImGuiChildFlags.Borders]], window_flags) if not SL.disable_menu and ImGui.BeginMenuBar() then if ImGui.BeginMenu("Menu") then DemoMenuFile() @@ -22600,11 +22634,11 @@ local function DemoWindowLayout_ChildWindows() end ImGui.EndMenuBar() end - if ImGui.BeginTable("split", 2, bit32.bor(ImGuiTableFlags.Resizable, ImGuiTableFlags.NoSavedSettings)) then + if ImGui.BeginTable("split", 2, bit32.bor(1 --[[ImGuiTableFlags.Resizable]], 16 --[[ImGuiTableFlags.NoSavedSettings]])) then for i = 0, 99 do local buf = string.format("%03d", i) ImGui.TableNextColumn() - ImGui.Button(buf, ImVec2(-FLT_MIN, 0.0)) + ImGui.Button(buf, ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], 0.0)) end ImGui.EndTable() end @@ -22620,8 +22654,8 @@ local function DemoWindowLayout_ChildWindows() -- ImGui.SetNextWindowSize(ImVec2(-FLT_MIN, 200.0)) -- end - ImGui.PushStyleColor(ImGuiCol.ChildBg, ImGui.GetStyleColorVec4(ImGuiCol.FrameBg)) - if BeginChild("ResizableChild", ImVec2(-FLT_MIN, ImGui.GetTextLineHeightWithSpacing() * 8), bit32.bor(ImGuiChildFlags.Borders, ImGuiChildFlags.ResizeY)) then + ImGui.PushStyleColor(3 --[[ImGuiCol.ChildBg]], ImGui.GetStyleColorVec4(7 --[[ImGuiCol.FrameBg]])) + if BeginChild("ResizableChild", ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], ImGui.GetTextLineHeightWithSpacing() * 8), bit32.bor(1 --[[ImGuiChildFlags.Borders]], 8 --[[ImGuiChildFlags.ResizeY]])) then for n = 0, 9 do ImGui.Text("Line %04d", n) end @@ -22638,8 +22672,8 @@ local function DemoWindowLayout_ChildWindows() ImGui.SetNextItemWidth(ImGui.GetFontSize() * 8) SL.max_height_in_lines = ImGui.DragInt("Max Height (in Lines)", SL.max_height_in_lines, 0.2) - ImGui.SetNextWindowSizeConstraints(ImVec2(0.0, ImGui.GetTextLineHeightWithSpacing() * 1), ImVec2(FLT_MAX, ImGui.GetTextLineHeightWithSpacing() * SL.max_height_in_lines)) - if BeginChild("ConstrainedChild", ImVec2(-FLT_MIN, 0.0), bit32.bor(ImGuiChildFlags.Borders, ImGuiChildFlags.AutoResizeY)) then + ImGui.SetNextWindowSizeConstraints(ImVec2(0.0, ImGui.GetTextLineHeightWithSpacing() * 1), ImVec2(3.4028234663853e+38 --[[FLT_MAX]], ImGui.GetTextLineHeightWithSpacing() * SL.max_height_in_lines)) + if BeginChild("ConstrainedChild", ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], 0.0), bit32.bor(1 --[[ImGuiChildFlags.Borders]], 32 --[[ImGuiChildFlags.AutoResizeY]])) then for n = 0, SL.draw_lines - 1 do ImGui.Text("Line %04d", n) end @@ -22657,25 +22691,25 @@ local function DemoWindowLayout_ChildWindows() -- - Using ImGui.GetItemRectMin/Max() to query the "item" state (because the child window is an item from -- the POV of the parent window). See 'Demo->Querying Status (Edited/Active/Hovered etc.)' for details. do - if SL.child_flags == nil then SL.child_flags = bit32.bor(ImGuiChildFlags.Borders, ImGuiChildFlags.ResizeX, ImGuiChildFlags.ResizeY) end + if SL.child_flags == nil then SL.child_flags = bit32.bor(1 --[[ImGuiChildFlags.Borders]], 4 --[[ImGuiChildFlags.ResizeX]], 8 --[[ImGuiChildFlags.ResizeY]]) end ImGui.SetNextItemWidth(ImGui.GetFontSize() * 8) SL.offset_x = ImGui.DragInt("Offset X", SL.offset_x, 1.0, -1000, 1000) _, SL.override_bg_color = ImGui.Checkbox("Override ChildBg color", SL.override_bg_color) - _, SL.child_flags = ImGui.CheckboxFlags("ImGuiChildFlags_Borders", SL.child_flags, ImGuiChildFlags.Borders) - _, SL.child_flags = ImGui.CheckboxFlags("ImGuiChildFlags_AlwaysUseWindowPadding", SL.child_flags, ImGuiChildFlags.AlwaysUseWindowPadding) - _, SL.child_flags = ImGui.CheckboxFlags("ImGuiChildFlags_ResizeX", SL.child_flags, ImGuiChildFlags.ResizeX) - _, SL.child_flags = ImGui.CheckboxFlags("ImGuiChildFlags_ResizeY", SL.child_flags, ImGuiChildFlags.ResizeY) - _, SL.child_flags = ImGui.CheckboxFlags("ImGuiChildFlags_FrameStyle", SL.child_flags, ImGuiChildFlags.FrameStyle) + _, SL.child_flags = ImGui.CheckboxFlags("ImGuiChildFlags_Borders", SL.child_flags, 1 --[[ImGuiChildFlags.Borders]]) + _, SL.child_flags = ImGui.CheckboxFlags("ImGuiChildFlags_AlwaysUseWindowPadding", SL.child_flags, 2 --[[ImGuiChildFlags.AlwaysUseWindowPadding]]) + _, SL.child_flags = ImGui.CheckboxFlags("ImGuiChildFlags_ResizeX", SL.child_flags, 4 --[[ImGuiChildFlags.ResizeX]]) + _, SL.child_flags = ImGui.CheckboxFlags("ImGuiChildFlags_ResizeY", SL.child_flags, 8 --[[ImGuiChildFlags.ResizeY]]) + _, SL.child_flags = ImGui.CheckboxFlags("ImGuiChildFlags_FrameStyle", SL.child_flags, 128 --[[ImGuiChildFlags.FrameStyle]]) ImGui.SameLine(); DemoHelpMarker("Style the child window like a framed item: use FrameBg, FrameRounding, FrameBorderSize, FramePadding instead of ChildBg, ChildRounding, ChildBorderSize, WindowPadding.") - if Has(SL.child_flags, ImGuiChildFlags.FrameStyle) then + if Has(SL.child_flags, 128 --[[ImGuiChildFlags.FrameStyle]]) then SL.override_bg_color = false end ImGui.SetCursorPosX(ImGui.GetCursorPosX() + SL.offset_x) if SL.override_bg_color then - ImGui.PushStyleColor(ImGuiCol.ChildBg, IM_COL32(255, 0, 0, 100)) + ImGui.PushStyleColor(3 --[[ImGuiCol.ChildBg]], IM_COL32(255, 0, 0, 100)) end - BeginChild("Red", ImVec2(200, 100), SL.child_flags, ImGuiWindowFlags.None) + BeginChild("Red", ImVec2(200, 100), SL.child_flags, 0 --[[ImGuiWindowFlags.None]]) if SL.override_bg_color then ImGui.PopStyleColor() end @@ -22720,7 +22754,7 @@ local function DemoWindowLayout_WidgetsWidth() block("SetNextItemWidth/PushItemWidth(-Min(GetContentRegionAvail().x * 0.40f, GetFontSize() * 12))", nil, -IM_MIN(ImGui.GetFontSize() * 12, ImGui.GetContentRegionAvail().x * 0.40), "float##5a", "float (indented)##5b") -- Demonstrate using PushItemWidth to surround three items. -- Calling SetNextItemWidth() before each of them would have the same effect. - block("SetNextItemWidth/PushItemWidth(-FLT_MIN)", "Align to right edge", -FLT_MIN, "##float6a", "float (indented)##6b") + block("SetNextItemWidth/PushItemWidth(-FLT_MIN)", "Align to right edge", -1.1754943508223e-38 --[[FLT_MIN]], "##float6a", "float (indented)##6b") end local function DemoWindowLayout_BasicHorizontal() @@ -22941,7 +22975,7 @@ local function DemoWindowLayout_TextBaseline() local spacing = ImGui.GetStyle().ItemInnerSpacing.x ImGui.Button("Button##1") -- Will make line higher ImGui.SameLine(0.0, spacing) - if ImGui.TreeNodeEx("Node##1", ImGuiTreeNodeFlags.DrawLinesNone) then + if ImGui.TreeNodeEx("Node##1", 262144 --[[ImGuiTreeNodeFlags.DrawLinesNone]]) then -- Placeholder tree data for i = 0, 5 do ImGui.BulletText("Item %d..", i) @@ -22950,11 +22984,11 @@ local function DemoWindowLayout_TextBaseline() end local padding = math.floor(ImGui.GetFontSize() * 1.20) -- Large padding - ImGui.PushStyleVarY(ImGuiStyleVar.FramePadding, padding) + ImGui.PushStyleVarY(11 --[[ImGuiStyleVar.FramePadding]], padding) ImGui.Button("Button##2") ImGui.PopStyleVar() ImGui.SameLine(0.0, spacing) - if ImGui.TreeNodeEx("Node##2", ImGuiTreeNodeFlags.DrawLinesNone) then + if ImGui.TreeNodeEx("Node##2", 262144 --[[ImGuiTreeNodeFlags.DrawLinesNone]]) then ImGui.TreePop() end @@ -22990,10 +23024,10 @@ local function DemoWindowLayout_HorizontalContentsSizeWindow() if SL.explicit_content_size then ImGui.SetNextWindowContentSize(ImVec2(SL.contents_size_x, 0.0)) end - SL.show_horizontal_contents_size_demo_window = ImGui.Begin("Horizontal contents size demo window", SL.show_horizontal_contents_size_demo_window, SL.show_h_scrollbar and ImGuiWindowFlags.HorizontalScrollbar or 0) + SL.show_horizontal_contents_size_demo_window = ImGui.Begin("Horizontal contents size demo window", SL.show_horizontal_contents_size_demo_window, SL.show_h_scrollbar and 2048 --[[ImGuiWindowFlags.HorizontalScrollbar]] or 0) IMGUI_DEMO_MARKER("Layout/Scrolling/Horizontal contents size demo window") - ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, ImVec2(2, 0)) - ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, ImVec2(2, 0)) + ImGui.PushStyleVar(14 --[[ImGuiStyleVar.ItemSpacing]], ImVec2(2, 0)) + ImGui.PushStyleVar(11 --[[ImGuiStyleVar.FramePadding]], ImVec2(2, 0)) DemoHelpMarker( "Test how different widgets react and impact the work rectangle growing when horizontal scrolling is enabled.\n\n" .. "Use 'Metrics->Tools->Show windows rectangles' to visualize rectangles.") @@ -23011,8 +23045,8 @@ local function DemoWindowLayout_HorizontalContentsSizeWindow() ImGui.SetNextItemWidth(ImGui.CalcTextSize("123456").x) SL.contents_size_x = ImGui.DragFloat("##csx", SL.contents_size_x) local p = ImGui.GetCursorScreenPos() - ImGui.GetWindowDrawList():AddRectFilled(p, ImVec2(p.x + 10, p.y + 10), IM_COL32_WHITE) - ImGui.GetWindowDrawList():AddRectFilled(ImVec2(p.x + SL.contents_size_x - 10, p.y), ImVec2(p.x + SL.contents_size_x, p.y + 10), IM_COL32_WHITE) + ImGui.GetWindowDrawList():AddRectFilled(p, ImVec2(p.x + 10, p.y + 10), 4294967295 --[[IM_COL32_WHITE]]) + ImGui.GetWindowDrawList():AddRectFilled(ImVec2(p.x + SL.contents_size_x - 10, p.y), ImVec2(p.x + SL.contents_size_x, p.y + 10), 4294967295 --[[IM_COL32_WHITE]]) ImGui.Dummy(ImVec2(0, 10)) end ImGui.PopStyleVar(2) @@ -23036,7 +23070,7 @@ local function DemoWindowLayout_HorizontalContentsSizeWindow() end if SL.show_columns then ImGui.Text("Tables:") - if ImGui.BeginTable("table", 4, ImGuiTableFlags.Borders) then + if ImGui.BeginTable("table", 4, 1920 --[[ImGuiTableFlags.Borders]]) then for n = 0, 3 do ImGui.TableNextColumn() ImGui.Text("Width %.2f", ImGui.GetContentRegionAvail().x) @@ -23063,7 +23097,7 @@ local function DemoWindowLayout_HorizontalContentsSizeWindow() ImGui.EndTabBar() end if SL.show_child then - BeginChild("child", ImVec2(0, 0), ImGuiChildFlags.Borders) + BeginChild("child", ImVec2(0, 0), 1 --[[ImGuiChildFlags.Borders]]) ImGui.EndChild() end ImGui.End() @@ -23084,12 +23118,12 @@ local function DemoWindowLayout_Scrolling() _, SL.enable_track = ImGui.Checkbox("Track", SL.enable_track) local scroll_to_off - SL.scroll_to_off_px, scroll_to_off = ImGui.DragFloat("##off", SL.scroll_to_off_px, 1.00, 0, FLT_MAX, "+%.0f px") + SL.scroll_to_off_px, scroll_to_off = ImGui.DragFloat("##off", SL.scroll_to_off_px, 1.00, 0, 3.4028234663853e+38 --[[FLT_MAX]], "+%.0f px") ImGui.SameLine() scroll_to_off = ImGui.Button("Scroll Offset") or scroll_to_off local scroll_to_pos - SL.scroll_to_pos_px, scroll_to_pos = ImGui.DragFloat("##pos", SL.scroll_to_pos_px, 1.00, -10, FLT_MAX, "X/Y = %.0f px") + SL.scroll_to_pos_px, scroll_to_pos = ImGui.DragFloat("##pos", SL.scroll_to_pos_px, 1.00, -10, 3.4028234663853e+38 --[[FLT_MAX]], "X/Y = %.0f px") ImGui.SameLine() scroll_to_pos = ImGui.Button("Scroll To Pos") or scroll_to_pos ImGui.PopItemWidth() @@ -23110,9 +23144,9 @@ local function DemoWindowLayout_Scrolling() ImGui.BeginGroup() ImGui.TextUnformatted(vnames[i + 1]) - local child_flags = SL.enable_extra_decorations and ImGuiWindowFlags.MenuBar or 0 + local child_flags = SL.enable_extra_decorations and 1024 --[[ImGuiWindowFlags.MenuBar]] or 0 local child_id = ImGui.GetID(i) - local child_is_visible = BeginChild(child_id, ImVec2(child_w, 200.0), ImGuiChildFlags.Borders, child_flags) + local child_is_visible = BeginChild(child_id, ImVec2(child_w, 200.0), 1 --[[ImGuiChildFlags.Borders]], child_flags) if ImGui.BeginMenuBar() then ImGui.TextUnformatted("abc") ImGui.EndMenuBar() @@ -23153,9 +23187,9 @@ local function DemoWindowLayout_Scrolling() local hnames = { "Left", "25%", "Center", "75%", "Right" } for i = 0, 4 do local child_height = ImGui.GetTextLineHeight() + style.ScrollbarSize + style.WindowPadding.y * 2.0 - local child_flags = bit32.bor(ImGuiWindowFlags.HorizontalScrollbar, SL.enable_extra_decorations and ImGuiWindowFlags.AlwaysVerticalScrollbar or 0) + local child_flags = bit32.bor(2048 --[[ImGuiWindowFlags.HorizontalScrollbar]], SL.enable_extra_decorations and 16384 --[[ImGuiWindowFlags.AlwaysVerticalScrollbar]] or 0) local child_id = ImGui.GetID(i) - local child_is_visible = BeginChild(child_id, ImVec2(-100, child_height), ImGuiChildFlags.Borders, child_flags) + local child_is_visible = BeginChild(child_id, ImVec2(-100, child_height), 1 --[[ImGuiChildFlags.Borders]], child_flags) if scroll_to_off then ImGui.SetScrollX(SL.scroll_to_off_px) end @@ -23190,10 +23224,10 @@ local function DemoWindowLayout_Scrolling() "Horizontal scrolling for a window is enabled via the ImGuiWindowFlags_HorizontalScrollbar flag.\n\n" .. "You may want to also explicitly specify content width by using SetNextWindowContentWidth() before Begin().") SL.lines = ImGui.SliderInt("Lines", SL.lines, 1, 15) - ImGui.PushStyleVar(ImGuiStyleVar.FrameRounding, 3.0) - ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, ImVec2(2.0, 1.0)) + ImGui.PushStyleVar(12 --[[ImGuiStyleVar.FrameRounding]], 3.0) + ImGui.PushStyleVar(11 --[[ImGuiStyleVar.FramePadding]], ImVec2(2.0, 1.0)) local scrolling_child_size = ImVec2(0, ImGui.GetFrameHeightWithSpacing() * 7 + 30) - BeginChild("scrolling", scrolling_child_size, ImGuiChildFlags.Borders, ImGuiWindowFlags.HorizontalScrollbar) + BeginChild("scrolling", scrolling_child_size, 1 --[[ImGuiChildFlags.Borders]], 2048 --[[ImGuiWindowFlags.HorizontalScrollbar]]) for line = 0, SL.lines - 1 do -- Display random stuff. For the sake of this trivial demo we are using basic Button() + SameLine() -- If you want to create your own time line for a real application you may be better off manipulating @@ -23206,9 +23240,9 @@ local function DemoWindowLayout_Scrolling() ImGui.PushID(n + line * 1000) local label = (n % 15 == 0) and "FizzBuzz" or (n % 3 == 0) and "Fizz" or (n % 5 == 0) and "Buzz" or tostring(n) local hue = n * 0.05 - ImGui.PushStyleColor(ImGuiCol.Button, HSV(hue, 0.6, 0.6)) - ImGui.PushStyleColor(ImGuiCol.ButtonHovered, HSV(hue, 0.7, 0.7)) - ImGui.PushStyleColor(ImGuiCol.ButtonActive, HSV(hue, 0.8, 0.8)) + ImGui.PushStyleColor(22 --[[ImGuiCol.Button]], HSV(hue, 0.6, 0.6)) + ImGui.PushStyleColor(23 --[[ImGuiCol.ButtonHovered]], HSV(hue, 0.7, 0.7)) + ImGui.PushStyleColor(24 --[[ImGuiCol.ButtonActive]], HSV(hue, 0.8, 0.8)) ImGui.Button(label, ImVec2(base_w + math.sin(line + n) * base_w * 0.5, 0.0)) ImGui.PopStyleColor(3) ImGui.PopID() @@ -23273,7 +23307,7 @@ local function DemoWindowLayout_TextClipping() ImGui.PushID(n) ImGui.InvisibleButton("##canvas", size) - if ImGui.IsItemActive() and ImGui.IsMouseDragging(ImGuiMouseButton.Left) then + if ImGui.IsItemActive() and ImGui.IsMouseDragging(0 --[[ImGuiMouseButton.Left]]) then offset.x = offset.x + ImGui.GetIO().MouseDelta.x offset.y = offset.y + ImGui.GetIO().MouseDelta.y end @@ -23290,17 +23324,17 @@ local function DemoWindowLayout_TextClipping() if n == 0 then ImGui.PushClipRect(p0, p1, true) draw_list:AddRectFilled(p0, p1, IM_COL32(90, 90, 120, 255)) - draw_list:AddText(text_pos, IM_COL32_WHITE, text_str) + draw_list:AddText(text_pos, 4294967295 --[[IM_COL32_WHITE]], text_str) ImGui.PopClipRect() elseif n == 1 then draw_list:PushClipRect(p0, p1, true) draw_list:AddRectFilled(p0, p1, IM_COL32(90, 90, 120, 255)) - draw_list:AddText(text_pos, IM_COL32_WHITE, text_str) + draw_list:AddText(text_pos, 4294967295 --[[IM_COL32_WHITE]], text_str) draw_list:PopClipRect() else local clip_rect = ImVec4(p0.x, p0.y, p1.x, p1.y) -- AddText() takes a ImVec4 here so let's convert. draw_list:AddRectFilled(p0, p1, IM_COL32(90, 90, 120, 255)) - draw_list:AddText(ImGui.GetFont(), ImGui.GetFontSize(), text_pos, IM_COL32_WHITE, text_str, 1, #text_str + 1, 0.0, clip_rect) + draw_list:AddText(ImGui.GetFont(), ImGui.GetFontSize(), text_pos, 4294967295 --[[IM_COL32_WHITE]], text_str, 1, #text_str + 1, 0.0, clip_rect) end until true end end @@ -23427,7 +23461,7 @@ local function DemoWindowPopups_Popups() if ImGui.Button("With a menu..") then ImGui.OpenPopup("my_file_popup") end - if ImGui.BeginPopup("my_file_popup", ImGuiWindowFlags.MenuBar) then + if ImGui.BeginPopup("my_file_popup", 1024 --[[ImGuiWindowFlags.MenuBar]]) then if ImGui.BeginMenuBar() then if ImGui.BeginMenu("File") then DemoMenuFile() @@ -23490,7 +23524,7 @@ local function DemoWindowPopups_ContextMenus() if ImGui.BeginPopupContextItem("my popup") then if ImGui.Selectable("Set to zero") then SP.value = 0.0 end if ImGui.Selectable("Set to PI") then SP.value = 3.1415 end - ImGui.SetNextItemWidth(-FLT_MIN) + ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) SP.value = ImGui.DragFloat("##Value", SP.value, 0.1, 0.0, 0.0) ImGui.EndPopup() end @@ -23499,7 +23533,7 @@ local function DemoWindowPopups_ContextMenus() -- Here we make it that right-clicking this other text element opens the same popup as above. -- The popup itself will be submitted by the code above. ImGui.Text("(2) Or right-click this text") - ImGui.OpenPopupOnItemClick("my popup", ImGuiPopupFlags.MouseButtonRight) + ImGui.OpenPopupOnItemClick("my popup", 8 --[[ImGuiPopupFlags.MouseButtonRight]]) -- Back to square one: manually open the same popup. if ImGui.Button("(3) Or click this button") then @@ -23538,16 +23572,16 @@ local function DemoWindowPopups_Modals() -- Always center this window when appearing local center = ImGui.GetMainViewport():GetCenter() - ImGui.SetNextWindowPos(center, ImGuiCond.Appearing, ImVec2(0.5, 0.5)) + ImGui.SetNextWindowPos(center, 8 --[[ImGuiCond.Appearing]], ImVec2(0.5, 0.5)) - if ImGui.BeginPopupModal("Delete?", nil, ImGuiWindowFlags.AlwaysAutoResize) then + if ImGui.BeginPopupModal("Delete?", nil, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) then ImGui.Text("All those beautiful files will be deleted.\nThis operation cannot be undone!") ImGui.Separator() -- local unused_i = 0 -- unused_i = ImGui.Combo("Combo", unused_i, "Delete\0Delete harder\0") - ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, ImVec2(0, 0)) + ImGui.PushStyleVar(11 --[[ImGuiStyleVar.FramePadding]], ImVec2(0, 0)) _, SP.dont_ask_me_next_time = ImGui.Checkbox("Don't ask me next time", SP.dont_ask_me_next_time) ImGui.PopStyleVar() @@ -23561,7 +23595,7 @@ local function DemoWindowPopups_Modals() if ImGui.Button("Stacked modals..") then ImGui.OpenPopup("Stacked 1") end - if ImGui.BeginPopupModal("Stacked 1", nil, ImGuiWindowFlags.MenuBar) then + if ImGui.BeginPopupModal("Stacked 1", nil, 1024 --[[ImGuiWindowFlags.MenuBar]]) then if ImGui.BeginMenuBar() then if ImGui.BeginMenu("File") then if ImGui.MenuItem("Some menu item") then end @@ -23681,12 +23715,12 @@ local function MyItem_SortWithSortSpecs(sort_specs, items, items_count) elseif uid == MyItemColumnID_Name then delta = (a.Name < b.Name) and -1 or (a.Name > b.Name) and 1 or 0 elseif uid == MyItemColumnID_Quantity then delta = a.Quantity - b.Quantity elseif uid == MyItemColumnID_Description then delta = (a.Name < b.Name) and -1 or (a.Name > b.Name) and 1 or 0 - else IM_ASSERT(false) end + else assert(false) end if delta > 0 then - return (sort_spec.SortDirection == ImGuiSortDirection.Ascending) and 1 or -1 + return (sort_spec.SortDirection == 1 --[[ImGuiSortDirection.Ascending]]) and 1 or -1 end if delta < 0 then - return (sort_spec.SortDirection == ImGuiSortDirection.Ascending) and -1 or 1 + return (sort_spec.SortDirection == 1 --[[ImGuiSortDirection.Ascending]]) and -1 or 1 end end @@ -23710,8 +23744,8 @@ end -- Make the UI compact because there are so many fields local function PushStyleCompact() local style = ImGui.GetStyle() - ImGui.PushStyleVarY(ImGuiStyleVar.FramePadding, math.floor(style.FramePadding.y * 0.60)) - ImGui.PushStyleVarY(ImGuiStyleVar.ItemSpacing, math.floor(style.ItemSpacing.y * 0.60)) + ImGui.PushStyleVarY(11 --[[ImGuiStyleVar.FramePadding]], math.floor(style.FramePadding.y * 0.60)) + ImGui.PushStyleVarY(14 --[[ImGuiStyleVar.ItemSpacing]], math.floor(style.ItemSpacing.y * 0.60)) end local function PopStyleCompact() @@ -23723,24 +23757,24 @@ local table_sizing_policies = nil local function EditTableSizingFlags(flags) if table_sizing_policies == nil then table_sizing_policies = { - { Value = ImGuiTableFlags.None, Name = "Default", Tooltip = "Use default sizing policy:\n- ImGuiTableFlags_SizingFixedFit if ScrollX is on or if host window has ImGuiWindowFlags_AlwaysAutoResize.\n- ImGuiTableFlags_SizingStretchSame otherwise." }, - { Value = ImGuiTableFlags.SizingFixedFit, Name = "ImGuiTableFlags_SizingFixedFit", Tooltip = "Columns default to _WidthFixed (if resizable) or _WidthAuto (if not resizable), matching contents width." }, - { Value = ImGuiTableFlags.SizingFixedSame, Name = "ImGuiTableFlags_SizingFixedSame", Tooltip = "Columns are all the same width, matching the maximum contents width.\nImplicitly disable ImGuiTableFlags_Resizable and enable ImGuiTableFlags_NoKeepColumnsVisible." }, - { Value = ImGuiTableFlags.SizingStretchProp, Name = "ImGuiTableFlags_SizingStretchProp", Tooltip = "Columns default to _WidthStretch with weights proportional to their widths." }, - { Value = ImGuiTableFlags.SizingStretchSame, Name = "ImGuiTableFlags_SizingStretchSame", Tooltip = "Columns default to _WidthStretch with same weights." }, + { Value = 0 --[[ImGuiTableFlags.None]], Name = "Default", Tooltip = "Use default sizing policy:\n- ImGuiTableFlags_SizingFixedFit if ScrollX is on or if host window has ImGuiWindowFlags_AlwaysAutoResize.\n- ImGuiTableFlags_SizingStretchSame otherwise." }, + { Value = 8192 --[[ImGuiTableFlags.SizingFixedFit]], Name = "ImGuiTableFlags_SizingFixedFit", Tooltip = "Columns default to _WidthFixed (if resizable) or _WidthAuto (if not resizable), matching contents width." }, + { Value = 16384 --[[ImGuiTableFlags.SizingFixedSame]], Name = "ImGuiTableFlags_SizingFixedSame", Tooltip = "Columns are all the same width, matching the maximum contents width.\nImplicitly disable ImGuiTableFlags_Resizable and enable ImGuiTableFlags_NoKeepColumnsVisible." }, + { Value = 24576 --[[ImGuiTableFlags.SizingStretchProp]], Name = "ImGuiTableFlags_SizingStretchProp", Tooltip = "Columns default to _WidthStretch with weights proportional to their widths." }, + { Value = 32768 --[[ImGuiTableFlags.SizingStretchSame]], Name = "ImGuiTableFlags_SizingStretchSame", Tooltip = "Columns default to _WidthStretch with same weights." }, } end local policies = table_sizing_policies local idx = 1 while idx <= #policies do - if policies[idx].Value == bit32.band(flags, ImGuiTableFlags.SizingMask_) then break end + if policies[idx].Value == bit32.band(flags, 57344 --[[ImGuiTableFlags.SizingMask_]]) then break end idx = idx + 1 end local preview_text = (idx <= #policies) and (idx > 1 and string.sub(policies[idx].Name, #"ImGuiTableFlags" + 1) or policies[idx].Name) or "" if ImGui.BeginCombo("Sizing Policy", preview_text) then for n = 1, #policies do if ImGui.Selectable(policies[n].Name, idx == n) then - flags = bit32.bor(bit32.band(flags, bit32.bnot(ImGuiTableFlags.SizingMask_)), policies[n].Value) + flags = bit32.bor(bit32.band(flags, bit32.bnot(57344 --[[ImGuiTableFlags.SizingMask_]])), policies[n].Value) end end ImGui.EndCombo() @@ -23790,10 +23824,10 @@ local function EditTableColumnsFlags(f) end local function ShowTableColumnsStatusFlags(flags) - ImGui.CheckboxFlags("_IsEnabled", flags, ImGuiTableColumnFlags.IsEnabled) - ImGui.CheckboxFlags("_IsVisible", flags, ImGuiTableColumnFlags.IsVisible) - ImGui.CheckboxFlags("_IsSorted", flags, ImGuiTableColumnFlags.IsSorted) - ImGui.CheckboxFlags("_IsHovered", flags, ImGuiTableColumnFlags.IsHovered) + ImGui.CheckboxFlags("_IsEnabled", flags, 16777216 --[[ImGuiTableColumnFlags.IsEnabled]]) + ImGui.CheckboxFlags("_IsVisible", flags, 33554432 --[[ImGuiTableColumnFlags.IsVisible]]) + ImGui.CheckboxFlags("_IsSorted", flags, 67108864 --[[ImGuiTableColumnFlags.IsSorted]]) + ImGui.CheckboxFlags("_IsHovered", flags, 134217728 --[[ImGuiTableColumnFlags.IsHovered]]) end local function bor(...) return bit32.bor(...) end @@ -23908,7 +23942,7 @@ local function Tables_BordersBackground() if s.contents_type == CT_Text then ImGui.TextUnformatted(buf) elseif s.contents_type == CT_FillButton then - ImGui.Button(buf, ImVec2(-FLT_MIN, 0.0)) + ImGui.Button(buf, ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], 0.0)) end end end @@ -24105,7 +24139,7 @@ local function Tables_Padding() ImGui.Text("Avail %.2f", ImGui.GetContentRegionAvail().x) else local buf = string.format("Hello %d,%d", column, row) - ImGui.Button(buf, ImVec2(-FLT_MIN, 0.0)) + ImGui.Button(buf, ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], 0.0)) end -- if bit32.band(ImGui.TableGetColumnFlags(), ImGuiTableColumnFlags.IsHovered) ~= 0 then -- ImGui.TableSetBgColor(ImGuiTableBgTarget.CellBg, IM_COL32(0, 100, 0, 255)) @@ -24131,17 +24165,17 @@ local function Tables_Padding() ImGui.SliderFloat2("CellPadding", s.cell_padding, 0.0, 10.0, "%.0f") PopStyleCompact() - ImGui.PushStyleVar(ImGuiStyleVar.CellPadding, s.cell_padding) + ImGui.PushStyleVar(17 --[[ImGuiStyleVar.CellPadding]], s.cell_padding) if ImGui.BeginTable("table_padding_2", 3, s.flags2) then if not s.show_widget_frame_bg then - ImGui.PushStyleColor(ImGuiCol.FrameBg, 0) + ImGui.PushStyleColor(7 --[[ImGuiCol.FrameBg]], 0) end for cell = 0, 3 * 5 - 1 do ImGui.TableNextColumn() if s.init then s.text_bufs[cell + 1] = Buf("edit me", 16) end - ImGui.SetNextItemWidth(-FLT_MIN) + ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) ImGui.PushID(cell) ImGui.InputText("##cell", s.text_bufs[cell + 1], 16) ImGui.PopID() @@ -24222,7 +24256,7 @@ local function Tables_SizingPolicies() "Be mindful that using right-alignment (e.g. size.x = -FLT_MIN) creates a feedback loop " .. "where contents width can feed into auto-column width can feed into contents width.") end - s.column_count = ImGui.DragInt("Columns", s.column_count, 0.1, 1, 64, "%d", ImGuiSliderFlags.AlwaysClamp) + s.column_count = ImGui.DragInt("Columns", s.column_count, 0.1, 1, 64, "%d", 1536 --[[ImGuiSliderFlags.AlwaysClamp]]) _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_Resizable", s.flags, TF.Resizable) _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_PreciseWidths", s.flags, TF.PreciseWidths) ImGui.SameLine(); DemoHelpMarker("Disable distributing remainder width to stretched columns (width allocation on a 100-wide table with 3 columns: Without this flag: 33,33,34. With this flag: 33,33,33). With larger number of columns, resizing will appear to be less smooth.") @@ -24246,8 +24280,8 @@ local function Tables_SizingPolicies() elseif ct == CT_LongText then ImGui.Text("Some %s text %d,%d\nOver two lines..", column == 0 and "long" or "longeeer", column, row) elseif ct == CT_ShowWidth then ImGui.Text("W: %.1f", ImGui.GetContentRegionAvail().x) elseif ct == CT_Button then ImGui.Button(label) - elseif ct == CT_FillButton then ImGui.Button(label, ImVec2(-FLT_MIN, 0.0)) - elseif ct == CT_InputText then ImGui.SetNextItemWidth(-FLT_MIN); ImGui.InputText("##", s.text_buf, 32) + elseif ct == CT_FillButton then ImGui.Button(label, ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], 0.0)) + elseif ct == CT_InputText then ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]); ImGui.InputText("##", s.text_buf, 32) end ImGui.PopID() end @@ -24272,9 +24306,9 @@ local function Tables_VerticalScrolling() local outer_size = ImVec2(0.0, TEXT_BASE_HEIGHT * 8) if ImGui.BeginTable("table_scrolly", 3, s.flags, outer_size) then ImGui.TableSetupScrollFreeze(0, 1) -- Make top row always visible - ImGui.TableSetupColumn("One", ImGuiTableColumnFlags.None) - ImGui.TableSetupColumn("Two", ImGuiTableColumnFlags.None) - ImGui.TableSetupColumn("Three", ImGuiTableColumnFlags.None) + ImGui.TableSetupColumn("One", 0 --[[ImGuiTableColumnFlags.None]]) + ImGui.TableSetupColumn("Two", 0 --[[ImGuiTableColumnFlags.None]]) + ImGui.TableSetupColumn("Three", 0 --[[ImGuiTableColumnFlags.None]]) ImGui.TableHeadersRow() -- Demonstrate using clipper for large vertical lists @@ -24314,9 +24348,9 @@ local function Tables_HorizontalScrolling() _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_ScrollX", s.flags, TF.ScrollX) _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_ScrollY", s.flags, TF.ScrollY) ImGui.SetNextItemWidth(ImGui.GetFrameHeight()) - s.freeze_cols = ImGui.DragInt("freeze_cols", s.freeze_cols, 0.2, 0, 9, nil, ImGuiSliderFlags.NoInput) + s.freeze_cols = ImGui.DragInt("freeze_cols", s.freeze_cols, 0.2, 0, 9, nil, 128 --[[ImGuiSliderFlags.NoInput]]) ImGui.SetNextItemWidth(ImGui.GetFrameHeight()) - s.freeze_rows = ImGui.DragInt("freeze_rows", s.freeze_rows, 0.2, 0, 9, nil, ImGuiSliderFlags.NoInput) + s.freeze_rows = ImGui.DragInt("freeze_rows", s.freeze_rows, 0.2, 0, 9, nil, 128 --[[ImGuiSliderFlags.NoInput]]) PopStyleCompact() -- When using ScrollX or ScrollY we need to specify a size for our table container! @@ -24324,7 +24358,7 @@ local function Tables_HorizontalScrolling() local outer_size = ImVec2(0.0, TEXT_BASE_HEIGHT * 8) if ImGui.BeginTable("table_scrollx", 7, s.flags, outer_size) then ImGui.TableSetupScrollFreeze(s.freeze_cols, s.freeze_rows) - ImGui.TableSetupColumn("Line #", ImGuiTableColumnFlags.NoHide) -- Make the first column not hideable to match our use of TableSetupScrollFreeze() + ImGui.TableSetupColumn("Line #", 128 --[[ImGuiTableColumnFlags.NoHide]]) -- Make the first column not hideable to match our use of TableSetupScrollFreeze() ImGui.TableSetupColumn("One") ImGui.TableSetupColumn("Two") ImGui.TableSetupColumn("Three") @@ -24366,7 +24400,7 @@ local function Tables_HorizontalScrolling() ImGui.PushID("flags3") ImGui.PushItemWidth(TEXT_BASE_WIDTH * 30) _, s.flags2 = ImGui.CheckboxFlags("ImGuiTableFlags_ScrollX", s.flags2, TF.ScrollX) - s.inner_width = ImGui.DragFloat("inner_width", s.inner_width, 1.0, 0.0, FLT_MAX, "%.1f") + s.inner_width = ImGui.DragFloat("inner_width", s.inner_width, 1.0, 0.0, 3.4028234663853e+38 --[[FLT_MAX]], "%.1f") ImGui.PopItemWidth() ImGui.PopID() PopStyleCompact() @@ -24386,11 +24420,11 @@ local function Tables_ColumnsFlags() local column_names = { "One", "Two", "Three" } local s = ST.colflags if s == nil then - s = { column_flags = { ImGuiTableColumnFlags.DefaultSort, ImGuiTableColumnFlags.None, ImGuiTableColumnFlags.DefaultHide }, column_flags_out = { 0, 0, 0 } } -- column_flags_out: Output from TableGetColumnFlags() + s = { column_flags = { 4 --[[ImGuiTableColumnFlags.DefaultSort]], 0 --[[ImGuiTableColumnFlags.None]], 2 --[[ImGuiTableColumnFlags.DefaultHide]] }, column_flags_out = { 0, 0, 0 } } -- column_flags_out: Output from TableGetColumnFlags() ST.colflags = s end - if ImGui.BeginTable("table_columns_flags_checkboxes", column_count, ImGuiTableFlags.None) then + if ImGui.BeginTable("table_columns_flags_checkboxes", column_count, 0 --[[ImGuiTableFlags.None]]) then PushStyleCompact() for column = 1, column_count do ImGui.TableNextColumn() @@ -24420,7 +24454,7 @@ local function Tables_ColumnsFlags() if ImGui.BeginTable("table_columns_flags", column_count, flags, outer_size) then local has_angled_header = false for column = 1, column_count do - has_angled_header = has_angled_header or Has(s.column_flags[column], ImGuiTableColumnFlags.AngledHeader) + has_angled_header = has_angled_header or Has(s.column_flags[column], 262144 --[[ImGuiTableColumnFlags.AngledHeader]]) ImGui.TableSetupColumn(column_names[column], s.column_flags[column]) end if has_angled_header then @@ -24526,12 +24560,12 @@ local function Tables_Nested() ImGui.TableSetupColumn("B1") ImGui.TableHeadersRow() - ImGui.TableNextRow(ImGuiTableRowFlags.None, rows_height) + ImGui.TableNextRow(0 --[[ImGuiTableRowFlags.None]], rows_height) ImGui.TableNextColumn() ImGui.Text("B0 Row 0") ImGui.TableNextColumn() ImGui.Text("B1 Row 0") - ImGui.TableNextRow(ImGuiTableRowFlags.None, rows_height) + ImGui.TableNextRow(0 --[[ImGuiTableRowFlags.None]], rows_height) ImGui.TableNextColumn() ImGui.Text("B0 Row 1") ImGui.TableNextColumn() @@ -24556,7 +24590,7 @@ local function Tables_RowHeight() if ImGui.BeginTable("table_row_height", 1, TF.Borders) then for row = 0, 7 do local min_row_height = math.floor(TEXT_BASE_HEIGHT * 0.30 * row + ImGui.GetStyle().CellPadding.y * 2.0) - ImGui.TableNextRow(ImGuiTableRowFlags.None, min_row_height) + ImGui.TableNextRow(0 --[[ImGuiTableRowFlags.None]], min_row_height) ImGui.TableNextColumn() ImGui.Text("min_row_height = %.2f", min_row_height) end @@ -24570,14 +24604,14 @@ local function Tables_RowHeight() if ImGui.BeginTable("table_share_lineheight", 2, TF.Borders) then ImGui.TableNextRow() ImGui.TableNextColumn() - ImGui.ColorButton("##1", ImVec4(0.13, 0.26, 0.40, 1.0), ImGuiColorEditFlags.None, ImVec2(40, 40)) + ImGui.ColorButton("##1", ImVec4(0.13, 0.26, 0.40, 1.0), 0 --[[ImGuiColorEditFlags.None]], ImVec2(40, 40)) ImGui.TableNextColumn() ImGui.Text("Line 1") ImGui.Text("Line 2") ImGui.TableNextRow() ImGui.TableNextColumn() - ImGui.ColorButton("##2", ImVec4(0.13, 0.26, 0.40, 1.0), ImGuiColorEditFlags.None, ImVec2(40, 40)) + ImGui.ColorButton("##2", ImVec4(0.13, 0.26, 0.40, 1.0), 0 --[[ImGuiColorEditFlags.None]], ImVec2(40, 40)) ImGui.TableNextColumn() ImGui.SameLine(0.0, 0.0) -- Reuse line height from previous column ImGui.Text("Line 1, with SameLine(0,0)") @@ -24591,9 +24625,9 @@ local function Tables_RowHeight() local style = ImGui.GetStyle() for row = 0, 7 do if (row % 3) == 2 then - ImGui.PushStyleVarY(ImGuiStyleVar.CellPadding, 20.0) + ImGui.PushStyleVarY(17 --[[ImGuiStyleVar.CellPadding]], 20.0) end - ImGui.TableNextRow(ImGuiTableRowFlags.None) + ImGui.TableNextRow(0 --[[ImGuiTableRowFlags.None]]) ImGui.TableNextColumn() ImGui.Text("CellPadding.y = %.2f", style.CellPadding.y) if (row % 3) == 2 then @@ -24675,9 +24709,9 @@ local function Tables_BackgroundColor() else NotPorted("Combo") end - IM_ASSERT(s.row_bg_type >= 0 and s.row_bg_type <= 2) - IM_ASSERT(s.row_bg_target >= 0 and s.row_bg_target <= 1) - IM_ASSERT(s.cell_bg_type >= 0 and s.cell_bg_type <= 1) + assert(s.row_bg_type >= 0 and s.row_bg_type <= 2) + assert(s.row_bg_target >= 0 and s.row_bg_target <= 1) + assert(s.cell_bg_type >= 0 and s.cell_bg_type <= 1) PopStyleCompact() if ImGui.BeginTable("table1", 5, s.flags) then @@ -24688,7 +24722,7 @@ local function Tables_BackgroundColor() -- We use a transparent color so we can see the one behind in case our target is RowBg1 and RowBg0 was already targeted by the ImGuiTableFlags_RowBg flag. if s.row_bg_type ~= 0 then local row_bg_color = ImGui.GetColorU32(s.row_bg_type == 1 and ImVec4(0.7, 0.3, 0.3, 0.65) or ImVec4(0.2 + row * 0.1, 0.2, 0.2, 0.65)) -- Flat or Gradient? - ImGui.TableSetBgColor(ImGuiTableBgTarget.RowBg0 + s.row_bg_target, row_bg_color) + ImGui.TableSetBgColor(1 --[[ImGuiTableBgTarget.RowBg0]] + s.row_bg_target, row_bg_color) end -- Fill cells @@ -24702,7 +24736,7 @@ local function Tables_BackgroundColor() -- We can also pass a column number as a third parameter to TableSetBgColor() and do this outside the column loop. if row >= 1 and row <= 2 and column >= 1 and column <= 2 and s.cell_bg_type == 1 then local cell_bg_color = ImGui.GetColorU32(ImVec4(0.3, 0.3, 0.7, 0.65)) - ImGui.TableSetBgColor(ImGuiTableBgTarget.CellBg, cell_bg_color) + ImGui.TableSetBgColor(3 --[[ImGuiTableBgTarget.CellBg]], cell_bg_color) end end end @@ -24730,12 +24764,12 @@ local function MyTreeNode_DisplayNode(node, all_nodes, tree_node_flags_base) local node_flags = tree_node_flags_base if node ~= all_nodes[1] then - node_flags = bit32.band(node_flags, bit32.bnot(ImGuiTreeNodeFlags.LabelSpanAllColumns)) -- Only demonstrate this on the root node. + node_flags = bit32.band(node_flags, bit32.bnot(32768 --[[ImGuiTreeNodeFlags.LabelSpanAllColumns]])) -- Only demonstrate this on the root node. end if is_folder then local open = ImGui.TreeNodeEx(node.Name, node_flags) - if bit32.band(node_flags, ImGuiTreeNodeFlags.LabelSpanAllColumns) == 0 then + if bit32.band(node_flags, 32768 --[[ImGuiTreeNodeFlags.LabelSpanAllColumns]]) == 0 then ImGui.TableNextColumn() ImGui.TextDisabled("--") ImGui.TableNextColumn() @@ -24748,7 +24782,7 @@ local function MyTreeNode_DisplayNode(node, all_nodes, tree_node_flags_base) ImGui.TreePop() end else - ImGui.TreeNodeEx(node.Name, bor(node_flags, ImGuiTreeNodeFlags.Leaf, ImGuiTreeNodeFlags.Bullet, ImGuiTreeNodeFlags.NoTreePushOnOpen)) + ImGui.TreeNodeEx(node.Name, bor(node_flags, 256 --[[ImGuiTreeNodeFlags.Leaf]], 512 --[[ImGuiTreeNodeFlags.Bullet]], 8 --[[ImGuiTreeNodeFlags.NoTreePushOnOpen]])) ImGui.TableNextColumn() ImGui.Text("%d", node.Size) ImGui.TableNextColumn() @@ -24761,21 +24795,21 @@ local function Tables_TreeView() local s = ST.treeview if s == nil then s = { table_flags = bor(TF.BordersV, TF.BordersOuterH, TF.Resizable, TF.RowBg, TF.NoBordersInBody), - tree_node_flags_base = bor(ImGuiTreeNodeFlags.SpanAllColumns, ImGuiTreeNodeFlags.DefaultOpen, ImGuiTreeNodeFlags.DrawLinesFull) } + tree_node_flags_base = bor(16384 --[[ImGuiTreeNodeFlags.SpanAllColumns]], 32 --[[ImGuiTreeNodeFlags.DefaultOpen]], 524288 --[[ImGuiTreeNodeFlags.DrawLinesFull]]) } ST.treeview = s end - _, s.tree_node_flags_base = ImGui.CheckboxFlags("ImGuiTreeNodeFlags_SpanFullWidth", s.tree_node_flags_base, ImGuiTreeNodeFlags.SpanFullWidth) - _, s.tree_node_flags_base = ImGui.CheckboxFlags("ImGuiTreeNodeFlags_SpanLabelWidth", s.tree_node_flags_base, ImGuiTreeNodeFlags.SpanLabelWidth) - _, s.tree_node_flags_base = ImGui.CheckboxFlags("ImGuiTreeNodeFlags_SpanAllColumns", s.tree_node_flags_base, ImGuiTreeNodeFlags.SpanAllColumns) - _, s.tree_node_flags_base = ImGui.CheckboxFlags("ImGuiTreeNodeFlags_LabelSpanAllColumns", s.tree_node_flags_base, ImGuiTreeNodeFlags.LabelSpanAllColumns) + _, s.tree_node_flags_base = ImGui.CheckboxFlags("ImGuiTreeNodeFlags_SpanFullWidth", s.tree_node_flags_base, 4096 --[[ImGuiTreeNodeFlags.SpanFullWidth]]) + _, s.tree_node_flags_base = ImGui.CheckboxFlags("ImGuiTreeNodeFlags_SpanLabelWidth", s.tree_node_flags_base, 8192 --[[ImGuiTreeNodeFlags.SpanLabelWidth]]) + _, s.tree_node_flags_base = ImGui.CheckboxFlags("ImGuiTreeNodeFlags_SpanAllColumns", s.tree_node_flags_base, 16384 --[[ImGuiTreeNodeFlags.SpanAllColumns]]) + _, s.tree_node_flags_base = ImGui.CheckboxFlags("ImGuiTreeNodeFlags_LabelSpanAllColumns", s.tree_node_flags_base, 32768 --[[ImGuiTreeNodeFlags.LabelSpanAllColumns]]) ImGui.SameLine(); DemoHelpMarker("Useful if you know that you aren't displaying contents in other columns") DemoHelpMarker("See \"Columns flags\" section to configure how indentation is applied to individual columns.") if ImGui.BeginTable("3ways", 3, s.table_flags) then -- The first column will use the default _WidthStretch when ScrollX is Off and _WidthFixed when ScrollX is On - ImGui.TableSetupColumn("Name", ImGuiTableColumnFlags.NoHide) - ImGui.TableSetupColumn("Size", ImGuiTableColumnFlags.WidthFixed, TEXT_BASE_WIDTH * 12.0) - ImGui.TableSetupColumn("Type", ImGuiTableColumnFlags.WidthFixed, TEXT_BASE_WIDTH * 18.0) + ImGui.TableSetupColumn("Name", 128 --[[ImGuiTableColumnFlags.NoHide]]) + ImGui.TableSetupColumn("Size", 16 --[[ImGuiTableColumnFlags.WidthFixed]], TEXT_BASE_WIDTH * 12.0) + ImGui.TableSetupColumn("Type", 16 --[[ImGuiTableColumnFlags.WidthFixed]], TEXT_BASE_WIDTH * 18.0) ImGui.TableHeadersRow() MyTreeNode_DisplayNode(tree_view_nodes[1], tree_view_nodes, s.tree_node_flags_base) @@ -24805,7 +24839,7 @@ local function Tables_ItemWidth() ImGui.TableSetColumnIndex(1) ImGui.PushItemWidth(-ImGui.GetContentRegionAvail().x * 0.5) ImGui.TableSetColumnIndex(2) - ImGui.PushItemWidth(-FLT_MIN) -- Right-aligned + ImGui.PushItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) -- Right-aligned end -- Draw our contents @@ -24841,12 +24875,12 @@ local function Tables_CustomHeaders() -- - Specify ImGuiTableColumnFlags_NoHeaderLabel in some TableSetupColumn() call. -- - Call TableHeadersRow() normally. This will submit TableHeader() with no name. -- - Then call TableSetColumnIndex() to position yourself in the column and submit your stuff e.g. Checkbox().) - ImGui.TableNextRow(ImGuiTableRowFlags.Headers) + ImGui.TableNextRow(1 --[[ImGuiTableRowFlags.Headers]]) for column = 0, COLUMNS_COUNT - 1 do ImGui.TableSetColumnIndex(column) local column_name = ImGui.TableGetColumnName(column) -- Retrieve name passed to TableSetupColumn() ImGui.PushID(column) - ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, ImVec2(0, 0)) + ImGui.PushStyleVar(11 --[[ImGuiStyleVar.FramePadding]], ImVec2(0, 0)) _, column_selected[column + 1] = ImGui.Checkbox("##checkall", column_selected[column + 1]) ImGui.PopStyleVar() ImGui.SameLine(0.0, ImGui.GetStyle().ItemInnerSpacing.x) @@ -24877,7 +24911,7 @@ local function Tables_AngledHeaders() local s = ST.angled if s == nil then s = { table_flags = bor(TF.SizingFixedFit, TF.ScrollX, TF.ScrollY, TF.BordersOuter, TF.BordersInnerH, TF.Hideable, TF.Resizable, TF.Reorderable, TF.HighlightHoveredColumn), - column_flags = bor(ImGuiTableColumnFlags.AngledHeader, ImGuiTableColumnFlags.WidthFixed), + column_flags = bor(262144 --[[ImGuiTableColumnFlags.AngledHeader]], 16 --[[ImGuiTableColumnFlags.WidthFixed]]), bools = {}, frozen_cols = 1, frozen_rows = 2 } -- bools: Dummy storage selection storage for i = 1, columns_count * rows_count do s.bools[i] = false end ST.angled = s @@ -24892,7 +24926,7 @@ local function Tables_AngledHeaders() s.frozen_cols = ImGui.SliderInt("Frozen columns", s.frozen_cols, 0, 2) ImGui.SetNextItemWidth(ImGui.GetFontSize() * 8) s.frozen_rows = ImGui.SliderInt("Frozen rows", s.frozen_rows, 0, 2) - _, s.column_flags = ImGui.CheckboxFlags("Disable header contributing to column width", s.column_flags, ImGuiTableColumnFlags.NoHeaderWidth) + _, s.column_flags = ImGui.CheckboxFlags("Disable header contributing to column width", s.column_flags, 8192 --[[ImGuiTableColumnFlags.NoHeaderWidth]]) if ImGui.TreeNode("Style settings") then ImGui.SameLine() @@ -24906,7 +24940,7 @@ local function Tables_AngledHeaders() end if ImGui.BeginTable("table_angled_headers", columns_count, s.table_flags, ImVec2(0.0, TEXT_BASE_HEIGHT * 12)) then - ImGui.TableSetupColumn(column_names[1], bor(ImGuiTableColumnFlags.NoHide, ImGuiTableColumnFlags.NoReorder)) + ImGui.TableSetupColumn(column_names[1], bor(128 --[[ImGuiTableColumnFlags.NoHide]], 64 --[[ImGuiTableColumnFlags.NoReorder]])) for n = 2, columns_count do ImGui.TableSetupColumn(column_names[n], s.column_flags) end @@ -25014,7 +25048,7 @@ local function Tables_ContextMenus() local hovered_column = -1 for column = 0, COLUMNS_COUNT do ImGui.PushID(column) - if Has(ImGui.TableGetColumnFlags(column), ImGuiTableColumnFlags.IsHovered) then + if Has(ImGui.TableGetColumnFlags(column), 134217728 --[[ImGuiTableColumnFlags.IsHovered]]) then hovered_column = column end if hovered_column == column and not ImGui.IsAnyItemHovered() and ImGui.IsMouseReleased(1) then @@ -25052,7 +25086,7 @@ local function Tables_SyncedInstances() _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_HighlightHoveredColumn", s.flags, TF.HighlightHoveredColumn) for n = 0, 2 do local buf = string.format("Synced Table %d", n) - local open = ImGui.CollapsingHeader(buf, ImGuiTreeNodeFlags.DefaultOpen) + local open = ImGui.CollapsingHeader(buf, 32 --[[ImGuiTreeNodeFlags.DefaultOpen]]) if open and ImGui.BeginTable("Table", 3, s.flags, ImVec2(0.0, ImGui.GetTextLineHeightWithSpacing() * 5)) then ImGui.TableSetupColumn("One") ImGui.TableSetupColumn("Two") @@ -25151,7 +25185,7 @@ local function Tables_AdvancedOptions(s) PushStyleCompact() ImGui.PushItemWidth(TEXT_BASE_WIDTH * 28.0) - if ImGui.TreeNodeEx("Features:", ImGuiTreeNodeFlags.DefaultOpen) then + if ImGui.TreeNodeEx("Features:", 32 --[[ImGuiTreeNodeFlags.DefaultOpen]]) then _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_Resizable", s.flags, TF.Resizable) _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_Reorderable", s.flags, TF.Reorderable) _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_Hideable", s.flags, TF.Hideable) @@ -25161,7 +25195,7 @@ local function Tables_AdvancedOptions(s) ImGui.TreePop() end - if ImGui.TreeNodeEx("Decorations:", ImGuiTreeNodeFlags.DefaultOpen) then + if ImGui.TreeNodeEx("Decorations:", 32 --[[ImGuiTreeNodeFlags.DefaultOpen]]) then _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_RowBg", s.flags, TF.RowBg) _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_BordersV", s.flags, TF.BordersV) _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_BordersOuterV", s.flags, TF.BordersOuterV) @@ -25174,7 +25208,7 @@ local function Tables_AdvancedOptions(s) ImGui.TreePop() end - if ImGui.TreeNodeEx("Sizing:", ImGuiTreeNodeFlags.DefaultOpen) then + if ImGui.TreeNodeEx("Sizing:", 32 --[[ImGuiTreeNodeFlags.DefaultOpen]]) then s.flags = EditTableSizingFlags(s.flags) ImGui.SameLine(); DemoHelpMarker("In the Advanced demo we override the policy of each column so those table-wide settings have less effect that typical.") _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_NoHostExtendX", s.flags, TF.NoHostExtendX) @@ -25190,26 +25224,26 @@ local function Tables_AdvancedOptions(s) ImGui.TreePop() end - if ImGui.TreeNodeEx("Padding:", ImGuiTreeNodeFlags.DefaultOpen) then + if ImGui.TreeNodeEx("Padding:", 32 --[[ImGuiTreeNodeFlags.DefaultOpen]]) then _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_PadOuterX", s.flags, TF.PadOuterX) _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_NoPadOuterX", s.flags, TF.NoPadOuterX) _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_NoPadInnerX", s.flags, TF.NoPadInnerX) ImGui.TreePop() end - if ImGui.TreeNodeEx("Scrolling:", ImGuiTreeNodeFlags.DefaultOpen) then + if ImGui.TreeNodeEx("Scrolling:", 32 --[[ImGuiTreeNodeFlags.DefaultOpen]]) then _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_ScrollX", s.flags, TF.ScrollX) ImGui.SameLine() ImGui.SetNextItemWidth(ImGui.GetFrameHeight()) - s.freeze_cols = ImGui.DragInt("freeze_cols", s.freeze_cols, 0.2, 0, 9, nil, ImGuiSliderFlags.NoInput) + s.freeze_cols = ImGui.DragInt("freeze_cols", s.freeze_cols, 0.2, 0, 9, nil, 128 --[[ImGuiSliderFlags.NoInput]]) _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_ScrollY", s.flags, TF.ScrollY) ImGui.SameLine() ImGui.SetNextItemWidth(ImGui.GetFrameHeight()) - s.freeze_rows = ImGui.DragInt("freeze_rows", s.freeze_rows, 0.2, 0, 9, nil, ImGuiSliderFlags.NoInput) + s.freeze_rows = ImGui.DragInt("freeze_rows", s.freeze_rows, 0.2, 0, 9, nil, 128 --[[ImGuiSliderFlags.NoInput]]) ImGui.TreePop() end - if ImGui.TreeNodeEx("Sorting:", ImGuiTreeNodeFlags.DefaultOpen) then + if ImGui.TreeNodeEx("Sorting:", 32 --[[ImGuiTreeNodeFlags.DefaultOpen]]) then _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_SortMulti", s.flags, TF.SortMulti) ImGui.SameLine(); DemoHelpMarker("When sorting is enabled: hold shift when clicking headers to sort on multiple column. TableGetSortSpecs() may return specs where (SpecsCount > 1).") _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_SortTristate", s.flags, TF.SortTristate) @@ -25217,15 +25251,15 @@ local function Tables_AdvancedOptions(s) ImGui.TreePop() end - if ImGui.TreeNodeEx("Headers:", ImGuiTreeNodeFlags.DefaultOpen) then + if ImGui.TreeNodeEx("Headers:", 32 --[[ImGuiTreeNodeFlags.DefaultOpen]]) then _, s.show_headers = ImGui.Checkbox("show_headers", s.show_headers) _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_HighlightHoveredColumn", s.flags, TF.HighlightHoveredColumn) - _, s.columns_base_flags = ImGui.CheckboxFlags("ImGuiTableColumnFlags_AngledHeader", s.columns_base_flags, ImGuiTableColumnFlags.AngledHeader) + _, s.columns_base_flags = ImGui.CheckboxFlags("ImGuiTableColumnFlags_AngledHeader", s.columns_base_flags, 262144 --[[ImGuiTableColumnFlags.AngledHeader]]) ImGui.SameLine(); DemoHelpMarker("Enable AngledHeader on all columns. Best enabled on selected narrow columns (see \"Angled headers\" section of the demo).") ImGui.TreePop() end - if ImGui.TreeNodeEx("Other:", ImGuiTreeNodeFlags.DefaultOpen) then + if ImGui.TreeNodeEx("Other:", 32 --[[ImGuiTreeNodeFlags.DefaultOpen]]) then _, s.show_wrapped_text = ImGui.Checkbox("show_wrapped_text", s.show_wrapped_text) ImGui.DragFloat2("##OuterSize", s.outer_size_value) @@ -25240,9 +25274,9 @@ local function Tables_AdvancedOptions(s) -- From a user point of view we will tend to use 'inner_width' differently depending on whether our table is embedding scrolling. -- To facilitate toying with this demo we will actually pass 0.0f to the BeginTable() when ScrollX is disabled. - s.inner_width_with_scroll = ImGui.DragFloat("inner_width (when ScrollX active)", s.inner_width_with_scroll, 1.0, 0.0, FLT_MAX) + s.inner_width_with_scroll = ImGui.DragFloat("inner_width (when ScrollX active)", s.inner_width_with_scroll, 1.0, 0.0, 3.4028234663853e+38 --[[FLT_MAX]]) - s.row_min_height = ImGui.DragFloat("row_min_height", s.row_min_height, 1.0, 0.0, FLT_MAX) + s.row_min_height = ImGui.DragFloat("row_min_height", s.row_min_height, 1.0, 0.0, 3.4028234663853e+38 --[[FLT_MAX]]) ImGui.SameLine(); DemoHelpMarker("Specify height of the Selectable item.") s.items_count = ImGui.DragInt("items_count", s.items_count, 0.1, 0, 9999) @@ -25269,7 +25303,7 @@ local function Tables_Advanced() local s = ST.advanced if s == nil then s = { flags = bor(TF.Resizable, TF.Reorderable, TF.Hideable, TF.Sortable, TF.SortMulti, TF.RowBg, TF.Borders, TF.NoBordersInBody, TF.ScrollX, TF.ScrollY, TF.SizingFixedFit), - columns_base_flags = ImGuiTableColumnFlags.None, contents_type = CT_SelectableSpanRow, + columns_base_flags = 0 --[[ImGuiTableColumnFlags.None]], contents_type = CT_SelectableSpanRow, freeze_cols = 1, freeze_rows = 1, items_count = #template_items_names * 2, outer_size_value = ImVec2(0.0, TEXT_BASE_HEIGHT * 12), row_min_height = 0.0, inner_width_with_scroll = 0.0, outer_size_enabled = true, show_headers = true, show_wrapped_text = false, @@ -25349,7 +25383,7 @@ local function Tables_Advanced() local item_is_selected = table.find(selection, item.ID) ~= nil ImGui.PushID(item.ID) - ImGui.TableNextRow(ImGuiTableRowFlags.None, s.row_min_height) + ImGui.TableNextRow(0 --[[ImGuiTableRowFlags.None]], s.row_min_height) -- For the demo purpose we can select among different type of items submitted in the first column ImGui.TableSetColumnIndex(0) @@ -25362,9 +25396,9 @@ local function Tables_Advanced() elseif ct == CT_SmallButton then ImGui.SmallButton(label) elseif ct == CT_FillButton then - ImGui.Button(label, ImVec2(-FLT_MIN, 0.0)) + ImGui.Button(label, ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], 0.0)) elseif ct == CT_Selectable or ct == CT_SelectableSpanRow then - local selectable_flags = (ct == CT_SelectableSpanRow) and bor(ImGuiSelectableFlags.SpanAllColumns, ImGuiSelectableFlags.AllowOverlap) or ImGuiSelectableFlags.None + local selectable_flags = (ct == CT_SelectableSpanRow) and bor(2 --[[ImGuiSelectableFlags.SpanAllColumns]], 16 --[[ImGuiSelectableFlags.AllowOverlap]]) or 0 --[[ImGuiSelectableFlags.None]] if ImGui.Selectable(label, item_is_selected, selectable_flags, ImVec2(0, s.row_min_height)) then if ImGui.GetIO().KeyCtrl then if item_is_selected then @@ -25473,7 +25507,7 @@ local function DemoWindowColumns() local paths = { "/path/one", "/path/two", "/path/three" } for i = 0, 2 do local label = string.format("%04d", i) - if ImGui.Selectable(label, DCS.selected == i, ImGuiSelectableFlags.SpanAllColumns) then + if ImGui.Selectable(label, DCS.selected == i, 2 --[[ImGuiSelectableFlags.SpanAllColumns]]) then DCS.selected = i end local hovered = ImGui.IsItemHovered() @@ -25512,7 +25546,7 @@ local function DemoWindowColumns() ImGui.Text("Avail %.2f", ImGui.GetContentRegionAvail().x) ImGui.Text("Offset %.2f", ImGui.GetColumnOffset()) ImGui.Text("Long text that is likely to clip") - ImGui.Button("Button", ImVec2(-FLT_MIN, 0.0)) + ImGui.Button("Button", ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], 0.0)) ImGui.PopID() ImGui.NextColumn() end @@ -25571,7 +25605,7 @@ local function DemoWindowColumns() IMGUI_DEMO_MARKER("Columns (legacy API)/Horizontal Scrolling") ImGui.SetNextWindowContentSize(ImVec2(1500.0, 0.0)) local child_size = ImVec2(0, ImGui.GetFontSize() * 20.0) - ImGui.BeginChild("##ScrollingRegion", child_size, ImGuiChildFlags.None, ImGuiWindowFlags.HorizontalScrollbar) + ImGui.BeginChild("##ScrollingRegion", child_size, 0 --[[ImGuiChildFlags.None]], 2048 --[[ImGuiWindowFlags.HorizontalScrollbar]]) ImGui.Columns(10) -- Also demonstrate using clipper for large vertical lists @@ -25682,7 +25716,7 @@ function DemoWindowTables() ImGui.Separator() local disable_indent = ST.disable_indent if disable_indent then - ImGui.PushStyleVar(ImGuiStyleVar.IndentSpacing, 0.0) + ImGui.PushStyleVar(16 --[[ImGuiStyleVar.IndentSpacing]], 0.0) end -- About Styling of tables @@ -25774,7 +25808,7 @@ local function ConsoleNew() end function c:TextEditCallback(data) --self:AddLog("cursor: %d, selection: %d-%d", data.CursorPos, data.SelectionStart, data.SelectionEnd) - if data.EventFlag == ImGuiInputTextFlags.CallbackCompletion then + if data.EventFlag == 262144 --[[ImGuiInputTextFlags.CallbackCompletion]] then -- Example of TEXT COMPLETION -- Locate beginning of current word (positions are 0-based offsets into data.Buf) @@ -25823,13 +25857,13 @@ local function ConsoleNew() self:AddLog("Possible matches:\n") for i = 1, #candidates do self:AddLog("- %s\n", candidates[i]) end end - elseif data.EventFlag == ImGuiInputTextFlags.CallbackHistory then + elseif data.EventFlag == 524288 --[[ImGuiInputTextFlags.CallbackHistory]] then -- Example of HISTORY local prev_history_pos = self.HistoryPos - if data.EventKey == ImGuiKey.UpArrow then + if data.EventKey == 515 --[[ImGuiKey.UpArrow]] then if self.HistoryPos == -1 then self.HistoryPos = #self.History - 1 elseif self.HistoryPos > 0 then self.HistoryPos = self.HistoryPos - 1 end - elseif data.EventKey == ImGuiKey.DownArrow then + elseif data.EventKey == 516 --[[ImGuiKey.DownArrow]] then if self.HistoryPos ~= -1 then self.HistoryPos = self.HistoryPos + 1 if self.HistoryPos >= #self.History then self.HistoryPos = -1 end @@ -25846,7 +25880,7 @@ local function ConsoleNew() return 0 end function c:Draw(title, p_open) - ImGui.SetNextWindowSize(ImVec2(520, 600), ImGuiCond.FirstUseEver) + ImGui.SetNextWindowSize(ImVec2(520, 600), 4 --[[ImGuiCond.FirstUseEver]]) local visible p_open, visible = ImGui.Begin(title, p_open) if not visible then ImGui.End(); return p_open end @@ -25881,18 +25915,18 @@ local function ConsoleNew() end -- Options, Filter - ImGui.SetNextItemShortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.O), ImGuiInputFlags.Tooltip) + ImGui.SetNextItemShortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 560 --[[ImGuiKey.O]]), 262144 --[[ImGuiInputFlags.Tooltip]]) if ImGui.Button("Options") then ImGui.OpenPopup("Options") end ImGui.SameLine() - ImGui.SetNextItemShortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.F), ImGuiInputFlags.Tooltip) - ImGui.SetNextItemWidth(-FLT_MIN) + ImGui.SetNextItemShortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 551 --[[ImGuiKey.F]]), 262144 --[[ImGuiInputFlags.Tooltip]]) + ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) self.Filter:DrawWithHint("##Filter", "Filter (incl -excl)") ImGui.Separator() -- Reserve enough left-over height for 1 separator + 1 input text local style = ImGui.GetStyle() local footer_height_to_reserve = (style.SeparatorSize or 1.0) + style.ItemSpacing.y + ImGui.GetFrameHeightWithSpacing() - if ImGui.BeginChild("ScrollingRegion", ImVec2(0, -footer_height_to_reserve), ImGuiChildFlags.NavFlattened, ImGuiWindowFlags.HorizontalScrollbar) then + if ImGui.BeginChild("ScrollingRegion", ImVec2(0, -footer_height_to_reserve), 256 --[[ImGuiChildFlags.NavFlattened]], 2048 --[[ImGuiWindowFlags.HorizontalScrollbar]]) then if ImGui.BeginPopupContextWindow() then if ImGui.Selectable("Clear") then self:ClearLog() end ImGui.EndPopup() @@ -25922,7 +25956,7 @@ local function ConsoleNew() -- If your items are of variable height: -- - Split them into same height items would be simpler and facilitate random-seeking into your list. -- - Consider using manual call to IsRectVisible() and skipping extraneous decoration from your items. - ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, ImVec2(4, 1)) -- Tighten spacing + ImGui.PushStyleVar(14 --[[ImGuiStyleVar.ItemSpacing]], ImVec2(4, 1)) -- Tighten spacing if copy_to_clipboard then ImGui.LogToClipboard() end for _, item in ipairs(self.Items) do if self.Filter:PassFilter(item) then @@ -25931,7 +25965,7 @@ local function ConsoleNew() local color if string.find(item, "[error]", 1, true) then color = ImVec4(1.0, 0.4, 0.4, 1.0) elseif string.sub(item, 1, 2) == "# " then color = ImVec4(1.0, 0.8, 0.6, 1.0) end - if color then ImGui.PushStyleColor(ImGuiCol.Text, color) end + if color then ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], color) end ImGui.TextUnformatted(item) if color then ImGui.PopStyleColor() end end @@ -26012,13 +26046,13 @@ local function ExampleAppLog() ImGui.SameLine() local copy = ImGui.Button("Copy") ImGui.SameLine() - ImGui.SetNextItemWidth(-FLT_MIN) + ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) self.Filter:DrawWithHint("##Filter", "Filter (incl -excl)") ImGui.Separator() - if ImGui.BeginChild("scrolling", ImVec2(0, 0), ImGuiChildFlags.None, ImGuiWindowFlags.HorizontalScrollbar) then + if ImGui.BeginChild("scrolling", ImVec2(0, 0), 0 --[[ImGuiChildFlags.None]], 2048 --[[ImGuiWindowFlags.HorizontalScrollbar]]) then if clear then self:Clear() end if copy then ImGui.LogToClipboard() end - ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, ImVec2(0, 0)) + ImGui.PushStyleVar(14 --[[ImGuiStyleVar.ItemSpacing]], ImVec2(0, 0)) local lines = self.Lines if self.Filter:IsActive() then -- In this example we don't use the clipper when Filter is enabled. @@ -26071,7 +26105,7 @@ function ShowExampleAppLog(p_open) -- For the demo: add a debug button _BEFORE_ the normal log window contents -- We take advantage of a rarely used feature: multiple calls to Begin()/End() are appending to the _same_ window. -- Most of the contents of the window will be added by the log:Draw() call. - ImGui.SetNextWindowSize(ImVec2(500, 400), ImGuiCond.FirstUseEver) + ImGui.SetNextWindowSize(ImVec2(500, 400), 4 --[[ImGuiCond.FirstUseEver]]) p_open = ImGui.Begin("Example: Log", p_open) if ImGui.SmallButton("[Debug] Add 5 entries") then local categories = { "info", "warn", "error" } @@ -26096,9 +26130,9 @@ end -- Demonstrate create a window with multiple child windows. local LayoutSelected = 0 function ShowExampleAppLayout(p_open) - ImGui.SetNextWindowSize(ImVec2(500, 440), ImGuiCond.FirstUseEver) + ImGui.SetNextWindowSize(ImVec2(500, 440), 4 --[[ImGuiCond.FirstUseEver]]) local visible - p_open, visible = ImGui.Begin("Example: Simple layout", p_open, ImGuiWindowFlags.MenuBar) + p_open, visible = ImGui.Begin("Example: Simple layout", p_open, 1024 --[[ImGuiWindowFlags.MenuBar]]) if visible then if ImGui.BeginMenuBar() then if ImGui.BeginMenu("File") then @@ -26109,9 +26143,9 @@ function ShowExampleAppLayout(p_open) end -- Left - ImGui.BeginChild("left pane", ImVec2(150, 0), bit32.bor(ImGuiChildFlags.Borders, ImGuiChildFlags.ResizeX)) + ImGui.BeginChild("left pane", ImVec2(150, 0), bit32.bor(1 --[[ImGuiChildFlags.Borders]], 4 --[[ImGuiChildFlags.ResizeX]])) for i = 0, 99 do - if ImGui.Selectable(string.format("MyObject %d", i), LayoutSelected == i, ImGuiSelectableFlags.SelectOnNav) then LayoutSelected = i end + if ImGui.Selectable(string.format("MyObject %d", i), LayoutSelected == i, 64 --[[ImGuiSelectableFlags.SelectOnNav]]) then LayoutSelected = i end end ImGui.EndChild() ImGui.SameLine() @@ -26121,7 +26155,7 @@ function ShowExampleAppLayout(p_open) ImGui.BeginChild("item view", ImVec2(0, -ImGui.GetFrameHeightWithSpacing())) -- Leave room for 1 line below us ImGui.Text("MyObject: %d", LayoutSelected) ImGui.Separator() - if ImGui.BeginTabBar("##Tabs", ImGuiTabBarFlags.None) then + if ImGui.BeginTabBar("##Tabs", 0 --[[ImGuiTabBarFlags.None]]) then if ImGui.BeginTabItem("Description") then ImGui.TextWrapped("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ") ImGui.EndTabItem() @@ -26183,7 +26217,7 @@ function PropEd:DrawTreeNode(node) local tree_flags = bit32.bor(TN.OpenOnArrow, TN.OpenOnDoubleClick, TN.NavLeftJumpsToParent, TN.SpanFullWidth, TN.DrawLinesToNodes) if node == self.SelectedNode then tree_flags = bit32.bor(tree_flags, TN.Selected) end -- Draw selection highlight if #node.Childs == 0 then tree_flags = bit32.bor(tree_flags, TN.Leaf, TN.Bullet, TN.NoTreePushOnOpen) end -- Use _NoTreePushOnOpen + set is_open=false to avoid unnecessarily push/pop on leaves. - if node.DataMyBool == false then ImGui.PushStyleColor(ImGuiCol.Text, ImGui.GetStyle().Colors[ImGuiCol.TextDisabled]) end + if node.DataMyBool == false then ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], ImGui.GetStyle().Colors[1 --[[ImGuiCol.TextDisabled]]]) end ImGui.SetNextItemStorageID(node.UID) -- Use node.UID as storage id local is_open = ImGui.TreeNodeEx(node.UID, tree_flags, "%s", node.Name) if #node.Childs == 0 then is_open = false end @@ -26246,7 +26280,7 @@ end function PropEd:DrawClippedTree(root_node) local node = root_node.Childs[1] -- First node local clipper = ImGuiListClipper() - clipper:Begin(INT_MAX) + clipper:Begin(2147483647 --[[INT_MAX]]) while clipper:Step() do while clipper.UserIndex < clipper.DisplayEnd and node ~= nil do node = self:DrawClippedTreeNodeAndAdvanceToNext(clipper, node) @@ -26269,18 +26303,18 @@ function PropEd:Draw(root_node) -- Left side: draw tree -- - Currently using a table to benefit from RowBg feature -- - Our tree node are all of equal height, facilitating the use of a clipper. - if ImGui.BeginChild("##tree", ImVec2(300, 0), bit32.bor(ImGuiChildFlags.ResizeX, ImGuiChildFlags.Borders, ImGuiChildFlags.NavFlattened)) then - ImGui.PushItemFlag(ImGuiItemFlags.NoNavDefaultFocus, true) + if ImGui.BeginChild("##tree", ImVec2(300, 0), bit32.bor(4 --[[ImGuiChildFlags.ResizeX]], 1 --[[ImGuiChildFlags.Borders]], 256 --[[ImGuiChildFlags.NavFlattened]])) then + ImGui.PushItemFlag(4 --[[ImGuiItemFlags.NoNavDefaultFocus]], true) _, self.UseClipper = ImGui.Checkbox("Use Clipper", self.UseClipper) ImGui.SameLine() ImGui.Text("(%d root nodes)", #root_node.Childs) - ImGui.SetNextItemWidth(-FLT_MIN) - ImGui.SetNextItemShortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.F), ImGuiInputFlags.Tooltip) - if ImGui.InputTextWithHint("##Filter", "incl -excl", self.Filter.InputBuf, 256, ImGuiInputTextFlags.EscapeClearsAll) then + ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) + ImGui.SetNextItemShortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 551 --[[ImGuiKey.F]]), 262144 --[[ImGuiInputFlags.Tooltip]]) + if ImGui.InputTextWithHint("##Filter", "incl -excl", self.Filter.InputBuf, 256, 128 --[[ImGuiInputTextFlags.EscapeClearsAll]]) then self.Filter:Build() end ImGui.PopItemFlag() - if ImGui.BeginTable("##list", 1, ImGuiTableFlags.RowBg) then + if ImGui.BeginTable("##list", 1, 64 --[[ImGuiTableFlags.RowBg]]) then if self.UseClipper then self:DrawClippedTree(root_node) else self:DrawTree(root_node) end ImGui.EndTable() end @@ -26296,11 +26330,11 @@ function PropEd:Draw(root_node) ImGui.Text("%s", node.Name) ImGui.TextDisabled("UID: 0x%08X", node.UID) ImGui.Separator() - if ImGui.BeginTable("##properties", 2, bit32.bor(ImGuiTableFlags.Resizable, ImGuiTableFlags.ScrollY)) then + if ImGui.BeginTable("##properties", 2, bit32.bor(1 --[[ImGuiTableFlags.Resizable]], 33554432 --[[ImGuiTableFlags.ScrollY]])) then -- Push object ID after we entered the table, so table is shared for all objects ImGui.PushID(node.UID) - ImGui.TableSetupColumn("", ImGuiTableColumnFlags.WidthFixed) - ImGui.TableSetupColumn("", ImGuiTableColumnFlags.WidthStretch, 2.0) -- Default twice larger + ImGui.TableSetupColumn("", 16 --[[ImGuiTableColumnFlags.WidthFixed]]) + ImGui.TableSetupColumn("", 8 --[[ImGuiTableColumnFlags.WidthStretch]], 2.0) -- Default twice larger if node.HasData then -- In a typical application, the structure description would be derived from a data-driven system. -- - We try to mimic this with our ExampleMemberInfo structure and the ExampleTreeNodeMemberInfos[] array. @@ -26316,10 +26350,10 @@ function PropEd:Draw(root_node) if field_desc.DataType == DT.Bool then _, node[field_desc.Field] = ImGui.Checkbox("##Editor", node[field_desc.Field]) elseif field_desc.DataType == DT.S32 then - ImGui.SetNextItemWidth(-FLT_MIN) - node[field_desc.Field] = ImGui.DragScalar("##Editor", DT.S32, node[field_desc.Field], 1.0, INT_MIN or -2147483648, INT_MAX) + ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) + node[field_desc.Field] = ImGui.DragScalar("##Editor", DT.S32, node[field_desc.Field], 1.0, (-2147483648) --[[INT_MIN]] or -2147483648, 2147483647 --[[INT_MAX]]) elseif field_desc.DataType == DT.Float then - ImGui.SetNextItemWidth(-FLT_MIN) + ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) ImGui.SliderScalarN("##Editor", DT.Float, node[field_desc.Field], field_desc.DataCount, 0.0, 1.0) elseif field_desc.DataType == DT.String then local b = self.NameBufs[node] @@ -26339,7 +26373,7 @@ end -- Demonstrate creating a simple property editor. local DemoTree = nil function ShowExampleAppPropertyEditor(p_open, demo_data) - ImGui.SetNextWindowSize(ImVec2(430, 450), ImGuiCond.FirstUseEver) + ImGui.SetNextWindowSize(ImVec2(430, 450), 4 --[[ImGuiCond.FirstUseEver]]) local visible p_open, visible = ImGui.Begin("Example: Property editor", p_open) if not visible then ImGui.End(); return p_open end @@ -26357,7 +26391,7 @@ end -- Demonstrate/test rendering huge amount of text, and the incidence of clipping. local LT = { test_type = 0, log = {}, lines = 0, bytes = 0 } function ShowExampleAppLongText(p_open) - ImGui.SetNextWindowSize(ImVec2(520, 600), ImGuiCond.FirstUseEver) + ImGui.SetNextWindowSize(ImVec2(520, 600), 4 --[[ImGuiCond.FirstUseEver]]) local visible p_open, visible = ImGui.Begin("Example: Long text display", p_open) if not visible then ImGui.End(); return p_open end @@ -26382,7 +26416,7 @@ function ShowExampleAppLongText(p_open) ImGui.TextUnformatted(LT.text) elseif LT.test_type == 1 then -- Multiple calls to Text(), manually coarsely clipped - demonstrate how to use the ImGuiListClipper helper. - ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, ImVec2(0, 0)) + ImGui.PushStyleVar(14 --[[ImGuiStyleVar.ItemSpacing]], ImVec2(0, 0)) local clipper = ImGuiListClipper() clipper:Begin(LT.lines) while clipper:Step() do @@ -26391,7 +26425,7 @@ function ShowExampleAppLongText(p_open) ImGui.PopStyleVar() else -- Multiple calls to Text(), not clipped (slow) - ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, ImVec2(0, 0)) + ImGui.PushStyleVar(14 --[[ImGuiStyleVar.ItemSpacing]], ImVec2(0, 0)) for i = 0, LT.lines - 1 do ImGui.Text("%i The quick brown fox jumps over the lazy dog", i) end ImGui.PopStyleVar() end @@ -26408,7 +26442,7 @@ end local AutoResizeLines = 10 function ShowExampleAppAutoResize(p_open) local visible - p_open, visible = ImGui.Begin("Example: Auto-resizing window", p_open, ImGuiWindowFlags.AlwaysAutoResize) + p_open, visible = ImGui.Begin("Example: Auto-resizing window", p_open, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) if not visible then ImGui.End(); return p_open end ImGui.TextUnformatted("Window will resize every-frame to the size of its content.\nNote that you probably don't want to query the window size to\noutput your content because that would create a feedback loop.") AutoResizeLines = ImGui.SliderInt("Number of lines", AutoResizeLines, 1, 20) @@ -26440,18 +26474,18 @@ function ShowExampleAppConstrainedResize(p_open) -- Submit constraint local t = CR.type if t == 0 then ImGui.SetNextWindowSizeConstraints(ImVec2(100, 100), ImVec2(500, 500)) end -- Between 100x100 and 500x500 - if t == 1 then ImGui.SetNextWindowSizeConstraints(ImVec2(100, 100), ImVec2(FLT_MAX, FLT_MAX)) end -- Width > 100, Height > 100 - if t == 2 then ImGui.SetNextWindowSizeConstraints(ImVec2(-1, 0), ImVec2(-1, FLT_MAX)) end -- Resize vertical + lock current width - if t == 3 then ImGui.SetNextWindowSizeConstraints(ImVec2(0, -1), ImVec2(FLT_MAX, -1)) end -- Resize horizontal + lock current height + if t == 1 then ImGui.SetNextWindowSizeConstraints(ImVec2(100, 100), ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]])) end -- Width > 100, Height > 100 + if t == 2 then ImGui.SetNextWindowSizeConstraints(ImVec2(-1, 0), ImVec2(-1, 3.4028234663853e+38 --[[FLT_MAX]])) end -- Resize vertical + lock current width + if t == 3 then ImGui.SetNextWindowSizeConstraints(ImVec2(0, -1), ImVec2(3.4028234663853e+38 --[[FLT_MAX]], -1)) end -- Resize horizontal + lock current height if t == 4 then ImGui.SetNextWindowSizeConstraints(ImVec2(400, -1), ImVec2(500, -1)) end -- Width Between and 400 and 500 - if t == 5 then ImGui.SetNextWindowSizeConstraints(ImVec2(-1, 400), ImVec2(-1, FLT_MAX)) end -- Height at least 400 - if t == 6 then ImGui.SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), AspectRatio, 16.0 / 9.0) end -- Aspect ratio - if t == 7 then ImGui.SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), Square) end -- Always Square - if t == 8 then ImGui.SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), Step, 100.0) end -- Fixed Step + if t == 5 then ImGui.SetNextWindowSizeConstraints(ImVec2(-1, 400), ImVec2(-1, 3.4028234663853e+38 --[[FLT_MAX]])) end -- Height at least 400 + if t == 6 then ImGui.SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]), AspectRatio, 16.0 / 9.0) end -- Aspect ratio + if t == 7 then ImGui.SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]), Square) end -- Always Square + if t == 8 then ImGui.SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]), Step, 100.0) end -- Fixed Step -- Submit window - if not CR.window_padding then ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, ImVec2(0.0, 0.0)) end - local window_flags = CR.auto_resize and ImGuiWindowFlags.AlwaysAutoResize or 0 + if not CR.window_padding then ImGui.PushStyleVar(2 --[[ImGuiStyleVar.WindowPadding]], ImVec2(0.0, 0.0)) end + local window_flags = CR.auto_resize and 64 --[[ImGuiWindowFlags.AlwaysAutoResize]] or 0 local window_open p_open, window_open = ImGui.Begin("Example: Constrained Resize", p_open, window_flags) if not CR.window_padding then ImGui.PopStyleVar() end @@ -26460,7 +26494,7 @@ function ShowExampleAppConstrainedResize(p_open) -- Display a dummy viewport (in your real app you would likely use ImageButton() to display a texture) local avail_size = ImGui.GetContentRegionAvail() local pos = ImGui.GetCursorScreenPos() - ImGui.ColorButton("viewport", ImVec4(0.5, 0.2, 0.5, 1.0), bit32.bor(ImGuiColorEditFlags.NoTooltip, ImGuiColorEditFlags.NoDragDrop), avail_size) + ImGui.ColorButton("viewport", ImVec4(0.5, 0.2, 0.5, 1.0), bit32.bor(64 --[[ImGuiColorEditFlags.NoTooltip]], 512 --[[ImGuiColorEditFlags.NoDragDrop]]), avail_size) ImGui.SetCursorScreenPos(ImVec2(pos.x + 10, pos.y + 10)) ImGui.Text("%.2f x %.2f", avail_size.x, avail_size.y) else @@ -26500,12 +26534,12 @@ function ShowExampleAppSimpleOverlay(p_open) local right, bottom = OverlayLocation % 2 == 1, OverlayLocation >= 2 local window_pos = ImVec2(right and (work_pos.x + work_size.x - PAD) or (work_pos.x + PAD), bottom and (work_pos.y + work_size.y - PAD) or (work_pos.y + PAD)) local window_pos_pivot = ImVec2(right and 1.0 or 0.0, bottom and 1.0 or 0.0) - ImGui.SetNextWindowPos(window_pos, ImGuiCond.Always, window_pos_pivot) + ImGui.SetNextWindowPos(window_pos, 1 --[[ImGuiCond.Always]], window_pos_pivot) ImGui.SetNextWindowViewport(viewport.ID) window_flags = bit32.bor(window_flags, W.NoMove) elseif OverlayLocation == -2 then -- Center window - ImGui.SetNextWindowPos(ImGui.GetMainViewport():GetCenter(), ImGuiCond.Always, ImVec2(0.5, 0.5)) + ImGui.SetNextWindowPos(ImGui.GetMainViewport():GetCenter(), 1 --[[ImGuiCond.Always]], ImVec2(0.5, 0.5)) window_flags = bit32.bor(window_flags, W.NoMove) end ImGui.SetNextWindowBgAlpha(0.35) -- Transparent background @@ -26577,11 +26611,11 @@ function ShowExampleAppWindowTitles(p_open) -- You can use the "##" and "###" markers to manipulate the display/ID. -- Using "##" to display same title but have unique identifier. - ImGui.SetNextWindowPos(ImVec2(base_pos.x + 100, base_pos.y + 100), ImGuiCond.FirstUseEver) + ImGui.SetNextWindowPos(ImVec2(base_pos.x + 100, base_pos.y + 100), 4 --[[ImGuiCond.FirstUseEver]]) ImGui.Begin("Same title as another window##1") ImGui.Text("This is window 1.\nMy title is the same as window 2, but my identifier is unique.") ImGui.End() - ImGui.SetNextWindowPos(ImVec2(base_pos.x + 100, base_pos.y + 200), ImGuiCond.FirstUseEver) + ImGui.SetNextWindowPos(ImVec2(base_pos.x + 100, base_pos.y + 200), 4 --[[ImGuiCond.FirstUseEver]]) ImGui.Begin("Same title as another window##2") ImGui.Text("This is window 2.\nMy title is the same as window 1, but my identifier is unique.") ImGui.End() @@ -26590,7 +26624,7 @@ function ShowExampleAppWindowTitles(p_open) local spin = "|/-\\" local k = math.floor(ImGui.GetTime() / 0.25) % 4 + 1 local buf = string.format("Animated title %s %d###AnimatedTitle", string.sub(spin, k, k), ImGui.GetFrameCount()) - ImGui.SetNextWindowPos(ImVec2(base_pos.x + 100, base_pos.y + 300), ImGuiCond.FirstUseEver) + ImGui.SetNextWindowPos(ImVec2(base_pos.x + 100, base_pos.y + 300), 4 --[[ImGuiCond.FirstUseEver]]) ImGui.Begin(buf) ImGui.Text("This window has a changing title.") ImGui.End() @@ -26615,7 +26649,7 @@ local CRS = { sz = 42.0, base_rounding = 8.0, base_thickness = 3.0, animate_roun local function CustomRenderingPrimitives() local s = CRS ImGui.PushItemWidth(-ImGui.GetFontSize() * 15) - ImGui.PushItemFlag(ImGuiItemFlags.LiveEditOnInput, true) + ImGui.PushItemFlag(384 --[[ImGuiItemFlags.LiveEditOnInput]], true) local draw_list = ImGui.GetWindowDrawList() -- Draw gradients @@ -26664,7 +26698,7 @@ local function CustomRenderingPrimitives() local start_pos = ImGui.GetCursorScreenPos() local pi = 3.141592 local step = sz + 10.0 - local corners_tl_br = bit32.bor(ImDrawFlags.RoundCornersTopLeft, ImDrawFlags.RoundCornersBottomRight) + local corners_tl_br = bit32.bor(16 --[[ImDrawFlags.RoundCornersTopLeft]], 128 --[[ImDrawFlags.RoundCornersBottomRight]]) local half_sz = sz * 0.5 local circle_segments = s.circle_override and s.circle_override_v or 0 local curve_segments = s.curve_override and s.curve_override_v or 0 @@ -26751,10 +26785,10 @@ local function CustomRenderingPrimitives() draw_list:AddTriangle(ImVec2(x + sz * 0.2, y), ImVec2(x + sz * 0.4, y + sz), ImVec2(x, y + sz), col, th); x = x + step - math.floor(sz * 0.6) -- Thin triangle -- Concave shape: U - Shape(concave_shape, x, y); draw_list:PathStroke(col, th, ImDrawFlags.Closed); x = x + step + Shape(concave_shape, x, y); draw_list:PathStroke(col, th, 512 --[[ImDrawFlags.Closed]]); x = x + step -- Concave shape: Zig-Zag with sharp angles - Shape(zigzag_shape, x, y); draw_list:PathStroke(col, th, ImDrawFlags.Closed); x = x + step + Shape(zigzag_shape, x, y); draw_list:PathStroke(col, th, 512 --[[ImDrawFlags.Closed]]); x = x + step -- Horizontal/Vertical/Diagonal lines local off = math.floor(sz * 0.4) @@ -26770,7 +26804,7 @@ local function CustomRenderingPrimitives() -- Rotating square for n = 1, 4 do draw_list:PathLineTo(ImVec2(x + half_sz + rotating_square[n].x, y + half_sz + rotating_square[n].y)) end - draw_list:PathStroke(col, th, ImDrawFlags.Closed); x = x + step + draw_list:PathStroke(col, th, 512 --[[ImDrawFlags.Closed]]); x = x + step -- Path draw_list:PathArcTo(ImVec2(x + half_sz, y + half_sz), half_sz, pi * -0.5, pi * 1.1) @@ -26825,7 +26859,7 @@ local function CustomRenderingCanvas() draw_list:AddRect(canvas_p0, canvas_p1, IM_COL32(255, 255, 255, 255)) -- This will catch our interactions - ImGui.InvisibleButton("canvas", canvas_sz, bit32.bor(ImGuiButtonFlags.MouseButtonLeft, ImGuiButtonFlags.MouseButtonRight)) + ImGui.InvisibleButton("canvas", canvas_sz, bit32.bor(1 --[[ImGuiButtonFlags.MouseButtonLeft]], 2 --[[ImGuiButtonFlags.MouseButtonRight]])) local is_hovered = ImGui.IsItemHovered() -- Hovered local is_active = ImGui.IsItemActive() -- Held local origin = ImVec2(canvas_p0.x + s.scrolling.x, canvas_p0.y + s.scrolling.y) -- Lock scrolled origin @@ -26833,28 +26867,28 @@ local function CustomRenderingCanvas() local points = s.points -- Add first and second point - if is_hovered and not s.adding_line and ImGui.IsMouseClicked(ImGuiMouseButton.Left) then + if is_hovered and not s.adding_line and ImGui.IsMouseClicked(0 --[[ImGuiMouseButton.Left]]) then points[#points + 1] = ImVec2(mouse_pos_in_canvas.x, mouse_pos_in_canvas.y) points[#points + 1] = ImVec2(mouse_pos_in_canvas.x, mouse_pos_in_canvas.y) s.adding_line = true end if s.adding_line then points[#points] = ImVec2(mouse_pos_in_canvas.x, mouse_pos_in_canvas.y) - if not ImGui.IsMouseDown(ImGuiMouseButton.Left) then s.adding_line = false end + if not ImGui.IsMouseDown(0 --[[ImGuiMouseButton.Left]]) then s.adding_line = false end end -- Pan (we use a zero mouse threshold when there's no context menu) -- You may decide to make that threshold dynamic based on whether the mouse is hovering something etc. local mouse_threshold_for_pan = s.opt_enable_context_menu and -1.0 or 0.0 - if is_active and ImGui.IsMouseDragging(ImGuiMouseButton.Right, mouse_threshold_for_pan) then + if is_active and ImGui.IsMouseDragging(1 --[[ImGuiMouseButton.Right]], mouse_threshold_for_pan) then s.scrolling.x = s.scrolling.x + io.MouseDelta.x s.scrolling.y = s.scrolling.y + io.MouseDelta.y end -- Context menu (under default mouse threshold) - local drag_delta = ImGui.GetMouseDragDelta(ImGuiMouseButton.Right) + local drag_delta = ImGui.GetMouseDragDelta(1 --[[ImGuiMouseButton.Right]]) if s.opt_enable_context_menu and drag_delta.x == 0.0 and drag_delta.y == 0.0 then - ImGui.OpenPopupOnItemClick("context", ImGuiPopupFlags.MouseButtonRight) + ImGui.OpenPopupOnItemClick("context", 8 --[[ImGuiPopupFlags.MouseButtonRight]]) end if ImGui.BeginPopup("context") then if s.adding_line then points[#points] = nil; points[#points] = nil end @@ -26970,12 +27004,12 @@ local function ShowExampleAppDockSpaceAdvanced(args, p_open) ImGui.SetNextWindowPos(viewport.WorkPos) ImGui.SetNextWindowSize(viewport.WorkSize) ImGui.SetNextWindowViewport(viewport.ID) - ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 0.0) - ImGui.PushStyleVar(ImGuiStyleVar.WindowBorderSize, 0.0) + ImGui.PushStyleVar(3 --[[ImGuiStyleVar.WindowRounding]], 0.0) + ImGui.PushStyleVar(4 --[[ImGuiStyleVar.WindowBorderSize]], 0.0) window_flags = bit32.bor(window_flags, W.NoTitleBar, W.NoCollapse, W.NoResize, W.NoMove, W.NoBringToFrontOnFocus, W.NoNavFocus, W.NoBackground) else -- Floating dockspace - dockspace_flags = bit32.band(dockspace_flags, bit32.bnot(ImGuiDockNodeFlags.PassthruCentralNode)) + dockspace_flags = bit32.band(dockspace_flags, bit32.bnot(8 --[[ImGuiDockNodeFlags.PassthruCentralNode]])) end -- Important: note that we proceed even if Begin() returns false (aka window is collapsed). @@ -26983,7 +27017,7 @@ local function ShowExampleAppDockSpaceAdvanced(args, p_open) -- all active windows docked into it will lose their parent and become undocked. -- We cannot preserve the docking relationship between an active window and an inactive docking, otherwise -- any change of dockspace/settings would lead to windows being stuck in limbo and never being visible. - if not args.KeepWindowPadding then ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, ImVec2(0.0, 0.0)) end + if not args.KeepWindowPadding then ImGui.PushStyleVar(2 --[[ImGuiStyleVar.WindowPadding]], ImVec2(0.0, 0.0)) end p_open = ImGui.Begin("Window with a DockSpace", p_open, window_flags) if not args.KeepWindowPadding then ImGui.PopStyleVar() end @@ -27016,14 +27050,14 @@ function ShowExampleAppDockSpace(p_open) -- Refocus our window to minimize perceived loss of focus when changing mode (caused by the fact that each use a different window, which would not happen in a real app) if args.opt_demo_mode_changed then ImGui.SetNextWindowFocus() end - p_open = ImGui.Begin("Examples: Dockspace", p_open, ImGuiWindowFlags.MenuBar) + p_open = ImGui.Begin("Examples: Dockspace", p_open, 1024 --[[ImGuiWindowFlags.MenuBar]]) local c1, c2 c1, args.opt_demo_mode = ImGui.RadioButton("Basic demo mode", args.opt_demo_mode, 0) c2, args.opt_demo_mode = ImGui.RadioButton("Advanced demo mode", args.opt_demo_mode, 1) args.opt_demo_mode_changed = c1 or c2 ImGui.SeparatorText("Options") local D = ImGuiDockNodeFlags - if bit32.band(ImGui.GetIO().ConfigFlags, ImGuiConfigFlags.DockingEnable) == 0 then + if bit32.band(ImGui.GetIO().ConfigFlags, 128 --[[ImGuiConfigFlags.DockingEnable]]) == 0 then ShowDockingDisabledMessage() elseif args.opt_demo_mode == 0 then args.DockSpaceFlags = bit32.band(args.DockSpaceFlags, D.PassthruCentralNode) -- Allowed flags @@ -27089,7 +27123,7 @@ local function DocsInit() MyDocument(4, "A Rather Long Title", false, ImVec4(0.4, 0.8, 0.8, 1.0)), MyDocument(5, "Some Document", false, ImVec4(0.8, 0.8, 1.0, 1.0)), }, CloseQueue = {}, RenamingDoc = nil, RenamingStarted = false, - opt_target = 1, opt_reorderable = true, opt_fitting_flags = ImGuiTabBarFlags.FittingPolicyDefault_ } + opt_target = 1, opt_reorderable = true, opt_fitting_flags = 128 --[[ImGuiTabBarFlags.FittingPolicyDefault_]] } function app:QueueClose(doc) for _, d in ipairs(self.CloseQueue) do if d == doc then return end end self.CloseQueue[#self.CloseQueue + 1] = doc @@ -27100,20 +27134,20 @@ local function DocsInit() function app:DisplayDocContents(doc) ImGui.PushID("doc" .. doc.UID) ImGui.Text("Document \"%s\"", doc:Name()) - ImGui.PushStyleColor(ImGuiCol.Text, doc.Color) + ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], doc.Color) ImGui.TextWrapped("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.") ImGui.PopStyleColor() - ImGui.SetNextItemShortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.R), ImGuiInputFlags.Tooltip) + ImGui.SetNextItemShortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 563 --[[ImGuiKey.R]]), 262144 --[[ImGuiInputFlags.Tooltip]]) if ImGui.Button("Rename..") then self.RenamingDoc = doc; self.RenamingStarted = true end ImGui.SameLine() - ImGui.SetNextItemShortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.M), ImGuiInputFlags.Tooltip) + ImGui.SetNextItemShortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 558 --[[ImGuiKey.M]]), 262144 --[[ImGuiInputFlags.Tooltip]]) if ImGui.Button("Modify") then doc.Dirty = true end ImGui.SameLine() - ImGui.SetNextItemShortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.S), ImGuiInputFlags.Tooltip) + ImGui.SetNextItemShortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 564 --[[ImGuiKey.S]]), 262144 --[[ImGuiInputFlags.Tooltip]]) if ImGui.Button("Save") then doc:DoSave() end ImGui.SameLine() - ImGui.SetNextItemShortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.W), ImGuiInputFlags.Tooltip) + ImGui.SetNextItemShortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 568 --[[ImGuiKey.W]]), 262144 --[[ImGuiInputFlags.Tooltip]]) if ImGui.Button("Close") then self:QueueClose(doc) end ImGui.ColorEdit3("color", doc.Color) -- Useful to test drag and drop and hold-dragged-to-open-tab behavior. ImGui.PopID() @@ -27159,7 +27193,7 @@ function ShowExampleAppDocuments(p_open) -- Another solution may be to make the "Example: Documents" window use the ImGuiWindowFlags.NoDocking. local window_contents_visible - p_open, window_contents_visible = ImGui.Begin("Example: Documents", p_open, ImGuiWindowFlags.MenuBar) + p_open, window_contents_visible = ImGui.Begin("Example: Documents", p_open, 1024 --[[ImGuiWindowFlags.MenuBar]]) if not window_contents_visible and app.opt_target ~= Target_DockSpaceAndWindow then ImGui.End() return p_open @@ -27214,7 +27248,7 @@ function ShowExampleAppDocuments(p_open) -- Tabs if app.opt_target == Target_Tab then - local tab_bar_flags = bit32.bor(app.opt_fitting_flags, app.opt_reorderable and ImGuiTabBarFlags.Reorderable or 0, ImGuiTabBarFlags.DrawSelectedOverline) + local tab_bar_flags = bit32.bor(app.opt_fitting_flags, app.opt_reorderable and 1 --[[ImGuiTabBarFlags.Reorderable]] or 0, 64 --[[ImGuiTabBarFlags.DrawSelectedOverline]]) if ImGui.BeginTabBar("##tabs", tab_bar_flags) then if app.opt_reorderable then app:NotifyOfDocumentsClosedElsewhere() end @@ -27222,7 +27256,7 @@ function ShowExampleAppDocuments(p_open) for _, doc in ipairs(app.Documents) do if doc.Open then -- As we allow to change document name, we append a never-changing document id so tabs are stable - local tab_flags = doc.Dirty and ImGuiTabItemFlags.UnsavedDocument or 0 + local tab_flags = doc.Dirty and 1 --[[ImGuiTabItemFlags.UnsavedDocument]] or 0 local visible visible, doc.Open = ImGui.BeginTabItem(app:GetTabName(doc), doc.Open, tab_flags) @@ -27241,7 +27275,7 @@ function ShowExampleAppDocuments(p_open) ImGui.EndTabBar() end elseif app.opt_target == Target_DockSpaceAndWindow then - if bit32.band(ImGui.GetIO().ConfigFlags, ImGuiConfigFlags.DockingEnable) ~= 0 then + if bit32.band(ImGui.GetIO().ConfigFlags, 128 --[[ImGuiConfigFlags.DockingEnable]]) ~= 0 then app:NotifyOfDocumentsClosedElsewhere() -- Create a DockSpace node where any window can be docked @@ -27251,8 +27285,8 @@ function ShowExampleAppDocuments(p_open) -- Create Windows for _, doc in ipairs(app.Documents) do if doc.Open then - ImGui.SetNextWindowDockID(dockspace_id, redock_all and ImGuiCond.Always or ImGuiCond.FirstUseEver) - local window_flags = doc.Dirty and ImGuiWindowFlags.UnsavedDocument or 0 + ImGui.SetNextWindowDockID(dockspace_id, redock_all and 1 --[[ImGuiCond.Always]] or 4 --[[ImGuiCond.FirstUseEver]]) + local window_flags = doc.Dirty and 262144 --[[ImGuiWindowFlags.UnsavedDocument]] or 0 local visible doc.Open, visible = ImGui.Begin(doc:Name(), doc.Open, window_flags) @@ -27282,7 +27316,7 @@ function ShowExampleAppDocuments(p_open) if app.RenamingStarted then ImGui.OpenPopup("Rename") end if ImGui.BeginPopup("Rename") then ImGui.SetNextItemWidth(ImGui.GetFontSize() * 30) - if ImGui.InputText("###Name", app.RenamingDoc.NameBuf, 32, ImGuiInputTextFlags.EnterReturnsTrue) then + if ImGui.InputText("###Name", app.RenamingDoc.NameBuf, 32, 64 --[[ImGuiInputTextFlags.EnterReturnsTrue]]) then ImGui.CloseCurrentPopup() app.RenamingDoc = nil end @@ -27304,10 +27338,10 @@ function ShowExampleAppDocuments(p_open) app.CloseQueue = {} else if not ImGui.IsPopupOpen("Save?") then ImGui.OpenPopup("Save?") end - if ImGui.BeginPopupModal("Save?", nil, ImGuiWindowFlags.AlwaysAutoResize) then + if ImGui.BeginPopupModal("Save?", nil, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) then ImGui.Text("Save change to the following items?") local item_height = ImGui.GetTextLineHeightWithSpacing() - if ImGui.BeginChild(ImGui.GetID("frame"), ImVec2(-FLT_MIN, 6.25 * item_height), ImGuiChildFlags.FrameStyle) then + if ImGui.BeginChild(ImGui.GetID("frame"), ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], 6.25 * item_height), 128 --[[ImGuiChildFlags.FrameStyle]]) then for _, doc in ipairs(app.CloseQueue) do if doc.Dirty then ImGui.Text("%s", doc:Name()) end end end ImGui.EndChild() @@ -27378,9 +27412,9 @@ function DemoWindowWidgetsBasic() for i = 0, 6 do if i > 0 then ImGui.SameLine() end ImGui.PushID(i) - ImGui.PushStyleColor(ImGuiCol.Button, HSV(i / 7.0, 0.6, 0.6)) - ImGui.PushStyleColor(ImGuiCol.ButtonHovered, HSV(i / 7.0, 0.7, 0.7)) - ImGui.PushStyleColor(ImGuiCol.ButtonActive, HSV(i / 7.0, 0.8, 0.8)) + ImGui.PushStyleColor(22 --[[ImGuiCol.Button]], HSV(i / 7.0, 0.6, 0.6)) + ImGui.PushStyleColor(23 --[[ImGuiCol.ButtonHovered]], HSV(i / 7.0, 0.7, 0.7)) + ImGui.PushStyleColor(24 --[[ImGuiCol.ButtonActive]], HSV(i / 7.0, 0.8, 0.8)) ImGui.Button("Click") ImGui.PopStyleColor(3) ImGui.PopID() @@ -27395,10 +27429,10 @@ function DemoWindowWidgetsBasic() -- Arrow buttons with Repeater local spacing = ImGui.GetStyle().ItemInnerSpacing.x - ImGui.PushItemFlag(ImGuiItemFlags.ButtonRepeat, true) - if ImGui.ArrowButton("##left", ImGuiDir.Left) then s.counter = s.counter - 1 end + ImGui.PushItemFlag(8 --[[ImGuiItemFlags.ButtonRepeat]], true) + if ImGui.ArrowButton("##left", 0 --[[ImGuiDir.Left]]) then s.counter = s.counter - 1 end ImGui.SameLine(0.0, spacing) - if ImGui.ArrowButton("##right", ImGuiDir.Right) then s.counter = s.counter + 1 end + if ImGui.ArrowButton("##right", 1 --[[ImGuiDir.Right]]) then s.counter = s.counter + 1 end ImGui.PopItemFlag() ImGui.SameLine() ImGui.Text("%d", s.counter) @@ -27420,8 +27454,8 @@ function DemoWindowWidgetsBasic() ImGui.SeparatorText("Drags") s.di1 = ImGui.DragInt("drag int", s.di1, 1) ImGui.SameLine(); HelpMarker("Click and drag to edit value.\nHold Shift/Alt for faster/slower edit.\nDouble-Click or Ctrl+Click to input value.") - s.di2 = ImGui.DragInt("drag int 0..100", s.di2, 1, 0, 100, "%d%%", ImGuiSliderFlags.AlwaysClamp) - s.di3 = ImGui.DragInt("drag int wrap 100..200", s.di3, 1, 100, 200, "%d", ImGuiSliderFlags.WrapAround) + s.di2 = ImGui.DragInt("drag int 0..100", s.di2, 1, 0, 100, "%d%%", 1536 --[[ImGuiSliderFlags.AlwaysClamp]]) + s.di3 = ImGui.DragInt("drag int wrap 100..200", s.di3, 1, 100, 200, "%d", 256 --[[ImGuiSliderFlags.WrapAround]]) s.df1 = ImGui.DragFloat("drag float", s.df1, 0.005) s.df2 = ImGui.DragFloat("drag small float", s.df2, 0.0001, 0.0, 0.0, "%.06f ns") -- ImGui.DragFloat("drag wrap -1..1", f3, 0.005, -1.0, 1.0, nil, ImGuiSliderFlags.WrapAround) @@ -27430,7 +27464,7 @@ function DemoWindowWidgetsBasic() s.si1 = ImGui.SliderInt("slider int", s.si1, -1, 3) ImGui.SameLine(); HelpMarker("Ctrl+Click to input value.") s.sf1 = ImGui.SliderFloat("slider float", s.sf1, 0.0, 1.0, "ratio = %.3f") - s.sf2 = ImGui.SliderFloat("slider float (log)", s.sf2, -10.0, 10.0, "%.4f", ImGuiSliderFlags.Logarithmic) + s.sf2 = ImGui.SliderFloat("slider float (log)", s.sf2, -10.0, 10.0, "%.4f", 32 --[[ImGuiSliderFlags.Logarithmic]]) s.angle = ImGui.SliderAngle("slider angle", s.angle) -- Using the format string to display a name instead of an integer. @@ -27482,7 +27516,7 @@ function DemoWindowWidgetsCollapsingHeaders() if not ImGui.TreeNode("Collapsing Headers") then return end local s = S.chdr _, s.closable_group = ImGui.Checkbox("Show 2nd header", s.closable_group) - if ImGui.CollapsingHeader("Header", ImGuiTreeNodeFlags.None) then + if ImGui.CollapsingHeader("Header", 0 --[[ImGuiTreeNodeFlags.None]]) then ImGui.Text("IsItemHovered: %d", ImGui.IsItemHovered() and 1 or 0) for i = 0, 4 do ImGui.Text("Some content %d", i) end end @@ -27705,8 +27739,8 @@ function DemoWindowWidgetsComboBoxes() ImGui.SetKeyboardFocusHere() s.filter:Clear() end - ImGui.SetNextItemShortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.F)) - ImGui.SetNextItemWidth(-FLT_MIN) + ImGui.SetNextItemShortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 551 --[[ImGuiKey.F]])) + ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) s.filter:DrawWithHint("##Filter", "Filter (incl -excl)") for n = 0, #items - 1 do local is_selected = (s.sel == n) @@ -27775,9 +27809,9 @@ function DemoWindowWidgetsDataTypes() s.s32 = ImGui.DragScalar("drag s32 hex", DT.S32, s.s32, drag_speed, lo, hi, "0x%08X") s.u32 = ImGui.DragScalar("drag u32", DT.U32, s.u32, drag_speed, lo, hi, "%u ms") s.f32 = ImGui.DragScalar("drag float", DT.Float, s.f32, 0.005, 0.0, 1.0, "%f") - s.f32 = ImGui.DragScalar("drag float log", DT.Float, s.f32, 0.005, 0.0, 1.0, "%f", ImGuiSliderFlags.Logarithmic) + s.f32 = ImGui.DragScalar("drag float log", DT.Float, s.f32, 0.005, 0.0, 1.0, "%f", 32 --[[ImGuiSliderFlags.Logarithmic]]) s.f64 = ImGui.DragScalar("drag double", DT.Double, s.f64, 0.0005, 0.0, nil, "%.10f grams") - s.f64 = ImGui.DragScalar("drag double log",DT.Double, s.f64, 0.0005, 0.0, 1.0, "0 < %.10f < 1", ImGuiSliderFlags.Logarithmic) + s.f64 = ImGui.DragScalar("drag double log",DT.Double, s.f64, 0.0005, 0.0, 1.0, "0 < %.10f < 1", 32 --[[ImGuiSliderFlags.Logarithmic]]) ImGui.SeparatorText("Sliders") s.s8 = ImGui.SliderScalar("slider s8 full", DT.S8, s.s8, -128, 127, "%d") @@ -27792,10 +27826,10 @@ function DemoWindowWidgetsDataTypes() s.u32 = ImGui.SliderScalar("slider u32 high", DT.U32, s.u32, u32_max - 100, u32_max, "%u") s.u32 = ImGui.SliderScalar("slider u32 full", DT.U32, s.u32, 0, u32_max, "%u") s.f32 = ImGui.SliderScalar("slider float low", DT.Float, s.f32, 0.0, 1.0) - s.f32 = ImGui.SliderScalar("slider float low log", DT.Float, s.f32, 0.0, 1.0, "%.10f", ImGuiSliderFlags.Logarithmic) + s.f32 = ImGui.SliderScalar("slider float low log", DT.Float, s.f32, 0.0, 1.0, "%.10f", 32 --[[ImGuiSliderFlags.Logarithmic]]) s.f32 = ImGui.SliderScalar("slider float high", DT.Float, s.f32, -10000000000.0, 10000000000.0, "%e") s.f64 = ImGui.SliderScalar("slider double low", DT.Double, s.f64, 0.0, 1.0, "%.10f grams") - s.f64 = ImGui.SliderScalar("slider double low log", DT.Double, s.f64, 0.0, 1.0, "%.10f", ImGuiSliderFlags.Logarithmic) + s.f64 = ImGui.SliderScalar("slider double low log", DT.Double, s.f64, 0.0, 1.0, "%.10f", 32 --[[ImGuiSliderFlags.Logarithmic]]) s.f64 = ImGui.SliderScalar("slider double high", DT.Double, s.f64, -1000000000000000.0, 1000000000000000.0, "%e grams") ImGui.SeparatorText("Sliders (reverse)") @@ -27806,9 +27840,9 @@ function DemoWindowWidgetsDataTypes() ImGui.SeparatorText("Inputs") _, s.inputs_step = ImGui.Checkbox("Show step buttons", s.inputs_step) - _, s.flags = ImGui.CheckboxFlags("ImGuiInputTextFlags_ReadOnly", s.flags, ImGuiInputTextFlags.ReadOnly) - if ImGuiInputTextFlags.ParseEmptyRefVal then _, s.flags = ImGui.CheckboxFlags("ImGuiInputTextFlags_ParseEmptyRefVal", s.flags, ImGuiInputTextFlags.ParseEmptyRefVal) end - if ImGuiInputTextFlags.DisplayEmptyRefVal then _, s.flags = ImGui.CheckboxFlags("ImGuiInputTextFlags_DisplayEmptyRefVal", s.flags, ImGuiInputTextFlags.DisplayEmptyRefVal) end + _, s.flags = ImGui.CheckboxFlags("ImGuiInputTextFlags_ReadOnly", s.flags, 512 --[[ImGuiInputTextFlags.ReadOnly]]) + if 8192 --[[ImGuiInputTextFlags.ParseEmptyRefVal]] then _, s.flags = ImGui.CheckboxFlags("ImGuiInputTextFlags_ParseEmptyRefVal", s.flags, 8192 --[[ImGuiInputTextFlags.ParseEmptyRefVal]]) end + if 16384 --[[ImGuiInputTextFlags.DisplayEmptyRefVal]] then _, s.flags = ImGui.CheckboxFlags("ImGuiInputTextFlags_DisplayEmptyRefVal", s.flags, 16384 --[[ImGuiInputTextFlags.DisplayEmptyRefVal]]) end local one = s.inputs_step and 1 or nil s.s8 = ImGui.InputScalar("input s8", DT.S8, s.s8, one, nil, "%d", s.flags) s.u8 = ImGui.InputScalar("input u8", DT.U8, s.u8, one, nil, "%u", s.flags) @@ -27867,7 +27901,7 @@ function DemoWindowWidgetsDragAndDrop() ImGui.Button(names[n + 1], ImVec2(60, 60)) -- Our buttons are both drag sources and drag targets here! - if ImGui.BeginDragDropSource(ImGuiDragDropFlags.None) then + if ImGui.BeginDragDropSource(0 --[[ImGuiDragDropFlags.None]]) then -- Set payload to carry the index of our item (could be anything) ImGui.SetDragDropPayload("DND_DEMO_CELL", n, 4) @@ -27897,7 +27931,7 @@ function DemoWindowWidgetsDragAndDrop() -- FIXME: there is temporary (usually single-frame) ID Conflict during reordering as a same item may be submitting twice. -- This code was always slightly faulty but in a way which was not easily noticeable. -- Until we fix this, enable ImGuiItemFlags.AllowDuplicateId to disable detecting the issue. - ImGui.PushItemFlag(ImGuiItemFlags.AllowDuplicateId, true) + ImGui.PushItemFlag(32 --[[ImGuiItemFlags.AllowDuplicateId]], true) -- Simple reordering HelpMarker("We don't use the drag and drop api at all here! Instead we query when the item is held but not hovered, and order items accordingly.") @@ -27923,9 +27957,9 @@ function DemoWindowWidgetsDragAndDrop() -- Drop targets ImGui.Button((n == 1) and "drop here##1" or "drop here##0") if ImGui.BeginDragDropTarget() then - local drop_target_flags = bit32.bor(ImGuiDragDropFlags.AcceptBeforeDelivery, ImGuiDragDropFlags.AcceptNoPreviewTooltip) + local drop_target_flags = bit32.bor(1024 --[[ImGuiDragDropFlags.AcceptBeforeDelivery]], 4096 --[[ImGuiDragDropFlags.AcceptNoPreviewTooltip]]) if ImGui.AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_4F, drop_target_flags) then - ImGui.SetMouseCursor(ImGuiMouseCursor.NotAllowed) + ImGui.SetMouseCursor(10 --[[ImGuiMouseCursor.NotAllowed]]) ImGui.SetTooltip("Cannot drop here!") end ImGui.EndDragDropTarget() @@ -27968,9 +28002,9 @@ function DemoWindowWidgetsDragsAndSliders() -- Drags ImGui.Text("Underlying float value: %f", s.drag_f) s.drag_f = ImGui.DragFloat("DragFloat (0 -> 1)", s.drag_f, 0.005, 0.0, 1.0, "%.3f", flags) - s.drag_f = ImGui.DragFloat("DragFloat (0 -> +inf)", s.drag_f, 0.005, 0.0, FLT_MAX, "%.3f", flags) - s.drag_f = ImGui.DragFloat("DragFloat (-inf -> 1)", s.drag_f, 0.005, -FLT_MAX, 1.0, "%.3f", flags) - s.drag_f = ImGui.DragFloat("DragFloat (-inf -> +inf)", s.drag_f, 0.005, -FLT_MAX, FLT_MAX, "%.3f", flags) + s.drag_f = ImGui.DragFloat("DragFloat (0 -> +inf)", s.drag_f, 0.005, 0.0, 3.4028234663853e+38 --[[FLT_MAX]], "%.3f", flags) + s.drag_f = ImGui.DragFloat("DragFloat (-inf -> 1)", s.drag_f, 0.005, -3.4028234663853e+38 --[[FLT_MAX]], 1.0, "%.3f", flags) + s.drag_f = ImGui.DragFloat("DragFloat (-inf -> +inf)", s.drag_f, 0.005, -3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]], "%.3f", flags) -- ImGui.DragFloat("DragFloat (0 -> 0)", drag_f, 0.005, 0.0, 0.0, "%.3f", flags) -- To test ClampZeroRange -- ImGui.DragFloat("DragFloat (100 -> 100)", drag_f, 0.005, 100.0, 100.0, "%.3f", flags) s.drag_i = ImGui.DragInt("DragInt (0 -> 100)", s.drag_i, 0.5, 0, 100, "%d", flags) @@ -28024,7 +28058,7 @@ function DemoWindowWidgetsImages() -- Basic drawing ImGui.SeparatorText("Image()/ImageWithBg() function") - ImGui.PushStyleVar(ImGuiStyleVar.ImageBorderSize, math.max(1.0, ImGui.GetStyle().ImageBorderSize)) + ImGui.PushStyleVar(24 --[[ImGuiStyleVar.ImageBorderSize]], math.max(1.0, ImGui.GetStyle().ImageBorderSize)) ImGui.ImageWithBg(my_tex_id, ImVec2(my_tex_w, my_tex_h), ImVec2(0.0, 0.0), ImVec2(1.0, 1.0), ImVec4(0.0, 0.0, 0.0, 1.0)) -- uv_min: Top-left, uv_max: Lower-right ImGui.PopStyleVar() @@ -28042,7 +28076,7 @@ function DemoWindowWidgetsImages() -- Here are trying to display only a 32x32 pixels area of the texture, hence the UV computation. -- Read about UV coordinates here: https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples ImGui.PushID(i) - if i > 0 then ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, ImVec2(i - 1.0, i - 1.0)) end + if i > 0 then ImGui.PushStyleVar(11 --[[ImGuiStyleVar.FramePadding]], ImVec2(i - 1.0, i - 1.0)) end local size = ImVec2(32.0, 32.0) -- Size of the image we want to make visible local uv0 = ImVec2(0.0, 0.0) -- UV coordinates for lower-left local uv1 = ImVec2(32.0 / my_tex_w, 32.0 / my_tex_h) -- UV coordinates for (32,32) in our texture @@ -28092,10 +28126,10 @@ function DemoWindowWidgetsListBoxes() -- Custom size: use all width, 5 items tall ImGui.Text("Full-width:") - if ImGui.BeginListBox("##listbox 2", ImVec2(-FLT_MIN, 5 * ImGui.GetTextLineHeightWithSpacing())) then + if ImGui.BeginListBox("##listbox 2", ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], 5 * ImGui.GetTextLineHeightWithSpacing())) then for n = 0, #items - 1 do local is_selected = (s.sel == n) - local flags = (item_highlighted_idx == n) and ImGuiSelectableFlags.Highlight or 0 + local flags = (item_highlighted_idx == n) and 32 --[[ImGuiSelectableFlags.Highlight]] or 0 if ImGui.Selectable(items[n + 1], is_selected, flags) then s.sel = n end -- Set the initial focus when opening the combo (scrolling + keyboard navigation focus) if is_selected then ImGui.SetItemDefaultFocus() end @@ -28118,8 +28152,8 @@ function DemoWindowWidgetsLiveEdit(demo_data) if not demo_data.LiveEditOverride then demo_data.LiveEditFlags = ImGui.GetItemFlags() end ImGui.BeginDisabled(demo_data.LiveEditOverride == false) ImGui.Indent() - _, demo_data.LiveEditFlags = ImGui.CheckboxFlags("ImGuiItemFlags_LiveEditOnInputText", demo_data.LiveEditFlags, ImGuiItemFlags.LiveEditOnInputText) - _, demo_data.LiveEditFlags = ImGui.CheckboxFlags("ImGuiItemFlags_LiveEditOnInputScalar", demo_data.LiveEditFlags, ImGuiItemFlags.LiveEditOnInputScalar) + _, demo_data.LiveEditFlags = ImGui.CheckboxFlags("ImGuiItemFlags_LiveEditOnInputText", demo_data.LiveEditFlags, 128 --[[ImGuiItemFlags.LiveEditOnInputText]]) + _, demo_data.LiveEditFlags = ImGui.CheckboxFlags("ImGuiItemFlags_LiveEditOnInputScalar", demo_data.LiveEditFlags, 256 --[[ImGuiItemFlags.LiveEditOnInputScalar]]) ImGui.Unindent() ImGui.EndDisabled() ImGui.Text("Try typing '123' and seeing effect on backing value:") @@ -28148,8 +28182,8 @@ function DemoWindowWidgetsMixedValues() local is_mixed = items[1] ~= items[2] or items[1] ~= items[3] -- Demonstrate Drags, Sliders, Inputs - ImGui.PushItemFlag(ImGuiItemFlags.LiveEditOnInput, s.use_liveedit) - ImGui.PushItemFlag(ImGuiItemFlags.MixedValue, is_mixed) + ImGui.PushItemFlag(384 --[[ImGuiItemFlags.LiveEditOnInput]], s.use_liveedit) + ImGui.PushItemFlag(4096 --[[ImGuiItemFlags.MixedValue]], is_mixed) local edited, e = false, false items[1], e = ImGui.DragFloat("DragFloat", items[1]); edited = edited or e items[1], e = ImGui.SliderFloat("SliderFloat", items[1], 0.0, 100.0); edited = edited or e @@ -28167,7 +28201,7 @@ function DemoWindowWidgetsMixedValues() ImGui.Text("(note: edits are not applied in this demo)") -- <-- Would need more state tracking. ImGui.Checkbox("Checkbox On", true) ImGui.Checkbox("Checkbox Off", false) - ImGui.PushItemFlag(ImGuiItemFlags.MixedValue, true) + ImGui.PushItemFlag(4096 --[[ImGuiItemFlags.MixedValue]], true) ImGui.Checkbox("Checkbox Mixed", false) ImGui.RadioButtonEx("RadioButton Mixed", true) ImGui.SameLine() @@ -28187,7 +28221,7 @@ function DemoWindowWidgetsMultiComponents() if not ImGui.TreeNode("Multi-component Widgets") then return end local s = S.mc local f, i = s.vec4f, s.vec4i - if ImGuiSliderFlags.ColorMarkers then _, s.flags = ImGui.CheckboxFlags("ImGuiSliderFlags_ColorMarkers", s.flags, ImGuiSliderFlags.ColorMarkers) end -- Only passing this to Drag/Sliders + if 4096 --[[ImGuiSliderFlags.ColorMarkers]] then _, s.flags = ImGui.CheckboxFlags("ImGuiSliderFlags_ColorMarkers", s.flags, 4096 --[[ImGuiSliderFlags.ColorMarkers]]) end -- Only passing this to Drag/Sliders local flags = s.flags for _, n in ipairs({ 2, 3, 4 }) do ImGui.SeparatorText(n .. "-wide") @@ -28199,7 +28233,7 @@ function DemoWindowWidgetsMultiComponents() ImGui["SliderInt" .. n]("slider int" .. n, i, 0, 255, nil, flags) end ImGui.SeparatorText("Ranges") - s.b, s.e = ImGui.DragFloatRange2("range float", s.b, s.e, 0.25, 0.0, 100.0, "Min: %.1f %%", "Max: %.1f %%", ImGuiSliderFlags.AlwaysClamp) + s.b, s.e = ImGui.DragFloatRange2("range float", s.b, s.e, 0.25, 0.0, 100.0, "Min: %.1f %%", "Max: %.1f %%", 1536 --[[ImGuiSliderFlags.AlwaysClamp]]) s.bi, s.ei = ImGui.DragIntRange2("range int", s.bi, s.ei, 5, 0, 1000, "Min: %d units", "Max: %d units") s.bi, s.ei = ImGui.DragIntRange2("range int (no bounds)", s.bi, s.ei, 5, 0, 0, "Min: %d units", "Max: %d units") ImGui.TreePop() @@ -28322,25 +28356,25 @@ function DemoWindowWidgetsQueryingStatuses() ImGui.SameLine() if not s.liveedit_override then s.liveedit_flags = ImGui.GetItemFlags() end ImGui.BeginDisabled(s.liveedit_override == false) - _, s.liveedit_flags = ImGui.CheckboxFlags("_LiveEditOnInput", s.liveedit_flags, ImGuiItemFlags.LiveEditOnInput) + _, s.liveedit_flags = ImGui.CheckboxFlags("_LiveEditOnInput", s.liveedit_flags, 384 --[[ImGuiItemFlags.LiveEditOnInput]]) ImGui.SameLine() - _, s.liveedit_flags = ImGui.CheckboxFlags("_LiveEditOnInputText", s.liveedit_flags, ImGuiItemFlags.LiveEditOnInputText) + _, s.liveedit_flags = ImGui.CheckboxFlags("_LiveEditOnInputText", s.liveedit_flags, 128 --[[ImGuiItemFlags.LiveEditOnInputText]]) ImGui.SameLine() - _, s.liveedit_flags = ImGui.CheckboxFlags("_LiveEditOnInputScalar", s.liveedit_flags, ImGuiItemFlags.LiveEditOnInputScalar) + _, s.liveedit_flags = ImGui.CheckboxFlags("_LiveEditOnInputScalar", s.liveedit_flags, 256 --[[ImGuiItemFlags.LiveEditOnInputScalar]]) ImGui.EndDisabled() if s.liveedit_override then - ImGui.PushItemFlag(ImGuiItemFlags.LiveEditOnInputText, bit32.band(s.liveedit_flags, ImGuiItemFlags.LiveEditOnInputText) ~= 0) - ImGui.PushItemFlag(ImGuiItemFlags.LiveEditOnInputScalar, bit32.band(s.liveedit_flags, ImGuiItemFlags.LiveEditOnInputScalar) ~= 0) + ImGui.PushItemFlag(128 --[[ImGuiItemFlags.LiveEditOnInputText]], bit32.band(s.liveedit_flags, 128 --[[ImGuiItemFlags.LiveEditOnInputText]]) ~= 0) + ImGui.PushItemFlag(256 --[[ImGuiItemFlags.LiveEditOnInputScalar]], bit32.band(s.liveedit_flags, 256 --[[ImGuiItemFlags.LiveEditOnInputScalar]]) ~= 0) end -- Submit selected items so we can query their status in the code following it. local ret = false local t = s.item_type if s.item_disabled then ImGui.BeginDisabled(true) end - if s.item_mixedvalue then ImGui.PushItemFlag(ImGuiItemFlags.MixedValue, true) end + if s.item_mixedvalue then ImGui.PushItemFlag(4096 --[[ImGuiItemFlags.MixedValue]], true) end if t == 0 then ImGui.Text("ITEM: Text") end -- Testing text items with no identifier/interaction if t == 1 then ret = ImGui.Button("ITEM: Button") end -- Testing button - if t == 2 then ImGui.PushItemFlag(ImGuiItemFlags.ButtonRepeat, true); ret = ImGui.Button("ITEM: Button"); ImGui.PopItemFlag() end -- Testing button (with repeater) + if t == 2 then ImGui.PushItemFlag(8 --[[ImGuiItemFlags.ButtonRepeat]], true); ret = ImGui.Button("ITEM: Button"); ImGui.PopItemFlag() end -- Testing button (with repeater) if t == 3 then ret, s.b = ImGui.Checkbox("ITEM: Checkbox", s.b) end -- Testing checkbox if t == 4 then s.col4f[1], ret = ImGui.SliderFloat("ITEM: SliderFloat", s.col4f[1], 0.0, 1.0) end -- Testing basic item if t == 5 then ret = ImGui.InputText("ITEM: InputText", s.str, 16) end -- Testing input text (which handles tabbing) @@ -28351,7 +28385,7 @@ function DemoWindowWidgetsQueryingStatuses() if t == 10 then ret = ImGui.Selectable("ITEM: Selectable") end -- Testing selectable item if t == 11 then ret = ImGui.MenuItem("ITEM: MenuItem") end -- Testing menu item (they use ImGuiButtonFlags.PressedOnRelease button policy) if t == 12 then ret = ImGui.TreeNode("ITEM: TreeNode"); if ret then ImGui.TreePop() end end -- Testing tree node - if t == 13 then ret = ImGui.TreeNodeEx("ITEM: TreeNode w/ ImGuiTreeNodeFlags_OpenOnDoubleClick", bit32.bor(ImGuiTreeNodeFlags.OpenOnDoubleClick, ImGuiTreeNodeFlags.NoTreePushOnOpen)) end -- Testing tree node with ImGuiButtonFlags.PressedOnDoubleClick button policy. + if t == 13 then ret = ImGui.TreeNodeEx("ITEM: TreeNode w/ ImGuiTreeNodeFlags_OpenOnDoubleClick", bit32.bor(64 --[[ImGuiTreeNodeFlags.OpenOnDoubleClick]], 8 --[[ImGuiTreeNodeFlags.NoTreePushOnOpen]])) end -- Testing tree node with ImGuiButtonFlags.PressedOnDoubleClick button policy. if t == 14 then s.combo, ret = ImGui.Combo("ITEM: Combo", s.combo, { "Apple", "Banana", "Cherry", "Kiwi" }) end if t == 15 then s.listbox, ret = ImGui.ListBox("ITEM: ListBox", s.listbox, { "Apple", "Banana", "Cherry", "Kiwi" }, 4, 4) end @@ -28388,7 +28422,7 @@ function DemoWindowWidgetsQueryingStatuses() if s.item_mixedvalue then ImGui.PopItemFlag() end if s.item_disabled then ImGui.EndDisabled() end - ImGui.InputText("unused", s.unused, 1, ImGuiInputTextFlags.ReadOnly) + ImGui.InputText("unused", s.unused, 1, 512 --[[ImGuiInputTextFlags.ReadOnly]]) ImGui.SameLine() HelpMarker("This widget is only here to be able to tab-out of the widgets above and see e.g. Deactivated() status.") ImGui.TreePop() @@ -28396,7 +28430,7 @@ function DemoWindowWidgetsQueryingStatuses() if ImGui.TreeNode("Querying Window Status (Focused/Hovered etc.)") then _, s.embed = ImGui.Checkbox("Embed everything inside a child window for testing _RootWindow flag.", s.embed) - if s.embed then ImGui.BeginChild("outer_child", ImVec2(0, ImGui.GetFontSize() * 20.0), ImGuiChildFlags.Borders) end + if s.embed then ImGui.BeginChild("outer_child", ImVec2(0, ImGui.GetFontSize() * 20.0), 1 --[[ImGuiChildFlags.Borders]]) end local FF, HF = ImGuiFocusedFlags, ImGuiHoveredFlags local bor = bit32.bor -- Testing IsWindowFocused() function with its various flags. @@ -28426,7 +28460,7 @@ function DemoWindowWidgetsQueryingStatuses() B(ImGui.IsWindowHovered(bor(HF.ChildWindows, HF.RootWindow, HF.DockHierarchy))), B(ImGui.IsWindowHovered(HF.RootWindow)), B(ImGui.IsWindowHovered(bor(HF.RootWindow, HF.NoPopupHierarchy))), B(ImGui.IsWindowHovered(bor(HF.RootWindow, HF.DockHierarchy))), B(ImGui.IsWindowHovered(bor(HF.ChildWindows, HF.AllowWhenBlockedByPopup))), B(ImGui.IsWindowHovered(HF.AnyWindow)), B(ImGui.IsWindowHovered(HF.Stationary))) - ImGui.BeginChild("child", ImVec2(0, 50), ImGuiChildFlags.Borders) + ImGui.BeginChild("child", ImVec2(0, 50), 1 --[[ImGuiChildFlags.Borders]]) ImGui.Text("This is another child window for testing the _ChildWindows flag.") ImGui.EndChild() if s.embed then ImGui.EndChild() end @@ -28475,7 +28509,7 @@ function DemoWindowWidgetsSelectables() _, b[1] = SelectableP("1. I am selectable", b[1]) _, b[2] = SelectableP("2. I am selectable", b[2]) _, b[3] = SelectableP("3. I am selectable", b[3]) - if ImGui.Selectable("4. I am double clickable", b[4], ImGuiSelectableFlags.AllowDoubleClick) then + if ImGui.Selectable("4. I am double clickable", b[4], 4 --[[ImGuiSelectableFlags.AllowDoubleClick]]) then if ImGui.IsMouseDoubleClicked(0) then b[4] = not b[4] end end ImGui.TreePop() @@ -28498,12 +28532,12 @@ function DemoWindowWidgetsSelectables() for n = 0, 4 do ImGui.PushID(n) ImGui.AlignTextToFramePadding() - if ImGui.Selectable("##selectable", s.selected_n == n, ImGuiSelectableFlags.AllowOverlap) then s.selected_n = n end + if ImGui.Selectable("##selectable", s.selected_n == n, 16 --[[ImGuiSelectableFlags.AllowOverlap]]) then s.selected_n = n end ImGui.SameLine(0, 0) _, s.checked[n + 1] = ImGui.Checkbox("##check", s.checked[n + 1]) ImGui.SameLine() local color = ImVec4((n % 2 == 1) and 1.0 or 0.2, (math.floor(n / 2) % 2 == 1) and 1.0 or 0.2, 0.2, 1.0) - ImGui.ColorButton("##color", color, ImGuiColorEditFlags.NoTooltip, ImVec2(color_marker_w, 0)) + ImGui.ColorButton("##color", color, 64 --[[ImGuiColorEditFlags.NoTooltip]], ImVec2(color_marker_w, 0)) ImGui.SameLine() ImGui.Text("Some label") ImGui.PopID() @@ -28526,7 +28560,7 @@ function DemoWindowWidgetsSelectables() for i = 0, 9 do ImGui.TableNextRow() ImGui.TableNextColumn() - _, sel[i + 1] = SelectableP(string.format("Item %d", i), sel[i + 1], ImGuiSelectableFlags.SpanAllColumns) + _, sel[i + 1] = SelectableP(string.format("Item %d", i), sel[i + 1], 2 --[[ImGuiSelectableFlags.SpanAllColumns]]) ImGui.TableNextColumn() ImGui.Text("Some other contents") ImGui.TableNextColumn() @@ -28545,7 +28579,7 @@ function DemoWindowWidgetsSelectables() local winning_state = true for y = 1, 4 do for x = 1, 4 do if g[y][x] == 0 then winning_state = false end end end -- If all cells are selected... if winning_state then - ImGui.PushStyleVar(ImGuiStyleVar.SelectableTextAlign, ImVec2(0.5 + 0.5 * math.cos(time * 2.0), 0.5 + 0.5 * math.sin(time * 3.0))) + ImGui.PushStyleVar(39 --[[ImGuiStyleVar.SelectableTextAlign]], ImVec2(0.5 + 0.5 * math.cos(time * 2.0), 0.5 + 0.5 * math.sin(time * 3.0))) end local size = ImGui.CalcTextSize("Sailor").x for y = 1, 4 do @@ -28575,8 +28609,8 @@ function DemoWindowWidgetsSelectables() local alignment = ImVec2(x / 2.0, y / 2.0) local name = string.format("(%.1f,%.1f)", alignment.x, alignment.y) if x > 0 then ImGui.SameLine() end - ImGui.PushStyleVar(ImGuiStyleVar.SelectableTextAlign, alignment) - _, s.align[3 * y + x + 1] = SelectableP(name, s.align[3 * y + x + 1], ImGuiSelectableFlags.None, ImVec2(size, size)) + ImGui.PushStyleVar(39 --[[ImGuiStyleVar.SelectableTextAlign]], alignment) + _, s.align[3 * y + x + 1] = SelectableP(name, s.align[3 * y + x + 1], 0 --[[ImGuiSelectableFlags.None]], ImVec2(size, size)) ImGui.PopStyleVar() end end @@ -28816,9 +28850,9 @@ function DemoWindowWidgetsTextFilter() local filter = S.tf.filter HelpMarker("Not a widget per-se, but ImGuiTextFilter is a helper to perform simple filtering on text strings.") ImGui.Text("Filter usage:\n \"\" display all lines\n xxx display lines containing \"xxx\"\n xxx yyy display lines containing \"xxx\" and \"yyy\"\n \"xxx yyy\" display lines containing \"xxx yyy\"\n xxx,yyy display lines containing \"xxx\" or \"yyy\"\n -xxx hide lines containing \"xxx\"") - ImGui.SetNextItemWidth(-FLT_MIN) + ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) filter:DrawWithHint("##Filter", "Filter (incl -excl)") - if ImGui.BeginChild("##items", ImVec2(-FLT_MIN, ImGui.GetTextLineHeightWithSpacing() * 15), ImGuiChildFlags.FrameStyle) then + if ImGui.BeginChild("##items", ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], ImGui.GetTextLineHeightWithSpacing() * 15), 128 --[[ImGuiChildFlags.FrameStyle]]) then for _, item in ipairs({ "aaa1.c", "bbb1.c", "ccc1.c", "aaa2.cpp", "bbb2.cpp", "ccc2.cpp", "abc.h", "hello, world" }) do if filter:PassFilter(item) then ImGui.TextUnformatted(item) end end @@ -28858,7 +28892,7 @@ function DemoWindowWidgetsTextInput() FlagBox("ml_flags", "AllowTabInput") ImGui.SameLine(); HelpMarker("When _AllowTabInput is set, passing through the widget with Tabbing doesn't automatically activate it, in order to also cycling through subsequent widgets.") FlagBox("ml_flags", "CtrlEnterForNewLine") - ImGui.InputTextMultiline("##source", s.text, 1024 * 16, ImVec2(-FLT_MIN, ImGui.GetTextLineHeight() * 16), s.ml_flags) + ImGui.InputTextMultiline("##source", s.text, 1024 * 16, ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], ImGui.GetTextLineHeight() * 16), s.ml_flags) ImGui.TreePop() end @@ -28901,11 +28935,11 @@ function DemoWindowWidgetsTextInput() if data.EventFlag == IT.CallbackCompletion then data:InsertChars(data.CursorPos, "..") elseif data.EventFlag == IT.CallbackHistory then - if data.EventKey == ImGuiKey.UpArrow then + if data.EventKey == 515 --[[ImGuiKey.UpArrow]] then data:DeleteChars(0, data.BufTextLen) data:InsertChars(0, "Pressed Up!") data:SelectAll() - elseif data.EventKey == ImGuiKey.DownArrow then + elseif data.EventKey == 516 --[[ImGuiKey.DownArrow]] then data:DeleteChars(0, data.BufTextLen) data:InsertChars(0, "Pressed Down!") data:SelectAll() @@ -28935,7 +28969,7 @@ function DemoWindowWidgetsTextInput() if ImGui.TreeNode("Resize Callback") then HelpMarker("Using ImGuiInputTextFlags_CallbackResize to wire your custom string type to InputText().\n\n(Lua port: fixed 1024 byte buffer, CallbackResize growth not supported)") FlagBox("rs_flags", "WordWrap") - ImGui.InputTextMultiline("##MyStr", s.rs, 1024, ImVec2(-FLT_MIN, ImGui.GetTextLineHeight() * 16), s.rs_flags) + ImGui.InputTextMultiline("##MyStr", s.rs, 1024, ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], ImGui.GetTextLineHeight() * 16), s.rs_flags) ImGui.Text("Size: %d\nCapacity: %d", #BufStr(s.rs) + 1, 1024) ImGui.TreePop() end @@ -28976,7 +29010,7 @@ function DemoWindowWidgetsTooltips() -- - Full-form (any contents): if IsItemHovered(...) and BeginTooltip() then Text("Hello"); EndTooltip() end HelpMarker("Tooltip are typically created by using a IsItemHovered() + SetTooltip() sequence.\n\nWe provide a helper SetItemTooltip() function to perform the two with standards flags.") - local sz = ImVec2(-FLT_MIN, 0.0) + local sz = ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], 0.0) ImGui.Button("Basic", sz) ImGui.SetItemTooltip("I am a tooltip") ImGui.Button("Fancy", sz) @@ -29046,7 +29080,7 @@ function DemoWindowWidgetsTreeNodes() for i = 0, 4 do -- Use SetNextItemOpen() so set the default state of a node to be open. We could -- also use TreeNodeEx() with the ImGuiTreeNodeFlags.DefaultOpen flag to achieve the same thing! - if i == 0 then ImGui.SetNextItemOpen(true, ImGuiCond.Once) end + if i == 0 then ImGui.SetNextItemOpen(true, 2 --[[ImGuiCond.Once]]) end -- Here we use PushID() to generate a unique base ID, and then the "" used as TreeNode id won't conflict. -- An alternative to using 'PushID() + TreeNode("", ...)' to generate a unique ID is to use 'TreeNode(i, ...)', @@ -29185,7 +29219,7 @@ function DemoWindowWidgetsVerticalSliders() if not ImGui.TreeNode("Vertical Sliders") then return end local s = S.vs local spacing = 4 - ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, ImVec2(spacing, spacing)) + ImGui.PushStyleVar(14 --[[ImGuiStyleVar.ItemSpacing]], ImVec2(spacing, spacing)) s.int_value = ImGui.VSliderInt("##int", ImVec2(18, 160), s.int_value, 0, 5) ImGui.SameLine() local values = s.values @@ -29193,10 +29227,10 @@ function DemoWindowWidgetsVerticalSliders() for i = 0, 6 do if i > 0 then ImGui.SameLine() end ImGui.PushID(i) - ImGui.PushStyleColor(ImGuiCol.FrameBg, HSV(i / 7.0, 0.5, 0.5)) - ImGui.PushStyleColor(ImGuiCol.FrameBgHovered, HSV(i / 7.0, 0.6, 0.5)) - ImGui.PushStyleColor(ImGuiCol.FrameBgActive, HSV(i / 7.0, 0.7, 0.5)) - ImGui.PushStyleColor(ImGuiCol.SliderGrab, HSV(i / 7.0, 0.9, 0.9)) + ImGui.PushStyleColor(7 --[[ImGuiCol.FrameBg]], HSV(i / 7.0, 0.5, 0.5)) + ImGui.PushStyleColor(8 --[[ImGuiCol.FrameBgHovered]], HSV(i / 7.0, 0.6, 0.5)) + ImGui.PushStyleColor(9 --[[ImGuiCol.FrameBgActive]], HSV(i / 7.0, 0.7, 0.5)) + ImGui.PushStyleColor(20 --[[ImGuiCol.SliderGrab]], HSV(i / 7.0, 0.9, 0.9)) values[i + 1] = ImGui.VSliderFloat("##v", ImVec2(18, 160), values[i + 1], 0.0, 1.0, "") if ImGui.IsItemActive() or ImGui.IsItemHovered() then ImGui.SetTooltip("%.3f", values[i + 1]) end ImGui.PopStyleColor(4) @@ -29226,7 +29260,7 @@ function DemoWindowWidgetsVerticalSliders() for i = 0, 3 do if i > 0 then ImGui.SameLine() end ImGui.PushID(i) - ImGui.PushStyleVar(ImGuiStyleVar.GrabMinSize, 40) + ImGui.PushStyleVar(21 --[[ImGuiStyleVar.GrabMinSize]], 40) values[i + 1] = ImGui.VSliderFloat("##v", ImVec2(40, 160), values[i + 1], 0.0, 1.0, "%.2f\nsec") ImGui.PopStyleVar() ImGui.PopID() @@ -29272,7 +29306,7 @@ function ShowExampleMenuFile() ImGui.Separator() if ImGui.BeginMenu("Options") then _, s.enabled = ImGui.MenuItem("Enabled", "", s.enabled) - ImGui.BeginChild("child", ImVec2(0, ImGui.GetTextLineHeightWithSpacing() * 5.0), ImGuiChildFlags.Borders) + ImGui.BeginChild("child", ImVec2(0, ImGui.GetTextLineHeightWithSpacing() * 5.0), 1 --[[ImGuiChildFlags.Borders]]) for i = 0, 9 do ImGui.Text("Scrolling Text %d", i) end ImGui.EndChild() s.f = ImGui.SliderFloat("Value", s.f, 0.0, 1.0) @@ -29283,7 +29317,7 @@ function ShowExampleMenuFile() if ImGui.BeginMenu("Colors") then local sz = ImGui.GetTextLineHeight() - for i = 0, ImGuiCol.COUNT - 1 do + for i = 0, 63 --[[ImGuiCol.COUNT]] - 1 do local name = ImGui.GetStyleColorName(i) local p = ImGui.GetCursorScreenPos() ImGui.GetWindowDrawList():AddRectFilled(p, ImVec2(p.x + sz, p.y + sz), ImGui.GetColorU32(i)) @@ -29303,7 +29337,7 @@ function ShowExampleMenuFile() end if ImGui.BeginMenu("Disabled", false) then -- Disabled - IM_ASSERT(false) + assert(false) end if ImGui.MenuItem("Checked", nil, true) then end ImGui.Separator() @@ -29372,7 +29406,7 @@ function ImGui.ShowStyleSelector(label) local ret = false if ImGui.BeginCombo(label, style_names[s.style_idx + 1] or "") then for n = 0, 2 do - if ImGui.Selectable(style_names[n + 1], s.style_idx == n, ImGuiSelectableFlags.SelectOnNav) then + if ImGui.Selectable(style_names[n + 1], s.style_idx == n, 64 --[[ImGuiSelectableFlags.SelectOnNav]]) then s.style_idx = n ret = true if n == 0 then ImGui.StyleColorsDark() elseif n == 1 then ImGui.StyleColorsLight() else ImGui.StyleColorsClassic() end @@ -29418,7 +29452,7 @@ function ImGui.ShowStyleEditor(ref) -- General ImGui.SeparatorText("General") - if bit32.band(ImGui.GetIO().BackendFlags, ImGuiBackendFlags.RendererHasTextures) == 0 then + if bit32.band(ImGui.GetIO().BackendFlags, 16 --[[ImGuiBackendFlags.RendererHasTextures]]) == 0 then ImGui.BulletText("Warning: Font scaling will NOT be smooth, because\nImGuiBackendFlags_RendererHasTextures is not set!") ImGui.BulletText("For instructions, see:") ImGui.SameLine() @@ -29454,7 +29488,7 @@ function ImGui.ShowStyleEditor(ref) HelpMarker("Save/Revert in local non-persistent storage. Default Colors definition are not affected. Use \"Export\" below to save them somewhere.") ImGui.SeparatorText("Details") - if ImGui.BeginTabBar("##tabs", ImGuiTabBarFlags.None) then + if ImGui.BeginTabBar("##tabs", 0 --[[ImGuiTabBarFlags.None]]) then if ImGui.BeginTabItem("Sizes") then ImGui.SeparatorText("Main") SF2("WindowPadding", 0.0, 20.0); SF2("FramePadding", 0.0, 20.0); SF2("ItemSpacing", 0.0, 20.0) @@ -29545,7 +29579,7 @@ function ImGui.ShowStyleEditor(ref) if ImGui.Button("Export") then if se.output_dest == 0 then ImGui.LogToClipboard() else ImGui.LogToTTY() end ImGui.LogText("ImVec4* colors = GetStyle().Colors;\n") - for i = 0, ImGuiCol.COUNT - 1 do + for i = 0, 63 --[[ImGuiCol.COUNT]] - 1 do local col = style.Colors[i] local name = ImGui.GetStyleColorName(i) if not se.output_only_modified or not ColorsEqual(col, ref.Colors[i]) then @@ -29565,15 +29599,15 @@ function ImGui.ShowStyleEditor(ref) HelpMarker("In the color list:\nLeft-click on color square to open color picker,\nRight-click to open edit options menu.") se.filter = se.filter or ImGuiTextFilter() - ImGui.SetNextItemWidth(-FLT_MIN) + ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) se.filter:DrawWithHint("##FilterColors", "Filter Colors (incl -excl)") - ImGui.SetNextWindowSizeConstraints(ImVec2(0.0, ImGui.GetTextLineHeightWithSpacing() * 10), ImVec2(FLT_MAX, FLT_MAX)) - ImGui.BeginChild("##colors", ImVec2(0, 0), bit32.bor(ImGuiChildFlags.Borders, ImGuiChildFlags.NavFlattened), bit32.bor(ImGuiWindowFlags.AlwaysVerticalScrollbar, ImGuiWindowFlags.AlwaysHorizontalScrollbar)) + ImGui.SetNextWindowSizeConstraints(ImVec2(0.0, ImGui.GetTextLineHeightWithSpacing() * 10), ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]])) + ImGui.BeginChild("##colors", ImVec2(0, 0), bit32.bor(1 --[[ImGuiChildFlags.Borders]], 256 --[[ImGuiChildFlags.NavFlattened]]), bit32.bor(16384 --[[ImGuiWindowFlags.AlwaysVerticalScrollbar]], 32768 --[[ImGuiWindowFlags.AlwaysHorizontalScrollbar]])) ImGui.PushItemWidth(ImGui.GetFontSize() * -12) -- [Luau] clipped: only visible rows are submitted (upstream submits every color) local visible_cols = {} - for i = 0, ImGuiCol.COUNT - 1 do + for i = 0, 63 --[[ImGuiCol.COUNT]] - 1 do if se.filter:PassFilter(ImGui.GetStyleColorName(i)) then visible_cols[#visible_cols + 1] = i end end local clipper = ImGuiListClipper() @@ -29630,7 +29664,7 @@ function ImGui.ShowStyleEditor(ref) style.CurveTessellationTol = curve_err * curve_err -- When editing the "Circle Segment Max Error" value, draw a preview of its effect on auto-tessellated circles. - style.CircleTessellationMaxError = ImGui.DragFloat("Circle Tessellation Max Error", style.CircleTessellationMaxError, 0.005, 0.10, 5.0, "%.2f", ImGuiSliderFlags.AlwaysClamp) + style.CircleTessellationMaxError = ImGui.DragFloat("Circle Tessellation Max Error", style.CircleTessellationMaxError, 0.005, 0.10, 5.0, "%.2f", 1536 --[[ImGuiSliderFlags.AlwaysClamp]]) local show_samples = ImGui.IsItemActive() if show_samples then ImGui.SetNextWindowPos(ImGui.GetCursorScreenPos()) end if show_samples and ImGui.BeginTooltip() then @@ -29649,7 +29683,7 @@ function ImGui.ShowStyleEditor(ref) local offset_x = math.floor(canvas_width * 0.5) local offset_y = math.floor(RAD_MAX) local p1 = ImGui.GetCursorScreenPos() - draw_list:AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad, ImGui.GetColorU32(ImGuiCol.Text)) + draw_list:AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad, ImGui.GetColorU32(0 --[[ImGuiCol.Text]])) ImGui.Dummy(ImVec2(canvas_width, RAD_MAX * 2)) -- local p2 = ImGui.GetCursorScreenPos() @@ -29687,9 +29721,9 @@ local _ local show_config_info = false function ImGui.ShowAboutWindow(p_open) local visible - p_open, visible = ImGui.Begin("About Dear ImGui", p_open, ImGuiWindowFlags.AlwaysAutoResize) + p_open, visible = ImGui.Begin("About Dear ImGui", p_open, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) if not visible then ImGui.End(); return p_open end - ImGui.Text("Dear ImGui %s (%d)", IMGUI_VERSION, IMGUI_VERSION_NUM) + ImGui.Text("Dear ImGui %s (%d)", IMGUI_VERSION, 19298 --[[IMGUI_VERSION_NUM]]) ImGui.TextLinkOpenURL("Homepage", "https://github.com/ocornut/imgui"); ImGui.SameLine() ImGui.TextLinkOpenURL("FAQ", "https://github.com/ocornut/imgui/blob/master/docs/FAQ.md"); ImGui.SameLine() ImGui.TextLinkOpenURL("Wiki", "https://github.com/ocornut/imgui/wiki"); ImGui.SameLine() @@ -29709,13 +29743,13 @@ function ImGui.ShowAboutWindow(p_open) local style = ImGui.GetStyle() local copy_to_clipboard = ImGui.Button("Copy to clipboard") local child_size = ImVec2(0, ImGui.GetTextLineHeightWithSpacing() * 18) - ImGui.BeginChild(ImGui.GetID("cfg_infos"), child_size, ImGuiChildFlags.FrameStyle) + ImGui.BeginChild(ImGui.GetID("cfg_infos"), child_size, 128 --[[ImGuiChildFlags.FrameStyle]]) if copy_to_clipboard then ImGui.LogToClipboard() ImGui.LogText("// (Copy from the next line. Keep the ``` markers for formatting.)\n") ImGui.LogText("```cpp\n") -- Back quotes will make text appears without formatting when pasting on GitHub end - ImGui.Text("Dear ImGui %s (%d)", IMGUI_VERSION, IMGUI_VERSION_NUM) + ImGui.Text("Dear ImGui %s (%d)", IMGUI_VERSION, 19298 --[[IMGUI_VERSION_NUM]]) ImGui.Separator() ImGui.Text("define: IMGUI_HAS_VIEWPORT") ImGui.Text("define: IMGUI_HAS_DOCK") @@ -29903,69 +29937,69 @@ function ImGui.StyleColorsDark(dst) local style = dst and dst or ImGui.GetStyle() local colors = style.Colors - colors[ImGuiCol.Text] = ImVec4(1.00, 1.00, 1.00, 1.00) - colors[ImGuiCol.TextDisabled] = ImVec4(0.50, 0.50, 0.50, 1.00) - colors[ImGuiCol.WindowBg] = ImVec4(0.06, 0.06, 0.06, 0.94) - colors[ImGuiCol.ChildBg] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.PopupBg] = ImVec4(0.08, 0.08, 0.08, 0.94) - colors[ImGuiCol.Border] = ImVec4(0.43, 0.43, 0.50, 0.50) - colors[ImGuiCol.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.FrameBg] = ImVec4(0.16, 0.29, 0.48, 0.54) - colors[ImGuiCol.FrameBgHovered] = ImVec4(0.26, 0.59, 0.98, 0.40) - colors[ImGuiCol.FrameBgActive] = ImVec4(0.26, 0.59, 0.98, 0.67) - colors[ImGuiCol.TitleBg] = ImVec4(0.04, 0.04, 0.04, 1.00) - colors[ImGuiCol.TitleBgActive] = ImVec4(0.16, 0.29, 0.48, 1.00) - colors[ImGuiCol.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.51) - colors[ImGuiCol.MenuBarBg] = ImVec4(0.14, 0.14, 0.14, 1.00) - colors[ImGuiCol.ScrollbarBg] = ImVec4(0.02, 0.02, 0.02, 0.53) - colors[ImGuiCol.ScrollbarGrab] = ImVec4(0.31, 0.31, 0.31, 1.00) - colors[ImGuiCol.ScrollbarGrabHovered] = ImVec4(0.41, 0.41, 0.41, 1.00) - colors[ImGuiCol.ScrollbarGrabActive] = ImVec4(0.51, 0.51, 0.51, 1.00) - colors[ImGuiCol.CheckMark] = ImVec4(0.26, 0.59, 0.98, 1.00) - colors[ImGuiCol.CheckboxSelectedBg] = ImLerpV4V4F(colors[ImGuiCol.FrameBg], colors[ImGuiCol.FrameBgHovered], 0.65) - colors[ImGuiCol.SliderGrab] = ImVec4(0.24, 0.52, 0.88, 1.00) - colors[ImGuiCol.SliderGrabActive] = ImVec4(0.26, 0.59, 0.98, 1.00) - colors[ImGuiCol.Button] = ImVec4(0.26, 0.59, 0.98, 0.40) - colors[ImGuiCol.ButtonHovered] = ImVec4(0.26, 0.59, 0.98, 1.00) - colors[ImGuiCol.ButtonActive] = ImVec4(0.06, 0.53, 0.98, 1.00) - colors[ImGuiCol.Header] = ImVec4(0.26, 0.59, 0.98, 0.31) - colors[ImGuiCol.HeaderHovered] = ImVec4(0.26, 0.59, 0.98, 0.80) - colors[ImGuiCol.HeaderActive] = ImVec4(0.26, 0.59, 0.98, 1.00) - colors[ImGuiCol.Separator] = colors[ImGuiCol.Border] - colors[ImGuiCol.SeparatorHovered] = ImVec4(0.10, 0.40, 0.75, 0.78) - colors[ImGuiCol.SeparatorActive] = ImVec4(0.10, 0.40, 0.75, 1.00) - colors[ImGuiCol.ResizeGrip] = ImVec4(0.26, 0.59, 0.98, 0.20) - colors[ImGuiCol.ResizeGripHovered] = ImVec4(0.26, 0.59, 0.98, 0.67) - colors[ImGuiCol.ResizeGripActive] = ImVec4(0.26, 0.59, 0.98, 0.95) - colors[ImGuiCol.InputTextCursor] = colors[ImGuiCol.Text] - colors[ImGuiCol.TabHovered] = colors[ImGuiCol.HeaderHovered] - colors[ImGuiCol.Tab] = ImLerpV4V4F(colors[ImGuiCol.Header], colors[ImGuiCol.TitleBgActive], 0.80) - colors[ImGuiCol.TabSelected] = ImLerpV4V4F(colors[ImGuiCol.HeaderActive], colors[ImGuiCol.TitleBgActive], 0.60) - colors[ImGuiCol.TabSelectedOverline] = colors[ImGuiCol.HeaderActive] - colors[ImGuiCol.TabDimmed] = ImLerpV4V4F(colors[ImGuiCol.Tab], colors[ImGuiCol.TitleBg], 0.80) - colors[ImGuiCol.TabDimmedSelected] = ImLerpV4V4F(colors[ImGuiCol.TabSelected], colors[ImGuiCol.TitleBg], 0.40) - colors[ImGuiCol.TabDimmedSelectedOverline] = ImVec4(0.50, 0.50, 0.50, 0.00) - colors[ImGuiCol.DockingPreview] = ImVec4(colors[ImGuiCol.HeaderActive].x, colors[ImGuiCol.HeaderActive].y, colors[ImGuiCol.HeaderActive].z, colors[ImGuiCol.HeaderActive].w * 0.7) - colors[ImGuiCol.DockingEmptyBg] = ImVec4(0.20, 0.20, 0.20, 1.00) - colors[ImGuiCol.PlotLines] = ImVec4(0.61, 0.61, 0.61, 1.00) - colors[ImGuiCol.PlotLinesHovered] = ImVec4(1.00, 0.43, 0.35, 1.00) - colors[ImGuiCol.PlotHistogram] = ImVec4(0.90, 0.70, 0.00, 1.00) - colors[ImGuiCol.PlotHistogramHovered] = ImVec4(1.00, 0.60, 0.00, 1.00) - colors[ImGuiCol.TableHeaderBg] = ImVec4(0.19, 0.19, 0.20, 1.00) - colors[ImGuiCol.TableBorderStrong] = ImVec4(0.31, 0.31, 0.35, 1.00) -- Prefer using Alpha=1.0 here - colors[ImGuiCol.TableBorderLight] = ImVec4(0.23, 0.23, 0.25, 1.00) -- Prefer using Alpha=1.0 here - colors[ImGuiCol.TableRowBg] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.TableRowBgAlt] = ImVec4(1.00, 1.00, 1.00, 0.06) - colors[ImGuiCol.TextLink] = colors[ImGuiCol.HeaderActive] - colors[ImGuiCol.TextSelectedBg] = ImVec4(0.26, 0.59, 0.98, 0.35) - colors[ImGuiCol.TreeLines] = colors[ImGuiCol.Border] - colors[ImGuiCol.DragDropTarget] = ImVec4(1.00, 1.00, 0.00, 0.90) - colors[ImGuiCol.DragDropTargetBg] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.UnsavedMarker] = ImVec4(1.00, 1.00, 1.00, 1.00) - colors[ImGuiCol.NavCursor] = ImVec4(0.26, 0.59, 0.98, 1.00) - colors[ImGuiCol.NavWindowingHighlight] = ImVec4(1.00, 1.00, 1.00, 0.70) - colors[ImGuiCol.NavWindowingDimBg] = ImVec4(0.80, 0.80, 0.80, 0.20) - colors[ImGuiCol.ModalWindowDimBg] = ImVec4(0.80, 0.80, 0.80, 0.35) + colors[0 --[[ImGuiCol.Text]]] = ImVec4(1.00, 1.00, 1.00, 1.00) + colors[1 --[[ImGuiCol.TextDisabled]]] = ImVec4(0.50, 0.50, 0.50, 1.00) + colors[2 --[[ImGuiCol.WindowBg]]] = ImVec4(0.06, 0.06, 0.06, 0.94) + colors[3 --[[ImGuiCol.ChildBg]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[4 --[[ImGuiCol.PopupBg]]] = ImVec4(0.08, 0.08, 0.08, 0.94) + colors[5 --[[ImGuiCol.Border]]] = ImVec4(0.43, 0.43, 0.50, 0.50) + colors[6 --[[ImGuiCol.BorderShadow]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[7 --[[ImGuiCol.FrameBg]]] = ImVec4(0.16, 0.29, 0.48, 0.54) + colors[8 --[[ImGuiCol.FrameBgHovered]]] = ImVec4(0.26, 0.59, 0.98, 0.40) + colors[9 --[[ImGuiCol.FrameBgActive]]] = ImVec4(0.26, 0.59, 0.98, 0.67) + colors[10 --[[ImGuiCol.TitleBg]]] = ImVec4(0.04, 0.04, 0.04, 1.00) + colors[11 --[[ImGuiCol.TitleBgActive]]] = ImVec4(0.16, 0.29, 0.48, 1.00) + colors[12 --[[ImGuiCol.TitleBgCollapsed]]] = ImVec4(0.00, 0.00, 0.00, 0.51) + colors[13 --[[ImGuiCol.MenuBarBg]]] = ImVec4(0.14, 0.14, 0.14, 1.00) + colors[14 --[[ImGuiCol.ScrollbarBg]]] = ImVec4(0.02, 0.02, 0.02, 0.53) + colors[15 --[[ImGuiCol.ScrollbarGrab]]] = ImVec4(0.31, 0.31, 0.31, 1.00) + colors[16 --[[ImGuiCol.ScrollbarGrabHovered]]] = ImVec4(0.41, 0.41, 0.41, 1.00) + colors[17 --[[ImGuiCol.ScrollbarGrabActive]]] = ImVec4(0.51, 0.51, 0.51, 1.00) + colors[18 --[[ImGuiCol.CheckMark]]] = ImVec4(0.26, 0.59, 0.98, 1.00) + colors[19 --[[ImGuiCol.CheckboxSelectedBg]]] = ImLerpV4V4F(colors[7 --[[ImGuiCol.FrameBg]]], colors[8 --[[ImGuiCol.FrameBgHovered]]], 0.65) + colors[20 --[[ImGuiCol.SliderGrab]]] = ImVec4(0.24, 0.52, 0.88, 1.00) + colors[21 --[[ImGuiCol.SliderGrabActive]]] = ImVec4(0.26, 0.59, 0.98, 1.00) + colors[22 --[[ImGuiCol.Button]]] = ImVec4(0.26, 0.59, 0.98, 0.40) + colors[23 --[[ImGuiCol.ButtonHovered]]] = ImVec4(0.26, 0.59, 0.98, 1.00) + colors[24 --[[ImGuiCol.ButtonActive]]] = ImVec4(0.06, 0.53, 0.98, 1.00) + colors[25 --[[ImGuiCol.Header]]] = ImVec4(0.26, 0.59, 0.98, 0.31) + colors[26 --[[ImGuiCol.HeaderHovered]]] = ImVec4(0.26, 0.59, 0.98, 0.80) + colors[27 --[[ImGuiCol.HeaderActive]]] = ImVec4(0.26, 0.59, 0.98, 1.00) + colors[28 --[[ImGuiCol.Separator]]] = colors[5 --[[ImGuiCol.Border]]] + colors[29 --[[ImGuiCol.SeparatorHovered]]] = ImVec4(0.10, 0.40, 0.75, 0.78) + colors[30 --[[ImGuiCol.SeparatorActive]]] = ImVec4(0.10, 0.40, 0.75, 1.00) + colors[31 --[[ImGuiCol.ResizeGrip]]] = ImVec4(0.26, 0.59, 0.98, 0.20) + colors[32 --[[ImGuiCol.ResizeGripHovered]]] = ImVec4(0.26, 0.59, 0.98, 0.67) + colors[33 --[[ImGuiCol.ResizeGripActive]]] = ImVec4(0.26, 0.59, 0.98, 0.95) + colors[34 --[[ImGuiCol.InputTextCursor]]] = colors[0 --[[ImGuiCol.Text]]] + colors[35 --[[ImGuiCol.TabHovered]]] = colors[26 --[[ImGuiCol.HeaderHovered]]] + colors[36 --[[ImGuiCol.Tab]]] = ImLerpV4V4F(colors[25 --[[ImGuiCol.Header]]], colors[11 --[[ImGuiCol.TitleBgActive]]], 0.80) + colors[37 --[[ImGuiCol.TabSelected]]] = ImLerpV4V4F(colors[27 --[[ImGuiCol.HeaderActive]]], colors[11 --[[ImGuiCol.TitleBgActive]]], 0.60) + colors[38 --[[ImGuiCol.TabSelectedOverline]]] = colors[27 --[[ImGuiCol.HeaderActive]]] + colors[39 --[[ImGuiCol.TabDimmed]]] = ImLerpV4V4F(colors[36 --[[ImGuiCol.Tab]]], colors[10 --[[ImGuiCol.TitleBg]]], 0.80) + colors[40 --[[ImGuiCol.TabDimmedSelected]]] = ImLerpV4V4F(colors[37 --[[ImGuiCol.TabSelected]]], colors[10 --[[ImGuiCol.TitleBg]]], 0.40) + colors[41 --[[ImGuiCol.TabDimmedSelectedOverline]]] = ImVec4(0.50, 0.50, 0.50, 0.00) + colors[42 --[[ImGuiCol.DockingPreview]]] = ImVec4(colors[27 --[[ImGuiCol.HeaderActive]]].x, colors[27 --[[ImGuiCol.HeaderActive]]].y, colors[27 --[[ImGuiCol.HeaderActive]]].z, colors[27 --[[ImGuiCol.HeaderActive]]].w * 0.7) + colors[43 --[[ImGuiCol.DockingEmptyBg]]] = ImVec4(0.20, 0.20, 0.20, 1.00) + colors[44 --[[ImGuiCol.PlotLines]]] = ImVec4(0.61, 0.61, 0.61, 1.00) + colors[45 --[[ImGuiCol.PlotLinesHovered]]] = ImVec4(1.00, 0.43, 0.35, 1.00) + colors[46 --[[ImGuiCol.PlotHistogram]]] = ImVec4(0.90, 0.70, 0.00, 1.00) + colors[47 --[[ImGuiCol.PlotHistogramHovered]]] = ImVec4(1.00, 0.60, 0.00, 1.00) + colors[48 --[[ImGuiCol.TableHeaderBg]]] = ImVec4(0.19, 0.19, 0.20, 1.00) + colors[49 --[[ImGuiCol.TableBorderStrong]]] = ImVec4(0.31, 0.31, 0.35, 1.00) -- Prefer using Alpha=1.0 here + colors[50 --[[ImGuiCol.TableBorderLight]]] = ImVec4(0.23, 0.23, 0.25, 1.00) -- Prefer using Alpha=1.0 here + colors[51 --[[ImGuiCol.TableRowBg]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[52 --[[ImGuiCol.TableRowBgAlt]]] = ImVec4(1.00, 1.00, 1.00, 0.06) + colors[53 --[[ImGuiCol.TextLink]]] = colors[27 --[[ImGuiCol.HeaderActive]]] + colors[54 --[[ImGuiCol.TextSelectedBg]]] = ImVec4(0.26, 0.59, 0.98, 0.35) + colors[55 --[[ImGuiCol.TreeLines]]] = colors[5 --[[ImGuiCol.Border]]] + colors[56 --[[ImGuiCol.DragDropTarget]]] = ImVec4(1.00, 1.00, 0.00, 0.90) + colors[57 --[[ImGuiCol.DragDropTargetBg]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[58 --[[ImGuiCol.UnsavedMarker]]] = ImVec4(1.00, 1.00, 1.00, 1.00) + colors[59 --[[ImGuiCol.NavCursor]]] = ImVec4(0.26, 0.59, 0.98, 1.00) + colors[60 --[[ImGuiCol.NavWindowingHighlight]]] = ImVec4(1.00, 1.00, 1.00, 0.70) + colors[61 --[[ImGuiCol.NavWindowingDimBg]]] = ImVec4(0.80, 0.80, 0.80, 0.20) + colors[62 --[[ImGuiCol.ModalWindowDimBg]]] = ImVec4(0.80, 0.80, 0.80, 0.35) end --- @param dst? ImGuiStyle @@ -29973,69 +30007,69 @@ function ImGui.StyleColorsClassic(dst) local style = dst and dst or ImGui.GetStyle() local colors = style.Colors - colors[ImGuiCol.Text] = ImVec4(0.90, 0.90, 0.90, 1.00) - colors[ImGuiCol.TextDisabled] = ImVec4(0.60, 0.60, 0.60, 1.00) - colors[ImGuiCol.WindowBg] = ImVec4(0.00, 0.00, 0.00, 0.85) - colors[ImGuiCol.ChildBg] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.PopupBg] = ImVec4(0.11, 0.11, 0.14, 0.92) - colors[ImGuiCol.Border] = ImVec4(0.50, 0.50, 0.50, 0.50) - colors[ImGuiCol.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.FrameBg] = ImVec4(0.43, 0.43, 0.43, 0.39) - colors[ImGuiCol.FrameBgHovered] = ImVec4(0.47, 0.47, 0.69, 0.40) - colors[ImGuiCol.FrameBgActive] = ImVec4(0.42, 0.41, 0.64, 0.69) - colors[ImGuiCol.TitleBg] = ImVec4(0.27, 0.27, 0.54, 0.83) - colors[ImGuiCol.TitleBgActive] = ImVec4(0.32, 0.32, 0.63, 0.87) - colors[ImGuiCol.TitleBgCollapsed] = ImVec4(0.40, 0.40, 0.80, 0.20) - colors[ImGuiCol.MenuBarBg] = ImVec4(0.40, 0.40, 0.55, 0.80) - colors[ImGuiCol.ScrollbarBg] = ImVec4(0.20, 0.25, 0.30, 0.60) - colors[ImGuiCol.ScrollbarGrab] = ImVec4(0.40, 0.40, 0.80, 0.30) - colors[ImGuiCol.ScrollbarGrabHovered] = ImVec4(0.40, 0.40, 0.80, 0.40) - colors[ImGuiCol.ScrollbarGrabActive] = ImVec4(0.41, 0.39, 0.80, 0.60) - colors[ImGuiCol.CheckMark] = ImVec4(0.90, 0.90, 0.90, 0.50) - colors[ImGuiCol.CheckboxSelectedBg] = ImLerpV4V4F(colors[ImGuiCol.FrameBg], colors[ImGuiCol.FrameBgActive], 0.65) - colors[ImGuiCol.SliderGrab] = ImVec4(1.00, 1.00, 1.00, 0.30) - colors[ImGuiCol.SliderGrabActive] = ImVec4(0.41, 0.39, 0.80, 0.60) - colors[ImGuiCol.Button] = ImVec4(0.35, 0.40, 0.61, 0.62) - colors[ImGuiCol.ButtonHovered] = ImVec4(0.40, 0.48, 0.71, 0.79) - colors[ImGuiCol.ButtonActive] = ImVec4(0.46, 0.54, 0.80, 1.00) - colors[ImGuiCol.Header] = ImVec4(0.40, 0.40, 0.90, 0.45) - colors[ImGuiCol.HeaderHovered] = ImVec4(0.45, 0.45, 0.90, 0.80) - colors[ImGuiCol.HeaderActive] = ImVec4(0.53, 0.53, 0.87, 0.80) - colors[ImGuiCol.Separator] = ImVec4(0.50, 0.50, 0.50, 0.60) - colors[ImGuiCol.SeparatorHovered] = ImVec4(0.60, 0.60, 0.70, 1.00) - colors[ImGuiCol.SeparatorActive] = ImVec4(0.70, 0.70, 0.90, 1.00) - colors[ImGuiCol.ResizeGrip] = ImVec4(1.00, 1.00, 1.00, 0.10) - colors[ImGuiCol.ResizeGripHovered] = ImVec4(0.78, 0.82, 1.00, 0.60) - colors[ImGuiCol.ResizeGripActive] = ImVec4(0.78, 0.82, 1.00, 0.90) - colors[ImGuiCol.InputTextCursor] = colors[ImGuiCol.Text] - colors[ImGuiCol.TabHovered] = colors[ImGuiCol.HeaderHovered] - colors[ImGuiCol.Tab] = ImLerpV4V4F(colors[ImGuiCol.Header], colors[ImGuiCol.TitleBgActive], 0.80) - colors[ImGuiCol.TabSelected] = ImLerpV4V4F(colors[ImGuiCol.HeaderActive], colors[ImGuiCol.TitleBgActive], 0.60) - colors[ImGuiCol.TabSelectedOverline] = colors[ImGuiCol.HeaderActive] - colors[ImGuiCol.TabDimmed] = ImLerpV4V4F(colors[ImGuiCol.Tab], colors[ImGuiCol.TitleBg], 0.80) - colors[ImGuiCol.TabDimmedSelected] = ImLerpV4V4F(colors[ImGuiCol.TabSelected], colors[ImGuiCol.TitleBg], 0.40) - colors[ImGuiCol.TabDimmedSelectedOverline] = ImVec4(0.53, 0.53, 0.87, 0.00) - colors[ImGuiCol.DockingPreview] = ImVec4(colors[ImGuiCol.Header].x, colors[ImGuiCol.Header].y, colors[ImGuiCol.Header].z, colors[ImGuiCol.Header].w * 0.7) - colors[ImGuiCol.DockingEmptyBg] = ImVec4(0.20, 0.20, 0.20, 1.00) - colors[ImGuiCol.PlotLines] = ImVec4(1.00, 1.00, 1.00, 1.00) - colors[ImGuiCol.PlotLinesHovered] = ImVec4(0.90, 0.70, 0.00, 1.00) - colors[ImGuiCol.PlotHistogram] = ImVec4(0.90, 0.70, 0.00, 1.00) - colors[ImGuiCol.PlotHistogramHovered] = ImVec4(1.00, 0.60, 0.00, 1.00) - colors[ImGuiCol.TableHeaderBg] = ImVec4(0.27, 0.27, 0.38, 1.00) - colors[ImGuiCol.TableBorderStrong] = ImVec4(0.31, 0.31, 0.45, 1.00) -- Prefer using Alpha=1.0 here - colors[ImGuiCol.TableBorderLight] = ImVec4(0.26, 0.26, 0.28, 1.00) -- Prefer using Alpha=1.0 here - colors[ImGuiCol.TableRowBg] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.TableRowBgAlt] = ImVec4(1.00, 1.00, 1.00, 0.07) - colors[ImGuiCol.TextLink] = colors[ImGuiCol.HeaderActive] - colors[ImGuiCol.TextSelectedBg] = ImVec4(0.00, 0.00, 1.00, 0.35) - colors[ImGuiCol.TreeLines] = colors[ImGuiCol.Border] - colors[ImGuiCol.DragDropTarget] = ImVec4(1.00, 1.00, 0.00, 0.90) - colors[ImGuiCol.DragDropTargetBg] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.UnsavedMarker] = ImVec4(0.90, 0.90, 0.90, 1.00) - colors[ImGuiCol.NavCursor] = colors[ImGuiCol.HeaderHovered] - colors[ImGuiCol.NavWindowingHighlight] = ImVec4(1.00, 1.00, 1.00, 0.70) - colors[ImGuiCol.NavWindowingDimBg] = ImVec4(0.80, 0.80, 0.80, 0.20) - colors[ImGuiCol.ModalWindowDimBg] = ImVec4(0.20, 0.20, 0.20, 0.35) + colors[0 --[[ImGuiCol.Text]]] = ImVec4(0.90, 0.90, 0.90, 1.00) + colors[1 --[[ImGuiCol.TextDisabled]]] = ImVec4(0.60, 0.60, 0.60, 1.00) + colors[2 --[[ImGuiCol.WindowBg]]] = ImVec4(0.00, 0.00, 0.00, 0.85) + colors[3 --[[ImGuiCol.ChildBg]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[4 --[[ImGuiCol.PopupBg]]] = ImVec4(0.11, 0.11, 0.14, 0.92) + colors[5 --[[ImGuiCol.Border]]] = ImVec4(0.50, 0.50, 0.50, 0.50) + colors[6 --[[ImGuiCol.BorderShadow]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[7 --[[ImGuiCol.FrameBg]]] = ImVec4(0.43, 0.43, 0.43, 0.39) + colors[8 --[[ImGuiCol.FrameBgHovered]]] = ImVec4(0.47, 0.47, 0.69, 0.40) + colors[9 --[[ImGuiCol.FrameBgActive]]] = ImVec4(0.42, 0.41, 0.64, 0.69) + colors[10 --[[ImGuiCol.TitleBg]]] = ImVec4(0.27, 0.27, 0.54, 0.83) + colors[11 --[[ImGuiCol.TitleBgActive]]] = ImVec4(0.32, 0.32, 0.63, 0.87) + colors[12 --[[ImGuiCol.TitleBgCollapsed]]] = ImVec4(0.40, 0.40, 0.80, 0.20) + colors[13 --[[ImGuiCol.MenuBarBg]]] = ImVec4(0.40, 0.40, 0.55, 0.80) + colors[14 --[[ImGuiCol.ScrollbarBg]]] = ImVec4(0.20, 0.25, 0.30, 0.60) + colors[15 --[[ImGuiCol.ScrollbarGrab]]] = ImVec4(0.40, 0.40, 0.80, 0.30) + colors[16 --[[ImGuiCol.ScrollbarGrabHovered]]] = ImVec4(0.40, 0.40, 0.80, 0.40) + colors[17 --[[ImGuiCol.ScrollbarGrabActive]]] = ImVec4(0.41, 0.39, 0.80, 0.60) + colors[18 --[[ImGuiCol.CheckMark]]] = ImVec4(0.90, 0.90, 0.90, 0.50) + colors[19 --[[ImGuiCol.CheckboxSelectedBg]]] = ImLerpV4V4F(colors[7 --[[ImGuiCol.FrameBg]]], colors[9 --[[ImGuiCol.FrameBgActive]]], 0.65) + colors[20 --[[ImGuiCol.SliderGrab]]] = ImVec4(1.00, 1.00, 1.00, 0.30) + colors[21 --[[ImGuiCol.SliderGrabActive]]] = ImVec4(0.41, 0.39, 0.80, 0.60) + colors[22 --[[ImGuiCol.Button]]] = ImVec4(0.35, 0.40, 0.61, 0.62) + colors[23 --[[ImGuiCol.ButtonHovered]]] = ImVec4(0.40, 0.48, 0.71, 0.79) + colors[24 --[[ImGuiCol.ButtonActive]]] = ImVec4(0.46, 0.54, 0.80, 1.00) + colors[25 --[[ImGuiCol.Header]]] = ImVec4(0.40, 0.40, 0.90, 0.45) + colors[26 --[[ImGuiCol.HeaderHovered]]] = ImVec4(0.45, 0.45, 0.90, 0.80) + colors[27 --[[ImGuiCol.HeaderActive]]] = ImVec4(0.53, 0.53, 0.87, 0.80) + colors[28 --[[ImGuiCol.Separator]]] = ImVec4(0.50, 0.50, 0.50, 0.60) + colors[29 --[[ImGuiCol.SeparatorHovered]]] = ImVec4(0.60, 0.60, 0.70, 1.00) + colors[30 --[[ImGuiCol.SeparatorActive]]] = ImVec4(0.70, 0.70, 0.90, 1.00) + colors[31 --[[ImGuiCol.ResizeGrip]]] = ImVec4(1.00, 1.00, 1.00, 0.10) + colors[32 --[[ImGuiCol.ResizeGripHovered]]] = ImVec4(0.78, 0.82, 1.00, 0.60) + colors[33 --[[ImGuiCol.ResizeGripActive]]] = ImVec4(0.78, 0.82, 1.00, 0.90) + colors[34 --[[ImGuiCol.InputTextCursor]]] = colors[0 --[[ImGuiCol.Text]]] + colors[35 --[[ImGuiCol.TabHovered]]] = colors[26 --[[ImGuiCol.HeaderHovered]]] + colors[36 --[[ImGuiCol.Tab]]] = ImLerpV4V4F(colors[25 --[[ImGuiCol.Header]]], colors[11 --[[ImGuiCol.TitleBgActive]]], 0.80) + colors[37 --[[ImGuiCol.TabSelected]]] = ImLerpV4V4F(colors[27 --[[ImGuiCol.HeaderActive]]], colors[11 --[[ImGuiCol.TitleBgActive]]], 0.60) + colors[38 --[[ImGuiCol.TabSelectedOverline]]] = colors[27 --[[ImGuiCol.HeaderActive]]] + colors[39 --[[ImGuiCol.TabDimmed]]] = ImLerpV4V4F(colors[36 --[[ImGuiCol.Tab]]], colors[10 --[[ImGuiCol.TitleBg]]], 0.80) + colors[40 --[[ImGuiCol.TabDimmedSelected]]] = ImLerpV4V4F(colors[37 --[[ImGuiCol.TabSelected]]], colors[10 --[[ImGuiCol.TitleBg]]], 0.40) + colors[41 --[[ImGuiCol.TabDimmedSelectedOverline]]] = ImVec4(0.53, 0.53, 0.87, 0.00) + colors[42 --[[ImGuiCol.DockingPreview]]] = ImVec4(colors[25 --[[ImGuiCol.Header]]].x, colors[25 --[[ImGuiCol.Header]]].y, colors[25 --[[ImGuiCol.Header]]].z, colors[25 --[[ImGuiCol.Header]]].w * 0.7) + colors[43 --[[ImGuiCol.DockingEmptyBg]]] = ImVec4(0.20, 0.20, 0.20, 1.00) + colors[44 --[[ImGuiCol.PlotLines]]] = ImVec4(1.00, 1.00, 1.00, 1.00) + colors[45 --[[ImGuiCol.PlotLinesHovered]]] = ImVec4(0.90, 0.70, 0.00, 1.00) + colors[46 --[[ImGuiCol.PlotHistogram]]] = ImVec4(0.90, 0.70, 0.00, 1.00) + colors[47 --[[ImGuiCol.PlotHistogramHovered]]] = ImVec4(1.00, 0.60, 0.00, 1.00) + colors[48 --[[ImGuiCol.TableHeaderBg]]] = ImVec4(0.27, 0.27, 0.38, 1.00) + colors[49 --[[ImGuiCol.TableBorderStrong]]] = ImVec4(0.31, 0.31, 0.45, 1.00) -- Prefer using Alpha=1.0 here + colors[50 --[[ImGuiCol.TableBorderLight]]] = ImVec4(0.26, 0.26, 0.28, 1.00) -- Prefer using Alpha=1.0 here + colors[51 --[[ImGuiCol.TableRowBg]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[52 --[[ImGuiCol.TableRowBgAlt]]] = ImVec4(1.00, 1.00, 1.00, 0.07) + colors[53 --[[ImGuiCol.TextLink]]] = colors[27 --[[ImGuiCol.HeaderActive]]] + colors[54 --[[ImGuiCol.TextSelectedBg]]] = ImVec4(0.00, 0.00, 1.00, 0.35) + colors[55 --[[ImGuiCol.TreeLines]]] = colors[5 --[[ImGuiCol.Border]]] + colors[56 --[[ImGuiCol.DragDropTarget]]] = ImVec4(1.00, 1.00, 0.00, 0.90) + colors[57 --[[ImGuiCol.DragDropTargetBg]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[58 --[[ImGuiCol.UnsavedMarker]]] = ImVec4(0.90, 0.90, 0.90, 1.00) + colors[59 --[[ImGuiCol.NavCursor]]] = colors[26 --[[ImGuiCol.HeaderHovered]]] + colors[60 --[[ImGuiCol.NavWindowingHighlight]]] = ImVec4(1.00, 1.00, 1.00, 0.70) + colors[61 --[[ImGuiCol.NavWindowingDimBg]]] = ImVec4(0.80, 0.80, 0.80, 0.20) + colors[62 --[[ImGuiCol.ModalWindowDimBg]]] = ImVec4(0.20, 0.20, 0.20, 0.35) end -- Those light colors are better suited with a thicker font than the default one + FrameBorder @@ -30044,69 +30078,69 @@ function ImGui.StyleColorsLight(dst) local style = dst and dst or ImGui.GetStyle() local colors = style.Colors - colors[ImGuiCol.Text] = ImVec4(0.00, 0.00, 0.00, 1.00) - colors[ImGuiCol.TextDisabled] = ImVec4(0.60, 0.60, 0.60, 1.00) - colors[ImGuiCol.WindowBg] = ImVec4(0.94, 0.94, 0.94, 1.00) - colors[ImGuiCol.ChildBg] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.PopupBg] = ImVec4(1.00, 1.00, 1.00, 0.98) - colors[ImGuiCol.Border] = ImVec4(0.00, 0.00, 0.00, 0.30) - colors[ImGuiCol.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.FrameBg] = ImVec4(1.00, 1.00, 1.00, 1.00) - colors[ImGuiCol.FrameBgHovered] = ImVec4(0.26, 0.59, 0.98, 0.40) - colors[ImGuiCol.FrameBgActive] = ImVec4(0.26, 0.59, 0.98, 0.67) - colors[ImGuiCol.TitleBg] = ImVec4(0.96, 0.96, 0.96, 1.00) - colors[ImGuiCol.TitleBgActive] = ImVec4(0.82, 0.82, 0.82, 1.00) - colors[ImGuiCol.TitleBgCollapsed] = ImVec4(1.00, 1.00, 1.00, 0.51) - colors[ImGuiCol.MenuBarBg] = ImVec4(0.86, 0.86, 0.86, 1.00) - colors[ImGuiCol.ScrollbarBg] = ImVec4(0.98, 0.98, 0.98, 0.53) - colors[ImGuiCol.ScrollbarGrab] = ImVec4(0.69, 0.69, 0.69, 0.80) - colors[ImGuiCol.ScrollbarGrabHovered] = ImVec4(0.49, 0.49, 0.49, 0.80) - colors[ImGuiCol.ScrollbarGrabActive] = ImVec4(0.49, 0.49, 0.49, 1.00) - colors[ImGuiCol.CheckMark] = ImVec4(0.26, 0.59, 0.98, 1.00) - colors[ImGuiCol.CheckboxSelectedBg] = ImVec4(0.95, 0.97, 1.00, 1.00) - colors[ImGuiCol.SliderGrab] = ImVec4(0.26, 0.59, 0.98, 0.78) - colors[ImGuiCol.SliderGrabActive] = ImVec4(0.46, 0.54, 0.80, 0.60) - colors[ImGuiCol.Button] = ImVec4(0.26, 0.59, 0.98, 0.40) - colors[ImGuiCol.ButtonHovered] = ImVec4(0.26, 0.59, 0.98, 1.00) - colors[ImGuiCol.ButtonActive] = ImVec4(0.06, 0.53, 0.98, 1.00) - colors[ImGuiCol.Header] = ImVec4(0.26, 0.59, 0.98, 0.31) - colors[ImGuiCol.HeaderHovered] = ImVec4(0.26, 0.59, 0.98, 0.80) - colors[ImGuiCol.HeaderActive] = ImVec4(0.26, 0.59, 0.98, 1.00) - colors[ImGuiCol.Separator] = ImVec4(0.39, 0.39, 0.39, 0.62) - colors[ImGuiCol.SeparatorHovered] = ImVec4(0.14, 0.44, 0.80, 0.78) - colors[ImGuiCol.SeparatorActive] = ImVec4(0.14, 0.44, 0.80, 1.00) - colors[ImGuiCol.ResizeGrip] = ImVec4(0.35, 0.35, 0.35, 0.17) - colors[ImGuiCol.ResizeGripHovered] = ImVec4(0.26, 0.59, 0.98, 0.67) - colors[ImGuiCol.ResizeGripActive] = ImVec4(0.26, 0.59, 0.98, 0.95) - colors[ImGuiCol.InputTextCursor] = colors[ImGuiCol.Text] - colors[ImGuiCol.TabHovered] = colors[ImGuiCol.HeaderHovered] - colors[ImGuiCol.Tab] = ImLerpV4V4F(colors[ImGuiCol.Header], colors[ImGuiCol.TitleBgActive], 0.90) - colors[ImGuiCol.TabSelected] = ImLerpV4V4F(colors[ImGuiCol.HeaderActive], colors[ImGuiCol.TitleBgActive], 0.60) - colors[ImGuiCol.TabSelectedOverline] = colors[ImGuiCol.HeaderActive] - colors[ImGuiCol.TabDimmed] = ImLerpV4V4F(colors[ImGuiCol.Tab], colors[ImGuiCol.TitleBg], 0.80) - colors[ImGuiCol.TabDimmedSelected] = ImLerpV4V4F(colors[ImGuiCol.TabSelected], colors[ImGuiCol.TitleBg], 0.40) - colors[ImGuiCol.TabDimmedSelectedOverline] = ImVec4(0.26, 0.59, 1.00, 0.00) - colors[ImGuiCol.DockingPreview] = ImVec4(colors[ImGuiCol.Header].x, colors[ImGuiCol.Header].y, colors[ImGuiCol.Header].z, colors[ImGuiCol.Header].w * 0.7) - colors[ImGuiCol.DockingEmptyBg] = ImVec4(0.68, 0.69, 0.73, 1.00) - colors[ImGuiCol.PlotLines] = ImVec4(0.39, 0.39, 0.39, 1.00) - colors[ImGuiCol.PlotLinesHovered] = ImVec4(1.00, 0.43, 0.35, 1.00) - colors[ImGuiCol.PlotHistogram] = ImVec4(0.90, 0.70, 0.00, 1.00) - colors[ImGuiCol.PlotHistogramHovered] = ImVec4(1.00, 0.45, 0.00, 1.00) - colors[ImGuiCol.TableHeaderBg] = ImVec4(0.78, 0.87, 0.98, 1.00) - colors[ImGuiCol.TableBorderStrong] = ImVec4(0.57, 0.57, 0.64, 1.00) -- Prefer using Alpha=1.0 here - colors[ImGuiCol.TableBorderLight] = ImVec4(0.68, 0.68, 0.74, 1.00) -- Prefer using Alpha=1.0 here - colors[ImGuiCol.TableRowBg] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.TableRowBgAlt] = ImVec4(0.30, 0.30, 0.30, 0.09) - colors[ImGuiCol.TextLink] = colors[ImGuiCol.HeaderActive] - colors[ImGuiCol.TextSelectedBg] = ImVec4(0.26, 0.59, 0.98, 0.35) - colors[ImGuiCol.TreeLines] = colors[ImGuiCol.Border] - colors[ImGuiCol.DragDropTarget] = ImVec4(0.26, 0.59, 0.98, 0.95) - colors[ImGuiCol.DragDropTargetBg] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.UnsavedMarker] = ImVec4(0.00, 0.00, 0.00, 1.00) - colors[ImGuiCol.NavCursor] = colors[ImGuiCol.HeaderHovered] - colors[ImGuiCol.NavWindowingHighlight] = ImVec4(0.70, 0.70, 0.70, 0.70) - colors[ImGuiCol.NavWindowingDimBg] = ImVec4(0.20, 0.20, 0.20, 0.20) - colors[ImGuiCol.ModalWindowDimBg] = ImVec4(0.20, 0.20, 0.20, 0.35) + colors[0 --[[ImGuiCol.Text]]] = ImVec4(0.00, 0.00, 0.00, 1.00) + colors[1 --[[ImGuiCol.TextDisabled]]] = ImVec4(0.60, 0.60, 0.60, 1.00) + colors[2 --[[ImGuiCol.WindowBg]]] = ImVec4(0.94, 0.94, 0.94, 1.00) + colors[3 --[[ImGuiCol.ChildBg]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[4 --[[ImGuiCol.PopupBg]]] = ImVec4(1.00, 1.00, 1.00, 0.98) + colors[5 --[[ImGuiCol.Border]]] = ImVec4(0.00, 0.00, 0.00, 0.30) + colors[6 --[[ImGuiCol.BorderShadow]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[7 --[[ImGuiCol.FrameBg]]] = ImVec4(1.00, 1.00, 1.00, 1.00) + colors[8 --[[ImGuiCol.FrameBgHovered]]] = ImVec4(0.26, 0.59, 0.98, 0.40) + colors[9 --[[ImGuiCol.FrameBgActive]]] = ImVec4(0.26, 0.59, 0.98, 0.67) + colors[10 --[[ImGuiCol.TitleBg]]] = ImVec4(0.96, 0.96, 0.96, 1.00) + colors[11 --[[ImGuiCol.TitleBgActive]]] = ImVec4(0.82, 0.82, 0.82, 1.00) + colors[12 --[[ImGuiCol.TitleBgCollapsed]]] = ImVec4(1.00, 1.00, 1.00, 0.51) + colors[13 --[[ImGuiCol.MenuBarBg]]] = ImVec4(0.86, 0.86, 0.86, 1.00) + colors[14 --[[ImGuiCol.ScrollbarBg]]] = ImVec4(0.98, 0.98, 0.98, 0.53) + colors[15 --[[ImGuiCol.ScrollbarGrab]]] = ImVec4(0.69, 0.69, 0.69, 0.80) + colors[16 --[[ImGuiCol.ScrollbarGrabHovered]]] = ImVec4(0.49, 0.49, 0.49, 0.80) + colors[17 --[[ImGuiCol.ScrollbarGrabActive]]] = ImVec4(0.49, 0.49, 0.49, 1.00) + colors[18 --[[ImGuiCol.CheckMark]]] = ImVec4(0.26, 0.59, 0.98, 1.00) + colors[19 --[[ImGuiCol.CheckboxSelectedBg]]] = ImVec4(0.95, 0.97, 1.00, 1.00) + colors[20 --[[ImGuiCol.SliderGrab]]] = ImVec4(0.26, 0.59, 0.98, 0.78) + colors[21 --[[ImGuiCol.SliderGrabActive]]] = ImVec4(0.46, 0.54, 0.80, 0.60) + colors[22 --[[ImGuiCol.Button]]] = ImVec4(0.26, 0.59, 0.98, 0.40) + colors[23 --[[ImGuiCol.ButtonHovered]]] = ImVec4(0.26, 0.59, 0.98, 1.00) + colors[24 --[[ImGuiCol.ButtonActive]]] = ImVec4(0.06, 0.53, 0.98, 1.00) + colors[25 --[[ImGuiCol.Header]]] = ImVec4(0.26, 0.59, 0.98, 0.31) + colors[26 --[[ImGuiCol.HeaderHovered]]] = ImVec4(0.26, 0.59, 0.98, 0.80) + colors[27 --[[ImGuiCol.HeaderActive]]] = ImVec4(0.26, 0.59, 0.98, 1.00) + colors[28 --[[ImGuiCol.Separator]]] = ImVec4(0.39, 0.39, 0.39, 0.62) + colors[29 --[[ImGuiCol.SeparatorHovered]]] = ImVec4(0.14, 0.44, 0.80, 0.78) + colors[30 --[[ImGuiCol.SeparatorActive]]] = ImVec4(0.14, 0.44, 0.80, 1.00) + colors[31 --[[ImGuiCol.ResizeGrip]]] = ImVec4(0.35, 0.35, 0.35, 0.17) + colors[32 --[[ImGuiCol.ResizeGripHovered]]] = ImVec4(0.26, 0.59, 0.98, 0.67) + colors[33 --[[ImGuiCol.ResizeGripActive]]] = ImVec4(0.26, 0.59, 0.98, 0.95) + colors[34 --[[ImGuiCol.InputTextCursor]]] = colors[0 --[[ImGuiCol.Text]]] + colors[35 --[[ImGuiCol.TabHovered]]] = colors[26 --[[ImGuiCol.HeaderHovered]]] + colors[36 --[[ImGuiCol.Tab]]] = ImLerpV4V4F(colors[25 --[[ImGuiCol.Header]]], colors[11 --[[ImGuiCol.TitleBgActive]]], 0.90) + colors[37 --[[ImGuiCol.TabSelected]]] = ImLerpV4V4F(colors[27 --[[ImGuiCol.HeaderActive]]], colors[11 --[[ImGuiCol.TitleBgActive]]], 0.60) + colors[38 --[[ImGuiCol.TabSelectedOverline]]] = colors[27 --[[ImGuiCol.HeaderActive]]] + colors[39 --[[ImGuiCol.TabDimmed]]] = ImLerpV4V4F(colors[36 --[[ImGuiCol.Tab]]], colors[10 --[[ImGuiCol.TitleBg]]], 0.80) + colors[40 --[[ImGuiCol.TabDimmedSelected]]] = ImLerpV4V4F(colors[37 --[[ImGuiCol.TabSelected]]], colors[10 --[[ImGuiCol.TitleBg]]], 0.40) + colors[41 --[[ImGuiCol.TabDimmedSelectedOverline]]] = ImVec4(0.26, 0.59, 1.00, 0.00) + colors[42 --[[ImGuiCol.DockingPreview]]] = ImVec4(colors[25 --[[ImGuiCol.Header]]].x, colors[25 --[[ImGuiCol.Header]]].y, colors[25 --[[ImGuiCol.Header]]].z, colors[25 --[[ImGuiCol.Header]]].w * 0.7) + colors[43 --[[ImGuiCol.DockingEmptyBg]]] = ImVec4(0.68, 0.69, 0.73, 1.00) + colors[44 --[[ImGuiCol.PlotLines]]] = ImVec4(0.39, 0.39, 0.39, 1.00) + colors[45 --[[ImGuiCol.PlotLinesHovered]]] = ImVec4(1.00, 0.43, 0.35, 1.00) + colors[46 --[[ImGuiCol.PlotHistogram]]] = ImVec4(0.90, 0.70, 0.00, 1.00) + colors[47 --[[ImGuiCol.PlotHistogramHovered]]] = ImVec4(1.00, 0.45, 0.00, 1.00) + colors[48 --[[ImGuiCol.TableHeaderBg]]] = ImVec4(0.78, 0.87, 0.98, 1.00) + colors[49 --[[ImGuiCol.TableBorderStrong]]] = ImVec4(0.57, 0.57, 0.64, 1.00) -- Prefer using Alpha=1.0 here + colors[50 --[[ImGuiCol.TableBorderLight]]] = ImVec4(0.68, 0.68, 0.74, 1.00) -- Prefer using Alpha=1.0 here + colors[51 --[[ImGuiCol.TableRowBg]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[52 --[[ImGuiCol.TableRowBgAlt]]] = ImVec4(0.30, 0.30, 0.30, 0.09) + colors[53 --[[ImGuiCol.TextLink]]] = colors[27 --[[ImGuiCol.HeaderActive]]] + colors[54 --[[ImGuiCol.TextSelectedBg]]] = ImVec4(0.26, 0.59, 0.98, 0.35) + colors[55 --[[ImGuiCol.TreeLines]]] = colors[5 --[[ImGuiCol.Border]]] + colors[56 --[[ImGuiCol.DragDropTarget]]] = ImVec4(0.26, 0.59, 0.98, 0.95) + colors[57 --[[ImGuiCol.DragDropTargetBg]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[58 --[[ImGuiCol.UnsavedMarker]]] = ImVec4(0.00, 0.00, 0.00, 1.00) + colors[59 --[[ImGuiCol.NavCursor]]] = colors[26 --[[ImGuiCol.HeaderHovered]]] + colors[60 --[[ImGuiCol.NavWindowingHighlight]]] = ImVec4(0.70, 0.70, 0.70, 0.70) + colors[61 --[[ImGuiCol.NavWindowingDimBg]]] = ImVec4(0.20, 0.20, 0.20, 0.20) + colors[62 --[[ImGuiCol.ModalWindowDimBg]]] = ImVec4(0.20, 0.20, 0.20, 0.35) end ------------------------------------------------------------------------------- @@ -30125,13 +30159,13 @@ function ImGui.ShadeVertsLinearColorGradientKeepAlpha(draw_list, vert_start_idx, local gradient_extent = gradient_p1 - gradient_p0 local gradient_inv_length2 = 1.0 / ImLengthSqr(gradient_extent) - local col0_r = bit32.band(bit32.rshift(col0, IM_COL32_R_SHIFT), 0xFF) - local col0_g = bit32.band(bit32.rshift(col0, IM_COL32_G_SHIFT), 0xFF) - local col0_b = bit32.band(bit32.rshift(col0, IM_COL32_B_SHIFT), 0xFF) + local col0_r = bit32.band(bit32.rshift(col0, 0 --[[IM_COL32_R_SHIFT]]), 0xFF) + local col0_g = bit32.band(bit32.rshift(col0, 8 --[[IM_COL32_G_SHIFT]]), 0xFF) + local col0_b = bit32.band(bit32.rshift(col0, 16 --[[IM_COL32_B_SHIFT]]), 0xFF) - local col_delta_r = bit32.band(bit32.rshift(col1, IM_COL32_R_SHIFT), 0xFF) - col0_r - local col_delta_g = bit32.band(bit32.rshift(col1, IM_COL32_G_SHIFT), 0xFF) - col0_g - local col_delta_b = bit32.band(bit32.rshift(col1, IM_COL32_B_SHIFT), 0xFF) - col0_b + local col_delta_r = bit32.band(bit32.rshift(col1, 0 --[[IM_COL32_R_SHIFT]]), 0xFF) - col0_r + local col_delta_g = bit32.band(bit32.rshift(col1, 8 --[[IM_COL32_G_SHIFT]]), 0xFF) - col0_g + local col_delta_b = bit32.band(bit32.rshift(col1, 16 --[[IM_COL32_B_SHIFT]]), 0xFF) - col0_b for vert_idx = vert_start_idx, vert_end_idx - 1 do local vb = draw_list.VtxBuffer.Buf @@ -30143,7 +30177,7 @@ function ImGui.ShadeVertsLinearColorGradientKeepAlpha(draw_list, vert_start_idx, local g = math.floor(col0_g + col_delta_g * t) local b = math.floor(col0_b + col_delta_b * t) - writeu32(vb, o + 32, bit32.bor(bit32.lshift(r, IM_COL32_R_SHIFT), bit32.lshift(g, IM_COL32_G_SHIFT), bit32.lshift(b, IM_COL32_B_SHIFT), bit32.band(readu32(vb, o + 32), IM_COL32_A_MASK))) + writeu32(vb, o + 32, bit32.bor(bit32.lshift(r, 0 --[[IM_COL32_R_SHIFT]]), bit32.lshift(g, 8 --[[IM_COL32_G_SHIFT]]), bit32.lshift(b, 16 --[[IM_COL32_B_SHIFT]]), bit32.band(readu32(vb, o + 32), 4278190080 --[[IM_COL32_A_MASK]]))) end end @@ -30352,7 +30386,7 @@ function MT.ImFontAtlas:SetFontLoader(font_loader) end function MT.ImFontAtlas:ClearInputData() - IM_ASSERT(not self.Locked, "Cannot modify a locked ImFontAtlas!") + assert(not self.Locked, "Cannot modify a locked ImFontAtlas!") for _, font in self.Fonts:iter() do ImFontAtlasFontDestroyOutput(self, font) @@ -30363,15 +30397,15 @@ function MT.ImFontAtlas:ClearInputData() for _, font in self.Fonts:iter() do -- When clearing this we lose access to the font name and other information used to build the font. font.Sources:clear() - font.Flags = bit32.bor(font.Flags, ImFontFlags.NoLoadGlyphs) + font.Flags = bit32.bor(font.Flags, 4 --[[ImFontFlags.NoLoadGlyphs]]) end self.Sources:clear() end -- Clear CPU-side copy of the texture data. function MT.ImFontAtlas:ClearTexData() - IM_ASSERT(not self.Locked, "Cannot modify a locked ImFontAtlas!") - IM_ASSERT(self.RendererHasTextures == false, "Not supported for dynamic atlases, but you may call Clear().") + assert(not self.Locked, "Cannot modify a locked ImFontAtlas!") + assert(self.RendererHasTextures == false, "Not supported for dynamic atlases, but you may call Clear().") for _, tex in self.TexList:iter() do tex:DestroyPixels() @@ -30386,7 +30420,7 @@ end function MT.ImFontAtlas:ClearFonts() -- FIXME-NEWATLAS: Illegal to remove currently bound font. IMGUI_DEBUG_LOG_FONT("[font] ImFontAtlas:ClearFonts()") - IM_ASSERT(not self.Locked, "Cannot modify a locked ImFontAtlas!") + assert(not self.Locked, "Cannot modify a locked ImFontAtlas!") for _, font in self.Fonts:iter() do ImFontAtlasBuildNotifySetFont(self, font, nil) @@ -30409,7 +30443,7 @@ end --- @param tex ImTextureData function ImTextureDataUpdateNewFrame(tex) local remove_from_list = false - if tex.Status == ImTextureStatus.OK then + if tex.Status == 0 --[[ImTextureStatus.OK]] then tex.Updates:resize(0) tex.UpdateRect.x = 65535 tex.UpdateRect.y = 65535 tex.UpdateRect.w = 0 tex.UpdateRect.h = 0 @@ -30418,32 +30452,32 @@ function ImTextureDataUpdateNewFrame(tex) -- Request destroy -- - Keep bool to true in order to differentiate a planned destroy vs a destroy decided by the backend. -- - We don't destroy pixels right away, as backend may have an in-flight copy from RAM. - if (tex.WantDestroyNextFrame and tex.Status ~= ImTextureStatus.Destroyed and tex.Status ~= ImTextureStatus.WantDestroy) then - IM_ASSERT(tex.Status == ImTextureStatus.OK or tex.Status == ImTextureStatus.WantCreate or tex.Status == ImTextureStatus.WantUpdates) - tex.Status = ImTextureStatus.WantDestroy + if (tex.WantDestroyNextFrame and tex.Status ~= 1 --[[ImTextureStatus.Destroyed]] and tex.Status ~= 4 --[[ImTextureStatus.WantDestroy]]) then + assert(tex.Status == 0 --[[ImTextureStatus.OK]] or tex.Status == 2 --[[ImTextureStatus.WantCreate]] or tex.Status == 3 --[[ImTextureStatus.WantUpdates]]) + tex.Status = 4 --[[ImTextureStatus.WantDestroy]] end -- If a texture has never reached the backend, they don't need to know about it. -- (note: backends between 1.92.0 and 1.92.4 could set an already destroyed texture to ImTextureStatus.WantDestroy -- when invalidating graphics objects twice, which would previously remove it from the list and crash.) - if (tex.Status == ImTextureStatus.WantDestroy and tex.TexID == ImTextureID_Invalid and tex.BackendUserData == nil and tex.QueueUserData == nil) then - tex.Status = ImTextureStatus.Destroyed + if (tex.Status == 4 --[[ImTextureStatus.WantDestroy]] and tex.TexID == (-1) --[[ImTextureID_Invalid]] and tex.BackendUserData == nil and tex.QueueUserData == nil) then + tex.Status = 1 --[[ImTextureStatus.Destroyed]] end -- Process texture being destroyed - if (tex.Status == ImTextureStatus.Destroyed) then - IM_ASSERT(tex.TexID == ImTextureID_Invalid and tex.BackendUserData == nil, "Backend set texture Status to Destroyed but did not clear TexID/BackendUserData!") - IM_ASSERT(tex.QueueUserData == nil, "Texture queue set Status to Destroyed but did not clear QueueUserData!") + if (tex.Status == 1 --[[ImTextureStatus.Destroyed]]) then + assert(tex.TexID == (-1) --[[ImTextureID_Invalid]] and tex.BackendUserData == nil, "Backend set texture Status to Destroyed but did not clear TexID/BackendUserData!") + assert(tex.QueueUserData == nil, "Texture queue set Status to Destroyed but did not clear QueueUserData!") if (tex.WantDestroyNextFrame) then remove_from_list = true -- Destroy was scheduled by us else - tex.Status = ImTextureStatus.WantCreate -- Destroy was done was backend: recreate it (e.g. freed resources mid-run) + tex.Status = 2 --[[ImTextureStatus.WantCreate]] -- Destroy was done was backend: recreate it (e.g. freed resources mid-run) end end -- The backend may need defer destroying by a few frames, to handle texture used by previous in-flight rendering. -- We allow the texture staying in _WantDestroy state and increment a counter which the backend can use to take its decision. - if (tex.Status == ImTextureStatus.WantDestroy) then + if (tex.Status == 4 --[[ImTextureStatus.WantDestroy]]) then tex.UnusedFrames = tex.UnusedFrames + 1 end @@ -30458,7 +30492,7 @@ end --- @param frame_count int --- @param renderer_has_textures any function ImFontAtlasUpdateNewFrame(atlas, frame_count, renderer_has_textures) - IM_ASSERT(atlas.Builder == nil or atlas.Builder.FrameCount < frame_count) -- Protection against being called twice. + assert(atlas.Builder == nil or atlas.Builder.FrameCount < frame_count) -- Protection against being called twice. atlas.RendererHasTextures = renderer_has_textures -- Update texture status and discard old textures. @@ -30470,14 +30504,14 @@ function ImFontAtlasUpdateNewFrame(atlas, frame_count, renderer_has_textures) -- Update and remove if requested local tex = atlas.TexList.Data[tex_n] - if (tex.Status == ImTextureStatus.WantCreate and atlas.RendererHasTextures) then - IM_ASSERT(tex.TexID == ImTextureID_Invalid and tex.BackendUserData == nil, "Backend set texture's TexID/BackendUserData but did not update Status to OK.") + if (tex.Status == 2 --[[ImTextureStatus.WantCreate]] and atlas.RendererHasTextures) then + assert(tex.TexID == (-1) --[[ImTextureID_Invalid]] and tex.BackendUserData == nil, "Backend set texture's TexID/BackendUserData but did not update Status to OK.") end local remove_from_list = ImTextureDataUpdateNewFrame(tex) if remove_from_list then - IM_ASSERT(atlas.TexData ~= tex) + assert(atlas.TexData ~= tex) tex:DestroyPixels() atlas.TexList:erase(tex_n) tex_n = tex_n - 1 @@ -30532,7 +30566,7 @@ function ImFontAtlasUpdateNewFrame(atlas, frame_count, renderer_has_textures) until true end - IM_ASSERT(dst_n - 1 + builder.BakedDiscardedCount == builder.BakedPool.Size) + assert(dst_n - 1 + builder.BakedDiscardedCount == builder.BakedPool.Size) builder.BakedPool.Size = builder.BakedPool.Size - builder.BakedDiscardedCount builder.BakedDiscardedCount = 0 @@ -30549,7 +30583,7 @@ end --- @param w int --- @param h int function ImFontAtlasTextureBlockConvert(src_pixels, src_fmt, src_pitch, dst_pixels, dst_pixels_base, dst_fmt, dst_pitch, w, h) - IM_ASSERT(src_pixels ~= nil and dst_pixels ~= nil) + assert(src_pixels ~= nil and dst_pixels ~= nil) local src_pixels_base = 1 if src_fmt == dst_fmt then local line_sz = w * ImTextureDataGetFormatBytesPerPixel(src_fmt) @@ -30559,7 +30593,7 @@ function ImFontAtlasTextureBlockConvert(src_pixels, src_fmt, src_pitch, dst_pixe src_pixels_base = src_pixels_base + src_pitch dst_pixels_base = dst_pixels_base + dst_pitch end - elseif src_fmt == ImTextureFormat.Alpha8 and dst_fmt == ImTextureFormat.RGBA32 then + elseif src_fmt == 1 --[[ImTextureFormat.Alpha8]] and dst_fmt == 0 --[[ImTextureFormat.RGBA32]] then for ny = h, 1, -1 do for nx = w, 1, -1 do local alpha = src_pixels[src_pixels_base + 0] @@ -30572,7 +30606,7 @@ function ImFontAtlasTextureBlockConvert(src_pixels, src_fmt, src_pitch, dst_pixe src_pixels_base = src_pixels_base + (src_pitch - w) dst_pixels_base = dst_pixels_base + (dst_pitch - w * 4) end - elseif src_fmt == ImTextureFormat.RGBA32 and dst_fmt == ImTextureFormat.Alpha8 then + elseif src_fmt == 0 --[[ImTextureFormat.RGBA32]] and dst_fmt == 1 --[[ImTextureFormat.Alpha8]] then for ny = h, 1, -1 do for nx = w, 1, -1 do local alpha = src_pixels[src_pixels_base + 3] @@ -30586,7 +30620,7 @@ function ImFontAtlasTextureBlockConvert(src_pixels, src_fmt, src_pitch, dst_pixe dst_pixels_base = dst_pixels_base + (dst_pitch - w) end else - IM_ASSERT(false) + assert(false) end end @@ -30605,7 +30639,7 @@ end function ImFontAtlasTextureBlockPostProcessMultiply(data, multiply_factor) local pixels, pixels_base = data.Pixels, data._PixelsBase local pitch = data.Pitch - if data.Format == ImTextureFormat.Alpha8 then + if data.Format == 1 --[[ImTextureFormat.Alpha8]] then for ny = data.Height, 1, -1 do local p = pixels_base for nx = data.Width, 1, -1 do @@ -30617,7 +30651,7 @@ function ImFontAtlasTextureBlockPostProcessMultiply(data, multiply_factor) pixels_base = pixels_base + pitch end - elseif data.Format == ImTextureFormat.RGBA32 then + elseif data.Format == 0 --[[ImTextureFormat.RGBA32]] then for ny = data.Height, 1, -1 do local p = pixels_base for nx = data.Width, 1, -1 do @@ -30631,7 +30665,7 @@ function ImFontAtlasTextureBlockPostProcessMultiply(data, multiply_factor) pixels_base = pixels_base + pitch end else - IM_ASSERT(false) + assert(false) end end @@ -30645,12 +30679,12 @@ end --- @param w int --- @param h int function ImFontAtlasTextureBlockCopy(src_tex, src_x, src_y, dst_tex, dst_x, dst_y, w, h) - IM_ASSERT(src_tex.Pixels ~= nil and dst_tex.Pixels ~= nil) - IM_ASSERT(src_tex.Format == dst_tex.Format) - IM_ASSERT(src_x >= 0 and src_x + w <= src_tex.Width) - IM_ASSERT(src_y >= 0 and src_y + h <= src_tex.Height) - IM_ASSERT(dst_x >= 0 and dst_x + w <= dst_tex.Width) - IM_ASSERT(dst_y >= 0 and dst_y + h <= dst_tex.Height) + assert(src_tex.Pixels ~= nil and dst_tex.Pixels ~= nil) + assert(src_tex.Format == dst_tex.Format) + assert(src_x >= 0 and src_x + w <= src_tex.Width) + assert(src_y >= 0 and src_y + h <= src_tex.Height) + assert(dst_x >= 0 and dst_x + w <= dst_tex.Width) + assert(dst_y >= 0 and dst_y + h <= dst_tex.Height) for y = 0, h - 1 do local dst, dst_base = dst_tex:GetPixelsAt(dst_x, dst_y + y) local src, src_base = src_tex:GetPixelsAt(src_x, src_y + y) @@ -30665,8 +30699,8 @@ end --- @param w int --- @param h int local function ImTextureDataQueueUpload(tex, x, y, w, h) - IM_ASSERT(tex.Status ~= ImTextureStatus.WantDestroy and tex.Status ~= ImTextureStatus.Destroyed) - IM_ASSERT(x >= 0 and x <= 0xFFFF and y >= 0 and y <= 0xFFFF and w >= 0 and x + w <= 0x10000 and h >= 0 and y + h <= 0x10000) + assert(tex.Status ~= 4 --[[ImTextureStatus.WantDestroy]] and tex.Status ~= 1 --[[ImTextureStatus.Destroyed]]) + assert(x >= 0 and x <= 0xFFFF and y >= 0 and y <= 0xFFFF and w >= 0 and x + w <= 0x10000 and h >= 0 and y + h <= 0x10000) local req = ImTextureRect(x, y, w, h) -- (unsigned short) local new_x1 = ImMax(tex.UpdateRect.w == 0 and 0 or tex.UpdateRect.x + tex.UpdateRect.w, req.x + req.w) @@ -30681,8 +30715,8 @@ local function ImTextureDataQueueUpload(tex, x, y, w, h) tex.UsedRect.h = (ImMax(tex.UsedRect.y + tex.UsedRect.h, req.y + req.h) - tex.UsedRect.y) -- (unsigned short) -- No need to queue if status is == ImTextureStatus.WantCreate - if (tex.Status == ImTextureStatus.OK or tex.Status == ImTextureStatus.WantUpdates) then - tex.Status = ImTextureStatus.WantUpdates + if (tex.Status == 0 --[[ImTextureStatus.OK]] or tex.Status == 3 --[[ImTextureStatus.WantUpdates]]) then + tex.Status = 3 --[[ImTextureStatus.WantUpdates]] tex.Updates:push_back(req) end end @@ -30709,9 +30743,9 @@ end --- @param src_pitch int local function ImFontAtlasBakedSetFontGlyphBitmap(atlas, baked, src, glyph, r, src_pixels, src_fmt, src_pitch) local tex = atlas.TexData - IM_ASSERT(r.x + r.w <= tex.Width and r.y + r.h <= tex.Height) + assert(r.x + r.w <= tex.Width and r.y + r.h <= tex.Height) local out_p, out_p_base = tex:GetPixelsAt(r.x, r.y) - IM_ASSERT(out_p ~= nil) + assert(out_p ~= nil) ImFontAtlasTextureBlockConvert(src_pixels, src_fmt, src_pitch, out_p, out_p_base, tex.Format, tex:GetPitch(), r.w, r.h) local pp_data = ImFontAtlasPostProcessData(atlas, baked.OwnerFont, src, baked, glyph, out_p, out_p_base, tex.Format, tex:GetPitch(), r.w, r.h) ImFontAtlasTextureBlockPostProcess(pp_data) @@ -30745,7 +30779,7 @@ local function ImFontAtlasBuildDiscardBakes(atlas, unused_frames) break end - if (baked.WantDestroy or (bit32.band(baked.OwnerFont.Flags, ImFontFlags.LockBakedSizes) ~= 0)) then + if (baked.WantDestroy or (bit32.band(baked.OwnerFont.Flags, 8 --[[ImFontFlags.LockBakedSizes]]) ~= 0)) then break end @@ -30759,14 +30793,14 @@ end --- @param atlas ImFontAtlas --- @param data ImDrawListSharedData function ImFontAtlasAddDrawListSharedData(atlas, data) - IM_ASSERT(not atlas.DrawListSharedDatas:contains(data)) + assert(not atlas.DrawListSharedDatas:contains(data)) atlas.DrawListSharedDatas:push_back(data) end --- @param atlas ImFontAtlas --- @param data ImDrawListSharedData function ImFontAtlasRemoveDrawListSharedData(atlas, data) - IM_ASSERT(atlas.DrawListSharedDatas:contains(data)) + assert(atlas.DrawListSharedDatas:contains(data)) atlas.DrawListSharedDatas:find_erase(data) end @@ -30809,7 +30843,7 @@ local function ImFontAtlasTextureRepack(atlas, w, h) end local new_r_id = ImFontAtlasPackAddRect(atlas, old_r.w, old_r.h, index_entry) - if new_r_id == ImFontAtlasRectId_Invalid then + if new_r_id == (-1) --[[ImFontAtlasRectId_Invalid]] then -- Undo, grow texture and try repacking again. -- FIXME-NEWATLAS-TESTS: This is a very rarely exercised path! It needs to be automatically tested properly. IMGUI_DEBUG_LOG_FONT("[font] Texture #%03d: resize failed. Will grow.", new_tex.UniqueID) @@ -30823,21 +30857,21 @@ local function ImFontAtlasTextureRepack(atlas, w, h) return end - IM_ASSERT(ImFontAtlasRectId_GetIndex(new_r_id) == builder.RectsIndex:index_from_ptr(index_entry)) + assert(ImFontAtlasRectId_GetIndex(new_r_id) == builder.RectsIndex:index_from_ptr(index_entry)) local new_r = ImFontAtlasPackGetRect(atlas, new_r_id) ImFontAtlasTextureBlockCopy(old_tex, old_r.x, old_r.y, new_tex, new_r.x, new_r.y, new_r.w, new_r.h) until true end - IM_ASSERT(old_rects.Size == builder.Rects.Size + builder.RectsDiscardedCount) + assert(old_rects.Size == builder.Rects.Size + builder.RectsDiscardedCount) builder.RectsDiscardedCount = 0 builder.RectsDiscardedSurface = 0 -- Patch glyphs UV for baked_n = 1, builder.BakedPool.Size do for _, glyph in builder.BakedPool[baked_n].Glyphs:iter() do - if (glyph.PackId ~= ImFontAtlasRectId_Invalid) then + if (glyph.PackId ~= (-1) --[[ImFontAtlasRectId_Invalid]]) then local r = ImFontAtlasPackGetRect(atlas, glyph.PackId) glyph.U0 = (r.x) * atlas.TexUvScale.x glyph.V0 = (r.y) * atlas.TexUvScale.y @@ -30871,8 +30905,8 @@ function ImFontAtlasTextureGrow(atlas, old_tex_w, old_tex_h) -- FIXME-NEWATLAS-V2: What to do when reaching limits exposed by backend? -- FIXME-NEWATLAS-V2: Does ImFontAtlasFlags.NoPowerOfTwoHeight makes sense now? Allow 'lock' and 'compact' operations? - IM_ASSERT(ImIsPowerOfTwo(old_tex_w) and ImIsPowerOfTwo(old_tex_h)) - IM_ASSERT(ImIsPowerOfTwo(atlas.TexMinWidth) and ImIsPowerOfTwo(atlas.TexMaxWidth) and ImIsPowerOfTwo(atlas.TexMinHeight) and ImIsPowerOfTwo(atlas.TexMaxHeight)) + assert(ImIsPowerOfTwo(old_tex_w) and ImIsPowerOfTwo(old_tex_h)) + assert(ImIsPowerOfTwo(atlas.TexMinWidth) and ImIsPowerOfTwo(atlas.TexMaxWidth) and ImIsPowerOfTwo(atlas.TexMinHeight) and ImIsPowerOfTwo(atlas.TexMaxHeight)) -- Grow texture so it follows roughly a square. -- - Grow height before width, as width imply more packing nodes. @@ -30922,7 +30956,7 @@ local function ImFontAtlasPackAllocRectEntry(atlas, rect_idx) else index_idx = builder.RectsIndexFreeListStart index_entry = builder.RectsIndex[index_idx + 1] - IM_ASSERT(index_entry.IsUsed == false and index_entry.Generation > 0) -- Generation is incremented during DiscardRect + assert(index_entry.IsUsed == false and index_entry.Generation > 0) -- Generation is incremented during DiscardRect builder.RectsIndexFreeListStart = index_entry.TargetIndex end @@ -30936,7 +30970,7 @@ end --- @param atlas ImFontAtlas --- @param index_entry ImFontAtlasRectEntry local function ImFontAtlasPackReuseRectEntry(atlas, index_entry) - IM_ASSERT(index_entry.IsUsed) + assert(index_entry.IsUsed) index_entry.TargetIndex = atlas.Builder.Rects.Size - 1 local index_idx = atlas.Builder.RectsIndex:index_from_ptr(index_entry) return ImFontAtlasRectId_Make(index_idx, index_entry.Generation) @@ -30946,7 +30980,7 @@ end --- @param atlas ImFontAtlas --- @param id ImFontAtlasRectId function ImFontAtlasPackDiscardRect(atlas, id) - IM_ASSERT(id ~= ImFontAtlasRectId_Invalid) + assert(id ~= (-1) --[[ImFontAtlasRectId_Invalid]]) local rect = ImFontAtlasPackGetRect(atlas, id) if (rect == nil) then @@ -30956,7 +30990,7 @@ function ImFontAtlasPackDiscardRect(atlas, id) local builder = atlas.Builder local index_idx = ImFontAtlasRectId_GetIndex(id) local index_entry = builder.RectsIndex.Data[index_idx + 1] - IM_ASSERT(index_entry.IsUsed and index_entry.TargetIndex >= 0) + assert(index_entry.IsUsed and index_entry.TargetIndex >= 0) index_entry.IsUsed = false index_entry.TargetIndex = builder.RectsIndexFreeListStart index_entry.Generation = index_entry.Generation + 1 @@ -30974,8 +31008,8 @@ end -- Important: Calling this may recreate a new texture and therefore change atlas.TexData -- FIXME-NEWFONTS: Expose other glyph padding settings for custom alteration (e.g. drop shadows). See #7962 function ImFontAtlasPackAddRect(atlas, w, h, overwrite_entry) - IM_ASSERT(w > 0 and w <= 0xFFFF) - IM_ASSERT(h > 0 and h <= 0xFFFF) + assert(w > 0 and w <= 0xFFFF) + assert(h > 0 and h <= 0xFFFF) local builder = atlas.Builder local pack_padding = atlas.TexGlyphPadding @@ -31000,7 +31034,7 @@ function ImFontAtlasPackAddRect(atlas, w, h, overwrite_entry) if (attempts_remaining == 0 or builder.LockDisableResize) then IMGUI_DEBUG_LOG_FONT("[font] Failed packing %dx%d rectangle. Returning fallback.", w, h) - return ImFontAtlasRectId_Invalid + return (-1) --[[ImFontAtlasRectId_Invalid]] end -- Resize or repack atlas! (this should be a rare event) @@ -31025,12 +31059,12 @@ end --- @param id ImFontAtlasRectId --- @return ImTextureRect function ImFontAtlasPackGetRect(atlas, id) - IM_ASSERT(id ~= ImFontAtlasRectId_Invalid) + assert(id ~= (-1) --[[ImFontAtlasRectId_Invalid]]) local index_idx = ImFontAtlasRectId_GetIndex(id) local builder = atlas.Builder local index_entry = builder.RectsIndex.Data[index_idx + 1] - IM_ASSERT(index_entry.Generation == ImFontAtlasRectId_GetGeneration(id)) - IM_ASSERT(index_entry.IsUsed) + assert(index_entry.Generation == ImFontAtlasRectId_GetGeneration(id)) + assert(index_entry.IsUsed) --- @type ImTextureRect return builder.Rects.Data[index_entry.TargetIndex + 1] end @@ -31040,7 +31074,7 @@ end --- @param atlas ImFontAtlas --- @param id ImFontAtlasRectId function ImFontAtlasPackGetRectSafe(atlas, id) - if id == ImFontAtlasRectId_Invalid then + if id == (-1) --[[ImFontAtlasRectId_Invalid]] then return nil end @@ -31083,7 +31117,7 @@ end --- @param baked ImFontBaked --- @param new_size int function ImFontBaked_BuildGrowIndex(baked, new_size) - IM_ASSERT(baked.IndexAdvanceX.Size == baked.IndexLookup.Size) + assert(baked.IndexAdvanceX.Size == baked.IndexLookup.Size) if (new_size <= baked.IndexLookup.Size) then return end @@ -31123,7 +31157,7 @@ local function ImGui_ImplStbTrueType_FontSrcInit(atlas, src) --- @type ImGui_ImplStbTrueType_FontSrcData? local bd_font_data = ImGui_ImplStbTrueType_FontSrcData() - IM_ASSERT(src.FontLoaderData == nil) + assert(src.FontLoaderData == nil) -- Initialize helper structure for font loading and verify that the TTF/OTF data is correct local font_offset = stbtt.GetFontOffsetForIndex(src.FontData, src.FontNo) @@ -31161,7 +31195,7 @@ end local function ImGui_ImplStbTrueType_FontSrcContainsGlyph(atlas, src, codepoint) -- IM_UNUSED(atlas) local bd_font_data = src.FontLoaderData - IM_ASSERT(bd_font_data ~= nil) + assert(bd_font_data ~= nil) local glyph_index = stbtt.FindGlyphIndex(bd_font_data.FontInfo, codepoint) return (glyph_index ~= 0) @@ -31197,7 +31231,7 @@ end local function ImGui_ImplStbTrueType_FontBakedLoadGlyph(atlas, src, baked, _, codepoint, out_glyph, advance_x) -- Search for first font which has the glyph local bd_font_data = src.FontLoaderData - IM_ASSERT(bd_font_data ~= nil) + assert(bd_font_data ~= nil) local glyph_index = stbtt.FindGlyphIndex(bd_font_data.FontInfo, codepoint) if (glyph_index == 0) then return false, advance_x @@ -31216,7 +31250,7 @@ local function ImGui_ImplStbTrueType_FontBakedLoadGlyph(atlas, src, baked, _, co -- Load metrics only mode if (advance_x ~= nil) then - IM_ASSERT(out_glyph == nil) + assert(out_glyph == nil) advance_x = advance * scale_for_layout return true, advance_x @@ -31233,9 +31267,9 @@ local function ImGui_ImplStbTrueType_FontBakedLoadGlyph(atlas, src, baked, _, co local w = (x1 - x0 + oversample_h - 1) local h = (y1 - y0 + oversample_v - 1) local pack_id = ImFontAtlasPackAddRect(atlas, w, h) - if (pack_id == ImFontAtlasRectId_Invalid) then + if (pack_id == (-1) --[[ImFontAtlasRectId_Invalid]]) then -- Pathological out of memory case (TexMaxWidth/TexMaxHeight set too small?) - IM_ASSERT(pack_id ~= ImFontAtlasRectId_Invalid, "Out of texture memory.") + assert(pack_id ~= (-1) --[[ImFontAtlasRectId_Invalid]], "Out of texture memory.") return false, advance_x end @@ -31272,7 +31306,7 @@ local function ImGui_ImplStbTrueType_FontBakedLoadGlyph(atlas, src, baked, _, co out_glyph.Visible = true out_glyph.PackId = pack_id - ImFontAtlasBakedSetFontGlyphBitmap(atlas, baked, src, out_glyph, r, bitmap_pixels, ImTextureFormat.Alpha8, w) + ImFontAtlasBakedSetFontGlyphBitmap(atlas, baked, src, out_glyph, r, bitmap_pixels, 1 --[[ImTextureFormat.Alpha8]], w) end return true, advance_x @@ -31307,7 +31341,7 @@ function ImFontAtlasBuildSetupFontBakedBlanks(atlas, baked) if baked:FindGlyphNoFallback(9) == nil and space_glyph ~= nil then local tab_glyph = ImFontGlyph() tab_glyph.Codepoint = 9 - tab_glyph.AdvanceX = space_glyph.AdvanceX * IM_TABSIZE + tab_glyph.AdvanceX = space_glyph.AdvanceX * 4 --[[IM_TABSIZE]] ImFontAtlasBakedAddFontGlyph(atlas, baked, nil, tab_glyph) end end @@ -31401,7 +31435,7 @@ function ImFontAtlasBakedDiscard(atlas, font, baked) local builder = atlas.Builder for _, glyph in baked.Glyphs:iter() do - if glyph.PackId ~= ImFontAtlasRectId_Invalid then + if glyph.PackId ~= (-1) --[[ImFontAtlasRectId_Invalid]] then ImFontAtlasPackDiscardRect(atlas, glyph.PackId) end end @@ -31455,7 +31489,7 @@ function ImFontAtlasFontInitOutput(atlas, font) ret = false end end - IM_ASSERT(ret) -- Unclear how to react to this meaningfully. Assume that result will be same as initial AddFont() call. + assert(ret) -- Unclear how to react to this meaningfully. Assume that result will be same as initial AddFont() call. return ret end @@ -31489,7 +31523,7 @@ function ImFontAtlasFontSourceAddToFont(atlas, font, src) font:ClearOutputData() --font.FontSize = src.SizePixels font.OwnerAtlas = atlas - IM_ASSERT(font.Sources[1] == src) + assert(font.Sources[1] == src) end atlas.TexIsBuilt = false -- For legacy backends ImFontAtlasBuildSetupFontSpecialGlyphs(atlas, font, src) @@ -31517,11 +31551,11 @@ end --- @param src ImFontConfig function ImFontAtlasBuildSetupFontSpecialGlyphs(atlas, font, src) -- IM_UNUSED(atlas) - IM_ASSERT(font.Sources:contains(src)) + assert(font.Sources:contains(src)) -- Find Fallback character. Actual glyph loaded in GetFontBaked(). --- @type ImWchar[] - local fallback_chars = {font.FallbackChar, IM_UNICODE_CODEPOINT_INVALID, 63, 32} + local fallback_chars = {font.FallbackChar, 65533 --[[IM_UNICODE_CODEPOINT_INVALID]], 63, 32} if font.FallbackChar == 0 then for _, candidate_char in ipairs(fallback_chars) do if candidate_char ~= 0 and font:IsGlyphInFont(candidate_char) then @@ -31561,7 +31595,7 @@ end --- @return ImFontGlyph? function ImFontAtlasBuildSetupFontBakedEllipsis(atlas, baked) local font = baked.OwnerFont - IM_ASSERT(font.EllipsisChar ~= 0) + assert(font.EllipsisChar ~= 0) local dot_glyph = baked:FindGlyphNoFallback(46) -- '.' if (dot_glyph == nil) then @@ -31604,8 +31638,8 @@ end -- (this is called from in hot-path so we avoid extraneous parameters to minimize impact on code size) --- @param baked ImFontBaked function ImFontAtlasBuildSetupFontBakedFallback(baked) - IM_ASSERT(baked.FallbackGlyphIndex == -1) - IM_ASSERT(baked.FallbackAdvanceX == 0.0) + assert(baked.FallbackGlyphIndex == -1) + assert(baked.FallbackAdvanceX == 0.0) local font = baked.OwnerFont local fallback_glyph if (font.FallbackChar ~= 0) then @@ -31628,7 +31662,7 @@ function ImFontAtlasBuildSetupFontLoader(atlas, font_loader) if atlas.FontLoader == font_loader then return end - IM_ASSERT(not atlas.Locked, "Cannot modify a locked ImFontAtlas!") + assert(not atlas.Locked, "Cannot modify a locked ImFontAtlas!") for _, font in atlas.Fonts:iter() do ImFontAtlasFontDestroyOutput(atlas, font) @@ -31639,7 +31673,7 @@ function ImFontAtlasBuildSetupFontLoader(atlas, font_loader) atlas.FontLoader = font_loader atlas.FontLoaderName = font_loader and font_loader.Name or "NULL" - IM_ASSERT(atlas.FontLoaderData == nil) + assert(atlas.FontLoaderData == nil) if atlas.Builder and atlas.FontLoader and atlas.FontLoader.LoaderInit then atlas.FontLoader.LoaderInit(atlas) @@ -31663,7 +31697,7 @@ local function ImFontAtlasBuildUpdateRendererHasTexturesFromContext(atlas) for _, shared_data in atlas.DrawListSharedDatas:iter() do local imgui_ctx = shared_data.Context if (imgui_ctx) then - atlas.RendererHasTextures = bit32.band(imgui_ctx.IO.BackendFlags, ImGuiBackendFlags.RendererHasTextures) ~= 0 + atlas.RendererHasTextures = bit32.band(imgui_ctx.IO.BackendFlags, 16 --[[ImGuiBackendFlags.RendererHasTextures]]) ~= 0 break end @@ -31750,7 +31784,7 @@ function ImFontAtlasTextureAdd(atlas, w, h) if old_tex ~= nil then -- Queue old as to destroy next frame old_tex.WantDestroyNextFrame = true - IM_ASSERT(old_tex.Status == ImTextureStatus.OK or old_tex.Status == ImTextureStatus.WantCreate or old_tex.Status == ImTextureStatus.WantUpdates) + assert(old_tex.Status == 0 --[[ImTextureStatus.OK]] or old_tex.Status == 2 --[[ImTextureStatus.WantCreate]] or old_tex.Status == 3 --[[ImTextureStatus.WantUpdates]]) end new_tex:Create(atlas.TexDesiredFormat, w, h) @@ -31766,7 +31800,7 @@ end function ImFontAtlasTextureGetSizeEstimate(atlas) local min_w = ImUpperPowerOfTwo(atlas.TexMinWidth) local min_h = ImUpperPowerOfTwo(atlas.TexMinHeight) - if (atlas.Builder == nil or atlas.TexData == nil or atlas.TexData.Status == ImTextureStatus.WantDestroy) then + if (atlas.Builder == nil or atlas.TexData == nil or atlas.TexData.Status == 4 --[[ImTextureStatus.WantDestroy]]) then return ImVec2(min_w, min_h) -- ImVec2i end @@ -31781,18 +31815,18 @@ function ImFontAtlasTextureGetSizeEstimate(atlas) if (min_w >= min_h) then new_tex_w = ImMax(min_w, ImUpperPowerOfTwo(surface_sqrt)) new_tex_h = ImMax(min_h, ImFloor((surface_approx + new_tex_w - 1) / new_tex_w)) - if (bit32.band(atlas.Flags, ImFontAtlasFlags.NoPowerOfTwoHeight) == 0) then + if (bit32.band(atlas.Flags, 1 --[[ImFontAtlasFlags.NoPowerOfTwoHeight]]) == 0) then new_tex_h = ImUpperPowerOfTwo(new_tex_h) end else new_tex_h = ImMax(min_h, ImUpperPowerOfTwo(surface_sqrt)) - if (bit32.band(atlas.Flags, ImFontAtlasFlags.NoPowerOfTwoHeight) == 0) then + if (bit32.band(atlas.Flags, 1 --[[ImFontAtlasFlags.NoPowerOfTwoHeight]]) == 0) then new_tex_h = ImUpperPowerOfTwo(new_tex_h) end new_tex_w = ImMax(min_w, ImFloor((surface_approx + new_tex_h - 1) / new_tex_h)) end - IM_ASSERT(ImIsPowerOfTwo(new_tex_w) and ImIsPowerOfTwo(new_tex_h)) + assert(ImIsPowerOfTwo(new_tex_w) and ImIsPowerOfTwo(new_tex_h)) return ImVec2(new_tex_w, new_tex_h) -- ImVec2i end @@ -31849,7 +31883,7 @@ end --- @param atlas ImFontAtlas function ImFontAtlasBuildUpdateTexDataLines(atlas) - if bit32.band(atlas.Flags, ImFontAtlasFlags.NoBakedLines) ~= 0 then + if bit32.band(atlas.Flags, 4 --[[ImFontAtlasFlags.NoBakedLines]]) ~= 0 then return end @@ -31864,7 +31898,7 @@ function ImFontAtlasBuildUpdateTexDataLines(atlas) -- The +2 here is to give space for the end caps, whilst height +1 is to accommodate the fact we have a zero-width row local pack_size = ImVec2(IM_DRAWLIST_TEX_LINES_WIDTH_MAX + 2, IM_DRAWLIST_TEX_LINES_WIDTH_MAX + 1) -- ImVec2i builder.PackIdLinesTexData = atlas:AddCustomRect(pack_size.x, pack_size.y, r) - IM_ASSERT(builder.PackIdLinesTexData ~= ImFontAtlasRectId_Invalid) + assert(builder.PackIdLinesTexData ~= (-1) --[[ImFontAtlasRectId_Invalid]]) end for n = 0, IM_DRAWLIST_TEX_LINES_WIDTH_MAX do -- +1 because of the zero-width row @@ -31877,10 +31911,10 @@ function ImFontAtlasBuildUpdateTexDataLines(atlas) --- @type int local pad_right = r.w - (pad_left + line_width) - IM_ASSERT(pad_left + line_width + pad_right == r.w and y < r.h) -- Make sure we're inside the texture bounds before we start writing pixels + assert(pad_left + line_width + pad_right == r.w and y < r.h) -- Make sure we're inside the texture bounds before we start writing pixels -- Write each slice - if (add_and_draw and tex.Format == ImTextureFormat.Alpha8) then + if (add_and_draw and tex.Format == 1 --[[ImTextureFormat.Alpha8]]) then local write_ptr, write_ptr_base = tex:GetPixelsAt(r.x, r.y + y) for i = 0, pad_left - 1 do @@ -31894,7 +31928,7 @@ function ImFontAtlasBuildUpdateTexDataLines(atlas) for i = 0, pad_right - 1 do write_ptr[write_ptr_base + pad_left + line_width + i] = 0x00 end - elseif (add_and_draw and tex.Format == ImTextureFormat.RGBA32) then + elseif (add_and_draw and tex.Format == 0 --[[ImTextureFormat.RGBA32]]) then local write_ptr, write_ptr_base = tex:GetPixelsAt(r.x, r.y + y) for i = 0, pad_left - 1 do @@ -31902,7 +31936,7 @@ function ImFontAtlasBuildUpdateTexDataLines(atlas) end for i = 0, line_width - 1 do - write_u32(write_ptr, write_ptr_base + (pad_left + i) * 4, IM_COL32_WHITE) + write_u32(write_ptr, write_ptr_base + (pad_left + i) * 4, 4294967295 --[[IM_COL32_WHITE]]) end for i = 0, pad_right - 1 do @@ -31928,10 +31962,10 @@ end --- @param in_marker_char string function ImFontAtlasBuildRenderBitmapFromString(atlas, x, y, w, h, in_str, in_marker_char) local tex = atlas.TexData - IM_ASSERT(x >= 0 and x + w <= tex.Width) - IM_ASSERT(y >= 0 and y + h <= tex.Height) + assert(x >= 0 and x + w <= tex.Width) + assert(y >= 0 and y + h <= tex.Height) - if tex.Format == ImTextureFormat.Alpha8 then + if tex.Format == 1 --[[ImTextureFormat.Alpha8]] then local out_p, out_p_base = tex:GetPixelsAt(x, y) local str_base = 1 for off_y = 0, h - 1 do @@ -31942,12 +31976,12 @@ function ImFontAtlasBuildRenderBitmapFromString(atlas, x, y, w, h, in_str, in_ma out_p_base = out_p_base + tex.Width str_base = str_base + w end - elseif tex.Format == ImTextureFormat.RGBA32 then + elseif tex.Format == 0 --[[ImTextureFormat.RGBA32]] then local out_p, out_p_base = tex:GetPixelsAt(x, y) local str_base = 1 for off_y = 0, h - 1 do for off_x = 0, w - 1 do - write_u32(out_p, out_p_base + off_x * 4, (in_str[str_base + off_x] == in_marker_char) and IM_COL32_WHITE or IM_COL32_BLACK_TRANS) + write_u32(out_p, out_p_base + off_x * 4, (in_str[str_base + off_x] == in_marker_char) and 4294967295 --[[IM_COL32_WHITE]] or 0 --[[IM_COL32_BLACK_TRANS]]) end out_p_base = out_p_base + tex.Width * 4 @@ -31961,24 +31995,24 @@ function ImFontAtlasBuildUpdateTexDataBasic(atlas) -- Pack and store identifier so we can refresh UV coordinates on texture resize. -- FIXME-NEWATLAS: User/custom rects where user code wants to store UV coordinates will need to do the same thing. local builder = atlas.Builder - local pack_size = (bit32.band(atlas.Flags, ImFontAtlasFlags.NoMouseCursors) ~= 0) and ImVec2(2, 2) or ImVec2(FONT_ATLAS_DEFAULT_TEX_DATA_W * 2 + 1, FONT_ATLAS_DEFAULT_TEX_DATA_H) + local pack_size = (bit32.band(atlas.Flags, 2 --[[ImFontAtlasFlags.NoMouseCursors]]) ~= 0) and ImVec2(2, 2) or ImVec2(122 --[[FONT_ATLAS_DEFAULT_TEX_DATA_W]] * 2 + 1, 27 --[[FONT_ATLAS_DEFAULT_TEX_DATA_H]]) local r = ImFontAtlasRect() local add_and_draw = (atlas:GetCustomRect(builder.PackIdMouseCursors, r) == false) if (add_and_draw) then builder.PackIdMouseCursors = atlas:AddCustomRect(pack_size.x, pack_size.y, r) - IM_ASSERT(builder.PackIdMouseCursors ~= ImFontAtlasRectId_Invalid) + assert(builder.PackIdMouseCursors ~= (-1) --[[ImFontAtlasRectId_Invalid]]) -- Draw to texture - if bit32.band(atlas.Flags, ImFontAtlasFlags.NoMouseCursors) ~= 0 then + if bit32.band(atlas.Flags, 2 --[[ImFontAtlasFlags.NoMouseCursors]]) ~= 0 then -- 2x2 white pixels ImFontAtlasBuildRenderBitmapFromString(atlas, r.x, r.y, 2, 2, {"X", "X", "X", "X"}, "X") else -- 2x2 white pixels + mouse cursors local x_for_white = r.x - local x_for_black = r.x + FONT_ATLAS_DEFAULT_TEX_DATA_W + 1 - ImFontAtlasBuildRenderBitmapFromString(atlas, x_for_white, r.y, FONT_ATLAS_DEFAULT_TEX_DATA_W, FONT_ATLAS_DEFAULT_TEX_DATA_H, FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS, ".") - ImFontAtlasBuildRenderBitmapFromString(atlas, x_for_black, r.y, FONT_ATLAS_DEFAULT_TEX_DATA_W, FONT_ATLAS_DEFAULT_TEX_DATA_H, FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS, "X") + local x_for_black = r.x + 122 --[[FONT_ATLAS_DEFAULT_TEX_DATA_W]] + 1 + ImFontAtlasBuildRenderBitmapFromString(atlas, x_for_white, r.y, 122 --[[FONT_ATLAS_DEFAULT_TEX_DATA_W]], 27 --[[FONT_ATLAS_DEFAULT_TEX_DATA_H]], FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS, ".") + ImFontAtlasBuildRenderBitmapFromString(atlas, x_for_black, r.y, 122 --[[FONT_ATLAS_DEFAULT_TEX_DATA_W]], 27 --[[FONT_ATLAS_DEFAULT_TEX_DATA_H]], FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS, "X") end end @@ -32046,7 +32080,7 @@ function ImFontAtlasBuildDestroy(atlas) end if atlas.Builder and atlas.FontLoader and atlas.FontLoader.LoaderShutdown then atlas.FontLoader.LoaderShutdown(atlas) - IM_ASSERT(atlas.FontLoaderData == nil) + assert(atlas.FontLoaderData == nil) end atlas.Builder = nil end @@ -32099,7 +32133,7 @@ end -- When atlas.RendererHasTextures = true, this is only called if no font were loaded. --- @param atlas ImFontAtlas function ImFontAtlasBuildMain(atlas) - IM_ASSERT(not atlas.Locked, "Cannot modify a locked ImFontAtlas!") + assert(not atlas.Locked, "Cannot modify a locked ImFontAtlas!") if (atlas.TexData and atlas.TexData.Format ~= atlas.TexDesiredFormat) then ImFontAtlasBuildClear(atlas) end @@ -32135,20 +32169,20 @@ function MT.ImTextureData:DestroyPixels() end function ImTextureDataGetFormatBytesPerPixel(format) - if format == ImTextureFormat.Alpha8 then + if format == 1 --[[ImTextureFormat.Alpha8]] then return 1 - elseif format == ImTextureFormat.RGBA32 then + elseif format == 0 --[[ImTextureFormat.RGBA32]] then return 4 end - IM_ASSERT(false) + assert(false) return 0 end function MT.ImTextureData:Create(format, w, h) - IM_ASSERT(self.Status == ImTextureStatus.Destroyed) + assert(self.Status == 1 --[[ImTextureStatus.Destroyed]]) self:DestroyPixels() self.Format = format - self.Status = ImTextureStatus.WantCreate + self.Status = 2 --[[ImTextureStatus.WantCreate]] self.Width = w self.Height = h self.BytesPerPixel = ImTextureDataGetFormatBytesPerPixel(format) @@ -32230,7 +32264,7 @@ function MT.ImFont:ClearOutputData() end --self.FallbackChar = 0 self.EllipsisChar = 0 - for i = 1, (IM_UNICODE_CODEPOINT_MAX + 1) / 8192 / 8 do self.Used8kPagesMap[i] = 0 end + for i = 1, (65535 --[[IM_UNICODE_CODEPOINT_MAX]] + 1) / 8192 / 8 do self.Used8kPagesMap[i] = 0 end self.LastBaked = nil end @@ -32251,25 +32285,25 @@ end function ImFontAtlasBakedGetOrAdd(atlas, font, font_size, font_rasterizer_density) -- FIXME-NEWATLAS: Design for picking a nearest size based on some criteria? -- FIXME-NEWATLAS: Altering font density won't work right away. - IM_ASSERT(font_size > 0.0 and font_rasterizer_density > 0.0) + assert(font_size > 0.0 and font_rasterizer_density > 0.0) local baked_id = ImFontAtlasBakedGetId(font.FontId, font_size, font_rasterizer_density) local builder = atlas.Builder local baked = builder.BakedMap[baked_id] if baked ~= nil then - IM_ASSERT(baked.Size == font_size and baked.OwnerFont == font and baked.BakedId == baked_id) + assert(baked.Size == font_size and baked.OwnerFont == font and baked.BakedId == baked_id) return baked end -- If atlas is locked, find closest match -- FIXME-OPT: This is not an optimal query. - if (bit32.band(font.Flags, ImFontFlags.LockBakedSizes) ~= 0 or atlas.Locked) then + if (bit32.band(font.Flags, 8 --[[ImFontFlags.LockBakedSizes]]) ~= 0 or atlas.Locked) then baked = ImFontAtlasBakedGetClosestMatch(atlas, font, font_size, font_rasterizer_density) if baked ~= nil then return baked end if atlas.Locked then - IM_ASSERT(not atlas.Locked, "Cannot use dynamic font size with a locked ImFontAtlas!") -- Locked because rendering backend does not support ImGuiBackendFlags.RendererHasTextures! + assert(not atlas.Locked, "Cannot use dynamic font size with a locked ImFontAtlas!") -- Locked because rendering backend does not support ImGuiBackendFlags.RendererHasTextures! return nil end end @@ -32293,12 +32327,12 @@ function ImFontAtlasBakedAddFontGlyph(atlas, baked, src, in_glyph) local glyph_idx = baked.Glyphs.Size + 1 baked.Glyphs:push_back(in_glyph) local glyph = baked.Glyphs.Data[glyph_idx] - IM_ASSERT(baked.Glyphs.Size < 0xFFFE) -- IndexLookup[] hold 16-bit values and -1/-2 are reserved. + assert(baked.Glyphs.Size < 0xFFFE) -- IndexLookup[] hold 16-bit values and -1/-2 are reserved. -- Set UV from packed rectangle - if (glyph.PackId ~= ImFontAtlasRectId_Invalid) then + if (glyph.PackId ~= (-1) --[[ImFontAtlasRectId_Invalid]]) then local r = ImFontAtlasPackGetRect(atlas, glyph.PackId) - IM_ASSERT(glyph.U0 == 0.0 and glyph.V0 == 0.0 and glyph.U1 == 0.0 and glyph.V1 == 0.0) + assert(glyph.U0 == 0.0 and glyph.V0 == 0.0 and glyph.U1 == 0.0 and glyph.V1 == 0.0) glyph.U0 = (r.x) * atlas.TexUvScale.x glyph.V0 = (r.y) * atlas.TexUvScale.y glyph.U1 = (r.x + r.w) * atlas.TexUvScale.x @@ -32424,7 +32458,7 @@ end function ImFontBaked_BuildLoadGlyph(baked, codepoint, only_load_advance_x) local font = baked.OwnerFont local atlas = font.OwnerAtlas - if atlas.Locked or bit32.band(font.Flags, ImFontFlags.NoLoadGlyphs) ~= 0 then + if atlas.Locked or bit32.band(font.Flags, 4 --[[ImFontFlags.NoLoadGlyphs]]) ~= 0 then -- Lazily load fallback glyph if baked.FallbackGlyphIndex == -1 and baked.LoadNoFallback == false then ImFontAtlasBuildSetupFontBakedFallback(baked) @@ -32502,7 +32536,7 @@ end --- @param codepoint ImWchar --- @return float function ImFontBaked_BuildLoadGlyphAdvanceX(baked, codepoint) - if (baked.Size >= IMGUI_FONT_SIZE_THRESHOLD_FOR_LOADADVANCEXONLYMODE) or baked.LoadNoRenderOnLayout then + if (baked.Size >= 128 --[[IMGUI_FONT_SIZE_THRESHOLD_FOR_LOADADVANCEXONLYMODE]]) or baked.LoadNoRenderOnLayout then -- First load AdvanceX value used by CalcTextSize() API then load the rest when loaded by drawing API. local only_advance_x local glyph @@ -32559,7 +32593,7 @@ end local function ImTextCalcWordWrapNextLineStart(text, text_begin, text_end, flags) local pos = text_begin - if bit32.band(flags, ImDrawTextFlags.WrapKeepBlanks) == 0 then + if bit32.band(flags, 2 --[[ImDrawTextFlags.WrapKeepBlanks]]) == 0 then while pos < text_end and ImCharIsBlankA(ImStrByte(text, pos)) do pos = pos + 1 end @@ -32588,7 +32622,7 @@ end --- @param char_class ImWcharClass --- @param c unsigned_int function ImTextClassifierSetCharClass(bits, codepoint_min, codepoint_end, char_class, c) - IM_ASSERT(c >= codepoint_min and c < codepoint_end) + assert(c >= codepoint_min and c < codepoint_end) -- IM_UNUSED(codepoint_end) c = c - codepoint_min local shift = bit32.lshift(bit32.band(c, 15), 1) @@ -32620,14 +32654,14 @@ function ImTextInitClassifiers() -- List of hardcoded separators: .,;!?'" -- Making this dynamic given known ranges is trivial BUT requires us to standardize where you pass them as parameters. (#3002, #8503) - ImTextClassifierClear(g_CharClassifierIsSeparator_0000_007f, 0, 128, ImWcharClass.Other) - ImTextClassifierSetCharClassFromStr(g_CharClassifierIsSeparator_0000_007f, 0, 128, ImWcharClass.Blank, " \t") - ImTextClassifierSetCharClassFromStr(g_CharClassifierIsSeparator_0000_007f, 0, 128, ImWcharClass.Punct, ".,;!?\"") + ImTextClassifierClear(g_CharClassifierIsSeparator_0000_007f, 0, 128, 2 --[[ImWcharClass.Other]]) + ImTextClassifierSetCharClassFromStr(g_CharClassifierIsSeparator_0000_007f, 0, 128, 0 --[[ImWcharClass.Blank]], " \t") + ImTextClassifierSetCharClassFromStr(g_CharClassifierIsSeparator_0000_007f, 0, 128, 1 --[[ImWcharClass.Punct]], ".,;!?\"") - ImTextClassifierClear(g_CharClassifierIsSeparator_3000_300f, 0x3000, 0x300F, ImWcharClass.Other) - ImTextClassifierSetCharClass(g_CharClassifierIsSeparator_3000_300f, 0x3000, 0x300F, ImWcharClass.Blank, 0x3000) - ImTextClassifierSetCharClass(g_CharClassifierIsSeparator_3000_300f, 0x3000, 0x300F, ImWcharClass.Punct, 0x3001) - ImTextClassifierSetCharClass(g_CharClassifierIsSeparator_3000_300f, 0x3000, 0x300F, ImWcharClass.Punct, 0x3002) + ImTextClassifierClear(g_CharClassifierIsSeparator_3000_300f, 0x3000, 0x300F, 2 --[[ImWcharClass.Other]]) + ImTextClassifierSetCharClass(g_CharClassifierIsSeparator_3000_300f, 0x3000, 0x300F, 0 --[[ImWcharClass.Blank]], 0x3000) + ImTextClassifierSetCharClass(g_CharClassifierIsSeparator_3000_300f, 0x3000, 0x300F, 1 --[[ImWcharClass.Punct]], 0x3001) + ImTextClassifierSetCharClass(g_CharClassifierIsSeparator_3000_300f, 0x3000, 0x300F, 1 --[[ImWcharClass.Punct]], 0x3002) end -- Simple word-wrapping for English, not full-featured. Please submit failing cases! @@ -32690,10 +32724,10 @@ function ImFontCalcWordWrapPositionEx_Uncached(baked, size, text, pos, text_end, wrap_width = wrap_width / scale -- We work with unscaled widths to avoid scaling every characters local s = pos - IM_ASSERT(text_end ~= nil) + assert(text_end ~= nil) - local prev_type = ImWcharClass.Other - local keep_blanks = bit32.band(flags, ImDrawTextFlags.WrapKeepBlanks) ~= 0 + local prev_type = 2 --[[ImWcharClass.Other]] + local keep_blanks = bit32.band(flags, 2 --[[ImDrawTextFlags.WrapKeepBlanks]]) ~= 0 -- Find next wrapping point --local span_begin = s @@ -32703,7 +32737,7 @@ function ImFontCalcWordWrapPositionEx_Uncached(baked, size, text, pos, text_end, local stop = false local text_is_str = type(text) == "string" -- [Luau] ImStrByte() inlined (once per character) local adv_data, adv_n = baked.IndexAdvanceX.Data, baked.IndexAdvanceX.Size -- [Luau] hoisted, refreshed after a glyph load - local CLASS_BLANK, CLASS_PUNCT, CLASS_OTHER = ImWcharClass.Blank, ImWcharClass.Punct, ImWcharClass.Other + local CLASS_BLANK, CLASS_PUNCT, CLASS_OTHER = 0 --[[ImWcharClass.Blank]], 1 --[[ImWcharClass.Punct]], 2 --[[ImWcharClass.Other]] local classifier_0000_007f = g_CharClassifierIsSeparator_0000_007f while s < text_end do repeat @@ -32825,8 +32859,8 @@ function ImFontCalcTextSizeEx(font, size, max_width, wrap_width, text, text_begi local cache_key = nil local wrap_cache = nil local text_len1 = text_is_str and #text + 1 or -1 - local cacheable = text_is_str and text_begin == 1 and out_offset == nil and max_width >= FLT_MAX - and (text_end == nil or text_end == text_len1) and (text_end_display == nil or text_end_display == text_len1) and (flags == nil or bit32.band(flags, ImDrawTextFlags.StopOnNewLine) == 0) + local cacheable = text_is_str and text_begin == 1 and out_offset == nil and max_width >= 3.4028234663853e+38 --[[FLT_MAX]] + and (text_end == nil or text_end == text_len1) and (text_end_display == nil or text_end_display == text_len1) and (flags == nil or bit32.band(flags, 4 --[[ImDrawTextFlags.StopOnNewLine]]) == 0) if cacheable and wrap_width <= 0.0 then local baked = font:GetFontBaked(size) local cache = baked._TextSizeCache @@ -32892,7 +32926,7 @@ function ImFontCalcTextSizeEx(font, size, max_width, wrap_width, text, text_begi text_size.y = text_size.y + line_height line_width = 0.0 s = ImTextCalcWordWrapNextLineStart(text, s, text_end, flags) -- Wrapping skips upcoming blanks - if bit32.band(flags, ImDrawTextFlags.StopOnNewLine) ~= 0 then + if bit32.band(flags, 4 --[[ImDrawTextFlags.StopOnNewLine]]) ~= 0 then stop = true; break end word_wrap_eol = nil @@ -32917,7 +32951,7 @@ function ImFontCalcTextSizeEx(font, size, max_width, wrap_width, text, text_begi text_size.x = ImMax(text_size.x, line_width) text_size.y = text_size.y + line_height line_width = 0.0 - if bit32.band(flags, ImDrawTextFlags.StopOnNewLine) ~= 0 then + if bit32.band(flags, 4 --[[ImDrawTextFlags.StopOnNewLine]]) ~= 0 then stop = true; break end @@ -32980,7 +33014,7 @@ end --- @param text_begin int --- @param text_end? int function MT.ImFont:CalcTextSizeA(size, max_width, wrap_width, text, text_begin, text_end) - return ImFontCalcTextSizeEx(self, size, max_width, wrap_width, text, text_begin, text_end, text_end, nil, ImDrawTextFlags.None) + return ImFontCalcTextSizeEx(self, size, max_width, wrap_width, text, text_begin, text_end, text_end, nil, 0 --[[ImDrawTextFlags.None]]) end --- Note: as with every ImDrawList drawing function, this expects that the font atlas texture is bound. @@ -32999,7 +33033,7 @@ function MT.ImFont:RenderChar(draw_list, size, pos, col, c, cpu_fine_clip) return end if glyph.Colored then - col = bit32.bor(col, bit32.bnot(IM_COL32_A_MASK)) + col = bit32.bor(col, bit32.bnot(4278190080 --[[IM_COL32_A_MASK]])) end local scale @@ -33011,7 +33045,7 @@ function MT.ImFont:RenderChar(draw_list, size, pos, col, c, cpu_fine_clip) local x = pos.x local y = pos.y - if bit32.band(draw_list.Flags, ImDrawListFlags.TextNoPixelSnap) == 0 then + if bit32.band(draw_list.Flags, 16 --[[ImDrawListFlags.TextNoPixelSnap]]) == 0 then x = IM_TRUNC(x) y = IM_TRUNC(y) end @@ -33047,14 +33081,14 @@ end function MT.ImFontAtlas:AddFont(font_cfg_in) -- Sanity Checks - IM_ASSERT(not self.Locked, "Cannot modify a locked ImFontAtlas!") - IM_ASSERT((font_cfg_in.FontData ~= nil and font_cfg_in.FontDataSize > 0) or (font_cfg_in.FontLoader ~= nil)) - IM_ASSERT(font_cfg_in.SizePixels > 0.0, "Is ImFontConfig struct correctly initialized?") - IM_ASSERT(font_cfg_in.RasterizerDensity > 0.0, "Is ImFontConfig struct correctly initialized?") + assert(not self.Locked, "Cannot modify a locked ImFontAtlas!") + assert((font_cfg_in.FontData ~= nil and font_cfg_in.FontDataSize > 0) or (font_cfg_in.FontLoader ~= nil)) + assert(font_cfg_in.SizePixels > 0.0, "Is ImFontConfig struct correctly initialized?") + assert(font_cfg_in.RasterizerDensity > 0.0, "Is ImFontConfig struct correctly initialized?") if font_cfg_in.GlyphOffset.x ~= 0.0 or font_cfg_in.GlyphOffset.y ~= 0.0 or - font_cfg_in.GlyphMinAdvanceX ~= 0.0 or font_cfg_in.GlyphMaxAdvanceX ~= FLT_MAX then - IM_ASSERT(font_cfg_in.SizePixels ~= 0.0, + font_cfg_in.GlyphMinAdvanceX ~= 0.0 or font_cfg_in.GlyphMaxAdvanceX ~= 3.4028234663853e+38 --[[FLT_MAX]] then + assert(font_cfg_in.SizePixels ~= 0.0, "Specifying glyph offset/advances requires a reference size to base it on.") end @@ -33075,7 +33109,7 @@ function MT.ImFontAtlas:AddFont(font_cfg_in) font.CurrentRasterizerDensity = font_cfg_in.RasterizerDensity self.Fonts:push_back(font) else - IM_ASSERT(self.Fonts.Size > 0, "Cannot use MergeMode for the first font!") -- When using MergeMode make sure that a font has already been added before. + assert(self.Fonts.Size > 0, "Cannot use MergeMode for the first font!") -- When using MergeMode make sure that a font has already been added before. font = (font_cfg_in.DstFont ~= nil) and font_cfg_in.DstFont or self.Fonts:back() ImFontAtlasFontDiscardBakes(self, font, 0) -- Need to discard bakes if the font was already used, because baked->FontLoaderDatas[] will change size. (#9162) end @@ -33094,21 +33128,21 @@ function MT.ImFontAtlas:AddFont(font_cfg_in) if font_cfg.GlyphExcludeRanges ~= nil then local size = 0 for _, v in ipairs(font_cfg.GlyphExcludeRanges) do if v == 0 then break end size = size + 1 end - IM_ASSERT(bit32.band(size, 1) == 0, "GlyphExcludeRanges[] size must be multiple of two!") - IM_ASSERT(size <= 64, "GlyphExcludeRanges[] size must be small!") + assert(bit32.band(size, 1) == 0, "GlyphExcludeRanges[] size must be multiple of two!") + assert(size <= 64, "GlyphExcludeRanges[] size must be small!") end if font_cfg.FontLoader ~= nil then - IM_ASSERT(font_cfg.FontLoader.FontBakedLoadGlyph ~= nil) - IM_ASSERT(font_cfg.FontLoader.LoaderInit == nil and font_cfg.FontLoader.LoaderShutdown == nil) -- FIXME-NEWATLAS: Unsupported yet. + assert(font_cfg.FontLoader.FontBakedLoadGlyph ~= nil) + assert(font_cfg.FontLoader.LoaderInit == nil and font_cfg.FontLoader.LoaderShutdown == nil) -- FIXME-NEWATLAS: Unsupported yet. end -- | Target w/ Implicit RefSize | Target w/ Explicit RefSize | -- Adding w/ Implicit RefSize: | OK (same scale) | OK (same scale) | -- Adding w/ Explicit RefSize: | KO | OK (custom scale) | if font_cfg_in.MergeMode and font_cfg_in.SizePixels > 0 then - IM_ASSERT(bit32.band(font.Flags, ImFontFlags.ImplicitRefSize) == 0, "Cannot use MergeMode with an explicit reference size when the destination font used an implicit reference size!") + assert(bit32.band(font.Flags, 16 --[[ImFontFlags.ImplicitRefSize]]) == 0, "Cannot use MergeMode with an explicit reference size when the destination font used an implicit reference size!") end - IM_ASSERT(font_cfg.FontLoaderData == nil) + assert(font_cfg.FontLoaderData == nil) if not ImFontAtlasFontSourceInit(self, font_cfg) then -- Rollback (this is a fragile/rarely exercised code-path. TestSuite's "misc_atlas_add_invalid_font" aim to test this) @@ -33150,10 +33184,10 @@ function MT.ImFontAtlas:AddFontDefault(font_cfg) end function MT.ImFontAtlas:AddFontFromMemoryTTF(font_data, font_data_size, size_pixels, font_cfg_template, glyph_ranges) - IM_ASSERT(not self.Locked, "Cannot modify a locked ImFontAtlas!") + assert(not self.Locked, "Cannot modify a locked ImFontAtlas!") local font_cfg = font_cfg_template and font_cfg_template or ImFontConfig() - IM_ASSERT(font_cfg.FontData == nil) - IM_ASSERT(font_data_size > 100, "Incorrect value for font_data_size!") -- Heuristic to prevent accidentally passing a wrong value to font_data_size. + assert(font_cfg.FontData == nil) + assert(font_data_size > 100, "Incorrect value for font_data_size!") -- Heuristic to prevent accidentally passing a wrong value to font_data_size. font_cfg.FontData = font_data font_cfg.FontDataSize = font_data_size font_cfg.SizePixels = (size_pixels > 0.0) and size_pixels or font_cfg.SizePixels @@ -33169,11 +33203,11 @@ function MT.ImFontAtlas:AddFontFromMemoryCompressedTTF() end function MT.ImFontAtlas:AddFontFromFileTTF(filename, size_pixels, font_cfg_template, glyph_ranges) - IM_ASSERT(not self.Locked, "Cannot modify a locked ImFontAtlas!") + assert(not self.Locked, "Cannot modify a locked ImFontAtlas!") local data, data_size = ImStd.ImFileLoadToMemory(filename, "rb") if not data then - if (font_cfg_template == nil or (bit32.band(font_cfg_template.Flags, ImFontFlags.NoLoadError) == 0)) then + if (font_cfg_template == nil or (bit32.band(font_cfg_template.Flags, 2 --[[ImFontFlags.NoLoadError]]) == 0)) then -- IMGUI_DEBUG_LOG("While loading '%s'\n", filename) IM_ASSERT_USER_ERROR(0, "Could not load font file!") end @@ -33215,7 +33249,7 @@ function MT.ImFontAtlas:AddFontDefaultBitmap(font_cfg_template) end if font_cfg.SizePixels <= 0.0 then font_cfg.SizePixels = 13.0 -- This only serves (1) as a reference for GlyphOffset.y setting and (2) as a default for pre-1.92 backend. - font_cfg.Flags = bit32.bor(font_cfg.Flags, ImFontFlags.ImplicitRefSize) + font_cfg.Flags = bit32.bor(font_cfg.Flags, 16 --[[ImFontFlags.ImplicitRefSize]]) end if not font_cfg.Name or font_cfg.Name == "" then font_cfg.Name = "ProggyClean.ttf" @@ -33237,7 +33271,7 @@ function MT.ImFontAtlas:AddFontDefaultVector(font_cfg_template) end if font_cfg.SizePixels <= 0.0 then font_cfg.SizePixels = 13.0 - font_cfg.Flags = bit32.bor(font_cfg.Flags, ImFontFlags.ImplicitRefSize) + font_cfg.Flags = bit32.bor(font_cfg.Flags, 16 --[[ImFontFlags.ImplicitRefSize]]) end if not font_cfg.Name or font_cfg.Name == "" then font_cfg.Name = "ProggyForever.ttf" @@ -33254,7 +33288,7 @@ function MT.ImFontAtlas:GetCustomRect(id, out_r) if r == nil then return false end - IM_ASSERT(self.TexData.Width > 0 and self.TexData.Height > 0) -- Font atlas needs to be built before we can calculate UV coordinates + assert(self.TexData.Width > 0 and self.TexData.Height > 0) -- Font atlas needs to be built before we can calculate UV coordinates if out_r == nil then return true end @@ -33275,10 +33309,10 @@ end --- @param out_uv_border ImVec2[] --- @param out_uv_fill ImVec2[] function ImFontAtlasGetMouseCursorTexData(atlas, cursor_type, out_offset, out_size, out_uv_border, out_uv_fill) - if cursor_type <= ImGuiMouseCursor.None or cursor_type >= ImGuiMouseCursor.COUNT then + if cursor_type <= (-1) --[[ImGuiMouseCursor.None]] or cursor_type >= 11 --[[ImGuiMouseCursor.COUNT]] then return false end - if bit32.band(atlas.Flags, ImFontAtlasFlags.NoMouseCursors) ~= 0 then + if bit32.band(atlas.Flags, 2 --[[ImFontAtlasFlags.NoMouseCursors]]) ~= 0 then return false end @@ -33289,7 +33323,7 @@ function ImFontAtlasGetMouseCursorTexData(atlas, cursor_type, out_offset, out_si ImVec2_Copy(out_offset, FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[cursor_type + 1][3]) ImVec2_Copy(out_uv_border[1], (pos) * atlas.TexUvScale) ImVec2_Copy(out_uv_border[2], (pos + size) * atlas.TexUvScale) - pos.x = pos.x + (FONT_ATLAS_DEFAULT_TEX_DATA_W + 1) + pos.x = pos.x + (122 --[[FONT_ATLAS_DEFAULT_TEX_DATA_W]] + 1) ImVec2_Copy(out_uv_fill[1], (pos) * atlas.TexUvScale) ImVec2_Copy(out_uv_fill[2], (pos + size) * atlas.TexUvScale) @@ -33298,16 +33332,16 @@ end -- At it is common to do an AddCustomRect() followed by a GetCustomRect(), we provide an optional 'out_r' argument to retrieve the info straight away. function MT.ImFontAtlas:AddCustomRect(width, height, out_r) - IM_ASSERT(width > 0 and width <= 0xFFFF) - IM_ASSERT(height > 0 and height <= 0xFFFF) + assert(width > 0 and width <= 0xFFFF) + assert(height > 0 and height <= 0xFFFF) if (self.Builder == nil) then ImFontAtlasBuildInit(self) end local r_id = ImFontAtlasPackAddRect(self, width, height) - if (r_id == ImFontAtlasRectId_Invalid) then - return ImFontAtlasRectId_Invalid + if (r_id == (-1) --[[ImFontAtlasRectId_Invalid]]) then + return (-1) --[[ImFontAtlasRectId_Invalid]] end if (out_r ~= nil) then self:GetCustomRect(r_id, out_r) @@ -33373,10 +33407,10 @@ function ImGui.AddDrawListToDrawDataEx(draw_data, out_list, draw_list) -- Draw list sanity check. Detect mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc. -- May trigger for you if you are using PrimXXX functions incorrectly. - IM_ASSERT(draw_list.VtxBuffer.Size == 0 or draw_list._VtxWritePtr == draw_list.VtxBuffer.Size + 1) - IM_ASSERT(draw_list.IdxBuffer.Size == 0 or draw_list._IdxWritePtr == draw_list.IdxBuffer.Size + 1) - if (bit32.band(draw_list.Flags, ImDrawListFlags.AllowVtxOffset) == 0) then - IM_ASSERT(draw_list._VtxCurrentIdx == draw_list.VtxBuffer.Size + 1) + assert(draw_list.VtxBuffer.Size == 0 or draw_list._VtxWritePtr == draw_list.VtxBuffer.Size + 1) + assert(draw_list.IdxBuffer.Size == 0 or draw_list._IdxWritePtr == draw_list.IdxBuffer.Size + 1) + if (bit32.band(draw_list.Flags, 8 --[[ImDrawListFlags.AllowVtxOffset]]) == 0) then + assert(draw_list._VtxCurrentIdx == draw_list.VtxBuffer.Size + 1) end -- Add to output list + records state in ImDrawData @@ -33393,9 +33427,9 @@ end local IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN = 4 local IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX = 512 -local function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(_RAD, _MAXERROR) return ImClamp(IM_ROUNDUP_TO_EVEN(ImCeil(IM_PI / ImAcos(1 - ImMin(_MAXERROR, _RAD) / _RAD))), IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX) end -local function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_R(_N, _MAXERROR) return (_MAXERROR / (1 - ImCos(IM_PI / ImMax(_N, IM_PI)))) end -local function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_ERROR(_N, _RAD) return ((1 - ImCos(IM_PI / ImMax(_N, IM_PI))) / _RAD) end +local function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(_RAD, _MAXERROR) return ImClamp(IM_ROUNDUP_TO_EVEN(ImCeil(3.141592653589793 --[[IM_PI]] / ImAcos(1 - ImMin(_MAXERROR, _RAD) / _RAD))), IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX) end +local function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_R(_N, _MAXERROR) return (_MAXERROR / (1 - ImCos(3.141592653589793 --[[IM_PI]] / ImMax(_N, 3.141592653589793 --[[IM_PI]])))) end +local function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_ERROR(_N, _RAD) return ((1 - ImCos(3.141592653589793 --[[IM_PI]] / ImMax(_N, 3.141592653589793 --[[IM_PI]]))) / _RAD) end ------------------------------------------------------------------------------- -- [SECTION] ImDrawList @@ -33406,15 +33440,15 @@ function MT.ImDrawListSharedData:SetCircleTessellationMaxError(max_error) return end - IM_ASSERT(max_error > 0) + assert(max_error > 0) self.CircleTessellationMaxError = max_error for i = 1, 64 do -- IM_COUNTOF(CircleSegmentCounts) local radius = (i - 1) - self.CircleSegmentCounts[i] = (i > 1) and IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(radius, self.CircleTessellationMaxError) or IM_DRAWLIST_ARCFAST_SAMPLE_MAX + self.CircleSegmentCounts[i] = (i > 1) and IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(radius, self.CircleTessellationMaxError) or 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] end - self.ArcFastRadiusCutoff = IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_R(IM_DRAWLIST_ARCFAST_SAMPLE_MAX, self.CircleTessellationMaxError) + self.ArcFastRadiusCutoff = IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_R(48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]], self.CircleTessellationMaxError) end --- @param data ImDrawListSharedData @@ -33463,7 +33497,7 @@ function MT.ImDrawList:_ClearFreeMemory() self.IdxBuffer:clear() self.VtxBuffer:clear() - self.Flags = ImDrawListFlags.None + self.Flags = 0 --[[ImDrawListFlags.None]] self._VtxCurrentIdx = 1 self._VtxWritePtr = 1 @@ -33484,7 +33518,7 @@ function MT.ImDrawList:AddDrawCmd() draw_cmd.VtxOffset = self._CmdHeader.VtxOffset draw_cmd.IdxOffset = self.IdxBuffer.Size - IM_ASSERT(draw_cmd.ClipRect.x <= draw_cmd.ClipRect.z and draw_cmd.ClipRect.y <= draw_cmd.ClipRect.w) + assert(draw_cmd.ClipRect.x <= draw_cmd.ClipRect.z and draw_cmd.ClipRect.y <= draw_cmd.ClipRect.w) -- [Luau] inline self.CmdBuffer:push_back(draw_cmd) local cmd_buffer = self.CmdBuffer local n = cmd_buffer.Size + 1 @@ -33510,11 +33544,11 @@ end function MT.ImDrawList:AddCallback(callback, userdata, userdata_size) if userdata_size == nil then userdata_size = 0 end - IM_ASSERT(callback ~= nil) + assert(callback ~= nil) IM_ASSERT_PARANOID(self.CmdBuffer.Size > 0) local curr_cmd = self.CmdBuffer.Data[self.CmdBuffer.Size] - IM_ASSERT(curr_cmd.UserCallback == nil) + assert(curr_cmd.UserCallback == nil) if curr_cmd.ElemCount ~= 0 then self:AddDrawCmd() curr_cmd = self.CmdBuffer.Data[self.CmdBuffer.Size] @@ -33526,8 +33560,8 @@ function MT.ImDrawList:AddCallback(callback, userdata, userdata_size) curr_cmd.UserCallbackData = userdata else - IM_ASSERT(userdata ~= nil) - IM_ASSERT(userdata_size < bit32.lshift(1, 31)) + assert(userdata ~= nil) + assert(userdata_size < bit32.lshift(1, 31)) end @@ -33608,7 +33642,7 @@ function MT.ImDrawList:_OnChangedClipRect() end end - IM_ASSERT(curr_cmd.UserCallback == nil) + assert(curr_cmd.UserCallback == nil) -- Try to merge with previous command if it matches, else use current command local prev_cmd = self.CmdBuffer.Data[self.CmdBuffer.Size - 1] @@ -33658,7 +33692,7 @@ function MT.ImDrawList:_OnChangedVtxOffset() self:AddDrawCmd() return end - IM_ASSERT(curr_cmd.UserCallback == nil) + assert(curr_cmd.UserCallback == nil) curr_cmd.VtxOffset = self._CmdHeader.VtxOffset end @@ -33701,7 +33735,7 @@ end --- @param draw_list ImDrawList --- @param channels_count int function MT.ImDrawListSplitter:Split(draw_list, channels_count) - IM_ASSERT(self._Current == 0 and self._Count <= 1, "Nested channel splitting is not supported. Please use separate instances of ImDrawListSplitter.") + assert(self._Current == 0 and self._Count <= 1, "Nested channel splitting is not supported. Please use separate instances of ImDrawListSplitter.") local old_channels_count = self._Channels.Size if old_channels_count < channels_count then self._Channels:reserve(channels_count) -- Avoid over reserving since this is likely to stay stable @@ -33818,7 +33852,7 @@ end --- @param idx int # 0-based channel index @native function MT.ImDrawListSplitter:SetCurrentChannel(draw_list, idx) - IM_ASSERT(idx >= 0 and idx < self._Count) + assert(idx >= 0 and idx < self._Count) if self._Current == idx then return end @@ -33870,15 +33904,15 @@ function MT.ImDrawList:ChannelsSetCurrent(n) self._Splitter:SetCurrentChannel(se --- @param col ImU32 @native function MT.ImDrawList:AddConvexPolyFilled(points, points_count, col) - if points_count < 3 or bit32.band(col, IM_COL32_A_MASK) == 0 then + if points_count < 3 or bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end local uv = self._Data.TexUvWhitePixel - if bit32.band(self.Flags, ImDrawListFlags.AntiAliasedFill) ~= 0 then + if bit32.band(self.Flags, 4 --[[ImDrawListFlags.AntiAliasedFill]]) ~= 0 then local AA_SIZE = self._FringeScale - local col_trans = bit32.band(col, bit32.bnot(IM_COL32_A_MASK)) + local col_trans = bit32.band(col, bit32.bnot(4278190080 --[[IM_COL32_A_MASK]])) local idx_count = (points_count - 2) * 3 + points_count * 6 local vtx_count = points_count * 2 self:PrimReserve(idx_count, vtx_count) @@ -33962,7 +33996,7 @@ function MT.ImDrawList:PushTexture(tex_ref) self._TextureStack:push_back(tex_ref) self._CmdHeader.TexRef = tex_ref if (tex_ref._TexData ~= nil) then - IM_ASSERT(tex_ref._TexData.WantDestroyNextFrame == false) + assert(tex_ref._TexData.WantDestroyNextFrame == false) end self:_OnChangedTexture() end @@ -33992,7 +34026,7 @@ local function PrimReserve(self, idx_count, vtx_count) -- Large mesh support (when enabled) IM_ASSERT_PARANOID(idx_count >= 0 and vtx_count >= 0) - if (self._VtxCurrentIdx + vtx_count >= bit32.lshift(1, 16)) and (bit32.band(self.Flags, ImDrawListFlags.AllowVtxOffset) ~= 0) then + if (self._VtxCurrentIdx + vtx_count >= bit32.lshift(1, 16)) and (bit32.band(self.Flags, 8 --[[ImDrawListFlags.AllowVtxOffset]]) ~= 0) then -- FIXME: In theory we should be testing that vtx_count <64k here. -- In practice, RenderText() relies on reserving ahead for a worst case scenario so it is currently useful for us -- to not make that check until we rework the text functions to handle clipping and large horizontal lines better. @@ -34108,11 +34142,11 @@ end function MT.ImDrawList:AddPolyline(points, points_count, col, thickness, flags) if flags == nil then flags = 0 end - if points_count < 2 or bit32.band(col, IM_COL32_A_MASK) == 0 then + if points_count < 2 or bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end - local closed = bit32.band(flags, ImDrawFlags.Closed) ~= 0 + local closed = bit32.band(flags, 512 --[[ImDrawFlags.Closed]]) ~= 0 local opaque_uv = self._Data.TexUvWhitePixel local count = closed and points_count or points_count - 1 -- Number of line segments local thick_line = thickness > self._FringeScale @@ -34120,12 +34154,12 @@ function MT.ImDrawList:AddPolyline(points, points_count, col, thickness, flags) -- - 1.92.8 (2025/05): swapped two last parameters order: flags, thickness --> thickness, flags. This should normally be caught by compile-time type-checking. -- - 1.92.8 (2025/05): changed value of ImDrawList_Closed which was previously guaranteed to be == 1. Hardcoded use of 1 or true should be replaced. -- Read more details near AddRect() + see "API BREAKING CHANGES" section for 1.82, 1.90 and 1.92.8. - IM_ASSERT_USER_ERROR_RET(bit32.band(flags, ImDrawFlags.InvalidMask_) == 0, "Incorrect parameter. Did you swap 'thickness' and 'flags'?") + IM_ASSERT_USER_ERROR_RET(bit32.band(flags, 2147483663 --[[ImDrawFlags.InvalidMask_]]) == 0, "Incorrect parameter. Did you swap 'thickness' and 'flags'?") - if bit32.band(self.Flags, ImDrawListFlags.AntiAliasedLines) ~= 0 then + if bit32.band(self.Flags, 1 --[[ImDrawListFlags.AntiAliasedLines]]) ~= 0 then -- Anti-aliased stroke local AA_SIZE = self._FringeScale - local col_trans = bit32.band(col, bit32.bnot(IM_COL32_A_MASK)) + local col_trans = bit32.band(col, bit32.bnot(4278190080 --[[IM_COL32_A_MASK]])) -- Thicknesses <1.0 should behave like thickness 1.0 thickness = ImMax(thickness, 1.0) @@ -34133,9 +34167,9 @@ function MT.ImDrawList:AddPolyline(points, points_count, col, thickness, flags) local fractional_thickness = thickness - integer_thickness -- Do we want to draw this line using a texture? - local use_texture = bit32.band(self.Flags, ImDrawListFlags.AntiAliasedLinesUseTex) ~= 0 and integer_thickness < IM_DRAWLIST_TEX_LINES_WIDTH_MAX and fractional_thickness <= 0.00001 and AA_SIZE == 1.0 + local use_texture = bit32.band(self.Flags, 2 --[[ImDrawListFlags.AntiAliasedLinesUseTex]]) ~= 0 and integer_thickness < IM_DRAWLIST_TEX_LINES_WIDTH_MAX and fractional_thickness <= 0.00001 and AA_SIZE == 1.0 - IM_ASSERT_PARANOID((not use_texture) or bit32.band(self._Data.Font.OwnerAtlas.Flags, ImFontAtlasFlags.NoBakedLines) == 0) + IM_ASSERT_PARANOID((not use_texture) or bit32.band(self._Data.Font.OwnerAtlas.Flags, 4 --[[ImFontAtlasFlags.NoBakedLines]]) == 0) local idx_count = use_texture and (count * 6) or (thick_line and count * 18 or count * 12) local vtx_count = use_texture and (points_count * 2) or (thick_line and points_count * 4 or points_count * 3) @@ -34361,28 +34395,28 @@ local function PathRectXY(self, ax, ay, bx, by, rounding, flags) if not flags then flags = 0 end if rounding >= 0.5 then - IM_ASSERT(bit32.band(flags, 0x0F) == 0, "Misuse of legacy hardcoded ImDrawCornerFlags values!") - if bit32.band(flags, ImDrawFlags.RoundCornersMask_) == 0 then - flags = bit32.bor(flags, ImDrawFlags.RoundCornersAll) + assert(bit32.band(flags, 0x0F) == 0, "Misuse of legacy hardcoded ImDrawCornerFlags values!") + if bit32.band(flags, 496 --[[ImDrawFlags.RoundCornersMask_]]) == 0 then + flags = bit32.bor(flags, 240 --[[ImDrawFlags.RoundCornersAll]]) end - rounding = ImMin(rounding, ImAbs(bx - ax) * (((bit32.band(flags, ImDrawFlags.RoundCornersTop) == ImDrawFlags.RoundCornersTop) or (bit32.band(flags, ImDrawFlags.RoundCornersBottom) == ImDrawFlags.RoundCornersBottom)) and 0.5 or 1.0) - 1.0) - rounding = ImMin(rounding, ImAbs(by - ay) * (((bit32.band(flags, ImDrawFlags.RoundCornersLeft) == ImDrawFlags.RoundCornersLeft) or (bit32.band(flags, ImDrawFlags.RoundCornersRight) == ImDrawFlags.RoundCornersRight)) and 0.5 or 1.0) - 1.0) + rounding = ImMin(rounding, ImAbs(bx - ax) * (((bit32.band(flags, 48 --[[ImDrawFlags.RoundCornersTop]]) == 48 --[[ImDrawFlags.RoundCornersTop]]) or (bit32.band(flags, 192 --[[ImDrawFlags.RoundCornersBottom]]) == 192 --[[ImDrawFlags.RoundCornersBottom]])) and 0.5 or 1.0) - 1.0) + rounding = ImMin(rounding, ImAbs(by - ay) * (((bit32.band(flags, 80 --[[ImDrawFlags.RoundCornersLeft]]) == 80 --[[ImDrawFlags.RoundCornersLeft]]) or (bit32.band(flags, 160 --[[ImDrawFlags.RoundCornersRight]]) == 160 --[[ImDrawFlags.RoundCornersRight]])) and 0.5 or 1.0) - 1.0) end - if rounding < 0.5 or (bit32.band(flags, ImDrawFlags.RoundCornersMask_) == ImDrawFlags.RoundCornersNone) then + if rounding < 0.5 or (bit32.band(flags, 496 --[[ImDrawFlags.RoundCornersMask_]]) == 256 --[[ImDrawFlags.RoundCornersNone]]) then PathLineToXY(self, ax, ay) PathLineToXY(self, bx, ay) PathLineToXY(self, bx, by) PathLineToXY(self, ax, by) else - local rounding_tl = (bit32.band(flags, ImDrawFlags.RoundCornersTopLeft) ~= 0) and rounding or 0.0 - local rounding_tr = (bit32.band(flags, ImDrawFlags.RoundCornersTopRight) ~= 0) and rounding or 0.0 - local rounding_br = (bit32.band(flags, ImDrawFlags.RoundCornersBottomRight) ~= 0) and rounding or 0.0 - local rounding_bl = (bit32.band(flags, ImDrawFlags.RoundCornersBottomLeft) ~= 0) and rounding or 0.0 + local rounding_tl = (bit32.band(flags, 16 --[[ImDrawFlags.RoundCornersTopLeft]]) ~= 0) and rounding or 0.0 + local rounding_tr = (bit32.band(flags, 32 --[[ImDrawFlags.RoundCornersTopRight]]) ~= 0) and rounding or 0.0 + local rounding_br = (bit32.band(flags, 128 --[[ImDrawFlags.RoundCornersBottomRight]]) ~= 0) and rounding or 0.0 + local rounding_bl = (bit32.band(flags, 64 --[[ImDrawFlags.RoundCornersBottomLeft]]) ~= 0) and rounding or 0.0 -- [Luau] inline PathArcToFast() (radius < 0.5 handled by _PathArcToFastExXY()) - _PathArcToFastExXY(self, ax + rounding_tl, ay + rounding_tl, rounding_tl, 6 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, 9 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, 0) - _PathArcToFastExXY(self, bx - rounding_tr, ay + rounding_tr, rounding_tr, 9 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, 12 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, 0) - _PathArcToFastExXY(self, bx - rounding_br, by - rounding_br, rounding_br, 0 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, 3 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, 0) - _PathArcToFastExXY(self, ax + rounding_bl, by - rounding_bl, rounding_bl, 3 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, 6 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, 0) + _PathArcToFastExXY(self, ax + rounding_tl, ay + rounding_tl, rounding_tl, 6 * 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / 12, 9 * 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / 12, 0) + _PathArcToFastExXY(self, bx - rounding_tr, ay + rounding_tr, rounding_tr, 9 * 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / 12, 12 * 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / 12, 0) + _PathArcToFastExXY(self, bx - rounding_br, by - rounding_br, rounding_br, 0 * 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / 12, 3 * 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / 12, 0) + _PathArcToFastExXY(self, ax + rounding_bl, by - rounding_bl, rounding_bl, 3 * 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / 12, 6 * 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / 12, 0) end end @@ -34395,9 +34429,9 @@ function MT.ImDrawList:AddRectFilled(p_min, p_max, col, rounding, flags) if not rounding then rounding = 0.0 end if not flags then flags = 0 end - if bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end - if rounding < 0.5 or (bit32.band(flags, ImDrawFlags.RoundCornersMask_) == ImDrawFlags.RoundCornersNone) then + if rounding < 0.5 or (bit32.band(flags, 496 --[[ImDrawFlags.RoundCornersMask_]]) == 256 --[[ImDrawFlags.RoundCornersNone]]) then PrimReserve(self, 6, 4) -- [Luau] local calls PrimRectXY(self, p_min.x, p_min.y, p_max.x, p_max.y, col) else @@ -34415,7 +34449,7 @@ end --- @param col_bot_right ImU32 --- @param col_bot_left ImU32 function MT.ImDrawList:AddRectFilledMultiColor(p_min, p_max, col_upr_left, col_upr_right, col_bot_right, col_bot_left) - if bit32.band(bit32.bor(col_upr_left, col_upr_right, col_bot_right, col_bot_left), IM_COL32_A_MASK) == 0 then + if bit32.band(bit32.bor(col_upr_left, col_upr_right, col_bot_right, col_bot_left), 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end @@ -34456,13 +34490,13 @@ function MT.ImDrawList:AddRect(p_min, p_max, col, rounding, thickness, flags) -- - Hard coded support for values 0x01 to 0x0F (matching 15 out of 16 old flags combinations) --> see FixRectCornerFlags() in <1.90 code. -- - Hard coded 0x00 with 'float rounding > 0.0f' --> replace with ImDrawFlags_RoundNone or use 'float rounding = 0.0f'. -- See "API BREAKING CHANGES" section for 1.82, 1.90 and 1.92.8. - IM_ASSERT_USER_ERROR_RET(bit32.band(flags, ImDrawFlags.InvalidMask_) == 0, "Incorrect parameter. Did you swap 'thickness' and 'flags'?") -- Or misuse of legacy hard-coded ImDrawCornerFlags values + IM_ASSERT_USER_ERROR_RET(bit32.band(flags, 2147483663 --[[ImDrawFlags.InvalidMask_]]) == 0, "Incorrect parameter. Did you swap 'thickness' and 'flags'?") -- Or misuse of legacy hard-coded ImDrawCornerFlags values - if bit32.band(col, IM_COL32_A_MASK) == 0 then + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end -- [Luau] square corners + whole-pixel thickness: 4 filled rects instead of a stroked path (same pixels, far cheaper here) - if (rounding == nil or rounding < 0.5 or bit32.band(flags, ImDrawFlags.RoundCornersMask_) == ImDrawFlags.RoundCornersNone) + if (rounding == nil or rounding < 0.5 or bit32.band(flags, 496 --[[ImDrawFlags.RoundCornersMask_]]) == 256 --[[ImDrawFlags.RoundCornersNone]]) and thickness >= 1.0 and thickness % 1 == 0 and p_max.x - p_min.x > 2 * thickness and p_max.y - p_min.y > 2 * thickness then local x0, y0, x1, y1, t = p_min.x, p_min.y, p_max.x, p_max.y, thickness PrimReserve(self, 24, 16) @@ -34472,17 +34506,17 @@ function MT.ImDrawList:AddRect(p_min, p_max, col, rounding, thickness, flags) PrimRectXY(self, x1 - t, y0 + t, x1, y1 - t, col) return end - if bit32.band(self.Flags, ImDrawListFlags.AntiAliasedLines) ~= 0 then + if bit32.band(self.Flags, 1 --[[ImDrawListFlags.AntiAliasedLines]]) ~= 0 then PathRectXY(self, p_min.x + 0.50, p_min.y + 0.50, p_max.x - 0.50, p_max.y - 0.50, rounding, flags) -- [Luau] scalar math, no temporary ImVec2 else PathRectXY(self, p_min.x + 0.50, p_min.y + 0.50, p_max.x - 0.49, p_max.y - 0.49, rounding, flags) -- Better looking lower-right corner and rounded non-AA shapes. end - self:PathStroke(col, thickness, ImDrawFlags.Closed) + self:PathStroke(col, thickness, 512 --[[ImDrawFlags.Closed]]) end function MT.ImDrawList:AddLine(p1, p2, col, thickness) - if bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end PathLineToXY(self, p1.x + 0.5, p1.y + 0.5) -- [Luau] scalar math, no temporary ImVec2 PathLineToXY(self, p2.x + 0.5, p2.y + 0.5) @@ -34497,7 +34531,7 @@ end function MT.ImDrawList:AddLineH(min_x, max_x, y, col, thickness) if thickness == nil then thickness = 1.0 end - if bit32.band(col, IM_COL32_A_MASK) == 0 then + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end PathLineToXY(self, min_x + 0.5, y + 0.5) @@ -34513,7 +34547,7 @@ end function MT.ImDrawList:AddLineV(x, min_y, max_y, col, thickness) if thickness == nil then thickness = 1.0 end - if bit32.band(col, IM_COL32_A_MASK) == 0 then + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end PathLineToXY(self, x + 0.5, min_y + 0.5) @@ -34522,29 +34556,29 @@ function MT.ImDrawList:AddLineV(x, min_y, max_y, col, thickness) end function MT.ImDrawList:AddTriangle(p1, p2, p3, col, thickness) - if bit32.band(col, IM_COL32_A_MASK) == 0 then + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end self:PathLineTo(p1) self:PathLineTo(p2) self:PathLineTo(p3) - self:PathStroke(col, thickness, ImDrawFlags.Closed) + self:PathStroke(col, thickness, 512 --[[ImDrawFlags.Closed]]) end function MT.ImDrawList:AddQuad(p1, p2, p3, p4, col, thickness) if thickness == nil then thickness = 1.0 end - if bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end self:PathLineTo(p1) self:PathLineTo(p2) self:PathLineTo(p3) self:PathLineTo(p4) - self:PathStroke(col, thickness, ImDrawFlags.Closed) + self:PathStroke(col, thickness, 512 --[[ImDrawFlags.Closed]]) end function MT.ImDrawList:AddQuadFilled(p1, p2, p3, p4, col) - if bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end self:PathLineTo(p1) self:PathLineTo(p2) @@ -34554,7 +34588,7 @@ function MT.ImDrawList:AddQuadFilled(p1, p2, p3, p4, col) end function MT.ImDrawList:AddTriangleFilled(p1, p2, p3, col) - if bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end self:PathLineTo(p1) self:PathLineTo(p2) @@ -34571,24 +34605,24 @@ function MT.ImDrawList:AddCircle(center, radius, col, num_segments, thickness) if num_segments == nil then num_segments = 0 end if thickness == nil then thickness = 1.0 end - if bit32.band(col, IM_COL32_A_MASK) == 0 or radius < 0.5 then + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 or radius < 0.5 then return end if num_segments <= 0 then -- Use arc with automatic segment count - _PathArcToFastExXY(self, center.x, center.y, radius - 0.5, 0, IM_DRAWLIST_ARCFAST_SAMPLE_MAX, 0) + _PathArcToFastExXY(self, center.x, center.y, radius - 0.5, 0, 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]], 0) self._Path.Size = self._Path.Size - 1 else -- Explicit segment count (still clamp to avoid drawing insanely tessellated shapes) num_segments = ImClamp(num_segments, 3, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX) -- Because we are filling a closed shape we remove 1 from the count of segments/points - local a_max = (IM_PI * 2.0) * (num_segments - 1) / num_segments + local a_max = (3.141592653589793 --[[IM_PI]] * 2.0) * (num_segments - 1) / num_segments self:PathArcTo(center, radius - 0.5, 0.0, a_max, num_segments - 1) end - self:PathStroke(col, thickness, ImDrawFlags.Closed) + self:PathStroke(col, thickness, 512 --[[ImDrawFlags.Closed]]) end --- @param center ImVec2 @@ -34598,20 +34632,20 @@ end function MT.ImDrawList:AddCircleFilled(center, radius, col, num_segments) if num_segments == nil then num_segments = 0 end - if bit32.band(col, IM_COL32_A_MASK) == 0 or radius < 0.5 then + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 or radius < 0.5 then return end if num_segments <= 0 then -- Use arc with automatic segment count - _PathArcToFastExXY(self, center.x, center.y, radius, 0, IM_DRAWLIST_ARCFAST_SAMPLE_MAX, 0) + _PathArcToFastExXY(self, center.x, center.y, radius, 0, 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]], 0) self._Path.Size = self._Path.Size - 1 else -- Explicit segment count (still clamp to avoid drawing insanely tessellated shapes) num_segments = ImClamp(num_segments, 3, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX) -- Because we are filling a closed shape we remove 1 from the count of segments/points - local a_max = (IM_PI * 2.0) * (num_segments - 1) / num_segments + local a_max = (3.141592653589793 --[[IM_PI]] * 2.0) * (num_segments - 1) / num_segments self:PathArcTo(center, radius, 0.0, a_max, num_segments - 1) end @@ -34638,7 +34672,7 @@ function MT.ImDrawList:AddText(font, font_size, pos, col, text, text_begin, text end if text_begin == nil then text_begin = 1 end - if bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end -- Accept null ranges if text_begin == text_end then @@ -34664,7 +34698,7 @@ function MT.ImDrawList:AddText(font, font_size, pos, col, text, text_begin, text clip_rect.w = math.min(clip_rect.w, cpu_fine_clip_rect.w) end - font:RenderText(self, font_size, pos, col, clip_rect, text, text_begin, text_end, wrap_width, (cpu_fine_clip_rect ~= nil) and ImDrawTextFlags.CpuFineClip or ImDrawTextFlags.None) + font:RenderText(self, font_size, pos, col, clip_rect, text, text_begin, text_end, wrap_width, (cpu_fine_clip_rect ~= nil) and 1 --[[ImDrawTextFlags.CpuFineClip]] or 0 --[[ImDrawTextFlags.None]]) end --- @param tex_ref ImTextureRef @@ -34676,9 +34710,9 @@ end function MT.ImDrawList:AddImage(tex_ref, p_min, p_max, uv_min, uv_max, col) if uv_min == nil then uv_min = ImVec2(0, 0) end if uv_max == nil then uv_max = ImVec2(1, 1) end - if col == nil then col = IM_COL32_WHITE end + if col == nil then col = 4294967295 --[[IM_COL32_WHITE]] end - if bit32.band(col, IM_COL32_A_MASK) == 0 then + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end @@ -34704,16 +34738,16 @@ end --- @param rounding float --- @param flags ImDrawFlags function MT.ImDrawList:AddImageRounded(tex_ref, p_min, p_max, uv_min, uv_max, col, rounding, flags) - if bit32.band(col, IM_COL32_A_MASK) == 0 then + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end - IM_ASSERT(bit32.band(flags, 0x0F) == 0, "Misuse of legacy hardcoded ImDrawCornerFlags values!") -- If this assert triggers on legacy code: see comments in ImDrawList:PathRect(). - if bit32.band(flags, ImDrawFlags.RoundCornersMask_) == 0 then - flags = bit32.bor(flags, ImDrawFlags.RoundCornersAll) + assert(bit32.band(flags, 0x0F) == 0, "Misuse of legacy hardcoded ImDrawCornerFlags values!") -- If this assert triggers on legacy code: see comments in ImDrawList:PathRect(). + if bit32.band(flags, 496 --[[ImDrawFlags.RoundCornersMask_]]) == 0 then + flags = bit32.bor(flags, 240 --[[ImDrawFlags.RoundCornersAll]]) end - if rounding < 0.5 or bit32.band(flags, ImDrawFlags.RoundCornersMask_) == ImDrawFlags.RoundCornersNone then + if rounding < 0.5 or bit32.band(flags, 496 --[[ImDrawFlags.RoundCornersMask_]]) == 256 --[[ImDrawFlags.RoundCornersNone]] then self:AddImage(tex_ref, p_min, p_max, uv_min, uv_max, col) return end @@ -34772,7 +34806,7 @@ end function MT.ImDrawList:PopClipRect() local stack = self._ClipRectStack - IM_ASSERT(stack.Size > 0) + assert(stack.Size > 0) stack.Size = stack.Size - 1 -- [Luau] inline pop_back() if (stack.Size == 0) then -- LUA: No "Ternary Operator" ImVec4_Copy(self._CmdHeader.ClipRect, self._Data.ClipRectFullscreen) @@ -34797,11 +34831,11 @@ function _PathArcToFastExXY(self, cx, cy, radius, a_min_sample, a_max_sample, a_ -- Calculate arc auto segment step size if a_step <= 0 then - a_step = math.floor(IM_DRAWLIST_ARCFAST_SAMPLE_MAX / self:_CalcCircleAutoSegmentCount(radius)) + a_step = math.floor(48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / self:_CalcCircleAutoSegmentCount(radius)) end -- Make sure we never do steps larger than one quarter of the circle - a_step = ImClamp(a_step, 1, math.floor(IM_DRAWLIST_ARCFAST_TABLE_SIZE / 4)) + a_step = ImClamp(a_step, 1, math.floor(48 --[[IM_DRAWLIST_ARCFAST_TABLE_SIZE]] / 4)) local sample_range = ImAbs(a_max_sample - a_min_sample) local a_next_step = a_step @@ -34829,10 +34863,10 @@ function _PathArcToFastExXY(self, cx, cy, radius, a_min_sample, a_max_sample, a_ local path_data, arc_fast_vtx = self._Path.Data, self._Data.ArcFastVtx -- [Luau] cache local sample_index = a_min_sample - if sample_index < 0 or sample_index >= IM_DRAWLIST_ARCFAST_SAMPLE_MAX then - sample_index = sample_index % IM_DRAWLIST_ARCFAST_SAMPLE_MAX + if sample_index < 0 or sample_index >= 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] then + sample_index = sample_index % 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] if sample_index < 0 then - sample_index = sample_index + IM_DRAWLIST_ARCFAST_SAMPLE_MAX + sample_index = sample_index + 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] end end @@ -34840,8 +34874,8 @@ function _PathArcToFastExXY(self, cx, cy, radius, a_min_sample, a_max_sample, a_ local a = a_min_sample while a <= a_max_sample do -- a_step is clamped to IM_DRAWLIST_ARCFAST_SAMPLE_MAX, so we have guaranteed that it will not wrap over range twice or more - if sample_index >= IM_DRAWLIST_ARCFAST_SAMPLE_MAX then - sample_index = sample_index - IM_DRAWLIST_ARCFAST_SAMPLE_MAX + if sample_index >= 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] then + sample_index = sample_index - 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] end local s = arc_fast_vtx[sample_index + 1] @@ -34858,7 +34892,7 @@ function _PathArcToFastExXY(self, cx, cy, radius, a_min_sample, a_max_sample, a_ while a >= a_max_sample do -- a_step is clamped to IM_DRAWLIST_ARCFAST_SAMPLE_MAX, so we have guaranteed that it will not wrap over range twice or more if sample_index < 0 then - sample_index = sample_index + IM_DRAWLIST_ARCFAST_SAMPLE_MAX + sample_index = sample_index + 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] end local s = arc_fast_vtx[sample_index + 1] @@ -34873,9 +34907,9 @@ function _PathArcToFastExXY(self, cx, cy, radius, a_min_sample, a_max_sample, a_ end if extra_max_sample then - local normalized_max_sample = a_max_sample % IM_DRAWLIST_ARCFAST_SAMPLE_MAX + local normalized_max_sample = a_max_sample % 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] if normalized_max_sample < 0 then - normalized_max_sample = normalized_max_sample + IM_DRAWLIST_ARCFAST_SAMPLE_MAX + normalized_max_sample = normalized_max_sample + 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] end local s = arc_fast_vtx[normalized_max_sample + 1] @@ -34899,7 +34933,7 @@ function MT.ImDrawList:PathArcToFast(center, radius, a_min_of_12, a_max_of_12) return end - _PathArcToFastExXY(self, center.x, center.y, radius, a_min_of_12 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, a_max_of_12 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, 0) + _PathArcToFastExXY(self, center.x, center.y, radius, a_min_of_12 * 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / 12, a_max_of_12 * 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / 12, 0) end --- @param center ImVec2 @@ -34952,15 +34986,15 @@ function MT.ImDrawList:PathArcTo(center, radius, a_min, a_max, num_segments) -- We are going to use precomputed values for mid samples. -- Determine first and last sample in lookup table that belong to the arc. - local a_min_sample_f = IM_DRAWLIST_ARCFAST_SAMPLE_MAX * a_min / (IM_PI * 2.0) - local a_max_sample_f = IM_DRAWLIST_ARCFAST_SAMPLE_MAX * a_max / (IM_PI * 2.0) + local a_min_sample_f = 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] * a_min / (3.141592653589793 --[[IM_PI]] * 2.0) + local a_max_sample_f = 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] * a_max / (3.141592653589793 --[[IM_PI]] * 2.0) local a_min_sample = a_is_reverse and ImFloor(a_min_sample_f) or ImCeil(a_min_sample_f) local a_max_sample = a_is_reverse and ImCeil(a_max_sample_f) or ImFloor(a_max_sample_f) local a_mid_samples = a_is_reverse and ImMax(a_min_sample - a_max_sample, 0) or ImMax(a_max_sample - a_min_sample, 0) - local a_min_segment_angle = a_min_sample * IM_PI * 2.0 / IM_DRAWLIST_ARCFAST_SAMPLE_MAX - local a_max_segment_angle = a_max_sample * IM_PI * 2.0 / IM_DRAWLIST_ARCFAST_SAMPLE_MAX + local a_min_segment_angle = a_min_sample * 3.141592653589793 --[[IM_PI]] * 2.0 / 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] + local a_max_segment_angle = a_max_sample * 3.141592653589793 --[[IM_PI]] * 2.0 / 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] local a_emit_start = ImAbs(a_min_segment_angle - a_min) >= 1e-5 local a_emit_end = ImAbs(a_max - a_max_segment_angle) >= 1e-5 @@ -34972,7 +35006,7 @@ function MT.ImDrawList:PathArcTo(center, radius, a_min, a_max, num_segments) else local arc_length = ImAbs(a_max - a_min) local circle_segment_count = self:_CalcCircleAutoSegmentCount(radius) - local arc_segment_count = ImMax(ImCeil(circle_segment_count * arc_length / (IM_PI * 2.0)), 1) + local arc_segment_count = ImMax(ImCeil(circle_segment_count * arc_length / (3.141592653589793 --[[IM_PI]] * 2.0)), 1) self:_PathArcToN(center, radius, a_min, a_max, arc_segment_count) end @@ -35001,7 +35035,7 @@ function MT.ImFont:RenderText(draw_list, size, pos, col, clip_rect, text, text_b if y > clip_rect.w then return end - if bit32.band(draw_list.Flags, ImDrawListFlags.TextNoPixelSnap) == 0 then + if bit32.band(draw_list.Flags, 16 --[[ImDrawListFlags.TextNoPixelSnap]]) == 0 then x = IM_TRUNC(x) y = IM_TRUNC(y) end @@ -35062,11 +35096,11 @@ function MT.ImFont:RenderText(draw_list, size, pos, col, clip_rect, text, text_b local idx_write = draw_list._IdxWritePtr local vtx_index = draw_list._VtxCurrentIdx local cmd_count = draw_list.CmdBuffer.Size - local cpu_fine_clip = bit32.band(flags, ImDrawTextFlags.CpuFineClip) ~= 0 + local cpu_fine_clip = bit32.band(flags, 1 --[[ImDrawTextFlags.CpuFineClip]]) ~= 0 local idx_data = draw_list.IdxBuffer.Data; local vtx_data = draw_list.VtxBuffer.Buf - local color_untinted = bit32.bor(col, bit32.bnot(IM_COL32_A_MASK)) + local color_untinted = bit32.bor(col, bit32.bnot(4278190080 --[[IM_COL32_A_MASK]])) local word_wrap_eol local stop = false @@ -35197,7 +35231,7 @@ function MT.ImFont:RenderText(draw_list, size, pos, col, clip_rect, text, text_b -- Edge case: calling RenderText() with unloaded glyphs triggering texture change. It doesn't happen via ImGui.* calls because CalcTextSize() is always used. if cmd_count ~= draw_list.CmdBuffer.Size then - IM_ASSERT(draw_list.CmdBuffer.Data[draw_list.CmdBuffer.Size].ElemCount == 0) + assert(draw_list.CmdBuffer.Data[draw_list.CmdBuffer.Size].ElemCount == 0) draw_list.CmdBuffer:pop_back() draw_list:PrimUnreserve(idx_count_max, vtx_count_max) draw_list:AddDrawCmd() @@ -35246,18 +35280,18 @@ function ImGui.RenderArrow(draw_list, pos, color, dir, scale) local cx, cy = pos.x + h * 0.50, pos.y + h * 0.50 * scale local ax, ay, bx, by, qx, qy - if dir == ImGuiDir.Up or dir == ImGuiDir.Down then - if dir == ImGuiDir.Up then r = -r end + if dir == 2 --[[ImGuiDir.Up]] or dir == 3 --[[ImGuiDir.Down]] then + if dir == 2 --[[ImGuiDir.Up]] then r = -r end ax, ay = 0.000 * r, 0.750 * r bx, by = -0.866 * r, -0.750 * r qx, qy = 0.866 * r, -0.750 * r - elseif dir == ImGuiDir.Left or dir == ImGuiDir.Right then - if dir == ImGuiDir.Left then r = -r end + elseif dir == 0 --[[ImGuiDir.Left]] or dir == 1 --[[ImGuiDir.Right]] then + if dir == 0 --[[ImGuiDir.Left]] then r = -r end ax, ay = 0.750 * r, 0.000 * r bx, by = -0.750 * r, 0.866 * r qx, qy = -0.750 * r, -0.866 * r else - IM_ASSERT(false) + assert(false) end arrow_a.x, arrow_a.y = cx + ax, cy + ay @@ -35307,20 +35341,20 @@ end --- @param direction ImGuiDir --- @param col ImU32 function ImGui.RenderArrowPointingAt(draw_list, pos, half_sz, direction, col) - if direction == ImGuiDir.Left then + if direction == 0 --[[ImGuiDir.Left]] then draw_list:AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), pos, col) - elseif direction == ImGuiDir.Right then + elseif direction == 1 --[[ImGuiDir.Right]] then draw_list:AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), pos, col) - elseif direction == ImGuiDir.Up then + elseif direction == 2 --[[ImGuiDir.Up]] then draw_list:AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), pos, col) - elseif direction == ImGuiDir.Down then + elseif direction == 3 --[[ImGuiDir.Down]] then draw_list:AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), pos, col) - elseif direction == ImGuiDir.None or direction == ImGuiDir.COUNT then -- Fix warnings + elseif direction == (-1) --[[ImGuiDir.None]] or direction == 4 --[[ImGuiDir.COUNT]] then -- Fix warnings end end local function ImAcos01(x) - if x <= 0.0 then return IM_PI * 0.5 end + if x <= 0.0 then return 3.141592653589793 --[[IM_PI]] * 0.5 end if x >= 1.0 then return 0.0 end return ImAcos(x) --return (-0.69813170079773212 * x * x - 0.87266462599716477) * x + 1.5707963267948966 -- Cheap approximation, may be enough for what we do. @@ -35352,7 +35386,7 @@ function ImGui.RenderRectFilledInRangeH(draw_list, rect, col, fill_x0, fill_x1, local inv_rounding = 1.0 / rounding local arc0_b = ImAcos01(1.0 - (p0.x - rect.Min.x) * inv_rounding) local arc0_e = ImAcos01(1.0 - (p1.x - rect.Min.x) * inv_rounding) - local half_pi = IM_PI * 0.5 -- We will == compare to this because we know this is the exact value ImAcos01 can return. + local half_pi = 3.141592653589793 --[[IM_PI]] * 0.5 -- We will == compare to this because we know this is the exact value ImAcos01 can return. local x0 = ImMax(p0.x, rect.Min.x + rounding) if arc0_b == arc0_e then @@ -35396,19 +35430,19 @@ function ImGui.CalcRoundingFlagsForRectInRect(r_in, r_outer, threshold) local round_t = r_in.Min.y <= r_outer.Min.y + threshold local round_b = r_in.Max.y >= r_outer.Max.y - threshold - local flags = ImDrawFlags.RoundCornersNone + local flags = 256 --[[ImDrawFlags.RoundCornersNone]] if round_t and round_l then - flags = bit32.bor(flags, ImDrawFlags.RoundCornersTopLeft) + flags = bit32.bor(flags, 16 --[[ImDrawFlags.RoundCornersTopLeft]]) end if round_t and round_r then - flags = bit32.bor(flags, ImDrawFlags.RoundCornersTopRight) + flags = bit32.bor(flags, 32 --[[ImDrawFlags.RoundCornersTopRight]]) end if round_b and round_l then - flags = bit32.bor(flags, ImDrawFlags.RoundCornersBottomLeft) + flags = bit32.bor(flags, 64 --[[ImDrawFlags.RoundCornersBottomLeft]]) end if round_b and round_r then - flags = bit32.bor(flags, ImDrawFlags.RoundCornersBottomRight) + flags = bit32.bor(flags, 128 --[[ImDrawFlags.RoundCornersBottomRight]]) end return flags @@ -35430,11 +35464,11 @@ function ImGui.RenderColorRectWithAlphaCheckerboard(draw_list, p_min, p_max, col if rounding == nil then rounding = 0.0 end if flags == nil then flags = 0 end - if bit32.band(flags, ImDrawFlags.RoundCornersMask_) == 0 then - flags = ImDrawFlags.RoundCornersDefault_ + if bit32.band(flags, 496 --[[ImDrawFlags.RoundCornersMask_]]) == 0 then + flags = 240 --[[ImDrawFlags.RoundCornersDefault_]] end - if bit32.rshift(bit32.band(col, IM_COL32_A_MASK), IM_COL32_A_SHIFT) < 0xFF then + 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) @@ -35464,19 +35498,19 @@ function ImGui.RenderColorRectWithAlphaCheckerboard(draw_list, p_min, p_max, col break end - cell_flags = ImDrawFlags.RoundCornersNone -- FIXME: Could use CalcRoundingFlagsForRectInRect() + cell_flags = 256 --[[ImDrawFlags.RoundCornersNone]] -- FIXME: Could use CalcRoundingFlagsForRectInRect() if y1 <= p_min.y then - if x1 <= p_min.x then cell_flags = bit32.bor(cell_flags, ImDrawFlags.RoundCornersTopLeft) end - if x2 >= p_max.x then cell_flags = bit32.bor(cell_flags, ImDrawFlags.RoundCornersTopRight) end + if x1 <= p_min.x then cell_flags = bit32.bor(cell_flags, 16 --[[ImDrawFlags.RoundCornersTopLeft]]) end + if x2 >= p_max.x then cell_flags = bit32.bor(cell_flags, 32 --[[ImDrawFlags.RoundCornersTopRight]]) end end if y2 >= p_max.y then - if x1 <= p_min.x then cell_flags = bit32.bor(cell_flags, ImDrawFlags.RoundCornersBottomLeft) end - if x2 >= p_max.x then cell_flags = bit32.bor(cell_flags, ImDrawFlags.RoundCornersBottomRight) end + if x1 <= p_min.x then cell_flags = bit32.bor(cell_flags, 64 --[[ImDrawFlags.RoundCornersBottomLeft]]) end + if x2 >= p_max.x then cell_flags = bit32.bor(cell_flags, 128 --[[ImDrawFlags.RoundCornersBottomRight]]) end end -- Combine flags - if flags == ImDrawFlags.RoundCornersNone or cell_flags == ImDrawFlags.RoundCornersNone then - cell_flags = ImDrawFlags.RoundCornersNone + if flags == 256 --[[ImDrawFlags.RoundCornersNone]] or cell_flags == 256 --[[ImDrawFlags.RoundCornersNone]] then + cell_flags = 256 --[[ImDrawFlags.RoundCornersNone]] else cell_flags = bit32.band(cell_flags, flags) end @@ -35602,18 +35636,18 @@ end -- Guaranteed to honor 'num_segments' function MT.ImDrawList:AddNgon(center, radius, col, num_segments, thickness) if thickness == nil then thickness = 1.0 end - if bit32.band(col, IM_COL32_A_MASK) == 0 or num_segments <= 2 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 or num_segments <= 2 then return end -- Because we are filling a closed shape we remove 1 from the count of segments/points - local a_max = (IM_PI * 2.0) * (num_segments - 1.0) / num_segments + local a_max = (3.141592653589793 --[[IM_PI]] * 2.0) * (num_segments - 1.0) / num_segments self:PathArcTo(center, radius - 0.5, 0.0, a_max, num_segments - 1) - self:PathStroke(col, thickness, ImDrawFlags.Closed) + self:PathStroke(col, thickness, 512 --[[ImDrawFlags.Closed]]) end -- Guaranteed to honor 'num_segments' function MT.ImDrawList:AddNgonFilled(center, radius, col, num_segments) - if bit32.band(col, IM_COL32_A_MASK) == 0 or num_segments <= 2 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 or num_segments <= 2 then return end -- Because we are filling a closed shape we remove 1 from the count of segments/points - local a_max = (IM_PI * 2.0) * (num_segments - 1.0) / num_segments + local a_max = (3.141592653589793 --[[IM_PI]] * 2.0) * (num_segments - 1.0) / num_segments self:PathArcTo(center, radius, 0.0, a_max, num_segments - 1) self:PathFillConvex(col) end @@ -35622,27 +35656,27 @@ end function MT.ImDrawList:AddEllipse(center, radius, col, rot, num_segments, thickness) if rot == nil then rot = 0.0 end if thickness == nil then thickness = 1.0 end - if bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end if num_segments == nil or num_segments <= 0 then num_segments = self:_CalcCircleAutoSegmentCount(ImMax(radius.x, radius.y)) end -- A bit pessimistic, maybe there's a better computation to do here. -- Because we are filling a closed shape we remove 1 from the count of segments/points - local a_max = IM_PI * 2.0 * (num_segments - 1.0) / num_segments + local a_max = 3.141592653589793 --[[IM_PI]] * 2.0 * (num_segments - 1.0) / num_segments self:PathEllipticalArcTo(center, radius, rot, 0.0, a_max, num_segments - 1) - self:PathStroke(col, thickness, ImDrawFlags.Closed) + self:PathStroke(col, thickness, 512 --[[ImDrawFlags.Closed]]) end function MT.ImDrawList:AddEllipseFilled(center, radius, col, rot, num_segments) if rot == nil then rot = 0.0 end - if bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end if num_segments == nil or num_segments <= 0 then num_segments = self:_CalcCircleAutoSegmentCount(ImMax(radius.x, radius.y)) end -- A bit pessimistic, maybe there's a better computation to do here. -- Because we are filling a closed shape we remove 1 from the count of segments/points - local a_max = IM_PI * 2.0 * (num_segments - 1.0) / num_segments + local a_max = 3.141592653589793 --[[IM_PI]] * 2.0 * (num_segments - 1.0) / num_segments self:PathEllipticalArcTo(center, radius, rot, 0.0, a_max, num_segments - 1) self:PathFillConvex(col) end -- Cubic Bezier takes 4 controls points function MT.ImDrawList:AddBezierCubic(p1, p2, p3, p4, col, thickness, num_segments) - if bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end self:PathLineTo(p1) self:PathBezierCubicCurveTo(p2, p3, p4, num_segments or 0) self:PathStroke(col, thickness or 1.0) @@ -35650,7 +35684,7 @@ end -- Quadratic Bezier takes 3 controls points function MT.ImDrawList:AddBezierQuadratic(p1, p2, p3, col, thickness, num_segments) - if bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end self:PathLineTo(p1) self:PathBezierQuadraticCurveTo(p2, p3, num_segments or 0) self:PathStroke(col, thickness or 1.0) @@ -35659,7 +35693,7 @@ end -- ponytail: ear-clipping, no anti-aliased fringe (upstream's AA triangulator not ported). O(n^2) is fine for UI polygons. --- @param points ImVec2[] # 1-based function MT.ImDrawList:AddConcavePolyFilled(points, points_count, col) - if points_count < 3 or bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if points_count < 3 or bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end local idx = {} local area = 0.0 for i = 1, points_count do @@ -35740,7 +35774,7 @@ __FILES['imgui_h.lua'] = function() --- @meta -local type = ImGui._GetTypeFunc() +local type = type -- [Luau] builtin (FASTCALL); ImGui._GetTypeFunc() kept for compatibility local rawget = rawget; local rawset = rawset -- [LuaBitOp](https://bitop.luajit.org/semantics.html) @@ -35988,7 +36022,7 @@ end IM_VEC2.__newindex = function(t, k, v) local n = VEC2_KEYS[k] - IM_ASSERT(n ~= nil) + assert(n ~= nil) rawset(t, n, v) end @@ -36056,7 +36090,7 @@ end IM_VEC4.__newindex = function(t, k, v) local n = VEC4_KEYS[k] - IM_ASSERT(n ~= nil) + assert(n ~= nil) rawset(t, n, v) end @@ -36106,7 +36140,7 @@ end --- @param v any IM_VECTOR.__newindex = function(t, k, v) if k == "Data" then rawset(t, "Data", v); return; end -- set new Data. old Data is already discarded - IM_ASSERT(k >= 1 and k <= t.Size) + assert(k >= 1 and k <= t.Size) t.Data[k] = v end @@ -36122,17 +36156,17 @@ local function _grow_capacity(v, sz) local new_capacity = (v.Capacity ~= 0) and function ImVector(T, COPY_FUNC) return setmetatable({Data = nil, Size = 0, Capacity = 0, _Constructor = T or _default_constructor, _CopyFunc = COPY_FUNC or _default_copyfunc}, IM_VECTOR) end function IM_VECTOR:push_back(value) if self.Size == self.Capacity then self:reserve(_grow_capacity(self, self.Size + 1)) end; self._CopyFunc(self.Data, self.Size + 1, value); self.Size = self.Size + 1; return value end -function IM_VECTOR:pop_back() IM_ASSERT(self.Size > 0); self.Size = self.Size - 1; end +function IM_VECTOR:pop_back() assert(self.Size > 0); self.Size = self.Size - 1; end function IM_VECTOR:push_front(value) if self.Size == 0 then self:push_back(value) else self:insert(1, value) end end function IM_VECTOR:clear() if self.Data then self.Size = 0; self.Capacity = 0; IM_FREE(self, "Data"); self.Data = nil end end function IM_VECTOR:clear_delete() for i = 1, self.Size do self.Data[i] = nil end self.Size = 0 end function IM_VECTOR:empty() return self.Size == 0 end -function IM_VECTOR:back() IM_ASSERT(self.Size > 0) return self.Data[self.Size] end -function IM_VECTOR:erase(i) IM_ASSERT(i >= 1 and i <= self.Size) local removed = (table.remove(self.Data, i)) ~= nil self.Size = self.Size - 1 return removed end +function IM_VECTOR:back() assert(self.Size > 0) return self.Data[self.Size] end +function IM_VECTOR:erase(i) assert(i >= 1 and i <= self.Size) local removed = (table.remove(self.Data, i)) ~= nil self.Size = self.Size - 1 return removed end local function _iter(v, i) i = i + 1 if i <= v.Size then return i, v.Data[i] end end function IM_VECTOR:iter() return _iter, self, 0 end function IM_VECTOR:find_index(value) for i = 1, self.Size do if self.Data[i] == value then return i end end return nil end -function IM_VECTOR:erase_unsorted(index) IM_ASSERT(index >= 1 and index <= self.Size) local last_idx = self.Size if index ~= last_idx then self.Data[index] = self.Data[last_idx] end self.Data[last_idx] = nil self.Size = self.Size - 1 return true end +function IM_VECTOR:erase_unsorted(index) assert(index >= 1 and index <= self.Size) local last_idx = self.Size if index ~= last_idx then self.Data[index] = self.Data[last_idx] end self.Data[last_idx] = nil self.Size = self.Size - 1 return true end function IM_VECTOR:find_erase(value) local idx = self:find_index(value) if idx then return self:erase(idx) end return false end function IM_VECTOR:find_erase_unsorted(value) local idx = self:find_index(value) if idx then return self:erase_unsorted(idx) end return false end @@ -36154,7 +36188,7 @@ function IM_VECTOR:reserve_discard(new_capacity) self.Capacity = new_capacity end -function IM_VECTOR:shrink(new_size) IM_ASSERT(new_size <= self.Size) self.Size = new_size end +function IM_VECTOR:shrink(new_size) assert(new_size <= self.Size) self.Size = new_size end function IM_VECTOR:resize(new_size, v) if new_size > self.Capacity then self:reserve(_grow_capacity(self, new_size)) end @@ -36169,7 +36203,7 @@ function IM_VECTOR:swap(other) self.Size, other.Size = other.Size, self.Size; se function IM_VECTOR:contains(v) for i = 1, self.Size do if self.Data[i] == v then return true end end return false end -- NOTE: This currently does not use type-aware copy! -function IM_VECTOR:insert(pos, value) IM_ASSERT(pos >= 1 and pos <= self.Size + 1); if self.Size == self.Capacity then self:reserve(_grow_capacity(self, self.Size + 1)) end; for i = self.Size, pos, -1 do self.Data[i + 1] = self.Data[i] end self.Data[pos] = value self.Size = self.Size + 1 return value end +function IM_VECTOR:insert(pos, value) assert(pos >= 1 and pos <= self.Size + 1); if self.Size == self.Capacity then self:reserve(_grow_capacity(self, self.Size + 1)) end; for i = self.Size, pos, -1 do self.Data[i + 1] = self.Data[i] end self.Data[pos] = value self.Size = self.Size + 1 return value end -- NOTE: This currently does not copy type related info! --- @nodiscard @@ -36185,7 +36219,7 @@ end function IM_VECTOR:index_from_ptr(p) local data = self.Data; for i = 1, self.Size do if p == data[i] then return i - 1 end end --- @diagnostic disable-next-line - IM_ASSERT(false, "index_from_ptr failed!") + assert(false, "index_from_ptr failed!") end ------------------------------------------------------------------------------- @@ -36231,7 +36265,7 @@ end function IM_DRAWCMD:GetTexID() local tex_id = (self.TexRef._TexData) and self.TexRef._TexData.TexID or self.TexRef._TexID if self.TexRef._TexData ~= nil then - IM_ASSERT(tex_id ~= ImTextureID_Invalid, "ImDrawCmd is referring to ImTextureData that wasn't uploaded to graphics system. Backend must call ImTextureData::SetTexID() after handling ImTextureStatus_WantCreate request!") + assert(tex_id ~= (-1) --[[ImTextureID_Invalid]], "ImDrawCmd is referring to ImTextureData that wasn't uploaded to graphics system. Backend must call ImTextureData::SetTexID() after handling ImTextureStatus_WantCreate request!") end return tex_id end @@ -36255,8 +36289,8 @@ IM_VTXBUF.__index = IM_VTXBUF function ImDrawVtxBuffer() return setmetatable({ Size = 0, Capacity = 0, Buf = buffer.create(0) }, IM_VTXBUF) end function IM_VTXBUF:reserve(n) if n <= self.Capacity then return end - local nb = buffer.create(n * VTX_STRIDE) - buffer.copy(nb, 0, self.Buf, 0, self.Size * VTX_STRIDE) + local nb = buffer.create(n * 36 --[[VTX_STRIDE]]) + buffer.copy(nb, 0, self.Buf, 0, self.Size * 36 --[[VTX_STRIDE]]) self.Buf = nb self.Capacity = n end @@ -36267,8 +36301,8 @@ end function IM_VTXBUF:shrink(n) self.Size = n end function IM_VTXBUF:clear() self.Size = 0; self.Capacity = 0; self.Buf = buffer.create(0) end -function ImDrawVtx_Pos(b, i) local o = (i - 1) * VTX_STRIDE; return buffer.readf64(b, o), buffer.readf64(b, o + 8) end -function ImDrawVtx_Col(b, i) return buffer.readu32(b, (i - 1) * VTX_STRIDE + 32) end +function ImDrawVtx_Pos(b, i) local o = (i - 1) * 36 --[[VTX_STRIDE]]; return buffer.readf64(b, o), buffer.readf64(b, o + 8) end +function ImDrawVtx_Col(b, i) return buffer.readu32(b, (i - 1) * 36 --[[VTX_STRIDE]] + 32) end -- [Internal] For use by ImDrawList --- @class ImDrawCmdHeader @@ -36335,7 +36369,7 @@ MT.ImDrawList.__index = MT.ImDrawList --- @param uv ImVec2 --- @param col ImU32 function MT.ImDrawList:PrimWriteVtx(pos, uv, col) - local b, o = self.VtxBuffer.Buf, (self._VtxWritePtr - 1) * VTX_STRIDE + local b, o = self.VtxBuffer.Buf, (self._VtxWritePtr - 1) * 36 --[[VTX_STRIDE]] buffer.writef64(b, o, pos.x); buffer.writef64(b, o + 8, pos.y) buffer.writef64(b, o + 16, uv.x); buffer.writef64(b, o + 24, uv.y) buffer.writeu32(b, o + 32, col) @@ -36458,9 +36492,9 @@ function ImTextureData() -------------------------------------------- core / backend --------------------------------------- this.UniqueID = 0 -- w - -- [DEBUG] Sequential index to facilitate identifying a texture when debugging/printing. Unique per atlas. - this.Status = ImTextureStatus.Destroyed -- rw rw -- ImTextureStatus.OK/_WantCreate/_WantUpdates/_WantDestroy. Always use SetStatus() to modify! + this.Status = 1 --[[ImTextureStatus.Destroyed]] -- rw rw -- ImTextureStatus.OK/_WantCreate/_WantUpdates/_WantDestroy. Always use SetStatus() to modify! this.BackendUserData = nil -- - rw -- Convenience storage for backend. Some backends may have enough with TexID. - this.TexID = ImTextureID_Invalid -- r w -- Backend-specific texture identifier. Always use SetTexID() to modify! The identifier will stored in ImDrawCmd::GetTexID() and passed to backend's RenderDrawData function. + this.TexID = (-1) --[[ImTextureID_Invalid]] -- r w -- Backend-specific texture identifier. Always use SetTexID() to modify! The identifier will stored in ImDrawCmd::GetTexID() and passed to backend's RenderDrawData function. this.Format = 0 -- w r -- ImTextureFormat.RGBA32 (default) or ImTextureFormat.Alpha8 this.Width = 0 -- w r -- Texture width this.Height = 0 -- w r -- Texture height @@ -36490,7 +36524,7 @@ function MT.ImTextureData:GetTexID() return self.TexID end function MT.ImTextureData:SetTexID(tex_id) self.TexID = tex_id end --- @param status ImTextureStatus -function MT.ImTextureData:SetStatus(status) self.Status = status if (status == ImTextureStatus.Destroyed and not self.WantDestroyNextFrame and self.Pixels ~= nil) then self.Status = ImTextureStatus.WantCreate end end +function MT.ImTextureData:SetStatus(status) self.Status = status if (status == 1 --[[ImTextureStatus.Destroyed]] and not self.WantDestroyNextFrame and self.Pixels ~= nil) then self.Status = 2 --[[ImTextureStatus.WantCreate]] end end ------------------------------------------------------------------------------- -- [SECTION] Texture identifiers (ImTextureID, ImTextureRef) @@ -36512,7 +36546,7 @@ function ImTextureRef(tex_id) return setmetatable({ -- Members (either are set, never both!) _TexData = nil, -- A texture, generally owned by a ImFontAtlas. Will convert to ImTextureID during render loop, after texture has been uploaded. - _TexID = tex_id or ImTextureID_Invalid -- _OR_ Low-level backend texture identifier, if already uploaded or created by user/app. Generally provided to e.g. ImGui.Image() calls. + _TexID = tex_id or (-1) --[[ImTextureID_Invalid]] -- _OR_ Low-level backend texture identifier, if already uploaded or created by user/app. Generally provided to e.g. ImGui.Image() calls. }, IM_TEXTURE_REF) end @@ -36679,7 +36713,7 @@ function ImFontConfig() this.GlyphExcludeRanges = nil -- nil -- Pointer to a small user-provided list of Unicode ranges (2 value per range, values are inclusive, zero-terminated list). This is very close to GlyphRanges[] but designed to exclude ranges from a font source, when merging fonts with overlapping glyphs. Use "Input Glyphs Overlap Detection Tool" to find about your overlapping ranges. this.GlyphOffset = ImVec2() -- 0, 0 -- Offset (in pixels) all glyphs from this font input. Absolute value for default size, other sizes will scale this value. this.GlyphMinAdvanceX = 0 -- 0 -- Minimum AdvanceX for glyphs, set Min to align font icons, set both Min/Max to enforce mono-space font. Absolute value for default size, other sizes will scale this value. - this.GlyphMaxAdvanceX = FLT_MAX -- FLT_MAX -- Maximum AdvanceX for glyphs + this.GlyphMaxAdvanceX = 3.4028234663853e+38 --[[FLT_MAX]] -- FLT_MAX -- Maximum AdvanceX for glyphs this.GlyphExtraAdvanceX = 0 -- 0 -- Extra spacing (in pixels) between glyphs. Please contact us if you are using this. -- FIXME-NEWATLAS: Intentionally unscaled this.FontNo = 0 -- 0 -- Index of font within TTF/OTF file this.FontLoaderFlags = 0 -- 0 -- Settings for custom font builder. THIS IS BUILDER IMPLEMENTATION DEPENDENT. Leave as zero if unsure. @@ -36745,7 +36779,7 @@ function ImFontAtlas() -- Input this.Flags = 0 -- Build flags (see ImFontAtlasFlags_) - this.TexDesiredFormat = ImTextureFormat.RGBA32 -- Desired texture format (default to ImTextureFormat.RGBA32 but may be changed to ImTextureFormat.Alpha8). + this.TexDesiredFormat = 0 --[[ImTextureFormat.RGBA32]] -- Desired texture format (default to ImTextureFormat.RGBA32 but may be changed to ImTextureFormat.Alpha8). this.TexGlyphPadding = 1 -- FIXME: Should be called "TexPackPadding". Padding between glyphs within texture in pixels. Defaults to 1. If your rendering method never relies on bilinear filtering you may set this to 0. this.TexMinWidth = 512 -- Minimum desired texture width. Must be a power of two. Default to 512. this.TexMinHeight = 128 -- Minimum desired texture height. Must be a power of two. Default to 128. @@ -36900,8 +36934,8 @@ function ImGuiIO() -- Other state maintained from data above + IO function calls KeyMods = nil, -- Key mods flags (any of ImGuiMod_Ctrl/ImGuiMod_Shift/ImGuiMod_Alt/ImGuiMod_Super flags, same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags). Read-only, updated by NewFrame() - BackendFlags = ImGuiBackendFlags.None, -- = 0 -- See ImGuiBackendFlags_ enum. Set by backend (imgui_impl_xxx files or custom backend) to communicate features supported by the backend. - ConfigFlags = ImGuiConfigFlags.None, -- = 0 -- See ImGuiConfigFlags_ enum. Set by user/application. Keyboard/Gamepad navigation options, etc. + BackendFlags = 0 --[[ImGuiBackendFlags.None]], -- = 0 -- See ImGuiBackendFlags_ enum. Set by backend (imgui_impl_xxx files or custom backend) to communicate features supported by the backend. + ConfigFlags = 0 --[[ImGuiConfigFlags.None]], -- = 0 -- See ImGuiConfigFlags_ enum. Set by user/application. Keyboard/Gamepad navigation options, etc. DisplaySize = ImVec2(-1.0, -1.0), -- -- Main display size, in pixels (== GetMainViewport()->Size). May change every frame. DeltaTime = 1.0 / 60.0, -- = 1.0f/60.0f -- Time elapsed since last frame, in seconds. May change every frame. @@ -36927,7 +36961,7 @@ function ImGuiIO() MouseWheelRequestAxisSwap = false, -- On a non-Mac system, holding Shift requests WheelY to perform the equivalent of a WheelX event. On a Mac system this is already enforced by the system. - ConfigColorEditFlags = ImGuiColorEditFlags.DefaultOptions_, -- = -- Current settings for ColorEdit/ColorPicker widgets. Must have one bit of ImGuiColorEditFlags.DisplayMask_, one bit of ImGuiColorEditFlags.DataTypeMask_, one bit of ImGuiColorEditFlags.PickerMask_, one bit of ImGuiColorEditFlags.InputMask_. Defaults to ImGuiColorEditFlags.DefaultOptions_. May be further edited by users, unless you also set ImGuiColorEditFlags.NoOptions. + ConfigColorEditFlags = 311427072 --[[ImGuiColorEditFlags.DefaultOptions_]], -- = -- Current settings for ColorEdit/ColorPicker widgets. Must have one bit of ImGuiColorEditFlags.DisplayMask_, one bit of ImGuiColorEditFlags.DataTypeMask_, one bit of ImGuiColorEditFlags.PickerMask_, one bit of ImGuiColorEditFlags.InputMask_. Defaults to ImGuiColorEditFlags.DefaultOptions_. May be further edited by users, unless you also set ImGuiColorEditFlags.NoOptions. -- Widget options ConfigMacOSXBehaviors = false, -- Swap Cmd<>Ctrl keys + OS X style text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl. @@ -37043,7 +37077,7 @@ function ImGuiIO() InputQueueSurrogate = 0 -- For AddInputCharacterUTF16() } - for i = 0, ImGuiKey.NamedKey_COUNT - 1 do + for i = 0, 155 --[[ImGuiKey.NamedKey_COUNT]] - 1 do this.KeysData[i] = ImGuiKeyData() end @@ -37840,7 +37874,8 @@ IM_COL32_A_MASK = 0xFF000000 --- @param G ImU32 --- @param B ImU32 --- @param A ImU32 -IM_COL32 = function(R, G, B, A) return (bitOr(bitLShift(A, IM_COL32_A_SHIFT), bitLShift(B, IM_COL32_B_SHIFT), bitLShift(G, IM_COL32_G_SHIFT), bitLShift(R, IM_COL32_R_SHIFT))) end + + IM_COL32_WHITE = IM_COL32(255, 255, 255, 255) IM_COL32_BLACK = IM_COL32(0, 0, 0, 255) IM_COL32_BLACK_TRANS = IM_COL32(0, 0, 0, 0) @@ -38082,7 +38117,7 @@ function ImGuiInputTextCallbackData() end function MT.ImGuiInputTextCallbackData:DeleteChars(pos, bytes_count) - IM_ASSERT(pos + bytes_count <= self.BufTextLen) + assert(pos + bytes_count <= self.BufTextLen) local buf = self.Buf local n = self.BufTextLen - bytes_count - pos + 1 -- includes zero terminator for i = 1, n do buf[pos + i] = buf[pos + bytes_count + i] end @@ -38101,7 +38136,7 @@ end function MT.ImGuiInputTextCallbackData:InsertChars(pos, new_text) local new_text_len = #new_text if new_text_len == 0 then return end - local is_resizable = bit32.band(self.Flags, ImGuiInputTextFlags.CallbackResize) ~= 0 + local is_resizable = bit32.band(self.Flags, 4194304 --[[ImGuiInputTextFlags.CallbackResize]]) ~= 0 -- We support partial insertion local avail = self.BufSize - 1 - self.BufTextLen if not is_resizable and new_text_len > avail then @@ -38441,10 +38476,10 @@ local function ImGui_ImplRoblox_UpdateKeyModifiers() local ctrl = UserInputService:IsKeyDown(K.LeftControl) or UserInputService:IsKeyDown(K.RightControl) local shift = UserInputService:IsKeyDown(K.LeftShift) or UserInputService:IsKeyDown(K.RightShift) local alt = UserInputService:IsKeyDown(K.LeftAlt) or UserInputService:IsKeyDown(K.RightAlt) - io:AddKeyEvent(ImGuiMod_Ctrl, ctrl) - io:AddKeyEvent(ImGuiMod_Shift, shift) - io:AddKeyEvent(ImGuiMod_Alt, alt) - io:AddKeyEvent(ImGuiMod_Super, UserInputService:IsKeyDown(K.LeftSuper) or UserInputService:IsKeyDown(K.RightSuper)) + io:AddKeyEvent(4096 --[[ImGuiMod_Ctrl]], ctrl) + io:AddKeyEvent(8192 --[[ImGuiMod_Shift]], shift) + io:AddKeyEvent(16384 --[[ImGuiMod_Alt]], alt) + io:AddKeyEvent(32768 --[[ImGuiMod_Super]], UserInputService:IsKeyDown(K.LeftSuper) or UserInputService:IsKeyDown(K.RightSuper)) return ctrl, shift, alt end @@ -38539,7 +38574,7 @@ end function ImGui_ImplRoblox_UpdateTexture(tex) local bd = ImGui_ImplRoblox_GetBackendData() - if tex.Status == ImTextureStatus.WantCreate then + if tex.Status == 2 --[[ImTextureStatus.WantCreate]] then local t = { Buffer = buffer.create(tex.Width * tex.Height * 4), Width = tex.Width, Height = tex.Height } CopyTexturePixels(tex, t.Buffer, 0, 0, tex.Width, tex.Height) @@ -38547,21 +38582,21 @@ function ImGui_ImplRoblox_UpdateTexture(tex) bd.Textures[bd.TextureCount] = t tex.BackendUserData = bd.TextureCount tex:SetTexID(bd.TextureCount) - tex:SetStatus(ImTextureStatus.OK) - elseif tex.Status == ImTextureStatus.WantUpdates then + tex:SetStatus(0 --[[ImTextureStatus.OK]]) + elseif tex.Status == 3 --[[ImTextureStatus.WantUpdates]] then local t = bd.Textures[tex.BackendUserData] - IM_ASSERT(t ~= nil) + assert(t ~= nil) for _, r in tex.Updates:iter() do CopyTexturePixels(tex, t.Buffer, r.x, r.y, r.w, r.h) end - tex:SetStatus(ImTextureStatus.OK) - elseif tex.Status == ImTextureStatus.WantDestroy then + tex:SetStatus(0 --[[ImTextureStatus.OK]]) + elseif tex.Status == 4 --[[ImTextureStatus.WantDestroy]] then if tex.BackendUserData then bd.Textures[tex.BackendUserData] = nil tex.BackendUserData = nil end - tex:SetTexID(ImTextureID_Invalid) - tex:SetStatus(ImTextureStatus.Destroyed) + tex:SetTexID((-1) --[[ImTextureID_Invalid]]) + tex:SetStatus(1 --[[ImTextureStatus.Destroyed]]) end end @@ -38989,7 +39024,7 @@ local CMD_STRIDE = 70 -- clip (4 f64), ElemCount, IdxOffset, VtxOffset (u32), te @native local function Snapshot(set, draw_list, ox, oy, sw, sh) - local nv = draw_list.VtxBuffer.Size * VTX_STRIDE + local nv = draw_list.VtxBuffer.Size * 36 --[[VTX_STRIDE]] local idx, ni = draw_list.IdxBuffer.Data, draw_list.IdxBuffer.Size local ncmd = draw_list.CmdBuffer.Size local sv, si, sc = set.SV, set.SI, set.SC @@ -39032,7 +39067,7 @@ end @native local function CompareDrawList(set, draw_list, ox, oy, sw, sh) if not set or not set.SnapOK then return 0 end - local nv = draw_list.VtxBuffer.Size * VTX_STRIDE + local nv = draw_list.VtxBuffer.Size * 36 --[[VTX_STRIDE]] local ni, ncmd = draw_list.IdxBuffer.Size, draw_list.CmdBuffer.Size if nv ~= set.SVN or ni ~= set.SIN or ncmd ~= set.SCN or ox ~= set.SOX or oy ~= set.SOY or sw ~= set.SSW or sh ~= set.SSH then return 0 end if (draw_list._ContentClipX0 ~= nil) ~= set.SCC then return 0 end @@ -39078,7 +39113,7 @@ local function CompareDrawList(set, draw_list, ox, oy, sw, sh) if dx == 0 and dy == 0 then if set.SCC and (draw_list._ContentClipX0 ~= set.SCX0 or draw_list._ContentClipY0 ~= set.SCY0 or draw_list._ContentClipX1 ~= set.SCX1 or draw_list._ContentClipY1 ~= set.SCY1 or draw_list._ScrollOriginX ~= set.SSX or draw_list._ScrollOriginY ~= set.SSY) then return 0 end - for v = 0, nv - VTX_STRIDE, VTX_STRIDE do + for v = 0, nv - 36 --[[VTX_STRIDE]], 36 --[[VTX_STRIDE]] do if readf64(vb, v) ~= readf64(sv, v) or readf64(vb, v + 8) ~= readf64(sv, v + 8) or readf64(vb, v + 16) ~= readf64(sv, v + 16) or readf64(vb, v + 24) ~= readf64(sv, v + 24) or readu32(vb, v + 32) ~= readu32(sv, v + 32) then return 0 end end @@ -39087,7 +39122,7 @@ local function CompareDrawList(set, draw_list, ox, oy, sw, sh) if set.SCC and not (ShiftedExact(set.SCX0, dx, draw_list._ContentClipX0) and ShiftedExact(set.SCY0, dy, draw_list._ContentClipY0) and ShiftedExact(set.SCX1, dx, draw_list._ContentClipX1) and ShiftedExact(set.SCY1, dy, draw_list._ContentClipY1) and ShiftedExact(set.SSX, dx, draw_list._ScrollOriginX) and ShiftedExact(set.SSY, dy, draw_list._ScrollOriginY)) then return 0 end - for v = 0, nv - VTX_STRIDE, VTX_STRIDE do + for v = 0, nv - 36 --[[VTX_STRIDE]], 36 --[[VTX_STRIDE]] do if not ShiftedExact(readf64(sv, v), dx, readf64(vb, v)) or not ShiftedExact(readf64(sv, v + 8), dy, readf64(vb, v + 8)) or readf64(vb, v + 16) ~= readf64(sv, v + 16) or readf64(vb, v + 24) ~= readf64(sv, v + 24) or readu32(vb, v + 32) ~= readu32(sv, v + 32) then return 0 end end @@ -39445,7 +39480,7 @@ function ImGui_ImplRoblox_RenderDrawData(draw_data) PB("ImGui textures") if draw_data.Textures ~= nil then for _, tex in draw_data.Textures:iter() do - if tex.Status ~= ImTextureStatus.OK then + if tex.Status ~= 0 --[[ImTextureStatus.OK]] then -- No redraw needed for WantUpdates: it only writes texture portions which have never been used before -- (new glyphs/rects), so no existing tile samples them. Created textures get a new (never reused) id. ImGui_ImplRoblox_UpdateTexture(tex) @@ -39463,8 +39498,8 @@ function ImGui_ImplRoblox_RenderDrawData(draw_data) if not busy and g.ActiveId ~= 0 then local w = g.ActiveIdWindow local cur = g.MouseCursor -- ResizeAll..ResizeNWSE while a resize grip/border is held - busy = (cur >= ImGuiMouseCursor.ResizeAll and cur <= ImGuiMouseCursor.ResizeNWSE) - or (w ~= nil and (g.ActiveId == ImGui.GetWindowScrollbarID(w, ImGuiAxis.X) or g.ActiveId == ImGui.GetWindowScrollbarID(w, ImGuiAxis.Y))) + busy = (cur >= 2 --[[ImGuiMouseCursor.ResizeAll]] and cur <= 6 --[[ImGuiMouseCursor.ResizeNWSE]]) + or (w ~= nil and (g.ActiveId == ImGui.GetWindowScrollbarID(w, 1 --[[ImGuiAxis.X]]) or g.ActiveId == ImGui.GetWindowScrollbarID(w, 2 --[[ImGuiAxis.Y]]))) end if busy and (rate <= 0 or bd.BusyRenderRate < rate) then rate = bd.BusyRenderRate end end @@ -39568,7 +39603,7 @@ function ImGui_ImplRoblox_RenderDrawData(draw_data) while i <= last do local ia, ic = idx[i], idx[i + 2] -- byte offsets of the vertices (index is 1-based) - local va, vb, vc = (vo + ia - 1) * VTX_STRIDE, (vo + idx[i + 1] - 1) * VTX_STRIDE, (vo + ic - 1) * VTX_STRIDE + local va, vb, vc = (vo + ia - 1) * 36 --[[VTX_STRIDE]], (vo + idx[i + 1] - 1) * 36 --[[VTX_STRIDE]], (vo + ic - 1) * 36 --[[VTX_STRIDE]] local vd = false local gk = false local pax, pay = readf64(vbuf, va), readf64(vbuf, va + 8) @@ -39576,7 +39611,7 @@ function ImGui_ImplRoblox_RenderDrawData(draw_data) local pcx, pcy = readf64(vbuf, vc), readf64(vbuf, vc + 8) local bx0, by0, bx1, by1 if i + 5 <= last and idx[i + 3] == ia and idx[i + 4] == ic then - local d = (vo + idx[i + 5] - 1) * VTX_STRIDE + local d = (vo + idx[i + 5] - 1) * 36 --[[VTX_STRIDE]] local pdx, pdy = readf64(vbuf, d), readf64(vbuf, d + 8) -- axis aligned quad (TL, TR, BR, BL) if pay == pby and pbx == pcx and pcy == pdy and pdx == pax and pax < pbx and pay < pdy then @@ -39733,7 +39768,7 @@ function ImGui_ImplRoblox_Init(parent, render_scale) } io.BackendPlatformUserData = bd - io.BackendFlags = bit32.bor(io.BackendFlags, ImGuiBackendFlags.RendererHasTextures, ImGuiBackendFlags.RendererHasVtxOffset) + io.BackendFlags = bit32.bor(io.BackendFlags, 16 --[[ImGuiBackendFlags.RendererHasTextures]], 8 --[[ImGuiBackendFlags.RendererHasVtxOffset]]) local platform_io = ImGui.GetPlatformIO() platform_io.Platform_SetClipboardTextFn = ImGui_ImplRoblox_PlatformSetClipboardText @@ -39748,13 +39783,13 @@ function ImGui_ImplRoblox_Init(parent, render_scale) local io = ImGui.GetIO() local button = MOUSE_BUTTONS[input.UserInputType] if button then - io:AddMouseSourceEvent(ImGuiMouseSource.Mouse) + io:AddMouseSourceEvent(0 --[[ImGuiMouseSource.Mouse]]) io:AddMouseButtonEvent(button, true) elseif input.UserInputType == Enum.UserInputType.Keyboard and (not game_processed or proxy_focused) then local ctrl, shift, alt = ImGui_ImplRoblox_UpdateKeyModifiers() local key = KEY_MAP[input.KeyCode] if key then io:AddKeyEvent(key, true) end - if proxy_focused and (key == ImGuiKey.Backspace or key == ImGuiKey.Delete) then ImGui_ImplRoblox_GetBackendData().DeleteKeySeen = true end + if proxy_focused and (key == 523 --[[ImGuiKey.Backspace]] or key == 522 --[[ImGuiKey.Delete]]) then ImGui_ImplRoblox_GetBackendData().DeleteKeySeen = true end -- Text: printable ASCII keys, skipped while Ctrl/Alt are held (shortcuts) local v = input.KeyCode.Value @@ -39852,8 +39887,8 @@ function ImGui_ImplRoblox_Shutdown() io.BackendPlatformUserData = nil io.BackendFlags = bit32.band(io.BackendFlags, bit32.bnot(bit32.bor( - ImGuiBackendFlags.RendererHasTextures, - ImGuiBackendFlags.RendererHasVtxOffset + 16 --[[ImGuiBackendFlags.RendererHasTextures]], + 8 --[[ImGuiBackendFlags.RendererHasVtxOffset]] ))) end @@ -39879,7 +39914,7 @@ function ImGui_ImplRoblox_NewFrame() local m = UserInputService:GetMouseLocation() if m.X ~= bd.MouseX or m.Y ~= bd.MouseY then bd.MouseX, bd.MouseY = m.X, m.Y - io:AddMouseSourceEvent(ImGuiMouseSource.Mouse) + io:AddMouseSourceEvent(0 --[[ImGuiMouseSource.Mouse]]) io:AddMousePosEvent(m.X * bd.Scale, m.Y * bd.Scale) end @@ -39914,13 +39949,13 @@ function ImGui_ImplRoblox_NewFrame() -- InputText ignores characters while Ctrl is held (upstream, so shortcuts don't type); a paste arrives with -- Ctrl still down, so release Ctrl around the characters in the event queue. local ctrl = io.KeyCtrl or UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) or UserInputService:IsKeyDown(Enum.KeyCode.RightControl) - if ctrl then io:AddKeyEvent(ImGuiMod_Ctrl, false) end + if ctrl then io:AddKeyEvent(4096 --[[ImGuiMod_Ctrl]], false) end local prev = bd.ProxyText or "" if #text < #prev and prev:sub(1, #text) == text and text:sub(-1) ~= "\n" then -- The TextBox deleted from its own text (Backspace/Delete; Roblox can't hold a real selection in it, so it -- may remove just 1 char). Apply the deletion with imgui's own selection instead: one Backspace deletes -- the whole imgui selection, or one char if none. Skipped if imgui already got the key event. - if not bd.DeleteKeySeen then io:AddKeyEvent(ImGuiKey.Backspace, true); io:AddKeyEvent(ImGuiKey.Backspace, false) end + if not bd.DeleteKeySeen then io:AddKeyEvent(523 --[[ImGuiKey.Backspace]], true); io:AddKeyEvent(523 --[[ImGuiKey.Backspace]], false) end elseif text ~= "\n" and text ~= "\r" and text ~= "\t" then -- Enter/Tab arrive as key events local prev = bd.ProxyText or "" if #text > 0 and (prev == "" or text:sub(1, #prev) ~= prev or #text <= #prev) then @@ -39929,7 +39964,7 @@ function ImGui_ImplRoblox_NewFrame() for _, cp in utf8.codes(text:sub(#prev + 1)) do io:AddInputCharacter(cp) end end end - if ctrl then io:AddKeyEvent(ImGuiMod_Ctrl, true) end + if ctrl then io:AddKeyEvent(4096 --[[ImGuiMod_Ctrl]], true) end used_proxy_text = true bd.ProxyText = nil end @@ -46456,7 +46491,7 @@ __FILES['imgui_internal.lua'] = function() --- @meta -local type = ImGui._GetTypeFunc() +local type = type -- [Luau] builtin (FASTCALL); ImGui._GetTypeFunc() kept for compatibility local rawget = rawget local mathMin = math.min; local mathMax = math.max @@ -46615,19 +46650,21 @@ end -- - ImMin/ImMax/ImClamp/ImLerp/ImSwap are used by widgets which support variety of types: signed/unsigned int/long long float/double --- @overload fun(lhs: number, rhs: number): number --- @overload fun(lhs: ImVec2, rhs: ImVec2): ImVec2 -@native -function ImMin(lhs, rhs) - if type(lhs) == "number" then return mathMin(lhs, rhs) end - return ImVec2(mathMin(lhs.x, rhs.x), mathMin(lhs.y, rhs.y)) -end + + + + + + --- @overload fun(lhs: number, rhs: number): number --- @overload fun(lhs: ImVec2, rhs: ImVec2): ImVec2 -@native -function ImMax(lhs, rhs) - if type(lhs) == "number" then return mathMax(lhs, rhs) end - return ImVec2(mathMax(lhs.x, rhs.x), mathMax(lhs.y, rhs.y)) -end + + + + + + -- Helpers: Sorting --- @param base table @@ -46637,33 +46674,37 @@ ImStd.ImQsort = function(base, count, cmp_func) if count > 0 then t_sort(base, c --- @overload fun(v: number, mn: number, mx: number): number --- @overload fun(v: ImVec2, mn: ImVec2, mx: ImVec2): ImVec2 -@native -function ImClamp(v, mn, mx) - if type(v) == "number" and type(mn) == "number" and type(mx) == "number" then return mathMin(mathMax(v, mn), mx) - elseif type(v) == "table" and type(mn) == "table" and type(mx) == "table" then return ImVec2(mathMax(mn.x, mathMin(v.x, mx.x)), mathMax(mn.y, mathMin(v.y, mx.y))) - end -end + + + + + + + --- @overload fun(a: number, b: number, t: number): number --- @overload fun(a: ImVec2, b: ImVec2, t: number): ImVec2 --- @overload fun(a: ImVec2, b: ImVec2, t: ImVec2): ImVec2 -@native -function ImLerp(a, b, t) - if type(a) == "number" and type(b) == "number" and type(t) == "number" then return ((a) + ((b) - (a)) * (t)) - elseif type(a) == "table" and type(b) == "table" and type(t) == "number" then return ImVec2(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t) - elseif type(a) == "table" and type(b) == "table" and type(t) == "table" then return ImVec2(a.x + (b.x - a.x) * t.x, a.y + (b.y - a.y) * t.y) - end -end -local function _Trunc(val) if val >= 0 then return mathFloor(val) else return mathCeil(val) end end + + + + + + + + + + --- @overload fun(v: float): float --- @overload fun(v: ImVec2): ImVec2 -function ImTrunc(v) - if type(v) == "number" then return _Trunc(v) - elseif type(v) == "table" then return ImVec2(_Trunc(v.x), _Trunc(v.y)) - end -end + + + + + + ImTrunc64 = _Trunc @@ -46682,7 +46723,8 @@ function ImRsqrt(x) return (1 / ImSqrt(x)) end function IM_TRUNC(VAL) return math.floor(VAL) end -- Positive values only! function IM_ROUND(VAL) return math.floor(VAL + 0.5) end -- Positive values only! -function ImFloor(f) if f >= 0 or math.floor(f) == f then return math.floor(f) else return math.floor(f) - 1 end end -- Decent replacement for floorf() + + -- Decent replacement for floorf() -- Helpers: Bit manipulation --- @param v int @@ -46802,7 +46844,8 @@ function ImStd.strncmp(str1, str2, max_count) return 0 end -function ImSaturate(f) return ((f < 0.0 and 0.0) or (f > 1.0 and 1.0) or f) end + + IM_F32_TO_INT8_UNBOUND = function(val) return math.floor(val * 255.0 + (val >= 0 and 0.5 or -0.5)) end -- Unsaturated, for display purpose IM_F32_TO_INT8_SAT = function(val) return math.floor(ImSaturate(val) * 255.0 + 0.5) end -- Saturated, always output 0..255 @@ -46876,7 +46919,7 @@ function ImStd.ImStrlen(str, begin) end end - IM_ASSERT(false) + assert(false) end -- FIXME: should also accept count? @@ -46931,19 +46974,19 @@ local function DebugLogIf(flag, fmt, ...) local g = GImGui if g and bitAnd(g.DebugLogFlags, flag) ~= 0 then ImGui.DebugLog(fmt, ...) end end -function IMGUI_DEBUG_LOG_ACTIVEID(...) DebugLogIf(ImGuiDebugLogFlags.EventActiveId, ...) end -function IMGUI_DEBUG_LOG_POPUP(...) DebugLogIf(ImGuiDebugLogFlags.EventPopup, ...) end -function IMGUI_DEBUG_LOG_FONT(...) DebugLogIf(ImGuiDebugLogFlags.EventFont, ...) end -- Called from ImFontAtlas function which may operate without a context. -function IMGUI_DEBUG_LOG_VIEWPORT(...) DebugLogIf(ImGuiDebugLogFlags.EventViewport, ...) end -function IMGUI_DEBUG_LOG_FOCUS(...) DebugLogIf(ImGuiDebugLogFlags.EventFocus, ...) end -function IMGUI_DEBUG_LOG_NAV(...) DebugLogIf(ImGuiDebugLogFlags.EventNav, ...) end -function IMGUI_DEBUG_LOG_IO(...) DebugLogIf(ImGuiDebugLogFlags.EventIO, ...) end -function IMGUI_DEBUG_LOG_INPUTROUTING(...) DebugLogIf(ImGuiDebugLogFlags.EventInputRouting, ...) end -function IMGUI_DEBUG_LOG_TABLE(...) DebugLogIf(ImGuiDebugLogFlags.EventTable, ...) end -function IMGUI_DEBUG_LOG_DOCKING(...) DebugLogIf(ImGuiDebugLogFlags.EventDocking, ...) end -function IMGUI_DEBUG_LOG_SELECTION(...) DebugLogIf(ImGuiDebugLogFlags.EventSelection, ...) end -function IMGUI_DEBUG_LOG_CLIPPER(...) DebugLogIf(ImGuiDebugLogFlags.EventClipper, ...) end -function IMGUI_DEBUG_LOG_ERROR(...) DebugLogIf(ImGuiDebugLogFlags.EventError, ...) end +function IMGUI_DEBUG_LOG_ACTIVEID(...) DebugLogIf(2 --[[ImGuiDebugLogFlags.EventActiveId]], ...) end +function IMGUI_DEBUG_LOG_POPUP(...) DebugLogIf(8 --[[ImGuiDebugLogFlags.EventPopup]], ...) end +function IMGUI_DEBUG_LOG_FONT(...) DebugLogIf(256 --[[ImGuiDebugLogFlags.EventFont]], ...) end -- Called from ImFontAtlas function which may operate without a context. +function IMGUI_DEBUG_LOG_VIEWPORT(...) DebugLogIf(2048 --[[ImGuiDebugLogFlags.EventViewport]], ...) end +function IMGUI_DEBUG_LOG_FOCUS(...) DebugLogIf(4 --[[ImGuiDebugLogFlags.EventFocus]], ...) end +function IMGUI_DEBUG_LOG_NAV(...) DebugLogIf(16 --[[ImGuiDebugLogFlags.EventNav]], ...) end +function IMGUI_DEBUG_LOG_IO(...) DebugLogIf(128 --[[ImGuiDebugLogFlags.EventIO]], ...) end +function IMGUI_DEBUG_LOG_INPUTROUTING(...) DebugLogIf(512 --[[ImGuiDebugLogFlags.EventInputRouting]], ...) end +function IMGUI_DEBUG_LOG_TABLE(...) DebugLogIf(4096 --[[ImGuiDebugLogFlags.EventTable]], ...) end +function IMGUI_DEBUG_LOG_DOCKING(...) DebugLogIf(1024 --[[ImGuiDebugLogFlags.EventDocking]], ...) end +function IMGUI_DEBUG_LOG_SELECTION(...) DebugLogIf(64 --[[ImGuiDebugLogFlags.EventSelection]], ...) end +function IMGUI_DEBUG_LOG_CLIPPER(...) DebugLogIf(32 --[[ImGuiDebugLogFlags.EventClipper]], ...) end +function IMGUI_DEBUG_LOG_ERROR(...) DebugLogIf(1 --[[ImGuiDebugLogFlags.EventError]], ...) end --- @alias ImGuiSelectionUserData any ImGuiSelectionUserData_Invalid = -1 @@ -46961,55 +47004,55 @@ ImGuiKeyOwner_NoOwner = 4294967295 -- Require key to have no owner. -- FIXME: Eventually we should aim to move e.g. IsActiveIdUsingKey() into IsKeyXXX functions. --- @param button ImGuiMouseButton --- @return ImGuiKey -function ImGui.MouseButtonToKey(button) IM_ASSERT(button >= 0 and button < ImGuiMouseButton.COUNT) return ImGuiKey.MouseLeft + button end +function ImGui.MouseButtonToKey(button) assert(button >= 0 and button < 5 --[[ImGuiMouseButton.COUNT]]) return 656 --[[ImGuiKey.MouseLeft]] + button end --- @param key ImGuiKey function ImGui.IsNamedKey(key) - return key >= ImGuiKey.NamedKey_BEGIN and key < ImGuiKey.NamedKey_END + return key >= 512 --[[ImGuiKey.NamedKey_BEGIN]] and key < 667 --[[ImGuiKey.NamedKey_END]] end --- @param key ImGuiKey function ImGui.IsKeyboardKey(key) - return key >= ImGuiKey_Keyboard_BEGIN and key < ImGuiKey_Keyboard_END + return key >= 512 --[[ImGuiKey_Keyboard_BEGIN]] and key < 632 --[[ImGuiKey_Keyboard_END]] end --- @param key ImGuiKey function ImGui.IsGamepadKey(key) - return key >= ImGuiKey_Gamepad_BEGIN and key < ImGuiKey_Gamepad_END + return key >= 632 --[[ImGuiKey_Gamepad_BEGIN]] and key < 656 --[[ImGuiKey_Gamepad_END]] end --- @param key ImGuiKey function ImGui.IsMouseKey(key) - return key >= ImGuiKey_Mouse_BEGIN and key < ImGuiKey_Mouse_END + return key >= 656 --[[ImGuiKey_Mouse_BEGIN]] and key < 663 --[[ImGuiKey_Mouse_END]] end --- @param key ImGuiKey function ImGui.IsAliasKey(key) - return key >= ImGuiKey_Aliases_BEGIN and key < ImGuiKey_Aliases_END + return key >= 656 --[[ImGuiKey_Aliases_BEGIN]] and key < 663 --[[ImGuiKey_Aliases_END]] end --- @param key ImGuiKey function ImGui.IsLRModKey(key) - return key >= ImGuiKey.LeftCtrl and key <= ImGuiKey.RightSuper + return key >= 527 --[[ImGuiKey.LeftCtrl]] and key <= 534 --[[ImGuiKey.RightSuper]] end --- @param key ImGuiKey --- @return bool function ImGui.IsNamedKeyOrMod(key) - return (key >= ImGuiKey.NamedKey_BEGIN and key < ImGuiKey.NamedKey_END) or key == ImGuiMod_Ctrl or key == ImGuiMod_Shift or key == ImGuiMod_Alt or key == ImGuiMod_Super + return (key >= 512 --[[ImGuiKey.NamedKey_BEGIN]] and key < 667 --[[ImGuiKey.NamedKey_END]]) or key == 4096 --[[ImGuiMod_Ctrl]] or key == 8192 --[[ImGuiMod_Shift]] or key == 16384 --[[ImGuiMod_Alt]] or key == 32768 --[[ImGuiMod_Super]] end --- @param key ImGuiKey --- @return ImGuiKey function ImGui.ConvertSingleModFlagToKey(key) - if key == ImGuiMod_Ctrl then - return ImGuiKey.ReservedForModCtrl - elseif key == ImGuiMod_Shift then - return ImGuiKey.ReservedForModShift - elseif key == ImGuiMod_Alt then - return ImGuiKey.ReservedForModAlt - elseif key == ImGuiMod_Super then - return ImGuiKey.ReservedForModSuper + if key == 4096 --[[ImGuiMod_Ctrl]] then + return 663 --[[ImGuiKey.ReservedForModCtrl]] + elseif key == 8192 --[[ImGuiMod_Shift]] then + return 664 --[[ImGuiKey.ReservedForModShift]] + elseif key == 16384 --[[ImGuiMod_Alt]] then + return 665 --[[ImGuiKey.ReservedForModAlt]] + elseif key == 32768 --[[ImGuiMod_Super]] then + return 666 --[[ImGuiKey.ReservedForModSuper]] end return key end @@ -47028,9 +47071,9 @@ end --- @param ctx ImGuiContext --- @param key ImGuiKey function ImGui.GetKeyOwnerData(ctx, key) - if bitAnd(key, ImGuiMod_Mask_) ~= 0 then key = ImGui.ConvertSingleModFlagToKey(key) end - IM_ASSERT(ImGui.IsNamedKey(key)) - return ctx.KeysOwnerData[key - ImGuiKey.NamedKey_BEGIN] + if bitAnd(key, 61440 --[[ImGuiMod_Mask_]]) ~= 0 then key = ImGui.ConvertSingleModFlagToKey(key) end + assert(ImGui.IsNamedKey(key)) + return ctx.KeysOwnerData[key - 512 --[[ImGuiKey.NamedKey_BEGIN]]] end -- This extends ImGuiKeyData but only for named keys (legacy keys don't support the new features) @@ -47041,8 +47084,8 @@ end --- @nodiscard function ImGuiKeyOwnerData() return { - OwnerCurr = ImGuiKeyOwner_NoOwner, - OwnerNext = ImGuiKeyOwner_NoOwner, + OwnerCurr = 4294967295 --[[ImGuiKeyOwner_NoOwner]], + OwnerNext = 4294967295 --[[ImGuiKeyOwner_NoOwner]], LockThisFrame = false, -- Reading this key requires explicit owner id (until end of frame). Set by ImGuiInputFlags.LockThisFrame. LockUntilRelease = false -- Reading this key requires explicit owner id (until key is released). Set by ImGuiInputFlags.LockUntilRelease. When this is true LockThisFrame is always true as well. } @@ -47208,7 +47251,7 @@ setmetatable(IM_RECT, { __index = function(_, k) if k ~= "Min" and k ~= "Max" th IM_RECT.__index = IM_RECT -- [Luau] plain table: fast method lookup. Use r.Min / r.Max (numeric r[1]/r[2] are not supported) -- [Luau] Min/Max are named fields, so `r.Min = v` assigns the reference: use ImVec2_Copy(r.Min, v) to keep copy semantics -IM_RECT.__newindex = function(t, k, v) IM_ASSERT(false, "ImRect: unknown field " .. tostring(k)) end +IM_RECT.__newindex = function(t, k, v) assert(false, "ImRect: unknown field " .. tostring(k)) end --- @return ImRect --- @nodiscard @@ -47400,9 +47443,9 @@ function ImBitArray(BITCOUNT, OFFSET) this.SetAllBits = function(self) local data = self.Data; for i = 1, size do data[i] = 0xFFFFFFFF end end --- @param n int # 1-based --- @return boolean - this.TestBit = function(self, n) n = n + OFFSET; IM_ASSERT(n >= 1 and n <= BITCOUNT); return IM_BITARRAY_TESTBIT(self.Data, n); end + this.TestBit = function(self, n) n = n + OFFSET; assert(n >= 1 and n <= BITCOUNT); return IM_BITARRAY_TESTBIT(self.Data, n); end --- @param n int # 1-based - this.SetBit = function(self, n) n = n + OFFSET; IM_ASSERT(n >= 1 and n <= BITCOUNT); ImBitArraySetBit(self.Data, n); end + this.SetBit = function(self, n) n = n + OFFSET; assert(n >= 1 and n <= BITCOUNT); ImBitArraySetBit(self.Data, n); end this:ClearAllBits() @@ -47453,7 +47496,7 @@ end --- @param col ImU32 function ImGui.SetNextItemColorMarker(col) local g = GImGui - g.NextItemData.HasFlags = bitOr(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasColorMarker) + g.NextItemData.HasFlags = bitOr(g.NextItemData.HasFlags, 32 --[[ImGuiNextItemDataFlags.HasColorMarker]]) g.NextItemData.ColorMarker = col end @@ -47515,8 +47558,8 @@ function ImDrawListSharedData() Context = nil -- [OPTIONAL] Link to Dear ImGui context. 99% of ImDrawList/ImFontAtlas can function without an ImGui context, but this facilitate handling one legacy edge case. }, MT.ImDrawListSharedData) - for i = 1, IM_DRAWLIST_ARCFAST_TABLE_SIZE do - local a = ((i - 1) * 2 * IM_PI) / IM_DRAWLIST_ARCFAST_TABLE_SIZE + for i = 1, 48 --[[IM_DRAWLIST_ARCFAST_TABLE_SIZE]] do + local a = ((i - 1) * 2 * 3.141592653589793 --[[IM_PI]]) / 48 --[[IM_DRAWLIST_ARCFAST_TABLE_SIZE]] this.ArcFastVtx[i] = ImVec2(ImCos(a), ImSin(a)) end @@ -47736,8 +47779,8 @@ IMGUI_NEXT_ITEM_DATA.__index = IMGUI_NEXT_ITEM_DATA -- Also cleared manually by ItemAdd()! function IMGUI_NEXT_ITEM_DATA:ClearFlags() - self.HasFlags = ImGuiNextItemDataFlags.None - self.ItemFlagsSet = ImGuiItemFlags.None + self.HasFlags = 0 --[[ImGuiNextItemDataFlags.None]] + self.ItemFlagsSet = 0 --[[ImGuiItemFlags.None]] end --- @return ImGuiNextItemData @@ -47785,7 +47828,7 @@ local IMGUI_NEXT_WINDOW_DATA = {} IMGUI_NEXT_WINDOW_DATA.__index = IMGUI_NEXT_WINDOW_DATA function IMGUI_NEXT_WINDOW_DATA:ClearFlags() - self.HasFlags = ImGuiNextWindowDataFlags.None + self.HasFlags = 0 --[[ImGuiNextWindowDataFlags.None]] end --- @return ImGuiNextWindowData @@ -47906,14 +47949,14 @@ function ImGuiStyle() WindowBorderHoverPadding = 4.0, -- Hit-testing extent outside/inside resizing border. Also extend determination of hovered window. Generally meaningfully larger than WindowBorderSize to make it easy to reach borders. - TreeLinesFlags = ImGuiTreeNodeFlags.DrawLinesNone, + TreeLinesFlags = 262144 --[[ImGuiTreeNodeFlags.DrawLinesNone]], TreeLinesSize = 1.0, -- Thickness of outlines when using ImGuiTreeNodeFlags.DrawLines. TreeLinesRounding = 0.0, -- Radius of lines connecting child nodes to the vertical line. MenuItemRounding = 0.0, -- Radius of MenuItem, BeginMenu rounding. SelectableRounding = 0.0, -- Radius of selectable rounding. MODIFYING THIS IS DISCOURAGED. CONTIGUOUS SELECTIONS WILL NOT LOOK RIGHT. (#7589) ColorMarkerSize = 3.0, -- Size of R/G/B/A color markers for ColorEdit4() and for Drags/Sliders when using ImGuiSliderFlags.ColorMarkers. - ColorButtonPosition = ImGuiDir.Right, -- Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir.Right. + ColorButtonPosition = 1 --[[ImGuiDir.Right]], -- Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir.Right. InputTextCursorSize = 1.0, -- Thickness of cursor/caret in InputText(). SeparatorSize = 1.0, -- Thickness of border in Separator(). @@ -47944,7 +47987,7 @@ function ImGuiStyle() WindowMinSize = ImVec2(32, 32), -- Minimum window size WindowTitleAlign = ImVec2(0.0, 0.5), -- Alignment for title bar text - WindowMenuButtonPosition = ImGuiDir.Left, -- Position of the collapsing/docking button in the title bar (left/right). Defaults to ImGuiDir.Left. + WindowMenuButtonPosition = 0 --[[ImGuiDir.Left]], -- Position of the collapsing/docking button in the title bar (left/right). Defaults to ImGuiDir.Left. ChildRounding = 0.0, -- Radius of child window corners rounding. Set to 0.0 to have rectangular child windows ChildBorderSize = 1.0, -- Thickness of border around child windows. Generally set to 0.0 or 1.0. Other values not well tested. PopupRounding = 0.0, -- Radius of popup window corners rounding. Set to 0.0 to have rectangular child windows @@ -47970,15 +48013,15 @@ function ImGuiStyle() TabCloseButtonMinWidthUnselected = 0.0, -- -1: always visible. 0.0: visible when hovered. >0.0: visible when hovered if minimum width. FLT_MAX: never show close button when unselected. TabBarBorderSize = 1.0, -- Thickness of tab-bar separator, which takes on the tab active color to denote focus. TabBarOverlineSize = 1.0, -- Thickness of tab-bar overline, which highlights the selected tab-bar. - TableAngledHeadersAngle = 35.0 * (IM_PI / 180.0), -- Angle of angled headers (supported values range from -50 degrees to +50 degrees). + TableAngledHeadersAngle = 35.0 * (3.141592653589793 --[[IM_PI]] / 180.0), -- Angle of angled headers (supported values range from -50 degrees to +50 degrees). TableAngledHeadersTextAlign = ImVec2(0.5, 0.0), -- Alignment of angled headers within the cell DragDropTargetRounding = 0.0, -- Radius of the drag and drop target frame. DragDropTargetBorderSize = 2.0, -- Thickness of the drag and drop target border. DragDropTargetPadding = 3.0, -- Size to expand the drag and drop target from actual target item size. - HoverFlagsForTooltipMouse = bitOr(ImGuiHoveredFlags.Stationary, ImGuiHoveredFlags.DelayShort, ImGuiHoveredFlags.AllowWhenDisabled), -- Default flags when using IsItemHovered(ImGuiHoveredFlags.ForTooltip) or BeginItemTooltip()/SetItemTooltip() while using mouse. - HoverFlagsForTooltipNav = bitOr(ImGuiHoveredFlags.NoSharedDelay, ImGuiHoveredFlags.DelayNormal, ImGuiHoveredFlags.AllowWhenDisabled), -- Default flags when using IsItemHovered(ImGuiHoveredFlags.ForTooltip) or BeginItemTooltip()/SetItemTooltip() while using keyboard/gamepad. + HoverFlagsForTooltipMouse = bitOr(8192 --[[ImGuiHoveredFlags.Stationary]], 32768 --[[ImGuiHoveredFlags.DelayShort]], 1024 --[[ImGuiHoveredFlags.AllowWhenDisabled]]), -- Default flags when using IsItemHovered(ImGuiHoveredFlags.ForTooltip) or BeginItemTooltip()/SetItemTooltip() while using mouse. + HoverFlagsForTooltipNav = bitOr(131072 --[[ImGuiHoveredFlags.NoSharedDelay]], 65536 --[[ImGuiHoveredFlags.DelayNormal]], 1024 --[[ImGuiHoveredFlags.AllowWhenDisabled]]), -- Default flags when using IsItemHovered(ImGuiHoveredFlags.ForTooltip) or BeginItemTooltip()/SetItemTooltip() while using keyboard/gamepad. -- [Internal] _MainScale = 1.0, @@ -48132,8 +48175,8 @@ function ImGuiKeyRoutingData() Mods = 0, -- Technically we'd only need 4-bits but for simplify we store ImGuiMod_ values which need 16-bits. RoutingCurrScore = 0, -- [DEBUG] For debug display RoutingNextScore = 0, -- Lower is better (0: perfect score) - RoutingCurr = ImGuiKeyOwner_NoOwner, - RoutingNext = ImGuiKeyOwner_NoOwner + RoutingCurr = 4294967295 --[[ImGuiKeyOwner_NoOwner]], + RoutingNext = 4294967295 --[[ImGuiKeyOwner_NoOwner]] } end @@ -48147,7 +48190,7 @@ local _ImGuiKeyRoutingTable = {} _ImGuiKeyRoutingTable.__index = _ImGuiKeyRoutingTable function _ImGuiKeyRoutingTable:Clear() - for n = 1, ImGuiKey.NamedKey_COUNT do self.Index[n] = -1 end + for n = 1, 155 --[[ImGuiKey.NamedKey_COUNT]] do self.Index[n] = -1 end self.Entries:clear() self.EntriesNext:clear() end @@ -48250,10 +48293,10 @@ function IMGUI_NAV_ITEM_DATA:Clear() self.ID = 0 self.FocusScopeId = 0 self.ItemFlags = 0 - self.SelectionUserData = ImGuiSelectionUserData_Invalid - self.DistBox = FLT_MAX - self.DistCenter = FLT_MAX - self.DistAxial = FLT_MAX + self.SelectionUserData = (-1) --[[ImGuiSelectionUserData_Invalid]] + self.DistBox = 3.4028234663853e+38 --[[FLT_MAX]] + self.DistCenter = 3.4028234663853e+38 --[[FLT_MAX]] + self.DistAxial = 3.4028234663853e+38 --[[FLT_MAX]] end --- @return ImGuiNavItemData @@ -48460,18 +48503,18 @@ function ImGuiContext(shared_font_atlas) -- TODO: tidy up / complete this struct IO = ImGuiIO(), PlatformIO = ImGuiPlatformIO(), - ConfigFlagsCurrFrame = ImGuiConfigFlags.None, -- = g.IO.ConfigFlags at the time of NewFrame() - ConfigFlagsLastFrame = ImGuiConfigFlags.None, + ConfigFlagsCurrFrame = 0 --[[ImGuiConfigFlags.None]], -- = g.IO.ConfigFlags at the time of NewFrame() + ConfigFlagsLastFrame = 0 --[[ImGuiConfigFlags.None]], MouseLastValidPos = ImVec2(), - KeysMayBeCharInput = ImBitArray(ImGuiKey.NamedKey_COUNT, -ImGuiKey.NamedKey_BEGIN), -- Lookup to tell if a key can emit char input, see IsKeyChordPotentiallyCharInput(). + KeysMayBeCharInput = ImBitArray(155 --[[ImGuiKey.NamedKey_COUNT]], -512 --[[ImGuiKey.NamedKey_BEGIN]]), -- Lookup to tell if a key can emit char input, see IsKeyChordPotentiallyCharInput(). KeysOwnerData = {}, -- size = ImGuiKey.NamedKey_COUNT KeysRoutingTable = ImGuiKeyRoutingTable(), InputEventsQueue = ImVector(), -- Input events which will be trickled/written into IO structure. - InputEventsNextMouseSource = ImGuiMouseSource.Mouse, + InputEventsNextMouseSource = 0 --[[ImGuiMouseSource.Mouse]], InputEventsNextEventId = 1, MovingWindow = nil, -- Track the window we clicked on (in order to preserve focus). The actual window that is moved is generally MovingWindow.RootWindowDockTree. @@ -48534,7 +48577,7 @@ function ImGuiContext(shared_font_atlas) -- TODO: tidy up / complete this struct ActiveIdAllowOverlap = false, -- Active widget allows another widget to steal active id (generally for overlapping widgets, but not always) - NavLayer = ImGuiNavLayer.Main, -- Focused layer (main scrolling layer, or menu/title bar layer) + NavLayer = 0 --[[ImGuiNavLayer.Main]], -- Focused layer (main scrolling layer, or menu/title bar layer) NavId = 0, -- Focused item for navigation NavOpenContextMenuItemId = 0, NavOpenContextMenuWindowId = 0, NavWindow = nil, -- Focused window for navigation. Could be called 'FocusedWindow' @@ -48544,17 +48587,17 @@ function ImGuiContext(shared_font_atlas) -- TODO: tidy up / complete this struct NavCursorHideFrames = 0, NavHighlightItemUnderNav = false, -- Disable mouse hovering highlight. Highlight navigation focused item instead of mouse hovered item. NavIdIsAlive = false, -- Nav widget has been seen this frame ~~ NavRectRel is valid - NavInputSource = ImGuiInputSource.Keyboard, -- Keyboard or Gamepad mode? THIS CAN ONLY BE ImGuiInputSource.Keyboard or ImGuiInputSource.Gamepad + NavInputSource = 2 --[[ImGuiInputSource.Keyboard]], -- Keyboard or Gamepad mode? THIS CAN ONLY BE ImGuiInputSource.Keyboard or ImGuiInputSource.Gamepad NavWindowingTarget = nil, NavWindowingTargetAnim = nil, NavWindowingListWindow = nil, -- Target window when doing Ctrl+Tab (or Pad Menu + FocusPrev/Next), this window is temporarily displayed top-most! NavWindowingTimer = 0.0, NavWindowingHighlightAlpha = 0.0, NavWindowingToggleLayer = false, -- Set while Alt or GamepadMenu is held, may be cleared by other operations, and processed when releasing the key. - NavWindowingToggleKey = ImGuiKey.None, -- Keyboard/gamepad key used when toggling to menu layer. - NavWindowingInputSource = ImGuiInputSource.None, + NavWindowingToggleKey = 0 --[[ImGuiKey.None]], -- Keyboard/gamepad key used when toggling to menu layer. + NavWindowingInputSource = 0 --[[ImGuiInputSource.None]], NavWindowingAccumDeltaPos = ImVec2(0.0, 0.0), NavWindowingAccumDeltaSize = ImVec2(0.0, 0.0), DimBgRatio = 0.0, -- 0.0..1.0 animation when fading in a dimming background (for modal window and Ctrl+Tab list) LastKeyboardKeyPressTime = -1.0, LastKeyModsChangeTime = -1.0, LastKeyModsChangeFromNoneTime = -1.0, -- Record the last time a keyboard key (ignore mouse/gamepad ones) was pressed. - ConfigNavWindowingKeyNext = bit32.bor(ImGuiMod_Ctrl, ImGuiKey.Tab), -- = ImGuiMod_Ctrl | ImGuiKey.Tab (or ImGuiMod_Super | ImGuiKey.Tab on OS X). Set to 0 to disable. For reconfiguration (see #4828) - ConfigNavWindowingKeyPrev = bit32.bor(ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey.Tab), -- = ImGuiMod_Ctrl | ImGuiMod_Shift | ImGuiKey.Tab (or ImGuiMod_Super | ImGuiMod_Shift | ImGuiKey.Tab on OS X) + ConfigNavWindowingKeyNext = bit32.bor(4096 --[[ImGuiMod_Ctrl]], 512 --[[ImGuiKey.Tab]]), -- = ImGuiMod_Ctrl | ImGuiKey.Tab (or ImGuiMod_Super | ImGuiKey.Tab on OS X). Set to 0 to disable. For reconfiguration (see #4828) + ConfigNavWindowingKeyPrev = bit32.bor(4096 --[[ImGuiMod_Ctrl]], 8192 --[[ImGuiMod_Shift]], 512 --[[ImGuiKey.Tab]]), -- = ImGuiMod_Ctrl | ImGuiMod_Shift | ImGuiKey.Tab (or ImGuiMod_Super | ImGuiMod_Shift | ImGuiKey.Tab on OS X) ConfigNavWindowingWithGamepad = true, -- = true. Enable Ctrl+Tab by holding ImGuiKey.GamepadFaceLeft (== ImGuiKey.NavGamepadMenu). When false, the button may still be used to toggle Menu layer. NavFocusRoute = ImVector(), -- Reversed copy focus scope stack for NavId (should contains NavFocusScopeId). This essentially follow the window.ParentWindowForFocusRoute chain. @@ -48566,10 +48609,10 @@ function ImGuiContext(shared_font_atlas) -- TODO: tidy up / complete this struct NavMoveSubmitted = false, -- Move request submitted, will process result on next NewFrame() NavMoveScoringItems = false, -- Move request submitted, still scoring incoming items NavMoveForwardToNextFrame = false, - NavMoveFlags = ImGuiNavMoveFlags.None, - NavMoveScrollFlags = ImGuiScrollFlags.None, - NavMoveKeyMods = ImGuiMod_None, - NavMoveDir = ImGuiDir.None, NavMoveDirForDebug = ImGuiDir.None, NavMoveClipDir = ImGuiDir.None, -- Direction of the move request (left/right/up/down) + NavMoveFlags = 0 --[[ImGuiNavMoveFlags.None]], + NavMoveScrollFlags = 0 --[[ImGuiScrollFlags.None]], + NavMoveKeyMods = 0 --[[ImGuiMod_None]], + NavMoveDir = (-1) --[[ImGuiDir.None]], NavMoveDirForDebug = (-1) --[[ImGuiDir.None]], NavMoveClipDir = (-1) --[[ImGuiDir.None]], -- Direction of the move request (left/right/up/down) NavMoveResultLocal = ImGuiNavItemData(), -- Best move request candidate within NavWindow NavMoveResultOther = ImGuiNavItemData(), -- Best move request candidate within NavWindow's flattened hierarchy (when using ImGuiWindowFlags.NavFlattened flag) NavMoveResultLocalVisible = ImGuiNavItemData(), -- Best move request candidate within NavWindow that are mostly visible (when using ImGuiNavMoveFlags.AlsoScoreVisibleSet flag) @@ -48580,9 +48623,9 @@ function ImGuiContext(shared_font_atlas) -- TODO: tidy up / complete this struct NavTabbingCounter = 0, -- >0 when counting items for tabbing NavTabbingDir = 0, -- Generally -1 or +1, 0 when tabbing without a nav id NavNextActivateId = 0, -- Set by ActivateItemByID(), queued until next frame. - NavNextActivateFlags = ImGuiActivateFlags.None, + NavNextActivateFlags = 0 --[[ImGuiActivateFlags.None]], NavActivateId = 0, NavActivateDownId = 0, NavActivatePressedId = 0, -- ~~ (g.ActiveId == 0) && (IsKeyPressed(ImGuiKey.Space) || IsKeyDown(ImGuiKey.Enter) || IsKeyPressed(ImGuiKey.NavGamepadActivate)) ? NavId : 0, also set when calling ActivateItemByID() - NavActivateFlags = ImGuiActivateFlags.None, + NavActivateFlags = 0 --[[ImGuiActivateFlags.None]], FrameCount = -1, @@ -48641,7 +48684,7 @@ function ImGuiContext(shared_font_atlas) -- TODO: tidy up / complete this struct StackSizesInBeginForCurrentWindow = nil, - MouseCursor = ImGuiMouseCursor.Arrow, + MouseCursor = 0 --[[ImGuiMouseCursor.Arrow]], MouseStationaryTimer = 0.0, -- Time the mouse has been stationary (with some loose heuristic) InputTextState = ImGuiInputTextState(), @@ -48683,7 +48726,7 @@ function ImGuiContext(shared_font_atlas) -- TODO: tidy up / complete this struct FocusScopeStack = ImVector(), -- Stack for PushFocusScope()/PopFocusScope() - inherited by BeginChild(), pushed into by Begin() CurrentFocusScopeId = 0, -- Value for currently appending items == g.FocusScopeStack.back(). Not to be mistaken with g.NavFocusScopeId. - CurrentItemFlags = ImGuiItemFlags.None, -- Value for currently appending items == g.ItemFlagsStack.back() + CurrentItemFlags = 0 --[[ImGuiItemFlags.None]], -- Value for currently appending items == g.ItemFlagsStack.back() DisabledAlphaBackup = 0.0, -- Backup for style.Alpha for BeginDisabled() DisabledStackSize = 0, @@ -48740,7 +48783,7 @@ function ImGuiContext(shared_font_atlas) -- TODO: tidy up / complete this struct LogFile = nil, -- If ~= nil log to stdout/ file LogBuffer = ImGuiTextBuffer(), -- Accumulation buffer when log to clipboard. LogNextPrefix = nil, LogNextSuffix = nil, -- See comment in LogSetNextTextDecoration(): doesn't copy underlying data, use carefully! - LogLinePosY = FLT_MAX, + LogLinePosY = 3.4028234663853e+38 --[[FLT_MAX]], LogDepthRef = 0, LogDepthToExpand = 2, LogDepthToExpandDefault = 2, @@ -48755,7 +48798,7 @@ function ImGuiContext(shared_font_atlas) -- TODO: tidy up / complete this struct LocalizationTable = {}, - DebugLogFlags = bitOr(ImGuiDebugLogFlags.EventError, ImGuiDebugLogFlags.OutputToTTY), + DebugLogFlags = bitOr(1 --[[ImGuiDebugLogFlags.EventError]], 1048576 --[[ImGuiDebugLogFlags.OutputToTTY]]), DebugFlashStyleColorIdx = nil, DebugMetricsConfig = ImGuiMetricsConfig(), @@ -48791,7 +48834,7 @@ function ImGuiContext(shared_font_atlas) -- TODO: tidy up / complete this struct this.IO.Fonts.OwnerContext = this end - for i = 0, ImGuiKey.NamedKey_COUNT - 1 do + for i = 0, 155 --[[ImGuiKey.NamedKey_COUNT]] - 1 do this.KeysOwnerData[i] = ImGuiKeyOwnerData() end @@ -49090,8 +49133,8 @@ function ImGuiWindow(ctx, name) BgClickFlags = 0, -- Configure behavior of click+dragging on window bg/void or over items. Default sets by io.ConfigWindowsMoveFromTitleBarOnly. If you use this please report in #3379. SetWindowPosAllowFlags = 0, SetWindowSizeAllowFlags = 0, SetWindowCollapsedAllowFlags = 0, -- store acceptable condition flags for SetNextWindowPos() use. - SetWindowPosVal = ImVec2(FLT_MAX, FLT_MAX), -- store window position when using a non-zero Pivot (position set needs to be processed when we know the window size) - SetWindowPosPivot = ImVec2(FLT_MAX, FLT_MAX), -- store window pivot for positioning. ImVec2(0, 0) when positioning from top-left corner; ImVec2(0.5, 0.5) for centering; ImVec2(1, 1) for bottom right. + SetWindowPosVal = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]), -- store window position when using a non-zero Pivot (position set needs to be processed when we know the window size) + SetWindowPosPivot = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]), -- store window pivot for positioning. ImVec2(0, 0) when positioning from top-left corner; ImVec2(0.5, 0.5) for centering; ImVec2(1, 1) for bottom right. SettingsOffset = -1, -- Offset into SettingsWindows[] (offsets are always valid as we only grow the array from the back) @@ -49101,7 +49144,7 @@ function ImGuiWindow(ctx, name) ScrollbarX = false, ScrollbarY = false, -- Are scrollbars visible? ScrollMax = ImVec2(), - ScrollTarget = ImVec2(FLT_MAX, FLT_MAX), -- target scroll position. stored as cursor position with scrolling canceled out, so the highest point is always 0.0. (FLT_MAX for no change) + ScrollTarget = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]), -- target scroll position. stored as cursor position with scrolling canceled out, so the highest point is always 0.0. (FLT_MAX for no change) ScrollTargetCenterRatio = ImVec2(0.5, 0.5), -- 0.0 = scroll so that target position is at top, 0.5 = scroll so that target position is centered ScrollTargetEdgeSnapDist = ImVec2(), -- 0.0 = no snapping, >0.0 snapping threshold @@ -49122,7 +49165,7 @@ function ImGuiWindow(ctx, name) ViewportAllowPlatformMonitorExtend = -1, -- Reset to -1 every frame (index is guaranteed to be valid between NewFrame..EndFrame), only used in the Appearing frame of a tooltip/popup to enforce clamping to a given monitor Viewport = nil, -- Always set in Begin(). Inactive windows may have a nil value here if their viewport was discarded. ViewportId = 0, -- We backup the viewport id (since the viewport may disappear or never be created if the window is inactive) - ViewportPos = ImVec2(FLT_MAX, FLT_MAX), -- We backup the viewport position (since the viewport may disappear or never be created if the window is inactive) + ViewportPos = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]), -- We backup the viewport position (since the viewport may disappear or never be created if the window is inactive) ViewportOwned = nil, DC = ImGuiWindowTempData(), -- Temporary per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the "DC" variable name. @@ -49300,9 +49343,9 @@ function ImGuiViewportP() this.DrawDataP = ImDrawData() this.DrawDataBuilder = ImDrawDataBuilder() -- Temporary data while building final ImDrawData - this.LastPlatformPos = ImVec2(FLT_MAX, FLT_MAX) - this.LastPlatformSize = ImVec2(FLT_MAX, FLT_MAX) - this.LastRendererSize = ImVec2(FLT_MAX, FLT_MAX) + this.LastPlatformPos = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]) + this.LastPlatformSize = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]) + this.LastRendererSize = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]) -- Per-viewport work area -- - Insets are >= 0.0 values, distance from viewport corners to work area. @@ -49401,7 +49444,7 @@ function ImFontAtlasRectId_GetGeneration(id) return bitRShift(bitAnd(id, ImFontA --- @param gen_idx int --- @return ImFontAtlasRectId # 0-based! function ImFontAtlasRectId_Make(index_idx, gen_idx) - IM_ASSERT(index_idx >= 0 and index_idx <= ImFontAtlasRectId_IndexMask_ and gen_idx <= bitRShift(ImFontAtlasRectId_GenerationMask_, ImFontAtlasRectId_GenerationShift_)) + assert(index_idx >= 0 and index_idx <= ImFontAtlasRectId_IndexMask_ and gen_idx <= bitRShift(ImFontAtlasRectId_GenerationMask_, ImFontAtlasRectId_GenerationShift_)) return bitOr(index_idx, bitLShift(gen_idx, ImFontAtlasRectId_GenerationShift_)) end @@ -49471,7 +49514,7 @@ ImGuiInputSource = { --- @return ImGuiInputEventMousePos --- @nodiscard function ImGuiInputEventMousePos() - return { PosX = 0, PosY = 0, MouseSource = ImGuiMouseSource.Mouse } + return { PosX = 0, PosY = 0, MouseSource = 0 --[[ImGuiMouseSource.Mouse]] } end --- @class ImGuiInputEventMouseButton @@ -49482,7 +49525,7 @@ end --- @return ImGuiInputEventMouseButton --- @nodiscard function ImGuiInputEventMouseButton() - return { Button = 0, Down = false, MouseSource = ImGuiMouseSource.Mouse } + return { Button = 0, Down = false, MouseSource = 0 --[[ImGuiMouseSource.Mouse]] } end --- @class ImGuiInputEventMouseWheel @@ -49493,7 +49536,7 @@ end --- @return ImGuiInputEventMouseWheel --- @nodiscard function ImGuiInputEventMouseWheel() - return { WheelX = 0, WheelY = 0, MouseSource = ImGuiMouseSource.Mouse } + return { WheelX = 0, WheelY = 0, MouseSource = 0 --[[ImGuiMouseSource.Mouse]] } end --- @class ImGuiInputEventKey @@ -50094,7 +50137,7 @@ IMGUI_TABLE_MAX_COLUMNS = 512 -- Arbitrary "safety" maximum, may be lifted in th local function IMGUI_DEBUG_LOG_TABLE(fmt, ...) local g = GImGui - if band(g.DebugLogFlags, ImGuiDebugLogFlags.EventTable) ~= 0 then ImGui.DebugLog(fmt, ...) end + if band(g.DebugLogFlags, 4096 --[[ImGuiDebugLogFlags.EventTable]]) ~= 0 then ImGui.DebugLog(fmt, ...) end end ------------------------------------------------------------------------------- @@ -50108,7 +50151,7 @@ local function BitTest(arr, n) return arr[n] == true end -- Sorting specification for one column of a table --- @class ImGuiTableColumnSortSpecs function ImGuiTableColumnSortSpecs() - return { ColumnUserID = 0, ColumnIndex = 0, SortOrder = 0, SortDirection = ImGuiSortDirection.None } + return { ColumnUserID = 0, ColumnIndex = 0, SortOrder = 0, SortDirection = 0 --[[ImGuiSortDirection.None]] } end -- Sorting specifications for a table (often handling sort specs for a single column, occasionally more) @@ -50135,7 +50178,7 @@ function ImGuiTableColumn() IsEnabled = false, IsUserEnabled = false, IsUserEnabledNextFrame = false, IsVisibleX = false, IsVisibleY = false, IsRequestOutput = false, IsSkipItems = false, IsPreserveWidthAuto = false, IsJustCreated = true, IsLoadedSettings = false, IsNeedReconcileSrc = false, IsNeedReconcileDst = false, - NavLayerCurrent = 0, AutoFitQueue = 0, CannotSkipItemsQueue = 0, SortDirection = ImGuiSortDirection.None, + NavLayerCurrent = 0, AutoFitQueue = 0, CannotSkipItemsQueue = 0, SortDirection = 0 --[[ImGuiSortDirection.None]], SortDirectionsAvailCount = 0, SortDirectionsAvailMask = 0, SortDirectionsAvailList = 0, } end @@ -50212,7 +50255,7 @@ end --- @class ImGuiTableColumnSettings function ImGuiTableColumnSettings() - return { WidthOrWeight = 0.0, ID = 0, Index = -1, DisplayOrder = -1, SortOrder = -1, SortDirection = ImGuiSortDirection.None, + return { WidthOrWeight = 0.0, ID = 0, Index = -1, DisplayOrder = -1, SortOrder = -1, SortDirection = 0 --[[ImGuiSortDirection.None]], IsEnabled = -1, IsStretch = 0, IsLoaded = false } end @@ -50278,38 +50321,38 @@ local TABLE_RESIZE_SEPARATOR_FEEDBACK_TIMER = 0.06 -- Delay/timer before mak -- Helper local function TableFixFlags(flags, outer_window) -- Adjust flags: set default sizing policy - if band(flags, ImGuiTableFlags.SizingMask_) == 0 then - flags = bor(flags, (band(flags, ImGuiTableFlags.ScrollX) ~= 0 or band(outer_window.Flags, ImGuiWindowFlags.AlwaysAutoResize) ~= 0) and ImGuiTableFlags.SizingFixedFit or ImGuiTableFlags.SizingStretchSame) + if band(flags, 57344 --[[ImGuiTableFlags.SizingMask_]]) == 0 then + flags = bor(flags, (band(flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) ~= 0 or band(outer_window.Flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) ~= 0) and 8192 --[[ImGuiTableFlags.SizingFixedFit]] or 32768 --[[ImGuiTableFlags.SizingStretchSame]]) end -- Adjust flags: enable NoKeepColumnsVisible when using ImGuiTableFlags.SizingFixedSame - if band(flags, ImGuiTableFlags.SizingMask_) == ImGuiTableFlags.SizingFixedSame then - flags = bor(flags, ImGuiTableFlags.NoKeepColumnsVisible) + if band(flags, 57344 --[[ImGuiTableFlags.SizingMask_]]) == 16384 --[[ImGuiTableFlags.SizingFixedSame]] then + flags = bor(flags, 262144 --[[ImGuiTableFlags.NoKeepColumnsVisible]]) end -- Adjust flags: enforce borders when resizable - if band(flags, ImGuiTableFlags.Resizable) ~= 0 then - flags = bor(flags, ImGuiTableFlags.BordersInnerV) + if band(flags, 1 --[[ImGuiTableFlags.Resizable]]) ~= 0 then + flags = bor(flags, 512 --[[ImGuiTableFlags.BordersInnerV]]) end -- Adjust flags: disable NoHostExtendX/NoHostExtendY if we have any scrolling going on - if band(flags, bor(ImGuiTableFlags.ScrollX, ImGuiTableFlags.ScrollY)) ~= 0 then - flags = band(flags, bnot(bor(ImGuiTableFlags.NoHostExtendX, ImGuiTableFlags.NoHostExtendY))) + if band(flags, bor(16777216 --[[ImGuiTableFlags.ScrollX]], 33554432 --[[ImGuiTableFlags.ScrollY]])) ~= 0 then + flags = band(flags, bnot(bor(65536 --[[ImGuiTableFlags.NoHostExtendX]], 131072 --[[ImGuiTableFlags.NoHostExtendY]]))) end -- Adjust flags: NoBordersInBodyUntilResize takes priority over NoBordersInBody - if band(flags, ImGuiTableFlags.NoBordersInBodyUntilResize) ~= 0 then - flags = band(flags, bnot(ImGuiTableFlags.NoBordersInBody)) + if band(flags, 4096 --[[ImGuiTableFlags.NoBordersInBodyUntilResize]]) ~= 0 then + flags = band(flags, bnot(2048 --[[ImGuiTableFlags.NoBordersInBody]])) end -- Adjust flags: disable saved settings if there's nothing to save - if band(flags, bor(ImGuiTableFlags.Resizable, ImGuiTableFlags.Hideable, ImGuiTableFlags.Reorderable, ImGuiTableFlags.Sortable)) == 0 then - flags = bor(flags, ImGuiTableFlags.NoSavedSettings) + if band(flags, bor(1 --[[ImGuiTableFlags.Resizable]], 4 --[[ImGuiTableFlags.Hideable]], 2 --[[ImGuiTableFlags.Reorderable]], 8 --[[ImGuiTableFlags.Sortable]])) == 0 then + flags = bor(flags, 16 --[[ImGuiTableFlags.NoSavedSettings]]) end -- Inherit _NoSavedSettings from top-level window (child windows always have _NoSavedSettings set) - if band(outer_window.RootWindow.Flags, ImGuiWindowFlags.NoSavedSettings) ~= 0 then - flags = bor(flags, ImGuiTableFlags.NoSavedSettings) + if band(outer_window.RootWindow.Flags, 256 --[[ImGuiWindowFlags.NoSavedSettings]]) ~= 0 then + flags = bor(flags, 16 --[[ImGuiTableFlags.NoSavedSettings]]) end return flags @@ -50356,9 +50399,9 @@ function ImGui.BeginTableEx(name, id, columns_count, flags, outer_size, inner_wi end -- Sanity checks - IM_ASSERT(columns_count > 0 and columns_count < IMGUI_TABLE_MAX_COLUMNS) - if band(flags, ImGuiTableFlags.ScrollX) ~= 0 then - IM_ASSERT(inner_width >= 0.0) + assert(columns_count > 0 and columns_count < 512 --[[IMGUI_TABLE_MAX_COLUMNS]]) + if band(flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) ~= 0 then + assert(inner_width >= 0.0) end -- If an outer size is specified ahead we will be able to early out when not visible. Exact clipping criteria may evolve. @@ -50368,9 +50411,9 @@ function ImGui.BeginTableEx(name, id, columns_count, flags, outer_size, inner_wi -- The side-effects of accessing table data on coarse clip would be: -- - always reserving the pooled ImGuiTable data ahead for a fully clipped table (minor IMHO). Also the 'outer_window_is_measuring_size' criteria may already be defeating this in some situations. -- - always performing the GetOrAddByKey() O(log N) query in g.Tables.Map[]. - local use_child_window = band(flags, bor(ImGuiTableFlags.ScrollX, ImGuiTableFlags.ScrollY)) ~= 0 + local use_child_window = band(flags, bor(16777216 --[[ImGuiTableFlags.ScrollX]], 33554432 --[[ImGuiTableFlags.ScrollY]])) ~= 0 local avail_size = ImGui.GetContentRegionAvail() - local actual_outer_size = ImTrunc(ImGui.CalcItemSize(outer_size, mathMax(avail_size.x, IMGUI_WINDOW_HARD_MIN_SIZE), use_child_window and mathMax(avail_size.y, IMGUI_WINDOW_HARD_MIN_SIZE) or 0.0)) + local actual_outer_size = ImTrunc(ImGui.CalcItemSize(outer_size, mathMax(avail_size.x, 4 --[[IMGUI_WINDOW_HARD_MIN_SIZE]]), use_child_window and mathMax(avail_size.y, 4 --[[IMGUI_WINDOW_HARD_MIN_SIZE]]) or 0.0)) local outer_rect = ImRect(outer_window.DC.CursorPos, outer_window.DC.CursorPos + actual_outer_size) local outer_window_is_measuring_size = (outer_window.AutoFitFramesX > 0) or (outer_window.AutoFitFramesY > 0) -- Doesn't apply to AlwaysAutoResize windows! if use_child_window and ImGui.IsClippedEx(outer_rect, 0) and not outer_window_is_measuring_size then @@ -50400,7 +50443,7 @@ function ImGui.BeginTableEx(name, id, columns_count, flags, outer_size, inner_wi table_.DrawSplitter:Clear() -- Fix flags - table_.IsDefaultSizingPolicy = band(flags, ImGuiTableFlags.SizingMask_) == 0 + table_.IsDefaultSizingPolicy = band(flags, 57344 --[[ImGuiTableFlags.SizingMask_]]) == 0 flags = TableFixFlags(flags, outer_window) -- Initialize @@ -50423,7 +50466,7 @@ function ImGui.BeginTableEx(name, id, columns_count, flags, outer_size, inner_wi local instance_id table_.InstanceCurrent = instance_no if instance_no > 0 then - IM_ASSERT(table_.ColumnsCount == columns_count, "BeginTable(): Cannot change columns count mid-frame while preserving same ID") + assert(table_.ColumnsCount == columns_count, "BeginTable(): Cannot change columns count mid-frame while preserving same ID") if table_.InstanceDataExtra.Size < instance_no then table_.InstanceDataExtra:push_back(ImGuiTableInstanceData()) end @@ -50438,38 +50481,38 @@ function ImGui.BeginTableEx(name, id, columns_count, flags, outer_size, inner_wi if use_child_window then -- Ensure no vertical scrollbar appears if we only want horizontal one, to make flag consistent -- (we have no other way to disable vertical scrollbar of a window while keeping the horizontal one showing) - local override_content_size = ImVec2(FLT_MAX, FLT_MAX) - if band(flags, ImGuiTableFlags.ScrollX) ~= 0 and band(flags, ImGuiTableFlags.ScrollY) == 0 then - override_content_size.y = FLT_MIN + local override_content_size = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]) + if band(flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) ~= 0 and band(flags, 33554432 --[[ImGuiTableFlags.ScrollY]]) == 0 then + override_content_size.y = 1.1754943508223e-38 --[[FLT_MIN]] end -- Ensure specified width (when not specified, Stretched columns will act as if the width == OuterWidth and -- never lead to any scrolling). We don't handle inner_width < 0.0, we could potentially use it to right-align -- based on the right side of the child window work rect, which would require knowing ahead if we are going to -- have decoration taking horizontal spaces (typically a vertical scrollbar). - if band(flags, ImGuiTableFlags.ScrollX) ~= 0 and inner_width > 0.0 then + if band(flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) ~= 0 and inner_width > 0.0 then override_content_size.x = inner_width end - if override_content_size.x ~= FLT_MAX or override_content_size.y ~= FLT_MAX then - ImGui.SetNextWindowContentSize(ImVec2((override_content_size.x ~= FLT_MAX) and override_content_size.x or 0.0, (override_content_size.y ~= FLT_MAX) and override_content_size.y or 0.0)) + if override_content_size.x ~= 3.4028234663853e+38 --[[FLT_MAX]] or override_content_size.y ~= 3.4028234663853e+38 --[[FLT_MAX]] then + ImGui.SetNextWindowContentSize(ImVec2((override_content_size.x ~= 3.4028234663853e+38 --[[FLT_MAX]]) and override_content_size.x or 0.0, (override_content_size.y ~= 3.4028234663853e+38 --[[FLT_MAX]]) and override_content_size.y or 0.0)) end -- Reset scroll if we are reactivating it - if band(previous_flags, bor(ImGuiTableFlags.ScrollX, ImGuiTableFlags.ScrollY)) == 0 then - if band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasScroll) == 0 then + if band(previous_flags, bor(16777216 --[[ImGuiTableFlags.ScrollX]], 33554432 --[[ImGuiTableFlags.ScrollY]])) == 0 then + if band(g.NextWindowData.HasFlags, 128 --[[ImGuiNextWindowDataFlags.HasScroll]]) == 0 then ImGui.SetNextWindowScroll(ImVec2(0.0, 0.0)) end end -- Create scrolling region (without border and zero window padding) - local child_window_flags = (band(flags, ImGuiTableFlags.ScrollX) ~= 0) and ImGuiWindowFlags.HorizontalScrollbar or ImGuiWindowFlags.None - ImGui.BeginChildEx(name, instance_id, outer_rect:GetSize(), ImGuiChildFlags.None, child_window_flags) + local child_window_flags = (band(flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) ~= 0) and 2048 --[[ImGuiWindowFlags.HorizontalScrollbar]] or 0 --[[ImGuiWindowFlags.None]] + ImGui.BeginChildEx(name, instance_id, outer_rect:GetSize(), 0 --[[ImGuiChildFlags.None]], child_window_flags) table_.InnerWindow = g.CurrentWindow ImRect_Copy(table_.WorkRect, table_.InnerWindow.WorkRect) ImRect_Copy(table_.OuterRect, table_.InnerWindow:Rect()) ImRect_Copy(table_.InnerRect, table_.InnerWindow.InnerRect) - IM_ASSERT(table_.InnerWindow.WindowPadding.x == 0.0 and table_.InnerWindow.WindowPadding.y == 0.0 and table_.InnerWindow.WindowBorderSize == 0.0) + assert(table_.InnerWindow.WindowPadding.x == 0.0 and table_.InnerWindow.WindowPadding.y == 0.0 and table_.InnerWindow.WindowBorderSize == 0.0) -- Allow submitting when host is measuring if table_.InnerWindow.SkipItems and outer_window_is_measuring_size then @@ -50525,13 +50568,13 @@ function ImGui.BeginTableEx(name, id, columns_count, flags, outer_size, inner_wi -- it already overlaps it and doesn't need an extra offset. Ideally we should be able to pass custom border size with -- different x/y values to BeginChild(). local border_size = TABLE_BORDER_SIZE - if band(flags, ImGuiTableFlags.BordersOuterV) ~= 0 then + if band(flags, 1024 --[[ImGuiTableFlags.BordersOuterV]]) ~= 0 then table_.HostClipRect.Min.x = mathMin(table_.HostClipRect.Min.x + border_size, table_.HostClipRect.Max.x) if inner_window.DecoOuterSizeX2 == 0.0 then table_.HostClipRect.Max.x = mathMax(table_.HostClipRect.Max.x - border_size, table_.HostClipRect.Min.x) end end - if band(flags, ImGuiTableFlags.BordersOuterH) ~= 0 then + if band(flags, 256 --[[ImGuiTableFlags.BordersOuterH]]) ~= 0 then table_.HostClipRect.Min.y = mathMin(table_.HostClipRect.Min.y + border_size, table_.HostClipRect.Max.y) if inner_window.DecoOuterSizeY2 == 0.0 then table_.HostClipRect.Max.y = mathMax(table_.HostClipRect.Max.y - border_size, table_.HostClipRect.Min.y) @@ -50545,29 +50588,29 @@ function ImGui.BeginTableEx(name, id, columns_count, flags, outer_size, inner_wi -- - PadInner ........Content.. Pad | Pad ..Content........ -- - PadOuter+PadInner | Pad ..Content.. Pad | Pad ..Content.. Pad | local pad_outer_x - if band(flags, ImGuiTableFlags.NoPadOuterX) ~= 0 then pad_outer_x = false - elseif band(flags, ImGuiTableFlags.PadOuterX) ~= 0 then pad_outer_x = true - else pad_outer_x = band(flags, ImGuiTableFlags.BordersOuterV) ~= 0 end - local pad_inner_x = band(flags, ImGuiTableFlags.NoPadInnerX) == 0 - local inner_spacing_for_border = (band(flags, ImGuiTableFlags.BordersInnerV) ~= 0) and TABLE_BORDER_SIZE or 0.0 - local inner_spacing_explicit = (pad_inner_x and band(flags, ImGuiTableFlags.BordersInnerV) == 0) and g.Style.CellPadding.x or 0.0 - local inner_padding_explicit = (pad_inner_x and band(flags, ImGuiTableFlags.BordersInnerV) ~= 0) and g.Style.CellPadding.x or 0.0 + if band(flags, 4194304 --[[ImGuiTableFlags.NoPadOuterX]]) ~= 0 then pad_outer_x = false + elseif band(flags, 2097152 --[[ImGuiTableFlags.PadOuterX]]) ~= 0 then pad_outer_x = true + else pad_outer_x = band(flags, 1024 --[[ImGuiTableFlags.BordersOuterV]]) ~= 0 end + local pad_inner_x = band(flags, 8388608 --[[ImGuiTableFlags.NoPadInnerX]]) == 0 + local inner_spacing_for_border = (band(flags, 512 --[[ImGuiTableFlags.BordersInnerV]]) ~= 0) and TABLE_BORDER_SIZE or 0.0 + local inner_spacing_explicit = (pad_inner_x and band(flags, 512 --[[ImGuiTableFlags.BordersInnerV]]) == 0) and g.Style.CellPadding.x or 0.0 + local inner_padding_explicit = (pad_inner_x and band(flags, 512 --[[ImGuiTableFlags.BordersInnerV]]) ~= 0) and g.Style.CellPadding.x or 0.0 table_.CellSpacingX1 = inner_spacing_explicit + inner_spacing_for_border table_.CellSpacingX2 = inner_spacing_explicit table_.CellPaddingX = inner_padding_explicit - local outer_padding_for_border = (band(flags, ImGuiTableFlags.BordersOuterV) ~= 0) and TABLE_BORDER_SIZE or 0.0 + local outer_padding_for_border = (band(flags, 1024 --[[ImGuiTableFlags.BordersOuterV]]) ~= 0) and TABLE_BORDER_SIZE or 0.0 local outer_padding_explicit = pad_outer_x and g.Style.CellPadding.x or 0.0 table_.OuterPaddingX = (outer_padding_for_border + outer_padding_explicit) - table_.CellPaddingX table_.CurrentColumn = -1 table_.CurrentRow = -1 table_.RowBgColorCounter = 0 - table_.LastRowFlags = ImGuiTableRowFlags.None + table_.LastRowFlags = 0 --[[ImGuiTableRowFlags.None]] ImRect_Copy(table_.InnerClipRect, (inner_window == outer_window) and table_.WorkRect or inner_window.ClipRect) table_.InnerClipRect:ClipWith(table_.WorkRect) -- We need this to honor inner_width table_.InnerClipRect:ClipWithFull(table_.HostClipRect) - table_.InnerClipRect.Max.y = (band(flags, ImGuiTableFlags.NoHostExtendY) ~= 0) and mathMin(table_.InnerClipRect.Max.y, inner_window.WorkRect.Max.y) or table_.HostClipRect.Max.y + table_.InnerClipRect.Max.y = (band(flags, 131072 --[[ImGuiTableFlags.NoHostExtendY]]) ~= 0) and mathMin(table_.InnerClipRect.Max.y, inner_window.WorkRect.Max.y) or table_.HostClipRect.Max.y table_.RowPosY1 = table_.WorkRect.Min.y -- This is needed somehow table_.RowPosY2 = table_.WorkRect.Min.y @@ -50584,8 +50627,8 @@ function ImGui.BeginTableEx(name, id, columns_count, flags, outer_size, inner_wi temp_data.AngledHeadersExtraWidth = 0.0 -- Using opaque colors facilitate overlapping lines of the grid, otherwise we'd need to improve TableDrawBorders() - table_.BorderColorStrong = ImGui.GetColorU32(ImGuiCol.TableBorderStrong) - table_.BorderColorLight = ImGui.GetColorU32(ImGuiCol.TableBorderLight) + table_.BorderColorStrong = ImGui.GetColorU32(49 --[[ImGuiCol.TableBorderStrong]]) + table_.BorderColorLight = ImGui.GetColorU32(50 --[[ImGuiCol.TableBorderLight]]) -- Make table current g.CurrentTable = table_ @@ -50595,7 +50638,7 @@ function ImGui.BeginTableEx(name, id, columns_count, flags, outer_size, inner_wi inner_window.DC.CurrentTableIdx = table_idx end - if band(previous_flags, ImGuiTableFlags.Reorderable) ~= 0 and band(flags, ImGuiTableFlags.Reorderable) == 0 then + if band(previous_flags, 2 --[[ImGuiTableFlags.Reorderable]]) ~= 0 and band(flags, 2 --[[ImGuiTableFlags.Reorderable]]) == 0 then table_.IsResetDisplayOrderRequest = true end @@ -50612,7 +50655,7 @@ function ImGui.BeginTableEx(name, id, columns_count, flags, outer_size, inner_wi if old_columns_count ~= 0 and old_columns_count ~= columns_count then -- Attempt to preserve width and other settings on column count/specs change (#4046, #9108) IMGUI_DEBUG_LOG_TABLE("[table] Table 0x%08X column count %d -> %d, recreating storage.\n", table_.ID, old_columns_count, columns_count) - IM_ASSERT(temp_data.OldColumnsRawData == nil) + assert(temp_data.OldColumnsRawData == nil) temp_data.OldColumnsRawData = table_.RawData -- Freed during layout temp_data.OldColumnsData = table_.Columns temp_data.OldColumnsDataSize = table_.ColumnsSize @@ -50700,11 +50743,11 @@ function ImGui.TableApplyQueuedRequests(table_) -- (We process this in the TableBegin() of the first instance of each table) -- FIXME-TABLE: Contains columns if our work area doesn't allow for scrolling? if table_.InstanceCurrent == 0 then - if table_.ResizedColumn ~= -1 and table_.ResizedColumnNextWidth ~= FLT_MAX then + if table_.ResizedColumn ~= -1 and table_.ResizedColumnNextWidth ~= 3.4028234663853e+38 --[[FLT_MAX]] then ImGui.TableSetColumnWidth(table_.ResizedColumn, table_.ResizedColumnNextWidth) end table_.LastResizedColumn = table_.ResizedColumn - table_.ResizedColumnNextWidth = FLT_MAX + table_.ResizedColumnNextWidth = 3.4028234663853e+38 --[[FLT_MAX]] table_.ResizedColumn = -1 -- Process auto-fit for single column, which is a special case for stretch columns and fixed columns with FixedSame policy. @@ -50746,7 +50789,7 @@ function ImGui.TableApplyQueuedRequests(table_) if table_.IsResetVisibilityRequest then for n = 0, table_.ColumnsSize - 1 do local column = table_.Columns[n] - local v = band(column.Flags, ImGuiTableColumnFlags.DefaultHide) == 0 + local v = band(column.Flags, 2 --[[ImGuiTableColumnFlags.DefaultHide]]) == 0 column.IsUserEnabled = v; column.IsUserEnabledNextFrame = v end table_.IsResetVisibilityRequest = false @@ -50756,8 +50799,8 @@ end -- Apply immediately. See TableQueueSetColumnDisplayOrder() for additional checks/constraints. function ImGui.TableSetColumnDisplayOrder(table_, column_n, dst_order) - IM_ASSERT(column_n >= 0 and column_n < table_.ColumnsCount) - IM_ASSERT(dst_order >= 0 and dst_order < table_.ColumnsCount) + assert(column_n >= 0 and column_n < table_.ColumnsCount) + assert(dst_order >= 0 and dst_order < table_.ColumnsCount) local src_column = table_.Columns[column_n] local src_order = src_column.DisplayOrder @@ -50799,7 +50842,7 @@ local function TableGetMaxDisplayOrderAllowed(table_, src_order, dst_order) local reorder_dir = (src_order < dst_order) and 1 or -1 local order_n = src_order while (src_order < dst_order and order_n <= dst_order) or (dst_order < src_order and order_n >= dst_order) do - if band(table_.Columns[table_.DisplayOrderToIndex[order_n]].Flags, ImGuiTableColumnFlags.NoReorder) ~= 0 then + if band(table_.Columns[table_.DisplayOrderToIndex[order_n]].Flags, 64 --[[ImGuiTableColumnFlags.NoReorder]]) ~= 0 then dst_order = (order_n == src_order) and src_order or (order_n - reorder_dir) break end @@ -50825,30 +50868,30 @@ local function TableSetupColumnFlags(table_, column, column_n, flags_in) local flags = flags_in -- Sizing Policy - if band(flags, ImGuiTableColumnFlags.WidthMask_) == 0 then - local table_sizing_policy = band(table_.Flags, ImGuiTableFlags.SizingMask_) - if table_sizing_policy == ImGuiTableFlags.SizingFixedFit or table_sizing_policy == ImGuiTableFlags.SizingFixedSame then - flags = bor(flags, ImGuiTableColumnFlags.WidthFixed) + if band(flags, 24 --[[ImGuiTableColumnFlags.WidthMask_]]) == 0 then + local table_sizing_policy = band(table_.Flags, 57344 --[[ImGuiTableFlags.SizingMask_]]) + if table_sizing_policy == 8192 --[[ImGuiTableFlags.SizingFixedFit]] or table_sizing_policy == 16384 --[[ImGuiTableFlags.SizingFixedSame]] then + flags = bor(flags, 16 --[[ImGuiTableColumnFlags.WidthFixed]]) else - flags = bor(flags, ImGuiTableColumnFlags.WidthStretch) + flags = bor(flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) end else - IM_ASSERT(ImIsPowerOfTwo(band(flags, ImGuiTableColumnFlags.WidthMask_))) -- Check that only 1 of each set is used. + assert(ImIsPowerOfTwo(band(flags, 24 --[[ImGuiTableColumnFlags.WidthMask_]]))) -- Check that only 1 of each set is used. end -- Resize - if band(table_.Flags, ImGuiTableFlags.Resizable) == 0 then - flags = bor(flags, ImGuiTableColumnFlags.NoResize) + if band(table_.Flags, 1 --[[ImGuiTableFlags.Resizable]]) == 0 then + flags = bor(flags, 32 --[[ImGuiTableColumnFlags.NoResize]]) end -- Sorting - if band(flags, ImGuiTableColumnFlags.NoSortAscending) ~= 0 and band(flags, ImGuiTableColumnFlags.NoSortDescending) ~= 0 then - flags = bor(flags, ImGuiTableColumnFlags.NoSort) + if band(flags, 1024 --[[ImGuiTableColumnFlags.NoSortAscending]]) ~= 0 and band(flags, 2048 --[[ImGuiTableColumnFlags.NoSortDescending]]) ~= 0 then + flags = bor(flags, 512 --[[ImGuiTableColumnFlags.NoSort]]) end -- Indentation - if band(flags, ImGuiTableColumnFlags.IndentMask_) == 0 then - flags = bor(flags, (column_n == 0) and ImGuiTableColumnFlags.IndentEnable or ImGuiTableColumnFlags.IndentDisable) + if band(flags, 196608 --[[ImGuiTableColumnFlags.IndentMask_]]) == 0 then + flags = bor(flags, (column_n == 0) and 65536 --[[ImGuiTableColumnFlags.IndentEnable]] or 131072 --[[ImGuiTableColumnFlags.IndentDisable]]) end -- Alignment @@ -50857,18 +50900,18 @@ local function TableSetupColumnFlags(table_, column, column_n, flags_in) --IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiTableColumnFlags.AlignMask_)) -- Check that only 1 of each set is used. -- Preserve status flags - column.Flags = bor(flags, band(column.Flags, ImGuiTableColumnFlags.StatusMask_)) + column.Flags = bor(flags, band(column.Flags, 251658240 --[[ImGuiTableColumnFlags.StatusMask_]])) -- Build an ordered list of available sort directions column.SortDirectionsAvailCount = 0; column.SortDirectionsAvailMask = 0; column.SortDirectionsAvailList = 0 - if band(table_.Flags, ImGuiTableFlags.Sortable) ~= 0 then + if band(table_.Flags, 8 --[[ImGuiTableFlags.Sortable]]) ~= 0 then local count, mask, list = 0, 0, 0 - local Asc, Desc = ImGuiSortDirection.Ascending, ImGuiSortDirection.Descending - if band(flags, ImGuiTableColumnFlags.PreferSortAscending) ~= 0 and band(flags, ImGuiTableColumnFlags.NoSortAscending) == 0 then mask = bor(mask, lshift(1, Asc)); list = bor(list, lshift(Asc, lshift(count, 1))); count = count + 1 end - if band(flags, ImGuiTableColumnFlags.PreferSortDescending) ~= 0 and band(flags, ImGuiTableColumnFlags.NoSortDescending) == 0 then mask = bor(mask, lshift(1, Desc)); list = bor(list, lshift(Desc, lshift(count, 1))); count = count + 1 end - if band(flags, ImGuiTableColumnFlags.PreferSortAscending) == 0 and band(flags, ImGuiTableColumnFlags.NoSortAscending) == 0 then mask = bor(mask, lshift(1, Asc)); list = bor(list, lshift(Asc, lshift(count, 1))); count = count + 1 end - if band(flags, ImGuiTableColumnFlags.PreferSortDescending) == 0 and band(flags, ImGuiTableColumnFlags.NoSortDescending) == 0 then mask = bor(mask, lshift(1, Desc)); list = bor(list, lshift(Desc, lshift(count, 1))); count = count + 1 end - if band(table_.Flags, ImGuiTableFlags.SortTristate) ~= 0 or count == 0 then mask = bor(mask, lshift(1, ImGuiSortDirection.None)); count = count + 1 end + local Asc, Desc = 1 --[[ImGuiSortDirection.Ascending]], 2 --[[ImGuiSortDirection.Descending]] + if band(flags, 16384 --[[ImGuiTableColumnFlags.PreferSortAscending]]) ~= 0 and band(flags, 1024 --[[ImGuiTableColumnFlags.NoSortAscending]]) == 0 then mask = bor(mask, lshift(1, Asc)); list = bor(list, lshift(Asc, lshift(count, 1))); count = count + 1 end + if band(flags, 32768 --[[ImGuiTableColumnFlags.PreferSortDescending]]) ~= 0 and band(flags, 2048 --[[ImGuiTableColumnFlags.NoSortDescending]]) == 0 then mask = bor(mask, lshift(1, Desc)); list = bor(list, lshift(Desc, lshift(count, 1))); count = count + 1 end + if band(flags, 16384 --[[ImGuiTableColumnFlags.PreferSortAscending]]) == 0 and band(flags, 1024 --[[ImGuiTableColumnFlags.NoSortAscending]]) == 0 then mask = bor(mask, lshift(1, Asc)); list = bor(list, lshift(Asc, lshift(count, 1))); count = count + 1 end + if band(flags, 32768 --[[ImGuiTableColumnFlags.PreferSortDescending]]) == 0 and band(flags, 2048 --[[ImGuiTableColumnFlags.NoSortDescending]]) == 0 then mask = bor(mask, lshift(1, Desc)); list = bor(list, lshift(Desc, lshift(count, 1))); count = count + 1 end + if band(table_.Flags, 134217728 --[[ImGuiTableFlags.SortTristate]]) ~= 0 or count == 0 then mask = bor(mask, lshift(1, 0 --[[ImGuiSortDirection.None]])); count = count + 1 end column.SortDirectionsAvailList = band(list, 0xFF) column.SortDirectionsAvailMask = band(mask, 0xFF) column.SortDirectionsAvailCount = count @@ -50883,7 +50926,7 @@ end function ImGui.TableUpdateLayout(table_) local g = GImGui local temp_data = table_.TempData - IM_ASSERT(table_.IsLayoutLocked == false) + assert(table_.IsLayoutLocked == false) local columns_count = table_.ColumnsCount -- Reconcile moved columns @@ -50932,7 +50975,7 @@ function ImGui.TableUpdateLayout(table_) end table_.RefScale = new_ref_scale_unit - local table_sizing_policy = band(table_.Flags, ImGuiTableFlags.SizingMask_) + local table_sizing_policy = band(table_.Flags, 57344 --[[ImGuiTableFlags.SizingMask_]]) table_.IsDefaultDisplayOrder = true; table_.IsDefaultVisibility = true table_.ColumnsEnabledCount = 0 BitArrayClearAll(table_.EnabledMaskByIndex) @@ -50957,24 +51000,24 @@ function ImGui.TableUpdateLayout(table_) -- It would easily work without but we're not ready to guarantee it since e.g. names need resubmission anyway. -- We take a slight shortcut but in theory we could be calling TableSetupColumn() here with dummy values, it should yield the same effect. if table_.DeclColumnsCount <= column_n then - TableSetupColumnFlags(table_, column, column_n, ImGuiTableColumnFlags.None) + TableSetupColumnFlags(table_, column, column_n, 0 --[[ImGuiTableColumnFlags.None]]) column.NameOffset = -1 column.ID = 0; column.UserData = 0 column.InitStretchWeightOrWidth = -1.0 end -- Update Enabled state, mark settings and sort specs dirty - if band(table_.Flags, ImGuiTableFlags.Hideable) == 0 or band(column.Flags, ImGuiTableColumnFlags.NoHide) ~= 0 then + if band(table_.Flags, 4 --[[ImGuiTableFlags.Hideable]]) == 0 or band(column.Flags, 128 --[[ImGuiTableColumnFlags.NoHide]]) ~= 0 then column.IsUserEnabledNextFrame = true end if column.IsUserEnabled ~= column.IsUserEnabledNextFrame then column.IsUserEnabled = column.IsUserEnabledNextFrame table_.IsSettingsDirty = true end - column.IsEnabled = column.IsUserEnabled and band(column.Flags, ImGuiTableColumnFlags.Disabled) == 0 + column.IsEnabled = column.IsUserEnabled and band(column.Flags, 1 --[[ImGuiTableColumnFlags.Disabled]]) == 0 column.IsJustCreated = false - if column.IsEnabled ~= (band(column.Flags, ImGuiTableColumnFlags.DefaultHide) == 0) then + if column.IsEnabled ~= (band(column.Flags, 2 --[[ImGuiTableColumnFlags.DefaultHide]]) == 0) then table_.IsDefaultVisibility = false end if column_n ~= order_n then @@ -50984,13 +51027,13 @@ function ImGui.TableUpdateLayout(table_) if column.SortOrder ~= -1 and not column.IsEnabled then table_.IsSortSpecsDirty = true end - if column.SortOrder > 0 and band(table_.Flags, ImGuiTableFlags.SortMulti) == 0 then + if column.SortOrder > 0 and band(table_.Flags, 67108864 --[[ImGuiTableFlags.SortMulti]]) == 0 then table_.IsSortSpecsDirty = true end -- Auto-fit unsized columns local start_auto_fit - if band(column.Flags, ImGuiTableColumnFlags.WidthFixed) ~= 0 then + if band(column.Flags, 16 --[[ImGuiTableColumnFlags.WidthFixed]]) ~= 0 then start_auto_fit = column.WidthRequest < 0.0 else start_auto_fit = column.StretchWeight < 0.0 @@ -51016,7 +51059,7 @@ function ImGui.TableUpdateLayout(table_) BitArraySet(table_.EnabledMaskByIndex, column_n) BitArraySet(table_.EnabledMaskByDisplayOrder, column.DisplayOrder) prev_visible_column_idx = column_n - IM_ASSERT(column.IndexWithinEnabledSet <= column.DisplayOrder) + assert(column.IndexWithinEnabledSet <= column.DisplayOrder) -- Calculate ideal/auto column width (that's the width required for all contents to be visible without clipping) -- Combine width from regular rows + width from headers unless requested not to. @@ -51025,18 +51068,18 @@ function ImGui.TableUpdateLayout(table_) end -- Non-resizable columns keep their requested width (apply user value regardless of IsPreserveWidthAuto) - local column_is_resizable = band(column.Flags, ImGuiTableColumnFlags.NoResize) == 0 + local column_is_resizable = band(column.Flags, 32 --[[ImGuiTableColumnFlags.NoResize]]) == 0 if column_is_resizable then has_resizable = true end - if band(column.Flags, ImGuiTableColumnFlags.WidthFixed) ~= 0 and column.InitStretchWeightOrWidth > 0.0 and not column_is_resizable then + if band(column.Flags, 16 --[[ImGuiTableColumnFlags.WidthFixed]]) ~= 0 and column.InitStretchWeightOrWidth > 0.0 and not column_is_resizable then column.WidthAuto = column.InitStretchWeightOrWidth end if column.AutoFitQueue ~= 0x00 then has_auto_fit_request = true end - if band(column.Flags, ImGuiTableColumnFlags.WidthStretch) ~= 0 then + if band(column.Flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0 then stretch_sum_width_auto = stretch_sum_width_auto + column.WidthAuto count_stretch = count_stretch + 1 else @@ -51045,11 +51088,11 @@ function ImGui.TableUpdateLayout(table_) end end end - if band(table_.Flags, ImGuiTableFlags.Sortable) ~= 0 and table_.SortSpecsCount == 0 and band(table_.Flags, ImGuiTableFlags.SortTristate) == 0 then + if band(table_.Flags, 8 --[[ImGuiTableFlags.Sortable]]) ~= 0 and table_.SortSpecsCount == 0 and band(table_.Flags, 134217728 --[[ImGuiTableFlags.SortTristate]]) == 0 then table_.IsSortSpecsDirty = true end table_.RightMostEnabledColumn = prev_visible_column_idx - IM_ASSERT(table_.LeftMostEnabledColumn >= 0 and table_.RightMostEnabledColumn >= 0) + assert(table_.LeftMostEnabledColumn >= 0 and table_.RightMostEnabledColumn >= 0) -- [Part 2] Disable child window clipping while fitting columns. This is not strictly necessary but makes it possible to avoid -- the column fitting having to wait until the first visible frame of the child container (may or not be a good thing). Also see #6510. @@ -51069,11 +51112,11 @@ function ImGui.TableUpdateLayout(table_) if BitTest(table_.EnabledMaskByIndex, column_n) then local column = table_.Columns[column_n] - local column_is_resizable = band(column.Flags, ImGuiTableColumnFlags.NoResize) == 0 - if band(column.Flags, ImGuiTableColumnFlags.WidthFixed) ~= 0 then + local column_is_resizable = band(column.Flags, 32 --[[ImGuiTableColumnFlags.NoResize]]) == 0 + if band(column.Flags, 16 --[[ImGuiTableColumnFlags.WidthFixed]]) ~= 0 then -- Apply same widths policy local width_auto = column.WidthAuto - if table_sizing_policy == ImGuiTableFlags.SizingFixedSame and (column.AutoFitQueue ~= 0x00 or not column_is_resizable) then + if table_sizing_policy == 16384 --[[ImGuiTableFlags.SizingFixedSame]] and (column.AutoFitQueue ~= 0x00 or not column_is_resizable) then width_auto = fixed_max_width_auto end @@ -51081,7 +51124,7 @@ function ImGui.TableUpdateLayout(table_) -- Latch initial size for fixed columns and update it constantly for auto-resizing column (unless clipped!) if column.AutoFitQueue ~= 0x00 then column.WidthRequest = width_auto - elseif band(column.Flags, ImGuiTableColumnFlags.WidthFixed) ~= 0 and not column_is_resizable and column.IsRequestOutput then + elseif band(column.Flags, 16 --[[ImGuiTableColumnFlags.WidthFixed]]) ~= 0 and not column_is_resizable and column.IsRequestOutput then column.WidthRequest = width_auto end @@ -51100,7 +51143,7 @@ function ImGui.TableUpdateLayout(table_) if column.AutoFitQueue ~= 0x00 or column.StretchWeight < 0.0 or not column_is_resizable then if column.InitStretchWeightOrWidth > 0.0 then column.StretchWeight = column.InitStretchWeightOrWidth - elseif table_sizing_policy == ImGuiTableFlags.SizingStretchProp then + elseif table_sizing_policy == 24576 --[[ImGuiTableFlags.SizingStretchProp]] then column.StretchWeight = (column.WidthAuto / stretch_sum_width_auto) * count_stretch else column.StretchWeight = 1.0 @@ -51126,7 +51169,7 @@ function ImGui.TableUpdateLayout(table_) local work_rect = Rect(table_.WorkRect) local width_spacings = (table_.OuterPaddingX * 2.0) + (table_.CellSpacingX1 + table_.CellSpacingX2) * (table_.ColumnsEnabledCount - 1) local width_removed = (table_.HasScrollbarYPrev and not table_.InnerWindow.ScrollbarY) and g.Style.ScrollbarSize or 0.0 -- To synchronize decoration width of synced tables with mismatching scrollbar state (#5920) - local width_avail = mathMax(1.0, ((band(table_.Flags, ImGuiTableFlags.ScrollX) ~= 0 and table_.InnerWidth == 0.0) and table_.InnerClipRect:GetWidth() or work_rect:GetWidth()) - width_removed) + local width_avail = mathMax(1.0, ((band(table_.Flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) ~= 0 and table_.InnerWidth == 0.0) and table_.InnerClipRect:GetWidth() or work_rect:GetWidth()) - width_removed) local width_avail_for_stretched_columns = width_avail - width_spacings - sum_width_requests local width_remaining_for_stretched_columns = width_avail_for_stretched_columns table_.ColumnsGivenWidth = width_spacings + (table_.CellPaddingX * 2.0) * table_.ColumnsEnabledCount @@ -51135,7 +51178,7 @@ function ImGui.TableUpdateLayout(table_) local column = table_.Columns[column_n] -- Allocate width for stretched/weighted columns (StretchWeight gets converted into WidthRequest) - if band(column.Flags, ImGuiTableColumnFlags.WidthStretch) ~= 0 then + if band(column.Flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0 then local weight_ratio = column.StretchWeight / stretch_sum_weights column.WidthRequest = IM_TRUNC(mathMax(width_avail_for_stretched_columns * weight_ratio, table_.MinColumnWidth) + 0.01) width_remaining_for_stretched_columns = width_remaining_for_stretched_columns - column.WidthRequest @@ -51144,7 +51187,7 @@ function ImGui.TableUpdateLayout(table_) -- [Resize Rule 1] The right-most Visible column is not resizable if there is at least one Stretch column -- See additional comments in TableSetColumnWidth(). if column.NextEnabledColumn == -1 and table_.LeftMostStretchedColumn ~= -1 then - column.Flags = bor(column.Flags, ImGuiTableColumnFlags.NoDirectResize_) + column.Flags = bor(column.Flags, 1073741824 --[[ImGuiTableColumnFlags.NoDirectResize_]]) end -- Assign final width, record width in case we will need to shrink @@ -51155,12 +51198,12 @@ function ImGui.TableUpdateLayout(table_) -- [Part 5] Redistribute stretch remainder width due to rounding (remainder width is < 1.0 * number of Stretch column). -- Using right-to-left distribution (more likely to match resizing cursor). - if width_remaining_for_stretched_columns >= 1.0 and band(table_.Flags, ImGuiTableFlags.PreciseWidths) == 0 then + if width_remaining_for_stretched_columns >= 1.0 and band(table_.Flags, 524288 --[[ImGuiTableFlags.PreciseWidths]]) == 0 then local order_n = columns_count - 1 while stretch_sum_weights > 0.0 and width_remaining_for_stretched_columns >= 1.0 and order_n >= 0 do if BitTest(table_.EnabledMaskByDisplayOrder, order_n) then local column = table_.Columns[table_.DisplayOrderToIndex[order_n]] - if band(column.Flags, ImGuiTableColumnFlags.WidthStretch) ~= 0 then + if band(column.Flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0 then column.WidthRequest = column.WidthRequest + 1.0 column.WidthGiven = column.WidthGiven + 1.0 width_remaining_for_stretched_columns = width_remaining_for_stretched_columns - 1.0 @@ -51182,7 +51225,7 @@ function ImGui.TableUpdateLayout(table_) local mouse_hit_rect = ImRect(table_.OuterRect.Min.x, table_.OuterRect.Min.y, table_.OuterRect.Max.x, mathMax(table_.OuterRect.Max.y, table_.OuterRect.Min.y + table_instance.LastOuterHeight)) local backup_active_id = g.ActiveId g.ActiveId = 0 - local is_hovering_table = ImGui.ItemHoverable(mouse_hit_rect, 0, ImGuiItemFlags.None) + local is_hovering_table = ImGui.ItemHoverable(mouse_hit_rect, 0, 0 --[[ImGuiItemFlags.None]]) g.ActiveId = backup_active_id -- Determine skewed MousePos.x to support angled headers. @@ -51206,7 +51249,7 @@ function ImGui.TableUpdateLayout(table_) local column = table_.Columns[column_n] -- Initial nav layer: using FreezeRowsCount, NOT FreezeRowsRequest, so Header line changes layer when frozen - column.NavLayerCurrent = (table_.FreezeRowsCount > 0) and ImGuiNavLayer.Menu or table_.NavLayer + column.NavLayerCurrent = (table_.FreezeRowsCount > 0) and 1 --[[ImGuiNavLayer.Menu]] or table_.NavLayer if offset_x_frozen and table_.FreezeColumnsCount == order_n then offset_x = offset_x + work_rect.Min.x - table_.OuterRect.Min.x @@ -51214,7 +51257,7 @@ function ImGui.TableUpdateLayout(table_) end -- Clear status flags - column.Flags = band(column.Flags, bnot(ImGuiTableColumnFlags.StatusMask_)) + column.Flags = band(column.Flags, bnot(251658240 --[[ImGuiTableColumnFlags.StatusMask_]])) if not BitTest(table_.EnabledMaskByDisplayOrder, order_n) then -- Hidden column: clear a few fields and we are done with it for the remainder of the function. @@ -51223,7 +51266,7 @@ function ImGui.TableUpdateLayout(table_) column.ClipRect.Min.x = offset_x; column.ClipRect.Max.x = offset_x column.WidthGiven = 0.0 column.ClipRect.Min.y = work_rect.Min.y - column.ClipRect.Max.y = FLT_MAX + column.ClipRect.Max.y = 3.4028234663853e+38 --[[FLT_MAX]] column.ClipRect:ClipWithFull(host_clip_rect) column.IsVisibleX = false; column.IsVisibleY = false; column.IsRequestOutput = false column.IsSkipItems = true @@ -51250,7 +51293,7 @@ function ImGui.TableUpdateLayout(table_) column.ClipRect.Min.x = column.MinX column.ClipRect.Min.y = work_rect.Min.y column.ClipRect.Max.x = column.MaxX --column.WorkMaxX - column.ClipRect.Max.y = FLT_MAX + column.ClipRect.Max.y = 3.4028234663853e+38 --[[FLT_MAX]] column.ClipRect:ClipWithFull(host_clip_rect) -- Mark column as Clipped (not in sight) @@ -51274,24 +51317,24 @@ function ImGui.TableUpdateLayout(table_) -- (table.HostSkipItems is a copy of inner_window.SkipItems before we cleared it above in Part 2) column.IsSkipItems = not column.IsEnabled or table_.HostSkipItems if column.IsSkipItems then - IM_ASSERT(not is_visible) + assert(not is_visible) end if column.IsRequestOutput and not column.IsSkipItems then has_at_least_one_column_requesting_output = true end -- Update status flags - column.Flags = bor(column.Flags, ImGuiTableColumnFlags.IsEnabled) + column.Flags = bor(column.Flags, 16777216 --[[ImGuiTableColumnFlags.IsEnabled]]) if is_visible then - column.Flags = bor(column.Flags, ImGuiTableColumnFlags.IsVisible) + column.Flags = bor(column.Flags, 33554432 --[[ImGuiTableColumnFlags.IsVisible]]) end if column.SortOrder ~= -1 then - column.Flags = bor(column.Flags, ImGuiTableColumnFlags.IsSorted) + column.Flags = bor(column.Flags, 67108864 --[[ImGuiTableColumnFlags.IsSorted]]) end -- Detect hovered column if is_hovering_table and mouse_skewed_x >= column.ClipRect.Min.x and mouse_skewed_x < column.ClipRect.Max.x then - column.Flags = bor(column.Flags, ImGuiTableColumnFlags.IsHovered) + column.Flags = bor(column.Flags, 134217728 --[[ImGuiTableColumnFlags.IsHovered]]) table_.HoveredColumnBody = column_n end @@ -51349,8 +51392,8 @@ function ImGui.TableUpdateLayout(table_) table_.HoveredColumnBody = columns_count end end - if has_resizable == false and band(table_.Flags, ImGuiTableFlags.Resizable) ~= 0 then - table_.Flags = band(table_.Flags, bnot(ImGuiTableFlags.Resizable)) + if has_resizable == false and band(table_.Flags, 1 --[[ImGuiTableFlags.Resizable]]) ~= 0 then + table_.Flags = band(table_.Flags, bnot(1 --[[ImGuiTableFlags.Resizable]])) end table_.IsActiveIdAliveBeforeTable = (g.ActiveIdIsAlive ~= 0) @@ -51359,9 +51402,9 @@ function ImGui.TableUpdateLayout(table_) -- This is done late to handle the case of fixed-columns tables not claiming more widths that they need. -- Because of this we are careful with uses of WorkRect and InnerClipRect before this point. if table_.RightMostStretchedColumn ~= -1 then - table_.Flags = band(table_.Flags, bnot(ImGuiTableFlags.NoHostExtendX)) + table_.Flags = band(table_.Flags, bnot(65536 --[[ImGuiTableFlags.NoHostExtendX]])) end - if band(table_.Flags, ImGuiTableFlags.NoHostExtendX) ~= 0 then + if band(table_.Flags, 65536 --[[ImGuiTableFlags.NoHostExtendX]]) ~= 0 then table_.OuterRect.Max.x = unused_x1; table_.WorkRect.Max.x = unused_x1 table_.InnerClipRect.Max.x = mathMin(table_.InnerClipRect.Max.x, unused_x1) end @@ -51371,10 +51414,10 @@ function ImGui.TableUpdateLayout(table_) -- Setup window's WorkRect.Max.y for GetContentRegionAvail(). Other values will be updated in each TableBeginCell() call. local window_content_max_y - if band(table_.Flags, ImGuiTableFlags.NoHostExtendY) ~= 0 then + if band(table_.Flags, 131072 --[[ImGuiTableFlags.NoHostExtendY]]) ~= 0 then window_content_max_y = table_.OuterRect.Max.y else - window_content_max_y = mathMax(table_.InnerWindow.ContentRegionRect.Max.y, (band(table_.Flags, ImGuiTableFlags.ScrollY) ~= 0) and 0.0 or table_.OuterRect.Max.y) + window_content_max_y = mathMax(table_.InnerWindow.ContentRegionRect.Max.y, (band(table_.Flags, 33554432 --[[ImGuiTableFlags.ScrollY]]) ~= 0) and 0.0 or table_.OuterRect.Max.y) end table_.InnerWindow.WorkRect.Max.y = ImClamp(window_content_max_y - g.Style.CellPadding.y, table_.InnerWindow.WorkRect.Min.y, table_.InnerWindow.WorkRect.Max.y) @@ -51382,7 +51425,7 @@ function ImGui.TableUpdateLayout(table_) ImGui.TableSetupDrawChannels(table_) -- [Part 10] Hit testing on borders - if band(table_.Flags, ImGuiTableFlags.Resizable) ~= 0 then + if band(table_.Flags, 1 --[[ImGuiTableFlags.Resizable]]) ~= 0 then ImGui.TableUpdateBorders(table_) end table_instance.LastTopHeadersRowHeight = 0.0 @@ -51393,7 +51436,7 @@ function ImGui.TableUpdateLayout(table_) table_.HighlightColumnHeader = -1 if table_.IsContextPopupOpen and table_.ContextPopupColumn ~= -1 and table_.InstanceInteracted == table_.InstanceCurrent then table_.HighlightColumnHeader = table_.ContextPopupColumn - elseif band(table_.Flags, ImGuiTableFlags.HighlightHoveredColumn) ~= 0 and table_.HoveredColumnBody ~= -1 and table_.HoveredColumnBody ~= columns_count and table_.HoveredColumnBorder == -1 then + elseif band(table_.Flags, 268435456 --[[ImGuiTableFlags.HighlightHoveredColumn]]) ~= 0 and table_.HoveredColumnBody ~= -1 and table_.HoveredColumnBody ~= columns_count and table_.HoveredColumnBorder == -1 then if g.ActiveId == 0 or (table_.IsActiveIdInTable or g.DragDropActive) then table_.HighlightColumnHeader = table_.HoveredColumnBody end @@ -51411,7 +51454,7 @@ function ImGui.TableUpdateLayout(table_) -- [Part 12] Sanitize and build sort specs before we have a chance to use them for display. -- This path will only be exercised when sort specs are modified before header rows (e.g. init or visibility change) - if table_.IsSortSpecsDirty and band(table_.Flags, ImGuiTableFlags.Sortable) ~= 0 then + if table_.IsSortSpecsDirty and band(table_.Flags, 8 --[[ImGuiTableFlags.Sortable]]) ~= 0 then ImGui.TableSortSpecsBuild(table_) end @@ -51431,7 +51474,7 @@ function ImGui.TableUpdateLayout(table_) end -- Initial state - if band(table_.Flags, ImGuiTableFlags.NoClip) ~= 0 then + if band(table_.Flags, 1048576 --[[ImGuiTableFlags.NoClip]]) ~= 0 then table_.DrawSplitter:SetCurrentChannel(inner_window.DrawList, TABLE_DRAW_CHANNEL_NOCLIP) else inner_window.DrawList:PushClipRect(inner_window.InnerClipRect.Min, inner_window.InnerClipRect.Max, false) -- FIXME: use table.InnerClipRect? @@ -51446,7 +51489,7 @@ function ImGui.TableApplyExternalUnclipRect(table_, rect) for column_n = 0, table_.ColumnsCount - 1 do local column = table_.Columns[column_n] if not column.IsRequestOutput then - if rect:Overlaps(ImRect(column.MinX, table_.WorkRect.Min.y, column.MaxX, FLT_MAX)) then + if rect:Overlaps(ImRect(column.MinX, table_.WorkRect.Min.y, column.MaxX, 3.4028234663853e+38 --[[FLT_MAX]])) then column.IsRequestOutput = true end end @@ -51457,7 +51500,7 @@ end -- - Set table.HoveredColumnBorder with a short delay/timer to reduce visual feedback noise. function ImGui.TableUpdateBorders(table_) local g = GImGui - IM_ASSERT(band(table_.Flags, ImGuiTableFlags.Resizable) ~= 0) + assert(band(table_.Flags, 1 --[[ImGuiTableFlags.Resizable]]) ~= 0) -- At this point OuterRect height may be zero or under actual final height, so we rely on temporal coherency and -- use the final height from last frame. Because this is only affecting _interaction_ with columns, it is not @@ -51477,13 +51520,13 @@ function ImGui.TableUpdateBorders(table_) local column_n = table_.DisplayOrderToIndex[order_n] local column = table_.Columns[column_n] - if band(column.Flags, bor(ImGuiTableColumnFlags.NoResize, ImGuiTableColumnFlags.NoDirectResize_)) ~= 0 then + if band(column.Flags, bor(32 --[[ImGuiTableColumnFlags.NoResize]], 1073741824 --[[ImGuiTableColumnFlags.NoDirectResize_]])) ~= 0 then break end -- ImGuiTableFlags.NoBordersInBodyUntilResize will be honored in TableDrawBorders() - local border_y2_hit = (band(table_.Flags, ImGuiTableFlags.NoBordersInBody) ~= 0) and hit_y2_head or hit_y2_body - if band(table_.Flags, ImGuiTableFlags.NoBordersInBody) ~= 0 and table_.IsUsingHeaders == false then + local border_y2_hit = (band(table_.Flags, 2048 --[[ImGuiTableFlags.NoBordersInBody]]) ~= 0) and hit_y2_head or hit_y2_body + if band(table_.Flags, 2048 --[[ImGuiTableFlags.NoBordersInBody]]) ~= 0 and table_.IsUsingHeaders == false then break end @@ -51493,10 +51536,10 @@ function ImGui.TableUpdateBorders(table_) local column_id = ImGui.TableGetColumnResizeID(table_, column_n, table_.InstanceCurrent) local hit_rect = ImRect(column.MaxX - hit_half_width, hit_y1, column.MaxX + hit_half_width, border_y2_hit) - ImGui.ItemAdd(hit_rect, column_id, nil, ImGuiItemFlags.NoNav) + ImGui.ItemAdd(hit_rect, column_id, nil, 2 --[[ImGuiItemFlags.NoNav]]) --ImGui.GetForegroundDrawList():AddRect(hit_rect.Min, hit_rect.Max, IM_COL32(255, 0, 0, 100)) - local pressed, hovered, held = ImGui.ButtonBehavior(hit_rect, column_id, bor(ImGuiButtonFlags.FlattenChildren, ImGuiButtonFlags.PressedOnClick, ImGuiButtonFlags.PressedOnDoubleClick, ImGuiButtonFlags.NoNavFocus)) + local pressed, hovered, held = ImGui.ButtonBehavior(hit_rect, column_id, bor(2048 --[[ImGuiButtonFlags.FlattenChildren]], 16 --[[ImGuiButtonFlags.PressedOnClick]], 256 --[[ImGuiButtonFlags.PressedOnDoubleClick]], 262144 --[[ImGuiButtonFlags.NoNavFocus]])) if pressed and ImGui.IsMouseDoubleClicked(0) then ImGui.TableSetColumnWidthAutoSingle(table_, column_n) ImGui.ClearActiveID() @@ -51504,14 +51547,14 @@ function ImGui.TableUpdateBorders(table_) end if held then if table_.LastResizedColumn == -1 then - table_.ResizeLockMinContentsX2 = (table_.RightMostEnabledColumn ~= -1) and table_.Columns[table_.RightMostEnabledColumn].MaxX or -FLT_MAX + table_.ResizeLockMinContentsX2 = (table_.RightMostEnabledColumn ~= -1) and table_.Columns[table_.RightMostEnabledColumn].MaxX or -3.4028234663853e+38 --[[FLT_MAX]] end table_.ResizedColumn = column_n table_.InstanceInteracted = table_.InstanceCurrent end if (hovered and g.HoveredIdTimer > TABLE_RESIZE_SEPARATOR_FEEDBACK_TIMER) or held then table_.HoveredColumnBorder = column_n - ImGui.SetMouseCursor(ImGuiMouseCursor.ResizeEW) + ImGui.SetMouseCursor(4 --[[ImGuiMouseCursor.ResizeEW]]) end until true end @@ -51536,16 +51579,16 @@ function ImGui.EndTable() local inner_window = table_.InnerWindow local outer_window = table_.OuterWindow local temp_data = table_.TempData - IM_ASSERT(inner_window == g.CurrentWindow and inner_window.ID == temp_data.WindowID) - IM_ASSERT(outer_window == inner_window or outer_window == inner_window.ParentWindow) + assert(inner_window == g.CurrentWindow and inner_window.ID == temp_data.WindowID) + assert(outer_window == inner_window or outer_window == inner_window.ParentWindow) if table_.IsInsideRow then ImGui.TableEndRow(table_) end -- Context menu in columns body - if band(flags, ImGuiTableFlags.ContextMenuInBody) ~= 0 then - if table_.HoveredColumnBody ~= -1 and not ImGui.IsAnyItemHovered() and ImGui.IsMouseReleased(ImGuiMouseButton.Right) then + if band(flags, 32 --[[ImGuiTableFlags.ContextMenuInBody]]) ~= 0 then + if table_.HoveredColumnBody ~= -1 and not ImGui.IsAnyItemHovered() and ImGui.IsMouseReleased(1 --[[ImGuiMouseButton.Right]]) then ImGui.TableOpenContextMenu(table_.HoveredColumnBody) end end @@ -51556,10 +51599,10 @@ function ImGui.EndTable() ImVec2_Copy(inner_window.DC.CurrLineSize, temp_data.HostBackupCurrLineSize) ImVec2_Copy(inner_window.DC.CursorMaxPos, temp_data.HostBackupCursorMaxPos) local inner_content_max_y = ImCeil(table_.RowPosY2) -- Rounding final position is important as we currently don't round row height ('Demo->Tables->Outer Size' demo uses non-integer heights) - IM_ASSERT(table_.RowPosY2 == inner_window.DC.CursorPos.y) + assert(table_.RowPosY2 == inner_window.DC.CursorPos.y) if inner_window ~= outer_window then inner_window.DC.CursorMaxPos.y = inner_content_max_y - elseif band(flags, ImGuiTableFlags.NoHostExtendY) == 0 then + elseif band(flags, 131072 --[[ImGuiTableFlags.NoHostExtendY]]) == 0 then local v = mathMax(table_.OuterRect.Max.y, inner_content_max_y) -- Patch OuterRect/InnerRect height table_.OuterRect.Max.y = v; table_.InnerRect.Max.y = v end @@ -51569,8 +51612,8 @@ function ImGui.EndTable() -- Setup inner scrolling range -- FIXME: This ideally should be done earlier, in BeginTable() SetNextWindowContentSize call, just like writing to inner_window.DC.CursorMaxPos.y, -- but since the later is likely to be impossible to do we'd rather update both axes together. - if band(table_.Flags, ImGuiTableFlags.ScrollX) ~= 0 then - local outer_padding_for_border = (band(table_.Flags, ImGuiTableFlags.BordersOuterV) ~= 0) and TABLE_BORDER_SIZE or 0.0 + if band(table_.Flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) ~= 0 then + local outer_padding_for_border = (band(table_.Flags, 1024 --[[ImGuiTableFlags.BordersOuterV]]) ~= 0) and TABLE_BORDER_SIZE or 0.0 local max_pos_x = inner_window.DC.CursorMaxPos.x if table_.RightMostEnabledColumn ~= -1 then max_pos_x = mathMax(max_pos_x, table_.Columns[table_.RightMostEnabledColumn].WorkMaxX + table_.CellPaddingX + table_.OuterPaddingX - outer_padding_for_border) @@ -51582,20 +51625,20 @@ function ImGui.EndTable() end -- Pop clipping rect - if band(flags, ImGuiTableFlags.NoClip) == 0 then + if band(flags, 1048576 --[[ImGuiTableFlags.NoClip]]) == 0 then inner_window.DrawList:PopClipRect() end ImRect_CopyFromV4(inner_window.ClipRect, inner_window.DrawList._ClipRectStack:back()) -- Draw borders - if band(flags, ImGuiTableFlags.Borders) ~= 0 then + if band(flags, 1920 --[[ImGuiTableFlags.Borders]]) ~= 0 then ImGui.TableDrawBorders(table_) end -- Flatten channels and merge draw calls local splitter = table_.DrawSplitter splitter:SetCurrentChannel(inner_window.DrawList, 0) - if band(table_.Flags, ImGuiTableFlags.NoClip) == 0 then + if band(table_.Flags, 1048576 --[[ImGuiTableFlags.NoClip]]) == 0 then ImGui.TableMergeDrawChannels(table_) end splitter:Merge(inner_window.DrawList) @@ -51608,17 +51651,17 @@ function ImGui.EndTable() if BitTest(table_.EnabledMaskByIndex, column_n) then local column = table_.Columns[column_n] local column_width_request - if band(column.Flags, ImGuiTableColumnFlags.WidthFixed) ~= 0 and band(column.Flags, ImGuiTableColumnFlags.NoResize) == 0 then + if band(column.Flags, 16 --[[ImGuiTableColumnFlags.WidthFixed]]) ~= 0 and band(column.Flags, 32 --[[ImGuiTableColumnFlags.NoResize]]) == 0 then column_width_request = column.WidthRequest else column_width_request = ImGui.TableGetColumnWidthAuto(table_, column) end - if band(column.Flags, ImGuiTableColumnFlags.WidthFixed) ~= 0 then + if band(column.Flags, 16 --[[ImGuiTableColumnFlags.WidthFixed]]) ~= 0 then auto_fit_width_for_fixed = auto_fit_width_for_fixed + column_width_request else auto_fit_width_for_stretched = auto_fit_width_for_stretched + column_width_request end - if band(column.Flags, ImGuiTableColumnFlags.WidthStretch) ~= 0 and band(column.Flags, ImGuiTableColumnFlags.NoResize) ~= 0 then + if band(column.Flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0 and band(column.Flags, 32 --[[ImGuiTableColumnFlags.NoResize]]) ~= 0 then auto_fit_width_for_stretched_min = mathMax(auto_fit_width_for_stretched_min, column_width_request / (column.StretchWeight / table_.ColumnsStretchSumWeights)) end end @@ -51627,7 +51670,7 @@ function ImGui.EndTable() table_.ColumnsAutoFitWidth = width_spacings + (table_.CellPaddingX * 2.0) * table_.ColumnsEnabledCount + auto_fit_width_for_fixed + mathMax(auto_fit_width_for_stretched, auto_fit_width_for_stretched_min) -- Update scroll - if band(table_.Flags, ImGuiTableFlags.ScrollX) == 0 and inner_window ~= outer_window then + if band(table_.Flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) == 0 and inner_window ~= outer_window then inner_window.Scroll.x = 0.0 elseif table_.LastResizedColumn ~= -1 and table_.ResizedColumn == -1 and inner_window.ScrollbarX and table_.InstanceInteracted == table_.InstanceCurrent then -- When releasing a column being resized, scroll to keep the resulting column in sight @@ -51685,10 +51728,10 @@ function ImGui.EndTable() end -- Override declared contents width/height to enable auto-resize while not needlessly adding a scrollbar - if band(table_.Flags, ImGuiTableFlags.NoHostExtendX) ~= 0 then + if band(table_.Flags, 65536 --[[ImGuiTableFlags.NoHostExtendX]]) ~= 0 then -- FIXME-TABLE: Could we remove this section? -- ColumnsAutoFitWidth may be one frame ahead here since for Fixed+NoResize is calculated from latest contents - IM_ASSERT(band(table_.Flags, ImGuiTableFlags.ScrollX) == 0) + assert(band(table_.Flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) == 0) outer_window.DC.CursorMaxPos.x = mathMax(backup_outer_max_pos.x, table_.OuterRect.Min.x + table_.ColumnsAutoFitWidth) elseif temp_data.UserOuterSize.x <= 0.0 then -- Some references for this: #7651 + tests "table_reported_size", "table_reported_size_outer" equivalent Y block, #9352 @@ -51719,8 +51762,8 @@ function ImGui.EndTable() table_.IsInitializing = false -- Clear or restore current table, if any - IM_ASSERT(g.CurrentWindow == outer_window and g.CurrentTable == table_) - IM_ASSERT(g.TablesTempDataStacked > 0) + assert(g.CurrentWindow == outer_window and g.CurrentTable == table_) + assert(g.TablesTempDataStacked > 0) g.TablesTempDataStacked = g.TablesTempDataStacked - 1 temp_data = (g.TablesTempDataStacked > 0) and g.TablesTempData.Data[g.TablesTempDataStacked] or nil g.CurrentTable = (temp_data and (temp_data.WindowID == outer_window.ID)) and g.Tables:GetByIndex(temp_data.TableIndex) or nil @@ -51737,28 +51780,28 @@ end --- @param column_n int # index of `column` (C++: Columns.index_from_ptr(column)) function ImGui.TableInitColumnDefaults(table_, column, column_n, init_mask) local flags = column.Flags - if band(init_mask, ImGuiTableFlags.Resizable) ~= 0 then + if band(init_mask, 1 --[[ImGuiTableFlags.Resizable]]) ~= 0 then local init_width_or_weight = column.InitStretchWeightOrWidth - column.WidthRequest = (band(flags, ImGuiTableColumnFlags.WidthFixed) ~= 0 and init_width_or_weight > 0.0) and init_width_or_weight or -1.0 - column.StretchWeight = (init_width_or_weight > 0.0 and band(flags, ImGuiTableColumnFlags.WidthStretch) ~= 0) and init_width_or_weight or -1.0 + column.WidthRequest = (band(flags, 16 --[[ImGuiTableColumnFlags.WidthFixed]]) ~= 0 and init_width_or_weight > 0.0) and init_width_or_weight or -1.0 + column.StretchWeight = (init_width_or_weight > 0.0 and band(flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0) and init_width_or_weight or -1.0 if init_width_or_weight > 0.0 then -- Disable auto-fit if an explicit width/weight has been specified column.AutoFitQueue = 0x00 end end - if band(init_mask, ImGuiTableFlags.Reorderable) ~= 0 then - column.DisplayOrder = (band(table_.Flags, ImGuiTableFlags.Reorderable) ~= 0) and -1 or column_n + if band(init_mask, 2 --[[ImGuiTableFlags.Reorderable]]) ~= 0 then + column.DisplayOrder = (band(table_.Flags, 2 --[[ImGuiTableFlags.Reorderable]]) ~= 0) and -1 or column_n end - if band(init_mask, ImGuiTableFlags.Hideable) ~= 0 then - local v = band(flags, ImGuiTableColumnFlags.DefaultHide) == 0 + if band(init_mask, 4 --[[ImGuiTableFlags.Hideable]]) ~= 0 then + local v = band(flags, 2 --[[ImGuiTableColumnFlags.DefaultHide]]) == 0 column.IsUserEnabled = v; column.IsUserEnabledNextFrame = v end - if band(init_mask, ImGuiTableFlags.Sortable) ~= 0 then + if band(init_mask, 8 --[[ImGuiTableFlags.Sortable]]) ~= 0 then -- Multiple columns using _DefaultSort will be reassigned unique SortOrder values when building the sort specs. - column.SortOrder = (band(flags, ImGuiTableColumnFlags.DefaultSort) ~= 0) and 0 or -1 - if band(flags, ImGuiTableColumnFlags.DefaultSort) ~= 0 then - column.SortDirection = (band(flags, ImGuiTableColumnFlags.PreferSortDescending) ~= 0) and ImGuiSortDirection.Descending or ImGuiSortDirection.Ascending + column.SortOrder = (band(flags, 4 --[[ImGuiTableColumnFlags.DefaultSort]]) ~= 0) and 0 or -1 + if band(flags, 4 --[[ImGuiTableColumnFlags.DefaultSort]]) ~= 0 then + column.SortDirection = (band(flags, 32768 --[[ImGuiTableColumnFlags.PreferSortDescending]]) ~= 0) and 2 --[[ImGuiSortDirection.Descending]] or 1 --[[ImGuiSortDirection.Ascending]] else - column.SortDirection = ImGuiSortDirection.None + column.SortDirection = 0 --[[ImGuiSortDirection.None]] end end end @@ -51770,19 +51813,19 @@ local function TableSetupColumnApply(table_, idx, id, name_offset, flags, init_w -- Assert when passing a width or weight if policy is entirely left to default, to avoid storing width into weight and vice-versa. -- Give a grace to users of ImGuiTableFlags.ScrollX. - if table_.IsDefaultSizingPolicy and band(flags, ImGuiTableColumnFlags.WidthMask_) == 0 and band(flags, ImGuiTableFlags.ScrollX) == 0 then + if table_.IsDefaultSizingPolicy and band(flags, 24 --[[ImGuiTableColumnFlags.WidthMask_]]) == 0 and band(flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) == 0 then IM_ASSERT_USER_ERROR_RET(init_width_or_weight <= 0.0, "TableSetupColumn(): can only specify width/weight if sizing policy is set explicitly in either Table or Column.") end -- When passing a width automatically enforce WidthFixed policy -- (whereas TableSetupColumnFlags would default to WidthAuto if table is not resizable) - if band(flags, ImGuiTableColumnFlags.WidthMask_) == 0 and init_width_or_weight > 0.0 then - if band(table_.Flags, ImGuiTableFlags.SizingMask_) == ImGuiTableFlags.SizingFixedFit or band(table_.Flags, ImGuiTableFlags.SizingMask_) == ImGuiTableFlags.SizingFixedSame then - flags = bor(flags, ImGuiTableColumnFlags.WidthFixed) + if band(flags, 24 --[[ImGuiTableColumnFlags.WidthMask_]]) == 0 and init_width_or_weight > 0.0 then + if band(table_.Flags, 57344 --[[ImGuiTableFlags.SizingMask_]]) == 8192 --[[ImGuiTableFlags.SizingFixedFit]] or band(table_.Flags, 57344 --[[ImGuiTableFlags.SizingMask_]]) == 16384 --[[ImGuiTableFlags.SizingFixedSame]] then + flags = bor(flags, 16 --[[ImGuiTableColumnFlags.WidthFixed]]) end end - if band(flags, ImGuiTableColumnFlags.AngledHeader) ~= 0 then - flags = bor(flags, ImGuiTableColumnFlags.NoHeaderLabel) + if band(flags, 262144 --[[ImGuiTableColumnFlags.AngledHeader]]) ~= 0 then + flags = bor(flags, 4096 --[[ImGuiTableColumnFlags.NoHeaderLabel]]) table_.AngledHeadersCount = table_.AngledHeadersCount + 1 end @@ -51807,7 +51850,7 @@ function ImGui.TableSetupColumn(label, flags, init_width_or_weight, user_data) IM_ASSERT_USER_ERROR_RET(table_ ~= nil, "Call should only be done while in BeginTable() scope!") IM_ASSERT_USER_ERROR_RET(table_.DeclColumnsCount < table_.ColumnsCount, "TableSetupColumn(): called too many times!") IM_ASSERT_USER_ERROR_RET(table_.IsLayoutLocked == false, "TableSetupColumn(): need to call before first row!") -- Table layout is locked when submitting a row or when calling BeginMultiSelect() with box-select. - IM_ASSERT(band(flags, ImGuiTableColumnFlags.StatusMask_) == 0, "Illegal to pass StatusMask values to TableSetupColumn()") + assert(band(flags, 251658240 --[[ImGuiTableColumnFlags.StatusMask_]]) == 0, "Illegal to pass StatusMask values to TableSetupColumn()") -- Store name -- FIXME: If we recorded the number of \n in names we could compute header row height @@ -51874,7 +51917,7 @@ function ImGui.TableReconcileColumns(table_) local src_column = src_columns[src_n] if src_column.ID == reconcile_data.ID and src_column.IsNeedReconcileSrc then local dst_column = dst_columns[reconcile_data.ColumnNewIdx] - IM_ASSERT(src_column.IsNeedReconcileSrc and dst_column.IsNeedReconcileDst) + assert(src_column.IsNeedReconcileSrc and dst_column.IsNeedReconcileDst) src_column.IsNeedReconcileSrc = false; dst_column.IsNeedReconcileDst = false reconcile_data.ColumnOldIdx = src_n reconcile_data.ColumnOldData = TableColumnClone(src_column) @@ -51899,7 +51942,7 @@ function ImGui.TableReconcileColumns(table_) end local reconcile_data = reconcile_requests.Data[dst_idx] local dst_column = dst_columns[reconcile_data.ColumnNewIdx] - IM_ASSERT(src_column.IsNeedReconcileSrc and dst_column.IsNeedReconcileDst) + assert(src_column.IsNeedReconcileSrc and dst_column.IsNeedReconcileDst) src_column.IsNeedReconcileSrc = false; dst_column.IsNeedReconcileDst = false reconcile_data.ColumnOldIdx = src_n reconcile_data.ColumnOldData = TableColumnClone(src_column) @@ -51923,13 +51966,13 @@ function ImGui.TableSetupScrollFreeze(columns, rows) local g = GImGui local table_ = g.CurrentTable IM_ASSERT_USER_ERROR_RET(table_ ~= nil, "Call should only be done while in BeginTable() scope!") - IM_ASSERT(table_.IsLayoutLocked == false, "TableSetupColumn(): need to call before first row!") - IM_ASSERT(columns >= 0 and columns < IMGUI_TABLE_MAX_COLUMNS) - IM_ASSERT(rows >= 0 and rows < 128) -- Arbitrary limit + assert(table_.IsLayoutLocked == false, "TableSetupColumn(): need to call before first row!") + assert(columns >= 0 and columns < 512 --[[IMGUI_TABLE_MAX_COLUMNS]]) + assert(rows >= 0 and rows < 128) -- Arbitrary limit - table_.FreezeColumnsRequest = (band(table_.Flags, ImGuiTableFlags.ScrollX) ~= 0) and mathMin(columns, table_.ColumnsCount) or 0 + table_.FreezeColumnsRequest = (band(table_.Flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) ~= 0) and mathMin(columns, table_.ColumnsCount) or 0 table_.FreezeColumnsCount = (table_.InnerWindow.Scroll.x ~= 0.0) and table_.FreezeColumnsRequest or 0 - table_.FreezeRowsRequest = (band(table_.Flags, ImGuiTableFlags.ScrollY) ~= 0) and rows or 0 + table_.FreezeRowsRequest = (band(table_.Flags, 33554432 --[[ImGuiTableFlags.ScrollY]]) ~= 0) and rows or 0 table_.FreezeRowsCount = (table_.InnerWindow.Scroll.y ~= 0.0) and table_.FreezeRowsRequest or 0 table_.IsUnfrozenRows = (table_.FreezeRowsCount == 0) -- Make sure this is set before TableUpdateLayout() so ImGuiListClipper can benefit from it. end @@ -52014,11 +52057,11 @@ function ImGui.TableSetColumnEnabled(column_n, enabled) local g = GImGui local table_ = g.CurrentTable IM_ASSERT_USER_ERROR_RET(table_ ~= nil, "Call should only be done while in BeginTable() scope!") - IM_ASSERT(band(table_.Flags, ImGuiTableFlags.Hideable) ~= 0) -- See comments above + assert(band(table_.Flags, 4 --[[ImGuiTableFlags.Hideable]]) ~= 0) -- See comments above if column_n < 0 then column_n = table_.CurrentColumn end - IM_ASSERT(column_n >= 0 and column_n < table_.ColumnsCount) + assert(column_n >= 0 and column_n < table_.ColumnsCount) local column = table_.Columns[column_n] column.IsUserEnabledNextFrame = enabled end @@ -52029,13 +52072,13 @@ function ImGui.TableGetColumnFlags(column_n) local g = GImGui local table_ = g.CurrentTable if not table_ then - return ImGuiTableColumnFlags.None + return 0 --[[ImGuiTableColumnFlags.None]] end if column_n < 0 then column_n = table_.CurrentColumn end if column_n == table_.ColumnsCount then - return (table_.HoveredColumnBody == column_n) and ImGuiTableColumnFlags.IsHovered or ImGuiTableColumnFlags.None + return (table_.HoveredColumnBody == column_n) and 134217728 --[[ImGuiTableColumnFlags.IsHovered]] or 0 --[[ImGuiTableColumnFlags.None]] end return table_.Columns[column_n].Flags end @@ -52062,7 +52105,7 @@ end -- Return the resizing ID for the right-side of the given column. function ImGui.TableGetColumnResizeID(table_, column_n, instance_no) if instance_no == nil then instance_no = 0 end - IM_ASSERT(column_n >= 0 and column_n < table_.ColumnsCount) + assert(column_n >= 0 and column_n < table_.ColumnsCount) local instance_id = ImGui.TableGetInstanceID(table_, instance_no) return band(instance_id + 1 + column_n, 0xFFFFFFFF) -- FIXME: #6140: still not ideal end @@ -52095,14 +52138,14 @@ function ImGui.TableSetBgColor(target, color, column_n) local g = GImGui local table_ = g.CurrentTable IM_ASSERT_USER_ERROR_RET(table_ ~= nil, "Call should only be done while in BeginTable() scope!") - IM_ASSERT(target ~= ImGuiTableBgTarget.None) + assert(target ~= 0 --[[ImGuiTableBgTarget.None]]) - if color == IM_COL32_DISABLE then + if color == 16777216 --[[IM_COL32_DISABLE]] then color = 0 end -- We cannot draw neither the cell or row background immediately as we don't know the row height at this point in time. - if target == ImGuiTableBgTarget.CellBg then + if target == 3 --[[ImGuiTableBgTarget.CellBg]] then if table_.RowPosY1 > table_.InnerClipRect.Max.y then -- Discard return end @@ -52118,15 +52161,15 @@ function ImGui.TableSetBgColor(target, color, column_n) local cell_data = table_.RowCellData[table_.RowCellDataCurrent] cell_data.BgColor = color cell_data.Column = column_n - elseif target == ImGuiTableBgTarget.RowBg0 or target == ImGuiTableBgTarget.RowBg1 then + elseif target == 1 --[[ImGuiTableBgTarget.RowBg0]] or target == 2 --[[ImGuiTableBgTarget.RowBg1]] then if table_.RowPosY1 > table_.InnerClipRect.Max.y then -- Discard return end - IM_ASSERT(column_n == -1) - local bg_idx = (target == ImGuiTableBgTarget.RowBg1) and 1 or 0 + assert(column_n == -1) + local bg_idx = (target == 2 --[[ImGuiTableBgTarget.RowBg1]]) and 1 or 0 table_.RowBgColor[bg_idx] = color else - IM_ASSERT(false) + assert(false) end end @@ -52183,12 +52226,12 @@ end -- [Internal] Only called by TableNextRow() function ImGui.TableBeginRow(table_) local window = table_.InnerWindow - IM_ASSERT(not table_.IsInsideRow) + assert(not table_.IsInsideRow) -- New row table_.CurrentRow = table_.CurrentRow + 1 table_.CurrentColumn = -1 - table_.RowBgColor[0] = IM_COL32_DISABLE; table_.RowBgColor[1] = IM_COL32_DISABLE + table_.RowBgColor[0] = 16777216 --[[IM_COL32_DISABLE]]; table_.RowBgColor[1] = 16777216 --[[IM_COL32_DISABLE]] table_.RowCellDataCurrent = -1 table_.IsInsideRow = true @@ -52213,8 +52256,8 @@ function ImGui.TableBeginRow(table_) dc.CursorMaxPos.y = next_y1 -- Making the header BG color non-transparent will allow us to overlay it multiple times when handling smooth dragging. - if band(table_.RowFlags, ImGuiTableRowFlags.Headers) ~= 0 then - ImGui.TableSetBgColor(ImGuiTableBgTarget.RowBg0, ImGui.GetColorU32(ImGuiCol.TableHeaderBg)) + if band(table_.RowFlags, 1 --[[ImGuiTableRowFlags.Headers]]) ~= 0 then + ImGui.TableSetBgColor(1 --[[ImGuiTableBgTarget.RowBg0]], ImGui.GetColorU32(48 --[[ImGuiCol.TableHeaderBg]])) if table_.CurrentRow == 0 then table_.IsUsingHeaders = true end @@ -52228,8 +52271,8 @@ local TableEndRow_RowMin, TableEndRow_RowMax = ImVec2(), ImVec2() function ImGui.TableEndRow(table_) local g = GImGui local window = g.CurrentWindow - IM_ASSERT(window == table_.InnerWindow) - IM_ASSERT(table_.IsInsideRow) + assert(window == table_.InnerWindow) + assert(table_.IsInsideRow) if table_.CurrentColumn ~= -1 then ImGui.TableEndCell(table_) @@ -52251,7 +52294,7 @@ function ImGui.TableEndRow(table_) local unfreeze_rows_actual = (table_.CurrentRow + 1 == table_.FreezeRowsCount) local unfreeze_rows_request = (table_.CurrentRow + 1 == table_.FreezeRowsRequest) local table_instance = (table_.InstanceCurrent == 0) and table_.InstanceDataFirst or ImGui.TableGetInstanceData(table_, table_.InstanceCurrent) -- [Luau] inline common case - if band(table_.RowFlags, ImGuiTableRowFlags.Headers) ~= 0 and (table_.CurrentRow == 0 or band(table_.LastRowFlags, ImGuiTableRowFlags.Headers) ~= 0) then + if band(table_.RowFlags, 1 --[[ImGuiTableRowFlags.Headers]]) ~= 0 and (table_.CurrentRow == 0 or band(table_.LastRowFlags, 1 --[[ImGuiTableRowFlags.Headers]]) ~= 0) then table_instance.LastTopHeadersRowHeight = table_instance.LastTopHeadersRowHeight + bg_y2 - bg_y1 end @@ -52265,20 +52308,20 @@ function ImGui.TableEndRow(table_) -- Decide of background color for the row local bg_col0 = 0 local bg_col1 = 0 - if table_.RowBgColor[0] ~= IM_COL32_DISABLE then + if table_.RowBgColor[0] ~= 16777216 --[[IM_COL32_DISABLE]] then bg_col0 = table_.RowBgColor[0] - elseif band(table_.Flags, ImGuiTableFlags.RowBg) ~= 0 then - bg_col0 = ImGui.GetColorU32((band(table_.RowBgColorCounter, 1) ~= 0) and ImGuiCol.TableRowBgAlt or ImGuiCol.TableRowBg) + elseif band(table_.Flags, 64 --[[ImGuiTableFlags.RowBg]]) ~= 0 then + bg_col0 = ImGui.GetColorU32((band(table_.RowBgColorCounter, 1) ~= 0) and 52 --[[ImGuiCol.TableRowBgAlt]] or 51 --[[ImGuiCol.TableRowBg]]) end - if table_.RowBgColor[1] ~= IM_COL32_DISABLE then + if table_.RowBgColor[1] ~= 16777216 --[[IM_COL32_DISABLE]] then bg_col1 = table_.RowBgColor[1] end -- Decide of top border color local top_border_col = 0 local border_size = TABLE_BORDER_SIZE - if table_.CurrentRow > 0 and band(table_.Flags, ImGuiTableFlags.BordersInnerH) ~= 0 then - top_border_col = (band(table_.LastRowFlags, ImGuiTableRowFlags.Headers) ~= 0) and table_.BorderColorStrong or table_.BorderColorLight + if table_.CurrentRow > 0 and band(table_.Flags, 128 --[[ImGuiTableFlags.BordersInnerH]]) ~= 0 then + top_border_col = (band(table_.LastRowFlags, 1 --[[ImGuiTableRowFlags.Headers]]) ~= 0) and table_.BorderColorStrong or table_.BorderColorLight end local draw_cell_bg_color = table_.RowCellDataCurrent >= 0 @@ -52286,7 +52329,7 @@ function ImGui.TableEndRow(table_) if bor(bg_col0, bg_col1, top_border_col) ~= 0 or draw_strong_bottom_border or draw_cell_bg_color then -- In theory we could call SetWindowClipRectBeforeSetChannel() but since we know TableEndRow() is -- always followed by a change of clipping rectangle we perform the smallest overwrite possible here. - if band(table_.Flags, ImGuiTableFlags.NoClip) == 0 then + if band(table_.Flags, 1048576 --[[ImGuiTableFlags.NoClip]]) == 0 then -- [Luau] scalar copy, no temporary ImVec4 local src, dst = table_.Bg0ClipRectForDrawCmd, window.DrawList._CmdHeader.ClipRect dst.x = src.Min.x; dst.y = src.Min.y; dst.z = src.Max.x; dst.w = src.Max.y @@ -52342,7 +52385,7 @@ function ImGui.TableEndRow(table_) -- - We need to do that in TableEndRow() instead of TableBeginRow() so the list clipper can mark -- end of row and get the new cursor position. if unfreeze_rows_request then - IM_ASSERT(table_.FreezeRowsRequest > 0) + assert(table_.FreezeRowsRequest > 0) for column_n = 0, table_.ColumnsCount - 1 do table_.Columns[column_n].NavLayerCurrent = table_.NavLayer end @@ -52350,7 +52393,7 @@ function ImGui.TableEndRow(table_) table_instance.LastFrozenHeight = y0 - table_.OuterRect.Min.y if unfreeze_rows_actual then - IM_ASSERT(table_.IsUnfrozenRows == false) + assert(table_.IsUnfrozenRows == false) table_.IsUnfrozenRows = true -- BgClipRect starts as table.InnerClipRect, reduce it now and make BgClipRectForDrawCmd == BgClipRect @@ -52358,7 +52401,7 @@ function ImGui.TableEndRow(table_) table_.BgClipRect.Min.y = min_y; table_.Bg2ClipRectForDrawCmd.Min.y = min_y table_.BgClipRect.Max.y = table_.InnerClipRect.Max.y; table_.Bg2ClipRectForDrawCmd.Max.y = table_.InnerClipRect.Max.y table_.Bg2DrawChannelCurrent = table_.Bg2DrawChannelUnfrozen - IM_ASSERT(table_.Bg2ClipRectForDrawCmd.Min.y <= table_.Bg2ClipRectForDrawCmd.Max.y) + assert(table_.Bg2ClipRectForDrawCmd.Min.y <= table_.Bg2ClipRectForDrawCmd.Max.y) local row_height = table_.RowPosY2 - table_.RowPosY1 table_.RowPosY2 = table_.WorkRect.Min.y + table_.RowPosY2 - table_.OuterRect.Min.y @@ -52376,7 +52419,7 @@ function ImGui.TableEndRow(table_) end end - if band(table_.RowFlags, ImGuiTableRowFlags.Headers) == 0 then + if band(table_.RowFlags, 1 --[[ImGuiTableRowFlags.Headers]]) == 0 then table_.RowBgColorCounter = table_.RowBgColorCounter + 1 end table_.IsInsideRow = false @@ -52465,7 +52508,7 @@ function ImGui.TableBeginCell(table_, column_n) -- Start position is roughly ~~ CellRect.Min + CellPadding + Indent local start_x = column.WorkMinX - if band(column.Flags, ImGuiTableColumnFlags.IndentEnable) ~= 0 then + if band(column.Flags, 65536 --[[ImGuiTableColumnFlags.IndentEnable]]) ~= 0 then start_x = start_x + table_.RowIndentOffsetX -- ~~ += window.DC.Indent.x - table.HostIndentX, except we locked it for the row. end @@ -52495,7 +52538,7 @@ function ImGui.TableBeginCell(table_, column_n) -- Also see TablePushColumnChannel() -- [Luau] inline the SetCurrentChannel() early-out (same channel) to skip the method call local splitter = table_.DrawSplitter - if band(table_.Flags, ImGuiTableFlags.NoClip) ~= 0 then + if band(table_.Flags, 1048576 --[[ImGuiTableFlags.NoClip]]) ~= 0 then -- FIXME: if we end up drawing all borders/bg in EndTable, could remove this and just assert that channel hasn't changed. if splitter._Current ~= TABLE_DRAW_CHANNEL_NOCLIP then splitter:SetCurrentChannel(window.DrawList, TABLE_DRAW_CHANNEL_NOCLIP) @@ -52513,7 +52556,7 @@ function ImGui.TableBeginCell(table_, column_n) -- Logging if g.LogEnabled and not column.IsSkipItems then ImGui.LogRenderedText(window.DC.CursorPos, "|") - g.LogLinePosY = FLT_MAX + g.LogLinePosY = 3.4028234663853e+38 --[[FLT_MAX]] end end @@ -52531,7 +52574,7 @@ function ImGui.TableEndCell(table_) -- Report maximum position so we can infer content size per column. local cursor_max_pos = dc.CursorMaxPos local x = cursor_max_pos.x - if band(table_.RowFlags, ImGuiTableRowFlags.Headers) ~= 0 then + if band(table_.RowFlags, 1 --[[ImGuiTableRowFlags.Headers]]) ~= 0 then column.ContentMaxXHeadersUsed = mathMax(column.ContentMaxXHeadersUsed, x) -- Useful in case user submit contents in header row that is not a TableHeader() call elseif table_.IsUnfrozenRows then column.ContentMaxXUnfrozen = mathMax(column.ContentMaxXUnfrozen, x) @@ -52564,16 +52607,16 @@ end -- Maximum column content width given current layout. Use column.MinX so this value differs on a per-column basis. function ImGui.TableCalcMaxColumnWidth(table_, column_n) local column = table_.Columns[column_n] - local max_width = FLT_MAX + local max_width = 3.4028234663853e+38 --[[FLT_MAX]] local min_column_distance = table_.MinColumnWidth + table_.CellPaddingX * 2.0 + table_.CellSpacingX1 + table_.CellSpacingX2 - if band(table_.Flags, ImGuiTableFlags.ScrollX) ~= 0 then + if band(table_.Flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) ~= 0 then -- Frozen columns can't reach beyond visible width else scrolling will naturally break. -- (we use DisplayOrder as within a set of multiple frozen column reordering is possible) if column.DisplayOrder < table_.FreezeColumnsRequest then max_width = (table_.InnerClipRect.Max.x - (table_.FreezeColumnsRequest - column.DisplayOrder) * min_column_distance) - column.MinX max_width = max_width - table_.OuterPaddingX - table_.CellPaddingX - table_.CellSpacingX2 end - elseif band(table_.Flags, ImGuiTableFlags.NoKeepColumnsVisible) == 0 then + elseif band(table_.Flags, 262144 --[[ImGuiTableFlags.NoKeepColumnsVisible]]) == 0 then -- If horizontal scrolling if disabled, we apply a final lossless shrinking of columns in order to make -- sure they are all visible. Because of this we also know that all of the columns will always fit in -- table.WorkRect and therefore in table.InnerRect (because ScrollX is off) @@ -52593,13 +52636,13 @@ function ImGui.TableGetColumnWidthAuto(table_, column) local content_width_body = mathMax(column.ContentMaxXFrozen, column.ContentMaxXUnfrozen) - column.WorkMinX local content_width_headers = column.ContentMaxXHeadersIdeal - column.WorkMinX local width_auto = content_width_body - if band(column.Flags, ImGuiTableColumnFlags.NoHeaderWidth) == 0 then + if band(column.Flags, 8192 --[[ImGuiTableColumnFlags.NoHeaderWidth]]) == 0 then width_auto = mathMax(width_auto, content_width_headers) end -- Non-resizable fixed columns preserve their requested width - if band(column.Flags, ImGuiTableColumnFlags.WidthFixed) ~= 0 and column.InitStretchWeightOrWidth > 0.0 then - if band(table_.Flags, ImGuiTableFlags.Resizable) == 0 or band(column.Flags, ImGuiTableColumnFlags.NoResize) ~= 0 then + if band(column.Flags, 16 --[[ImGuiTableColumnFlags.WidthFixed]]) ~= 0 and column.InitStretchWeightOrWidth > 0.0 then + if band(table_.Flags, 1 --[[ImGuiTableFlags.Resizable]]) == 0 or band(column.Flags, 32 --[[ImGuiTableColumnFlags.NoResize]]) ~= 0 then width_auto = column.InitStretchWeightOrWidth end end @@ -52611,14 +52654,14 @@ end function ImGui.TableSetColumnWidth(column_n, width) local g = GImGui local table_ = g.CurrentTable - IM_ASSERT(table_ ~= nil and table_.IsLayoutLocked == false) - IM_ASSERT(column_n >= 0 and column_n < table_.ColumnsCount) + assert(table_ ~= nil and table_.IsLayoutLocked == false) + assert(column_n >= 0 and column_n < table_.ColumnsCount) local column_0 = table_.Columns[column_n] local column_0_width = width -- Apply constraints early -- Compare both requested and actual given width to avoid overwriting requested width when column is stuck (minimum size, bounded) - IM_ASSERT(table_.MinColumnWidth > 0.0) + assert(table_.MinColumnWidth > 0.0) local min_width = table_.MinColumnWidth local max_width = mathMax(min_width, column_0.WidthMax) -- Don't use TableCalcMaxColumnWidth() here as it would rely on MinX from last instance (#7933) column_0_width = ImClamp(column_0_width, min_width, max_width) @@ -52663,7 +52706,7 @@ function ImGui.TableSetColumnWidth(column_n, width) -- If we have all Fixed columns OR resizing a Fixed column that doesn't come after a Stretch one, we can do an offsetting resize. -- This is the preferred resize path - if band(column_0.Flags, ImGuiTableColumnFlags.WidthFixed) ~= 0 then + if band(column_0.Flags, 16 --[[ImGuiTableColumnFlags.WidthFixed]]) ~= 0 then if not column_1 or table_.LeftMostStretchedColumn == -1 or table_.Columns[table_.LeftMostStretchedColumn].DisplayOrder >= column_0.DisplayOrder then column_0.WidthRequest = column_0_width table_.IsSettingsDirty = true @@ -52683,10 +52726,10 @@ function ImGui.TableSetColumnWidth(column_n, width) -- (old_a + old_b == new_a + new_b) --> (new_a == old_a + old_b - new_b) local column_1_width = mathMax(column_1.WidthRequest - (column_0_width - column_0.WidthRequest), min_width) column_0_width = column_0.WidthRequest + column_1.WidthRequest - column_1_width - IM_ASSERT(column_0_width > 0.0 and column_1_width > 0.0) + assert(column_0_width > 0.0 and column_1_width > 0.0) column_0.WidthRequest = column_0_width column_1.WidthRequest = column_1_width - if band(bor(column_0.Flags, column_1.Flags), ImGuiTableColumnFlags.WidthStretch) ~= 0 then + if band(bor(column_0.Flags, column_1.Flags), 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0 then ImGui.TableUpdateColumnsWeightFromWidth(table_) end table_.IsSettingsDirty = true @@ -52707,7 +52750,7 @@ end function ImGui.TableSetColumnWidthAutoAll(table_) for column_n = 0, table_.ColumnsCount - 1 do local column = table_.Columns[column_n] - if column.IsEnabled or band(column.Flags, ImGuiTableColumnFlags.WidthStretch) ~= 0 then -- Cannot reset weight of hidden stretch column + if column.IsEnabled or band(column.Flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0 then -- Cannot reset weight of hidden stretch column column.CannotSkipItemsQueue = lshift(1, 0) column.AutoFitQueue = lshift(1, 1) end @@ -52715,27 +52758,27 @@ function ImGui.TableSetColumnWidthAutoAll(table_) end function ImGui.TableUpdateColumnsWeightFromWidth(table_) - IM_ASSERT(table_.LeftMostStretchedColumn ~= -1 and table_.RightMostStretchedColumn ~= -1) + assert(table_.LeftMostStretchedColumn ~= -1 and table_.RightMostStretchedColumn ~= -1) -- Measure existing quantities local visible_weight = 0.0 local visible_width = 0.0 for column_n = 0, table_.ColumnsCount - 1 do local column = table_.Columns[column_n] - if column.IsEnabled and band(column.Flags, ImGuiTableColumnFlags.WidthStretch) ~= 0 then - IM_ASSERT(column.StretchWeight > 0.0) + if column.IsEnabled and band(column.Flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0 then + assert(column.StretchWeight > 0.0) visible_weight = visible_weight + column.StretchWeight visible_width = visible_width + column.WidthRequest end end - IM_ASSERT(visible_weight > 0.0 and visible_width > 0.0) + assert(visible_weight > 0.0 and visible_width > 0.0) -- Apply new weights for column_n = 0, table_.ColumnsCount - 1 do local column = table_.Columns[column_n] - if column.IsEnabled and band(column.Flags, ImGuiTableColumnFlags.WidthStretch) ~= 0 then + if column.IsEnabled and band(column.Flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0 then column.StretchWeight = (column.WidthRequest / visible_width) * visible_weight - IM_ASSERT(column.StretchWeight > 0.0) + assert(column.StretchWeight > 0.0) end end end @@ -52785,7 +52828,7 @@ function ImGui.TablePushColumnChannel(column_n) local table_ = g.CurrentTable -- Optimization: avoid SetCurrentChannel() + PushClipRect() - if band(table_.Flags, ImGuiTableFlags.NoClip) ~= 0 then + if band(table_.Flags, 1048576 --[[ImGuiTableFlags.NoClip]]) ~= 0 then return end local window = g.CurrentWindow @@ -52799,7 +52842,7 @@ function ImGui.TablePopColumnChannel() local table_ = g.CurrentTable -- Optimization: avoid PopClipRect() + SetCurrentChannel() - if band(table_.Flags, ImGuiTableFlags.NoClip) ~= 0 or (table_.CurrentColumn == -1) then -- Calling TreePop() after TableNextRow() is supported. + if band(table_.Flags, 1048576 --[[ImGuiTableFlags.NoClip]]) ~= 0 or (table_.CurrentColumn == -1) then -- Calling TreePop() after TableNextRow() is supported. return end local window = g.CurrentWindow @@ -52826,7 +52869,7 @@ end -- Where D is 1 if any column is clipped or hidden (dummy channel) otherwise 0. function ImGui.TableSetupDrawChannels(table_) local freeze_row_multiplier = (table_.FreezeRowsCount > 0) and 2 or 1 - local channels_for_row = (band(table_.Flags, ImGuiTableFlags.NoClip) ~= 0) and 1 or table_.ColumnsEnabledCount + local channels_for_row = (band(table_.Flags, 1048576 --[[ImGuiTableFlags.NoClip]]) ~= 0) and 1 or table_.ColumnsEnabledCount local channels_for_bg = 1 + 1 * freeze_row_multiplier local masks_differ = false for n = 0, table_.ColumnsCount - 1 do @@ -52848,7 +52891,7 @@ function ImGui.TableSetupDrawChannels(table_) if column.IsVisibleX and column.IsVisibleY then column.DrawChannelFrozen = draw_channel_current column.DrawChannelUnfrozen = draw_channel_current + ((table_.FreezeRowsCount > 0) and (channels_for_row + 1) or 0) - if band(table_.Flags, ImGuiTableFlags.NoClip) == 0 then + if band(table_.Flags, 1048576 --[[ImGuiTableFlags.NoClip]]) == 0 then draw_channel_current = draw_channel_current + 1 end else @@ -52864,7 +52907,7 @@ function ImGui.TableSetupDrawChannels(table_) ImRect_Copy(table_.BgClipRect, table_.InnerClipRect) ImRect_Copy(table_.Bg0ClipRectForDrawCmd, table_.OuterWindow.ClipRect) ImRect_Copy(table_.Bg2ClipRectForDrawCmd, table_.HostClipRect) - IM_ASSERT(table_.BgClipRect.Min.y <= table_.BgClipRect.Max.y) + assert(table_.BgClipRect.Min.y <= table_.BgClipRect.Max.y) end -- This function reorder draw channels based on matching clip rectangle, to facilitate merging them. Called by EndTable(). @@ -52908,7 +52951,7 @@ function ImGui.TableMergeDrawChannels(table_) local channels = splitter._Channels.Data local has_freeze_v = (table_.FreezeRowsCount > 0) local has_freeze_h = (table_.FreezeColumnsCount > 0) - IM_ASSERT(splitter._Current == 0) + assert(splitter._Current == 0) -- Track which groups we are going to attempt to merge, and which channels goes into each group. local merge_group_mask = 0x00 @@ -52947,7 +52990,7 @@ function ImGui.TableMergeDrawChannels(table_) -- Find out the width of this merge group and check if it will fit in our column -- (note that we assume that rendering didn't stray on the left direction. we should need a CursorMinPos to detect it) - if band(column.Flags, ImGuiTableColumnFlags.NoClip) == 0 then + if band(column.Flags, 256 --[[ImGuiTableColumnFlags.NoClip]]) == 0 then local content_max_x if not has_freeze_v then content_max_x = mathMax(column.ContentMaxXUnfrozen, column.ContentMaxXHeadersUsed) -- No row freeze @@ -52962,11 +53005,11 @@ function ImGui.TableMergeDrawChannels(table_) end local merge_group_n = ((has_freeze_h and column_n < table_.FreezeColumnsCount) and 0 or 1) + ((has_freeze_v and merge_group_sub_n == 0) and 0 or 2) - IM_ASSERT(channel_no < max_draw_channels) + assert(channel_no < max_draw_channels) local merge_group = merge_groups[merge_group_n] if merge_group.ChannelsCount == 0 then local gcr = merge_group.ClipRect -- [Luau] in place (merge_groups are local to this call) - gcr.Min.x = FLT_MAX; gcr.Min.y = FLT_MAX; gcr.Max.x = -FLT_MAX; gcr.Max.y = -FLT_MAX + gcr.Min.x = 3.4028234663853e+38 --[[FLT_MAX]]; gcr.Min.y = 3.4028234663853e+38 --[[FLT_MAX]]; gcr.Max.x = -3.4028234663853e+38 --[[FLT_MAX]]; gcr.Max.y = -3.4028234663853e+38 --[[FLT_MAX]] end merge_group.ChannelsMask[channel_no] = true merge_group.ChannelsCount = merge_group.ChannelsCount + 1 @@ -52997,7 +53040,7 @@ function ImGui.TableMergeDrawChannels(table_) remaining_mask[n] = true end remaining_mask[table_.Bg2DrawChannelUnfrozen] = nil - IM_ASSERT(has_freeze_v == false or table_.Bg2DrawChannelUnfrozen ~= TABLE_DRAW_CHANNEL_BG2_FROZEN) + assert(has_freeze_v == false or table_.Bg2DrawChannelUnfrozen ~= TABLE_DRAW_CHANNEL_BG2_FROZEN) local remaining_count = splitter._Count - (has_freeze_v and (LEADING_DRAW_CHANNELS + 1) or LEADING_DRAW_CHANNELS) --local host_rect = (table.InnerWindow == table.OuterWindow) and table.InnerClipRect or table.HostClipRect local host_rect = table_.HostClipRect @@ -53023,7 +53066,7 @@ function ImGui.TableMergeDrawChannels(table_) if band(merge_group_n, 1) ~= 0 then merge_clip_rect.Max.x = mathMax(merge_clip_rect.Max.x, host_rect.Max.x) end - if band(merge_group_n, 2) ~= 0 and band(table_.Flags, ImGuiTableFlags.NoHostExtendY) == 0 then + if band(merge_group_n, 2) ~= 0 and band(table_.Flags, 131072 --[[ImGuiTableFlags.NoHostExtendY]]) == 0 then merge_clip_rect.Max.y = mathMax(merge_clip_rect.Max.y, host_rect.Max.y) end --ImGui.GetForegroundDrawList():AddRect(merge_group.ClipRect.Min, merge_group.ClipRect.Max, IM_COL32(255, 0, 0, 200), 0.0, 0, 1.0) -- [DEBUG] @@ -53041,7 +53084,7 @@ function ImGui.TableMergeDrawChannels(table_) merge_channels_count = merge_channels_count - 1 local channel = channels[n + 1] - IM_ASSERT(channel._CmdBuffer.Size == 1) + assert(channel._CmdBuffer.Size == 1) local dst = channel._CmdBuffer.Data[1].ClipRect -- [Luau] scalar copy, no temporary ImVec4 dst.x = merge_clip_rect.Min.x; dst.y = merge_clip_rect.Min.y; dst.z = merge_clip_rect.Max.x; dst.w = merge_clip_rect.Max.y dst_tmp[#dst_tmp + 1] = channel @@ -53065,7 +53108,7 @@ function ImGui.TableMergeDrawChannels(table_) end n = n + 1 end - IM_ASSERT(#dst_tmp == splitter._Count - LEADING_DRAW_CHANNELS) + assert(#dst_tmp == splitter._Count - LEADING_DRAW_CHANNELS) for i = 1, #dst_tmp do channels[LEADING_DRAW_CHANNELS + i] = dst_tmp[i] end @@ -53078,9 +53121,9 @@ local function TableGetColumnBorderCol(table_, order_n, column_n) local is_resized = (table_.ResizedColumn == column_n) and (table_.InstanceInteracted == table_.InstanceCurrent) local is_frozen_separator = (table_.FreezeColumnsCount == order_n + 1) if is_resized or is_hovered then - return ImGui.GetColorU32(is_resized and ImGuiCol.SeparatorActive or ImGuiCol.SeparatorHovered) + return ImGui.GetColorU32(is_resized and 30 --[[ImGuiCol.SeparatorActive]] or 29 --[[ImGuiCol.SeparatorHovered]]) end - if is_frozen_separator or band(table_.Flags, bor(ImGuiTableFlags.NoBordersInBody, ImGuiTableFlags.NoBordersInBodyUntilResize)) ~= 0 then + if is_frozen_separator or band(table_.Flags, bor(2048 --[[ImGuiTableFlags.NoBordersInBody]], 4096 --[[ImGuiTableFlags.NoBordersInBodyUntilResize]])) ~= 0 then return table_.BorderColorStrong end return table_.BorderColorLight @@ -53100,10 +53143,10 @@ function ImGui.TableDrawBorders(table_) -- Draw inner border and resizing feedback local table_instance = ImGui.TableGetInstanceData(table_, table_.InstanceCurrent) local border_size = TABLE_BORDER_SIZE - local draw_y1 = mathMax(table_.InnerRect.Min.y, ((table_.FreezeRowsCount >= 1) and table_.InnerRect.Min.y or table_.WorkRect.Min.y) + table_.AngledHeadersHeight) + ((band(table_.Flags, ImGuiTableFlags.BordersOuterH) ~= 0) and border_size or 0.0) + local draw_y1 = mathMax(table_.InnerRect.Min.y, ((table_.FreezeRowsCount >= 1) and table_.InnerRect.Min.y or table_.WorkRect.Min.y) + table_.AngledHeadersHeight) + ((band(table_.Flags, 256 --[[ImGuiTableFlags.BordersOuterH]]) ~= 0) and border_size or 0.0) local draw_y2_body = table_.InnerRect.Max.y local draw_y2_head = table_.IsUsingHeaders and mathMin(table_.InnerRect.Max.y, ((table_.FreezeRowsCount >= 1) and table_.InnerRect.Min.y or table_.WorkRect.Min.y) + table_instance.LastTopHeadersRowHeight) or draw_y1 - if band(table_.Flags, ImGuiTableFlags.BordersInnerV) ~= 0 then + if band(table_.Flags, 512 --[[ImGuiTableFlags.BordersInnerV]]) ~= 0 then for order_n = 0, table_.ColumnsCount - 1 do repeat if not BitTest(table_.EnabledMaskByDisplayOrder, order_n) then @@ -53114,7 +53157,7 @@ function ImGui.TableDrawBorders(table_) local column = table_.Columns[column_n] local is_hovered = (table_.HoveredColumnBorder == column_n) local is_resized = (table_.ResizedColumn == column_n) and (table_.InstanceInteracted == table_.InstanceCurrent) - local is_resizable = band(column.Flags, bor(ImGuiTableColumnFlags.NoResize, ImGuiTableColumnFlags.NoDirectResize_)) == 0 + local is_resizable = band(column.Flags, bor(32 --[[ImGuiTableColumnFlags.NoResize]], 1073741824 --[[ImGuiTableColumnFlags.NoDirectResize_]])) == 0 local is_frozen_separator = (table_.FreezeColumnsCount == order_n + 1) if column.MaxX > table_.InnerClipRect.Max.x and not is_resized then break @@ -53122,7 +53165,7 @@ function ImGui.TableDrawBorders(table_) -- Decide whether right-most column is visible if column.NextEnabledColumn == -1 and not is_resizable then - if band(table_.Flags, ImGuiTableFlags.SizingMask_) ~= ImGuiTableFlags.SizingFixedSame or band(table_.Flags, ImGuiTableFlags.NoHostExtendX) ~= 0 then + if band(table_.Flags, 57344 --[[ImGuiTableFlags.SizingMask_]]) ~= 16384 --[[ImGuiTableFlags.SizingFixedSame]] or band(table_.Flags, 65536 --[[ImGuiTableFlags.NoHostExtendX]]) ~= 0 then break end end @@ -53134,9 +53177,9 @@ function ImGui.TableDrawBorders(table_) local draw_y2 = draw_y2_head if is_frozen_separator then draw_y2 = draw_y2_body - elseif band(table_.Flags, ImGuiTableFlags.NoBordersInBodyUntilResize) ~= 0 and (is_hovered or is_resized) then + elseif band(table_.Flags, 4096 --[[ImGuiTableFlags.NoBordersInBodyUntilResize]]) ~= 0 and (is_hovered or is_resized) then draw_y2 = draw_y2_body - elseif band(table_.Flags, bor(ImGuiTableFlags.NoBordersInBodyUntilResize, ImGuiTableFlags.NoBordersInBody)) == 0 then + elseif band(table_.Flags, bor(4096 --[[ImGuiTableFlags.NoBordersInBodyUntilResize]], 2048 --[[ImGuiTableFlags.NoBordersInBody]])) == 0 then draw_y2 = draw_y2_body end if draw_y2 > draw_y1 then @@ -53148,7 +53191,7 @@ function ImGui.TableDrawBorders(table_) -- Draw outer border -- FIXME: could use AddRect or explicit VLine/HLine helper? - if band(table_.Flags, ImGuiTableFlags.BordersOuter) ~= 0 then + if band(table_.Flags, 1280 --[[ImGuiTableFlags.BordersOuter]]) ~= 0 then -- Display outer border offset by 1 which is a simple way to display it without adding an extra draw call -- (Without the offset, in outer_window it would be rendered behind cells, because child windows are above their -- parent. In inner_window, it won't reach out over scrollbars. Another weird solution would be to display part @@ -53156,19 +53199,19 @@ function ImGui.TableDrawBorders(table_) -- Either solution currently won't allow us to use a larger border size: the border would clipped. local outer_border = table_.OuterRect local outer_col = table_.BorderColorStrong - if band(table_.Flags, ImGuiTableFlags.BordersOuter) == ImGuiTableFlags.BordersOuter then + if band(table_.Flags, 1280 --[[ImGuiTableFlags.BordersOuter]]) == 1280 --[[ImGuiTableFlags.BordersOuter]] then inner_drawlist:AddRect(outer_border.Min, outer_border.Max, outer_col, 0.0, border_size) - elseif band(table_.Flags, ImGuiTableFlags.BordersOuterV) ~= 0 then + elseif band(table_.Flags, 1024 --[[ImGuiTableFlags.BordersOuterV]]) ~= 0 then inner_drawlist:AddLineV(outer_border.Min.x, outer_border.Min.y, outer_border.Max.y, outer_col, border_size) inner_drawlist:AddLineV(outer_border.Max.x - border_size, outer_border.Min.y, outer_border.Max.y, outer_col, border_size) - elseif band(table_.Flags, ImGuiTableFlags.BordersOuterH) ~= 0 then + elseif band(table_.Flags, 256 --[[ImGuiTableFlags.BordersOuterH]]) ~= 0 then inner_drawlist:AddLineH(outer_border.Min.x, outer_border.Max.x, outer_border.Min.y, outer_col, border_size) inner_drawlist:AddLineH(outer_border.Min.x, outer_border.Max.x, outer_border.Max.y - border_size, outer_col, border_size) end end - if band(table_.Flags, ImGuiTableFlags.BordersInnerH) ~= 0 and table_.RowPosY2 < table_.OuterRect.Max.y then + if band(table_.Flags, 128 --[[ImGuiTableFlags.BordersInnerH]]) ~= 0 and table_.RowPosY2 < table_.OuterRect.Max.y then -- Draw bottom-most row border between it is above outer border. - local h_inset = (band(table_.Flags, ImGuiTableFlags.BordersOuterV) ~= 0) and border_size or 0.0 + local h_inset = (band(table_.Flags, 1024 --[[ImGuiTableFlags.BordersOuterV]]) ~= 0) and border_size or 0.0 local border_y = table_.RowPosY2 if border_y >= table_.BgClipRect.Min.y and border_y < table_.BgClipRect.Max.y then inner_drawlist:AddLineH(table_.BorderX1 + h_inset, table_.BorderX2 - h_inset, border_y, table_.BorderColorLight, border_size) @@ -53198,7 +53241,7 @@ end function ImGui.TableGetSortSpecs() local g = GImGui local table_ = g.CurrentTable - if table_ == nil or band(table_.Flags, ImGuiTableFlags.Sortable) == 0 then + if table_ == nil or band(table_.Flags, 8 --[[ImGuiTableFlags.Sortable]]) == 0 then return nil end @@ -53212,7 +53255,7 @@ function ImGui.TableGetSortSpecs() end local function TableGetColumnAvailSortDirection(column, n) - IM_ASSERT(n < column.SortDirectionsAvailCount) + assert(n < column.SortDirectionsAvailCount) return band(rshift(column.SortDirectionsAvailList, lshift(n, 1)), 0x03) end @@ -53229,7 +53272,7 @@ end -- - If the PreferSortDescending flag is set, we will default to a Descending direction on the first click. -- - Note that the PreferSortAscending flag is never checked, it is essentially the default and therefore a no-op. function ImGui.TableGetColumnNextSortDirection(column) - IM_ASSERT(column.SortDirectionsAvailCount > 0) + assert(column.SortDirectionsAvailCount > 0) if column.SortOrder == -1 then return TableGetColumnAvailSortDirection(column, 0) end @@ -53238,8 +53281,8 @@ function ImGui.TableGetColumnNextSortDirection(column) return TableGetColumnAvailSortDirection(column, (n + 1) % column.SortDirectionsAvailCount) end end - IM_ASSERT(false) - return ImGuiSortDirection.None + assert(false) + return 0 --[[ImGuiSortDirection.None]] end -- Note that the NoSortAscending/NoSortDescending flags are processed in TableSortSpecsSanitize(), and they may change/revert @@ -53248,11 +53291,11 @@ function ImGui.TableSetColumnSortDirection(column_n, sort_direction, append_to_s local g = GImGui local table_ = g.CurrentTable - if band(table_.Flags, ImGuiTableFlags.SortMulti) == 0 then + if band(table_.Flags, 67108864 --[[ImGuiTableFlags.SortMulti]]) == 0 then append_to_sort_specs = false end - if band(table_.Flags, ImGuiTableFlags.SortTristate) == 0 then - IM_ASSERT(sort_direction ~= ImGuiSortDirection.None) + if band(table_.Flags, 134217728 --[[ImGuiTableFlags.SortTristate]]) == 0 then + assert(sort_direction ~= 0 --[[ImGuiSortDirection.None]]) end local sort_order_max = 0 @@ -53264,7 +53307,7 @@ function ImGui.TableSetColumnSortDirection(column_n, sort_direction, append_to_s local column = table_.Columns[column_n] column.SortDirection = sort_direction - if column.SortDirection == ImGuiSortDirection.None then + if column.SortDirection == 0 --[[ImGuiSortDirection.None]] then column.SortOrder = -1 elseif column.SortOrder == -1 or not append_to_sort_specs then column.SortOrder = append_to_sort_specs and (sort_order_max + 1) or 0 @@ -53282,7 +53325,7 @@ function ImGui.TableSetColumnSortDirection(column_n, sort_direction, append_to_s end function ImGui.TableSortSpecsSanitize(table_) - IM_ASSERT(band(table_.Flags, ImGuiTableFlags.Sortable) ~= 0) + assert(band(table_.Flags, 8 --[[ImGuiTableFlags.Sortable]]) ~= 0) -- Clear SortOrder from hidden column and verify that there's no gap or duplicate. local sort_order_count = 0 @@ -53297,7 +53340,7 @@ function ImGui.TableSortSpecsSanitize(table_) sort_order_count = sort_order_count + 1 if sort_order_set[column.SortOrder] then sort_order_dup = true end sort_order_set[column.SortOrder] = true - IM_ASSERT(sort_order_count < 64) + assert(sort_order_count < 64) end end @@ -53306,7 +53349,7 @@ function ImGui.TableSortSpecsSanitize(table_) for n = 0, sort_order_count - 1 do if not sort_order_set[n] then need_fix_linearize = true end end - local need_fix_single_sort_order = (sort_order_count > 1) and band(table_.Flags, ImGuiTableFlags.SortMulti) == 0 + local need_fix_single_sort_order = (sort_order_count > 1) and band(table_.Flags, 67108864 --[[ImGuiTableFlags.SortMulti]]) == 0 if need_fix_linearize or need_fix_single_sort_order then local fixed_mask = {} for sort_n = 0, sort_order_count - 1 do @@ -53320,7 +53363,7 @@ function ImGui.TableSortSpecsSanitize(table_) end end end - IM_ASSERT(column_with_smallest_sort_order ~= -1) + assert(column_with_smallest_sort_order ~= -1) fixed_mask[column_with_smallest_sort_order] = true table_.Columns[column_with_smallest_sort_order].SortOrder = sort_n @@ -53338,10 +53381,10 @@ function ImGui.TableSortSpecsSanitize(table_) end -- Fallback default sort order (if no column with the ImGuiTableColumnFlags.DefaultSort flag) - if sort_order_count == 0 and band(table_.Flags, ImGuiTableFlags.SortTristate) == 0 then + if sort_order_count == 0 and band(table_.Flags, 134217728 --[[ImGuiTableFlags.SortTristate]]) == 0 then for column_n = 0, table_.ColumnsCount - 1 do local column = table_.Columns[column_n] - if column.IsEnabled and band(column.Flags, ImGuiTableColumnFlags.NoSort) == 0 then + if column.IsEnabled and band(column.Flags, 512 --[[ImGuiTableColumnFlags.NoSort]]) == 0 then sort_order_count = 1 column.SortOrder = 0 column.SortDirection = TableGetColumnAvailSortDirection(column, 0) @@ -53380,7 +53423,7 @@ function ImGui.TableSortSpecsBuild(table_) for column_n = 0, table_.ColumnsCount - 1 do local column = table_.Columns[column_n] if column.SortOrder ~= -1 then - IM_ASSERT(column.SortOrder < table_.SortSpecsCount) + assert(column.SortOrder < table_.SortSpecsCount) local sort_spec = sort_specs[column.SortOrder + 1] sort_spec.ColumnUserID = column.UserData sort_spec.ColumnIndex = column_n @@ -53415,7 +53458,7 @@ function ImGui.TableGetHeaderRowHeight() local row_height = g.FontSize for column_n = 0, table_.ColumnsCount - 1 do if BitTest(table_.EnabledMaskByIndex, column_n) then - if band(table_.Columns[column_n].Flags, ImGuiTableColumnFlags.NoHeaderLabel) == 0 then + if band(table_.Columns[column_n].Flags, 4096 --[[ImGuiTableColumnFlags.NoHeaderLabel]]) == 0 then row_height = mathMax(row_height, ImGui.CalcTextSize(ImGui.TableGetColumnName(table_, column_n)).y) end end @@ -53429,7 +53472,7 @@ function ImGui.TableGetHeaderAngledMaxLabelWidth() local width = 0.0 for column_n = 0, table_.ColumnsCount - 1 do if BitTest(table_.EnabledMaskByIndex, column_n) then - if band(table_.Columns[column_n].Flags, ImGuiTableColumnFlags.AngledHeader) ~= 0 then + if band(table_.Columns[column_n].Flags, 262144 --[[ImGuiTableColumnFlags.AngledHeader]]) ~= 0 then width = mathMax(width, ImGui.CalcTextSize(ImGui.TableGetColumnName(table_, column_n), nil, true).x) end end @@ -53457,7 +53500,7 @@ function ImGui.TableHeadersRow() -- Open row local row_height = ImGui.TableGetHeaderRowHeight() - ImGui.TableNextRow(ImGuiTableRowFlags.Headers, row_height) + ImGui.TableNextRow(1 --[[ImGuiTableRowFlags.Headers]], row_height) local row_y1 = ImGui.GetCursorScreenPos().y if table_.HostSkipItems then -- Merely an optimization, you may skip in your own code. return @@ -53467,7 +53510,7 @@ function ImGui.TableHeadersRow() for column_n = 0, columns_count - 1 do if ImGui.TableSetColumnIndex(column_n) or table_.LastHeldHeaderColumn == column_n then -- Push an id to allow empty/unnamed headers. This is also idiomatic as it ensure there is a consistent ID path to access columns (for e.g. automation) - local name = (band(ImGui.TableGetColumnFlags(column_n), ImGuiTableColumnFlags.NoHeaderLabel) ~= 0) and "" or ImGui.TableGetColumnName(column_n) + local name = (band(ImGui.TableGetColumnFlags(column_n), 4096 --[[ImGuiTableColumnFlags.NoHeaderLabel]]) ~= 0) and "" or ImGui.TableGetColumnName(column_n) ImGui.PushID(column_n) ImGui.TableHeader(name) ImGui.PopID() @@ -53495,7 +53538,7 @@ function ImGui.TableHeader(label) local table_ = g.CurrentTable IM_ASSERT_USER_ERROR_RET(table_ ~= nil, "Call should only be done while in BeginTable() scope!") - IM_ASSERT(table_.CurrentColumn ~= -1) + assert(table_.CurrentColumn ~= -1) local column_n = table_.CurrentColumn local column = table_.Columns[column_n] @@ -53521,7 +53564,7 @@ function ImGui.TableHeader(label) local sort_arrow = false local sort_order_suf = "" local ARROW_SCALE = 0.65 - if band(table_.Flags, ImGuiTableFlags.Sortable) ~= 0 and band(column.Flags, ImGuiTableColumnFlags.NoSort) == 0 then + if band(table_.Flags, 8 --[[ImGuiTableFlags.Sortable]]) ~= 0 and band(column.Flags, 512 --[[ImGuiTableColumnFlags.NoSort]]) == 0 then w_arrow = ImTrunc(g.FontSize * ARROW_SCALE + g.Style.FramePadding.x) if column.SortOrder ~= -1 then sort_arrow = true @@ -53550,18 +53593,18 @@ function ImGui.TableHeader(label) -- Using AllowOverlap mode because we cover the whole cell, and we want user to be able to submit subsequent items. local highlight = (table_.HighlightColumnHeader == column_n) - local pressed, hovered, held = ImGui.ButtonBehavior(bb, id, ImGuiButtonFlags.AllowOverlap) + local pressed, hovered, held = ImGui.ButtonBehavior(bb, id, 4096 --[[ImGuiButtonFlags.AllowOverlap]]) if held or hovered or highlight then - local col = ImGui.GetColorU32(held and ImGuiCol.HeaderActive or (hovered and ImGuiCol.HeaderHovered or ImGuiCol.Header)) + local col = ImGui.GetColorU32(held and 27 --[[ImGuiCol.HeaderActive]] or (hovered and 26 --[[ImGuiCol.HeaderHovered]] or 25 --[[ImGuiCol.Header]])) --RenderFrame(bb.Min, bb.Max, col, false, 0.0) - ImGui.TableSetBgColor(ImGuiTableBgTarget.CellBg, col, table_.CurrentColumn) + ImGui.TableSetBgColor(3 --[[ImGuiTableBgTarget.CellBg]], col, table_.CurrentColumn) else -- Submit single cell bg color in the case we didn't submit a full header row - if band(table_.RowFlags, ImGuiTableRowFlags.Headers) == 0 then - ImGui.TableSetBgColor(ImGuiTableBgTarget.CellBg, ImGui.GetColorU32(ImGuiCol.TableHeaderBg), table_.CurrentColumn) + if band(table_.RowFlags, 1 --[[ImGuiTableRowFlags.Headers]]) == 0 then + ImGui.TableSetBgColor(3 --[[ImGuiTableBgTarget.CellBg]], ImGui.GetColorU32(48 --[[ImGuiCol.TableHeaderBg]]), table_.CurrentColumn) end end - ImGui.RenderNavCursor(bb, id, ImGuiNavRenderCursorFlags.Compact, 0.0) + ImGui.RenderNavCursor(bb, id, 2 --[[ImGuiNavRenderCursorFlags.Compact]], 0.0) if held then table_.HeldHeaderColumn = column_n end @@ -53569,7 +53612,7 @@ function ImGui.TableHeader(label) -- Drag and drop to re-order columns. -- FIXME-TABLE: Scroll request while reordering a column and it lands out of the scrolling zone. - if held and band(table_.Flags, ImGuiTableFlags.Reorderable) ~= 0 and ImGui.IsMouseDragging(0) and not g.DragDropActive then + if held and band(table_.Flags, 2 --[[ImGuiTableFlags.Reorderable]]) ~= 0 and ImGui.IsMouseDragging(0) and not g.DragDropActive then -- - While moving a column it will jump on the other side of the mouse, so we also test for MouseDelta.x -- - We need to handle reordering across hidden columns. -- In the configuration below, moving C to the right of E will lead to: @@ -53595,17 +53638,17 @@ function ImGui.TableHeader(label) -- - Only clip label for a visible arrow. Auto-fit still accounts for a possible arrow, but when -- manually sized smaller we don't clip the label for the sake of an arrow that isn't displayed. local ellipsis_max = mathMax(cell_x2 - (sort_arrow and (w_arrow + w_sort_text) or 0.0), label_pos.x) - if band(table_.Flags, ImGuiTableFlags.Sortable) ~= 0 and band(column.Flags, ImGuiTableColumnFlags.NoSort) == 0 then + if band(table_.Flags, 8 --[[ImGuiTableFlags.Sortable]]) ~= 0 and band(column.Flags, 512 --[[ImGuiTableColumnFlags.NoSort]]) == 0 then if column.SortOrder ~= -1 then local x = mathMax(cell_x1, cell_x2 - w_arrow - w_sort_text) local y = label_pos.y if column.SortOrder > 0 then - ImGui.PushStyleColor(ImGuiCol.Text, ImGui.GetColorU32(ImGuiCol.Text, 0.70)) + ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], ImGui.GetColorU32(0 --[[ImGuiCol.Text]], 0.70)) ImGui.RenderText(ImVec2(x + g.Style.ItemInnerSpacing.x, y), sort_order_suf) ImGui.PopStyleColor() x = x + w_sort_text end - ImGui.RenderArrow(window.DrawList, ImVec2(x, y), ImGui.GetColorU32(ImGuiCol.Text), (column.SortDirection == ImGuiSortDirection.Ascending) and ImGuiDir.Up or ImGuiDir.Down, ARROW_SCALE) + ImGui.RenderArrow(window.DrawList, ImVec2(x, y), ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), (column.SortDirection == 1 --[[ImGuiSortDirection.Ascending]]) and 2 --[[ImGuiDir.Up]] or 3 --[[ImGuiDir.Down]], ARROW_SCALE) end -- Handle clicking on column header to adjust Sort Order @@ -53626,7 +53669,7 @@ function ImGui.TableHeader(label) end -- We don't use BeginPopupContextItem() because we want the popup to stay up even after the column is hidden - if ImGui.IsPopupOpenRequestForItem(ImGuiPopupFlags.None, id) then + if ImGui.IsPopupOpenRequestForItem(0 --[[ImGuiPopupFlags.None]], id) then ImGui.TableOpenContextMenu(column_n) end end @@ -53650,14 +53693,14 @@ function ImGui.TableAngledHeadersRow() end -- Build up request - local col_header_bg = ImGui.GetColorU32(ImGuiCol.TableHeaderBg) - local col_text = ImGui.GetColorU32(ImGuiCol.Text) + local col_header_bg = ImGui.GetColorU32(48 --[[ImGuiCol.TableHeaderBg]]) + local col_text = ImGui.GetColorU32(0 --[[ImGuiCol.Text]]) for order_n = 0, table_.ColumnsCount - 1 do if BitTest(table_.EnabledMaskByDisplayOrder, order_n) then local column_n = table_.DisplayOrderToIndex[order_n] local column = table_.Columns[column_n] - if band(column.Flags, ImGuiTableColumnFlags.AngledHeader) ~= 0 then -- Note: can't rely on ImGuiTableColumnFlags.IsVisible test here. - temp_data.AngledHeadersRequests:push_back({ Index = column_n, TextColor = col_text, BgColor0 = col_header_bg, BgColor1 = (column_n == highlight_column_n) and ImGui.GetColorU32(ImGuiCol.Header) or 0 }) + if band(column.Flags, 262144 --[[ImGuiTableColumnFlags.AngledHeader]]) ~= 0 then -- Note: can't rely on ImGuiTableColumnFlags.IsVisible test here. + temp_data.AngledHeadersRequests:push_back({ Index = column_n, TextColor = col_text, BgColor0 = col_header_bg, BgColor1 = (column_n == highlight_column_n) and ImGui.GetColorU32(25 --[[ImGuiCol.Header]]) or 0 }) end end end @@ -53686,7 +53729,7 @@ function ImGui.TableAngledHeadersRowEx(row_id, angle, max_label_width, data, dat local window = g.CurrentWindow local draw_list = window.DrawList IM_ASSERT_USER_ERROR_RET(table_ ~= nil, "Call should only be done while in BeginTable() scope!") - IM_ASSERT(table_.CurrentRow == -1, "Must be first row") + assert(table_.CurrentRow == -1, "Must be first row") if max_label_width == 0.0 then max_label_width = ImGui.TableGetHeaderAngledMaxLabelWidth() @@ -53694,11 +53737,11 @@ function ImGui.TableAngledHeadersRowEx(row_id, angle, max_label_width, data, dat -- Angle argument expressed in (-IM_PI/2 .. +IM_PI/2) as it is easier to think about for user. local flip_label = (angle < 0.0) - angle = angle - IM_PI * 0.5 + angle = angle - 3.141592653589793 --[[IM_PI]] * 0.5 local cos_a = ImCos(angle) local sin_a = ImSin(angle) - local label_cos_a = flip_label and ImCos(angle + IM_PI) or cos_a - local label_sin_a = flip_label and ImSin(angle + IM_PI) or sin_a + local label_cos_a = flip_label and ImCos(angle + 3.141592653589793 --[[IM_PI]]) or cos_a + local label_sin_a = flip_label and ImSin(angle + 3.141592653589793 --[[IM_PI]]) or sin_a local unit_right = ImVec2(cos_a, sin_a) -- Calculate our base metrics and set angled headers data _before_ the first call to TableNextRow() @@ -53711,7 +53754,7 @@ function ImGui.TableAngledHeadersRowEx(row_id, angle, max_label_width, data, dat -- Declare row, override and draw our own background -- FIXME-TABLE: Generally broken when overlapping frozen columns limit. - ImGui.TableNextRow(ImGuiTableRowFlags.Headers, row_height) + ImGui.TableNextRow(1 --[[ImGuiTableRowFlags.Headers]], row_height) ImGui.TableNextColumn() local row_r = ImRect(table_.WorkRect.Min.x, table_.BgClipRect.Min.y, table_.WorkRect.Max.x, table_.RowPosY2) table_.DrawSplitter:SetCurrentChannel(draw_list, TABLE_DRAW_CHANNEL_BG0) @@ -53719,9 +53762,9 @@ function ImGui.TableAngledHeadersRowEx(row_id, angle, max_label_width, data, dat if table_.FreezeColumnsCount > 0 then clip_rect_min_x = ImMax(clip_rect_min_x, table_.Columns[table_.DisplayOrderToIndex[table_.FreezeColumnsCount - 1]].MaxX) end - ImGui.TableSetBgColor(ImGuiTableBgTarget.RowBg0, 0) -- Cancel + ImGui.TableSetBgColor(1 --[[ImGuiTableBgTarget.RowBg0]], 0) -- Cancel ImGui.PushClipRect(table_.BgClipRect.Min, table_.BgClipRect.Max, false) -- Span all columns - draw_list:AddRectFilled(ImVec2(table_.BgClipRect.Min.x, row_r.Min.y), ImVec2(table_.BgClipRect.Max.x, row_r.Max.y), ImGui.GetColorU32(ImGuiCol.TableHeaderBg, 0.25)) -- FIXME-STYLE: Change row background with an arbitrary color. + draw_list:AddRectFilled(ImVec2(table_.BgClipRect.Min.x, row_r.Min.y), ImVec2(table_.BgClipRect.Max.x, row_r.Max.y), ImGui.GetColorU32(48 --[[ImGuiCol.TableHeaderBg]], 0.25)) -- FIXME-STYLE: Change row background with an arbitrary color. ImGui.PushClipRect(ImVec2(clip_rect_min_x, table_.BgClipRect.Min.y), table_.BgClipRect.Max, true) -- Span all columns ImGui.ButtonBehavior(row_r, row_id) @@ -53733,7 +53776,7 @@ function ImGui.TableAngledHeadersRowEx(row_id, angle, max_label_width, data, dat local align = g.Style.TableAngledHeadersTextAlign -- Draw background and labels in first pass, then all borders. - local max_x = -FLT_MAX + local max_x = -3.4028234663853e+38 --[[FLT_MAX]] for pass = 0, 1 do for order_n = 0, data_count - 1 do local request = data[order_n + 1] @@ -53782,7 +53825,7 @@ function ImGui.TableAngledHeadersRowEx(row_id, angle, max_label_width, data, dat local clip_height = ImMin(label_size.y, column.ClipRect.Max.x - column.WorkMinX - line_off_curr_x) local clip_r = ImRect(window.ClipRect.Min, window.ClipRect.Min + ImVec2(clip_width, clip_height)) local vtx_idx_begin = draw_list._VtxCurrentIdx - ImGui.PushStyleColor(ImGuiCol.Text, request.TextColor) + ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], request.TextColor) ImGui.RenderTextEllipsis(draw_list, clip_r.Min, clip_r.Max, clip_r.Max.x, line, #line + 1, label_size) ImGui.PopStyleColor() local vtx_idx_end = draw_list._VtxCurrentIdx @@ -53837,13 +53880,13 @@ function ImGui.TableOpenContextMenu(column_n) if column_n == table_.ColumnsCount then -- To facilitate using with TableGetHoveredColumn() column_n = -1 end - IM_ASSERT(column_n >= -1 and column_n < table_.ColumnsCount) - if band(table_.Flags, bor(ImGuiTableFlags.Resizable, ImGuiTableFlags.Reorderable, ImGuiTableFlags.Hideable)) ~= 0 then + assert(column_n >= -1 and column_n < table_.ColumnsCount) + if band(table_.Flags, bor(1 --[[ImGuiTableFlags.Resizable]], 2 --[[ImGuiTableFlags.Reorderable]], 4 --[[ImGuiTableFlags.Hideable]])) ~= 0 then table_.IsContextPopupOpen = true table_.ContextPopupColumn = column_n table_.InstanceInteracted = table_.InstanceCurrent local context_menu_id = ImHashStr("##ContextMenu", nil, table_.ID) - ImGui.OpenPopupEx(context_menu_id, ImGuiPopupFlags.None) + ImGui.OpenPopupEx(context_menu_id, 0 --[[ImGuiPopupFlags.None]]) end end @@ -53852,7 +53895,7 @@ function ImGui.TableBeginContextMenuPopup(table_) return false end local context_menu_id = ImHashStr("##ContextMenu", nil, table_.ID) - if ImGui.BeginPopupEx(context_menu_id, bor(ImGuiWindowFlags.AlwaysAutoResize, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoSavedSettings)) then + if ImGui.BeginPopupEx(context_menu_id, bor(64 --[[ImGuiWindowFlags.AlwaysAutoResize]], 1 --[[ImGuiWindowFlags.NoTitleBar]], 256 --[[ImGuiWindowFlags.NoSavedSettings]])) then return true end table_.IsContextPopupOpen = false @@ -53872,16 +53915,16 @@ local function MenuItemForColumnReorder(label, selected, enabled) local text_pos = ImVec2(window.DC.CursorPos.x, window.DC.CursorPos.y + window.DC.CurrLineTextBaseOffset) local id = ImGui.GetID(label) - local selectable_flags = bor(ImGuiSelectableFlags.SelectOnRelease, ImGuiSelectableFlags.SpanAvailWidth) + local selectable_flags = bor(8388608 --[[ImGuiSelectableFlags.SelectOnRelease]], 16777216 --[[ImGuiSelectableFlags.SpanAvailWidth]]) if g.ActiveId == id then - selectable_flags = bor(selectable_flags, ImGuiSelectableFlags.Highlight) -- Stays highlighted while dragging. + selectable_flags = bor(selectable_flags, 32 --[[ImGuiSelectableFlags.Highlight]]) -- Stays highlighted while dragging. end local has_been_moved = (g.ActiveId == id) and g.ActiveIdHasBeenEditedBefore -- But disable toggling once moved. ImGui.BeginDisabled(not enabled) -- Don't use ImGuiSelectableFlags.Disabled so that Check mark is also affected. local ret = ImGui.Selectable(label, false, selectable_flags, ImVec2(min_w, label_size.y)) and not has_been_moved -- Can't use IsMouseDragging(0) as button is released already. - if band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.Visible) ~= 0 and selected then - ImGui.RenderCheckMark(window.DrawList, text_pos + ImVec2(offsets.OffsetMark + stretch_w + g.FontSize * 0.40, g.FontSize * 0.134 * 0.5), ImGui.GetColorU32(ImGuiCol.Text), g.FontSize * 0.866) + if band(g.LastItemData.StatusFlags, 256 --[[ImGuiItemStatusFlags.Visible]]) ~= 0 and selected then + ImGui.RenderCheckMark(window.DrawList, text_pos + ImVec2(offsets.OffsetMark + stretch_w + g.FontSize * 0.40, g.FontSize * 0.134 * 0.5), ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), g.FontSize * 0.866) end ImGui.EndDisabled() @@ -53908,19 +53951,19 @@ function ImGui.TableDrawDefaultContextMenu(table_, flags_for_section_to_display) local context_column = (context_column_n ~= -1) and table_.Columns[context_column_n] or nil -- Sizing - if band(flags_for_section_to_display, ImGuiTableFlags.Resizable) ~= 0 then + if band(flags_for_section_to_display, 1 --[[ImGuiTableFlags.Resizable]]) ~= 0 then if context_column ~= nil then - local can_resize = band(context_column.Flags, ImGuiTableColumnFlags.NoResize) == 0 and context_column.IsEnabled - if ImGui.MenuItem(ImGui.LocalizeGetMsg(ImGuiLocKey.TableSizeOne), nil, false, can_resize) then -- "###SizeOne" + local can_resize = band(context_column.Flags, 32 --[[ImGuiTableColumnFlags.NoResize]]) == 0 and context_column.IsEnabled + if ImGui.MenuItem(ImGui.LocalizeGetMsg(2 --[[ImGuiLocKey.TableSizeOne]]), nil, false, can_resize) then -- "###SizeOne" ImGui.TableSetColumnWidthAutoSingle(table_, context_column_n) end end local size_all_desc - if table_.ColumnsEnabledFixedCount == table_.ColumnsEnabledCount and band(table_.Flags, ImGuiTableFlags.SizingMask_) ~= ImGuiTableFlags.SizingFixedSame then - size_all_desc = ImGui.LocalizeGetMsg(ImGuiLocKey.TableSizeAllFit) -- "###SizeAll" All fixed + if table_.ColumnsEnabledFixedCount == table_.ColumnsEnabledCount and band(table_.Flags, 57344 --[[ImGuiTableFlags.SizingMask_]]) ~= 16384 --[[ImGuiTableFlags.SizingFixedSame]] then + size_all_desc = ImGui.LocalizeGetMsg(3 --[[ImGuiLocKey.TableSizeAllFit]]) -- "###SizeAll" All fixed else - size_all_desc = ImGui.LocalizeGetMsg(ImGuiLocKey.TableSizeAllDefault) -- "###SizeAll" All stretch or mixed + size_all_desc = ImGui.LocalizeGetMsg(4 --[[ImGuiLocKey.TableSizeAllDefault]]) -- "###SizeAll" All stretch or mixed end if ImGui.MenuItem(size_all_desc, nil) then ImGui.TableSetColumnWidthAutoAll(table_) @@ -53929,18 +53972,18 @@ function ImGui.TableDrawDefaultContextMenu(table_, flags_for_section_to_display) end -- Reset Order/Visibility etc. - if band(flags_for_section_to_display, bor(ImGuiTableFlags.Reorderable, ImGuiTableFlags.Hideable)) ~= 0 then - if ImGui.BeginMenu(ImGui.LocalizeGetMsg(ImGuiLocKey.TableReset)) then + if band(flags_for_section_to_display, bor(2 --[[ImGuiTableFlags.Reorderable]], 4 --[[ImGuiTableFlags.Hideable]])) ~= 0 then + if ImGui.BeginMenu(ImGui.LocalizeGetMsg(5 --[[ImGuiLocKey.TableReset]])) then --if ImGui.MenuItem(ImGui.LocalizeGetMsg(ImGuiLocKey.TableResetAll)) then -- FIXME: Hiding because altering Sort Order + requesting auto-fit simultaneously has a tendency to exhibit a sizing glitch. -- table_.IsResetAllRequest = true --end - if band(flags_for_section_to_display, ImGuiTableFlags.Reorderable) ~= 0 then - if ImGui.MenuItem(ImGui.LocalizeGetMsg(ImGuiLocKey.TableResetOrder), nil, false, not table_.IsDefaultDisplayOrder) then -- PS: cannot be hidden because it would mess with drag reordering. + if band(flags_for_section_to_display, 2 --[[ImGuiTableFlags.Reorderable]]) ~= 0 then + if ImGui.MenuItem(ImGui.LocalizeGetMsg(6 --[[ImGuiLocKey.TableResetOrder]]), nil, false, not table_.IsDefaultDisplayOrder) then -- PS: cannot be hidden because it would mess with drag reordering. table_.IsResetDisplayOrderRequest = true end end - if band(flags_for_section_to_display, ImGuiTableFlags.Hideable) ~= 0 then - if ImGui.MenuItem(ImGui.LocalizeGetMsg(ImGuiLocKey.TableResetVisibility), nil, false, not table_.IsDefaultVisibility) then + if band(flags_for_section_to_display, 4 --[[ImGuiTableFlags.Hideable]]) ~= 0 then + if ImGui.MenuItem(ImGui.LocalizeGetMsg(7 --[[ImGuiLocKey.TableResetVisibility]]), nil, false, not table_.IsDefaultVisibility) then table_.IsResetVisibilityRequest = true end end @@ -53965,7 +54008,7 @@ function ImGui.TableDrawDefaultContextMenu(table_, flags_for_section_to_display) -- #endif -- Hiding / Visibility - if band(flags_for_section_to_display, ImGuiTableFlags.Hideable) ~= 0 then + if band(flags_for_section_to_display, 4 --[[ImGuiTableFlags.Hideable]]) ~= 0 then if want_separator then ImGui.Separator() end @@ -53977,18 +54020,18 @@ function ImGui.TableDrawDefaultContextMenu(table_, flags_for_section_to_display) local reorder_src_order = is_reordering and table_.Columns[table_.ReorderColumn].DisplayOrder or -1 local reorder_min_order = is_reordering and TableGetMaxDisplayOrderAllowed(table_, reorder_src_order, 0) or 0 local reorder_max_order = is_reordering and TableGetMaxDisplayOrderAllowed(table_, reorder_src_order, table_.ColumnsCount - 1) or (table_.ColumnsCount - 1) - ImGui.PushItemFlag(ImGuiItemFlags.AutoClosePopups, false) + ImGui.PushItemFlag(16 --[[ImGuiItemFlags.AutoClosePopups]], false) for order_n = 0, table_.ColumnsCount - 1 do local column_n = table_.DisplayOrderToIndex[order_n] local column = table_.Columns[column_n] - if band(column.Flags, ImGuiTableColumnFlags.Disabled) == 0 then + if band(column.Flags, 1 --[[ImGuiTableColumnFlags.Disabled]]) == 0 then local name = ImGui.TableGetColumnName(table_, column_n) if name == nil or name == "" then name = "" end -- Make sure we can't hide the last active column - local menu_item_enabled = band(column.Flags, ImGuiTableColumnFlags.NoHide) == 0 + local menu_item_enabled = band(column.Flags, 128 --[[ImGuiTableColumnFlags.NoHide]]) == 0 if column.IsUserEnabled and table_.ColumnsEnabledCount <= 1 then menu_item_enabled = false end @@ -54001,7 +54044,7 @@ function ImGui.TableDrawDefaultContextMenu(table_, flags_for_section_to_display) -- Drag to reorder -- FIXME: It is currently not possible to reorder columns marked with ImGuiTableColumnFlags.NoHide. - if ImGui.IsItemActive() and ImGui.IsMouseDragging(0) and g.ActiveIdSource == ImGuiInputSource.Mouse and band(table_.Flags, ImGuiTableFlags.Reorderable) ~= 0 then + if ImGui.IsItemActive() and ImGui.IsMouseDragging(0) and g.ActiveIdSource == 1 --[[ImGuiInputSource.Mouse]] and band(table_.Flags, 2 --[[ImGuiTableFlags.Reorderable]]) ~= 0 then g.ActiveIdHasBeenEditedBefore = true -- Disable toggle in MenuItemForColumnReorder() + start dimming to display allowed reorder targets. table_.ReorderColumn = column_n if not ImGui.IsItemHovered() then @@ -54095,7 +54138,7 @@ function ImGui.TableGetBoundSettings(table_) end local g = GImGui local settings = g.SettingsTables.Data[table_.SettingsOffset] - IM_ASSERT(settings.ID == table_.ID) + assert(settings.ID == table_.ID) return settings end @@ -54104,12 +54147,12 @@ function ImGui.TableResetSettings(table_) table_.IsInitializing = true; table_.IsSettingsDirty = true table_.IsResetAllRequest = false table_.IsSettingsRequestLoad = false -- Don't reload from ini - table_.SettingsLoadedFlags = ImGuiTableFlags.None -- Mark as nothing loaded so our initialized data becomes authoritative + table_.SettingsLoadedFlags = 0 --[[ImGuiTableFlags.None]] -- Mark as nothing loaded so our initialized data becomes authoritative end function ImGui.TableSaveSettings(table_) table_.IsSettingsDirty = false - if band(table_.Flags, ImGuiTableFlags.NoSavedSettings) ~= 0 then + if band(table_.Flags, 16 --[[ImGuiTableFlags.NoSavedSettings]]) ~= 0 then return end @@ -54126,15 +54169,15 @@ function ImGui.TableSaveSettings(table_) settings.ColumnsCount = table_.ColumnsCount -- Serialize ImGuiTable/ImGuiTableColumn into ImGuiTableSettings/ImGuiTableColumnSettings - IM_ASSERT(settings.ID == table_.ID) - IM_ASSERT(settings.ColumnsCount == table_.ColumnsCount and settings.ColumnsCountMax >= settings.ColumnsCount) + assert(settings.ID == table_.ID) + assert(settings.ColumnsCount == table_.ColumnsCount and settings.ColumnsCountMax >= settings.ColumnsCount) local save_ref_scale = false - settings.SaveFlags = ImGuiTableFlags.None + settings.SaveFlags = 0 --[[ImGuiTableFlags.None]] for n = 0, table_.ColumnsCount - 1 do local column = table_.Columns[n] local column_settings = settings.Columns[n] - local width_or_weight = (band(column.Flags, ImGuiTableColumnFlags.WidthStretch) ~= 0) and column.StretchWeight or column.WidthRequest + local width_or_weight = (band(column.Flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0) and column.StretchWeight or column.WidthRequest column_settings.ID = column.ID column_settings.WidthOrWeight = width_or_weight column_settings.Index = n @@ -54142,8 +54185,8 @@ function ImGui.TableSaveSettings(table_) column_settings.SortOrder = column.SortOrder column_settings.SortDirection = column.SortDirection column_settings.IsEnabled = column.IsUserEnabled and 1 or 0 - column_settings.IsStretch = (band(column.Flags, ImGuiTableColumnFlags.WidthStretch) ~= 0) and 1 or 0 - if band(column.Flags, ImGuiTableColumnFlags.WidthStretch) == 0 then + column_settings.IsStretch = (band(column.Flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0) and 1 or 0 + if band(column.Flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) == 0 then save_ref_scale = true end @@ -54151,16 +54194,16 @@ function ImGui.TableSaveSettings(table_) -- Note that fixed width where initial width was derived from auto-fit will always be saved as InitStretchWeightOrWidth will be 0.0f. -- FIXME-TABLE: We don't have logic to easily compare SortOrder to DefaultSortOrder yet so it's always saved when present. if width_or_weight ~= column.InitStretchWeightOrWidth then - settings.SaveFlags = bor(settings.SaveFlags, ImGuiTableFlags.Resizable) + settings.SaveFlags = bor(settings.SaveFlags, 1 --[[ImGuiTableFlags.Resizable]]) end if column.DisplayOrder ~= n then - settings.SaveFlags = bor(settings.SaveFlags, ImGuiTableFlags.Reorderable) + settings.SaveFlags = bor(settings.SaveFlags, 2 --[[ImGuiTableFlags.Reorderable]]) end if column.SortOrder ~= -1 then - settings.SaveFlags = bor(settings.SaveFlags, ImGuiTableFlags.Sortable, ImGuiTableFlags.Reorderable) -- Because SortOrder saving itself is gated, make sure every column is saved (#9519) + settings.SaveFlags = bor(settings.SaveFlags, 8 --[[ImGuiTableFlags.Sortable]], 2 --[[ImGuiTableFlags.Reorderable]]) -- Because SortOrder saving itself is gated, make sure every column is saved (#9519) end - if column.IsUserEnabled ~= (band(column.Flags, ImGuiTableColumnFlags.DefaultHide) == 0) then - settings.SaveFlags = bor(settings.SaveFlags, ImGuiTableFlags.Hideable) + if column.IsUserEnabled ~= (band(column.Flags, 2 --[[ImGuiTableColumnFlags.DefaultHide]]) == 0) then + settings.SaveFlags = bor(settings.SaveFlags, 4 --[[ImGuiTableFlags.Hideable]]) end end settings.SaveFlags = band(settings.SaveFlags, table_.Flags) @@ -54170,7 +54213,7 @@ function ImGui.TableSaveSettings(table_) end function ImGui.TableLoadSettings(table_) - if band(table_.Flags, ImGuiTableFlags.NoSavedSettings) ~= 0 then + if band(table_.Flags, 16 --[[ImGuiTableFlags.NoSavedSettings]]) ~= 0 then table_.IsSettingsRequestLoad = false -- Done return end @@ -54205,7 +54248,7 @@ function ImGui.TableLoadSettingsForColumns(table_) return end - table_.SettingsLoadedFlags = bor(table_.SettingsLoadedFlags, ImGuiTableFlags.Reorderable) -- We handle above in code above. + table_.SettingsLoadedFlags = bor(table_.SettingsLoadedFlags, 2 --[[ImGuiTableFlags.Reorderable]]) -- We handle above in code above. -- Serialize ImGuiTableSettings/ImGuiTableColumnSettings into ImGuiTable/ImGuiTableColumn local column_settings = settings.Columns @@ -54260,7 +54303,7 @@ end function ImGui.TableLoadSettingsForColumn(column, column_settings, load_flags) column.IsLoadedSettings = true column_settings.IsLoaded = true - if band(load_flags, ImGuiTableFlags.Resizable) ~= 0 then + if band(load_flags, 1 --[[ImGuiTableFlags.Resizable]]) ~= 0 then if column_settings.IsStretch ~= 0 then column.StretchWeight = column_settings.WidthOrWeight else @@ -54268,12 +54311,12 @@ function ImGui.TableLoadSettingsForColumn(column, column_settings, load_flags) end column.AutoFitQueue = 0x00 end - if band(load_flags, ImGuiTableFlags.Reorderable) ~= 0 then + if band(load_flags, 2 --[[ImGuiTableFlags.Reorderable]]) ~= 0 then column.DisplayOrder = column_settings.DisplayOrder else column.DisplayOrder = column_settings.Index -- Because default depends on previous Index, we need to set that up and cannot rely on TableInitColumnDefaults() end - if band(load_flags, ImGuiTableFlags.Hideable) ~= 0 and column_settings.IsEnabled ~= -1 then + if band(load_flags, 4 --[[ImGuiTableFlags.Hideable]]) ~= 0 and column_settings.IsEnabled ~= -1 then local v = (column_settings.IsEnabled == 1) column.IsUserEnabled = v; column.IsUserEnabledNextFrame = v end @@ -54283,7 +54326,7 @@ end -- Fix invalid display order data: compact values (0,1,3 -> 0,1,2); preserve relative order (0,3,1 -> 0,2,1); deduplicate (0,4,1,1 -> 0,3,1,2) function ImGui.TableFixDisplayOrder(table_) - if band(table_.Flags, ImGuiTableFlags.Reorderable) == 0 then + if band(table_.Flags, 2 --[[ImGuiTableFlags.Reorderable]]) == 0 then for n = 0, table_.ColumnsCount - 1 do table_.Columns[n].DisplayOrder = n table_.DisplayOrderToIndex[n] = n @@ -54345,7 +54388,7 @@ local function TableSettingsHandler_ReadOpen(ctx, handler, name) return nil end id = tonumber(id, 16); columns_count = tonumber(columns_count) - if columns_count <= 0 or columns_count >= IMGUI_TABLE_MAX_COLUMNS then + if columns_count <= 0 or columns_count >= 512 --[[IMGUI_TABLE_MAX_COLUMNS]] then return nil end return ImGui.TableSettingsCreate(id, columns_count) @@ -54376,16 +54419,16 @@ local function TableSettingsHandler_ReadLine(ctx, handler, settings, line) end take("UserID=0x(%x+)") -- FIXME-LEGACY: Removed 2025/11/12, was never properly set. local v = take("Width=(%-?%d+)") - if v then column.WidthOrWeight = tonumber(v); column.IsStretch = 0; settings.SaveFlags = bor(settings.SaveFlags, ImGuiTableFlags.Resizable) end + if v then column.WidthOrWeight = tonumber(v); column.IsStretch = 0; settings.SaveFlags = bor(settings.SaveFlags, 1 --[[ImGuiTableFlags.Resizable]]) end v = take("Weight=([%-%d%.eE+]+)") - if v then column.WidthOrWeight = tonumber(v); column.IsStretch = 1; settings.SaveFlags = bor(settings.SaveFlags, ImGuiTableFlags.Resizable) end + if v then column.WidthOrWeight = tonumber(v); column.IsStretch = 1; settings.SaveFlags = bor(settings.SaveFlags, 1 --[[ImGuiTableFlags.Resizable]]) end v = take("Visible=(%-?%d+)") - if v then column.IsEnabled = tonumber(v); settings.SaveFlags = bor(settings.SaveFlags, ImGuiTableFlags.Hideable) end + if v then column.IsEnabled = tonumber(v); settings.SaveFlags = bor(settings.SaveFlags, 4 --[[ImGuiTableFlags.Hideable]]) end v = take("Order=(%-?%d+)") - if v then column.DisplayOrder = tonumber(v); settings.SaveFlags = bor(settings.SaveFlags, ImGuiTableFlags.Reorderable) end + if v then column.DisplayOrder = tonumber(v); settings.SaveFlags = bor(settings.SaveFlags, 2 --[[ImGuiTableFlags.Reorderable]]) end local c v, c = take("Sort=(%-?%d+)(.)") - if v then column.SortOrder = tonumber(v); column.SortDirection = (c == "^") and ImGuiSortDirection.Descending or ImGuiSortDirection.Ascending; settings.SaveFlags = bor(settings.SaveFlags, ImGuiTableFlags.Sortable) end + if v then column.SortOrder = tonumber(v); column.SortDirection = (c == "^") and 2 --[[ImGuiSortDirection.Descending]] or 1 --[[ImGuiSortDirection.Ascending]]; settings.SaveFlags = bor(settings.SaveFlags, 8 --[[ImGuiTableFlags.Sortable]]) end v = take("ID=0x(%x+)") if v then column.ID = tonumber(v, 16) end end @@ -54397,10 +54440,10 @@ local function TableSettingsHandler_WriteAll(ctx, handler, buf) if settings.ID ~= 0 then -- Skip ditched settings -- TableSaveSettings() may clear some of those flags when we establish that the data can be stripped -- (e.g. Order was unchanged) - local save_size = band(settings.SaveFlags, ImGuiTableFlags.Resizable) ~= 0 - local save_visible = band(settings.SaveFlags, ImGuiTableFlags.Hideable) ~= 0 - local save_order = band(settings.SaveFlags, ImGuiTableFlags.Reorderable) ~= 0 - local save_sort = band(settings.SaveFlags, ImGuiTableFlags.Sortable) ~= 0 + local save_size = band(settings.SaveFlags, 1 --[[ImGuiTableFlags.Resizable]]) ~= 0 + local save_visible = band(settings.SaveFlags, 4 --[[ImGuiTableFlags.Hideable]]) ~= 0 + local save_order = band(settings.SaveFlags, 2 --[[ImGuiTableFlags.Reorderable]]) ~= 0 + local save_sort = band(settings.SaveFlags, 8 --[[ImGuiTableFlags.Sortable]]) ~= 0 -- We need to save the [Table] entry even if all the bools are false, since this records a table with "default settings". buf:appendf("[%s][0x%08X,%d]\n", handler.TypeName, settings.ID, settings.ColumnsCount) @@ -54417,7 +54460,7 @@ local function TableSettingsHandler_WriteAll(ctx, handler, buf) if save_size and column.IsStretch == 0 then buf:appendf(" Width=%d", ImTrunc(column.WidthOrWeight)) end if save_visible then buf:appendf(" Visible=%d", column.IsEnabled) end if save_order then buf:appendf(" Order=%d", column.DisplayOrder) end - if save_sort and column.SortOrder ~= -1 then buf:appendf(" Sort=%d%s", column.SortOrder, (column.SortDirection == ImGuiSortDirection.Ascending) and "v" or "^") end + if save_sort and column.SortOrder ~= -1 then buf:appendf(" Sort=%d%s", column.SortOrder, (column.SortDirection == 1 --[[ImGuiSortDirection.Ascending]]) and "v" or "^") end if column.ID ~= 0 then buf:appendf(" ID=0x%08X", column.ID) end buf:append("\n") end @@ -54472,7 +54515,7 @@ function ImGui.TableGcCompactTransientBuffers(t) --IMGUI_DEBUG_PRINT("TableGcCompactTransientBuffers() id=0x%08X\n", t.ID) local g = GImGui local table_ = t - IM_ASSERT(table_.MemoryCompacted == false) + assert(table_.MemoryCompacted == false) table_.SortSpecs.Specs = nil table.clear(table_.SortSpecsMulti) table_.IsSortSpecsDirty = true -- FIXME: In theory shouldn't have to leak into user performing a sort on resume. @@ -54551,12 +54594,12 @@ local function GetDraggedColumnOffset(columns, column_index) -- window creates a feedback loop because we store normalized positions. So while dragging we enforce absolute positioning. local g = GImGui local window = g.CurrentWindow - IM_ASSERT(column_index > 0) -- We are not supposed to drag column 0. - IM_ASSERT(g.ActiveId == band(columns.ID + column_index, 0xFFFFFFFF)) + assert(column_index > 0) -- We are not supposed to drag column 0. + assert(g.ActiveId == band(columns.ID + column_index, 0xFFFFFFFF)) local x = g.IO.MousePos.x - g.ActiveIdClickOffset.x + ImTrunc(COLUMNS_HIT_RECT_HALF_THICKNESS * g.CurrentDpiScale) - window.Pos.x x = ImMax(x, ImGui.GetColumnOffset(column_index - 1) + g.Style.ColumnsMinSpacing) - if band(columns.Flags, ImGuiOldColumnFlags.NoPreserveWidths) ~= 0 then + if band(columns.Flags, 4 --[[ImGuiOldColumnFlags.NoPreserveWidths]]) ~= 0 then x = ImMin(x, ImGui.GetColumnOffset(column_index + 1) - g.Style.ColumnsMinSpacing) end @@ -54574,7 +54617,7 @@ function ImGui.GetColumnOffset(column_index) if column_index < 0 then column_index = columns.Current end - IM_ASSERT(column_index < columns.Columns.Size) + assert(column_index < columns.Columns.Size) local t = columns.Columns.Data[column_index + 1].OffsetNorm local x_offset = ImLerp(columns.OffMinX, columns.OffMaxX, t) @@ -54616,17 +54659,17 @@ function ImGui.SetColumnOffset(column_index, offset) local g = GImGui local window = g.CurrentWindow local columns = window.DC.CurrentColumns - IM_ASSERT(columns ~= nil) + assert(columns ~= nil) if column_index < 0 then column_index = columns.Current end - IM_ASSERT(column_index < columns.Columns.Size) + assert(column_index < columns.Columns.Size) - local preserve_width = band(columns.Flags, ImGuiOldColumnFlags.NoPreserveWidths) == 0 and (column_index < columns.Count - 1) + local preserve_width = band(columns.Flags, 4 --[[ImGuiOldColumnFlags.NoPreserveWidths]]) == 0 and (column_index < columns.Count - 1) local width = preserve_width and GetColumnWidthEx(columns, column_index, columns.IsBeingResized) or 0.0 - if band(columns.Flags, ImGuiOldColumnFlags.NoForceWithinWindow) == 0 then + if band(columns.Flags, 8 --[[ImGuiOldColumnFlags.NoForceWithinWindow]]) == 0 then offset = ImMin(offset, columns.OffMaxX - g.Style.ColumnsMinSpacing * (columns.Count - column_index)) end columns.Columns.Data[column_index + 1].OffsetNorm = ImGui.GetColumnNormFromOffset(columns, offset - columns.OffMinX) @@ -54639,7 +54682,7 @@ end function ImGui.SetColumnWidth(column_index, width) local window = ImGui.GetCurrentWindowRead() local columns = window.DC.CurrentColumns - IM_ASSERT(columns ~= nil) + assert(columns ~= nil) if column_index < 0 then column_index = columns.Current @@ -54715,13 +54758,13 @@ function ImGui.BeginColumns(str_id, columns_count, flags) local g = GImGui local window = ImGui.GetCurrentWindow() - IM_ASSERT(columns_count >= 1) - IM_ASSERT(window.DC.CurrentColumns == nil) -- Nested columns are currently not supported + assert(columns_count >= 1) + assert(window.DC.CurrentColumns == nil) -- Nested columns are currently not supported -- Acquire storage for the columns set local id = ImGui.GetColumnsID(str_id, columns_count) local columns = ImGui.FindOrCreateColumns(window, id) - IM_ASSERT(columns.ID == id) + assert(columns.ID == id) columns.Current = 0 columns.Count = columns_count columns.Flags = flags @@ -54764,7 +54807,7 @@ function ImGui.BeginColumns(str_id, columns_count, flags) local column = columns.Columns.Data[n + 1] local clip_x1 = IM_ROUND(window.Pos.x + ImGui.GetColumnOffset(n)) local clip_x2 = IM_ROUND(window.Pos.x + ImGui.GetColumnOffset(n + 1) - 1.0) - column.ClipRect = ImRect(clip_x1, -FLT_MAX, clip_x2, FLT_MAX) + column.ClipRect = ImRect(clip_x1, -3.4028234663853e+38 --[[FLT_MAX]], clip_x2, 3.4028234663853e+38 --[[FLT_MAX]]) column.ClipRect:ClipWithFull(window.ClipRect) end @@ -54796,7 +54839,7 @@ function ImGui.NextColumn() if columns.Count == 1 then window.DC.CursorPos.x = IM_TRUNC(window.Pos.x + window.DC.Indent.x + window.DC.ColumnsOffset.x) - IM_ASSERT(columns.Current == 0) + assert(columns.Current == 0) return end @@ -54843,7 +54886,7 @@ function ImGui.EndColumns() local g = GImGui local window = ImGui.GetCurrentWindow() local columns = window.DC.CurrentColumns - IM_ASSERT(columns ~= nil) + assert(columns ~= nil) ImGui.PopItemWidth() if columns.Count > 1 then @@ -54854,14 +54897,14 @@ function ImGui.EndColumns() local flags = columns.Flags columns.LineMaxY = ImMax(columns.LineMaxY, window.DC.CursorPos.y) window.DC.CursorPos.y = columns.LineMaxY - if band(flags, ImGuiOldColumnFlags.GrowParentContentsSize) == 0 then + if band(flags, 16 --[[ImGuiOldColumnFlags.GrowParentContentsSize]]) == 0 then window.DC.CursorMaxPos.x = columns.HostCursorMaxPosX -- Restore cursor max pos, as columns don't grow parent end -- Draw columns borders and handle resize -- The IsBeingResized flag ensure we preserve pre-resize columns width so back-and-forth are not lossy local is_being_resized = false - if band(flags, ImGuiOldColumnFlags.NoBorder) == 0 and not window.SkipItems then + if band(flags, 1 --[[ImGuiOldColumnFlags.NoBorder]]) == 0 and not window.SkipItems then -- We clip Y boundaries CPU side because very long triangles are mishandled by some GPU drivers. local y1 = ImMax(columns.HostCursorPosY, window.ClipRect.Min.y) local y2 = ImMin(window.DC.CursorPos.y, window.ClipRect.Max.y) @@ -54872,21 +54915,21 @@ function ImGui.EndColumns() local column_id = band(columns.ID + n, 0xFFFFFFFF) local column_hit_hw = ImTrunc(COLUMNS_HIT_RECT_HALF_THICKNESS * g.CurrentDpiScale) local column_hit_rect = ImRect(ImVec2(x - column_hit_hw, y1), ImVec2(x + column_hit_hw, y2)) - if ImGui.ItemAdd(column_hit_rect, column_id, nil, ImGuiItemFlags.NoNav) then + if ImGui.ItemAdd(column_hit_rect, column_id, nil, 2 --[[ImGuiItemFlags.NoNav]]) then local hovered, held = false, false - if band(flags, ImGuiOldColumnFlags.NoResize) == 0 then + if band(flags, 2 --[[ImGuiOldColumnFlags.NoResize]]) == 0 then local _ _, hovered, held = ImGui.ButtonBehavior(column_hit_rect, column_id) if hovered or held then - ImGui.SetMouseCursor(ImGuiMouseCursor.ResizeEW) + ImGui.SetMouseCursor(4 --[[ImGuiMouseCursor.ResizeEW]]) end - if held and band(column.Flags, ImGuiOldColumnFlags.NoResize) == 0 then + if held and band(column.Flags, 2 --[[ImGuiOldColumnFlags.NoResize]]) == 0 then dragging_column = n end end -- Draw column - local col = ImGui.GetColorU32(held and ImGuiCol.SeparatorActive or (hovered and ImGuiCol.SeparatorHovered or ImGuiCol.Separator)) + local col = ImGui.GetColorU32(held and 30 --[[ImGuiCol.SeparatorActive]] or (hovered and 29 --[[ImGuiCol.SeparatorHovered]] or 28 --[[ImGuiCol.Separator]])) local xi = IM_TRUNC(x) window.DrawList:AddLineV(xi, y1 + 1.0, y2, col) end @@ -54922,9 +54965,9 @@ function ImGui.Columns(columns_count, id, borders) if columns_count == nil then columns_count = 1 end if borders == nil then borders = true end local window = ImGui.GetCurrentWindow() - IM_ASSERT(columns_count >= 1) + assert(columns_count >= 1) - local flags = borders and 0 or ImGuiOldColumnFlags.NoBorder + local flags = borders and 0 or 1 --[[ImGuiOldColumnFlags.NoBorder]] --flags = bor(flags, ImGuiOldColumnFlags.NoPreserveWidths) -- NB: Legacy behavior local columns = window.DC.CurrentColumns if columns ~= nil and columns.Count == columns_count and columns.Flags == flags then @@ -55084,7 +55127,7 @@ function ImGui.TextEx(text, text_end, flags) if not line_end then line_end = text_end end - if bit32.band(flags, ImGuiTextFlags.NoWidthForLargeClippedText) == 0 then + if bit32.band(flags, 1 --[[ImGuiTextFlags.NoWidthForLargeClippedText]]) == 0 then local line_size = ImGui.CalcTextSizeEx(text, line, line_end) text_size.x = ImMax(text_size.x, line_size.x) end @@ -55097,7 +55140,7 @@ function ImGui.TextEx(text, text_end, flags) -- Lines to render if line < text_end then - local line_rect = ImRect(pos, pos + ImVec2(FLT_MAX, line_height)) + local line_rect = ImRect(pos, pos + ImVec2(3.4028234663853e+38 --[[FLT_MAX]], line_height)) while line < text_end do if ImGui.IsClippedEx(line_rect, 0) then break @@ -55124,7 +55167,7 @@ function ImGui.TextEx(text, text_end, flags) if not line_end then line_end = text_end end - if bit32.band(flags, ImGuiTextFlags.NoWidthForLargeClippedText) == 0 then + if bit32.band(flags, 1 --[[ImGuiTextFlags.NoWidthForLargeClippedText]]) == 0 then local line_size = ImGui.CalcTextSizeEx(text, line, line_end) text_size.x = ImMax(text_size.x, line_size.x) end @@ -55144,7 +55187,7 @@ end --- @param text string --- @param text_end? int function ImGui.TextUnformatted(text, text_end) - ImGui.TextEx(text, text_end, ImGuiTextFlags.NoWidthForLargeClippedText) + ImGui.TextEx(text, text_end, 1 --[[ImGuiTextFlags.NoWidthForLargeClippedText]]) end --- @param fmt string @@ -55158,7 +55201,7 @@ function ImGui.TextV(fmt, ...) end local text = ImFormatString(fmt, ...) - ImGui.TextEx(text, nil, ImGuiTextFlags.NoWidthForLargeClippedText) + ImGui.TextEx(text, nil, 1 --[[ImGuiTextFlags.NoWidthForLargeClippedText]]) end --- @param fmt string @@ -55176,7 +55219,7 @@ end --- @param fmt string --- @param ... any function ImGui.TextColored(col, fmt, ...) - ImGui.PushStyleColor(ImGuiCol.Text, col) + ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], col) ImGui.TextV(fmt, ...) ImGui.PopStyleColor() end @@ -55185,7 +55228,7 @@ end --- @param ... any function ImGui.TextDisabled(fmt, ...) local g = GImGui - ImGui.PushStyleColor(ImGuiCol.Text, g.Style.Colors[ImGuiCol.TextDisabled]) + ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], g.Style.Colors[1 --[[ImGuiCol.TextDisabled]]]) ImGui.TextV(fmt, ...) ImGui.PopStyleColor() end @@ -55238,7 +55281,7 @@ function ImGui.TextAligned(align_x, size_x, fmt, ...) ImGui.ItemAdd(ImRect(pos, pos + size), 0) window.DC.CursorMaxPos.x = backup_max_pos.x -- Cancel out extending content to 'size' to use 'text_size' allowing auto-resize to function with align_x > 0.0f - if size_x < text_size.x and ImGui.IsItemHovered(bit32.bor(ImGuiHoveredFlags.NoNavOverride, ImGuiHoveredFlags.AllowWhenDisabled, ImGuiHoveredFlags.ForTooltip)) then + if size_x < text_size.x and ImGui.IsItemHovered(bit32.bor(2048 --[[ImGuiHoveredFlags.NoNavOverride]], 1024 --[[ImGuiHoveredFlags.AllowWhenDisabled]], 4096 --[[ImGuiHoveredFlags.ForTooltip]])) then ImGui.SetTooltip("%.*s", text_end - 1, text) end end @@ -55304,7 +55347,7 @@ function ImGui.BulletText(fmt, ...) end -- Render - local text_col = ImGui.GetColorU32(ImGuiCol.Text) + local text_col = ImGui.GetColorU32(0 --[[ImGuiCol.Text]]) ImGui.RenderBullet(window.DrawList, ImVec2(bb.Min.x + (style.FramePadding.x + g.FontSize * 0.5), bb.Min.y + g.FontSize * 0.5), text_col) ImGui.RenderText(ImVec2(bb.Min.x + (g.FontSize + style.FramePadding.x * 2), bb.Min.y + 0.0), text, 1, text_end, false) end @@ -55440,25 +55483,25 @@ function ImGui.ButtonBehavior(bb, id, flags) -- Default behavior inherited from item flags -- Note that _both_ ButtonFlags and ItemFlags are valid sources, so copy one into the item_flags and only check that. local item_flags = (g.LastItemData.ID == id) and g.LastItemData.ItemFlags or g.CurrentItemFlags - if bit32.band(flags, ImGuiButtonFlags.AllowOverlap) ~= 0 then - item_flags = bit32.bor(item_flags, ImGuiItemFlags.AllowOverlap) + if bit32.band(flags, 4096 --[[ImGuiButtonFlags.AllowOverlap]]) ~= 0 then + item_flags = bit32.bor(item_flags, 16384 --[[ImGuiItemFlags.AllowOverlap]]) end - if bit32.band(item_flags, ImGuiItemFlags.NoFocus) ~= 0 then - flags = bit32.bor(flags, ImGuiButtonFlags.NoFocus, ImGuiButtonFlags.NoNavFocus) + if bit32.band(item_flags, 131072 --[[ImGuiItemFlags.NoFocus]]) ~= 0 then + flags = bit32.bor(flags, 4194304 --[[ImGuiButtonFlags.NoFocus]], 262144 --[[ImGuiButtonFlags.NoNavFocus]]) end -- Default only reacts to left mouse button - if bit32.band(flags, ImGuiButtonFlags.MouseButtonMask_) == 0 then - flags = bit32.bor(flags, ImGuiButtonFlags.MouseButtonLeft) + if bit32.band(flags, 7 --[[ImGuiButtonFlags.MouseButtonMask_]]) == 0 then + flags = bit32.bor(flags, 1 --[[ImGuiButtonFlags.MouseButtonLeft]]) end -- Default behavior requires click + release inside bounding box - if bit32.band(flags, ImGuiButtonFlags.PressedOnMask_) == 0 then - flags = bit32.bor(flags, (bit32.band(item_flags, ImGuiItemFlags.ButtonRepeat) ~= 0) and ImGuiButtonFlags.PressedOnClick or ImGuiButtonFlags.PressedOnDefault_) + if bit32.band(flags, 1008 --[[ImGuiButtonFlags.PressedOnMask_]]) == 0 then + flags = bit32.bor(flags, (bit32.band(item_flags, 8 --[[ImGuiItemFlags.ButtonRepeat]]) ~= 0) and 16 --[[ImGuiButtonFlags.PressedOnClick]] or 32 --[[ImGuiButtonFlags.PressedOnDefault_]]) end local backup_hovered_window = g.HoveredWindow - local flatten_hovered_children = (bit32.band(flags, ImGuiButtonFlags.FlattenChildren) ~= 0) and g.HoveredWindow and g.HoveredWindow.RootWindowDockTree == window.RootWindowDockTree + local flatten_hovered_children = (bit32.band(flags, 2048 --[[ImGuiButtonFlags.FlattenChildren]]) ~= 0) and g.HoveredWindow and g.HoveredWindow.RootWindowDockTree == window.RootWindowDockTree if flatten_hovered_children then g.HoveredWindow = window end @@ -55469,7 +55512,7 @@ function ImGui.ButtonBehavior(bb, id, flags) -- Special mode for Drag and Drop used by openables (tree nodes, tabs etc.) -- where holding the button pressed for a long time while drag a payload item triggers the button. if g.DragDropActive then - if (bit32.band(flags, ImGuiButtonFlags.PressedOnDragDropHold) ~= 0) and (bit32.band(g.DragDropSourceFlags, ImGuiDragDropFlags.SourceNoHoldToOpenOthers) == 0) and ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenBlockedByActiveItem) then + if (bit32.band(flags, 512 --[[ImGuiButtonFlags.PressedOnDragDropHold]]) ~= 0) and (bit32.band(g.DragDropSourceFlags, 4 --[[ImGuiDragDropFlags.SourceNoHoldToOpenOthers]]) == 0) and ImGui.IsItemHovered(128 --[[ImGuiHoveredFlags.AllowWhenBlockedByActiveItem]]) then hovered = true ImGui.SetHoveredID(id) @@ -55480,7 +55523,7 @@ function ImGui.ButtonBehavior(bb, id, flags) end end - if (g.DragDropAcceptIdPrev == id) and (bit32.band(g.DragDropAcceptFlagsPrev, ImGuiDragDropFlags.AcceptDrawAsHovered) ~= 0) then + if (g.DragDropAcceptIdPrev == id) and (bit32.band(g.DragDropAcceptFlagsPrev, 8192 --[[ImGuiDragDropFlags.AcceptDrawAsHovered]]) ~= 0) then hovered = true end end @@ -55490,9 +55533,9 @@ function ImGui.ButtonBehavior(bb, id, flags) end -- Mouse handling - local test_owner_id = (bit32.band(flags, ImGuiButtonFlags.NoTestKeyOwner) ~= 0) and ImGuiKeyOwner_Any or id + local test_owner_id = (bit32.band(flags, 2097152 --[[ImGuiButtonFlags.NoTestKeyOwner]]) ~= 0) and 0 --[[ImGuiKeyOwner_Any]] or id if hovered then - IM_ASSERT(id ~= 0) -- Lazily check inside rare path. + assert(id ~= 0) -- Lazily check inside rare path. -- Poll mouse buttons -- - 'mouse_button_clicked' is generally carried into ActiveIdMouseButton when setting ActiveId. @@ -55500,38 +55543,38 @@ function ImGui.ButtonBehavior(bb, id, flags) local mouse_button_clicked = -1 local mouse_button_released = -1 for button = 0, 2 do - if bit32.band(flags, bit32.lshift(ImGuiButtonFlags.MouseButtonLeft, button)) ~= 0 then -- Handle ImGuiButtonFlags.MouseButtonRight and ImGuiButtonFlags.MouseButtonMiddle here. - if (ImGui.IsMouseClickedEx(button, ImGuiInputFlags.None, test_owner_id) and mouse_button_clicked == -1) then mouse_button_clicked = button end + if bit32.band(flags, bit32.lshift(1 --[[ImGuiButtonFlags.MouseButtonLeft]], button)) ~= 0 then -- Handle ImGuiButtonFlags.MouseButtonRight and ImGuiButtonFlags.MouseButtonMiddle here. + if (ImGui.IsMouseClickedEx(button, 0 --[[ImGuiInputFlags.None]], test_owner_id) and mouse_button_clicked == -1) then mouse_button_clicked = button end if (ImGui.IsMouseReleased(button, test_owner_id) and mouse_button_released == -1) then mouse_button_released = button end end end -- Process initial action - local mods_ok = (bit32.band(flags, ImGuiButtonFlags.NoKeyModsAllowed) == 0) or (not g.IO.KeyCtrl and not g.IO.KeyShift and not g.IO.KeyAlt) + local mods_ok = (bit32.band(flags, 65536 --[[ImGuiButtonFlags.NoKeyModsAllowed]]) == 0) or (not g.IO.KeyCtrl and not g.IO.KeyShift and not g.IO.KeyAlt) if mods_ok then if mouse_button_clicked ~= -1 and g.ActiveId ~= id then --- @cast mouse_button_clicked ImGuiMouseButton - if bit32.band(flags, ImGuiButtonFlags.NoSetKeyOwner) == 0 then + if bit32.band(flags, 1048576 --[[ImGuiButtonFlags.NoSetKeyOwner]]) == 0 then ImGui.SetKeyOwner(ImGui.MouseButtonToKey(mouse_button_clicked), id) end - if bit32.band(flags, bit32.bor(ImGuiButtonFlags.PressedOnClickRelease, ImGuiButtonFlags.PressedOnClickReleaseAnywhere)) ~= 0 then + if bit32.band(flags, bit32.bor(32 --[[ImGuiButtonFlags.PressedOnClickRelease]], 64 --[[ImGuiButtonFlags.PressedOnClickReleaseAnywhere]])) ~= 0 then ImGui.SetActiveID(id, window) g.ActiveIdMouseButton = mouse_button_clicked - if bit32.band(flags, ImGuiButtonFlags.NoNavFocus) == 0 then + if bit32.band(flags, 262144 --[[ImGuiButtonFlags.NoNavFocus]]) == 0 then ImGui.SetFocusID(id, window) ImGui.FocusWindow(window) - elseif bit32.band(flags, ImGuiButtonFlags.NoFocus) == 0 then - ImGui.FocusWindow(window, ImGuiFocusRequestFlags.RestoreFocusedChild) -- Still need to focus and bring to front, but try to avoid losing NavId when navigating a child + elseif bit32.band(flags, 4194304 --[[ImGuiButtonFlags.NoFocus]]) == 0 then + ImGui.FocusWindow(window, 1 --[[ImGuiFocusRequestFlags.RestoreFocusedChild]]) -- Still need to focus and bring to front, but try to avoid losing NavId when navigating a child end end - if (bit32.band(flags, ImGuiButtonFlags.PressedOnClick) ~= 0) or ((bit32.band(flags, ImGuiButtonFlags.PressedOnDoubleClick) ~= 0) and g.IO.MouseClickedCount[mouse_button_clicked] == 2) then + if (bit32.band(flags, 16 --[[ImGuiButtonFlags.PressedOnClick]]) ~= 0) or ((bit32.band(flags, 256 --[[ImGuiButtonFlags.PressedOnDoubleClick]]) ~= 0) and g.IO.MouseClickedCount[mouse_button_clicked] == 2) then pressed = true - if bit32.band(flags, ImGuiButtonFlags.NoHoldingActiveId) ~= 0 then + if bit32.band(flags, 131072 --[[ImGuiButtonFlags.NoHoldingActiveId]]) ~= 0 then ImGui.ClearActiveID() else ImGui.SetActiveID(id, window) -- Hold on ID @@ -55539,33 +55582,33 @@ function ImGui.ButtonBehavior(bb, id, flags) g.ActiveIdMouseButton = mouse_button_clicked - if bit32.band(flags, ImGuiButtonFlags.NoNavFocus) == 0 then + if bit32.band(flags, 262144 --[[ImGuiButtonFlags.NoNavFocus]]) == 0 then ImGui.SetFocusID(id, window) ImGui.FocusWindow(window) - elseif bit32.band(flags, ImGuiButtonFlags.NoFocus) == 0 then - ImGui.FocusWindow(window, ImGuiFocusRequestFlags.RestoreFocusedChild) -- Still need to focus and bring to front, but try to avoid losing NavId when navigating a child + elseif bit32.band(flags, 4194304 --[[ImGuiButtonFlags.NoFocus]]) == 0 then + ImGui.FocusWindow(window, 1 --[[ImGuiFocusRequestFlags.RestoreFocusedChild]]) -- Still need to focus and bring to front, but try to avoid losing NavId when navigating a child end end - if bit32.band(flags, ImGuiButtonFlags.PressedOnRelease) ~= 0 then + if bit32.band(flags, 128 --[[ImGuiButtonFlags.PressedOnRelease]]) ~= 0 then -- FIXME: Traditionally ImGuiButtonFlags.PressedOnRelease never took ActiveId. Adding it in 2026-03-20 since ImGuiButtonFlags.NoHoldingActiveId can always be added. -- We don't yet perform an explicit ClearActiveID() to reduce scope of change, but this possibility could be investigated. - if bit32.band(flags, ImGuiButtonFlags.NoHoldingActiveId) == 0 then + if bit32.band(flags, 131072 --[[ImGuiButtonFlags.NoHoldingActiveId]]) == 0 then ImGui.SetActiveID(id, window) -- Hold on ID end g.ActiveIdMouseButton = mouse_button_clicked end end - if bit32.band(flags, ImGuiButtonFlags.PressedOnRelease) ~= 0 then + if bit32.band(flags, 128 --[[ImGuiButtonFlags.PressedOnRelease]]) ~= 0 then if mouse_button_released ~= -1 then - local has_repeated_at_least_once = (bit32.band(item_flags, ImGuiItemFlags.ButtonRepeat) ~= 0) and g.IO.MouseDownDurationPrev[mouse_button_released] >= g.IO.KeyRepeatDelay -- Repeat mode trumps on release behavior + local has_repeated_at_least_once = (bit32.band(item_flags, 8 --[[ImGuiItemFlags.ButtonRepeat]]) ~= 0) and g.IO.MouseDownDurationPrev[mouse_button_released] >= g.IO.KeyRepeatDelay -- Repeat mode trumps on release behavior if not has_repeated_at_least_once then pressed = true end - if bit32.band(flags, ImGuiButtonFlags.NoNavFocus) == 0 then + if bit32.band(flags, 262144 --[[ImGuiButtonFlags.NoNavFocus]]) == 0 then ImGui.SetFocusID(id, window) -- FIXME: Lack of FocusWindow() call here is inconsistent with other paths. Research why. end @@ -55575,8 +55618,8 @@ function ImGui.ButtonBehavior(bb, id, flags) -- 'Repeat' mode acts when held regardless of _PressedOn flags (see table above). -- Relies on repeat logic of IsMouseClicked() but we may as well do it ourselves if we end up exposing finer RepeatDelay/RepeatRate settings. - if g.ActiveId == id and (bit32.band(item_flags, ImGuiItemFlags.ButtonRepeat) ~= 0) then - if g.IO.MouseDownDuration[g.ActiveIdMouseButton] > 0.0 and ImGui.IsMouseClickedEx(g.ActiveIdMouseButton, ImGuiInputFlags.Repeat, test_owner_id) then + if g.ActiveId == id and (bit32.band(item_flags, 8 --[[ImGuiItemFlags.ButtonRepeat]]) ~= 0) then + if g.IO.MouseDownDuration[g.ActiveIdMouseButton] > 0.0 and ImGui.IsMouseClickedEx(g.ActiveIdMouseButton, 1 --[[ImGuiInputFlags.Repeat]], test_owner_id) then pressed = true end end @@ -55589,19 +55632,19 @@ function ImGui.ButtonBehavior(bb, id, flags) -- Keyboard/Gamepad navigation handling -- We report navigated and navigation-activated items as hovered but we don't set g.HoveredId to not interfere with mouse. - if bit32.band(item_flags, ImGuiItemFlags.Disabled) == 0 then + if bit32.band(item_flags, 64 --[[ImGuiItemFlags.Disabled]]) == 0 then if g.NavId == id and g.NavCursorVisible and g.NavHighlightItemUnderNav then - if bit32.band(flags, ImGuiButtonFlags.NoHoveredOnFocus) == 0 then + if bit32.band(flags, 524288 --[[ImGuiButtonFlags.NoHoveredOnFocus]]) == 0 then hovered = true end end if g.NavActivateDownId == id then local nav_activated_by_code = (g.NavActivateId == id) local nav_activated_by_inputs = (g.NavActivatePressedId == id) - if not nav_activated_by_inputs and bit32.band(item_flags, ImGuiItemFlags.ButtonRepeat) ~= 0 then + if not nav_activated_by_inputs and bit32.band(item_flags, 8 --[[ImGuiItemFlags.ButtonRepeat]]) ~= 0 then -- Avoid pressing multiple keys from triggering excessive amount of repeat events - local key1 = ImGui.GetKeyData(g, ImGuiKey.Space) - local key2 = ImGui.GetKeyData(g, ImGuiKey.Enter) + local key1 = ImGui.GetKeyData(g, 524 --[[ImGuiKey.Space]]) + local key2 = ImGui.GetKeyData(g, 525 --[[ImGuiKey.Enter]]) local key3 = ImGui.GetKeyData(g, ImGuiKey.NavGamepadActivate) local t1 = ImMax(ImMax(key1.DownDuration, key2.DownDuration), key3.DownDuration) nav_activated_by_inputs = ImGui.CalcTypematicRepeatAmount(t1 - g.IO.DeltaTime, t1, g.IO.KeyRepeatDelay, g.IO.KeyRepeatRate) > 0 @@ -55611,10 +55654,10 @@ function ImGui.ButtonBehavior(bb, id, flags) pressed = true ImGui.SetActiveID(id, window) g.ActiveIdSource = g.NavInputSource - if bit32.band(flags, ImGuiButtonFlags.NoNavFocus) == 0 and bit32.band(g.NavActivateFlags, ImGuiActivateFlags.FromShortcut) == 0 then + if bit32.band(flags, 262144 --[[ImGuiButtonFlags.NoNavFocus]]) == 0 and bit32.band(g.NavActivateFlags, 16 --[[ImGuiActivateFlags.FromShortcut]]) == 0 then ImGui.SetFocusID(id, window) end - if bit32.band(g.NavActivateFlags, ImGuiActivateFlags.FromShortcut) ~= 0 then + if bit32.band(g.NavActivateFlags, 16 --[[ImGuiActivateFlags.FromShortcut]]) ~= 0 then g.ActiveIdFromShortcut = true end end @@ -55624,7 +55667,7 @@ function ImGui.ButtonBehavior(bb, id, flags) -- Process while held local held = false if g.ActiveId == id then - if g.ActiveIdSource == ImGuiInputSource.Mouse then + if g.ActiveIdSource == 1 --[[ImGuiInputSource.Mouse]] then if g.ActiveIdIsJustActivated then g.ActiveIdClickOffset = g.IO.MousePos - bb.Min end @@ -55636,14 +55679,14 @@ function ImGui.ButtonBehavior(bb, id, flags) elseif ImGui.IsMouseDown(mouse_button, test_owner_id) then held = true else - local release_in = hovered and (bit32.band(flags, ImGuiButtonFlags.PressedOnClickRelease) ~= 0) - local release_anywhere = (bit32.band(flags, ImGuiButtonFlags.PressedOnClickReleaseAnywhere) ~= 0) + local release_in = hovered and (bit32.band(flags, 32 --[[ImGuiButtonFlags.PressedOnClickRelease]]) ~= 0) + local release_anywhere = (bit32.band(flags, 64 --[[ImGuiButtonFlags.PressedOnClickReleaseAnywhere]]) ~= 0) if (release_in or release_anywhere) and not g.DragDropActive then -- Report as pressed when releasing the mouse (this is the most common path) - local is_double_click_release = (bit32.band(flags, ImGuiButtonFlags.PressedOnDoubleClick) ~= 0) and g.IO.MouseReleased[mouse_button] and g.IO.MouseClickedLastCount[mouse_button] == 2 + local is_double_click_release = (bit32.band(flags, 256 --[[ImGuiButtonFlags.PressedOnDoubleClick]]) ~= 0) and g.IO.MouseReleased[mouse_button] and g.IO.MouseClickedLastCount[mouse_button] == 2 - local is_repeating_already = (bit32.band(item_flags, ImGuiItemFlags.ButtonRepeat) ~= 0) and g.IO.MouseDownDurationPrev[mouse_button] >= g.IO.KeyRepeatDelay -- Repeat mode trumps + local is_repeating_already = (bit32.band(item_flags, 8 --[[ImGuiItemFlags.ButtonRepeat]]) ~= 0) and g.IO.MouseDownDurationPrev[mouse_button] >= g.IO.KeyRepeatDelay -- Repeat mode trumps local is_button_avail_or_owned = ImGui.TestKeyOwner(ImGui.MouseButtonToKey(mouse_button), test_owner_id) @@ -55655,10 +55698,10 @@ function ImGui.ButtonBehavior(bb, id, flags) ImGui.ClearActiveID() end - if bit32.band(flags, ImGuiButtonFlags.NoNavFocus) == 0 and g.IO.ConfigNavCursorVisibleAuto then + if bit32.band(flags, 262144 --[[ImGuiButtonFlags.NoNavFocus]]) == 0 and g.IO.ConfigNavCursorVisibleAuto then g.NavCursorVisible = false end - elseif g.ActiveIdSource == ImGuiInputSource.Keyboard or g.ActiveIdSource == ImGuiInputSource.Gamepad then + elseif g.ActiveIdSource == 2 --[[ImGuiInputSource.Keyboard]] or g.ActiveIdSource == 3 --[[ImGuiInputSource.Gamepad]] then -- When activated using Nav, we hold on the ActiveID until activation button is released if g.NavActivateDownId == id then held = true -- hovered == true not true as we are already likely hovered on direct activation. @@ -55673,7 +55716,7 @@ function ImGui.ButtonBehavior(bb, id, flags) end -- Activation highlight (this may be a remote activation) - if g.NavHighlightActivatedId == id and (bit32.band(item_flags, ImGuiItemFlags.Disabled) == 0) then + if g.NavHighlightActivatedId == id and (bit32.band(item_flags, 64 --[[ImGuiItemFlags.Disabled]]) == 0) then hovered = true end @@ -55705,7 +55748,7 @@ function ImGui.ButtonEx(label, size_arg, flags) -- [Luau] scalar pos, no temporary ImVec2 local pos_x, pos_y = window.DC.CursorPos.x, window.DC.CursorPos.y -- Don't modify the cursor! local frame_padding = style.FramePadding - if bit32.band(flags, ImGuiButtonFlags.AlignTextBaseLine) ~= 0 and frame_padding.y < window.DC.CurrLineTextBaseOffset then -- Try to vertically align buttons that are smaller/have no padding so that text baseline matches (bit hacky, since it shouldn't be a flag) + if bit32.band(flags, 32768 --[[ImGuiButtonFlags.AlignTextBaseLine]]) ~= 0 and frame_padding.y < window.DC.CurrLineTextBaseOffset then -- Try to vertically align buttons that are smaller/have no padding so that text baseline matches (bit hacky, since it shouldn't be a flag) pos_y = pos_y + window.DC.CurrLineTextBaseOffset - frame_padding.y end local size = ImGui.CalcItemSize(size_arg, label_size.x + frame_padding.x * 2.0, label_size.y + frame_padding.y * 2.0) @@ -55721,11 +55764,11 @@ function ImGui.ButtonEx(label, size_arg, flags) -- Render local col if held and hovered then - col = ImGui.GetColorU32(ImGuiCol.ButtonActive) + col = ImGui.GetColorU32(24 --[[ImGuiCol.ButtonActive]]) elseif hovered then - col = ImGui.GetColorU32(ImGuiCol.ButtonHovered) + col = ImGui.GetColorU32(23 --[[ImGuiCol.ButtonHovered]]) else - col = ImGui.GetColorU32(ImGuiCol.Button) + col = ImGui.GetColorU32(22 --[[ImGuiCol.Button]]) end ImGui.RenderNavCursor(bb, id) @@ -55750,7 +55793,7 @@ end --- @param size_arg? ImVec2 --- @return bool function ImGui.Button(label, size_arg) - return ImGui.ButtonEx(label, size_arg, ImGuiButtonFlags.None) + return ImGui.ButtonEx(label, size_arg, 0 --[[ImGuiButtonFlags.None]]) end -- Small buttons fits within text without additional vertical spacing. @@ -55760,7 +55803,7 @@ function ImGui.SmallButton(label) local g = GImGui local backup_padding_y = g.Style.FramePadding.y g.Style.FramePadding.y = 0.0 - local pressed = ImGui.ButtonEx(label, ImVec2(0, 0), ImGuiButtonFlags.AlignTextBaseLine) + local pressed = ImGui.ButtonEx(label, ImVec2(0, 0), 32768 --[[ImGuiButtonFlags.AlignTextBaseLine]]) g.Style.FramePadding.y = backup_padding_y return pressed end @@ -55779,13 +55822,13 @@ function ImGui.InvisibleButton(str_id, size_arg, flags) end -- Ensure zero-size fits to contents - local size = ImGui.CalcItemSize(ImVec2(size_arg.x ~= 0.0 and size_arg.x or -FLT_MIN, size_arg.y ~= 0.0 and size_arg.y or -FLT_MIN), 0.0, 0.0) + local size = ImGui.CalcItemSize(ImVec2(size_arg.x ~= 0.0 and size_arg.x or -1.1754943508223e-38 --[[FLT_MIN]], size_arg.y ~= 0.0 and size_arg.y or -1.1754943508223e-38 --[[FLT_MIN]]), 0.0, 0.0) local id = window:GetID(str_id) local bb = ImRect(window.DC.CursorPos, window.DC.CursorPos + size) ImGui.ItemSize(size) - local item_flags = (bit32.band(flags, ImGuiButtonFlags.EnableNav) ~= 0) and ImGuiItemFlags.None or ImGuiItemFlags.NoNav + local item_flags = (bit32.band(flags, 8 --[[ImGuiButtonFlags.EnableNav]]) ~= 0) and 0 --[[ImGuiItemFlags.None]] or 2 --[[ImGuiItemFlags.NoNav]] if not ImGui.ItemAdd(bb, id, nil, item_flags) then return false end @@ -55821,8 +55864,8 @@ function ImGui.ArrowButtonEx(str_id, dir, size, flags) local pressed, hovered, held = ImGui.ButtonBehavior(bb, id, flags) -- Render - local bg_col = ImGui.GetColorU32((held and hovered) and ImGuiCol.ButtonActive or hovered and ImGuiCol.ButtonHovered or ImGuiCol.Button) - local text_col = ImGui.GetColorU32(ImGuiCol.Text) + local bg_col = ImGui.GetColorU32((held and hovered) and 24 --[[ImGuiCol.ButtonActive]] or hovered and 23 --[[ImGuiCol.ButtonHovered]] or 22 --[[ImGuiCol.Button]]) + local text_col = ImGui.GetColorU32(0 --[[ImGuiCol.Text]]) ImGui.RenderNavCursor(bb, id) ImGui.RenderFrame(bb.Min, bb.Max, bg_col, true, g.Style.FrameRounding) ImGui.RenderArrow(window.DrawList, bb.Min + ImVec2(ImMax(0.0, (size.x - g.FontSize) * 0.5), ImMax(0.0, (size.y - g.FontSize) * 0.5)), text_col, dir) @@ -55835,7 +55878,7 @@ end --- @param dir ImGuiDir function ImGui.ArrowButton(str_id, dir) local sz = ImGui.GetFrameHeight() - return ImGui.ArrowButtonEx(str_id, dir, ImVec2(sz, sz), ImGuiButtonFlags.None) + return ImGui.ArrowButtonEx(str_id, dir, ImVec2(sz, sz), 0 --[[ImGuiButtonFlags.None]]) end -- Button to close a window @@ -55870,9 +55913,9 @@ function ImGui.CloseButton(id, pos) -- Render local bg_col if held then - bg_col = ImGui.GetColorU32(ImGuiCol.ButtonActive) + bg_col = ImGui.GetColorU32(24 --[[ImGuiCol.ButtonActive]]) else - bg_col = ImGui.GetColorU32(ImGuiCol.ButtonHovered) + bg_col = ImGui.GetColorU32(23 --[[ImGuiCol.ButtonHovered]]) end if hovered then @@ -55881,7 +55924,7 @@ function ImGui.CloseButton(id, pos) local cross_center = bb:GetCenter() - ImVec2(0.5, 0.5) local cross_extent = g.FontSize * 0.5 * 0.7071 - 1 - local cross_col = ImGui.GetColorU32(ImGuiCol.Text) + local cross_col = ImGui.GetColorU32(0 --[[ImGuiCol.Text]]) local cross_thickness = 1.0 -- FIXME-DPI window.DrawList:AddLine(cross_center + ImVec2(cross_extent, cross_extent), cross_center + ImVec2(-cross_extent, -cross_extent), cross_col, cross_thickness) window.DrawList:AddLine(cross_center + ImVec2(cross_extent, -cross_extent), cross_center + ImVec2(-cross_extent, cross_extent), cross_col, cross_thickness) @@ -55903,13 +55946,13 @@ function ImGui.CollapseButton(id, pos) -- Render if hovered then - window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(ImGuiCol.ButtonHovered)) + 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(ImGuiCol.Text), ImGuiDir.Right, 1) + ImGui.RenderArrow(window.DrawList, bb.Min, ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), 1 --[[ImGuiDir.Right]], 1) else - ImGui.RenderArrow(window.DrawList, bb.Min, ImGui.GetColorU32(ImGuiCol.Text), ImGuiDir.Down, 1) + ImGui.RenderArrow(window.DrawList, bb.Min, ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), 3 --[[ImGuiDir.Down]], 1) end return pressed @@ -55919,7 +55962,7 @@ end --- @param axis ImGuiAxis --- @return ImGuiID function ImGui.GetWindowScrollbarID(window, axis) - if axis == ImGuiAxis.X then + if axis == 1 --[[ImGuiAxis.X]] then return window:GetID("#SCROLLX") else return window:GetID("#SCROLLY") @@ -55937,13 +55980,13 @@ function ImGui.GetWindowScrollbarRect(window, axis) local inner_rect = window.InnerRect -- (ScrollbarSizes.x = width of Y scrollbar; ScrollbarSizes.y = height of X scrollbar) - local scrollbar_size = window.ScrollbarSizes[axis == ImGuiAxis.X and ImGuiAxis.Y or ImGuiAxis.X] - IM_ASSERT(scrollbar_size >= 0.0) + local scrollbar_size = window.ScrollbarSizes[axis == 1 --[[ImGuiAxis.X]] and 2 --[[ImGuiAxis.Y]] or 1 --[[ImGuiAxis.X]]] + assert(scrollbar_size >= 0.0) local border_size = IM_ROUND(window.WindowBorderSize * 0.5) - local border_top = (bit32.band(window.Flags, ImGuiWindowFlags.MenuBar) ~= 0) and IM_ROUND(g.Style.FrameBorderSize * 0.5) or (bit32.band(window.Flags, ImGuiWindowFlags.NoTitleBar) ~= 0 and border_size or 0) + local border_top = (bit32.band(window.Flags, 1024 --[[ImGuiWindowFlags.MenuBar]]) ~= 0) and IM_ROUND(g.Style.FrameBorderSize * 0.5) or (bit32.band(window.Flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) ~= 0 and border_size or 0) - if axis == ImGuiAxis.X then + if axis == 1 --[[ImGuiAxis.X]] then return ImRect(inner_rect.Min.x + border_size, ImMax(outer_rect.Min.y + border_size, outer_rect.Max.y - border_size - scrollbar_size), inner_rect.Max.x - border_size, outer_rect.Max.y - border_size) else return ImRect(ImMax(outer_rect.Min.x, outer_rect.Max.x - border_size - scrollbar_size), inner_rect.Min.y + border_top, outer_rect.Max.x - border_size, inner_rect.Max.y - border_size) @@ -55997,7 +56040,7 @@ function ImGui.ScrollbarEx(bb_frame, id, axis, p_scroll_v, size_visible_v, size_ -- When we are too small, start hiding and disabling the grab (this reduce visual noise on very small window and facilitate using the window resize grab) local alpha = 1.0 - if axis == ImGuiAxis.Y and bb_frame_height < bb_frame_width then + if axis == 2 --[[ImGuiAxis.Y]] and bb_frame_height < bb_frame_width then alpha = ImSaturate(bb_frame_height / ImMax(bb_frame_width * 2.0, 1.0)) end if alpha <= 0.0 then @@ -56015,7 +56058,7 @@ function ImGui.ScrollbarEx(bb_frame, id, axis, p_scroll_v, size_visible_v, size_ -- V denote the main, longer axis of the scrollbar (= height for a vertical scrollbar) local scrollbar_size_v - if axis == ImGuiAxis.X then + if axis == 1 --[[ImGuiAxis.X]] then scrollbar_size_v = bb:GetWidth() else scrollbar_size_v = bb:GetHeight() @@ -56027,7 +56070,7 @@ function ImGui.ScrollbarEx(bb_frame, id, axis, p_scroll_v, size_visible_v, size_ -- Calculate the height of our grabbable box. It generally represent the amount visible (vs the total scrollable amount) -- But we maintain a minimum size in pixel to allow for the user to still aim inside. - IM_ASSERT(ImMax(size_contents_v, size_visible_v) > 0.0) -- Adding this assert to check if the ImMax(XXX,1.0f) is still needed. PLEASE CONTACT ME if this triggers. + assert(ImMax(size_contents_v, size_visible_v) > 0.0) -- Adding this assert to check if the ImMax(XXX,1.0f) is still needed. PLEASE CONTACT ME if this triggers. local win_size_v = ImMax(ImMax(size_contents_v, size_visible_v), 1) local grab_h_minsize = ImMin(bb:GetSize()[axis], style.GrabMinSize) local grab_h_pixels = ImTrunc(ImClamp(scrollbar_size_v * (size_visible_v / win_size_v), grab_h_minsize, scrollbar_size_v)) @@ -56036,11 +56079,11 @@ function ImGui.ScrollbarEx(bb_frame, id, axis, p_scroll_v, size_visible_v, size_ -- As a special thing, we allow scrollbar near the edge of a screen/viewport to be reachable with mouse at the extreme edge (#9276) local bb_hit = ImRect() ImRect_Copy(bb_hit, bb_frame) - ImGui.ExtendHitBoxWhenNearViewportEdge(window, bb_hit, g.Style.WindowBorderSize, ImGuiAxis.X + ImGuiAxis.Y - axis) -- swap axis here + ImGui.ExtendHitBoxWhenNearViewportEdge(window, bb_hit, g.Style.WindowBorderSize, 1 --[[ImGuiAxis.X]] + 2 --[[ImGuiAxis.Y]] - axis) -- swap axis here -- Handle input right away. None of the code of Begin() is relying on scrolling position before calling Scrollbar(). - ImGui.ItemAdd(bb_frame, id, nil, ImGuiItemFlags.NoNav) - local pressed, hovered, held = ImGui.ButtonBehavior(bb_hit, id, ImGuiButtonFlags.NoNavFocus) + ImGui.ItemAdd(bb_frame, id, nil, 2 --[[ImGuiItemFlags.NoNav]]) + local pressed, hovered, held = ImGui.ButtonBehavior(bb_hit, id, 262144 --[[ImGuiButtonFlags.NoNavFocus]]) local scroll_max = ImMax(1, size_contents_v - size_visible_v) local scroll_ratio = ImSaturate(p_scroll_v / scroll_max) @@ -56085,7 +56128,7 @@ function ImGui.ScrollbarEx(bb_frame, id, axis, p_scroll_v, size_visible_v, size_ p_scroll_v = scroll_v_norm * scroll_max else -- Page by page - if ImGui.IsMouseClickedEx(ImGuiMouseButton.Left, ImGuiInputFlags.Repeat) and held_dir == g.ScrollbarSeekMode then + if ImGui.IsMouseClickedEx(0 --[[ImGuiMouseButton.Left]], 1 --[[ImGuiInputFlags.Repeat]]) and held_dir == g.ScrollbarSeekMode then local page_dir if g.ScrollbarSeekMode > 0.0 then page_dir = 1.0 @@ -56106,18 +56149,18 @@ function ImGui.ScrollbarEx(bb_frame, id, axis, p_scroll_v, size_visible_v, size_ end -- Render - local bg_col = ImGui.GetColorU32(ImGuiCol.ScrollbarBg) + local bg_col = ImGui.GetColorU32(14 --[[ImGuiCol.ScrollbarBg]]) local grab_col if held then - grab_col = ImGui.GetColorU32(ImGuiCol.ScrollbarGrabActive, alpha) + grab_col = ImGui.GetColorU32(17 --[[ImGuiCol.ScrollbarGrabActive]], alpha) elseif hovered then - grab_col = ImGui.GetColorU32(ImGuiCol.ScrollbarGrabHovered, alpha) + grab_col = ImGui.GetColorU32(16 --[[ImGuiCol.ScrollbarGrabHovered]], alpha) else - grab_col = ImGui.GetColorU32(ImGuiCol.ScrollbarGrab, alpha) + grab_col = ImGui.GetColorU32(15 --[[ImGuiCol.ScrollbarGrab]], alpha) end window.DrawList:AddRectFilled(bb_frame.Min, bb_frame.Max, bg_col, window.WindowRounding, draw_rounding_flags) local grab_rect - if axis == ImGuiAxis.X then + if axis == 1 --[[ImGuiAxis.X]] then local x1 = ImLerp(bb.Min.x, bb.Max.x, grab_v_norm) grab_rect = ImRect(x1, bb.Min.y, x1 + grab_h_pixels, bb.Max.y) else @@ -56139,7 +56182,7 @@ function ImGui.Scrollbar(axis) -- Calculate scrollbar bounding box local bb = ImGui.GetWindowScrollbarRect(window, axis) local rounding_corners = ImGui.CalcRoundingFlagsForRectInRect(bb, window:Rect(), g.Style.WindowBorderSize) - local k = (axis == ImGuiAxis.X) and "x" or "y" -- [Luau] named key: ImVec2[axis] goes through IM_VEC2.__index + local k = (axis == 1 --[[ImGuiAxis.X]]) and "x" or "y" -- [Luau] named key: ImVec2[axis] goes through IM_VEC2.__index local size_visible = window.InnerRect.Max[k] - window.InnerRect.Min[k] local size_contents = window.ContentSize[k] + window.WindowPadding[k] * 2.0 local scroll = window.Scroll[k] @@ -56186,7 +56229,7 @@ function ImGui.ImageWithBg(tex_ref, image_size, uv0, uv1, bg_col, tint_col) window.DrawList:AddImage(tex_ref, bb.Min + padding, bb.Max - padding, uv0, uv1, ImGui.GetColorU32(tint_col)) end if g.Style.ImageBorderSize > 0.0 then - window.DrawList:AddRect(bb.Min, bb.Max, ImGui.GetColorU32(ImGuiCol.Border), rounding, g.Style.ImageBorderSize, ImDrawFlags.None) + window.DrawList:AddRect(bb.Min, bb.Max, ImGui.GetColorU32(5 --[[ImGuiCol.Border]]), rounding, g.Style.ImageBorderSize, 0 --[[ImDrawFlags.None]]) end end @@ -56225,7 +56268,7 @@ function ImGui.ImageButtonEx(id, tex_ref, image_size, uv0, uv1, bg_col, tint_col local pressed, hovered, held = ImGui.ButtonBehavior(bb, id, flags) -- Render - local col = ImGui.GetColorU32((held and hovered) and ImGuiCol.ButtonActive or hovered and ImGuiCol.ButtonHovered or ImGuiCol.Button) + local col = ImGui.GetColorU32((held and hovered) and 24 --[[ImGuiCol.ButtonActive]] or hovered and 23 --[[ImGuiCol.ButtonHovered]] or 22 --[[ImGuiCol.Button]]) ImGui.RenderNavCursor(bb, id) ImGui.RenderFrame(bb.Min, bb.Max, col, true, g.Style.FrameRounding) if bg_col.w > 0.0 then @@ -56289,7 +56332,7 @@ function ImGui.Checkbox(label, v) local total_bb = ImRect(pos_x, pos_y, pos_x + total_width, pos_y + (label_size.y + style.FramePadding.y * 2.0)) ImGui.ItemSize(total_bb, style.FramePadding.y) local is_visible = ImGui.ItemAdd(total_bb, id) - local is_multi_select = (bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.IsMultiSelect) ~= 0) + local is_multi_select = (bit32.band(g.LastItemData.ItemFlags, 4194304 --[[ImGuiItemFlags.IsMultiSelect]]) ~= 0) if not is_visible then if not is_multi_select or not g.BoxSelectState.UnclipMode or not g.BoxSelectState.UnclipRect:Overlaps(total_bb) then -- Extra layer of "no logic clip" for box-select support -- IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0)) @@ -56319,12 +56362,12 @@ function ImGui.Checkbox(label, v) end local check_bb = ImRect(pos_x, pos_y, pos_x + square_sz, pos_y + square_sz) - local mixed_value = (bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.MixedValue) ~= 0) + local mixed_value = (bit32.band(g.LastItemData.ItemFlags, 4096 --[[ImGuiItemFlags.MixedValue]]) ~= 0) if is_visible then ImGui.RenderNavCursor(total_bb, id) - local bg_col = ImGui.GetColorU32((held and hovered) and ImGuiCol.FrameBgActive or (hovered and ImGuiCol.FrameBgHovered or ((mixed_value or checked) and ImGuiCol.CheckboxSelectedBg or ImGuiCol.FrameBg))) - local check_col = ImGui.GetColorU32(ImGuiCol.CheckMark) + local bg_col = ImGui.GetColorU32((held and hovered) and 9 --[[ImGuiCol.FrameBgActive]] or (hovered and 8 --[[ImGuiCol.FrameBgHovered]] or ((mixed_value or checked) and 19 --[[ImGuiCol.CheckboxSelectedBg]] or 7 --[[ImGuiCol.FrameBg]]))) + local check_col = ImGui.GetColorU32(18 --[[ImGuiCol.CheckMark]]) ImGui.RenderFrame(check_bb.Min, check_bb.Max, bg_col, true, style.FrameRounding) if mixed_value then @@ -56363,7 +56406,7 @@ function ImGui.CheckboxFlags(label, flags, flags_value) local pressed if not all_on and any_on then local g = GImGui - g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, ImGuiItemFlags.MixedValue) + g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, 4096 --[[ImGuiItemFlags.MixedValue]]) pressed, all_on = ImGui.Checkbox(label, all_on) else pressed, all_on = ImGui.Checkbox(label, all_on) @@ -56418,22 +56461,22 @@ function ImGui.RadioButtonEx(label, active) local num_segment = window.DrawList:_CalcCircleAutoSegmentCount(radius) local col if held and hovered then - col = ImGui.GetColorU32(ImGuiCol.FrameBgActive) + col = ImGui.GetColorU32(9 --[[ImGuiCol.FrameBgActive]]) else if hovered then - col = ImGui.GetColorU32(ImGuiCol.FrameBgHovered) + col = ImGui.GetColorU32(8 --[[ImGuiCol.FrameBgHovered]]) else - col = ImGui.GetColorU32(ImGuiCol.FrameBg) + col = ImGui.GetColorU32(7 --[[ImGuiCol.FrameBg]]) end end window.DrawList:AddCircleFilled(center, radius, col, num_segment) if active then local pad = ImMax(1.0, IM_TRUNC(square_sz / 6.0)) - window.DrawList:AddCircleFilled(center, radius - pad, ImGui.GetColorU32(ImGuiCol.CheckMark)) + window.DrawList:AddCircleFilled(center, radius - pad, ImGui.GetColorU32(18 --[[ImGuiCol.CheckMark]])) end if style.FrameBorderSize > 0.0 then - window.DrawList:AddCircle(center + ImVec2(1, 1), radius, ImGui.GetColorU32(ImGuiCol.BorderShadow), num_segment, style.FrameBorderSize) - window.DrawList:AddCircle(center, radius, ImGui.GetColorU32(ImGuiCol.Border), num_segment, style.FrameBorderSize) + window.DrawList:AddCircle(center + ImVec2(1, 1), radius, ImGui.GetColorU32(6 --[[ImGuiCol.BorderShadow]]), num_segment, style.FrameBorderSize) + window.DrawList:AddCircle(center, radius, ImGui.GetColorU32(5 --[[ImGuiCol.Border]]), num_segment, style.FrameBorderSize) end local label_pos = ImVec2(check_bb.Max.x + style.ItemInnerSpacing.x, check_bb.Min.y + style.FramePadding.y) if g.LogEnabled then @@ -56465,7 +56508,7 @@ end --- @param size_arg? ImVec2 --- @param overlay? string function ImGui.ProgressBar(fraction, size_arg, overlay) - if size_arg == nil then size_arg = ImVec2(-FLT_MIN, 0) end + if size_arg == nil then size_arg = ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], 0) end local window = ImGui.GetCurrentWindow() if window.SkipItems then @@ -56503,13 +56546,13 @@ function ImGui.ProgressBar(fraction, size_arg, overlay) end -- Render - ImGui.RenderFrame(bb.Min, bb.Max, ImGui.GetColorU32(ImGuiCol.FrameBg), true, style.FrameRounding) + ImGui.RenderFrame(bb.Min, bb.Max, ImGui.GetColorU32(7 --[[ImGuiCol.FrameBg]]), true, style.FrameRounding) bb:Expand(ImVec2(-style.FrameBorderSize, -style.FrameBorderSize)) local fill_x0 = ImLerp(bb.Min.x, bb.Max.x, fill_n0) local fill_x1 = ImLerp(bb.Min.x, bb.Max.x, fill_n1) if fill_x0 < fill_x1 then - ImGui.RenderRectFilledInRangeH(window.DrawList, bb, ImGui.GetColorU32(ImGuiCol.PlotHistogram), fill_x0, fill_x1, style.FrameRounding) + ImGui.RenderRectFilledInRangeH(window.DrawList, bb, ImGui.GetColorU32(46 --[[ImGuiCol.PlotHistogram]]), fill_x0, fill_x1, style.FrameRounding) end -- Default displaying the fraction as percentage string, but user can override it @@ -56544,7 +56587,7 @@ function ImGui.Bullet() end -- Render and stay on same line - local text_col = ImGui.GetColorU32(ImGuiCol.Text) + local text_col = ImGui.GetColorU32(0 --[[ImGuiCol.Text]]) ImGui.RenderBullet(window.DrawList, bb.Min + ImVec2(style.FramePadding.x + g.FontSize * 0.5, line_height * 0.5), text_col) ImGui.SameLine(0, style.FramePadding.x * 2.0) end @@ -56576,11 +56619,11 @@ function ImGui.TextLink(label) ImGui.RenderNavCursor(bb, id) if hovered then - ImGui.SetMouseCursor(ImGuiMouseCursor.Hand) + ImGui.SetMouseCursor(7 --[[ImGuiMouseCursor.Hand]]) end local text_colf = ImVec4() - ImVec4_Copy(text_colf, g.Style.Colors[ImGuiCol.TextLink]) + ImVec4_Copy(text_colf, g.Style.Colors[53 --[[ImGuiCol.TextLink]]]) local line_colf = ImVec4() ImVec4_Copy(line_colf, text_colf) do @@ -56599,7 +56642,7 @@ function ImGui.TextLink(label) local line_y = bb.Max.y + ImFloor(g.FontBaked.Descent * g.FontBakedScale * 0.20) window.DrawList:AddLineH(bb.Min.x, bb.Max.x, line_y, ImGui.GetColorU32(line_colf), 1.0 * ImTrunc(g.Style._MainScale)) -- FIXME-TEXT: Underline mode -- FIXME-DPI - ImGui.PushStyleColor(ImGuiCol.Text, ImGui.GetColorU32(text_colf)) + ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], ImGui.GetColorU32(text_colf)) ImGui.RenderText(bb.Min, label, 1, label_end, false) ImGui.PopStyleColor() @@ -56619,10 +56662,10 @@ function ImGui.TextLinkOpenURL(label, url) g.PlatformIO.Platform_OpenInShellFn(g, url) end - ImGui.SetItemTooltip(ImGui.LocalizeGetMsg(ImGuiLocKey.OpenLink_s), url) -- It is more reassuring for user to _always_ display URL when it is the same as the label. + ImGui.SetItemTooltip(ImGui.LocalizeGetMsg(11 --[[ImGuiLocKey.OpenLink_s]]), url) -- It is more reassuring for user to _always_ display URL when it is the same as the label. if ImGui.BeginPopupContextItem() then - if ImGui.MenuItem(ImGui.LocalizeGetMsg(ImGuiLocKey.CopyLink)) then + if ImGui.MenuItem(ImGui.LocalizeGetMsg(12 --[[ImGuiLocKey.CopyLink]])) then ImGui.SetClipboardText(url) end ImGui.EndPopup() @@ -56674,7 +56717,7 @@ function ImGui.NewLine() local g = GImGui local backup_layout_type = window.DC.LayoutType - window.DC.LayoutType = ImGuiLayoutType.Vertical + window.DC.LayoutType = 1 --[[ImGuiLayoutType.Vertical]] window.DC.IsSameLine = false if window.DC.CurrLineSize.y > 0.0 then -- In the event that we are on a line with items that is smaller that FontSize high, we will preserve its height. @@ -56711,10 +56754,10 @@ function ImGui.SeparatorEx(flags, thickness) end local g = GImGui - IM_ASSERT(ImIsPowerOfTwo(bit32.band(flags, bit32.bor(ImGuiSeparatorFlags.Horizontal, ImGuiSeparatorFlags.Vertical)))) -- Check that only 1 option is selected - IM_ASSERT(thickness > 0.0) + assert(ImIsPowerOfTwo(bit32.band(flags, bit32.bor(1 --[[ImGuiSeparatorFlags.Horizontal]], 2 --[[ImGuiSeparatorFlags.Vertical]])))) -- Check that only 1 option is selected + assert(thickness > 0.0) - if bit32.band(flags, ImGuiSeparatorFlags.Vertical) ~= 0 then + if bit32.band(flags, 2 --[[ImGuiSeparatorFlags.Vertical]]) ~= 0 then -- Vertical separator, for menu bars (use current line height). local y1 = window.DC.CursorPos.y local y2 = window.DC.CursorPos.y + window.DC.CurrLineSize.y @@ -56726,11 +56769,11 @@ function ImGui.SeparatorEx(flags, thickness) end -- Draw - window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(ImGuiCol.Separator)) + window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(28 --[[ImGuiCol.Separator]])) if g.LogEnabled then ImGui.LogText(" |") end - elseif bit32.band(flags, ImGuiSeparatorFlags.Horizontal) ~= 0 then + elseif bit32.band(flags, 1 --[[ImGuiSeparatorFlags.Horizontal]]) ~= 0 then -- Horizontal Separator local x1 = window.DC.CursorPos.x local x2 = window.WorkRect.Max.x @@ -56738,7 +56781,7 @@ function ImGui.SeparatorEx(flags, thickness) -- Preserve legacy behavior inside Columns() -- Before Tables API happened, we relied on Separator() to span all columns of a Columns() set. -- We currently don't need to provide the same feature for tables because tables naturally have border features. - local columns = (bit32.band(flags, ImGuiSeparatorFlags.SpanAllColumns) ~= 0) and window.DC.CurrentColumns or nil + local columns = (bit32.band(flags, 4 --[[ImGuiSeparatorFlags.SpanAllColumns]]) ~= 0) and window.DC.CurrentColumns or nil if columns then x1 = window.Pos.x + window.DC.Indent.x -- Used to be Pos.x before 2023/10/03 x2 = window.Pos.x + window.Size.x @@ -56758,7 +56801,7 @@ function ImGui.SeparatorEx(flags, thickness) if ImGui.ItemAdd(bb, 0) then -- Draw - window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(ImGuiCol.Separator)) + window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(28 --[[ImGuiCol.Separator]])) if g.LogEnabled then ImGui.LogRenderedText(bb.Min, "--------------------------------") end @@ -56780,15 +56823,15 @@ function ImGui.Separator() -- Those flags should eventually be configurable by the user local flags - if window.DC.LayoutType == ImGuiLayoutType.Horizontal then - flags = ImGuiSeparatorFlags.Vertical + if window.DC.LayoutType == 0 --[[ImGuiLayoutType.Horizontal]] then + flags = 2 --[[ImGuiSeparatorFlags.Vertical]] else - flags = ImGuiSeparatorFlags.Horizontal + flags = 1 --[[ImGuiSeparatorFlags.Horizontal]] end -- Only applies to legacy Columns() api as they relied on Separator() a lot. if window.DC.CurrentColumns then - flags = bit32.bor(flags, ImGuiSeparatorFlags.SpanAllColumns) + flags = bit32.bor(flags, 4 --[[ImGuiSeparatorFlags.SpanAllColumns]]) end ImGui.SeparatorEx(flags, ImMax(g.Style.SeparatorSize, 1.0)) @@ -56828,7 +56871,7 @@ function ImGui.SeparatorTextEx(id, label, label_end, extra_w) -- This allows using SameLine() to position something in the 'extra_w' window.DC.CursorPosPrevLine.x = label_pos.x + label_size.x - local separator_col = ImGui.GetColorU32(ImGuiCol.Separator) + local separator_col = ImGui.GetColorU32(28 --[[ImGuiCol.Separator]]) if label_size.x > 0.0 then local sep1_x2 = label_pos.x - style.ItemSpacing.x @@ -56891,7 +56934,7 @@ end local function CalcMaxPopupHeightFromItemCount(items_count) local g = GImGui if items_count <= 0 then - return FLT_MAX + return 3.4028234663853e+38 --[[FLT_MAX]] end return (g.FontSize + g.Style.ItemSpacing.y) * items_count - g.Style.ItemSpacing.y + (g.Style.WindowPadding.y * 2) end @@ -56913,13 +56956,13 @@ function ImGui.BeginCombo(label, preview_value, flags) local style = g.Style local id = window:GetID(label) - IM_ASSERT(bit32.band(flags, bit32.bor(ImGuiComboFlags.NoArrowButton, ImGuiComboFlags.NoPreview)) ~= bit32.bor(ImGuiComboFlags.NoArrowButton, ImGuiComboFlags.NoPreview)) -- Can't use both flags together - if bit32.band(flags, ImGuiComboFlags.WidthFitPreview) ~= 0 then - IM_ASSERT(bit32.band(flags, bit32.bor(ImGuiComboFlags.NoPreview, ImGuiComboFlags.CustomPreview)) == 0) + assert(bit32.band(flags, bit32.bor(32 --[[ImGuiComboFlags.NoArrowButton]], 64 --[[ImGuiComboFlags.NoPreview]])) ~= bit32.bor(32 --[[ImGuiComboFlags.NoArrowButton]], 64 --[[ImGuiComboFlags.NoPreview]])) -- Can't use both flags together + if bit32.band(flags, 128 --[[ImGuiComboFlags.WidthFitPreview]]) ~= 0 then + assert(bit32.band(flags, bit32.bor(64 --[[ImGuiComboFlags.NoPreview]], 1048576 --[[ImGuiComboFlags.CustomPreview]])) == 0) end local arrow_size - if (bit32.band(flags, ImGuiComboFlags.NoArrowButton) ~= 0) then + if (bit32.band(flags, 32 --[[ImGuiComboFlags.NoArrowButton]]) ~= 0) then arrow_size = 0.0 else arrow_size = ImGui.GetFrameHeight() @@ -56929,16 +56972,16 @@ function ImGui.BeginCombo(label, preview_value, flags) local label_size = ImGui.CalcTextSize(label, label_end, false) local preview_width - if ((bit32.band(flags, ImGuiComboFlags.WidthFitPreview) ~= 0) and (preview_value ~= nil)) then + if ((bit32.band(flags, 128 --[[ImGuiComboFlags.WidthFitPreview]]) ~= 0) and (preview_value ~= nil)) then preview_width = ImGui.CalcTextSize(preview_value, nil, false).x else preview_width = 0.0 end local w - if bit32.band(flags, ImGuiComboFlags.NoPreview) ~= 0 then + if bit32.band(flags, 64 --[[ImGuiComboFlags.NoPreview]]) ~= 0 then w = arrow_size - elseif bit32.band(flags, ImGuiComboFlags.WidthFitPreview) ~= 0 then + elseif bit32.band(flags, 128 --[[ImGuiComboFlags.WidthFitPreview]]) ~= 0 then w = arrow_size + preview_width + style.FramePadding.x * 2.0 else w = ImGui.CalcItemWidth() @@ -56956,44 +56999,44 @@ function ImGui.BeginCombo(label, preview_value, flags) -- Open on click local pressed, hovered, held = ImGui.ButtonBehavior(bb, id) local popup_id = ImHashStr("##ComboPopup", nil, id) - local popup_open = ImGui.IsPopupOpen(popup_id, ImGuiPopupFlags.None) + local popup_open = ImGui.IsPopupOpen(popup_id, 0 --[[ImGuiPopupFlags.None]]) if pressed and not popup_open then - ImGui.OpenPopupEx(popup_id, ImGuiPopupFlags.None) + ImGui.OpenPopupEx(popup_id, 0 --[[ImGuiPopupFlags.None]]) popup_open = true end -- Render shape - local frame_col = ImGui.GetColorU32(hovered and ImGuiCol.FrameBgHovered or ImGuiCol.FrameBg) + local frame_col = ImGui.GetColorU32(hovered and 8 --[[ImGuiCol.FrameBgHovered]] or 7 --[[ImGuiCol.FrameBg]]) local value_x2 = ImMax(bb.Min.x, bb.Max.x - arrow_size) ImGui.RenderNavCursor(bb, id) - if bit32.band(flags, ImGuiComboFlags.NoPreview) == 0 then - window.DrawList:AddRectFilled(bb.Min, ImVec2(value_x2, bb.Max.y), frame_col, style.FrameRounding, (bit32.band(flags, ImGuiComboFlags.NoArrowButton) ~= 0) and ImDrawFlags.RoundCornersAll or ImDrawFlags.RoundCornersLeft) + if bit32.band(flags, 64 --[[ImGuiComboFlags.NoPreview]]) == 0 then + window.DrawList:AddRectFilled(bb.Min, ImVec2(value_x2, bb.Max.y), frame_col, style.FrameRounding, (bit32.band(flags, 32 --[[ImGuiComboFlags.NoArrowButton]]) ~= 0) and 240 --[[ImDrawFlags.RoundCornersAll]] or 80 --[[ImDrawFlags.RoundCornersLeft]]) end - if bit32.band(flags, ImGuiComboFlags.NoArrowButton) == 0 then - local bg_col = ImGui.GetColorU32((popup_open or hovered) and ImGuiCol.ButtonHovered or ImGuiCol.Button) - local text_col = ImGui.GetColorU32(ImGuiCol.Text) + if bit32.band(flags, 32 --[[ImGuiComboFlags.NoArrowButton]]) == 0 then + local bg_col = ImGui.GetColorU32((popup_open or hovered) and 23 --[[ImGuiCol.ButtonHovered]] or 22 --[[ImGuiCol.Button]]) + local text_col = ImGui.GetColorU32(0 --[[ImGuiCol.Text]]) - window.DrawList:AddRectFilled(ImVec2(value_x2, bb.Min.y), bb.Max, bg_col, style.FrameRounding, (w <= arrow_size) and ImDrawFlags.RoundCornersAll or ImDrawFlags.RoundCornersRight) + window.DrawList:AddRectFilled(ImVec2(value_x2, bb.Min.y), bb.Max, bg_col, style.FrameRounding, (w <= arrow_size) and 240 --[[ImDrawFlags.RoundCornersAll]] or 160 --[[ImDrawFlags.RoundCornersRight]]) if value_x2 + arrow_size - style.FramePadding.x <= bb.Max.x then - ImGui.RenderArrow(window.DrawList, ImVec2(value_x2 + style.FramePadding.y, bb.Min.y + style.FramePadding.y), text_col, ImGuiDir.Down, 1.0) + ImGui.RenderArrow(window.DrawList, ImVec2(value_x2 + style.FramePadding.y, bb.Min.y + style.FramePadding.y), text_col, 3 --[[ImGuiDir.Down]], 1.0) end end ImGui.RenderFrameBorder(bb.Min, bb.Max, style.FrameRounding) -- Custom preview - if bit32.band(flags, ImGuiComboFlags.CustomPreview) ~= 0 then + if bit32.band(flags, 1048576 --[[ImGuiComboFlags.CustomPreview]]) ~= 0 then g.ComboPreviewData.PreviewRect = ImRect(bb.Min.x, bb.Min.y, value_x2, bb.Max.y) - IM_ASSERT(preview_value == nil or preview_value == "") + assert(preview_value == nil or preview_value == "") preview_value = nil end -- Render preview and label - if preview_value ~= nil and bit32.band(flags, ImGuiComboFlags.NoPreview) == 0 then + if preview_value ~= nil and bit32.band(flags, 64 --[[ImGuiComboFlags.NoPreview]]) == 0 then if g.LogEnabled then ImGui.LogSetNextTextDecoration("{", "}") end @@ -57017,34 +57060,34 @@ end --- @param flags ImGuiComboFlags function ImGui.BeginComboPopup(popup_id, bb, flags) local g = GImGui - if not ImGui.IsPopupOpen(popup_id, ImGuiPopupFlags.None) then + if not ImGui.IsPopupOpen(popup_id, 0 --[[ImGuiPopupFlags.None]]) then g.NextWindowData:ClearFlags() return false end -- Set popup size local w = bb:GetWidth() - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasSizeConstraint) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 16 --[[ImGuiNextWindowDataFlags.HasSizeConstraint]]) ~= 0 then g.NextWindowData.SizeConstraintRect.Min.x = ImMax(g.NextWindowData.SizeConstraintRect.Min.x, w) else - if bit32.band(flags, ImGuiComboFlags.HeightMask_) == 0 then - flags = bit32.bor(flags, ImGuiComboFlags.HeightRegular) + if bit32.band(flags, 30 --[[ImGuiComboFlags.HeightMask_]]) == 0 then + flags = bit32.bor(flags, 4 --[[ImGuiComboFlags.HeightRegular]]) end - IM_ASSERT(ImIsPowerOfTwo(bit32.band(flags, ImGuiComboFlags.HeightMask_))) -- Only one + assert(ImIsPowerOfTwo(bit32.band(flags, 30 --[[ImGuiComboFlags.HeightMask_]]))) -- Only one local popup_max_height_in_items = -1 - if bit32.band(flags, ImGuiComboFlags.HeightRegular) ~= 0 then + if bit32.band(flags, 4 --[[ImGuiComboFlags.HeightRegular]]) ~= 0 then popup_max_height_in_items = 8 - elseif bit32.band(flags, ImGuiComboFlags.HeightSmall) ~= 0 then + elseif bit32.band(flags, 2 --[[ImGuiComboFlags.HeightSmall]]) ~= 0 then popup_max_height_in_items = 4 - elseif bit32.band(flags, ImGuiComboFlags.HeightLarge) ~= 0 then + elseif bit32.band(flags, 8 --[[ImGuiComboFlags.HeightLarge]]) ~= 0 then popup_max_height_in_items = 20 end local constraint_min = ImVec2(0.0, 0.0) - local constraint_max = ImVec2(FLT_MAX, FLT_MAX) - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasSize) == 0 or g.NextWindowData.SizeVal.x <= 0.0 then -- Don't apply constraints if user specified a size + local constraint_max = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]) + if bit32.band(g.NextWindowData.HasFlags, 2 --[[ImGuiNextWindowDataFlags.HasSize]]) == 0 or g.NextWindowData.SizeVal.x <= 0.0 then -- Don't apply constraints if user specified a size constraint_min.x = w end - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasSize) == 0 or g.NextWindowData.SizeVal.y <= 0.0 then + if bit32.band(g.NextWindowData.HasFlags, 2 --[[ImGuiNextWindowDataFlags.HasSize]]) == 0 or g.NextWindowData.SizeVal.y <= 0.0 then constraint_max.y = CalcMaxPopupHeightFromItemCount(popup_max_height_in_items) end ImGui.SetNextWindowSizeConstraints(constraint_min, constraint_max) @@ -57061,24 +57104,24 @@ function ImGui.BeginComboPopup(popup_id, bb, flags) if popup_window.WasActive then -- Always override 'AutoPosLastDirection' to not leave a chance for a past value to affect us. local size_expected = ImGui.CalcWindowNextAutoFitSize(popup_window) - popup_window.AutoPosLastDirection = (bit32.band(flags, ImGuiComboFlags.PopupAlignLeft) ~= 0) and ImGuiDir.Left or ImGuiDir.Down -- Left = "Below, Toward Left", Down = "Below, Toward Right (default)" + popup_window.AutoPosLastDirection = (bit32.band(flags, 1 --[[ImGuiComboFlags.PopupAlignLeft]]) ~= 0) and 0 --[[ImGuiDir.Left]] or 3 --[[ImGuiDir.Down]] -- Left = "Below, Toward Left", Down = "Below, Toward Right (default)" local r_outer = ImGui.GetPopupAllowedExtentRect(popup_window) local pos - pos, popup_window.AutoPosLastDirection = ImGui.FindBestWindowPosForPopupEx(bb:GetBL(), size_expected, popup_window.AutoPosLastDirection, r_outer, bb, ImGuiPopupPositionPolicy.ComboBox) + pos, popup_window.AutoPosLastDirection = ImGui.FindBestWindowPosForPopupEx(bb:GetBL(), size_expected, popup_window.AutoPosLastDirection, r_outer, bb, 1 --[[ImGuiPopupPositionPolicy.ComboBox]]) ImGui.SetNextWindowPos(pos) end end -- We don't use BeginPopupEx() solely because we have a custom name string, which we could make an argument to BeginPopupEx() - local window_flags = bit32.bor(ImGuiWindowFlags.AlwaysAutoResize, ImGuiWindowFlags.Popup, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoResize, ImGuiWindowFlags.NoSavedSettings, ImGuiWindowFlags.NoMove) - ImGui.PushStyleVarX(ImGuiStyleVar.WindowPadding, g.Style.FramePadding.x) -- Horizontally align ourselves with the framed text + local window_flags = bit32.bor(64 --[[ImGuiWindowFlags.AlwaysAutoResize]], 67108864 --[[ImGuiWindowFlags.Popup]], 1 --[[ImGuiWindowFlags.NoTitleBar]], 2 --[[ImGuiWindowFlags.NoResize]], 256 --[[ImGuiWindowFlags.NoSavedSettings]], 4 --[[ImGuiWindowFlags.NoMove]]) + ImGui.PushStyleVarX(2 --[[ImGuiStyleVar.WindowPadding]], g.Style.FramePadding.x) -- Horizontally align ourselves with the framed text local _, ret = ImGui.Begin(name, nil, window_flags) ImGui.PopStyleVar() if not ret then ImGui.EndPopup() if not g.IO.ConfigDebugBeginReturnValueOnce and not g.IO.ConfigDebugBeginReturnValueLoop then -- Begin may only return false with those debug tools activated. - IM_ASSERT(false) -- This should never happen as we tested for IsPopupOpen() above + assert(false) -- This should never happen as we tested for IsPopupOpen() above end return false end @@ -57111,11 +57154,11 @@ function ImGui.BeginComboPreview() local window = g.CurrentWindow local preview_data = g.ComboPreviewData - if window.SkipItems or not (bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.Visible) ~= 0) then + if window.SkipItems or not (bit32.band(g.LastItemData.StatusFlags, 256 --[[ImGuiItemStatusFlags.Visible]]) ~= 0) then return false end - IM_ASSERT(g.LastItemData.Rect.Min.x == preview_data.PreviewRect.Min.x and g.LastItemData.Rect.Min.y == preview_data.PreviewRect.Min.y) -- Didn't call after BeginCombo/EndCombo block or forgot to pass ImGuiComboFlags.CustomPreview flag? + assert(g.LastItemData.Rect.Min.x == preview_data.PreviewRect.Min.x and g.LastItemData.Rect.Min.y == preview_data.PreviewRect.Min.y) -- Didn't call after BeginCombo/EndCombo block or forgot to pass ImGuiComboFlags.CustomPreview flag? if not window.ClipRect:Overlaps(preview_data.PreviewRect) then -- Narrower test (optional) return false @@ -57130,7 +57173,7 @@ function ImGui.BeginComboPreview() ImVec2_Copy(window.DC.CursorPos, preview_data.PreviewRect.Min + g.Style.FramePadding) ImVec2_Copy(window.DC.CursorMaxPos, window.DC.CursorPos) - window.DC.LayoutType = ImGuiLayoutType.Horizontal + window.DC.LayoutType = 0 --[[ImGuiLayoutType.Horizontal]] window.DC.IsSameLine = false ImGui.PushClipRect(preview_data.PreviewRect.Min, preview_data.PreviewRect.Max, true) @@ -57221,18 +57264,18 @@ function ImGui.Combo(label, current_item, a, b, c, d) -- Call the getter to obtain the preview string which is a parameter to BeginCombo() local preview_value = nil - if bit32.band(bit32.bor(g.NextItemData.ItemFlagsSet, g.CurrentItemFlags), ImGuiItemFlags.MixedValue) ~= 0 then + if bit32.band(bit32.bor(g.NextItemData.ItemFlagsSet, g.CurrentItemFlags), 4096 --[[ImGuiItemFlags.MixedValue]]) ~= 0 then preview_value = "" elseif current_item >= 0 and current_item < items_count then preview_value = getter(user_data, current_item) end -- The old Combo() API exposed "popup_max_height_in_items". The new more general BeginCombo() API doesn't have/need it, but we emulate it here. - if popup_max_height_in_items ~= -1 and bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasSizeConstraint) == 0 then - ImGui.SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, CalcMaxPopupHeightFromItemCount(popup_max_height_in_items))) + if popup_max_height_in_items ~= -1 and bit32.band(g.NextWindowData.HasFlags, 16 --[[ImGuiNextWindowDataFlags.HasSizeConstraint]]) == 0 then + ImGui.SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(3.4028234663853e+38 --[[FLT_MAX]], CalcMaxPopupHeightFromItemCount(popup_max_height_in_items))) end - if not ImGui.BeginCombo(label, preview_value, ImGuiComboFlags.None) then + if not ImGui.BeginCombo(label, preview_value, 0 --[[ImGuiComboFlags.None]]) then return current_item, false end @@ -57315,7 +57358,7 @@ local GDataTypeInfo = { --- @param data_type ImGuiDataType function ImGui.DataTypeGetInfo(data_type) - IM_ASSERT(data_type >= 0 and data_type < ImGuiDataType.COUNT) + assert(data_type >= 0 and data_type < 10 --[[ImGuiDataType.COUNT]]) return GDataTypeInfo[data_type + 1] end @@ -57326,24 +57369,24 @@ end --- @param format string function ImGui.DataTypeFormatString(buf, buf_size, data_type, data, format) local str - if data_type == ImGuiDataType.S32 then + if data_type == 4 --[[ImGuiDataType.S32]] then str = ImFormatString(format, (ImS32)(data)) - elseif data_type == ImGuiDataType.U32 then + elseif data_type == 5 --[[ImGuiDataType.U32]] then str = ImFormatString(format, (ImU32)(data)) - elseif data_type == ImGuiDataType.Float then + elseif data_type == 6 --[[ImGuiDataType.Float]] then str = ImFormatString(format, data) - elseif data_type == ImGuiDataType.Double then + elseif data_type == 7 --[[ImGuiDataType.Double]] then str = ImFormatString(format, data) - elseif data_type == ImGuiDataType.S8 then + elseif data_type == 0 --[[ImGuiDataType.S8]] then str = ImFormatString(format, (ImS8)(data)) - elseif data_type == ImGuiDataType.U8 then + elseif data_type == 1 --[[ImGuiDataType.U8]] then str = ImFormatString(format, (ImU8)(data)) - elseif data_type == ImGuiDataType.S16 then + elseif data_type == 2 --[[ImGuiDataType.S16]] then str = ImFormatString(format, (ImS16)(data)) - elseif data_type == ImGuiDataType.U16 then + elseif data_type == 3 --[[ImGuiDataType.U16]] then str = ImFormatString(format, (ImU16)(data)) else - IM_ASSERT(false) + assert(false) end ImStd.ImStrncpy(buf, 1, { string.byte(str, 1, #str) }, 1, ImMin(#str + 1, buf_size)) -- TODO: update this when new ImFormatString is implemented end @@ -57353,51 +57396,51 @@ end --- @param arg1 number --- @param arg2 number function ImGui.DataTypeApplyOp(data_type, op, arg1, arg2) - IM_ASSERT(op == 43 or op == 45) -- '+' or '-' + assert(op == 43 or op == 45) -- '+' or '-' - if data_type == ImGuiDataType.S8 then + if data_type == 0 --[[ImGuiDataType.S8]] then if op == 43 then return ImAddClampOverflow(arg1, arg2, IM_S8_MIN, IM_S8_MAX) elseif op == 45 then return ImSubClampOverflow(arg1, arg2, IM_S8_MIN, IM_S8_MAX) end - elseif data_type == ImGuiDataType.U8 then + elseif data_type == 1 --[[ImGuiDataType.U8]] then if op == 43 then return ImAddClampOverflow(arg1, arg2, IM_U8_MIN, IM_U8_MAX) elseif op == 45 then return ImSubClampOverflow(arg1, arg2, IM_U8_MIN, IM_U8_MAX) end - elseif data_type == ImGuiDataType.S16 then + elseif data_type == 2 --[[ImGuiDataType.S16]] then if op == 43 then return ImAddClampOverflow((ImS16)(arg1), (ImS16)(arg2), IM_S16_MIN, IM_S16_MAX) elseif op == 45 then return ImSubClampOverflow((ImS16)(arg1), (ImS16)(arg2), IM_S16_MIN, IM_S16_MAX) end - elseif data_type == ImGuiDataType.U16 then + elseif data_type == 3 --[[ImGuiDataType.U16]] then if op == 43 then return ImAddClampOverflow((ImU16)(arg1), (ImU16)(arg2), IM_U16_MIN, IM_U16_MAX) elseif op == 45 then return ImSubClampOverflow((ImU16)(arg1), (ImU16)(arg2), IM_U16_MIN, IM_U16_MAX) end - elseif data_type == ImGuiDataType.S32 then + elseif data_type == 4 --[[ImGuiDataType.S32]] then if op == 43 then return ImAddClampOverflow(arg1, arg2, IM_S32_MIN, IM_S32_MAX) elseif op == 45 then return ImSubClampOverflow(arg1, arg2, IM_S32_MIN, IM_S32_MAX) end - elseif data_type == ImGuiDataType.U32 then + elseif data_type == 5 --[[ImGuiDataType.U32]] then if op == 43 then return ImAddClampOverflow(arg1, arg2, IM_U32_MIN, IM_U32_MAX) elseif op == 45 then return ImSubClampOverflow(arg1, arg2, IM_U32_MIN, IM_U32_MAX) end - elseif data_type == ImGuiDataType.Float then + elseif data_type == 6 --[[ImGuiDataType.Float]] then if op == 43 then return arg1 + arg2 elseif op == 45 then return arg1 - arg2 end - elseif data_type == ImGuiDataType.Double then + elseif data_type == 7 --[[ImGuiDataType.Double]] then if op == 43 then return arg1 + arg2 elseif op == 45 then @@ -57405,7 +57448,7 @@ function ImGui.DataTypeApplyOp(data_type, op, arg1, arg2) end end - IM_ASSERT(false) + assert(false) end local ImParseFormatSanitizeForScanning @@ -57437,7 +57480,7 @@ function ImGui.DataTypeApplyFromText(buf, data_type, data, format, data_when_emp -- Sanitize format -- - For float/double we have to ignore format with precision (e.g. "%.2f") because sscanf doesn't take them in, so force them into %f and %lf local format_sanitized, format_sanitized_size = {}, 32 - if (data_type == ImGuiDataType.Float or data_type == ImGuiDataType.Double) then + if (data_type == 6 --[[ImGuiDataType.Float]] or data_type == 7 --[[ImGuiDataType.Double]]) then format = type_info.ScanFmt else format = ImParseFormatSanitizeForScanning(format, format_sanitized, format_sanitized_size) @@ -57459,16 +57502,16 @@ function ImGui.DataTypeApplyFromText(buf, data_type, data, format, data_when_emp end if type_info.Size < 4 then - if data_type == ImGuiDataType.S8 then + if data_type == 0 --[[ImGuiDataType.S8]] then data = (ImS8)(ImClamp(v32, IM_S8_MIN, IM_S8_MAX)) - elseif data_type == ImGuiDataType.U8 then + elseif data_type == 1 --[[ImGuiDataType.U8]] then data = (ImU8)(ImClamp(v32, IM_U8_MIN, IM_U8_MAX)) - elseif data_type == ImGuiDataType.S16 then + elseif data_type == 2 --[[ImGuiDataType.S16]] then data = (ImS16)(ImClamp(v32, IM_S16_MIN, IM_S16_MAX)) - elseif data_type == ImGuiDataType.U16 then + elseif data_type == 3 --[[ImGuiDataType.U16]] then data = (ImU16)(ImClamp(v32, IM_U16_MIN, IM_U16_MAX)) else - IM_ASSERT(false) + assert(false) end end @@ -57488,16 +57531,16 @@ end --- @param arg1 number --- @param arg2 number function ImGui.DataTypeCompare(data_type, arg1, arg2) - if data_type == ImGuiDataType.S8 then return DataTypeCompareT((ImS8)(arg1), (ImS8)(arg2)) - elseif data_type == ImGuiDataType.U8 then return DataTypeCompareT((ImU8)(arg1), (ImU8)(arg2)) - elseif data_type == ImGuiDataType.S16 then return DataTypeCompareT((ImS16)(arg1), (ImS16)(arg2)) - elseif data_type == ImGuiDataType.U16 then return DataTypeCompareT((ImU16)(arg1), (ImU16)(arg2)) - elseif data_type == ImGuiDataType.S32 then return DataTypeCompareT((ImS32)(arg1), (ImS32)(arg2)) - elseif data_type == ImGuiDataType.U32 then return DataTypeCompareT((ImU32)(arg1), (ImU32)(arg2)) - elseif data_type == ImGuiDataType.Float then return DataTypeCompareT(arg1, arg2) - elseif data_type == ImGuiDataType.Double then return DataTypeCompareT(arg1, arg2) + if data_type == 0 --[[ImGuiDataType.S8]] then return DataTypeCompareT((ImS8)(arg1), (ImS8)(arg2)) + elseif data_type == 1 --[[ImGuiDataType.U8]] then return DataTypeCompareT((ImU8)(arg1), (ImU8)(arg2)) + elseif data_type == 2 --[[ImGuiDataType.S16]] then return DataTypeCompareT((ImS16)(arg1), (ImS16)(arg2)) + elseif data_type == 3 --[[ImGuiDataType.U16]] then return DataTypeCompareT((ImU16)(arg1), (ImU16)(arg2)) + elseif data_type == 4 --[[ImGuiDataType.S32]] then return DataTypeCompareT((ImS32)(arg1), (ImS32)(arg2)) + elseif data_type == 5 --[[ImGuiDataType.U32]] then return DataTypeCompareT((ImU32)(arg1), (ImU32)(arg2)) + elseif data_type == 6 --[[ImGuiDataType.Float]] then return DataTypeCompareT(arg1, arg2) + elseif data_type == 7 --[[ImGuiDataType.Double]] then return DataTypeCompareT(arg1, arg2) end - IM_ASSERT(false) + assert(false) return 0 end @@ -57518,16 +57561,16 @@ end --- @param min? number --- @param max? number function ImGui.DataTypeClamp(data_type, data, min, max) - if data_type == ImGuiDataType.S8 then return DataTypeClampT((ImS8)(data), min and (ImS8)(min), max and (ImS8)(max)) - elseif data_type == ImGuiDataType.U8 then return DataTypeClampT((ImU8)(data), min and (ImU8)(min), max and (ImU8)(max)) - elseif data_type == ImGuiDataType.S16 then return DataTypeClampT((ImS16)(data), min and (ImS16)(min), max and (ImS16)(max)) - elseif data_type == ImGuiDataType.U16 then return DataTypeClampT((ImU16)(data), min and (ImU16)(min), max and (ImU16)(max)) - elseif data_type == ImGuiDataType.S32 then return DataTypeClampT((ImS32)(data), min and (ImS32)(min), max and (ImS32)(max)) - elseif data_type == ImGuiDataType.U32 then return DataTypeClampT((ImU32)(data), min and (ImU32)(min), max and (ImU32)(max)) - elseif data_type == ImGuiDataType.Float then return DataTypeClampT(data, min, max) - elseif data_type == ImGuiDataType.Double then return DataTypeClampT(data, min, max) + if data_type == 0 --[[ImGuiDataType.S8]] then return DataTypeClampT((ImS8)(data), min and (ImS8)(min), max and (ImS8)(max)) + elseif data_type == 1 --[[ImGuiDataType.U8]] then return DataTypeClampT((ImU8)(data), min and (ImU8)(min), max and (ImU8)(max)) + elseif data_type == 2 --[[ImGuiDataType.S16]] then return DataTypeClampT((ImS16)(data), min and (ImS16)(min), max and (ImS16)(max)) + elseif data_type == 3 --[[ImGuiDataType.U16]] then return DataTypeClampT((ImU16)(data), min and (ImU16)(min), max and (ImU16)(max)) + elseif data_type == 4 --[[ImGuiDataType.S32]] then return DataTypeClampT((ImS32)(data), min and (ImS32)(min), max and (ImS32)(max)) + elseif data_type == 5 --[[ImGuiDataType.U32]] then return DataTypeClampT((ImU32)(data), min and (ImU32)(min), max and (ImU32)(max)) + elseif data_type == 6 --[[ImGuiDataType.Float]] then return DataTypeClampT(data, min, max) + elseif data_type == 7 --[[ImGuiDataType.Double]] then return DataTypeClampT(data, min, max) end - IM_ASSERT(false) + assert(false) return data, false end @@ -57546,7 +57589,7 @@ local min_steps = { 1.0, 0.1, 0.01, 0.001, 0.0001, 0.00001, 0.000001, 0.0000001, --- @return float function GetMinimumStepAtDecimalPrecision(decimal_precision) if decimal_precision < 0 then - return FLT_MIN + return 1.1754943508223e-38 --[[FLT_MIN]] end if decimal_precision < #min_steps then return min_steps[decimal_precision + 1] @@ -57564,7 +57607,7 @@ local ImParseFormatFindStart --- @param v number function ImGui.RoundScalarWithFormatT(format, data_type, v) -- IM_UNUSED(data_type) - IM_ASSERT(data_type == ImGuiDataType.Float or data_type == ImGuiDataType.Double) + assert(data_type == 6 --[[ImGuiDataType.Float]] or data_type == 7 --[[ImGuiDataType.Double]]) local fmt_start = ImParseFormatFindStart(format) if string.byte(format, fmt_start) ~= 37 or string.byte(format, fmt_start + 1) == 37 then return v -- Don't apply if the value is not visible in the format string @@ -57668,7 +57711,7 @@ end function ImParseFormatSanitizeForScanning(fmt_in, fmt_out, fmt_out_size) local fmt_end = ImParseFormatFindEnd(fmt_in, 1) -- IM_UNUSED(fmt_out_size) - IM_ASSERT(fmt_end < fmt_out_size) -- Format is too long, let us know if this happens to you! + assert(fmt_end < fmt_out_size) -- Format is too long, let us know if this happens to you! local has_type = false local fmt_in_begin = 1 local fmt_out_begin = 1 @@ -57733,7 +57776,7 @@ local function ImParseFormatPrecision(fmt, default_precision) c = string.byte(fmt, pos) if pos > len then break end end - local precision = INT_MAX + local precision = 2147483647 --[[INT_MAX]] if c == 46 then -- '.' precision, pos = ImAtoi(fmt, pos + 1) if precision < 0 or precision > 99 then @@ -57744,10 +57787,10 @@ local function ImParseFormatPrecision(fmt, default_precision) if c == 101 or c == 69 then -- Maximum precision with scientific notation precision = -1 end - if (c == 103 or c == 71) and precision == INT_MAX then + if (c == 103 or c == 71) and precision == 2147483647 --[[INT_MAX]] then precision = -1 end - return (precision == INT_MAX) and default_precision or precision + return (precision == 2147483647 --[[INT_MAX]]) and default_precision or precision end -- Create text input in place of another active widget (e.g. used when doing a Ctrl+Click on drag/slider widgets) @@ -57778,12 +57821,12 @@ function ImGui.TempInputText(bb, id, label, buf, buf_size, flags, callback, user local backup_pos = ImVec2() ImVec2_Copy(backup_pos, window.DC.CursorPos) ImVec2_Copy(window.DC.CursorPos, bb.Min) - g.LastItemData.ItemFlags = bit32.bor(g.LastItemData.ItemFlags, ImGuiItemFlags.AllowDuplicateId) -- Using ImGuiInputTextFlags.MergedItem above will skip ItemAdd() so we poke here. - local value_changed = ImGui.InputTextEx(label, nil, buf, buf_size, bb:GetSize(), bit32.bor(flags, ImGuiInputTextFlags.TempInput, ImGuiInputTextFlags.AutoSelectAll), callback, user_data) + g.LastItemData.ItemFlags = bit32.bor(g.LastItemData.ItemFlags, 32 --[[ImGuiItemFlags.AllowDuplicateId]]) -- Using ImGuiInputTextFlags.MergedItem above will skip ItemAdd() so we poke here. + local value_changed = ImGui.InputTextEx(label, nil, buf, buf_size, bb:GetSize(), bit32.bor(flags, 134217728 --[[ImGuiInputTextFlags.TempInput]], 4096 --[[ImGuiInputTextFlags.AutoSelectAll]]), callback, user_data) ImGui.KeepAliveID(id) -- Not done because of ImGuiInputTextFlags.TempInput if (not is_active and not is_deactivated) then -- First frame we started displaying the InputText widget, we expect it to take the active id. - IM_ASSERT(g.ActiveId == id) + assert(g.ActiveId == id) g.TempInputId = g.ActiveId end if is_active and g.ActiveId ~= id then @@ -57818,9 +57861,9 @@ function ImGui.TempInputScalar(bb, id, label, data_type, data, format, clamp_min ImGui.DataTypeFormatString(data_buf, data_buf_size, data_type, data, format) ImStd.ImStrTrimBlanks(data_buf) - local flags = bit32.bor(ImGuiInputTextFlags.AutoSelectAll, ImGuiInputTextFlags.LocalizeDecimalPoint) - g.LastItemData.ItemFlags = bit32.bor(g.LastItemData.ItemFlags, ImGuiItemFlags.NoMarkEdited) -- Because TempInputText() uses ImGuiInputTextFlags.MergedItem it doesn't submit a new item, so we poke LastItemData. - g.LastItemData.ItemFlags = (bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.LiveEditOnInputScalar) ~= 0) and bit32.bor(g.LastItemData.ItemFlags, ImGuiItemFlags.LiveEditOnInputText) or bit32.band(g.LastItemData.ItemFlags, bit32.bnot(ImGuiItemFlags.LiveEditOnInputText)) + local flags = bit32.bor(4096 --[[ImGuiInputTextFlags.AutoSelectAll]], 268435456 --[[ImGuiInputTextFlags.LocalizeDecimalPoint]]) + g.LastItemData.ItemFlags = bit32.bor(g.LastItemData.ItemFlags, 65536 --[[ImGuiItemFlags.NoMarkEdited]]) -- Because TempInputText() uses ImGuiInputTextFlags.MergedItem it doesn't submit a new item, so we poke LastItemData. + g.LastItemData.ItemFlags = (bit32.band(g.LastItemData.ItemFlags, 256 --[[ImGuiItemFlags.LiveEditOnInputScalar]]) ~= 0) and bit32.bor(g.LastItemData.ItemFlags, 128 --[[ImGuiItemFlags.LiveEditOnInputText]]) or bit32.band(g.LastItemData.ItemFlags, bit32.bnot(128 --[[ImGuiItemFlags.LiveEditOnInputText]])) if not ImGui.TempInputText(bb, id, label, data_buf, data_buf_size, flags) then return data, false end @@ -57838,7 +57881,7 @@ function ImGui.TempInputScalar(bb, id, label, data_type, data, format, clamp_min end -- Only mark as edited if new value is different - g.LastItemData.ItemFlags = bit32.band(g.LastItemData.ItemFlags, bit32.bnot(ImGuiItemFlags.NoMarkEdited)) + g.LastItemData.ItemFlags = bit32.band(g.LastItemData.ItemFlags, bit32.bnot(65536 --[[ImGuiItemFlags.NoMarkEdited]])) local value_changed = data_backup ~= data if value_changed then ImGui.MarkItemEdited(id) @@ -57872,10 +57915,10 @@ function ImGui.InputScalar(label, data_type, data, step, step_fast, format, flag format = ImGui.DataTypeGetInfo(data_type).PrintFmt end - local data_default = (bit32.band(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasRefVal) ~= 0) and g.NextItemData.RefVal or g.DataTypeZeroValue + local data_default = (bit32.band(g.NextItemData.HasFlags, 8 --[[ImGuiNextItemDataFlags.HasRefVal]]) ~= 0) and g.NextItemData.RefVal or g.DataTypeZeroValue local buf, buf_size = {}, 64 -- TODO: IM_COUNTOF() - if bit32.band(flags, ImGuiInputTextFlags.DisplayEmptyRefVal) ~= 0 and ImGui.DataTypeCompare(data_type, data, data_default) == 0 then + if bit32.band(flags, 16384 --[[ImGuiInputTextFlags.DisplayEmptyRefVal]]) ~= 0 and ImGui.DataTypeCompare(data_type, data, data_default) == 0 then buf[1] = 0 else ImGui.DataTypeFormatString(buf, buf_size, data_type, data, format) @@ -57883,8 +57926,8 @@ function ImGui.InputScalar(label, data_type, data, step, step_fast, format, flag -- Disable the MarkItemEdited() call in InputText but keep ImGuiItemStatusFlags.Edited. -- We call MarkItemEdited() ourselves by comparing the actual data rather than the string. - g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, ImGuiItemFlags.NoMarkEdited) - flags = bit32.bor(flags, ImGuiInputTextFlags.AutoSelectAll, ImGuiInputTextFlags.LocalizeDecimalPoint) + g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, 65536 --[[ImGuiItemFlags.NoMarkEdited]]) + flags = bit32.bor(flags, 4096 --[[ImGuiInputTextFlags.AutoSelectAll]], 268435456 --[[ImGuiInputTextFlags.LocalizeDecimalPoint]]) local has_step_buttons = (step ~= nil) local button_size = has_step_buttons and ImGui.GetFrameHeight() or 0.0 @@ -57903,17 +57946,17 @@ function ImGui.InputScalar(label, data_type, data, step, step_fast, format, flag -- Apply local value_changed = false - if bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.LiveEditOnInputScalar) ~= 0 then - local input_edited = bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.EditedInternal) ~= 0 -- We would be using 'ret' if ImGuiInputTextFlags.EnterReturnsTrue was not involved. + if bit32.band(g.LastItemData.ItemFlags, 256 --[[ImGuiItemFlags.LiveEditOnInputScalar]]) ~= 0 then + local input_edited = bit32.band(g.LastItemData.StatusFlags, 2048 --[[ImGuiItemStatusFlags.EditedInternal]]) ~= 0 -- We would be using 'ret' if ImGuiInputTextFlags.EnterReturnsTrue was not involved. if input_edited then - data, value_changed = ImGui.DataTypeApplyFromText(buf, data_type, data, format, bit32.band(flags, ImGuiInputTextFlags.ParseEmptyRefVal) ~= 0 and data_default or nil) + data, value_changed = ImGui.DataTypeApplyFromText(buf, data_type, data, format, bit32.band(flags, 8192 --[[ImGuiInputTextFlags.ParseEmptyRefVal]]) ~= 0 and data_default or nil) end else -- g.LastItemData.StatusFlags &= ~ImGuiItemStatusFlags_Edited if (g.DeactivatedItemData.ID == g.LastItemData.ID) then -- g.DeactivatedItemData.HasBeenEditedBefore = false; // Will be set below by MarkItemEdited() -- if (IsItemDeactivated()) // Should be unnecessary - data, value_changed = ImGui.DataTypeApplyFromText(buf, data_type, data, format, bit32.band(flags, ImGuiInputTextFlags.ParseEmptyRefVal) ~= 0 and data_default or nil) + data, value_changed = ImGui.DataTypeApplyFromText(buf, data_type, data, format, bit32.band(flags, 8192 --[[ImGuiInputTextFlags.ParseEmptyRefVal]]) ~= 0 and data_default or nil) end end @@ -57922,10 +57965,10 @@ function ImGui.InputScalar(label, data_type, data, step, step_fast, format, flag local backup_frame_padding = ImVec2() ImVec2_Copy(backup_frame_padding, style.FramePadding) style.FramePadding.x = style.FramePadding.y - if bit32.band(flags, ImGuiInputTextFlags.ReadOnly) ~= 0 then + if bit32.band(flags, 512 --[[ImGuiInputTextFlags.ReadOnly]]) ~= 0 then ImGui.BeginDisabled() end - ImGui.PushItemFlag(ImGuiItemFlags.ButtonRepeat, true) + ImGui.PushItemFlag(8 --[[ImGuiItemFlags.ButtonRepeat]], true) ImGui.SameLine(0, style.ItemInnerSpacing.x) --- @cast step number if ImGui.ButtonEx("-", ImVec2(button_size, button_size)) then @@ -57940,7 +57983,7 @@ function ImGui.InputScalar(label, data_type, data, step, step_fast, format, flag ret = true end ImGui.PopItemFlag() - if bit32.band(flags, ImGuiInputTextFlags.ReadOnly) ~= 0 then + if bit32.band(flags, 512 --[[ImGuiInputTextFlags.ReadOnly]]) ~= 0 then ImGui.EndDisabled() end local label_end = ImGui.FindRenderedTextEnd(label) @@ -57954,12 +57997,12 @@ function ImGui.InputScalar(label, data_type, data, step, step_fast, format, flag ImGui.EndGroup() end - g.LastItemData.ItemFlags = bit32.band(g.LastItemData.ItemFlags, bit32.bnot(ImGuiItemFlags.NoMarkEdited)) + g.LastItemData.ItemFlags = bit32.band(g.LastItemData.ItemFlags, bit32.bnot(65536 --[[ImGuiItemFlags.NoMarkEdited]])) if value_changed then ImGui.MarkItemEdited(g.LastItemData.ID) end - if bit32.band(flags, ImGuiInputTextFlags.EnterReturnsTrue) ~= 0 then + if bit32.band(flags, 64 --[[ImGuiInputTextFlags.EnterReturnsTrue]]) ~= 0 then return data, ret end return data, value_changed @@ -58017,27 +58060,27 @@ end function ImGui.InputFloat3(label, v, format, flags) if format == nil then format = "%.3f" end - return ImGui.InputScalarN(label, ImGuiDataType.Float, v, 3, nil, nil, format, flags) + return ImGui.InputScalarN(label, 6 --[[ImGuiDataType.Float]], v, 3, nil, nil, format, flags) end function ImGui.InputFloat2(label, v, format, flags) - return ImGui.InputScalarN(label, ImGuiDataType.Float, v, 2, nil, nil, format or "%.3f", flags) + return ImGui.InputScalarN(label, 6 --[[ImGuiDataType.Float]], v, 2, nil, nil, format or "%.3f", flags) end function ImGui.InputFloat4(label, v, format, flags) - return ImGui.InputScalarN(label, ImGuiDataType.Float, v, 4, nil, nil, format or "%.3f", flags) + return ImGui.InputScalarN(label, 6 --[[ImGuiDataType.Float]], v, 4, nil, nil, format or "%.3f", flags) end function ImGui.InputInt2(label, v, flags) - return ImGui.InputScalarN(label, ImGuiDataType.S32, v, 2, nil, nil, "%d", flags) + return ImGui.InputScalarN(label, 4 --[[ImGuiDataType.S32]], v, 2, nil, nil, "%d", flags) end function ImGui.InputInt3(label, v, flags) - return ImGui.InputScalarN(label, ImGuiDataType.S32, v, 3, nil, nil, "%d", flags) + return ImGui.InputScalarN(label, 4 --[[ImGuiDataType.S32]], v, 3, nil, nil, "%d", flags) end function ImGui.InputInt4(label, v, flags) - return ImGui.InputScalarN(label, ImGuiDataType.S32, v, 4, nil, nil, "%d", flags) + return ImGui.InputScalarN(label, 4 --[[ImGuiDataType.S32]], v, 4, nil, nil, "%d", flags) end --- @param label string @@ -58051,8 +58094,8 @@ function ImGui.InputInt(label, v, step, step_fast, flags) if flags == nil then flags = 0 end -- Hexadecimal input provided as a convenience but the flag name is awkward. Typically you'd use InputText() to parse your own data, if you want to handle prefixes. - local format = (bit32.band(flags, ImGuiInputTextFlags.CharsHexadecimal) ~= 0) and "%08X" or "%d" - return ImGui.InputScalar(label, ImGuiDataType.S32, v, (step > 0) and step or nil, (step_fast > 0) and step_fast or nil, format, flags) + local format = (bit32.band(flags, 2 --[[ImGuiInputTextFlags.CharsHexadecimal]]) ~= 0) and "%08X" or "%d" + return ImGui.InputScalar(label, 4 --[[ImGuiDataType.S32]], v, (step > 0) and step or nil, (step_fast > 0) and step_fast or nil, format, flags) end --- @param label string @@ -58066,7 +58109,7 @@ function ImGui.InputFloat(label, v, step, step_fast, format, flags) if step_fast == nil then step_fast = .0 end if format == nil then format = "%.3f" end - return ImGui.InputScalar(label, ImGuiDataType.Float, v, (step > 0.0 and step or nil), (step_fast > 0.0 and step_fast or nil), format, flags) + return ImGui.InputScalar(label, 6 --[[ImGuiDataType.Float]], v, (step > 0.0 and step or nil), (step_fast > 0.0 and step_fast or nil), format, flags) end --- @param label string @@ -58080,7 +58123,7 @@ function ImGui.InputDouble(label, v, step, step_fast, format, flags) if step_fast == nil then step_fast = .0 end if format == nil then format = "%.6f" end - return ImGui.InputScalar(label, ImGuiDataType.Double, v, (step > 0.0 and step or nil), (step_fast > 0.0 and step_fast or nil), format, flags) + return ImGui.InputScalar(label, 7 --[[ImGuiDataType.Double]], v, (step > 0.0 and step or nil), (step_fast > 0.0 and step_fast or nil), format, flags) end ------------------------------------------------------------------------------- @@ -58117,11 +58160,11 @@ end --- @return bool changed function ImGui.DragBehaviorT(TYPE, SIGNEDTYPE, data_type, v, v_speed, v_min, v_max, format, flags) local g = GImGui - local axis = (bit32.band(flags, ImGuiSliderFlags.Vertical) ~= 0) and ImGuiAxis.Y or ImGuiAxis.X - local is_bounded = (v_min < v_max) or ((v_min == v_max) and (v_min ~= 0.0 or (bit32.band(flags, ImGuiSliderFlags.ClampZeroRange) ~= 0))) - local is_wrapped = is_bounded and (bit32.band(flags, ImGuiSliderFlags.WrapAround) ~= 0) - local is_logarithmic = bit32.band(flags, ImGuiSliderFlags.Logarithmic) ~= 0 - local is_floating_point = (data_type == ImGuiDataType.Float) or (data_type == ImGuiDataType.Double) + local axis = (bit32.band(flags, 1048576 --[[ImGuiSliderFlags.Vertical]]) ~= 0) and 2 --[[ImGuiAxis.Y]] or 1 --[[ImGuiAxis.X]] + local is_bounded = (v_min < v_max) or ((v_min == v_max) and (v_min ~= 0.0 or (bit32.band(flags, 1024 --[[ImGuiSliderFlags.ClampZeroRange]]) ~= 0))) + local is_wrapped = is_bounded and (bit32.band(flags, 256 --[[ImGuiSliderFlags.WrapAround]]) ~= 0) + local is_logarithmic = bit32.band(flags, 32 --[[ImGuiSliderFlags.Logarithmic]]) ~= 0 + local is_floating_point = (data_type == 6 --[[ImGuiDataType.Float]]) or (data_type == 7 --[[ImGuiDataType.Double]]) -- Default tweak speed if v_speed == 0.0 and is_bounded and (v_max - v_min < math.huge) then @@ -58130,26 +58173,26 @@ function ImGui.DragBehaviorT(TYPE, SIGNEDTYPE, data_type, v, v_speed, v_min, v_m -- Inputs accumulates into g.DragCurrentAccum, which is flushed into the current value as soon as it makes a difference with our precision settings local adjust_delta = 0.0 - if g.ActiveIdSource == ImGuiInputSource.Mouse and ImGui.IsMousePosValid() and ImGui.IsMouseDragPastThreshold(0, g.IO.MouseDragThreshold * DRAG_MOUSE_THRESHOLD_FACTOR) then + if g.ActiveIdSource == 1 --[[ImGuiInputSource.Mouse]] and ImGui.IsMousePosValid() and ImGui.IsMouseDragPastThreshold(0, g.IO.MouseDragThreshold * DRAG_MOUSE_THRESHOLD_FACTOR) then adjust_delta = g.IO.MouseDelta[axis] - if g.IO.KeyAlt and bit32.band(flags, ImGuiSliderFlags.NoSpeedTweaks) == 0 then + if g.IO.KeyAlt and bit32.band(flags, 2048 --[[ImGuiSliderFlags.NoSpeedTweaks]]) == 0 then adjust_delta = adjust_delta / 100.0 end - if g.IO.KeyShift and bit32.band(flags, ImGuiSliderFlags.NoSpeedTweaks) == 0 then + if g.IO.KeyShift and bit32.band(flags, 2048 --[[ImGuiSliderFlags.NoSpeedTweaks]]) == 0 then adjust_delta = adjust_delta * 10.0 end - elseif g.ActiveIdSource == ImGuiInputSource.Keyboard or g.ActiveIdSource == ImGuiInputSource.Gamepad then + elseif g.ActiveIdSource == 2 --[[ImGuiInputSource.Keyboard]] or g.ActiveIdSource == 3 --[[ImGuiInputSource.Gamepad]] then local decimal_precision if is_floating_point then decimal_precision = ImParseFormatPrecision(format, 3) else decimal_precision = 0 end - local slow_key = (g.NavInputSource == ImGuiInputSource.Gamepad) and ImGuiKey.NavGamepadTweakSlow or ImGuiKey.NavKeyboardTweakSlow - local fast_key = (g.NavInputSource == ImGuiInputSource.Gamepad) and ImGuiKey.NavGamepadTweakFast or ImGuiKey.NavKeyboardTweakFast + local slow_key = (g.NavInputSource == 3 --[[ImGuiInputSource.Gamepad]]) and 642 --[[ImGuiKey.NavGamepadTweakSlow]] or 4096 --[[ImGuiKey.NavKeyboardTweakSlow]] + local fast_key = (g.NavInputSource == 3 --[[ImGuiInputSource.Gamepad]]) and 643 --[[ImGuiKey.NavGamepadTweakFast]] or 8192 --[[ImGuiKey.NavKeyboardTweakFast]] local tweak_factor - if bit32.band(flags, ImGuiSliderFlags.NoSpeedTweaks) ~= 0 then + if bit32.band(flags, 2048 --[[ImGuiSliderFlags.NoSpeedTweaks]]) ~= 0 then tweak_factor = 1.0 elseif ImGui.IsKeyDown(slow_key) then tweak_factor = 1.0 / 10.0 @@ -58165,12 +58208,12 @@ function ImGui.DragBehaviorT(TYPE, SIGNEDTYPE, data_type, v, v_speed, v_min, v_m adjust_delta = adjust_delta * v_speed -- For vertical drag we currently assume that Up=higher value (like we do with vertical sliders). This may become a parameter. - if axis == ImGuiAxis.Y then + if axis == 2 --[[ImGuiAxis.Y]] then adjust_delta = -adjust_delta end -- For logarithmic use our range is effectively 0..1 so scale the delta into that range - if is_logarithmic and (v_max - v_min < FLT_MAX) and (v_max - v_min > 0.000001) then -- Epsilon to avoid /0 + if is_logarithmic and (v_max - v_min < 3.4028234663853e+38 --[[FLT_MAX]]) and (v_max - v_min > 0.000001) then -- Epsilon to avoid /0 adjust_delta = adjust_delta / (v_max - v_min) end @@ -58215,7 +58258,7 @@ function ImGui.DragBehaviorT(TYPE, SIGNEDTYPE, data_type, v, v_speed, v_min, v_m end -- Round to user desired precision based on format string - if is_floating_point and bit32.band(flags, ImGuiSliderFlags.NoRoundToFormat) == 0 then + if is_floating_point and bit32.band(flags, 64 --[[ImGuiSliderFlags.NoRoundToFormat]]) == 0 then v_cur = ImGui.RoundScalarWithFormatT(format, data_type, v_cur) end @@ -58273,43 +58316,43 @@ end @native function ImGui.DragBehavior(id, data_type, v, v_speed, min, max, format, flags) -- Read imgui.cpp "API BREAKING CHANGES" section for 1.78 if you hit this assert. - IM_ASSERT((flags == 1 or bit32.band(flags, ImGuiSliderFlags.InvalidMask_) == 0), "Invalid ImGuiSliderFlags flags! Has the legacy 'float power' argument been mistakenly cast to flags? Call function with ImGuiSliderFlags_Logarithmic flags instead.") + assert((flags == 1 or bit32.band(flags, 1879048207 --[[ImGuiSliderFlags.InvalidMask_]]) == 0), "Invalid ImGuiSliderFlags flags! Has the legacy 'float power' argument been mistakenly cast to flags? Call function with ImGuiSliderFlags_Logarithmic flags instead.") -- Things we can do easily outside the DragBehaviorT<> template, saves code generation. local g = GImGui if g.ActiveId == id then - if g.ActiveIdSource == ImGuiInputSource.Mouse and not g.IO.MouseDown[0] then + if g.ActiveIdSource == 1 --[[ImGuiInputSource.Mouse]] and not g.IO.MouseDown[0] then ImGui.ClearActiveID() - elseif (g.ActiveIdSource == ImGuiInputSource.Keyboard or g.ActiveIdSource == ImGuiInputSource.Gamepad) and g.NavActivatePressedId == id and not g.ActiveIdIsJustActivated then + elseif (g.ActiveIdSource == 2 --[[ImGuiInputSource.Keyboard]] or g.ActiveIdSource == 3 --[[ImGuiInputSource.Gamepad]]) and g.NavActivatePressedId == id and not g.ActiveIdIsJustActivated then ImGui.ClearActiveID() end end if g.ActiveId ~= id then return v, false end - if bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.ReadOnly) ~= 0 or bit32.band(flags, ImGuiSliderFlags.ReadOnly) ~= 0 then + if bit32.band(g.LastItemData.ItemFlags, 2048 --[[ImGuiItemFlags.ReadOnly]]) ~= 0 or bit32.band(flags, 2097152 --[[ImGuiSliderFlags.ReadOnly]]) ~= 0 then return v, false end - if data_type == ImGuiDataType.S8 then - return ImGui.DragBehaviorT(ImS32, ImS32, ImGuiDataType.S32, v, v_speed, min and min or IM_S8_MIN, max and max or IM_S8_MAX, format, flags) - elseif data_type == ImGuiDataType.U8 then - return ImGui.DragBehaviorT(ImU32, ImS32, ImGuiDataType.U32, v, v_speed, min and min or IM_U8_MIN, max and max or IM_U8_MAX, format, flags) - elseif data_type == ImGuiDataType.S16 then - return ImGui.DragBehaviorT(ImS32, ImS32, ImGuiDataType.S32, v, v_speed, min and min or IM_S16_MIN, max and max or IM_S16_MAX, format, flags) - elseif data_type == ImGuiDataType.U16 then - return ImGui.DragBehaviorT(ImU32, ImS32, ImGuiDataType.U32, v, v_speed, min and min or IM_U16_MIN, max and max or IM_U16_MAX, format, flags) - elseif data_type == ImGuiDataType.S32 then + if data_type == 0 --[[ImGuiDataType.S8]] then + return ImGui.DragBehaviorT(ImS32, ImS32, 4 --[[ImGuiDataType.S32]], v, v_speed, min and min or IM_S8_MIN, max and max or IM_S8_MAX, format, flags) + elseif data_type == 1 --[[ImGuiDataType.U8]] then + return ImGui.DragBehaviorT(ImU32, ImS32, 5 --[[ImGuiDataType.U32]], v, v_speed, min and min or IM_U8_MIN, max and max or IM_U8_MAX, format, flags) + elseif data_type == 2 --[[ImGuiDataType.S16]] then + return ImGui.DragBehaviorT(ImS32, ImS32, 4 --[[ImGuiDataType.S32]], v, v_speed, min and min or IM_S16_MIN, max and max or IM_S16_MAX, format, flags) + elseif data_type == 3 --[[ImGuiDataType.U16]] then + return ImGui.DragBehaviorT(ImU32, ImS32, 5 --[[ImGuiDataType.U32]], v, v_speed, min and min or IM_U16_MIN, max and max or IM_U16_MAX, format, flags) + elseif data_type == 4 --[[ImGuiDataType.S32]] then return ImGui.DragBehaviorT(ImS32, ImS32, data_type, v, v_speed, min and min or IM_S32_MIN, max and max or IM_S32_MAX, format, flags) - elseif data_type == ImGuiDataType.U32 then + elseif data_type == 5 --[[ImGuiDataType.U32]] then return ImGui.DragBehaviorT(ImU32, ImS32, data_type, v, v_speed, min and min or IM_U32_MIN, max and max or IM_U32_MAX, format, flags) - elseif data_type == ImGuiDataType.Float then - return ImGui.DragBehaviorT(float, float, data_type, v, v_speed, min and min or -FLT_MAX, max and max or FLT_MAX, format, flags) - elseif data_type == ImGuiDataType.Double then - return ImGui.DragBehaviorT(double, double, data_type, v, v_speed, min and min or -DBL_MAX, max and max or DBL_MAX, format, flags) + elseif data_type == 6 --[[ImGuiDataType.Float]] then + return ImGui.DragBehaviorT(float, float, data_type, v, v_speed, min and min or -3.4028234663853e+38 --[[FLT_MAX]], max and max or 3.4028234663853e+38 --[[FLT_MAX]], format, flags) + elseif data_type == 7 --[[ImGuiDataType.Double]] then + return ImGui.DragBehaviorT(double, double, data_type, v, v_speed, min and min or -1.7976931348623e+308 --[[DBL_MAX]], max and max or 1.7976931348623e+308 --[[DBL_MAX]], format, flags) end - IM_ASSERT(false) + assert(false) return v, false end @@ -58319,7 +58362,7 @@ end --- @param min number --- @param max number local function TempInputIsClampEnabled(flags, data_type, min, max) - if bit32.band(flags, ImGuiSliderFlags.ClampOnInput) ~= 0 and (min ~= nil or max ~= nil) then + if bit32.band(flags, 512 --[[ImGuiSliderFlags.ClampOnInput]]) ~= 0 and (min ~= nil or max ~= nil) then local clamp_range_dir = 0 if min ~= nil and max ~= nil then clamp_range_dir = ImGui.DataTypeCompare(data_type, min, max) -- -1 when min < max, == 0 when min == max @@ -58328,7 +58371,7 @@ local function TempInputIsClampEnabled(flags, data_type, min, max) return true end if clamp_range_dir == 0 then - return ImGui.DataTypeIsZero(data_type, min) and (bit32.band(flags, ImGuiSliderFlags.ClampZeroRange) ~= 0) or true + return ImGui.DataTypeIsZero(data_type, min) and (bit32.band(flags, 1024 --[[ImGuiSliderFlags.ClampZeroRange]]) ~= 0) or true end end return false @@ -58373,7 +58416,7 @@ function ImGui.DragScalar(label, data_type, data, v_speed, min, max, format, fla local style = g.Style local id = window:GetID(label) local w = ImGui.CalcItemWidth() - local color_marker = (bit32.band(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasColorMarker) ~= 0) and g.NextItemData.ColorMarker or 0 + local color_marker = (bit32.band(g.NextItemData.HasFlags, 32 --[[ImGuiNextItemDataFlags.HasColorMarker]]) ~= 0) and g.NextItemData.ColorMarker or 0 local label_end = ImGui.FindRenderedTextEnd(label) local label_size = ImGui.CalcTextSize(label, label_end, false) @@ -58383,9 +58426,9 @@ function ImGui.DragScalar(label, data_type, data, v_speed, min, max, format, fla total_bb.Min.x = frame_bb.Min.x; total_bb.Min.y = frame_bb.Min.y total_bb.Max.x = frame_bb.Max.x + ((label_size.x > 0.0) and (style.ItemInnerSpacing.x + label_size.x) or 0.0); total_bb.Max.y = frame_bb.Max.y + 0.0 - local temp_input_allowed = (bit32.band(flags, ImGuiSliderFlags.NoInput) == 0) + local temp_input_allowed = (bit32.band(flags, 128 --[[ImGuiSliderFlags.NoInput]]) == 0) ImGui.ItemSize(total_bb, style.FramePadding.y) - if not ImGui.ItemAdd(total_bb, id, frame_bb, temp_input_allowed and ImGuiItemFlags.Inputable or 0) then + if not ImGui.ItemAdd(total_bb, id, frame_bb, temp_input_allowed and 1048576 --[[ImGuiItemFlags.Inputable]] or 0) then return data, false end @@ -58398,14 +58441,14 @@ function ImGui.DragScalar(label, data_type, data, v_speed, min, max, format, fla local temp_input_is_active = temp_input_allowed and ImGui.TempInputIsActive(id) if not temp_input_is_active then -- Tabbing or Ctrl+Click on Drag turns it into an InputText - local clicked = hovered and ImGui.IsMouseClickedEx(0, ImGuiInputFlags.None, id) - local double_clicked = (hovered and g.IO.MouseClickedCount[0] == 2 and ImGui.TestKeyOwner(ImGuiKey.MouseLeft, id)) + local clicked = hovered and ImGui.IsMouseClickedEx(0, 0 --[[ImGuiInputFlags.None]], id) + local double_clicked = (hovered and g.IO.MouseClickedCount[0] == 2 and ImGui.TestKeyOwner(656 --[[ImGuiKey.MouseLeft]], id)) local make_active = (clicked or double_clicked or g.NavActivateId == id) if make_active and (clicked or double_clicked) then - ImGui.SetKeyOwner(ImGuiKey.MouseLeft, id) + ImGui.SetKeyOwner(656 --[[ImGuiKey.MouseLeft]], id) end if make_active and temp_input_allowed then - if (clicked and g.IO.KeyCtrl) or double_clicked or (g.NavActivateId == id and bit32.band(g.NavActivateFlags, ImGuiActivateFlags.PreferInput) ~= 0) then + if (clicked and g.IO.KeyCtrl) or double_clicked or (g.NavActivateId == id and bit32.band(g.NavActivateFlags, 1 --[[ImGuiActivateFlags.PreferInput]]) ~= 0) then temp_input_is_active = true end end @@ -58414,7 +58457,7 @@ function ImGui.DragScalar(label, data_type, data, v_speed, min, max, format, fla if g.IO.ConfigDragClickToInputText and temp_input_allowed and not temp_input_is_active then if g.ActiveId == id and hovered and g.IO.MouseReleased[0] and not ImGui.IsMouseDragPastThreshold(0, g.IO.MouseDragThreshold * DRAG_MOUSE_THRESHOLD_FACTOR) then g.NavActivateId = id - g.NavActivateFlags = ImGuiActivateFlags.PreferInput + g.NavActivateFlags = 1 --[[ImGuiActivateFlags.PreferInput]] temp_input_is_active = true end end @@ -58428,7 +58471,7 @@ function ImGui.DragScalar(label, data_type, data, v_speed, min, max, format, fla ImGui.SetActiveID(id, window) ImGui.SetFocusID(id, window) ImGui.FocusWindow(window) - g.ActiveIdUsingNavDirMask = bit32.bor(bit32.lshift(1, ImGuiDir.Left), bit32.lshift(1, ImGuiDir.Right)) + g.ActiveIdUsingNavDirMask = bit32.bor(bit32.lshift(1, 0 --[[ImGuiDir.Left]]), bit32.lshift(1, 1 --[[ImGuiDir.Right]])) end end @@ -58438,7 +58481,7 @@ function ImGui.DragScalar(label, data_type, data, v_speed, min, max, format, fla end -- Draw frame - local frame_col = ImGui.GetColorU32(g.ActiveId == id and ImGuiCol.FrameBgActive or hovered and ImGuiCol.FrameBgHovered or ImGuiCol.FrameBg) + local frame_col = ImGui.GetColorU32(g.ActiveId == id and 9 --[[ImGuiCol.FrameBgActive]] or hovered and 8 --[[ImGuiCol.FrameBgHovered]] or 7 --[[ImGuiCol.FrameBg]]) ImGui.RenderNavCursor(frame_bb, id) ImGui.RenderFrame(frame_bb.Min, frame_bb.Max, frame_col, false, style.FrameRounding) @@ -58481,7 +58524,7 @@ function ImGui.DragFloat(label, v, v_speed, v_min, v_max, format, flags) if format == nil then format = "%.3f" end if flags == nil then flags = 0 end - return ImGui.DragScalar(label, ImGuiDataType.Float, v, v_speed, v_min, v_max, format, flags) + return ImGui.DragScalar(label, 6 --[[ImGuiDataType.Float]], v, v_speed, v_min, v_max, format, flags) end -- NB: v_speed is float to allow adjusting the drag speed with more precision @@ -58500,7 +58543,7 @@ function ImGui.DragInt(label, v, v_speed, v_min, v_max, format, flags) if format == nil then format = "%d" end if flags == nil then flags = 0 end - return ImGui.DragScalar(label, ImGuiDataType.S32, v, v_speed, v_min, v_max, format, flags) + return ImGui.DragScalar(label, 4 --[[ImGuiDataType.S32]], v, v_speed, v_min, v_max, format, flags) end -- `v` is mutated in place (1-based), returns value_changed @@ -58523,7 +58566,7 @@ function ImGui.DragScalarN(label, data_type, v, components, v_speed, v_min, v_ma if i > 1 then ImGui.SameLine(0, g.Style.ItemInnerSpacing.x) end - if bit32.band(flags, ImGuiSliderFlags.ColorMarkers) ~= 0 then + if bit32.band(flags, 4096 --[[ImGuiSliderFlags.ColorMarkers]]) ~= 0 then ImGui.SetNextItemColorMarker(GDefaultRgbaColorMarkers[i]) end local changed @@ -58546,12 +58589,12 @@ end local function DragFloatN(n) return function(label, v, v_speed, v_min, v_max, format, flags) - return ImGui.DragScalarN(label, ImGuiDataType.Float, v, n, v_speed or 1.0, v_min or 0.0, v_max or 0.0, format or "%.3f", flags or 0) + return ImGui.DragScalarN(label, 6 --[[ImGuiDataType.Float]], v, n, v_speed or 1.0, v_min or 0.0, v_max or 0.0, format or "%.3f", flags or 0) end end local function DragIntN(n) return function(label, v, v_speed, v_min, v_max, format, flags) - return ImGui.DragScalarN(label, ImGuiDataType.S32, v, n, v_speed or 1.0, v_min or 0, v_max or 0, format or "%d", flags or 0) + return ImGui.DragScalarN(label, 4 --[[ImGuiDataType.S32]], v, n, v_speed or 1.0, v_min or 0, v_max or 0, format or "%d", flags or 0) end end ImGui.DragFloat2 = DragFloatN(2) @@ -58572,15 +58615,15 @@ local function DragRange2(data_type, label, v_current_min, v_current_max, v_spee end local g = GImGui - local lo = (data_type == ImGuiDataType.Float) and -FLT_MAX or INT_MIN - local hi = (data_type == ImGuiDataType.Float) and FLT_MAX or INT_MAX + local lo = (data_type == 6 --[[ImGuiDataType.Float]]) and -3.4028234663853e+38 --[[FLT_MAX]] or (-2147483648) --[[INT_MIN]] + local hi = (data_type == 6 --[[ImGuiDataType.Float]]) and 3.4028234663853e+38 --[[FLT_MAX]] or 2147483647 --[[INT_MAX]] ImGui.PushID(label) ImGui.BeginGroup() ImGui.PushMultiItemsWidths(2, ImGui.CalcItemWidth()) local min_min = (v_min >= v_max) and lo or v_min local min_max = (v_min >= v_max) and v_current_max or ImMin(v_max, v_current_max) - local min_flags = bit32.bor(flags, (min_min == min_max) and ImGuiSliderFlags.ReadOnly or 0) + local min_flags = bit32.bor(flags, (min_min == min_max) and 2097152 --[[ImGuiSliderFlags.ReadOnly]] or 0) local value_changed, changed v_current_min, value_changed = ImGui.DragScalar("##min", data_type, v_current_min, v_speed, min_min, min_max, format, min_flags) ImGui.PopItemWidth() @@ -58588,7 +58631,7 @@ local function DragRange2(data_type, label, v_current_min, v_current_max, v_spee local max_min = (v_min >= v_max) and v_current_min or ImMax(v_min, v_current_min) local max_max = (v_min >= v_max) and hi or v_max - local max_flags = bit32.bor(flags, (max_min == max_max) and ImGuiSliderFlags.ReadOnly or 0) + local max_flags = bit32.bor(flags, (max_min == max_max) and 2097152 --[[ImGuiSliderFlags.ReadOnly]] or 0) v_current_max, changed = ImGui.DragScalar("##max", data_type, v_current_max, v_speed, max_min, max_max, format_max or format, max_flags) value_changed = value_changed or changed ImGui.PopItemWidth() @@ -58602,11 +58645,11 @@ local function DragRange2(data_type, label, v_current_min, v_current_max, v_spee end function ImGui.DragFloatRange2(label, v_current_min, v_current_max, v_speed, v_min, v_max, format, format_max, flags) - return DragRange2(ImGuiDataType.Float, label, v_current_min, v_current_max, v_speed or 1.0, v_min or 0.0, v_max or 0.0, format or "%.3f", format_max, flags or 0) + return DragRange2(6 --[[ImGuiDataType.Float]], label, v_current_min, v_current_max, v_speed or 1.0, v_min or 0.0, v_max or 0.0, format or "%.3f", format_max, flags or 0) end function ImGui.DragIntRange2(label, v_current_min, v_current_max, v_speed, v_min, v_max, format, format_max, flags) - return DragRange2(ImGuiDataType.S32, label, v_current_min, v_current_max, v_speed or 1.0, v_min or 0, v_max or 0, format or "%d", format_max, flags or 0) + return DragRange2(4 --[[ImGuiDataType.S32]], label, v_current_min, v_current_max, v_speed or 1.0, v_min or 0, v_max or 0, format or "%d", format_max, flags or 0) end ------------------------------------------------------------------------------- @@ -58773,7 +58816,7 @@ function ImGui.ScaleValueFromRatioT(TYPE, SIGNEDTYPE, data_type, t, v_min, v_max end else -- Linear slider - local is_floating_point = (data_type == ImGuiDataType.Float) or (data_type == ImGuiDataType.Double) + local is_floating_point = (data_type == 6 --[[ImGuiDataType.Float]]) or (data_type == 7 --[[ImGuiDataType.Double]]) if is_floating_point then result = ImLerp(v_min, v_max, t) elseif t < 1.0 then -- t is already < 1.0 here @@ -58808,10 +58851,10 @@ function ImGui.SliderBehaviorT(TYPE, SIGNEDTYPE, bb, id, data_type, v, v_min, v_ local g = GImGui local style = g.Style - local axis = (bit32.band(flags, ImGuiSliderFlags.Vertical) ~= 0) and ImGuiAxis.Y or ImGuiAxis.X - local axis_k = (axis == ImGuiAxis.X) and "x" or "y" -- [Luau] named key: ImVec2[axis] goes through IM_VEC2.__index - local is_logarithmic = bit32.band(flags, ImGuiSliderFlags.Logarithmic) ~= 0 - local is_floating_point = (data_type == ImGuiDataType.Float) or (data_type == ImGuiDataType.Double) + local axis = (bit32.band(flags, 1048576 --[[ImGuiSliderFlags.Vertical]]) ~= 0) and 2 --[[ImGuiAxis.Y]] or 1 --[[ImGuiAxis.X]] + local axis_k = (axis == 1 --[[ImGuiAxis.X]]) and "x" or "y" -- [Luau] named key: ImVec2[axis] goes through IM_VEC2.__index + local is_logarithmic = bit32.band(flags, 32 --[[ImGuiSliderFlags.Logarithmic]]) ~= 0 + local is_floating_point = (data_type == 6 --[[ImGuiDataType.Float]]) or (data_type == 7 --[[ImGuiDataType.Double]]) local v_range_f = (v_min < v_max) and (v_max - v_min) or (v_min - v_max) -- We don't need high precision for what we do with it. -- Calculate bounds @@ -58840,14 +58883,14 @@ function ImGui.SliderBehaviorT(TYPE, SIGNEDTYPE, bb, id, data_type, v, v_min, v_ if g.ActiveId == id then local set_new_value = false local clicked_t = 0.0 - if g.ActiveIdSource == ImGuiInputSource.Mouse then + if g.ActiveIdSource == 1 --[[ImGuiInputSource.Mouse]] then if not g.IO.MouseDown[0] then ImGui.ClearActiveID() else local mouse_abs_pos = g.IO.MousePos[axis_k] if g.ActiveIdIsJustActivated then local grab_t = ImGui.ScaleRatioFromValueT(data_type, v, v_min, v_max, logarithmic_zero_epsilon, zero_deadzone_halfsize) - if axis == ImGuiAxis.Y then + if axis == 2 --[[ImGuiAxis.Y]] then grab_t = 1.0 - grab_t end local grab_pos = ImLerp(slider_usable_pos_min, slider_usable_pos_max, grab_t) @@ -58857,21 +58900,21 @@ function ImGui.SliderBehaviorT(TYPE, SIGNEDTYPE, bb, id, data_type, v, v_min, v_ if slider_usable_sz > 0.0 then clicked_t = ImSaturate((mouse_abs_pos - g.SliderGrabClickOffset - slider_usable_pos_min) / slider_usable_sz) end - if axis == ImGuiAxis.Y then + if axis == 2 --[[ImGuiAxis.Y]] then clicked_t = 1.0 - clicked_t end set_new_value = true end - elseif g.ActiveIdSource == ImGuiInputSource.Keyboard or g.ActiveIdSource == ImGuiInputSource.Gamepad then + elseif g.ActiveIdSource == 2 --[[ImGuiInputSource.Keyboard]] or g.ActiveIdSource == 3 --[[ImGuiInputSource.Gamepad]] then if g.ActiveIdIsJustActivated then g.SliderCurrentAccum = 0.0 -- Reset any stored nav delta upon activation g.SliderCurrentAccumDirty = false end - local input_delta = (axis == ImGuiAxis.X) and ImGui.GetNavTweakPressedAmount(axis) or -ImGui.GetNavTweakPressedAmount(axis) + local input_delta = (axis == 1 --[[ImGuiAxis.X]]) and ImGui.GetNavTweakPressedAmount(axis) or -ImGui.GetNavTweakPressedAmount(axis) if input_delta ~= 0.0 then - local tweak_slow = ImGui.IsKeyDown((g.NavInputSource == ImGuiInputSource.Gamepad) and ImGuiKey.NavGamepadTweakSlow or ImGuiKey.NavKeyboardTweakSlow) - local tweak_fast = ImGui.IsKeyDown((g.NavInputSource == ImGuiInputSource.Gamepad) and ImGuiKey.NavGamepadTweakFast or ImGuiKey.NavKeyboardTweakFast) + local tweak_slow = ImGui.IsKeyDown((g.NavInputSource == 3 --[[ImGuiInputSource.Gamepad]]) and 642 --[[ImGuiKey.NavGamepadTweakSlow]] or 4096 --[[ImGuiKey.NavKeyboardTweakSlow]]) + local tweak_fast = ImGui.IsKeyDown((g.NavInputSource == 3 --[[ImGuiInputSource.Gamepad]]) and 643 --[[ImGuiKey.NavGamepadTweakFast]] or 8192 --[[ImGuiKey.NavKeyboardTweakFast]]) local decimal_precision = is_floating_point and ImParseFormatPrecision(format, 3) or 0 if decimal_precision > 0 then input_delta = input_delta / 100.0 -- Keyboard/Gamepad tweak speeds in % of slider bounds @@ -58909,7 +58952,7 @@ function ImGui.SliderBehaviorT(TYPE, SIGNEDTYPE, bb, id, data_type, v, v_min, v_ -- Calculate what our "new" clicked_t will be, and thus how far we actually moved the slider, and subtract this from the accumulator local v_new = ImGui.ScaleValueFromRatioT(TYPE, SIGNEDTYPE, data_type, clicked_t, v_min, v_max, logarithmic_zero_epsilon, zero_deadzone_halfsize) - if is_floating_point and bit32.band(flags, ImGuiSliderFlags.NoRoundToFormat) == 0 then + if is_floating_point and bit32.band(flags, 64 --[[ImGuiSliderFlags.NoRoundToFormat]]) == 0 then v_new = ImGui.RoundScalarWithFormatT(format, data_type, v_new) end local new_clicked_t = ImGui.ScaleRatioFromValueT(data_type, v_new, v_min, v_max, logarithmic_zero_epsilon, zero_deadzone_halfsize) @@ -58926,7 +58969,7 @@ function ImGui.SliderBehaviorT(TYPE, SIGNEDTYPE, bb, id, data_type, v, v_min, v_ end if set_new_value then - if (bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.ReadOnly) ~= 0) or (bit32.band(flags, ImGuiSliderFlags.ReadOnly) ~= 0) then + if (bit32.band(g.LastItemData.ItemFlags, 2048 --[[ImGuiItemFlags.ReadOnly]]) ~= 0) or (bit32.band(flags, 2097152 --[[ImGuiSliderFlags.ReadOnly]]) ~= 0) then set_new_value = false end end @@ -58935,7 +58978,7 @@ function ImGui.SliderBehaviorT(TYPE, SIGNEDTYPE, bb, id, data_type, v, v_min, v_ local v_new = ImGui.ScaleValueFromRatioT(TYPE, SIGNEDTYPE, data_type, clicked_t, v_min, v_max, logarithmic_zero_epsilon, zero_deadzone_halfsize) -- Round to user desired precision based on format string - if is_floating_point and bit32.band(flags, ImGuiSliderFlags.NoRoundToFormat) == 0 then + if is_floating_point and bit32.band(flags, 64 --[[ImGuiSliderFlags.NoRoundToFormat]]) == 0 then v_new = ImGui.RoundScalarWithFormatT(format, data_type, v_new) end @@ -58954,11 +58997,11 @@ function ImGui.SliderBehaviorT(TYPE, SIGNEDTYPE, bb, id, data_type, v, v_min, v_ else -- Output grab position so it can be displayed by the caller local grab_t = ImGui.ScaleRatioFromValueT(data_type, v, v_min, v_max, logarithmic_zero_epsilon, zero_deadzone_halfsize) - if axis == ImGuiAxis.Y then + if axis == 2 --[[ImGuiAxis.Y]] then grab_t = 1.0 - grab_t end local grab_pos = ImLerp(slider_usable_pos_min, slider_usable_pos_max, grab_t) - if axis == ImGuiAxis.X then + if axis == 1 --[[ImGuiAxis.X]] then og_min.x = grab_pos - grab_sz * 0.5; og_min.y = bb.Min.y + grab_padding; og_max.x = grab_pos + grab_sz * 0.5; og_max.y = bb.Max.y - grab_padding else og_min.x = bb.Min.x + grab_padding; og_min.y = grab_pos - grab_sz * 0.5; og_max.x = bb.Max.x - grab_padding; og_max.y = grab_pos + grab_sz * 0.5 @@ -58985,44 +59028,44 @@ end --- @return bool value_changed function ImGui.SliderBehavior(bb, id, data_type, v, min, max, format, flags, out_grab_bb) -- Read imgui.cpp "API BREAKING CHANGES" section for 1.78 if you hit this assert. - IM_ASSERT((flags == 1 or bit32.band(flags, ImGuiSliderFlags.InvalidMask_) == 0), "Invalid ImGuiSliderFlags flags! Has the legacy 'float power' argument been mistakenly cast to flags? Call function with ImGuiSliderFlags_Logarithmic flags instead.") - IM_ASSERT(bit32.band(flags, ImGuiSliderFlags.WrapAround) == 0) -- Not supported by SliderXXX(), only by DragXXX() + assert((flags == 1 or bit32.band(flags, 1879048207 --[[ImGuiSliderFlags.InvalidMask_]]) == 0), "Invalid ImGuiSliderFlags flags! Has the legacy 'float power' argument been mistakenly cast to flags? Call function with ImGuiSliderFlags_Logarithmic flags instead.") + assert(bit32.band(flags, 256 --[[ImGuiSliderFlags.WrapAround]]) == 0) -- Not supported by SliderXXX(), only by DragXXX() - if data_type == ImGuiDataType.S8 then + if data_type == 0 --[[ImGuiDataType.S8]] then local v32 = (ImS32)((ImS8)(v)); local r - v32, r = ImGui.SliderBehaviorT(ImS32, ImS32, bb, id, ImGuiDataType.S32, v32, min, max, format, flags, out_grab_bb) + v32, r = ImGui.SliderBehaviorT(ImS32, ImS32, bb, id, 4 --[[ImGuiDataType.S32]], v32, min, max, format, flags, out_grab_bb) if r then v = (ImS8)(v32) end return v, r - elseif data_type == ImGuiDataType.U8 then + elseif data_type == 1 --[[ImGuiDataType.U8]] then local v32 = (ImU32)((ImU8)(v)); local r - v32, r = ImGui.SliderBehaviorT(ImU32, ImS32, bb, id, ImGuiDataType.U32, v32, min, max, format, flags, out_grab_bb) + v32, r = ImGui.SliderBehaviorT(ImU32, ImS32, bb, id, 5 --[[ImGuiDataType.U32]], v32, min, max, format, flags, out_grab_bb) if r then v = (ImU8)(v32) end return v, r - elseif data_type == ImGuiDataType.S16 then + elseif data_type == 2 --[[ImGuiDataType.S16]] then local v32 = (ImS32)((ImS16)(v)); local r - v32, r = ImGui.SliderBehaviorT(ImS32, ImS32, bb, id, ImGuiDataType.S32, v32, min, max, format, flags, out_grab_bb) + v32, r = ImGui.SliderBehaviorT(ImS32, ImS32, bb, id, 4 --[[ImGuiDataType.S32]], v32, min, max, format, flags, out_grab_bb) if r then v = (ImS16)(v32) end return v, r - elseif data_type == ImGuiDataType.U16 then + elseif data_type == 3 --[[ImGuiDataType.U16]] then local v32 = (ImU32)((ImU16)(v)); local r - v32, r = ImGui.SliderBehaviorT(ImU32, ImS32, bb, id, ImGuiDataType.U32, v32, min, max, format, flags, out_grab_bb) + v32, r = ImGui.SliderBehaviorT(ImU32, ImS32, bb, id, 5 --[[ImGuiDataType.U32]], v32, min, max, format, flags, out_grab_bb) if r then v = (ImU16)(v32) end return v, r - elseif data_type == ImGuiDataType.S32 then - IM_ASSERT(min >= math.floor(IM_S32_MIN / 2) and max <= math.floor(IM_S32_MAX / 2)) + elseif data_type == 4 --[[ImGuiDataType.S32]] then + assert(min >= math.floor(IM_S32_MIN / 2) and max <= math.floor(IM_S32_MAX / 2)) return ImGui.SliderBehaviorT(ImS32, ImS32, bb, id, data_type, v, min, max, format, flags, out_grab_bb) - elseif data_type == ImGuiDataType.U32 then - IM_ASSERT(max <= math.floor(IM_U32_MAX / 2)) + elseif data_type == 5 --[[ImGuiDataType.U32]] then + assert(max <= math.floor(IM_U32_MAX / 2)) return ImGui.SliderBehaviorT(ImU32, ImS32, bb, id, data_type, v, min, max, format, flags, out_grab_bb) - elseif data_type == ImGuiDataType.Float then - IM_ASSERT(min >= -FLT_MAX / 2.0 and max <= FLT_MAX / 2.0) + elseif data_type == 6 --[[ImGuiDataType.Float]] then + assert(min >= -3.4028234663853e+38 --[[FLT_MAX]] / 2.0 and max <= 3.4028234663853e+38 --[[FLT_MAX]] / 2.0) return ImGui.SliderBehaviorT(float, float, bb, id, data_type, v, min, max, format, flags, out_grab_bb) - elseif data_type == ImGuiDataType.Double then - IM_ASSERT(min >= -DBL_MAX / 2.0 and max <= DBL_MAX / 2.0) + elseif data_type == 7 --[[ImGuiDataType.Double]] then + assert(min >= -1.7976931348623e+308 --[[DBL_MAX]] / 2.0 and max <= 1.7976931348623e+308 --[[DBL_MAX]] / 2.0) return ImGui.SliderBehaviorT(double, double, bb, id, data_type, v, min, max, format, flags, out_grab_bb) end - IM_ASSERT(false) + assert(false) return v, false end @@ -59048,7 +59091,7 @@ function ImGui.SliderScalar(label, data_type, data, min, max, format, flags) local style = g.Style local id = window:GetID(label) local w = ImGui.CalcItemWidth() - local color_marker = (bit32.band(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasColorMarker) ~= 0) and g.NextItemData.ColorMarker or 0 + local color_marker = (bit32.band(g.NextItemData.HasFlags, 32 --[[ImGuiNextItemDataFlags.HasColorMarker]]) ~= 0) and g.NextItemData.ColorMarker or 0 local label_end = ImGui.FindRenderedTextEnd(label) local label_size = ImGui.CalcTextSize(label, label_end, false) @@ -59058,9 +59101,9 @@ function ImGui.SliderScalar(label, data_type, data, min, max, format, flags) local total_bb = SliderScalar_total_bb -- [Luau] scratch: ItemSize()/ItemAdd() only read it total_bb.Min.x = frame_bb.Min.x; total_bb.Min.y = frame_bb.Min.y; total_bb.Max.x = total_bb_x; total_bb.Max.y = frame_bb.Max.y - local temp_input_allowed = bit32.band(flags, ImGuiSliderFlags.NoInput) == 0 + local temp_input_allowed = bit32.band(flags, 128 --[[ImGuiSliderFlags.NoInput]]) == 0 ImGui.ItemSize(total_bb, style.FramePadding.y) - local item_flags = temp_input_allowed and ImGuiItemFlags.Inputable or 0 + local item_flags = temp_input_allowed and 1048576 --[[ImGuiItemFlags.Inputable]] or 0 if not ImGui.ItemAdd(total_bb, id, frame_bb, item_flags) then return data, false end @@ -59074,13 +59117,13 @@ function ImGui.SliderScalar(label, data_type, data, min, max, format, flags) local temp_input_is_active = temp_input_allowed and ImGui.TempInputIsActive(id) if not temp_input_is_active then -- Tabbing or Ctrl+Click on Slider turns it into an input box - local clicked = hovered and ImGui.IsMouseClickedEx(0, ImGuiInputFlags.None, id) + local clicked = hovered and ImGui.IsMouseClickedEx(0, 0 --[[ImGuiInputFlags.None]], id) local make_active = clicked or g.NavActivateId == id if make_active and clicked then - ImGui.SetKeyOwner(ImGuiKey.MouseLeft, id) + ImGui.SetKeyOwner(656 --[[ImGuiKey.MouseLeft]], id) end if make_active and temp_input_allowed then - if (clicked and g.IO.KeyCtrl) or (g.NavActivateId == id and bit32.band(g.NavActivateFlags, ImGuiActivateFlags.PreferInput) ~= 0) then + if (clicked and g.IO.KeyCtrl) or (g.NavActivateId == id and bit32.band(g.NavActivateFlags, 1 --[[ImGuiActivateFlags.PreferInput]]) ~= 0) then temp_input_is_active = true end end @@ -59094,18 +59137,18 @@ function ImGui.SliderScalar(label, data_type, data, min, max, format, flags) ImGui.SetActiveID(id, window) ImGui.SetFocusID(id, window) ImGui.FocusWindow(window) - g.ActiveIdUsingNavDirMask = bit32.bor(g.ActiveIdUsingNavDirMask, bit32.lshift(1, ImGuiDir.Left), bit32.lshift(1, ImGuiDir.Right)) + g.ActiveIdUsingNavDirMask = bit32.bor(g.ActiveIdUsingNavDirMask, bit32.lshift(1, 0 --[[ImGuiDir.Left]]), bit32.lshift(1, 1 --[[ImGuiDir.Right]])) end end if temp_input_is_active then -- Only clamp Ctrl+Click input when ImGuiSliderFlags.ClampOnInput is set (generally via ImGuiSliderFlags.AlwaysClamp) - local clamp_enabled = bit32.band(flags, ImGuiSliderFlags.ClampOnInput) ~= 0 -- Don't use TempInputIsClampEnabled() + local clamp_enabled = bit32.band(flags, 512 --[[ImGuiSliderFlags.ClampOnInput]]) ~= 0 -- Don't use TempInputIsClampEnabled() return ImGui.TempInputScalar(frame_bb, id, label, data_type, data, format, clamp_enabled and min or nil, clamp_enabled and max or nil) end -- Draw frame - local frame_col = ImGui.GetColorU32((g.ActiveId == id) and ImGuiCol.FrameBgActive or (hovered and ImGuiCol.FrameBgHovered or ImGuiCol.FrameBg)) + local frame_col = ImGui.GetColorU32((g.ActiveId == id) and 9 --[[ImGuiCol.FrameBgActive]] or (hovered and 8 --[[ImGuiCol.FrameBgHovered]] or 7 --[[ImGuiCol.FrameBg]])) ImGui.RenderNavCursor(frame_bb, id) ImGui.RenderFrame(frame_bb.Min, frame_bb.Max, frame_col, false, style.FrameRounding) if color_marker ~= 0 and style.ColorMarkerSize > 0.0 then @@ -59123,7 +59166,7 @@ function ImGui.SliderScalar(label, data_type, data, min, max, format, flags) -- Render grab if grab_bb.Max.x > grab_bb.Min.x then - window.DrawList:AddRectFilled(grab_bb.Min, grab_bb.Max, ImGui.GetColorU32((g.ActiveId == id) and ImGuiCol.SliderGrabActive or ImGuiCol.SliderGrab), style.GrabRounding) + window.DrawList:AddRectFilled(grab_bb.Min, grab_bb.Max, ImGui.GetColorU32((g.ActiveId == id) and 21 --[[ImGuiCol.SliderGrabActive]] or 20 --[[ImGuiCol.SliderGrab]]), style.GrabRounding) end -- TODO: ImGui.DataTypeFormatString() should be used here instead of ImFormatString() @@ -59170,7 +59213,7 @@ function ImGui.SliderScalarN(label, data_type, v, components, v_min, v_max, form if i > 1 then ImGui.SameLine(0, g.Style.ItemInnerSpacing.x) end - if bit32.band(flags, ImGuiSliderFlags.ColorMarkers) ~= 0 then + if bit32.band(flags, 4096 --[[ImGuiSliderFlags.ColorMarkers]]) ~= 0 then ImGui.SetNextItemColorMarker(GDefaultRgbaColorMarkers[i]) end local changed @@ -59198,7 +59241,7 @@ end --- @param format? string --- @param flags? ImGuiSliderFlags function ImGui.SliderFloat2(label, v, v_min, v_max, format, flags) - return ImGui.SliderScalarN(label, ImGuiDataType.Float, v, 2, v_min, v_max, format, flags) + return ImGui.SliderScalarN(label, 6 --[[ImGuiDataType.Float]], v, 2, v_min, v_max, format, flags) end --- @param label string @@ -59208,7 +59251,7 @@ end --- @param format? string --- @param flags? ImGuiSliderFlags function ImGui.SliderFloat3(label, v, v_min, v_max, format, flags) - return ImGui.SliderScalarN(label, ImGuiDataType.Float, v, 3, v_min, v_max, format, flags) + return ImGui.SliderScalarN(label, 6 --[[ImGuiDataType.Float]], v, 3, v_min, v_max, format, flags) end --- @param label string @@ -59218,7 +59261,7 @@ end --- @param format? string --- @param flags? ImGuiSliderFlags function ImGui.SliderFloat4(label, v, v_min, v_max, format, flags) - return ImGui.SliderScalarN(label, ImGuiDataType.Float, v, 4, v_min, v_max, format, flags) + return ImGui.SliderScalarN(label, 6 --[[ImGuiDataType.Float]], v, 4, v_min, v_max, format, flags) end --- @param label string @@ -59231,7 +59274,7 @@ function ImGui.SliderFloat(label, v, v_min, v_max, format, flags) if format == nil then format = "%.3f" end if flags == nil then flags = 0 end - return ImGui.SliderScalar(label, ImGuiDataType.Float, v, v_min, v_max, format, flags) + return ImGui.SliderScalar(label, 6 --[[ImGuiDataType.Float]], v, v_min, v_max, format, flags) end --- @param label string @@ -59248,11 +59291,11 @@ function ImGui.SliderAngle(label, v_rad, v_degrees_min, v_degrees_max, format, f if format == nil then format = "%.0f deg" end if flags == nil then flags = 0 end - local v_deg = v_rad * 360.0 / (2 * IM_PI) + local v_deg = v_rad * 360.0 / (2 * 3.141592653589793 --[[IM_PI]]) local value_changed v_deg, value_changed = ImGui.SliderFloat(label, v_deg, v_degrees_min, v_degrees_max, format, flags) if value_changed then - v_rad = v_deg * (2 * IM_PI) / 360.0 + v_rad = v_deg * (2 * 3.141592653589793 --[[IM_PI]]) / 360.0 end return v_rad, value_changed end @@ -59267,19 +59310,19 @@ function ImGui.SliderInt(label, v, v_min, v_max, format, flags) if format == nil then format = "%d" end if flags == nil then flags = 0 end - return ImGui.SliderScalar(label, ImGuiDataType.S32, v, v_min, v_max, format, flags) + return ImGui.SliderScalar(label, 4 --[[ImGuiDataType.S32]], v, v_min, v_max, format, flags) end function ImGui.SliderInt2(label, v, v_min, v_max, format, flags) - return ImGui.SliderScalarN(label, ImGuiDataType.S32, v, 2, v_min, v_max, format or "%d", flags) + return ImGui.SliderScalarN(label, 4 --[[ImGuiDataType.S32]], v, 2, v_min, v_max, format or "%d", flags) end function ImGui.SliderInt3(label, v, v_min, v_max, format, flags) - return ImGui.SliderScalarN(label, ImGuiDataType.S32, v, 3, v_min, v_max, format or "%d", flags) + return ImGui.SliderScalarN(label, 4 --[[ImGuiDataType.S32]], v, 3, v_min, v_max, format or "%d", flags) end function ImGui.SliderInt4(label, v, v_min, v_max, format, flags) - return ImGui.SliderScalarN(label, ImGuiDataType.S32, v, 4, v_min, v_max, format or "%d", flags) + return ImGui.SliderScalarN(label, 4 --[[ImGuiDataType.S32]], v, 4, v_min, v_max, format or "%d", flags) end --- @param label string @@ -59317,33 +59360,33 @@ function ImGui.VSliderScalar(label, size, data_type, data, min, max, format, fla end local hovered = ImGui.ItemHoverable(frame_bb, id, g.LastItemData.ItemFlags) - local clicked = hovered and ImGui.IsMouseClickedEx(0, ImGuiInputFlags.None, id) + local clicked = hovered and ImGui.IsMouseClickedEx(0, 0 --[[ImGuiInputFlags.None]], id) if clicked or g.NavActivateId == id then if clicked then - ImGui.SetKeyOwner(ImGuiKey.MouseLeft, id) + ImGui.SetKeyOwner(656 --[[ImGuiKey.MouseLeft]], id) end ImGui.SetActiveID(id, window) ImGui.SetFocusID(id, window) ImGui.FocusWindow(window) - g.ActiveIdUsingNavDirMask = bit32.bor(g.ActiveIdUsingNavDirMask, bit32.lshift(1, ImGuiDir.Up), bit32.lshift(1, ImGuiDir.Down)) + g.ActiveIdUsingNavDirMask = bit32.bor(g.ActiveIdUsingNavDirMask, bit32.lshift(1, 2 --[[ImGuiDir.Up]]), bit32.lshift(1, 3 --[[ImGuiDir.Down]])) end -- Draw frame - local frame_col = ImGui.GetColorU32((g.ActiveId == id) and ImGuiCol.FrameBgActive or (hovered and ImGuiCol.FrameBgHovered or ImGuiCol.FrameBg)) + local frame_col = ImGui.GetColorU32((g.ActiveId == id) and 9 --[[ImGuiCol.FrameBgActive]] or (hovered and 8 --[[ImGuiCol.FrameBgHovered]] or 7 --[[ImGuiCol.FrameBg]])) ImGui.RenderNavCursor(frame_bb, id) ImGui.RenderFrame(frame_bb.Min, frame_bb.Max, frame_col, true, g.Style.FrameRounding) -- Slider behavior local grab_bb = ImRect() local value_changed - data, value_changed = ImGui.SliderBehavior(frame_bb, id, data_type, data, min, max, format, bit32.bor(flags or 0, ImGuiSliderFlags.Vertical), grab_bb) + data, value_changed = ImGui.SliderBehavior(frame_bb, id, data_type, data, min, max, format, bit32.bor(flags or 0, 1048576 --[[ImGuiSliderFlags.Vertical]]), grab_bb) if value_changed then ImGui.MarkItemEdited(id) end -- Render grab if grab_bb.Max.y > grab_bb.Min.y then - window.DrawList:AddRectFilled(grab_bb.Min, grab_bb.Max, ImGui.GetColorU32((g.ActiveId == id) and ImGuiCol.SliderGrabActive or ImGuiCol.SliderGrab), style.GrabRounding) + window.DrawList:AddRectFilled(grab_bb.Min, grab_bb.Max, ImGui.GetColorU32((g.ActiveId == id) and 21 --[[ImGuiCol.SliderGrabActive]] or 20 --[[ImGuiCol.SliderGrab]]), style.GrabRounding) end -- Display value using user-provided display format so user can add prefix/suffix/decorations to the value. @@ -59369,7 +59412,7 @@ end function ImGui.VSliderFloat(label, size, v, v_min, v_max, format, flags) if format == nil then format = "%.3f" end - return ImGui.VSliderScalar(label, size, ImGuiDataType.Float, v, v_min, v_max, format, flags) + return ImGui.VSliderScalar(label, size, 6 --[[ImGuiDataType.Float]], v, v_min, v_max, format, flags) end --- @param label string @@ -59382,7 +59425,7 @@ end function ImGui.VSliderInt(label, size, v, v_min, v_max, format, flags) if format == nil then format = "%d" end - return ImGui.VSliderScalar(label, size, ImGuiDataType.S32, v, v_min, v_max, format, flags) + return ImGui.VSliderScalar(label, size, 4 --[[ImGuiDataType.S32]], v, v_min, v_max, format, flags) end ------------------------------------------------------------------------------- @@ -59405,7 +59448,7 @@ end function ImGui.InputText(label, buf, buf_size, flags, callback, user_data) if flags == nil then flags = 0 end - IM_ASSERT(bit32.band(flags, ImGuiInputTextFlags.Multiline) == 0) -- call InputTextMultiline() + assert(bit32.band(flags, 67108864 --[[ImGuiInputTextFlags.Multiline]]) == 0) -- call InputTextMultiline() return ImGui.InputTextEx(label, nil, buf, buf_size, ImVec2(0, 0), flags, callback, user_data) end @@ -59425,7 +59468,7 @@ end --- @param size? ImVec2 function ImGui.InputTextMultiline(label, buf, buf_size, size, flags, callback, user_data) - return ImGui.InputTextEx(label, nil, buf, buf_size, size or ImVec2(0, 0), bit32.bor(flags or 0, ImGuiInputTextFlags.Multiline), callback, user_data) + return ImGui.InputTextEx(label, nil, buf, buf_size, size or ImVec2(0, 0), bit32.bor(flags or 0, 67108864 --[[ImGuiInputTextFlags.Multiline]]), callback, user_data) end ImStb = {} @@ -59449,8 +59492,8 @@ local function InputTextCalcTextSize(ctx, text, text_begin, text_end_display, te local g = ctx local obj = g.InputTextState - IM_ASSERT(text_end_display >= text_begin and text_end_display <= text_end) - return ImFontCalcTextSizeEx(g.Font, g.FontSize, FLT_MAX, obj.WrapWidth, text, text_begin, text_end_display, text_end, out_offset, flags) + assert(text_end_display >= text_begin and text_end_display <= text_end) + return ImFontCalcTextSizeEx(g.Font, g.FontSize, 3.4028234663853e+38 --[[FLT_MAX]], obj.WrapWidth, text, text_begin, text_end_display, text_end, out_offset, flags) end -- Wrapper for stb_textedit.h to edit text (our wrapper is for: statically sized buffer, single-line, wchar characters. InputText converts between UTF-8 and wchar) @@ -59464,7 +59507,7 @@ function ImStb.TEXTEDIT_STRINGLEN(obj) return obj.TextLen end --- @param obj ImGuiInputTextState --- @param idx int # 1-based -function ImStb.TEXTEDIT_GETCHAR(obj, idx) IM_ASSERT(idx >= 1 and idx <= obj.TextLen + 1); return obj.TextSrc[idx] end +function ImStb.TEXTEDIT_GETCHAR(obj, idx) assert(idx >= 1 and idx <= obj.TextLen + 1); return obj.TextSrc[idx] end --- @param obj ImGuiInputTextState --- @param line_start_idx int # 1-based @@ -59477,7 +59520,7 @@ function ImStb.TEXTEDIT_GETWIDTH(obj, line_start_idx, char_idx) local _, c = ImS --- @param line_start_idx int # 1-based function ImStb.TEXTEDIT_LAYOUTROW(r, obj, line_start_idx) local text = obj.TextSrc - local size, text_remaining = InputTextCalcTextSize(obj.Ctx, text, line_start_idx, obj.TextLen + 1, obj.TextLen + 1, nil, bit32.bor(ImDrawTextFlags.StopOnNewLine, ImDrawTextFlags.WrapKeepBlanks)) + local size, text_remaining = InputTextCalcTextSize(obj.Ctx, text, line_start_idx, obj.TextLen + 1, obj.TextLen + 1, nil, bit32.bor(4 --[[ImDrawTextFlags.StopOnNewLine]], 2 --[[ImDrawTextFlags.WrapKeepBlanks]])) r.x0 = 0.0 r.x1 = size.x r.baseline_y_delta = size.y @@ -59529,7 +59572,7 @@ end --- @param idx int function ImStb.is_word_boundary_from_right(obj, idx) -- When ImGuiInputTextFlags.Password is set, we don't want actions such as Ctrl+Arrow to leak the fact that underlying data are blanks or separators. - if bit32.band(obj.Flags, ImGuiInputTextFlags.Password) ~= 0 or idx <= 1 then + if bit32.band(obj.Flags, 1024 --[[ImGuiInputTextFlags.Password]]) ~= 0 or idx <= 1 then return false end @@ -59547,7 +59590,7 @@ end --- @param obj ImGuiInputTextState --- @param idx int function ImStb.is_word_boundary_from_left(obj, idx) - if bit32.band(obj.Flags, ImGuiInputTextFlags.Password) ~= 0 or idx <= 1 then + if bit32.band(obj.Flags, 1024 --[[ImGuiInputTextFlags.Password]]) ~= 0 or idx <= 1 then return false end @@ -59620,11 +59663,11 @@ function ImStb.TEXTEDIT_MOVELINESTART(obj, state, cursor) local p = bol local text_end = obj.TextLen + 1 -- End of line would be enough while p >= bol do - local eol = ImFontCalcWordWrapPositionEx(g.Font, g.FontSize, obj.TextSrc, p, text_end, obj.WrapWidth, ImDrawTextFlags.WrapKeepBlanks) + local eol = ImFontCalcWordWrapPositionEx(g.Font, g.FontSize, obj.TextSrc, p, text_end, obj.WrapWidth, 2 --[[ImDrawTextFlags.WrapKeepBlanks]]) if p == cursor then -- If we are already on a visible beginning-of-line, return real beginning-of-line (would be same as regular handler below) return bol end - if eol == cursor and obj.TextA[cursor] ~= 10 and obj.LastMoveDirectionLR == ImGuiDir.Left then + if eol == cursor and obj.TextA[cursor] ~= 10 and obj.LastMoveDirectionLR == 0 --[[ImGuiDir.Left]] then return bol end if eol >= cursor then @@ -59637,7 +59680,7 @@ function ImStb.TEXTEDIT_MOVELINESTART(obj, state, cursor) -- Regular handler, same as stb_textedit_move_line_start() while cursor > 1 do local prev_cursor = ImStb.TEXTEDIT_GETPREVCHARINDEX(obj, cursor) - if (ImStb.TEXTEDIT_GETCHAR(obj, prev_cursor) == STB_TEXTEDIT_NEWLINE) then + if (ImStb.TEXTEDIT_GETCHAR(obj, prev_cursor) == 10 --[[STB_TEXTEDIT_NEWLINE]]) then break end cursor = prev_cursor @@ -59659,9 +59702,9 @@ function ImStb.TEXTEDIT_MOVELINEEND(obj, state, cursor) local p = ImStd.ImStrbol(obj.TextSrc, cursor, 1) local text_end = obj.TextLen + 1 -- End of line would be enough while p < text_end do - local eol = ImFontCalcWordWrapPositionEx(g.Font, g.FontSize, obj.TextSrc, p, text_end, obj.WrapWidth, ImDrawTextFlags.WrapKeepBlanks) + local eol = ImFontCalcWordWrapPositionEx(g.Font, g.FontSize, obj.TextSrc, p, text_end, obj.WrapWidth, 2 --[[ImDrawTextFlags.WrapKeepBlanks]]) cursor = eol - if eol == cursor and obj.LastMoveDirectionLR ~= ImGuiDir.Left then -- If we are already on a visible end-of-line, switch to regular handle + if eol == cursor and obj.LastMoveDirectionLR ~= 0 --[[ImGuiDir.Left]] then -- If we are already on a visible end-of-line, switch to regular handle break end if eol > cursor then @@ -59672,7 +59715,7 @@ function ImStb.TEXTEDIT_MOVELINEEND(obj, state, cursor) end -- Regular handler, same as stb_textedit_move_line_end() - while (cursor < n and ImStb.TEXTEDIT_GETCHAR(obj, cursor) ~= STB_TEXTEDIT_NEWLINE) do + while (cursor < n and ImStb.TEXTEDIT_GETCHAR(obj, cursor) ~= 10 --[[STB_TEXTEDIT_NEWLINE]]) do cursor = ImStb.TEXTEDIT_GETNEXTCHARINDEX(obj, cursor) end return cursor @@ -59683,7 +59726,7 @@ end --- @param n int function ImStb.TEXTEDIT_DELETECHARS(obj, pos, n) -- Offset remaining text (+ copy zero terminator) - IM_ASSERT(obj.TextSrc == obj.TextA.Data) + assert(obj.TextSrc == obj.TextA.Data) ImStd.memmove(obj.TextA.Data, pos, obj.TextA.Data, pos + n, obj.TextLen - n - pos + 2) obj.EditedBefore = true obj.EditedThisFrame = true @@ -59696,9 +59739,9 @@ end --- @param new_text_pos int --- @param new_text_len int function ImStb.TEXTEDIT_INSERTCHARS(obj, pos, new_text, new_text_pos, new_text_len) - local is_resizable = bit32.band(obj.Flags, ImGuiInputTextFlags.CallbackResize) ~= 0 + local is_resizable = bit32.band(obj.Flags, 4194304 --[[ImGuiInputTextFlags.CallbackResize]]) ~= 0 local text_len = obj.TextLen - IM_ASSERT(pos <= text_len + 1) + assert(pos <= text_len + 1) -- We support partial insertion (with a mod in stb_textedit.h) local avail = obj.BufCapacity - 1 - obj.TextLen @@ -59710,7 +59753,7 @@ function ImStb.TEXTEDIT_INSERTCHARS(obj, pos, new_text, new_text_pos, new_text_l end -- Grow internal buffer if needed - IM_ASSERT(obj.TextSrc == obj.TextA.Data) + assert(obj.TextSrc == obj.TextA.Data) if text_len + new_text_len + 1 > obj.TextA.Size and is_resizable then obj.TextA:resize(text_len + ImClamp(new_text_len, 32, ImMax(256, new_text_len)) + 1) obj.TextSrc = obj.TextA.Data @@ -59758,7 +59801,7 @@ function ImStb.stb_textedit_replace(str, state, text, text_len) return end - IM_ASSERT(false) -- Failed to insert character, normally shouldn't happen because of how we currently use stb_textedit_replace() + assert(false) -- Failed to insert character, normally shouldn't happen because of how we currently use stb_textedit_replace() end local MT = ImGui.GetMetatables() @@ -59770,11 +59813,11 @@ function MT.ImGuiInputTextState:OnKeyPressed(key) stbte.key(self, self.Stb, key) self.CursorFollow = true self:CursorAnimReset() - local key_u = bit32.band(key, bit32.bnot(STB_TEXTEDIT_K_SHIFT)) - if key_u == STB_TEXTEDIT_K_LEFT or key_u == STB_TEXTEDIT_K_LINESTART or key_u == STB_TEXTEDIT_K_TEXTSTART or key_u == STB_TEXTEDIT_K_BACKSPACE or key_u == STB_TEXTEDIT_K_WORDLEFT then - self.LastMoveDirectionLR = ImGuiDir.Left - elseif key_u == STB_TEXTEDIT_K_RIGHT or key_u == STB_TEXTEDIT_K_LINEEND or key_u == STB_TEXTEDIT_K_TEXTEND or key_u == STB_TEXTEDIT_K_DELETE or key_u == STB_TEXTEDIT_K_WORDRIGHT then - self.LastMoveDirectionLR = ImGuiDir.Right + local key_u = bit32.band(key, bit32.bnot(4194304 --[[STB_TEXTEDIT_K_SHIFT]])) + if key_u == 2097152 --[[STB_TEXTEDIT_K_LEFT]] or key_u == 2097156 --[[STB_TEXTEDIT_K_LINESTART]] or key_u == 2097158 --[[STB_TEXTEDIT_K_TEXTSTART]] or key_u == 2097161 --[[STB_TEXTEDIT_K_BACKSPACE]] or key_u == 2097164 --[[STB_TEXTEDIT_K_WORDLEFT]] then + self.LastMoveDirectionLR = 0 --[[ImGuiDir.Left]] + elseif key_u == 2097153 --[[STB_TEXTEDIT_K_RIGHT]] or key_u == 2097157 --[[STB_TEXTEDIT_K_LINEEND]] or key_u == 2097159 --[[STB_TEXTEDIT_K_TEXTEND]] or key_u == 2097160 --[[STB_TEXTEDIT_K_DELETE]] or key_u == 2097165 --[[STB_TEXTEDIT_K_WORDRIGHT]] then + self.LastMoveDirectionLR = 1 --[[ImGuiDir.Right]] end end @@ -59815,14 +59858,14 @@ end function ImGui.PushPasswordFont() local g = GImGui local backup = g.InputTextPasswordFontBackupBaked - IM_ASSERT(backup.IndexAdvanceX.Size == 0 and backup.IndexLookup.Size == 0) + assert(backup.IndexAdvanceX.Size == 0 and backup.IndexLookup.Size == 0) local glyph = g.FontBaked:FindGlyph(42) -- '*' g.InputTextPasswordFontBackupFlags = g.Font.Flags backup.FallbackGlyphIndex = g.FontBaked.FallbackGlyphIndex backup.FallbackAdvanceX = g.FontBaked.FallbackAdvanceX backup.IndexLookup:swap(g.FontBaked.IndexLookup) backup.IndexAdvanceX:swap(g.FontBaked.IndexAdvanceX) - g.Font.Flags = bit32.bor(g.Font.Flags, ImFontFlags.NoLoadGlyphs) + g.Font.Flags = bit32.bor(g.Font.Flags, 4 --[[ImFontFlags.NoLoadGlyphs]]) g.FontBaked.FallbackGlyphIndex = g.FontBaked.Glyphs:index_from_ptr(glyph) + 1 g.FontBaked.FallbackAdvanceX = glyph.AdvanceX end @@ -59835,7 +59878,7 @@ function ImGui.PopPasswordFont() g.FontBaked.FallbackAdvanceX = backup.FallbackAdvanceX g.FontBaked.IndexLookup:swap(backup.IndexLookup) g.FontBaked.IndexAdvanceX:swap(backup.IndexAdvanceX) - IM_ASSERT(backup.IndexAdvanceX.Size == 0 and backup.IndexLookup.Size == 0) + assert(backup.IndexAdvanceX.Size == 0 and backup.IndexLookup.Size == 0) end -- Return false to discard a character. Returns (char, ok). @@ -59850,7 +59893,7 @@ end local function InputTextFilterCharacter(ctx, state, char, callback, user_data, input_source_is_clipboard) if input_source_is_clipboard == nil then input_source_is_clipboard = false end - IM_ASSERT(state ~= nil) + assert(state ~= nil) local c = char local flags = state.Flags @@ -59859,14 +59902,14 @@ local function InputTextFilterCharacter(ctx, state, char, callback, user_data, i local apply_named_filters = true if c < 0x20 then local pass = false - pass = pass or (c == 10) and (bit32.band(flags, ImGuiInputTextFlags.Multiline) ~= 0) -- Note that an Enter KEY will emit \r and be ignored (we poll for KEY in InputText() code) - if c == 10 and input_source_is_clipboard and (bit32.band(flags, ImGuiInputTextFlags.Multiline) == 0) then -- In single line mode, replace \n with a space + pass = pass or (c == 10) and (bit32.band(flags, 67108864 --[[ImGuiInputTextFlags.Multiline]]) ~= 0) -- Note that an Enter KEY will emit \r and be ignored (we poll for KEY in InputText() code) + if c == 10 and input_source_is_clipboard and (bit32.band(flags, 67108864 --[[ImGuiInputTextFlags.Multiline]]) == 0) then -- In single line mode, replace \n with a space char = 32 c = 32 pass = true end - pass = pass or (c == 10) and (bit32.band(flags, ImGuiInputTextFlags.Multiline) ~= 0) - pass = pass or (c == 9) and (bit32.band(flags, ImGuiInputTextFlags.AllowTabInput) ~= 0) -- tab + pass = pass or (c == 10) and (bit32.band(flags, 67108864 --[[ImGuiInputTextFlags.Multiline]]) ~= 0) + pass = pass or (c == 9) and (bit32.band(flags, 32 --[[ImGuiInputTextFlags.AllowTabInput]]) ~= 0) -- tab if not pass then return char, false end @@ -59886,12 +59929,12 @@ local function InputTextFilterCharacter(ctx, state, char, callback, user_data, i end -- Filter Unicode ranges we are not handling in this build - if c > IM_UNICODE_CODEPOINT_MAX then + if c > 65535 --[[IM_UNICODE_CODEPOINT_MAX]] then return char, false end -- Generic named filters - if apply_named_filters and (bit32.band(flags, bit32.bor(ImGuiInputTextFlags.CharsDecimal, ImGuiInputTextFlags.CharsHexadecimal, ImGuiInputTextFlags.CharsUppercase, ImGuiInputTextFlags.CharsNoBlank, ImGuiInputTextFlags.CharsScientific, ImGuiInputTextFlags.LocalizeDecimalPoint))) ~= 0 then + if apply_named_filters and (bit32.band(flags, bit32.bor(1 --[[ImGuiInputTextFlags.CharsDecimal]], 2 --[[ImGuiInputTextFlags.CharsHexadecimal]], 8 --[[ImGuiInputTextFlags.CharsUppercase]], 16 --[[ImGuiInputTextFlags.CharsNoBlank]], 4 --[[ImGuiInputTextFlags.CharsScientific]], 268435456 --[[ImGuiInputTextFlags.LocalizeDecimalPoint]]))) ~= 0 then -- The standard mandate that programs starts in the "C" locale where the decimal point is '.'. -- We don't really intend to provide widespread support for it, but out of empathy for people stuck with using odd API, we support the bare minimum aka overriding the decimal point. -- Change the default decimal_point with: @@ -59899,7 +59942,7 @@ local function InputTextFilterCharacter(ctx, state, char, callback, user_data, i -- Users of non-default decimal point (in particular ',') may be affected by word-selection logic (is_word_boundary_from_right/is_word_boundary_from_left) functions. local g = ctx local c_decimal_point = g.PlatformIO.Platform_LocaleDecimalPoint - if bit32.band(flags, bit32.bor(ImGuiInputTextFlags.CharsDecimal, ImGuiInputTextFlags.CharsScientific, ImGuiInputTextFlags.LocalizeDecimalPoint)) ~= 0 then + if bit32.band(flags, bit32.bor(1 --[[ImGuiInputTextFlags.CharsDecimal]], 4 --[[ImGuiInputTextFlags.CharsScientific]], 268435456 --[[ImGuiInputTextFlags.LocalizeDecimalPoint]])) ~= 0 then if c == 46 or c == 44 then -- '.' or ',' c = c_decimal_point end @@ -59908,41 +59951,41 @@ local function InputTextFilterCharacter(ctx, state, char, callback, user_data, i -- Full-width -> half-width conversion for numeric fields: https://en.wikipedia.org/wiki/Halfwidth_and_Fullwidth_Forms_(Unicode_block) -- While this is mostly convenient, this has the side-effect for uninformed users accidentally inputting full-width characters that they may -- scratch their head as to why it works in numerical fields vs in generic text fields it would require support in the font. - if bit32.band(flags, bit32.bor(ImGuiInputTextFlags.CharsDecimal, ImGuiInputTextFlags.CharsScientific, ImGuiInputTextFlags.CharsHexadecimal)) ~= 0 then + if bit32.band(flags, bit32.bor(1 --[[ImGuiInputTextFlags.CharsDecimal]], 4 --[[ImGuiInputTextFlags.CharsScientific]], 2 --[[ImGuiInputTextFlags.CharsHexadecimal]])) ~= 0 then if c >= 0xFF01 and c <= 0xFF5E then c = c - 0xFF01 + 0x21 end end -- Allow 0-9 . - + * / - if bit32.band(flags, ImGuiInputTextFlags.CharsDecimal) ~= 0 then + if bit32.band(flags, 1 --[[ImGuiInputTextFlags.CharsDecimal]]) ~= 0 then if not (c >= 48 and c <= 57) and (c ~= c_decimal_point) and (c ~= 45) and (c ~= 43) and (c ~= 42) and (c ~= 47) then -- 0-9 . - + * / return char, false end end -- Allow 0-9 . - + * / e E - if bit32.band(flags, ImGuiInputTextFlags.CharsScientific) ~= 0 then + if bit32.band(flags, 4 --[[ImGuiInputTextFlags.CharsScientific]]) ~= 0 then if not (c >= 48 and c <= 57) and (c ~= c_decimal_point) and (c ~= 45) and (c ~= 43) and (c ~= 42) and (c ~= 47) and (c ~= 101) and (c ~= 69) then -- 0-9 . - + * / e E return char, false end end -- Allow 0-9 a-F A-F - if bit32.band(flags, ImGuiInputTextFlags.CharsHexadecimal) ~= 0 then + if bit32.band(flags, 2 --[[ImGuiInputTextFlags.CharsHexadecimal]]) ~= 0 then if not (c >= 48 and c <= 57) and not (c >= 97 and c <= 102) and not (c >= 65 and c <= 70) then -- 0-9 a-f A-F return char, false end end -- Turn a-z into A-Z - if bit32.band(flags, ImGuiInputTextFlags.CharsUppercase) ~= 0 then + if bit32.band(flags, 8 --[[ImGuiInputTextFlags.CharsUppercase]]) ~= 0 then if c >= 97 and c <= 122 then -- a-z c = c + (65 - 97) -- 'A' - 'a' end end - if bit32.band(flags, ImGuiInputTextFlags.CharsNoBlank) ~= 0 then + if bit32.band(flags, 16 --[[ImGuiInputTextFlags.CharsNoBlank]]) ~= 0 then if ImStd.ImCharIsBlankW(c) then return char, false end @@ -59952,13 +59995,13 @@ local function InputTextFilterCharacter(ctx, state, char, callback, user_data, i end -- Custom callback filter - if bit32.band(flags, ImGuiInputTextFlags.CallbackCharFilter) ~= 0 then + if bit32.band(flags, 2097152 --[[ImGuiInputTextFlags.CallbackCharFilter]]) ~= 0 then local g = GImGui local callback_data = ImGuiInputTextCallbackData() callback_data.Ctx = g callback_data.ID = state.ID callback_data.Flags = flags - callback_data.EventFlag = ImGuiInputTextFlags.CallbackCharFilter + callback_data.EventFlag = 2097152 --[[ImGuiInputTextFlags.CallbackCharFilter]] callback_data.EventChar = c callback_data.EventActivated = (state ~= nil and g.ActiveId == state.ID and g.ActiveIdIsJustActivated) callback_data.CursorPos = state.Stb.cursor @@ -60040,10 +60083,10 @@ function ImGui.InputTextDeactivateHook(id) g.InputTextDeactivatedState.ID = state.ID g.InputTextDeactivatedState.ElapseFrame = g.FrameCount + 1 - if bit32.band(state.Flags, ImGuiInputTextFlags.ReadOnly) ~= 0 then + if bit32.band(state.Flags, 512 --[[ImGuiInputTextFlags.ReadOnly]]) ~= 0 then g.InputTextDeactivatedState.TextA:resize(0) -- In theory this data won't be used, but clear to be neat. else - IM_ASSERT(state.TextA.Data ~= nil) + assert(state.TextA.Data ~= nil) -- IM_ASSERT(state.TextA[state.TextLen + 1] == 0) g.InputTextDeactivatedState.TextA:resize(state.TextLen + 1) ImStd.memmove(g.InputTextDeactivatedState.TextA.Data, 1, state.TextA.Data, 1, state.TextLen) -- state.TextLen + 1 @@ -60065,13 +60108,13 @@ local function InputTextLineIndexBuild(flags, line_index, buf, buf_end, wrap_wid local size = 0 local s = 1 local trailing_line_already_counted = false - if bit32.band(flags, ImGuiInputTextFlags.WordWrap) ~= 0 then + if bit32.band(flags, 16777216 --[[ImGuiInputTextFlags.WordWrap]]) ~= 0 then while s < buf_end do if size <= max_output_buffer_size then line_index.Offsets:push_back(s - 1) end size = size + 1 - s = ImFontCalcWordWrapPositionEx(g.Font, g.FontSize, buf, s, buf_end, wrap_width, ImDrawTextFlags.WrapKeepBlanks) + s = ImFontCalcWordWrapPositionEx(g.Font, g.FontSize, buf, s, buf_end, wrap_width, 2 --[[ImDrawTextFlags.WrapKeepBlanks]]) if buf[s] == 10 then s = s + 1 end end @@ -60163,7 +60206,7 @@ local function InputTextLineIndexGetPosOffset(g, state, line_index, buf, buf_end local it = ImLowerBound(line_index.Offsets, 1, line_index.Offsets.Size + 1, cursor_ptr) if it > 1 then - if it > line_index.Offsets.Size or line_index.Offsets[it] ~= cursor_ptr or (state ~= nil and state.WrapWidth > 0.0 and state.LastMoveDirectionLR == ImGuiDir.Right and + if it > line_index.Offsets.Size or line_index.Offsets[it] ~= cursor_ptr or (state ~= nil and state.WrapWidth > 0.0 and state.LastMoveDirectionLR == 1 --[[ImGuiDir.Right]] and buf[cursor_ptr - 1] ~= 10 and buf[cursor_ptr - 1] ~= 0) then it = it - 1 end @@ -60173,7 +60216,7 @@ local function InputTextLineIndexGetPosOffset(g, state, line_index, buf, buf_end local line_start = (line_no == 1) and 1 or line_index.Offsets[line_no] + 1 local offset = ImVec2() - offset.x = InputTextCalcTextSize(g, buf, line_start, cursor_ptr, buf_end, nil, ImDrawTextFlags.WrapKeepBlanks).x + offset.x = InputTextCalcTextSize(g, buf, line_start, cursor_ptr, buf_end, nil, 2 --[[ImDrawTextFlags.WrapKeepBlanks]]).x offset.y = line_no * g.FontSize return offset @@ -60209,19 +60252,19 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback return false end - IM_ASSERT(buf ~= nil and buf_size >= 0) - IM_ASSERT(not (bit32.band(flags, ImGuiInputTextFlags.CallbackHistory) ~= 0 and bit32.band(flags, ImGuiInputTextFlags.Multiline) ~= 0)) -- Can't use both together (they both use up/down keys) - IM_ASSERT(not (bit32.band(flags, ImGuiInputTextFlags.CallbackCompletion) ~= 0 and bit32.band(flags, ImGuiInputTextFlags.AllowTabInput) ~= 0)) -- Can't use both together (they both use tab key) - IM_ASSERT(not (bit32.band(flags, ImGuiInputTextFlags.ElideLeft) ~= 0 and bit32.band(flags, ImGuiInputTextFlags.Multiline) ~= 0)) -- Multiline does not work with left-trimming - IM_ASSERT(bit32.band(flags, ImGuiInputTextFlags.WordWrap) == 0 or bit32.band(flags, ImGuiInputTextFlags.Password) == 0) -- WordWrap does not work with Password mode. - IM_ASSERT(bit32.band(flags, ImGuiInputTextFlags.WordWrap) == 0 or bit32.band(flags, ImGuiInputTextFlags.Multiline) ~= 0) -- WordWrap does not work in single-line mode. + assert(buf ~= nil and buf_size >= 0) + assert(not (bit32.band(flags, 524288 --[[ImGuiInputTextFlags.CallbackHistory]]) ~= 0 and bit32.band(flags, 67108864 --[[ImGuiInputTextFlags.Multiline]]) ~= 0)) -- Can't use both together (they both use up/down keys) + assert(not (bit32.band(flags, 262144 --[[ImGuiInputTextFlags.CallbackCompletion]]) ~= 0 and bit32.band(flags, 32 --[[ImGuiInputTextFlags.AllowTabInput]]) ~= 0)) -- Can't use both together (they both use tab key) + assert(not (bit32.band(flags, 131072 --[[ImGuiInputTextFlags.ElideLeft]]) ~= 0 and bit32.band(flags, 67108864 --[[ImGuiInputTextFlags.Multiline]]) ~= 0)) -- Multiline does not work with left-trimming + assert(bit32.band(flags, 16777216 --[[ImGuiInputTextFlags.WordWrap]]) == 0 or bit32.band(flags, 1024 --[[ImGuiInputTextFlags.Password]]) == 0) -- WordWrap does not work with Password mode. + assert(bit32.band(flags, 16777216 --[[ImGuiInputTextFlags.WordWrap]]) == 0 or bit32.band(flags, 67108864 --[[ImGuiInputTextFlags.Multiline]]) ~= 0) -- WordWrap does not work in single-line mode. local g = GImGui --[[@as ImGuiContext]] local io = g.IO local style = g.Style local RENDER_SELECTION_WHEN_INACTIVE = false - local is_multiline = bit32.band(flags, ImGuiInputTextFlags.Multiline) ~= 0 + local is_multiline = bit32.band(flags, 67108864 --[[ImGuiInputTextFlags.Multiline]]) ~= 0 if is_multiline then -- Open group before calling GetID() because groups tracks id created within their scope (including the scrollbar) ImGui.BeginGroup() @@ -60244,7 +60287,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback ImVec2_Copy(backup_pos, window.DC.CursorPos) ImGui.ItemSize(total_bb, style.FramePadding.y) local no_clip = (g.InputTextDeactivatedState.ID == id) or (g.ActiveId == id) or (id == g.NavActivateId) -- Mimic some of ItemAdd() logic + add InputTextDeactivatedState.ID check. - if not ImGui.ItemAdd(total_bb, id, frame_bb, ImGuiItemFlags.Inputable) and not no_clip then + if not ImGui.ItemAdd(total_bb, id, frame_bb, 1048576 --[[ImGuiItemFlags.Inputable]]) and not no_clip then ImGui.EndGroup() return false end @@ -60252,7 +60295,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback ImVec2_Copy(window.DC.CursorPos, backup_pos) -- Prevent NavActivation from explicit Tabbing when our widget accepts Tab inputs: this allows cycling through widgets without stopping. - if g.NavActivateId == id and (bit32.band(g.NavActivateFlags, ImGuiActivateFlags.FromTabbing) ~= 0) and (bit32.band(g.NavActivateFlags, ImGuiActivateFlags.FromFocusApi) == 0) and (bit32.band(flags, ImGuiInputTextFlags.AllowTabInput) ~= 0) then + if g.NavActivateId == id and (bit32.band(g.NavActivateFlags, 8 --[[ImGuiActivateFlags.FromTabbing]]) ~= 0) and (bit32.band(g.NavActivateFlags, 32 --[[ImGuiActivateFlags.FromFocusApi]]) == 0) and (bit32.band(flags, 32 --[[ImGuiInputTextFlags.AllowTabInput]]) ~= 0) then g.NavActivateId = 0 end @@ -60263,11 +60306,11 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback end -- We reproduce the contents of BeginChildFrame() in order to provide 'label' so our window internal data are easier to read/debug. - ImGui.PushStyleColor(ImGuiCol.ChildBg, style.Colors[ImGuiCol.FrameBg]) - ImGui.PushStyleVar(ImGuiStyleVar.ChildRounding, style.FrameRounding) - ImGui.PushStyleVar(ImGuiStyleVar.ChildBorderSize, style.FrameBorderSize) - ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, ImVec2(0, 0)) -- Ensure no clip rect so mouse hover can reach FramePadding edges - local child_visible = ImGui.BeginChildEx(label, id, frame_bb:GetSize(), ImGuiChildFlags.Borders, ImGuiWindowFlags.NoMove) + ImGui.PushStyleColor(3 --[[ImGuiCol.ChildBg]], style.Colors[7 --[[ImGuiCol.FrameBg]]]) + ImGui.PushStyleVar(7 --[[ImGuiStyleVar.ChildRounding]], style.FrameRounding) + ImGui.PushStyleVar(8 --[[ImGuiStyleVar.ChildBorderSize]], style.FrameBorderSize) + ImGui.PushStyleVar(2 --[[ImGuiStyleVar.WindowPadding]], ImVec2(0, 0)) -- Ensure no clip rect so mouse hover can reach FramePadding edges + local child_visible = ImGui.BeginChildEx(label, id, frame_bb:GetSize(), 1 --[[ImGuiChildFlags.Borders]], 4 --[[ImGuiWindowFlags.NoMove]]) g.NavActivateId = backup_activate_id ImGui.PopStyleVar(3) ImGui.PopStyleColor() @@ -60289,17 +60332,17 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- Support for internal ImGuiInputTextFlags.MergedItem flag, which could be redesigned as an ItemFlags if needed (with test performed in ItemAdd) ImGui.ItemSize(total_bb, style.FramePadding.y) - if bit32.band(flags, ImGuiInputTextFlags.TempInput) == 0 then - if not ImGui.ItemAdd(total_bb, id, frame_bb, ImGuiItemFlags.Inputable) then + if bit32.band(flags, 134217728 --[[ImGuiInputTextFlags.TempInput]]) == 0 then + if not ImGui.ItemAdd(total_bb, id, frame_bb, 1048576 --[[ImGuiItemFlags.Inputable]]) then return false end end end -- Ensure mouse cursor is set even after switching to keyboard/gamepad mode. May generalize further? (#6417) - local hovered = ImGui.ItemHoverable(frame_bb, id, bit32.bor(g.LastItemData.ItemFlags, ImGuiItemFlags.NoNavDisableMouseHover)) + local hovered = ImGui.ItemHoverable(frame_bb, id, bit32.bor(g.LastItemData.ItemFlags, 32768 --[[ImGuiItemFlags.NoNavDisableMouseHover]])) if hovered then - ImGui.SetMouseCursor(ImGuiMouseCursor.TextInput) + ImGui.SetMouseCursor(1 --[[ImGuiMouseCursor.TextInput]]) end if hovered and g.NavHighlightItemUnderNav then hovered = false @@ -60308,44 +60351,44 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- We are only allowed to access the state if we are already the active widget. local state = ImGui.GetInputTextState(id) - if bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.ReadOnly) ~= 0 then - flags = bit32.bor(flags, ImGuiInputTextFlags.ReadOnly) + if bit32.band(g.LastItemData.ItemFlags, 2048 --[[ImGuiItemFlags.ReadOnly]]) ~= 0 then + flags = bit32.bor(flags, 512 --[[ImGuiInputTextFlags.ReadOnly]]) end - local is_readonly = bit32.band(flags, ImGuiInputTextFlags.ReadOnly) ~= 0 - local is_password = bit32.band(flags, ImGuiInputTextFlags.Password) ~= 0 - local is_undoable = bit32.band(flags, ImGuiInputTextFlags.NoUndoRedo) == 0 - local is_resizable = bit32.band(flags, ImGuiInputTextFlags.CallbackResize) ~= 0 + local is_readonly = bit32.band(flags, 512 --[[ImGuiInputTextFlags.ReadOnly]]) ~= 0 + local is_password = bit32.band(flags, 1024 --[[ImGuiInputTextFlags.Password]]) ~= 0 + local is_undoable = bit32.band(flags, 65536 --[[ImGuiInputTextFlags.NoUndoRedo]]) == 0 + local is_resizable = bit32.band(flags, 4194304 --[[ImGuiInputTextFlags.CallbackResize]]) ~= 0 if is_resizable then - IM_ASSERT(callback ~= nil) -- Must provide a callback if you set the ImGuiInputTextFlags.CallbackResize flag! + assert(callback ~= nil) -- Must provide a callback if you set the ImGuiInputTextFlags.CallbackResize flag! end -- Word-wrapping: enforcing a fixed width not altered by vertical scrollbar makes things easier, notably to track cursor reliably and avoid one-frame glitches. -- Instead of using ImGuiWindowFlags_AlwaysVerticalScrollbar we account for that space if the scrollbar is not visible. - local is_wordwrap = bit32.band(flags, ImGuiInputTextFlags.WordWrap) ~= 0 + local is_wordwrap = bit32.band(flags, 16777216 --[[ImGuiInputTextFlags.WordWrap]]) ~= 0 local wrap_width = 0.0 if is_wordwrap then wrap_width = ImMax(1.0, ImGui.GetContentRegionAvail().x + (draw_window.ScrollbarY and 0.0 or -g.Style.ScrollbarSize)) end local user_clicked = hovered and io.MouseClicked[0] - local input_requested_by_nav = (g.ActiveId ~= id) and (g.NavActivateId == id) and ((bit32.band(g.NavActivateFlags, ImGuiActivateFlags.PreferInput) ~= 0) or (g.NavInputSource == ImGuiInputSource.Keyboard)) + local input_requested_by_nav = (g.ActiveId ~= id) and (g.NavActivateId == id) and ((bit32.band(g.NavActivateFlags, 1 --[[ImGuiActivateFlags.PreferInput]]) ~= 0) or (g.NavInputSource == 2 --[[ImGuiInputSource.Keyboard]])) local input_requested_by_reactivate = (g.InputTextReactivateId == id) -- for io.ConfigInputTextEnterKeepActive - local input_requested_by_user = (user_clicked) or (g.ActiveId == 0 and bit32.band(flags, ImGuiInputTextFlags.TempInput) ~= 0 and g.InputTextDeactivatedState.ID ~= id) - local scrollbar_id = (is_multiline and state ~= nil) and ImGui.GetWindowScrollbarID(draw_window, ImGuiAxis.Y) or 0 + local input_requested_by_user = (user_clicked) or (g.ActiveId == 0 and bit32.band(flags, 134217728 --[[ImGuiInputTextFlags.TempInput]]) ~= 0 and g.InputTextDeactivatedState.ID ~= id) + local scrollbar_id = (is_multiline and state ~= nil) and ImGui.GetWindowScrollbarID(draw_window, 2 --[[ImGuiAxis.Y]]) or 0 local user_scroll_finish = is_multiline and state ~= nil and g.ActiveId == 0 and g.ActiveIdPreviousFrame == scrollbar_id local user_scroll_active = is_multiline and state ~= nil and g.ActiveId == scrollbar_id local clear_active_id = false local select_all = false - local scroll_y = is_multiline and draw_window.Scroll.y or FLT_MAX + local scroll_y = is_multiline and draw_window.Scroll.y or 3.4028234663853e+38 --[[FLT_MAX]] local init_reload_from_user_buf = (state ~= nil and state.WantReloadUserBuf) local init_changed_specs_multiline = (state ~= nil and (state.Stb.single_line ~= (not is_multiline))) -- state ~= nil means its our state. - local init_changed_specs_readonly = (state ~= nil and (bit32.band(bit32.bxor(state.Flags, flags), ImGuiInputTextFlags.ReadOnly) ~= 0)) -- state ~= nil means its our state. + local init_changed_specs_readonly = (state ~= nil and (bit32.band(bit32.bxor(state.Flags, flags), 512 --[[ImGuiInputTextFlags.ReadOnly]]) ~= 0)) -- state ~= nil means its our state. local init_make_active = (input_requested_by_user or input_requested_by_nav or input_requested_by_reactivate or user_scroll_finish) if init_reload_from_user_buf then local new_len = ImStd.ImStrlen(buf) - IM_ASSERT(new_len + 1 <= buf_size, "Is your input buffer properly zero-terminated?") + assert(new_len + 1 <= buf_size, "Is your input buffer properly zero-terminated?") state.WantReloadUserBuf = false --- @cast state ImGuiInputTextState InputTextReconcileUndoState(state, state.TextA.Data, state.TextLen, buf, new_len) @@ -60368,7 +60411,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- Take a copy of the initial buffer value. -- From the moment we focused we are normally ignoring the content of 'buf' (unless we are in read-only mode) local buf_len = ImStd.ImStrlen(buf) - IM_ASSERT(((buf_len + 1 <= buf_size) or (buf_len == 0 and buf_size == 0)), "Is your input buffer properly zero-terminated?") + assert(((buf_len + 1 <= buf_size) or (buf_len == 0 and buf_size == 0)), "Is your input buffer properly zero-terminated?") if not user_scroll_finish then state.TextToRevertTo:resize(buf_len + 1) -- UTF-8. we use +1 to make sure that .Data is always pointing to at least an empty string. ImStd.memmove(state.TextToRevertTo.Data, 1, buf, 1, buf_len + 1) @@ -60392,7 +60435,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- Find initial scroll position for right alignment ImVec2_Copy(state.Scroll, ImVec2(0.0, 0.0)) - if bit32.band(flags, ImGuiInputTextFlags.ElideLeft) ~= 0 then + if bit32.band(flags, 131072 --[[ImGuiInputTextFlags.ElideLeft]]) ~= 0 then state.Scroll.x = state.Scroll.x + ImMax(0.0, ImGui.CalcTextSize(table.concat(buf)).x - frame_size.x + style.FramePadding.x * 2.0) -- FIXME: no table.concat here end @@ -60403,10 +60446,10 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback end if not is_multiline then - if bit32.band(flags, ImGuiInputTextFlags.AutoSelectAll) ~= 0 then + if bit32.band(flags, 4096 --[[ImGuiInputTextFlags.AutoSelectAll]]) ~= 0 then select_all = true end - if input_requested_by_nav and (not recycle_state or (bit32.band(g.NavActivateFlags, ImGuiActivateFlags.TryToPreserveState) == 0)) then + if input_requested_by_nav and (not recycle_state or (bit32.band(g.NavActivateFlags, 4 --[[ImGuiActivateFlags.TryToPreserveState]]) == 0)) then select_all = true end if user_clicked and io.KeyCtrl then @@ -60414,7 +60457,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback end end - if bit32.band(flags, ImGuiInputTextFlags.AlwaysOverwrite) ~= 0 then + if bit32.band(flags, 2048 --[[ImGuiInputTextFlags.AlwaysOverwrite]]) ~= 0 then state.Stb.insert_mode = true -- stb field name is indeed incorrect (see #2863) end end @@ -60422,7 +60465,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback local is_osx = io.ConfigMacOSXBehaviors if init_make_active and g.ActiveId ~= id then - IM_ASSERT(state ~= nil and state.ID == id) + assert(state ~= nil and state.ID == id) ImGui.SetActiveID(id, window) ImGui.SetFocusID(id, window) ImGui.FocusWindow(window) @@ -60433,26 +60476,26 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback if g.ActiveId == id then -- Declare some inputs, the other are registered and polled via Shortcut() routing system. -- FIXME: The reason we don't use Shortcut() is we would need a routing flag to specify multiple mods, or to all mods combination into individual shortcuts. - local always_owned_keys = { ImGuiKey.LeftArrow, ImGuiKey.RightArrow, ImGuiKey.Delete, ImGuiKey.Backspace, ImGuiKey.Home, ImGuiKey.End } + local always_owned_keys = { 513 --[[ImGuiKey.LeftArrow]], 514 --[[ImGuiKey.RightArrow]], 522 --[[ImGuiKey.Delete]], 523 --[[ImGuiKey.Backspace]], 519 --[[ImGuiKey.Home]], 520 --[[ImGuiKey.End]] } for _, key in ipairs(always_owned_keys) do ImGui.SetKeyOwner(key, id) end if user_clicked then - ImGui.SetKeyOwner(ImGuiKey.MouseLeft, id) + ImGui.SetKeyOwner(656 --[[ImGuiKey.MouseLeft]], id) end - g.ActiveIdUsingNavDirMask = bit32.bor(g.ActiveIdUsingNavDirMask, bit32.lshift(1, ImGuiDir.Left), bit32.lshift(1, ImGuiDir.Right)) - if is_multiline or (bit32.band(flags, ImGuiInputTextFlags.CallbackHistory) ~= 0) then - g.ActiveIdUsingNavDirMask = bit32.bor(g.ActiveIdUsingNavDirMask, bit32.lshift(1, ImGuiDir.Up), bit32.lshift(1, ImGuiDir.Down)) - ImGui.SetKeyOwner(ImGuiKey.UpArrow, id) - ImGui.SetKeyOwner(ImGuiKey.DownArrow, id) + g.ActiveIdUsingNavDirMask = bit32.bor(g.ActiveIdUsingNavDirMask, bit32.lshift(1, 0 --[[ImGuiDir.Left]]), bit32.lshift(1, 1 --[[ImGuiDir.Right]])) + if is_multiline or (bit32.band(flags, 524288 --[[ImGuiInputTextFlags.CallbackHistory]]) ~= 0) then + g.ActiveIdUsingNavDirMask = bit32.bor(g.ActiveIdUsingNavDirMask, bit32.lshift(1, 2 --[[ImGuiDir.Up]]), bit32.lshift(1, 3 --[[ImGuiDir.Down]])) + ImGui.SetKeyOwner(515 --[[ImGuiKey.UpArrow]], id) + ImGui.SetKeyOwner(516 --[[ImGuiKey.DownArrow]], id) end if is_multiline then - ImGui.SetKeyOwner(ImGuiKey.PageUp, id) - ImGui.SetKeyOwner(ImGuiKey.PageDown, id) + ImGui.SetKeyOwner(517 --[[ImGuiKey.PageUp]], id) + ImGui.SetKeyOwner(518 --[[ImGuiKey.PageDown]], id) end -- FIXME: May be a problem to always steal Alt on OSX, would ideally still allow an uninterrupted Alt down-up to toggle menu if is_osx then - ImGui.SetKeyOwner(ImGuiMod_Alt, id) + ImGui.SetKeyOwner(16384 --[[ImGuiMod_Alt]], id) end -- Expose scroll in a manner that is agnostic to us using a child window @@ -60514,7 +60557,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- Process mouse inputs and character inputs if g.ActiveId == id then --- @cast state ImGuiInputTextState - IM_ASSERT(state ~= nil) + assert(state ~= nil) state.EditedThisFrame = false state.BufCapacity = buf_size state.WrapWidth = wrap_width @@ -60539,7 +60582,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- FIXME: There are likely many ways to improve this behavior, but there's no "right" behavior (depends on use-case, software, OS) local is_bol = (state.Stb.cursor == 1) or ImStb.TEXTEDIT_GETCHAR(state, state.Stb.cursor - 1) == 10 if stbte.HAS_SELECTION(state.Stb) or not is_bol then - state:OnKeyPressed(STB_TEXTEDIT_K_WORDLEFT) + state:OnKeyPressed(2097164 --[[STB_TEXTEDIT_K_WORDLEFT]]) end -- state:OnKeyPressed(bit32.bor(STB_TEXTEDIT_K_WORDRIGHT, STB_TEXTEDIT_K_SHIFT)) if not stbte.HAS_SELECTION(state.Stb) then @@ -60552,9 +60595,9 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- Triple-click: Select line local is_eol = ImStb.TEXTEDIT_GETCHAR(state, state.Stb.cursor) == 10 state.WrapWidth = 0.0 -- Temporarily disable wrapping so we use real line start. - state:OnKeyPressed(STB_TEXTEDIT_K_LINESTART) - state:OnKeyPressed(bit32.bor(STB_TEXTEDIT_K_LINEEND, STB_TEXTEDIT_K_SHIFT)) - state:OnKeyPressed(bit32.bor(STB_TEXTEDIT_K_RIGHT, STB_TEXTEDIT_K_SHIFT)) + state:OnKeyPressed(2097156 --[[STB_TEXTEDIT_K_LINESTART]]) + state:OnKeyPressed(bit32.bor(2097157 --[[STB_TEXTEDIT_K_LINEEND]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]])) + state:OnKeyPressed(bit32.bor(2097153 --[[STB_TEXTEDIT_K_RIGHT]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]])) state.WrapWidth = wrap_width if not is_eol and is_multiline then state.Stb.select_start, state.Stb.select_end = state.Stb.select_end, state.Stb.select_start @@ -60583,8 +60626,8 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- We expect backends to emit a Tab key but some also emit a Tab character which we ignore (#2467, #1336) -- (For Tab and Enter: Win32/SFML/Allegro are sending both keys and chars, GLFW and SDL are only sending keys. For Space they all send all threes) - if bit32.band(flags, ImGuiInputTextFlags.AllowTabInput) ~= 0 and not is_readonly then - if ImGui.Shortcut(ImGuiKey.Tab, ImGuiInputFlags.Repeat, id) then + if bit32.band(flags, 32 --[[ImGuiInputTextFlags.AllowTabInput]]) ~= 0 and not is_readonly then + if ImGui.Shortcut(512 --[[ImGuiKey.Tab]], 1 --[[ImGuiInputFlags.Repeat]], id) then local c = 9 -- Insert TAB local ret2 c, ret2 = InputTextFilterCharacter(g, state, c, callback, callback_user_data) @@ -60629,82 +60672,82 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- Process other shortcuts/key-presses local revert_edit = false if g.ActiveId == id and not g.ActiveIdIsJustActivated and not clear_active_id then - IM_ASSERT(state ~= nil) + assert(state ~= nil) --- @cast state ImGuiInputTextState local row_count_per_page = ImMax(ImTrunc((inner_size.y - style.FramePadding.y) / g.FontSize), 1) state.Stb.row_count_per_page = row_count_per_page - local k_mask = (io.KeyShift and STB_TEXTEDIT_K_SHIFT or 0) + local k_mask = (io.KeyShift and 4194304 --[[STB_TEXTEDIT_K_SHIFT]] or 0) local is_wordmove_key_down = is_osx and io.KeyAlt or io.KeyCtrl -- OS X style: Text editing cursor movement using Alt instead of Ctrl local is_startend_key_down = is_osx and io.KeyCtrl and not io.KeySuper and not io.KeyAlt -- OS X style: Line/Text Start and End using Cmd+Arrows instead of Home/End -- Using Shortcut() with ImGuiInputFlags.RouteFocused (default policy) to allow routing operations for other code (e.g. calling window trying to use Ctrl+A and Ctrl+B: former would be handled by InputText) -- Otherwise we could simply assume that we own the keys as we are active. - local f_repeat = ImGuiInputFlags.Repeat - local is_cut = (ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.X), f_repeat, id) or ImGui.Shortcut(bit32.bor(ImGuiMod_Shift, ImGuiKey.Delete), f_repeat, id)) and not is_readonly and not is_password and (not is_multiline or state:HasSelection()) - local is_copy = (ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.C), 0, id) or ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.Insert), 0, id)) and not is_password and (not is_multiline or state:HasSelection()) - local is_paste = (ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.V), f_repeat, id) or ImGui.Shortcut(bit32.bor(ImGuiMod_Shift, ImGuiKey.Insert), f_repeat, id)) and not is_readonly - local is_undo = (ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.Z), f_repeat, id)) and not is_readonly and is_undoable - local is_redo = (ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.Y), f_repeat, id) or ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey.Z), f_repeat, id)) and not is_readonly and is_undoable - local is_select_all = ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.A), 0, id) + local f_repeat = 1 --[[ImGuiInputFlags.Repeat]] + local is_cut = (ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 569 --[[ImGuiKey.X]]), f_repeat, id) or ImGui.Shortcut(bit32.bor(8192 --[[ImGuiMod_Shift]], 522 --[[ImGuiKey.Delete]]), f_repeat, id)) and not is_readonly and not is_password and (not is_multiline or state:HasSelection()) + local is_copy = (ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 548 --[[ImGuiKey.C]]), 0, id) or ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 521 --[[ImGuiKey.Insert]]), 0, id)) and not is_password and (not is_multiline or state:HasSelection()) + local is_paste = (ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 567 --[[ImGuiKey.V]]), f_repeat, id) or ImGui.Shortcut(bit32.bor(8192 --[[ImGuiMod_Shift]], 521 --[[ImGuiKey.Insert]]), f_repeat, id)) and not is_readonly + local is_undo = (ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 571 --[[ImGuiKey.Z]]), f_repeat, id)) and not is_readonly and is_undoable + local is_redo = (ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 570 --[[ImGuiKey.Y]]), f_repeat, id) or ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 8192 --[[ImGuiMod_Shift]], 571 --[[ImGuiKey.Z]]), f_repeat, id)) and not is_readonly and is_undoable + local is_select_all = ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 546 --[[ImGuiKey.A]]), 0, id) -- We allow validate/cancel with Nav source (gamepad) to makes it easier to undo an accidental NavInput press with no keyboard wired, but otherwise it isn't very useful. - local nav_gamepad_active = (bit32.band(io.ConfigFlags, ImGuiConfigFlags.NavEnableGamepad) ~= 0) and (bit32.band(io.BackendFlags, ImGuiBackendFlags.HasGamepad) ~= 0) - local is_enter = ImGui.Shortcut(ImGuiKey.Enter, f_repeat, id) or ImGui.Shortcut(ImGuiKey.KeypadEnter, f_repeat, id) - local is_ctrl_enter = ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.Enter), f_repeat, id) or ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.KeypadEnter), f_repeat, id) - local is_shift_enter = ImGui.Shortcut(bit32.bor(ImGuiMod_Shift, ImGuiKey.Enter), f_repeat, id) or ImGui.Shortcut(bit32.bor(ImGuiMod_Shift, ImGuiKey.KeypadEnter), f_repeat, id) + local nav_gamepad_active = (bit32.band(io.ConfigFlags, 2 --[[ImGuiConfigFlags.NavEnableGamepad]]) ~= 0) and (bit32.band(io.BackendFlags, 1 --[[ImGuiBackendFlags.HasGamepad]]) ~= 0) + local is_enter = ImGui.Shortcut(525 --[[ImGuiKey.Enter]], f_repeat, id) or ImGui.Shortcut(627 --[[ImGuiKey.KeypadEnter]], f_repeat, id) + local is_ctrl_enter = ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 525 --[[ImGuiKey.Enter]]), f_repeat, id) or ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 627 --[[ImGuiKey.KeypadEnter]]), f_repeat, id) + local is_shift_enter = ImGui.Shortcut(bit32.bor(8192 --[[ImGuiMod_Shift]], 525 --[[ImGuiKey.Enter]]), f_repeat, id) or ImGui.Shortcut(bit32.bor(8192 --[[ImGuiMod_Shift]], 627 --[[ImGuiKey.KeypadEnter]]), f_repeat, id) local is_gamepad_validate = nav_gamepad_active and ImGui.IsKeyPressed(ImGuiKey.NavGamepadActivate, false) - local is_cancel = ImGui.Shortcut(ImGuiKey.Escape, f_repeat, id) or (nav_gamepad_active and ImGui.Shortcut(ImGuiKey.NavGamepadCancel, f_repeat, id)) + local is_cancel = ImGui.Shortcut(526 --[[ImGuiKey.Escape]], f_repeat, id) or (nav_gamepad_active and ImGui.Shortcut(ImGuiKey.NavGamepadCancel, f_repeat, id)) -- FIXME: Should use more Shortcut() and reduce IsKeyPressed()+SetKeyOwner(), but requires modifiers combination to be taken account of. -- FIXME-OSX: Missing support for Alt(option)+Right/Left = go to end of line, or next line if already in end of line. - if ImGui.IsKeyPressed(ImGuiKey.LeftArrow) then - state:OnKeyPressed(bit32.bor(is_startend_key_down and STB_TEXTEDIT_K_LINESTART or (is_wordmove_key_down and STB_TEXTEDIT_K_WORDLEFT or STB_TEXTEDIT_K_LEFT), k_mask)) - elseif ImGui.IsKeyPressed(ImGuiKey.RightArrow) then - state:OnKeyPressed(bit32.bor(is_startend_key_down and STB_TEXTEDIT_K_LINEEND or (is_wordmove_key_down and STB_TEXTEDIT_K_WORDRIGHT or STB_TEXTEDIT_K_RIGHT), k_mask)) - elseif ImGui.IsKeyPressed(ImGuiKey.UpArrow) and is_multiline then + if ImGui.IsKeyPressed(513 --[[ImGuiKey.LeftArrow]]) then + state:OnKeyPressed(bit32.bor(is_startend_key_down and 2097156 --[[STB_TEXTEDIT_K_LINESTART]] or (is_wordmove_key_down and 2097164 --[[STB_TEXTEDIT_K_WORDLEFT]] or 2097152 --[[STB_TEXTEDIT_K_LEFT]]), k_mask)) + elseif ImGui.IsKeyPressed(514 --[[ImGuiKey.RightArrow]]) then + state:OnKeyPressed(bit32.bor(is_startend_key_down and 2097157 --[[STB_TEXTEDIT_K_LINEEND]] or (is_wordmove_key_down and 2097165 --[[STB_TEXTEDIT_K_WORDRIGHT]] or 2097153 --[[STB_TEXTEDIT_K_RIGHT]]), k_mask)) + elseif ImGui.IsKeyPressed(515 --[[ImGuiKey.UpArrow]]) and is_multiline then if io.KeyCtrl then ImGui.SetScrollY(draw_window, ImMax(draw_window.Scroll.y - g.FontSize, 0.0)) else - state:OnKeyPressed(bit32.bor(is_startend_key_down and STB_TEXTEDIT_K_TEXTSTART or STB_TEXTEDIT_K_UP, k_mask)) + state:OnKeyPressed(bit32.bor(is_startend_key_down and 2097158 --[[STB_TEXTEDIT_K_TEXTSTART]] or 2097154 --[[STB_TEXTEDIT_K_UP]], k_mask)) end - elseif ImGui.IsKeyPressed(ImGuiKey.DownArrow) and is_multiline then + elseif ImGui.IsKeyPressed(516 --[[ImGuiKey.DownArrow]]) and is_multiline then if io.KeyCtrl then ImGui.SetScrollY(draw_window, ImMin(draw_window.Scroll.y + g.FontSize, ImGui.GetScrollMaxY())) else - state:OnKeyPressed(bit32.bor(is_startend_key_down and STB_TEXTEDIT_K_TEXTEND or STB_TEXTEDIT_K_DOWN, k_mask)) + state:OnKeyPressed(bit32.bor(is_startend_key_down and 2097159 --[[STB_TEXTEDIT_K_TEXTEND]] or 2097155 --[[STB_TEXTEDIT_K_DOWN]], k_mask)) end - elseif ImGui.IsKeyPressed(ImGuiKey.PageUp) and is_multiline then - state:OnKeyPressed(bit32.bor(STB_TEXTEDIT_K_PGUP, k_mask)) + elseif ImGui.IsKeyPressed(517 --[[ImGuiKey.PageUp]]) and is_multiline then + state:OnKeyPressed(bit32.bor(2097166 --[[STB_TEXTEDIT_K_PGUP]], k_mask)) scroll_y = scroll_y - row_count_per_page * g.FontSize - elseif ImGui.IsKeyPressed(ImGuiKey.PageDown) and is_multiline then - state:OnKeyPressed(bit32.bor(STB_TEXTEDIT_K_PGDOWN, k_mask)) + elseif ImGui.IsKeyPressed(518 --[[ImGuiKey.PageDown]]) and is_multiline then + state:OnKeyPressed(bit32.bor(2097167 --[[STB_TEXTEDIT_K_PGDOWN]], k_mask)) scroll_y = scroll_y + row_count_per_page * g.FontSize - elseif ImGui.IsKeyPressed(ImGuiKey.Home) then - state:OnKeyPressed(io.KeyCtrl and bit32.bor(STB_TEXTEDIT_K_TEXTSTART, k_mask) or bit32.bor(STB_TEXTEDIT_K_LINESTART, k_mask)) - elseif ImGui.IsKeyPressed(ImGuiKey.End) then - state:OnKeyPressed(io.KeyCtrl and bit32.bor(STB_TEXTEDIT_K_TEXTEND, k_mask) or bit32.bor(STB_TEXTEDIT_K_LINEEND, k_mask)) - elseif ImGui.IsKeyPressed(ImGuiKey.Delete) and not is_readonly and not is_cut then + elseif ImGui.IsKeyPressed(519 --[[ImGuiKey.Home]]) then + state:OnKeyPressed(io.KeyCtrl and bit32.bor(2097158 --[[STB_TEXTEDIT_K_TEXTSTART]], k_mask) or bit32.bor(2097156 --[[STB_TEXTEDIT_K_LINESTART]], k_mask)) + elseif ImGui.IsKeyPressed(520 --[[ImGuiKey.End]]) then + state:OnKeyPressed(io.KeyCtrl and bit32.bor(2097159 --[[STB_TEXTEDIT_K_TEXTEND]], k_mask) or bit32.bor(2097157 --[[STB_TEXTEDIT_K_LINEEND]], k_mask)) + elseif ImGui.IsKeyPressed(522 --[[ImGuiKey.Delete]]) and not is_readonly and not is_cut then if not state:HasSelection() then -- OSX doesn't seem to have Super+Delete to delete until end-of-line, so we don't emulate that (as opposed to Super+Backspace) if is_wordmove_key_down then - state:OnKeyPressed(bit32.bor(STB_TEXTEDIT_K_WORDRIGHT, STB_TEXTEDIT_K_SHIFT)) + state:OnKeyPressed(bit32.bor(2097165 --[[STB_TEXTEDIT_K_WORDRIGHT]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]])) end end - state:OnKeyPressed(bit32.bor(STB_TEXTEDIT_K_DELETE, k_mask)) - elseif ImGui.IsKeyPressed(ImGuiKey.Backspace) and not is_readonly then + state:OnKeyPressed(bit32.bor(2097160 --[[STB_TEXTEDIT_K_DELETE]], k_mask)) + elseif ImGui.IsKeyPressed(523 --[[ImGuiKey.Backspace]]) and not is_readonly then if not state:HasSelection() then if is_wordmove_key_down then - state:OnKeyPressed(bit32.bor(STB_TEXTEDIT_K_WORDLEFT, STB_TEXTEDIT_K_SHIFT)) + state:OnKeyPressed(bit32.bor(2097164 --[[STB_TEXTEDIT_K_WORDLEFT]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]])) elseif is_osx and io.KeyCtrl and not io.KeyAlt and not io.KeySuper then - state:OnKeyPressed(bit32.bor(STB_TEXTEDIT_K_LINESTART, STB_TEXTEDIT_K_SHIFT)) + state:OnKeyPressed(bit32.bor(2097156 --[[STB_TEXTEDIT_K_LINESTART]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]])) end end - state:OnKeyPressed(bit32.bor(STB_TEXTEDIT_K_BACKSPACE, k_mask)) + state:OnKeyPressed(bit32.bor(2097161 --[[STB_TEXTEDIT_K_BACKSPACE]], k_mask)) elseif is_enter or is_ctrl_enter or is_shift_enter or is_gamepad_validate then -- Determine if we turn Enter into a \n character - local ctrl_enter_for_new_line = bit32.band(flags, ImGuiInputTextFlags.CtrlEnterForNewLine) ~= 0 + local ctrl_enter_for_new_line = bit32.band(flags, 256 --[[ImGuiInputTextFlags.CtrlEnterForNewLine]]) ~= 0 local is_new_line = is_multiline and not is_gamepad_validate and (is_shift_enter or (is_enter and not ctrl_enter_for_new_line) or (is_ctrl_enter and ctrl_enter_for_new_line)) if not is_new_line then validated = true @@ -60724,7 +60767,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback end end elseif is_cancel then - if bit32.band(flags, ImGuiInputTextFlags.EscapeClearsAll) ~= 0 then + if bit32.band(flags, 128 --[[ImGuiInputTextFlags.EscapeClearsAll]]) ~= 0 then if state.TextA.Data[1] ~= 0 then revert_edit = true else @@ -60739,7 +60782,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback render_selection = false end elseif is_undo or is_redo then - state:OnKeyPressed(is_undo and STB_TEXTEDIT_K_UNDO or STB_TEXTEDIT_K_REDO) + state:OnKeyPressed(is_undo and 2097162 --[[STB_TEXTEDIT_K_UNDO]] or 2097163 --[[STB_TEXTEDIT_K_REDO]]) state:ClearSelection() elseif is_select_all then state:SelectAll() @@ -60808,13 +60851,13 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback local apply_new_text = nil local apply_new_text_length = 0 if g.ActiveId == id then - IM_ASSERT(state ~= nil) + assert(state ~= nil) --- @cast state ImGuiInputTextState if revert_edit and not is_readonly then - if bit32.band(flags, ImGuiInputTextFlags.EscapeClearsAll) ~= 0 then + if bit32.band(flags, 128 --[[ImGuiInputTextFlags.EscapeClearsAll]]) ~= 0 then -- Clear input - IM_ASSERT(state.TextA.Data[1] ~= 0) + assert(state.TextA.Data[1] ~= 0) apply_new_text = {0} apply_new_text_length = 0 value_changed = true @@ -60832,26 +60875,26 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback end -- User callback - if bit32.band(flags, bit32.bor(ImGuiInputTextFlags.CallbackCompletion, ImGuiInputTextFlags.CallbackHistory, ImGuiInputTextFlags.CallbackEdit, ImGuiInputTextFlags.CallbackAlways)) ~= 0 then - IM_ASSERT(callback ~= nil) + if bit32.band(flags, bit32.bor(262144 --[[ImGuiInputTextFlags.CallbackCompletion]], 524288 --[[ImGuiInputTextFlags.CallbackHistory]], 8388608 --[[ImGuiInputTextFlags.CallbackEdit]], 1048576 --[[ImGuiInputTextFlags.CallbackAlways]])) ~= 0 then + assert(callback ~= nil) -- The reason we specify the usage semantic (Completion/History) is that Completion needs to disable keyboard TABBING at the moment. local event_flag = 0 - local event_key = ImGuiKey.None - if bit32.band(flags, ImGuiInputTextFlags.CallbackCompletion) ~= 0 and ImGui.Shortcut(ImGuiKey.Tab, 0, id) then - event_flag = ImGuiInputTextFlags.CallbackCompletion - event_key = ImGuiKey.Tab - elseif bit32.band(flags, ImGuiInputTextFlags.CallbackHistory) ~= 0 and ImGui.IsKeyPressed(ImGuiKey.UpArrow) then - event_flag = ImGuiInputTextFlags.CallbackHistory - event_key = ImGuiKey.UpArrow - elseif bit32.band(flags, ImGuiInputTextFlags.CallbackHistory) ~= 0 and ImGui.IsKeyPressed(ImGuiKey.DownArrow) then - event_flag = ImGuiInputTextFlags.CallbackHistory - event_key = ImGuiKey.DownArrow - elseif bit32.band(flags, ImGuiInputTextFlags.CallbackEdit) ~= 0 and state.EditedThisFrame then - event_flag = ImGuiInputTextFlags.CallbackEdit - elseif bit32.band(flags, ImGuiInputTextFlags.CallbackAlways) ~= 0 then - event_flag = ImGuiInputTextFlags.CallbackAlways + local event_key = 0 --[[ImGuiKey.None]] + if bit32.band(flags, 262144 --[[ImGuiInputTextFlags.CallbackCompletion]]) ~= 0 and ImGui.Shortcut(512 --[[ImGuiKey.Tab]], 0, id) then + event_flag = 262144 --[[ImGuiInputTextFlags.CallbackCompletion]] + event_key = 512 --[[ImGuiKey.Tab]] + elseif bit32.band(flags, 524288 --[[ImGuiInputTextFlags.CallbackHistory]]) ~= 0 and ImGui.IsKeyPressed(515 --[[ImGuiKey.UpArrow]]) then + event_flag = 524288 --[[ImGuiInputTextFlags.CallbackHistory]] + event_key = 515 --[[ImGuiKey.UpArrow]] + elseif bit32.band(flags, 524288 --[[ImGuiInputTextFlags.CallbackHistory]]) ~= 0 and ImGui.IsKeyPressed(516 --[[ImGuiKey.DownArrow]]) then + event_flag = 524288 --[[ImGuiInputTextFlags.CallbackHistory]] + event_key = 516 --[[ImGuiKey.DownArrow]] + elseif bit32.band(flags, 8388608 --[[ImGuiInputTextFlags.CallbackEdit]]) ~= 0 and state.EditedThisFrame then + event_flag = 8388608 --[[ImGuiInputTextFlags.CallbackEdit]] + elseif bit32.band(flags, 1048576 --[[ImGuiInputTextFlags.CallbackAlways]]) ~= 0 then + event_flag = 1048576 --[[ImGuiInputTextFlags.CallbackAlways]] end if event_flag ~= 0 then @@ -60865,7 +60908,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- FIXME-OPT: Undo stack reconcile needs a backup of the data until we rework API, see #7925 local callback_buf = is_readonly and buf or state.TextA.Data - IM_ASSERT(callback_buf == state.TextSrc) + assert(callback_buf == state.TextSrc) state.CallbackTextBackup:resize(state.TextLen + 1) ImStd.memmove(state.CallbackTextBackup.Data, 1, callback_buf, 1, state.TextLen + 1) @@ -60883,9 +60926,9 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- Read back what user may have modified callback_buf = is_readonly and buf or state.TextA.Data -- Pointer may have been invalidated by a resize callback - IM_ASSERT(callback_data.Buf == callback_buf) -- Invalid to modify those fields - IM_ASSERT(callback_data.BufSize == state.BufCapacity) - IM_ASSERT(callback_data.Flags == flags) + assert(callback_data.Buf == callback_buf) -- Invalid to modify those fields + assert(callback_data.BufSize == state.BufCapacity) + assert(callback_data.Flags == flags) if callback_data.BufDirty or callback_data.CursorPos ~= state.Stb.cursor then state.CursorFollow = true end @@ -60894,7 +60937,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback state.Stb.select_end = ImClamp(callback_data.SelectionEnd, 0, callback_data.BufTextLen) if callback_data.BufDirty then -- Callback may update buffer and thus set buf_dirty even in read-only mode. - IM_ASSERT(callback_data.BufTextLen == ImStd.ImStrlen(callback_data.Buf)) -- You need to maintain BufTextLen if you change the text! + assert(callback_data.BufTextLen == ImStd.ImStrlen(callback_data.Buf)) -- You need to maintain BufTextLen if you change the text! InputTextReconcileUndoState(state, state.CallbackTextBackup.Data, state.CallbackTextBackup.Size - 1, callback_data.Buf, callback_data.BufTextLen) state.TextLen = callback_data.BufTextLen -- Assume correct length and valid UTF-8 from user, saves us an extra strlen() state.EditedBefore = true; state.EditedThisFrame = true @@ -60906,7 +60949,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- Write back result string if modified. -- FIXME-OPT: Could mark dirty state from the stb_textedit callbacks if not is_readonly then - if bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.LiveEditOnInputScalar) ~= 0 then + if bit32.band(g.LastItemData.ItemFlags, 256 --[[ImGuiItemFlags.LiveEditOnInputScalar]]) ~= 0 then -- Apply when modified if (ImStd.strcmp(state.TextSrc, buf) ~= 0) then apply_new_text = state.TextSrc @@ -60926,7 +60969,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- This is used when e.g. losing focus or tabbing out into another InputText() which may already be using the temp buffer. if g.InputTextDeactivatedState.ID == id then -- The state only exists after an Edit. IsItemDeactivatedAfterEdit() is not valid in every code path (see "widgets_inputtext_status_noliveedit" test). - if ((g.ActiveId ~= id and ImGui.IsItemDeactivated()) or (g.ActiveId == id and bit32.band(flags, ImGuiInputTextFlags.TempInput) ~= 0)) then + if ((g.ActiveId ~= id and ImGui.IsItemDeactivated()) or (g.ActiveId == id and bit32.band(flags, 134217728 --[[ImGuiInputTextFlags.TempInput]]) ~= 0)) then if (not is_readonly and ImStd.strcmp(g.InputTextDeactivatedState.TextA.Data, buf) ~= 0) then apply_new_text = g.InputTextDeactivatedState.TextA.Data apply_new_text_length = g.InputTextDeactivatedState.TextA.Size - 1 @@ -60944,13 +60987,13 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- (PS: if you use this property together with ImGuiInputTextFlags.CallbackResize, you are at the risk of recreating a temporary -- allocated/string object every frame. Which in the grand scheme of scheme is nothing, but isn't dear imgui vibe). if apply_new_text ~= nil then - IM_ASSERT(apply_new_text_length >= 0) + assert(apply_new_text_length >= 0) if is_resizable then local callback_data = ImGuiInputTextCallbackData() callback_data.Ctx = g callback_data.ID = id callback_data.Flags = flags - callback_data.EventFlag = ImGuiInputTextFlags.CallbackResize + callback_data.EventFlag = 4194304 --[[ImGuiInputTextFlags.CallbackResize]] callback_data.EventActivated = (g.ActiveId == state.ID and g.ActiveIdIsJustActivated) callback_data.Buf = buf callback_data.BufTextLen = apply_new_text_length @@ -60962,7 +61005,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback buf = callback_data.Buf buf_size = callback_data.BufSize apply_new_text_length = ImMin(callback_data.BufTextLen, buf_size - 1) - IM_ASSERT(apply_new_text_length <= buf_size) + assert(apply_new_text_length <= buf_size) end -- IMGUI_DEBUG_PRINT("InputText(\"%s\"): apply_new_text length %d\n", label, apply_new_text_length); @@ -60981,7 +61024,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- Render frame if not is_multiline then ImGui.RenderNavCursor(frame_bb, id) - ImGui.RenderFrame(frame_bb.Min, frame_bb.Max, ImGui.GetColorU32(ImGuiCol.FrameBg), true, style.FrameRounding) + ImGui.RenderFrame(frame_bb.Min, frame_bb.Max, ImGui.GetColorU32(7 --[[ImGuiCol.FrameBg]]), true, style.FrameRounding) end local draw_pos = ImVec2() @@ -61040,7 +61083,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback local will_scroll_y = state and ((state.CursorFollow and render_cursor) or (state.CursorCenterY and (render_cursor or render_selection))) --- @cast buf_display_end int local out_buf_end - line_count, out_buf_end = InputTextLineIndexBuild(flags, line_index, buf_display, buf_display_end, wrap_width, will_scroll_y and INT_MAX or (line_visible_n1 + 1)) + line_count, out_buf_end = InputTextLineIndexBuild(flags, line_index, buf_display, buf_display_end, wrap_width, will_scroll_y and 2147483647 --[[INT_MAX]] or (line_visible_n1 + 1)) if buf_display_end then buf_display_end = out_buf_end end @@ -61058,7 +61101,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback local draw_scroll = ImVec2() -- Render text. We currently only render selection when the widget is active or while scrolling. - local text_col = ImGui.GetColorU32(is_displaying_hint and ImGuiCol.TextDisabled or ImGuiCol.Text) + local text_col = ImGui.GetColorU32(is_displaying_hint and 1 --[[ImGuiCol.TextDisabled]] or 0 --[[ImGuiCol.Text]]) if render_cursor or render_selection then -- Render text (with cursor and selection) -- This is going to be messy. We need to: @@ -61067,14 +61110,14 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- - Measure text height (for scrollbar) -- We are attempting to do most of that in **one main pass** to minimize the computation cost (non-negligible for large amount of text) + 2nd pass for selection rendering (we could merge them by an extra refactoring effort) -- FIXME: This should occur on buf_display but we'd need to maintain cursor/select_start/select_end for UTF-8. - IM_ASSERT(state ~= nil) + assert(state ~= nil) state.LineCount = line_count -- Scroll local new_scroll_y = scroll_y if render_cursor and state.CursorFollow then -- Horizontal scroll in chunks of quarter width - if bit32.band(flags, ImGuiInputTextFlags.NoHorizontalScroll) == 0 then + if bit32.band(flags, 32768 --[[ImGuiInputTextFlags.NoHorizontalScroll]]) == 0 then local scroll_increment_x = inner_size.x * 0.25 local visible_width = inner_size.x - style.FramePadding.x if cursor_offset.x < state.Scroll.x then @@ -61116,7 +61159,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- Draw selection draw_scroll.x = state.Scroll.x if render_selection then - local bg_color = ImGui.GetColorU32(ImGuiCol.TextSelectedBg, render_cursor and 1.0 or 0.6) -- FIXME: current code flow mandate that render_cursor is always true here, we are leaving the transparent one for tests. + local bg_color = ImGui.GetColorU32(54 --[[ImGuiCol.TextSelectedBg]], render_cursor and 1.0 or 0.6) -- FIXME: current code flow mandate that render_cursor is always true here, we are leaving the transparent one for tests. local bg_offy_up = is_multiline and 0.0 or -1.0 -- FIXME-DPI: those offsets should be part of the style? they don't play so well with multi-line selection. local bg_offy_dn = is_multiline and 0.0 or 2.0 local bg_eol_width = IM_TRUNC(g.FontBaked:GetCharAdvance(32) * 0.50) -- So we can see selected empty lines @@ -61160,20 +61203,20 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback end -- Find render position for right alignment (single-line only) - if g.ActiveId ~= id and bit32.band(flags, ImGuiInputTextFlags.ElideLeft) ~= 0 and not render_cursor and not render_selection then + if g.ActiveId ~= id and bit32.band(flags, 131072 --[[ImGuiInputTextFlags.ElideLeft]]) ~= 0 and not render_cursor and not render_selection then draw_pos.x = ImMin(draw_pos.x, frame_bb.Max.x - ImGui.CalcTextSize(buf_display, nil).x - style.FramePadding.x) end -- draw_scroll.x = state.Scroll.x -- Preserve scroll when inactive? -- Render text - if (is_multiline or (buf_display_end - 1) < buf_display_max_length) and bit32.band(text_col, IM_COL32_A_MASK) ~= 0 and line_visible_n0 < line_visible_n1 then + if (is_multiline or (buf_display_end - 1) < buf_display_max_length) and bit32.band(text_col, 4278190080 --[[IM_COL32_A_MASK]]) ~= 0 and line_visible_n0 < line_visible_n1 then g.Font:RenderText(draw_window.DrawList, g.FontSize, draw_pos - draw_scroll + ImVec2(0.0, (line_visible_n0 - 1) * g.FontSize), text_col, clip_rect:AsVec4(), buf_display, line_index:get_line_begin(1, line_visible_n0), line_index:get_line_end(1, line_visible_n1 - 1), - wrap_width, bit32.bor(ImDrawTextFlags.WrapKeepBlanks, ImDrawTextFlags.CpuFineClip)) + wrap_width, bit32.bor(2 --[[ImDrawTextFlags.WrapKeepBlanks]], 1 --[[ImDrawTextFlags.CpuFineClip]])) end -- Render blinking cursor @@ -61185,7 +61228,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback 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) 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(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) 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.) @@ -61208,14 +61251,14 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback if is_multiline then -- For focus requests to work on our multiline we need to ensure our child ItemAdd() call specifies the ImGuiItemFlags.Inputable (see #4761, #7870)... ImGui.Dummy(ImVec2(0.0, text_size_y + style.FramePadding.y)) - g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, ImGuiItemFlags.Inputable, ImGuiItemFlags.NoTabStop) + g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, 1048576 --[[ImGuiItemFlags.Inputable]], 1 --[[ImGuiItemFlags.NoTabStop]]) ImGui.EndChild() - item_data_backup.StatusFlags = bit32.bor(item_data_backup.StatusFlags, bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HoveredWindow)) + item_data_backup.StatusFlags = bit32.bor(item_data_backup.StatusFlags, bit32.band(g.LastItemData.StatusFlags, 128 --[[ImGuiItemStatusFlags.HoveredWindow]])) -- ...and then we need to undo the group overriding last item data, which gets a bit messy as EndGroup() tries to forward scrollbar being active... -- FIXME: This quite messy/tricky, should attempt to get rid of the child window. ImGui.EndGroup() - if g.LastItemData.ID == 0 or g.LastItemData.ID ~= ImGui.GetWindowScrollbarID(draw_window, ImGuiAxis.Y) then + if g.LastItemData.ID == 0 or g.LastItemData.ID ~= ImGui.GetWindowScrollbarID(draw_window, 2 --[[ImGuiAxis.Y]]) then g.LastItemData.ID = id g.LastItemData.ItemFlags = item_data_backup.ItemFlags g.LastItemData.StatusFlags = item_data_backup.StatusFlags @@ -61234,7 +61277,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback ImGui.MarkItemEdited(id) end - if bit32.band(flags, ImGuiInputTextFlags.EnterReturnsTrue) ~= 0 then + if bit32.band(flags, 64 --[[ImGuiInputTextFlags.EnterReturnsTrue]]) ~= 0 then return validated else return value_changed @@ -61251,7 +61294,7 @@ end function ImGui.InputTextWithHint(label, hint, buf, buf_size, flags, callback, user_data) if flags == nil then flags = 0 end - IM_ASSERT(bit32.band(flags, ImGuiInputTextFlags.Multiline) == 0) -- call InputTextMultiline() or InputTextEx() manually if you need multi-line + hint. + assert(bit32.band(flags, 67108864 --[[ImGuiInputTextFlags.Multiline]]) == 0) -- call InputTextMultiline() or InputTextEx() manually if you need multi-line + hint. return ImGui.InputTextEx(label, hint, buf, buf_size, ImVec2(0, 0), flags, callback, user_data) end @@ -61274,7 +61317,7 @@ end --- @return float local function ColorEditRestoreH(col, H) local g = GImGui - IM_ASSERT(g.ColorEditCurrentID ~= 0) + assert(g.ColorEditCurrentID ~= 0) if g.ColorEditSavedID ~= g.ColorEditCurrentID or g.ColorEditSavedColor ~= ImGui.ColorConvertFloat4ToU32(ImVec4(col[1], col[2], col[3], 0)) then return H end @@ -61291,7 +61334,7 @@ end --- @return float, float, float local function ColorEditRestoreHS(col, H, S, V) local g = GImGui - IM_ASSERT(g.ColorEditCurrentID ~= 0) + assert(g.ColorEditCurrentID ~= 0) if g.ColorEditSavedID ~= g.ColorEditCurrentID or g.ColorEditSavedColor ~= ImGui.ColorConvertFloat4ToU32(ImVec4(col[1], col[2], col[3], 0)) then return H, S, V @@ -61350,7 +61393,7 @@ function ImGui.ColorEdit4(label, col, flags) -- inside would draw, be hovered or receive input, so only reproduce the layout (same group size, baseline and -- last item rect as the full path). Not taken while anything could depend on the inner items: an active item -- or popup, keyboard navigation, logging, or the ID debug hook. - if label_display_end == 1 and bit32.band(flags, bit32.bor(ImGuiColorEditFlags.NoInputs, ImGuiColorEditFlags.NoSmallPreview)) == 0 + if label_display_end == 1 and bit32.band(flags, bit32.bor(32 --[[ImGuiColorEditFlags.NoInputs]], 16 --[[ImGuiColorEditFlags.NoSmallPreview]])) == 0 and g.ActiveId == 0 and g.OpenPopupStack.Size == 0 and not g.NavCursorVisible and not g.NavAnyRequest and not g.LogEnabled and g.DebugHookIdInfoId == 0 then local w_button = square_sz + style.ItemInnerSpacing.x @@ -61376,44 +61419,44 @@ function ImGui.ColorEdit4(label, col, flags) -- If we're not showing any slider there's no point in doing any HSV conversions local flags_untouched = flags - if bit32.band(flags, ImGuiColorEditFlags.NoInputs) ~= 0 then - flags = bit32.bor(bit32.band(flags, bit32.bnot(ImGuiColorEditFlags.DisplayMask_)), ImGuiColorEditFlags.DisplayRGB, ImGuiColorEditFlags.NoOptions) + if bit32.band(flags, 32 --[[ImGuiColorEditFlags.NoInputs]]) ~= 0 then + flags = bit32.bor(bit32.band(flags, bit32.bnot(7340032 --[[ImGuiColorEditFlags.DisplayMask_]])), 1048576 --[[ImGuiColorEditFlags.DisplayRGB]], 8 --[[ImGuiColorEditFlags.NoOptions]]) end -- Context menu: display and modify options (before defaults are applied) - if bit32.band(flags, ImGuiColorEditFlags.NoOptions) == 0 then + if bit32.band(flags, 8 --[[ImGuiColorEditFlags.NoOptions]]) == 0 then ImGui.ColorEditOptionsPopup(col, flags) end -- Read stored options - if bit32.band(flags, ImGuiColorEditFlags.DisplayMask_) == 0 then - flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, ImGuiColorEditFlags.DisplayMask_)) + if bit32.band(flags, 7340032 --[[ImGuiColorEditFlags.DisplayMask_]]) == 0 then + flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, 7340032 --[[ImGuiColorEditFlags.DisplayMask_]])) end - if bit32.band(flags, ImGuiColorEditFlags.DataTypeMask_) == 0 then - flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, ImGuiColorEditFlags.DataTypeMask_)) + if bit32.band(flags, 25165824 --[[ImGuiColorEditFlags.DataTypeMask_]]) == 0 then + flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, 25165824 --[[ImGuiColorEditFlags.DataTypeMask_]])) end - if bit32.band(flags, ImGuiColorEditFlags.PickerMask_) == 0 then - flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, ImGuiColorEditFlags.PickerMask_)) + if bit32.band(flags, 100663296 --[[ImGuiColorEditFlags.PickerMask_]]) == 0 then + flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, 100663296 --[[ImGuiColorEditFlags.PickerMask_]])) end - if bit32.band(flags, ImGuiColorEditFlags.InputMask_) == 0 then - flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, ImGuiColorEditFlags.InputMask_)) + if bit32.band(flags, 805306368 --[[ImGuiColorEditFlags.InputMask_]]) == 0 then + flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, 805306368 --[[ImGuiColorEditFlags.InputMask_]])) end - flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, bit32.bnot(bit32.bor(ImGuiColorEditFlags.DisplayMask_, ImGuiColorEditFlags.DataTypeMask_, ImGuiColorEditFlags.PickerMask_, ImGuiColorEditFlags.InputMask_)))) - IM_ASSERT(ImIsPowerOfTwo(bit32.band(flags, ImGuiColorEditFlags.DisplayMask_))) -- Check that only 1 is selected - IM_ASSERT(ImIsPowerOfTwo(bit32.band(flags, ImGuiColorEditFlags.InputMask_))) -- Check that only 1 is selected + flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, bit32.bnot(bit32.bor(7340032 --[[ImGuiColorEditFlags.DisplayMask_]], 25165824 --[[ImGuiColorEditFlags.DataTypeMask_]], 100663296 --[[ImGuiColorEditFlags.PickerMask_]], 805306368 --[[ImGuiColorEditFlags.InputMask_]])))) + assert(ImIsPowerOfTwo(bit32.band(flags, 7340032 --[[ImGuiColorEditFlags.DisplayMask_]]))) -- Check that only 1 is selected + assert(ImIsPowerOfTwo(bit32.band(flags, 805306368 --[[ImGuiColorEditFlags.InputMask_]]))) -- Check that only 1 is selected - local alpha = bit32.band(flags, ImGuiColorEditFlags.NoAlpha) == 0 - local hdr = bit32.band(flags, ImGuiColorEditFlags.HDR) ~= 0 + local alpha = bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) == 0 + local hdr = bit32.band(flags, 524288 --[[ImGuiColorEditFlags.HDR]]) ~= 0 local components = alpha and 4 or 3 - local w_button = (bit32.band(flags, ImGuiColorEditFlags.NoSmallPreview) ~= 0) and 0.0 or (square_sz + style.ItemInnerSpacing.x) + local w_button = (bit32.band(flags, 16 --[[ImGuiColorEditFlags.NoSmallPreview]]) ~= 0) and 0.0 or (square_sz + style.ItemInnerSpacing.x) local w_inputs = ImMax(w_full - w_button, 1.0) w_full = w_inputs + w_button -- Convert to the formats we need local f = { col[1], col[2], col[3], alpha and col[4] or 1.0 } - if bit32.band(flags, ImGuiColorEditFlags.InputHSV) ~= 0 and bit32.band(flags, ImGuiColorEditFlags.DisplayRGB) ~= 0 then + if bit32.band(flags, 536870912 --[[ImGuiColorEditFlags.InputHSV]]) ~= 0 and bit32.band(flags, 1048576 --[[ImGuiColorEditFlags.DisplayRGB]]) ~= 0 then f[1], f[2], f[3] = ImGui.ColorConvertHSVtoRGB(f[1], f[2], f[3]) - elseif bit32.band(flags, ImGuiColorEditFlags.InputRGB) ~= 0 and bit32.band(flags, ImGuiColorEditFlags.DisplayHSV) ~= 0 then + elseif bit32.band(flags, 268435456 --[[ImGuiColorEditFlags.InputRGB]]) ~= 0 and bit32.band(flags, 2097152 --[[ImGuiColorEditFlags.DisplayHSV]]) ~= 0 then -- Hue is lost when converting from grayscale rgb (saturation=0). Restore it. f[1], f[2], f[3] = ImGui.ColorConvertRGBtoHSV(f[1], f[2], f[3]) f[1], f[2], f[3] = ColorEditRestoreHS(col, f[1], f[2], f[3]) @@ -61425,25 +61468,25 @@ function ImGui.ColorEdit4(label, col, flags) local pos = ImVec2() ImVec2_Copy(pos, window.DC.CursorPos) - local inputs_offset_x = (style.ColorButtonPosition == ImGuiDir.Left) and w_button or 0.0 + local inputs_offset_x = (style.ColorButtonPosition == 0 --[[ImGuiDir.Left]]) and w_button or 0.0 window.DC.CursorPos.x = pos.x + inputs_offset_x - if bit32.band(flags, bit32.bor(ImGuiColorEditFlags.DisplayRGB, ImGuiColorEditFlags.DisplayHSV)) ~= 0 and bit32.band(flags, ImGuiColorEditFlags.NoInputs) == 0 then + if bit32.band(flags, bit32.bor(1048576 --[[ImGuiColorEditFlags.DisplayRGB]], 2097152 --[[ImGuiColorEditFlags.DisplayHSV]])) ~= 0 and bit32.band(flags, 32 --[[ImGuiColorEditFlags.NoInputs]]) == 0 then -- RGB/HSV 0..255 Sliders local w_items = w_inputs - style.ItemInnerSpacing.x * (components - 1) local w_per_component = IM_TRUNC(w_items / components) - local draw_color_marker = bit32.band(flags, bit32.bor(ImGuiColorEditFlags.DisplayHSV, ImGuiColorEditFlags.NoColorMarkers)) == 0 - local hide_prefix = draw_color_marker or (w_per_component <= ImGui.CalcTextSize((bit32.band(flags, ImGuiColorEditFlags.Float) ~= 0) and "M:0.000" or "M:000").x) + local draw_color_marker = bit32.band(flags, bit32.bor(2097152 --[[ImGuiColorEditFlags.DisplayHSV]], 2048 --[[ImGuiColorEditFlags.NoColorMarkers]])) == 0 + local hide_prefix = draw_color_marker or (w_per_component <= ImGui.CalcTextSize((bit32.band(flags, 16777216 --[[ImGuiColorEditFlags.Float]]) ~= 0) and "M:0.000" or "M:000").x) local fmt_idx if hide_prefix then fmt_idx = 1 - elseif bit32.band(flags, ImGuiColorEditFlags.DisplayHSV) ~= 0 then + elseif bit32.band(flags, 2097152 --[[ImGuiColorEditFlags.DisplayHSV]]) ~= 0 then fmt_idx = 3 else fmt_idx = 2 end - local drag_flags = draw_color_marker and ImGuiSliderFlags.ColorMarkers or ImGuiSliderFlags.None + local drag_flags = draw_color_marker and 4096 --[[ImGuiSliderFlags.ColorMarkers]] or 0 --[[ImGuiSliderFlags.None]] local prev_split = 0.0 for n = 1, components do @@ -61458,7 +61501,7 @@ function ImGui.ColorEdit4(label, col, flags) end -- FIXME: When ImGuiColorEditFlags_HDR flag is passed HS values snap in weird ways when SV values go below 0. - if bit32.band(flags, ImGuiColorEditFlags.Float) ~= 0 then + if bit32.band(flags, 16777216 --[[ImGuiColorEditFlags.Float]]) ~= 0 then local changed f[n], changed = ImGui.DragFloat(ids[n], f[n], 1.0 / 255.0, 0.0, hdr and 0.0 or 1.0, fmt_table_float[fmt_idx][n], drag_flags) value_changed = value_changed or changed @@ -61469,11 +61512,11 @@ function ImGui.ColorEdit4(label, col, flags) value_changed = value_changed or changed end - if bit32.band(flags, ImGuiColorEditFlags.NoOptions) == 0 then - ImGui.OpenPopupOnItemClick("context", ImGuiPopupFlags.MouseButtonRight) + if bit32.band(flags, 8 --[[ImGuiColorEditFlags.NoOptions]]) == 0 then + ImGui.OpenPopupOnItemClick("context", 8 --[[ImGuiPopupFlags.MouseButtonRight]]) end end - elseif bit32.band(flags, ImGuiColorEditFlags.DisplayHex) ~= 0 and bit32.band(flags, ImGuiColorEditFlags.NoInputs) == 0 then + elseif bit32.band(flags, 4194304 --[[ImGuiColorEditFlags.DisplayHex]]) ~= 0 and bit32.band(flags, 32 --[[ImGuiColorEditFlags.NoInputs]]) == 0 then -- RGB Hexadecimal Input -- TODO: resolve sprintf, sscanf requirement. currently this section creates a lot of temp tables and strings... local buf, buf_size = nil, 64 @@ -61488,7 +61531,7 @@ function ImGui.ColorEdit4(label, col, flags) end ImGui.SetNextItemWidth(w_inputs) - if ImGui.InputText("##Text", buf, buf_size, ImGuiInputTextFlags.CharsUppercase) then + if ImGui.InputText("##Text", buf, buf_size, 8 --[[ImGuiInputTextFlags.CharsUppercase]]) then value_changed = true local p = 1 while buf[p] == 35 or ImCharIsBlankA(buf[p]) do @@ -61506,27 +61549,27 @@ function ImGui.ColorEdit4(label, col, flags) -- IM_UNUSED(r) -- Fixes C6031: Return value ignored: 'sscanf'. end - if bit32.band(flags, ImGuiColorEditFlags.NoOptions) == 0 then - ImGui.OpenPopupOnItemClick("context", ImGuiPopupFlags.MouseButtonRight) + if bit32.band(flags, 8 --[[ImGuiColorEditFlags.NoOptions]]) == 0 then + ImGui.OpenPopupOnItemClick("context", 8 --[[ImGuiPopupFlags.MouseButtonRight]]) end end local picker_active_window = nil - if bit32.band(flags, ImGuiColorEditFlags.NoSmallPreview) == 0 then - local button_offset_x = (bit32.band(flags, ImGuiColorEditFlags.NoInputs) ~= 0 or style.ColorButtonPosition == ImGuiDir.Left) and 0.0 or (w_inputs + style.ItemInnerSpacing.x) + if bit32.band(flags, 16 --[[ImGuiColorEditFlags.NoSmallPreview]]) == 0 then + local button_offset_x = (bit32.band(flags, 32 --[[ImGuiColorEditFlags.NoInputs]]) ~= 0 or style.ColorButtonPosition == 0 --[[ImGuiDir.Left]]) and 0.0 or (w_inputs + style.ItemInnerSpacing.x) ImVec2_Copy(window.DC.CursorPos, ImVec2(pos.x + button_offset_x, pos.y)) local col_v4 = ImVec4(col[1], col[2], col[3], alpha and col[4] or 1.0) if ImGui.ColorButton("##ColorButton", col_v4, flags) then - if bit32.band(flags, ImGuiColorEditFlags.NoPicker) == 0 then + if bit32.band(flags, 4 --[[ImGuiColorEditFlags.NoPicker]]) == 0 then -- Store current color and open a picker ImVec4_Copy(g.ColorPickerRef, col_v4) ImGui.OpenPopup("picker") ImGui.SetNextWindowPos(g.LastItemData.Rect:GetBL() + ImVec2(0.0, style.ItemSpacing.y)) end end - if bit32.band(flags, ImGuiColorEditFlags.NoOptions) == 0 then - ImGui.OpenPopupOnItemClick("context", ImGuiPopupFlags.MouseButtonRight) + if bit32.band(flags, 8 --[[ImGuiColorEditFlags.NoOptions]]) == 0 then + ImGui.OpenPopupOnItemClick("context", 8 --[[ImGuiPopupFlags.MouseButtonRight]]) end if ImGui.BeginPopup("picker") then @@ -61536,8 +61579,8 @@ function ImGui.ColorEdit4(label, col, flags) ImGui.TextEx(label, label_display_end) ImGui.Spacing() end - local picker_flags_to_forward = bit32.bor(ImGuiColorEditFlags.DataTypeMask_, ImGuiColorEditFlags.PickerMask_, ImGuiColorEditFlags.InputMask_, ImGuiColorEditFlags.HDR, ImGuiColorEditFlags.NoAlpha, ImGuiColorEditFlags.AlphaBar) - local picker_flags = bit32.bor(bit32.band(flags_untouched, picker_flags_to_forward), ImGuiColorEditFlags.DisplayMask_, ImGuiColorEditFlags.NoLabel, ImGuiColorEditFlags.AlphaPreviewHalf) + local picker_flags_to_forward = bit32.bor(25165824 --[[ImGuiColorEditFlags.DataTypeMask_]], 100663296 --[[ImGuiColorEditFlags.PickerMask_]], 805306368 --[[ImGuiColorEditFlags.InputMask_]], 524288 --[[ImGuiColorEditFlags.HDR]], 2 --[[ImGuiColorEditFlags.NoAlpha]], 262144 --[[ImGuiColorEditFlags.AlphaBar]]) + local picker_flags = bit32.bor(bit32.band(flags_untouched, picker_flags_to_forward), 7340032 --[[ImGuiColorEditFlags.DisplayMask_]], 128 --[[ImGuiColorEditFlags.NoLabel]], 16384 --[[ImGuiColorEditFlags.AlphaPreviewHalf]]) ImGui.SetNextItemWidth(square_sz * 12.0) -- Use 256 + bar sizes? value_changed = value_changed or ImGui.ColorPicker4("##picker", col, picker_flags, g.ColorPickerRef) end @@ -61545,11 +61588,11 @@ function ImGui.ColorEdit4(label, col, flags) end end - if label ~= "" and label_display_end > 1 and bit32.band(flags, ImGuiColorEditFlags.NoLabel) == 0 then + if label ~= "" and label_display_end > 1 and bit32.band(flags, 128 --[[ImGuiColorEditFlags.NoLabel]]) == 0 then -- Position not necessarily next to last submitted button (e.g. if style.ColorButtonPosition == ImGuiDir_Left), -- but we need to use SameLine() to setup baseline correctly. Might want to refactor SameLine() to simplify this. ImGui.SameLine(0.0, style.ItemInnerSpacing.x) - window.DC.CursorPos.x = pos.x + ((bit32.band(flags, ImGuiColorEditFlags.NoInputs) ~= 0) and w_button or (w_full + style.ItemInnerSpacing.x)) + window.DC.CursorPos.x = pos.x + ((bit32.band(flags, 32 --[[ImGuiColorEditFlags.NoInputs]]) ~= 0) and w_button or (w_full + style.ItemInnerSpacing.x)) ImGui.TextEx(label, label_display_end) end @@ -61560,14 +61603,14 @@ function ImGui.ColorEdit4(label, col, flags) f[n] = i[n] / 255.0 end end - if bit32.band(flags, ImGuiColorEditFlags.DisplayHSV) ~= 0 and bit32.band(flags, ImGuiColorEditFlags.InputRGB) ~= 0 then + if bit32.band(flags, 2097152 --[[ImGuiColorEditFlags.DisplayHSV]]) ~= 0 and bit32.band(flags, 268435456 --[[ImGuiColorEditFlags.InputRGB]]) ~= 0 then g.ColorEditSavedHue = f[1] g.ColorEditSavedSat = f[2] f[1], f[2], f[3] = ImGui.ColorConvertHSVtoRGB(f[1], f[2], f[3]) g.ColorEditSavedID = g.ColorEditCurrentID g.ColorEditSavedColor = ImGui.ColorConvertFloat4ToU32(ImVec4(f[1], f[2], f[3], 0)) end - if bit32.band(flags, ImGuiColorEditFlags.DisplayRGB) ~= 0 and bit32.band(flags, ImGuiColorEditFlags.InputHSV) ~= 0 then + if bit32.band(flags, 1048576 --[[ImGuiColorEditFlags.DisplayRGB]]) ~= 0 and bit32.band(flags, 536870912 --[[ImGuiColorEditFlags.InputHSV]]) ~= 0 then f[1], f[2], f[3] = ImGui.ColorConvertRGBtoHSV(f[1], f[2], f[3]) end @@ -61609,14 +61652,14 @@ function ImGui.ColorEdit3(label, col, flags) if flags == nil then flags = 0 end if flags == nil then flags = 0 end - return ImGui.ColorEdit4(label, col, bit32.bor(flags, ImGuiColorEditFlags.NoAlpha)) + return ImGui.ColorEdit4(label, col, bit32.bor(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]])) end -- `col` mutated in place, returns value_changed function ImGui.ColorPicker3(label, col, flags) if flags == nil then flags = 0 end local col4 = { col[1], col[2], col[3], 1.0 } - if not ImGui.ColorPicker4(label, col4, bit32.bor(flags or 0, ImGuiColorEditFlags.NoAlpha)) then + if not ImGui.ColorPicker4(label, col4, bit32.bor(flags or 0, 2 --[[ImGuiColorEditFlags.NoAlpha]])) then return false end col[1] = col4[1]; col[2] = col4[2]; col[3] = col4[3] @@ -61626,8 +61669,8 @@ end -- This allowed passing 0 to set default, whereas NewFrame() will assert if one of missing. Abide to old logic. function ImGui.SetColorEditOptions(flags) local g = GImGui - local def = ImGuiColorEditFlags.DefaultOptions_ - for _, mask in ipairs({ ImGuiColorEditFlags.DisplayMask_, ImGuiColorEditFlags.DataTypeMask_, ImGuiColorEditFlags.PickerMask_, ImGuiColorEditFlags.InputMask_ }) do + local def = 311427072 --[[ImGuiColorEditFlags.DefaultOptions_]] + for _, mask in ipairs({ 7340032 --[[ImGuiColorEditFlags.DisplayMask_]], 25165824 --[[ImGuiColorEditFlags.DataTypeMask_]], 100663296 --[[ImGuiColorEditFlags.PickerMask_]], 805306368 --[[ImGuiColorEditFlags.InputMask_]] }) do if bit32.band(flags, mask) == 0 then flags = bit32.bor(flags, bit32.band(def, mask)) end @@ -61643,10 +61686,10 @@ end --- @param alpha float local function RenderArrowsForVerticalBar(draw_list, pos, half_sz, bar_w, alpha) local alpha8 = IM_F32_TO_INT8_SAT(alpha) - ImGui.RenderArrowPointingAt(draw_list, ImVec2(pos.x + half_sz.x + 1, pos.y), ImVec2(half_sz.x + 2, half_sz.y + 1), ImGuiDir.Right, IM_COL32(0, 0, 0, alpha8)) - ImGui.RenderArrowPointingAt(draw_list, ImVec2(pos.x + half_sz.x, pos.y), half_sz, ImGuiDir.Right, IM_COL32(255, 255, 255, alpha8)) - ImGui.RenderArrowPointingAt(draw_list, ImVec2(pos.x + bar_w - half_sz.x - 1, pos.y), ImVec2(half_sz.x + 2, half_sz.y + 1), ImGuiDir.Left, IM_COL32(0, 0, 0, alpha8)) - ImGui.RenderArrowPointingAt(draw_list, ImVec2(pos.x + bar_w - half_sz.x, pos.y), half_sz, ImGuiDir.Left, IM_COL32(255, 255, 255, alpha8)) + ImGui.RenderArrowPointingAt(draw_list, ImVec2(pos.x + half_sz.x + 1, pos.y), ImVec2(half_sz.x + 2, half_sz.y + 1), 1 --[[ImGuiDir.Right]], IM_COL32(0, 0, 0, alpha8)) + ImGui.RenderArrowPointingAt(draw_list, ImVec2(pos.x + half_sz.x, pos.y), half_sz, 1 --[[ImGuiDir.Right]], IM_COL32(255, 255, 255, alpha8)) + ImGui.RenderArrowPointingAt(draw_list, ImVec2(pos.x + bar_w - half_sz.x - 1, pos.y), ImVec2(half_sz.x + 2, half_sz.y + 1), 0 --[[ImGuiDir.Left]], IM_COL32(0, 0, 0, alpha8)) + ImGui.RenderArrowPointingAt(draw_list, ImVec2(pos.x + bar_w - half_sz.x, pos.y), half_sz, 0 --[[ImGuiDir.Left]], IM_COL32(255, 255, 255, alpha8)) end do --[[ColorPicker4]] @@ -61673,7 +61716,7 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) local io = g.IO local width = ImGui.CalcItemWidth() - local is_readonly = bit32.band(bit32.bor(g.NextItemData.ItemFlagsSet, g.CurrentItemFlags), ImGuiItemFlags.ReadOnly) ~= 0 + local is_readonly = bit32.band(bit32.bor(g.NextItemData.ItemFlagsSet, g.CurrentItemFlags), 2048 --[[ImGuiItemFlags.ReadOnly]]) ~= 0 g.NextItemData:ClearFlags() ImGui.PushID(label) @@ -61683,41 +61726,41 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) end ImGui.BeginGroup() - if bit32.band(flags, ImGuiColorEditFlags.NoSidePreview) == 0 then - flags = bit32.bor(flags, ImGuiColorEditFlags.NoSmallPreview) + if bit32.band(flags, 256 --[[ImGuiColorEditFlags.NoSidePreview]]) == 0 then + flags = bit32.bor(flags, 16 --[[ImGuiColorEditFlags.NoSmallPreview]]) end -- Context menu: display and store options. - if bit32.band(flags, ImGuiColorEditFlags.NoOptions) == 0 then + if bit32.band(flags, 8 --[[ImGuiColorEditFlags.NoOptions]]) == 0 then ImGui.ColorPickerOptionsPopup(col, flags) end -- Read stored options - if bit32.band(flags, ImGuiColorEditFlags.PickerMask_) == 0 then - local picker_flags = bit32.band(g.IO.ConfigColorEditFlags, ImGuiColorEditFlags.PickerMask_) + if bit32.band(flags, 100663296 --[[ImGuiColorEditFlags.PickerMask_]]) == 0 then + local picker_flags = bit32.band(g.IO.ConfigColorEditFlags, 100663296 --[[ImGuiColorEditFlags.PickerMask_]]) if picker_flags ~= 0 then flags = bit32.bor(flags, picker_flags) else - flags = bit32.bor(flags, bit32.band(ImGuiColorEditFlags.DefaultOptions_, ImGuiColorEditFlags.PickerMask_)) + flags = bit32.bor(flags, bit32.band(311427072 --[[ImGuiColorEditFlags.DefaultOptions_]], 100663296 --[[ImGuiColorEditFlags.PickerMask_]])) end end - if bit32.band(flags, ImGuiColorEditFlags.InputMask_) == 0 then - local input_flags = bit32.band(g.IO.ConfigColorEditFlags, ImGuiColorEditFlags.InputMask_) + if bit32.band(flags, 805306368 --[[ImGuiColorEditFlags.InputMask_]]) == 0 then + local input_flags = bit32.band(g.IO.ConfigColorEditFlags, 805306368 --[[ImGuiColorEditFlags.InputMask_]]) if input_flags ~= 0 then flags = bit32.bor(flags, input_flags) else - flags = bit32.bor(flags, bit32.band(ImGuiColorEditFlags.DefaultOptions_, ImGuiColorEditFlags.InputMask_)) + flags = bit32.bor(flags, bit32.band(311427072 --[[ImGuiColorEditFlags.DefaultOptions_]], 805306368 --[[ImGuiColorEditFlags.InputMask_]])) end end - IM_ASSERT(ImIsPowerOfTwo(bit32.band(flags, ImGuiColorEditFlags.PickerMask_))) -- Check that only 1 is selected - IM_ASSERT(ImIsPowerOfTwo(bit32.band(flags, ImGuiColorEditFlags.InputMask_))) -- Check that only 1 is selected - if bit32.band(flags, ImGuiColorEditFlags.NoOptions) == 0 then - flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, ImGuiColorEditFlags.AlphaBar)) + assert(ImIsPowerOfTwo(bit32.band(flags, 100663296 --[[ImGuiColorEditFlags.PickerMask_]]))) -- Check that only 1 is selected + assert(ImIsPowerOfTwo(bit32.band(flags, 805306368 --[[ImGuiColorEditFlags.InputMask_]]))) -- Check that only 1 is selected + if bit32.band(flags, 8 --[[ImGuiColorEditFlags.NoOptions]]) == 0 then + flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, 262144 --[[ImGuiColorEditFlags.AlphaBar]])) end -- Setup - local components = (bit32.band(flags, ImGuiColorEditFlags.NoAlpha) ~= 0) and 3 or 4 - local alpha_bar = (bit32.band(flags, ImGuiColorEditFlags.AlphaBar) ~= 0) and (bit32.band(flags, ImGuiColorEditFlags.NoAlpha) == 0) + local components = (bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) ~= 0) and 3 or 4 + local alpha_bar = (bit32.band(flags, 262144 --[[ImGuiColorEditFlags.AlphaBar]]) ~= 0) and (bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) == 0) local picker_pos = ImVec2() ImVec2_Copy(picker_pos, window.DC.CursorPos) local square_sz = ImGui.GetFrameHeight() @@ -61735,7 +61778,7 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) local wheel_center = ImVec2(picker_pos.x + (sv_picker_size + bars_width) * 0.5, picker_pos.y + sv_picker_size * 0.5) -- Note: the triangle is displayed rotated with triangle_pa pointing to Hue, but most coordinates stays unrotated for logic. - local triangle_rotate = bit32.band(flags, ImGuiColorEditFlags.PickerNoRotate) == 0 + local triangle_rotate = bit32.band(flags, 134217728 --[[ImGuiColorEditFlags.PickerNoRotate]]) == 0 local triangle_r = wheel_r_inner - math.floor(sv_picker_size * 0.027) local triangle_pa, triangle_pb, triangle_pc if triangle_rotate then triangle_pa = ImVec2( triangle_r, 0.0) else triangle_pa = ImVec2( triangle_r * 0.866, triangle_r * 0.5) end -- Hue point. @@ -61744,18 +61787,18 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) local H = col[1]; local S = col[2]; local V = col[3] local R = col[1]; local G = col[2]; local B = col[3] - if bit32.band(flags, ImGuiColorEditFlags.InputRGB) ~= 0 then + if bit32.band(flags, 268435456 --[[ImGuiColorEditFlags.InputRGB]]) ~= 0 then -- Hue is lost when converting from grayscale rgb (saturation=0). Restore it. H, S, V = ImGui.ColorConvertRGBtoHSV(R, G, B) H, S, V = ColorEditRestoreHS(col, H, S, V) - elseif bit32.band(flags, ImGuiColorEditFlags.InputHSV) ~= 0 then + elseif bit32.band(flags, 536870912 --[[ImGuiColorEditFlags.InputHSV]]) ~= 0 then R, G, B = ImGui.ColorConvertHSVtoRGB(H, S, V) end local value_changed = false; local value_changed_h = false; local value_changed_sv = false - ImGui.PushItemFlag(ImGuiItemFlags.NoNav, true) - if bit32.band(flags, ImGuiColorEditFlags.PickerHueWheel) ~= 0 then + ImGui.PushItemFlag(2 --[[ImGuiItemFlags.NoNav]], true) + if bit32.band(flags, 67108864 --[[ImGuiColorEditFlags.PickerHueWheel]]) ~= 0 then -- Hue wheel + SV triangle logic ImGui.InvisibleButton("hsv", ImVec2(sv_picker_size + style.ItemInnerSpacing.x + bars_width, sv_picker_size)) if ImGui.IsItemActive() and not is_readonly then @@ -61765,7 +61808,7 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) if initial_dist2 >= (wheel_r_inner - 1) * (wheel_r_inner - 1) and initial_dist2 <= (wheel_r_outer + 1) * (wheel_r_outer + 1) then -- Interactive with Hue wheel - H = ImAtan2(current_off.y, current_off.x) / IM_PI * 0.5 + H = ImAtan2(current_off.y, current_off.x) / 3.141592653589793 --[[IM_PI]] * 0.5 if H < 0.0 then H = H + 1.0 end @@ -61773,8 +61816,8 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) value_changed_h = true end - local cos_hue_angle = triangle_rotate and ImCos(-H * 2.0 * IM_PI) or 1.0 - local sin_hue_angle = triangle_rotate and ImSin(-H * 2.0 * IM_PI) or 0.0 + local cos_hue_angle = triangle_rotate and ImCos(-H * 2.0 * 3.141592653589793 --[[IM_PI]]) or 1.0 + local sin_hue_angle = triangle_rotate and ImSin(-H * 2.0 * 3.141592653589793 --[[IM_PI]]) or 0.0 if ImStd.ImTriangleContainsPoint(triangle_pa, triangle_pb, triangle_pc, ImRotate(initial_off, cos_hue_angle, sin_hue_angle)) then -- Interacting with SV triangle @@ -61791,10 +61834,10 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) end end - if bit32.band(flags, ImGuiColorEditFlags.NoOptions) == 0 then - ImGui.OpenPopupOnItemClick("context", ImGuiPopupFlags.MouseButtonRight) + if bit32.band(flags, 8 --[[ImGuiColorEditFlags.NoOptions]]) == 0 then + ImGui.OpenPopupOnItemClick("context", 8 --[[ImGuiPopupFlags.MouseButtonRight]]) end - elseif bit32.band(flags, ImGuiColorEditFlags.PickerHueBar) ~= 0 then + elseif bit32.band(flags, 33554432 --[[ImGuiColorEditFlags.PickerHueBar]]) ~= 0 then -- SV rectangle logic ImGui.InvisibleButton("sv", ImVec2(sv_picker_size, sv_picker_size)) if ImGui.IsItemActive() and not is_readonly then @@ -61805,8 +61848,8 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) value_changed_sv = true end - if bit32.band(flags, ImGuiColorEditFlags.NoOptions) == 0 then - ImGui.OpenPopupOnItemClick("context", ImGuiPopupFlags.MouseButtonRight) + if bit32.band(flags, 8 --[[ImGuiColorEditFlags.NoOptions]]) == 0 then + ImGui.OpenPopupOnItemClick("context", 8 --[[ImGuiPopupFlags.MouseButtonRight]]) end -- Hue bar logic @@ -61830,36 +61873,36 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) end ImGui.PopItemFlag() -- ImGuiItemFlags.NoNav - if bit32.band(flags, ImGuiColorEditFlags.NoSidePreview) == 0 then + if bit32.band(flags, 256 --[[ImGuiColorEditFlags.NoSidePreview]]) == 0 then ImGui.SameLine(0, style.ItemInnerSpacing.x) ImGui.BeginGroup() end - if bit32.band(flags, ImGuiColorEditFlags.NoLabel) == 0 then + if bit32.band(flags, 128 --[[ImGuiColorEditFlags.NoLabel]]) == 0 then local label_display_end = ImGui.FindRenderedTextEnd(label) if label ~= "" and label_display_end > 1 then - if bit32.band(flags, ImGuiColorEditFlags.NoSidePreview) ~= 0 then + if bit32.band(flags, 256 --[[ImGuiColorEditFlags.NoSidePreview]]) ~= 0 then ImGui.SameLine(0, style.ItemInnerSpacing.x) end ImGui.TextEx(label, label_display_end) end end - if bit32.band(flags, ImGuiColorEditFlags.NoSidePreview) == 0 then - ImGui.PushItemFlag(ImGuiItemFlags.NoNavDefaultFocus, true) - local col_v4 = ImVec4(col[1], col[2], col[3], (bit32.band(flags, ImGuiColorEditFlags.NoAlpha) ~= 0) and 1.0 or col[4]) + if bit32.band(flags, 256 --[[ImGuiColorEditFlags.NoSidePreview]]) == 0 then + ImGui.PushItemFlag(4 --[[ImGuiItemFlags.NoNavDefaultFocus]], true) + local col_v4 = ImVec4(col[1], col[2], col[3], (bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) ~= 0) and 1.0 or col[4]) - if bit32.band(flags, ImGuiColorEditFlags.NoLabel) ~= 0 then + if bit32.band(flags, 128 --[[ImGuiColorEditFlags.NoLabel]]) ~= 0 then ImGui.Text("Current") end - local sub_flags_to_forward = bit32.bor(ImGuiColorEditFlags.InputMask_, ImGuiColorEditFlags.HDR, ImGuiColorEditFlags.AlphaMask_, ImGuiColorEditFlags.NoTooltip) + local sub_flags_to_forward = bit32.bor(805306368 --[[ImGuiColorEditFlags.InputMask_]], 524288 --[[ImGuiColorEditFlags.HDR]], 28674 --[[ImGuiColorEditFlags.AlphaMask_]], 64 --[[ImGuiColorEditFlags.NoTooltip]]) ImGui.ColorButton("##current", col_v4, bit32.band(flags, sub_flags_to_forward), ImVec2(square_sz * 3, square_sz * 2)) if ref_col ~= nil then ImGui.Text("Original") - local ref_col_v4 = ImVec4(ref_col[1], ref_col[2], ref_col[3], (bit32.band(flags, ImGuiColorEditFlags.NoAlpha) ~= 0) and 1.0 or ref_col[4]) + local ref_col_v4 = ImVec4(ref_col[1], ref_col[2], ref_col[3], (bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) ~= 0) and 1.0 or ref_col[4]) if ImGui.ColorButton("##original", ref_col_v4, bit32.band(flags, sub_flags_to_forward), ImVec2(square_sz * 3, square_sz * 2)) then for i = 1, components do col[i] = ref_col[i] @@ -61874,13 +61917,13 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) -- Convert back color to RGB if value_changed_h or value_changed_sv then - if bit32.band(flags, ImGuiColorEditFlags.InputRGB) ~= 0 then + if bit32.band(flags, 268435456 --[[ImGuiColorEditFlags.InputRGB]]) ~= 0 then col[1], col[2], col[3] = ImGui.ColorConvertHSVtoRGB(H, S, V) -- Lua 1-based indexing g.ColorEditSavedHue = H g.ColorEditSavedSat = S g.ColorEditSavedID = g.ColorEditCurrentID g.ColorEditSavedColor = ImGui.ColorConvertFloat4ToU32(ImVec4(col[1], col[2], col[3], 0)) - elseif bit32.band(flags, ImGuiColorEditFlags.InputHSV) ~= 0 then + elseif bit32.band(flags, 536870912 --[[ImGuiColorEditFlags.InputHSV]]) ~= 0 then col[1] = H col[2] = S col[3] = V @@ -61889,14 +61932,14 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) -- R,G,B and H,S,V slider color editor local value_changed_fix_hue_wrap = false - if bit32.band(flags, ImGuiColorEditFlags.NoInputs) == 0 then + if bit32.band(flags, 32 --[[ImGuiColorEditFlags.NoInputs]]) == 0 then ImGui.PushItemWidth((alpha_bar and bar1_pos_x or bar0_pos_x) + bars_width - picker_pos.x) - local sub_flags_to_forward = bit32.bor(ImGuiColorEditFlags.DataTypeMask_, ImGuiColorEditFlags.InputMask_, ImGuiColorEditFlags.HDR, ImGuiColorEditFlags.AlphaMask_, ImGuiColorEditFlags.NoOptions, ImGuiColorEditFlags.NoTooltip, ImGuiColorEditFlags.NoSmallPreview) - local sub_flags = bit32.bor(bit32.band(flags, sub_flags_to_forward), ImGuiColorEditFlags.NoPicker) + local sub_flags_to_forward = bit32.bor(25165824 --[[ImGuiColorEditFlags.DataTypeMask_]], 805306368 --[[ImGuiColorEditFlags.InputMask_]], 524288 --[[ImGuiColorEditFlags.HDR]], 28674 --[[ImGuiColorEditFlags.AlphaMask_]], 8 --[[ImGuiColorEditFlags.NoOptions]], 64 --[[ImGuiColorEditFlags.NoTooltip]], 16 --[[ImGuiColorEditFlags.NoSmallPreview]]) + local sub_flags = bit32.bor(bit32.band(flags, sub_flags_to_forward), 4 --[[ImGuiColorEditFlags.NoPicker]]) - if bit32.band(flags, ImGuiColorEditFlags.DisplayRGB) ~= 0 or bit32.band(flags, ImGuiColorEditFlags.DisplayMask_) == 0 then - if ImGui.ColorEdit4("##rgb", col, bit32.bor(sub_flags, ImGuiColorEditFlags.DisplayRGB)) then + if bit32.band(flags, 1048576 --[[ImGuiColorEditFlags.DisplayRGB]]) ~= 0 or bit32.band(flags, 7340032 --[[ImGuiColorEditFlags.DisplayMask_]]) == 0 then + if ImGui.ColorEdit4("##rgb", col, bit32.bor(sub_flags, 1048576 --[[ImGuiColorEditFlags.DisplayRGB]])) then -- FIXME: Hackily differentiating using the DragInt (ActiveId != 0 && !ActiveIdAllowOverlap) vs. using the InputText or DropTarget. -- For the later we don't want to run the hue-wrap canceling code. If you are well versed in HSV picker please provide your input! (See #2050) value_changed_fix_hue_wrap = (g.ActiveId ~= 0 and not g.ActiveIdAllowOverlap) @@ -61904,14 +61947,14 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) end end - if bit32.band(flags, ImGuiColorEditFlags.DisplayHSV) ~= 0 or bit32.band(flags, ImGuiColorEditFlags.DisplayMask_) == 0 then - if ImGui.ColorEdit4("##hsv", col, bit32.bor(sub_flags, ImGuiColorEditFlags.DisplayHSV)) then + if bit32.band(flags, 2097152 --[[ImGuiColorEditFlags.DisplayHSV]]) ~= 0 or bit32.band(flags, 7340032 --[[ImGuiColorEditFlags.DisplayMask_]]) == 0 then + if ImGui.ColorEdit4("##hsv", col, bit32.bor(sub_flags, 2097152 --[[ImGuiColorEditFlags.DisplayHSV]])) then value_changed = true end end - if bit32.band(flags, ImGuiColorEditFlags.DisplayHex) ~= 0 or bit32.band(flags, ImGuiColorEditFlags.DisplayMask_) == 0 then - if ImGui.ColorEdit4("##hex", col, bit32.bor(sub_flags, ImGuiColorEditFlags.DisplayHex)) then + if bit32.band(flags, 4194304 --[[ImGuiColorEditFlags.DisplayHex]]) ~= 0 or bit32.band(flags, 7340032 --[[ImGuiColorEditFlags.DisplayMask_]]) == 0 then + if ImGui.ColorEdit4("##hex", col, bit32.bor(sub_flags, 4194304 --[[ImGuiColorEditFlags.DisplayHex]])) then value_changed = true end end @@ -61920,7 +61963,7 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) end -- Try to cancel hue wrap (after ColorEdit4 call), if any - if value_changed_fix_hue_wrap and bit32.band(flags, ImGuiColorEditFlags.InputRGB) ~= 0 then + if value_changed_fix_hue_wrap and bit32.band(flags, 268435456 --[[ImGuiColorEditFlags.InputRGB]]) ~= 0 then local new_H, new_S, new_V = ImGui.ColorConvertRGBtoHSV(col[1], col[2], col[3]) -- Lua 1-based indexing if new_H <= 0 and H > 0 then @@ -61933,13 +61976,13 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) end if value_changed then - if bit32.band(flags, ImGuiColorEditFlags.InputRGB) ~= 0 then + if bit32.band(flags, 268435456 --[[ImGuiColorEditFlags.InputRGB]]) ~= 0 then R = col[1] G = col[2] B = col[3] H, S, V = ImGui.ColorConvertRGBtoHSV(R, G, B) H, S, V = ColorEditRestoreHS(col, H, S, V) -- Fix local Hue as display below will use it immediately. - elseif bit32.band(flags, ImGuiColorEditFlags.InputHSV) ~= 0 then + elseif bit32.band(flags, 536870912 --[[ImGuiColorEditFlags.InputHSV]]) ~= 0 then H = col[1] S = col[2] V = col[3] @@ -61960,14 +62003,14 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) local sv_cursor_pos = ImVec2() - if bit32.band(flags, ImGuiColorEditFlags.PickerHueWheel) ~= 0 then + if bit32.band(flags, 67108864 --[[ImGuiColorEditFlags.PickerHueWheel]]) ~= 0 then -- Render Hue Wheel local aeps = 0.5 / wheel_r_outer -- Half a pixel arc length in radians (2pi cancels out). local segment_per_arc = ImMax(4, math.floor(wheel_r_outer / 12)) for n = 1, 6 do - local a0 = (n - 1) / 6.0 * 2.0 * IM_PI - aeps - local a1 = n / 6.0 * 2.0 * IM_PI + aeps + local a0 = (n - 1) / 6.0 * 2.0 * 3.141592653589793 --[[IM_PI]] - aeps + local a1 = n / 6.0 * 2.0 * 3.141592653589793 --[[IM_PI]] + aeps local vert_start_idx = draw_list.VtxBuffer.Size + 1 draw_list:PathArcTo(wheel_center, (wheel_r_inner + wheel_r_outer) * 0.5, a0, a1, segment_per_arc) @@ -61982,8 +62025,8 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) end -- Render Cursor + preview on Hue Wheel - local cos_hue_angle = ImCos(H * 2.0 * IM_PI) - local sin_hue_angle = ImSin(H * 2.0 * IM_PI) + local cos_hue_angle = ImCos(H * 2.0 * 3.141592653589793 --[[IM_PI]]) + local sin_hue_angle = ImSin(H * 2.0 * 3.141592653589793 --[[IM_PI]]) local hue_cursor_pos = ImVec2(wheel_center.x + cos_hue_angle * (wheel_r_inner + wheel_r_outer) * 0.5, wheel_center.y + sin_hue_angle * (wheel_r_inner + wheel_r_outer) * 0.5) @@ -62012,7 +62055,7 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) draw_list:AddTriangle(tra, trb, trc, col_midgrey, 1.5) sv_cursor_pos = ImLerp(ImLerp(trc, tra, ImSaturate(S)), trb, ImSaturate(1 - V)) - elseif bit32.band(flags, ImGuiColorEditFlags.PickerHueBar) ~= 0 then + elseif bit32.band(flags, 33554432 --[[ImGuiColorEditFlags.PickerHueBar]]) ~= 0 then -- Render SV Square draw_list:AddRectFilledMultiColor(picker_pos, picker_pos + ImVec2(sv_picker_size, sv_picker_size), col_white, hue_color32, hue_color32, col_white) draw_list:AddRectFilledMultiColor(picker_pos, picker_pos + ImVec2(sv_picker_size, sv_picker_size), 0, 0, col_black, col_black) @@ -62043,7 +62086,7 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) 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)) - 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(IM_COL32_A_MASK)), bit32.band(user_col32_striped_of_alpha, bit32.bnot(IM_COL32_A_MASK))) + 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) ImGui.RenderFrameBorder(bar1_bb.Min, bar1_bb.Max, 0.0) @@ -62108,12 +62151,12 @@ function ImGui.ColorButton(desc_id, col, flags, size_arg) local pressed, hovered, _ = ImGui.ButtonBehavior(bb, id) - if bit32.band(flags, bit32.bor(ImGuiColorEditFlags.NoAlpha, ImGuiColorEditFlags.AlphaOpaque)) ~= 0 then - flags = bit32.band(flags, bit32.bnot(bit32.bor(ImGuiColorEditFlags.AlphaNoBg, ImGuiColorEditFlags.AlphaPreviewHalf))) + if bit32.band(flags, bit32.bor(2 --[[ImGuiColorEditFlags.NoAlpha]], 4096 --[[ImGuiColorEditFlags.AlphaOpaque]])) ~= 0 then + flags = bit32.band(flags, bit32.bnot(bit32.bor(8192 --[[ImGuiColorEditFlags.AlphaNoBg]], 16384 --[[ImGuiColorEditFlags.AlphaPreviewHalf]]))) end local col_rgb = ImVec4(col.x, col.y, col.z, col.w) - if bit32.band(flags, ImGuiColorEditFlags.InputHSV) ~= 0 then + if bit32.band(flags, 536870912 --[[ImGuiColorEditFlags.InputHSV]]) ~= 0 then col_rgb.x, col_rgb.y, col_rgb.z = ImGui.ColorConvertHSVtoRGB(col_rgb.x, col_rgb.y, col_rgb.z) end @@ -62123,33 +62166,33 @@ function ImGui.ColorButton(desc_id, col, flags, size_arg) local bb_inner = ImRect() ImRect_Copy(bb_inner, bb) local off = 0.0 - if bit32.band(flags, ImGuiColorEditFlags.NoBorder) == 0 then + if bit32.band(flags, 1024 --[[ImGuiColorEditFlags.NoBorder]]) == 0 then off = -0.75 bb_inner:Expand(off) end - if bit32.band(flags, ImGuiColorEditFlags.AlphaPreviewHalf) ~= 0 and col_rgb.w < 1.0 then + 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, 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, ImDrawFlags.RoundCornersRight) + 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.RoundCornersRight]]) else - window.DrawList:AddRectFilled(ImVec2(bb_inner.Min.x + grid_step, bb_inner.Min.y), bb_inner.Max, ImGui.GetColorU32(col_rgb), rounding, ImDrawFlags.RoundCornersRight) + window.DrawList:AddRectFilled(ImVec2(bb_inner.Min.x + grid_step, bb_inner.Min.y), bb_inner.Max, ImGui.GetColorU32(col_rgb), rounding, 160 --[[ImDrawFlags.RoundCornersRight]]) end - window.DrawList:AddRectFilled(bb_inner.Min, ImVec2(mid_x, bb_inner.Max.y), ImGui.GetColorU32(col_rgb_without_alpha), rounding, ImDrawFlags.RoundCornersLeft) + window.DrawList:AddRectFilled(bb_inner.Min, ImVec2(mid_x, bb_inner.Max.y), ImGui.GetColorU32(col_rgb_without_alpha), rounding, 80 --[[ImDrawFlags.RoundCornersLeft]]) 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, ImGuiColorEditFlags.AlphaOpaque) ~= 0) and col_rgb_without_alpha or col_rgb - if col_source.w < 1.0 and bit32.band(flags, ImGuiColorEditFlags.AlphaNoBg) == 0 then + 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) else window.DrawList:AddRectFilled(bb_inner.Min, bb_inner.Max, ImGui.GetColorU32(col_source), rounding) end end ImGui.RenderNavCursor(bb, id) - if bit32.band(flags, ImGuiColorEditFlags.NoBorder) == 0 then + 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(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) -- Color buttons are often in need of some sort of border end end @@ -62168,8 +62211,8 @@ function ImGui.ColorButton(desc_id, col, flags, size_arg) -- end -- Tooltip - if bit32.band(flags, ImGuiColorEditFlags.NoTooltip) == 0 and hovered and ImGui.IsItemHovered(ImGuiHoveredFlags.ForTooltip) then - ImGui.ColorTooltip(desc_id, col, bit32.band(flags, bit32.bor(ImGuiColorEditFlags.InputMask_, ImGuiColorEditFlags.AlphaMask_))) + if bit32.band(flags, 64 --[[ImGuiColorEditFlags.NoTooltip]]) == 0 and hovered and ImGui.IsItemHovered(4096 --[[ImGuiHoveredFlags.ForTooltip]]) then + ImGui.ColorTooltip(desc_id, col, bit32.band(flags, bit32.bor(805306368 --[[ImGuiColorEditFlags.InputMask_]], 28674 --[[ImGuiColorEditFlags.AlphaMask_]]))) end return pressed @@ -62182,7 +62225,7 @@ end function ImGui.ColorTooltip(text, col, flags) local g = GImGui - if not ImGui.BeginTooltipEx(ImGuiTooltipFlags.OverridePrevious, ImGuiWindowFlags.None) then + if not ImGui.BeginTooltipEx(2 --[[ImGuiTooltipFlags.OverridePrevious]], 0 --[[ImGuiWindowFlags.None]]) then return end @@ -62194,24 +62237,24 @@ function ImGui.ColorTooltip(text, col, flags) end local sz = ImVec2(g.FontSize * 3 + g.Style.FramePadding.y * 2, g.FontSize * 3 + g.Style.FramePadding.y * 2) - local cf = ImVec4(col.x, col.y, col.z, (bit32.band(flags, ImGuiColorEditFlags.NoAlpha) ~= 0) and 1.0 or col.w) + local cf = ImVec4(col.x, col.y, col.z, (bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) ~= 0) and 1.0 or col.w) local cr = IM_F32_TO_INT8_SAT(col.x) local cg = IM_F32_TO_INT8_SAT(col.y) local cb = IM_F32_TO_INT8_SAT(col.z) - local ca = (bit32.band(flags, ImGuiColorEditFlags.NoAlpha) ~= 0) and 255 or IM_F32_TO_INT8_SAT(col.w) + local ca = (bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) ~= 0) and 255 or IM_F32_TO_INT8_SAT(col.w) - local flags_to_forward = bit32.bor(ImGuiColorEditFlags.InputMask_, ImGuiColorEditFlags.AlphaMask_) - ImGui.ColorButton("##preview", cf, bit32.bor(bit32.band(flags, flags_to_forward), ImGuiColorEditFlags.NoTooltip), sz) + local flags_to_forward = bit32.bor(805306368 --[[ImGuiColorEditFlags.InputMask_]], 28674 --[[ImGuiColorEditFlags.AlphaMask_]]) + ImGui.ColorButton("##preview", cf, bit32.bor(bit32.band(flags, flags_to_forward), 64 --[[ImGuiColorEditFlags.NoTooltip]]), sz) ImGui.SameLine() - if bit32.band(flags, ImGuiColorEditFlags.InputRGB) ~= 0 or bit32.band(flags, ImGuiColorEditFlags.InputMask_) == 0 then - if bit32.band(flags, ImGuiColorEditFlags.NoAlpha) ~= 0 then + if bit32.band(flags, 268435456 --[[ImGuiColorEditFlags.InputRGB]]) ~= 0 or bit32.band(flags, 805306368 --[[ImGuiColorEditFlags.InputMask_]]) == 0 then + if bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) ~= 0 then ImGui.Text("#%02X%02X%02X\nR: %d, G: %d, B: %d\n(%.3f, %.3f, %.3f)", cr, cg, cb, cr, cg, cb, col.x, col.y, col.z) else ImGui.Text("#%02X%02X%02X%02X\nR:%d, G:%d, B:%d, A:%d\n(%.3f, %.3f, %.3f, %.3f)", cr, cg, cb, ca, cr, cg, cb, ca, col.x, col.y, col.z, col.w) end - elseif bit32.band(flags, ImGuiColorEditFlags.InputHSV) ~= 0 then - if bit32.band(flags, ImGuiColorEditFlags.NoAlpha) ~= 0 then + elseif bit32.band(flags, 536870912 --[[ImGuiColorEditFlags.InputHSV]]) ~= 0 then + if bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) ~= 0 then ImGui.Text("H: %.3f, S: %.3f, V: %.3f", col.x, col.y, col.z) else ImGui.Text("H: %.3f, S: %.3f, V: %.3f, A: %.3f", col.x, col.y, col.z, col.w) @@ -62224,34 +62267,34 @@ end --- @param col float[] --- @param flags ImGuiColorEditFlags function ImGui.ColorEditOptionsPopup(col, flags) - local allow_opt_inputs = bit32.band(flags, ImGuiColorEditFlags.DisplayMask_) == 0 - local allow_opt_datatype = bit32.band(flags, ImGuiColorEditFlags.DataTypeMask_) == 0 + local allow_opt_inputs = bit32.band(flags, 7340032 --[[ImGuiColorEditFlags.DisplayMask_]]) == 0 + local allow_opt_datatype = bit32.band(flags, 25165824 --[[ImGuiColorEditFlags.DataTypeMask_]]) == 0 if (not allow_opt_inputs and not allow_opt_datatype) or not ImGui.BeginPopup("context") then return end local g = GImGui - ImGui.PushItemFlag(ImGuiItemFlags.NoMarkEdited, true) + ImGui.PushItemFlag(65536 --[[ImGuiItemFlags.NoMarkEdited]], true) local opts = g.IO.ConfigColorEditFlags if allow_opt_inputs then - if ImGui.RadioButtonEx("RGB", bit32.band(opts, ImGuiColorEditFlags.DisplayRGB) ~= 0) then - opts = bit32.bor(bit32.band(opts, bit32.bnot(ImGuiColorEditFlags.DisplayMask_)), ImGuiColorEditFlags.DisplayRGB) + if ImGui.RadioButtonEx("RGB", bit32.band(opts, 1048576 --[[ImGuiColorEditFlags.DisplayRGB]]) ~= 0) then + opts = bit32.bor(bit32.band(opts, bit32.bnot(7340032 --[[ImGuiColorEditFlags.DisplayMask_]])), 1048576 --[[ImGuiColorEditFlags.DisplayRGB]]) end - if ImGui.RadioButtonEx("HSV", bit32.band(opts, ImGuiColorEditFlags.DisplayHSV) ~= 0) then - opts = bit32.bor(bit32.band(opts, bit32.bnot(ImGuiColorEditFlags.DisplayMask_)), ImGuiColorEditFlags.DisplayHSV) + if ImGui.RadioButtonEx("HSV", bit32.band(opts, 2097152 --[[ImGuiColorEditFlags.DisplayHSV]]) ~= 0) then + opts = bit32.bor(bit32.band(opts, bit32.bnot(7340032 --[[ImGuiColorEditFlags.DisplayMask_]])), 2097152 --[[ImGuiColorEditFlags.DisplayHSV]]) end - if ImGui.RadioButtonEx("Hex", bit32.band(opts, ImGuiColorEditFlags.DisplayHex) ~= 0) then - opts = bit32.bor(bit32.band(opts, bit32.bnot(ImGuiColorEditFlags.DisplayMask_)), ImGuiColorEditFlags.DisplayHex) + if ImGui.RadioButtonEx("Hex", bit32.band(opts, 4194304 --[[ImGuiColorEditFlags.DisplayHex]]) ~= 0) then + opts = bit32.bor(bit32.band(opts, bit32.bnot(7340032 --[[ImGuiColorEditFlags.DisplayMask_]])), 4194304 --[[ImGuiColorEditFlags.DisplayHex]]) end end if allow_opt_datatype then if allow_opt_inputs then ImGui.Separator() end - if ImGui.RadioButtonEx("0..255", bit32.band(opts, ImGuiColorEditFlags.Uint8) ~= 0) then - opts = bit32.bor(bit32.band(opts, bit32.bnot(ImGuiColorEditFlags.DataTypeMask_)), ImGuiColorEditFlags.Uint8) + if ImGui.RadioButtonEx("0..255", bit32.band(opts, 8388608 --[[ImGuiColorEditFlags.Uint8]]) ~= 0) then + opts = bit32.bor(bit32.band(opts, bit32.bnot(25165824 --[[ImGuiColorEditFlags.DataTypeMask_]])), 8388608 --[[ImGuiColorEditFlags.Uint8]]) end - if ImGui.RadioButtonEx("0.00..1.00", bit32.band(opts, ImGuiColorEditFlags.Float) ~= 0) then - opts = bit32.bor(bit32.band(opts, bit32.bnot(ImGuiColorEditFlags.DataTypeMask_)), ImGuiColorEditFlags.Float) + if ImGui.RadioButtonEx("0.00..1.00", bit32.band(opts, 16777216 --[[ImGuiColorEditFlags.Float]]) ~= 0) then + opts = bit32.bor(bit32.band(opts, bit32.bnot(25165824 --[[ImGuiColorEditFlags.DataTypeMask_]])), 16777216 --[[ImGuiColorEditFlags.Float]]) end end @@ -62265,9 +62308,9 @@ function ImGui.ColorEditOptionsPopup(col, flags) local cr = IM_F32_TO_INT8_SAT(col[1]) local cg = IM_F32_TO_INT8_SAT(col[2]) local cb = IM_F32_TO_INT8_SAT(col[3]) - local ca = (bit32.band(flags, ImGuiColorEditFlags.NoAlpha) ~= 0) and 255 or IM_F32_TO_INT8_SAT(col[4]) + local ca = (bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) ~= 0) and 255 or IM_F32_TO_INT8_SAT(col[4]) - local buf1 = ImFormatString("(%.3ff, %.3ff, %.3ff, %.3ff)", col[1], col[2], col[3], (bit32.band(flags, ImGuiColorEditFlags.NoAlpha) ~= 0) and 1.0 or col[4]) + local buf1 = ImFormatString("(%.3ff, %.3ff, %.3ff, %.3ff)", col[1], col[2], col[3], (bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) ~= 0) and 1.0 or col[4]) if ImGui.Selectable(buf1) then ImGui.SetClipboardText(buf1) end @@ -62282,7 +62325,7 @@ function ImGui.ColorEditOptionsPopup(col, flags) ImGui.SetClipboardText(buf3) end - if bit32.band(flags, ImGuiColorEditFlags.NoAlpha) == 0 then + if bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) == 0 then local buf4 = ImFormatString("#%02X%02X%02X%02X", cr, cg, cb, ca) if ImGui.Selectable(buf4) then ImGui.SetClipboardText(buf4) @@ -62300,15 +62343,15 @@ end --- @param ref_col float[] --- @param flags ImGuiColorEditFlags function ImGui.ColorPickerOptionsPopup(ref_col, flags) - local allow_opt_picker = bit32.band(flags, ImGuiColorEditFlags.PickerMask_) == 0 - local allow_opt_alpha_bar = (bit32.band(flags, ImGuiColorEditFlags.NoAlpha) == 0) and (bit32.band(flags, ImGuiColorEditFlags.AlphaBar) == 0) + local allow_opt_picker = bit32.band(flags, 100663296 --[[ImGuiColorEditFlags.PickerMask_]]) == 0 + local allow_opt_alpha_bar = (bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) == 0) and (bit32.band(flags, 262144 --[[ImGuiColorEditFlags.AlphaBar]]) == 0) if (not allow_opt_picker and not allow_opt_alpha_bar) or not ImGui.BeginPopup("context") then return end local g = GImGui - ImGui.PushItemFlag(ImGuiItemFlags.NoMarkEdited, true) + ImGui.PushItemFlag(65536 --[[ImGuiItemFlags.NoMarkEdited]], true) if allow_opt_picker then local picker_size = ImVec2(g.FontSize * 8, ImMax(g.FontSize * 8 - (ImGui.GetFrameHeight() + g.Style.ItemInnerSpacing.x), 1.0)) -- FIXME: Picker size copied from main picker function ImGui.PushItemWidth(picker_size.x) @@ -62318,20 +62361,20 @@ function ImGui.ColorPickerOptionsPopup(ref_col, flags) ImGui.Separator() end ImGui.PushID(picker_type) - local picker_flags = bit32.bor(ImGuiColorEditFlags.NoInputs, ImGuiColorEditFlags.NoOptions, ImGuiColorEditFlags.NoLabel, ImGuiColorEditFlags.NoSidePreview, bit32.band(flags, ImGuiColorEditFlags.NoAlpha)) + local picker_flags = bit32.bor(32 --[[ImGuiColorEditFlags.NoInputs]], 8 --[[ImGuiColorEditFlags.NoOptions]], 128 --[[ImGuiColorEditFlags.NoLabel]], 256 --[[ImGuiColorEditFlags.NoSidePreview]], bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]])) if picker_type == 0 then - picker_flags = bit32.bor(picker_flags, ImGuiColorEditFlags.PickerHueBar) + picker_flags = bit32.bor(picker_flags, 33554432 --[[ImGuiColorEditFlags.PickerHueBar]]) end if picker_type == 1 then - picker_flags = bit32.bor(picker_flags, ImGuiColorEditFlags.PickerHueWheel) + picker_flags = bit32.bor(picker_flags, 67108864 --[[ImGuiColorEditFlags.PickerHueWheel]]) end local backup_pos = ImGui.GetCursorScreenPos() if ImGui.Selectable("##selectable", false, 0, picker_size) then -- By default, Selectable() is closing popup - g.IO.ConfigColorEditFlags = bit32.bor(bit32.band(g.IO.ConfigColorEditFlags, bit32.bnot(ImGuiColorEditFlags.PickerMask_)), bit32.band(picker_flags, ImGuiColorEditFlags.PickerMask_)) + g.IO.ConfigColorEditFlags = bit32.bor(bit32.band(g.IO.ConfigColorEditFlags, bit32.bnot(100663296 --[[ImGuiColorEditFlags.PickerMask_]])), bit32.band(picker_flags, 100663296 --[[ImGuiColorEditFlags.PickerMask_]])) end ImGui.SetCursorScreenPos(backup_pos) local previewing_ref_col = ImVec4() - for i = 1, (bit32.band(picker_flags, ImGuiColorEditFlags.NoAlpha) ~= 0 and 3 or 4) do + for i = 1, (bit32.band(picker_flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) ~= 0 and 3 or 4) do previewing_ref_col[i] = ref_col[i] end ImGui.ColorPicker4("##previewing_picker", previewing_ref_col, picker_flags) @@ -62343,7 +62386,7 @@ function ImGui.ColorPickerOptionsPopup(ref_col, flags) if allow_opt_picker then ImGui.Separator() end - _, g.IO.ConfigColorEditFlags = ImGui.CheckboxFlags("Alpha Bar", g.IO.ConfigColorEditFlags, ImGuiColorEditFlags.AlphaBar) + _, g.IO.ConfigColorEditFlags = ImGui.CheckboxFlags("Alpha Bar", g.IO.ConfigColorEditFlags, 262144 --[[ImGuiColorEditFlags.AlphaBar]]) end ImGui.PopItemFlag() ImGui.EndPopup() @@ -62377,7 +62420,7 @@ ImGui.BulletTextV = function(...) return ImGui.BulletText(...) end --- @param v number function ImGui.SetNextItemRefVal(data_type, v) local g = GImGui - g.NextItemData.HasFlags = bit32.bor(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasRefVal) + g.NextItemData.HasFlags = bit32.bor(g.NextItemData.HasFlags, 8 --[[ImGuiNextItemDataFlags.HasRefVal]]) g.NextItemData.RefVal = v end @@ -62393,7 +62436,7 @@ function ImGui.TreeNode(label, fmt, ...) return false end local id = window:GetID(label) - return ImGui.TreeNodeBehavior(id, ImGuiTreeNodeFlags.None, label, nil) + return ImGui.TreeNodeBehavior(id, 0 --[[ImGuiTreeNodeFlags.None]], label, nil) end function ImGui.TreeNodeV(str_id, fmt, ...) @@ -62448,7 +62491,7 @@ end --- @param flags ImGuiTreeNodeFlags function ImGui.TreeNodeUpdateNextOpen(storage_id, flags) -- Leaf node always open a new tree/id scope. If you never use it, add ImGuiTreeNodeFlags.NoTreePushOnOpen. - if bit32.band(flags, ImGuiTreeNodeFlags.Leaf) ~= 0 then + if bit32.band(flags, 256 --[[ImGuiTreeNodeFlags.Leaf]]) ~= 0 then return true end @@ -62458,8 +62501,8 @@ function ImGui.TreeNodeUpdateNextOpen(storage_id, flags) local storage = window.DC.StateStorage local is_open - if bit32.band(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasOpen) ~= 0 then - if bit32.band(g.NextItemData.OpenCond, ImGuiCond.Always) ~= 0 then + if bit32.band(g.NextItemData.HasFlags, 2 --[[ImGuiNextItemDataFlags.HasOpen]]) ~= 0 then + if bit32.band(g.NextItemData.OpenCond, 1 --[[ImGuiCond.Always]]) ~= 0 then is_open = g.NextItemData.OpenVal ImGui.TreeNodeSetOpen(storage_id, is_open) else @@ -62473,12 +62516,12 @@ function ImGui.TreeNodeUpdateNextOpen(storage_id, flags) end end else - is_open = (storage[storage_id] == nil) and (bit32.band(flags, ImGuiTreeNodeFlags.DefaultOpen) ~= 0) or storage[storage_id] + is_open = (storage[storage_id] == nil) and (bit32.band(flags, 32 --[[ImGuiTreeNodeFlags.DefaultOpen]]) ~= 0) or storage[storage_id] end -- When logging is enabled, we automatically expand tree nodes (but *NOT* collapsing headers.. seems like sensible behavior). -- NB- If we are above max depth we still allow manually opened nodes to be logged. - if g.LogEnabled and bit32.band(flags, ImGuiTreeNodeFlags.NoAutoOpenOnLog) == 0 and (window.DC.TreeDepth - g.LogDepthRef) < g.LogDepthToExpand then + if g.LogEnabled and bit32.band(flags, 16 --[[ImGuiTreeNodeFlags.NoAutoOpenOnLog]]) == 0 and (window.DC.TreeDepth - g.LogDepthRef) < g.LogDepthToExpand then is_open = true end @@ -62501,12 +62544,12 @@ local function TreeNodeStoreStackData(flags, x1) ImRect_Copy(tree_node_data.NavRect, g.LastItemData.NavRect) -- Initially I tried to latch value for GetColorU32(ImGuiCol.TreeLines) but it's not a good trade-off for very large trees. - local draw_lines = bit32.band(flags, bit32.bor(ImGuiTreeNodeFlags.DrawLinesFull, ImGuiTreeNodeFlags.DrawLinesToNodes)) ~= 0 - tree_node_data.DrawLinesX1 = draw_lines and (x1 + g.FontSize * 0.5 + g.Style.FramePadding.x) or FLT_MAX + local draw_lines = bit32.band(flags, bit32.bor(524288 --[[ImGuiTreeNodeFlags.DrawLinesFull]], 1048576 --[[ImGuiTreeNodeFlags.DrawLinesToNodes]])) ~= 0 + tree_node_data.DrawLinesX1 = draw_lines and (x1 + g.FontSize * 0.5 + g.Style.FramePadding.x) or 3.4028234663853e+38 --[[FLT_MAX]] tree_node_data.DrawLinesTableColumn = (draw_lines and g.CurrentTable) and g.CurrentTable.CurrentColumn or -1 - tree_node_data.DrawLinesToNodesY2 = -FLT_MAX + tree_node_data.DrawLinesToNodesY2 = -3.4028234663853e+38 --[[FLT_MAX]] window.DC.TreeHasStackDataDepthMask = bit32.bor(window.DC.TreeHasStackDataDepthMask, bit32.lshift(1, window.DC.TreeDepth)) - if bit32.band(flags, ImGuiTreeNodeFlags.DrawLinesToNodes) ~= 0 then + if bit32.band(flags, 1048576 --[[ImGuiTreeNodeFlags.DrawLinesToNodes]]) ~= 0 then window.DC.TreeRecordsClippedNodesY2Mask = bit32.bor(window.DC.TreeRecordsClippedNodesY2Mask, bit32.lshift(1, window.DC.TreeDepth)) end end @@ -62526,8 +62569,8 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) local style = g.Style -- When not framed, we vertically increase height up to typical framed widget height - local display_frame = bit32.band(flags, ImGuiTreeNodeFlags.Framed) ~= 0 - local use_frame_padding = display_frame or (bit32.band(flags, ImGuiTreeNodeFlags.FramePadding) ~= 0) + local display_frame = bit32.band(flags, 2 --[[ImGuiTreeNodeFlags.Framed]]) ~= 0 + local use_frame_padding = display_frame or (bit32.band(flags, 1024 --[[ImGuiTreeNodeFlags.FramePadding]]) ~= 0) -- [Luau] scalar padding, no temporary ImVec2 local padding_x, padding_y if use_frame_padding then @@ -62546,12 +62589,12 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) local text_width = g.FontSize + label_size.x + padding_x * 2 -- Include collapsing arrow local frame_height = label_size.y + padding_y * 2 - local span_all_columns = bit32.band(flags, ImGuiTreeNodeFlags.SpanAllColumns) ~= 0 and (g.CurrentTable ~= nil) - local span_all_columns_label = bit32.band(flags, ImGuiTreeNodeFlags.LabelSpanAllColumns) ~= 0 and (g.CurrentTable ~= nil) + local span_all_columns = bit32.band(flags, 16384 --[[ImGuiTreeNodeFlags.SpanAllColumns]]) ~= 0 and (g.CurrentTable ~= nil) + local span_all_columns_label = bit32.band(flags, 32768 --[[ImGuiTreeNodeFlags.LabelSpanAllColumns]]) ~= 0 and (g.CurrentTable ~= nil) local frame_bb = ImRect() - frame_bb.Min.x = span_all_columns and window.ParentWorkRect.Min.x or (bit32.band(flags, ImGuiTreeNodeFlags.SpanFullWidth) ~= 0 and window.WorkRect.Min.x or window.DC.CursorPos.x) + frame_bb.Min.x = span_all_columns and window.ParentWorkRect.Min.x or (bit32.band(flags, 4096 --[[ImGuiTreeNodeFlags.SpanFullWidth]]) ~= 0 and window.WorkRect.Min.x or window.DC.CursorPos.x) frame_bb.Min.y = window.DC.CursorPos.y + (text_offset_y - padding_y) - frame_bb.Max.x = span_all_columns and window.ParentWorkRect.Max.x or (bit32.band(flags, ImGuiTreeNodeFlags.SpanLabelWidth) ~= 0 and window.DC.CursorPos.x + text_width + padding_x or window.WorkRect.Max.x) + frame_bb.Max.x = span_all_columns and window.ParentWorkRect.Max.x or (bit32.band(flags, 8192 --[[ImGuiTreeNodeFlags.SpanLabelWidth]]) ~= 0 and window.DC.CursorPos.x + text_width + padding_x or window.WorkRect.Max.x) frame_bb.Max.y = window.DC.CursorPos.y + (text_offset_y - padding_y) + frame_height if display_frame then local outer_extend = IM_TRUNC(window.WindowPadding.x * 0.5) -- Framed header expand a little outside of current limits @@ -62566,12 +62609,12 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) -- For regular tree nodes, we arbitrary allow to click past 2 worth of ItemSpacing local interact_bb = ImRect() ImRect_Copy(interact_bb, frame_bb) - if bit32.band(flags, bit32.bor(ImGuiTreeNodeFlags.Framed, ImGuiTreeNodeFlags.SpanAvailWidth, ImGuiTreeNodeFlags.SpanFullWidth, ImGuiTreeNodeFlags.SpanLabelWidth, ImGuiTreeNodeFlags.SpanAllColumns)) == 0 then + if bit32.band(flags, bit32.bor(2 --[[ImGuiTreeNodeFlags.Framed]], 2048 --[[ImGuiTreeNodeFlags.SpanAvailWidth]], 4096 --[[ImGuiTreeNodeFlags.SpanFullWidth]], 8192 --[[ImGuiTreeNodeFlags.SpanLabelWidth]], 16384 --[[ImGuiTreeNodeFlags.SpanAllColumns]])) == 0 then interact_bb.Max.x = frame_bb.Min.x + text_width + (label_size.x > 0.0 and (style.ItemSpacing.x * 2.0) or 0.0) end -- Compute open and multi-select states before ItemAdd() as it clear NextItem data. - local storage_id = (bit32.band(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasStorageID) ~= 0) and g.NextItemData.StorageId or id + local storage_id = (bit32.band(g.NextItemData.HasFlags, 16 --[[ImGuiNextItemDataFlags.HasStorageID]]) ~= 0) and g.NextItemData.StorageId or id local is_open = ImGui.TreeNodeUpdateNextOpen(storage_id, flags) local is_visible @@ -62587,7 +62630,7 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) else is_visible = ImGui.ItemAdd(interact_bb, id) end - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HasDisplayRect) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 2 --[[ImGuiItemStatusFlags.HasDisplayRect]]) ImRect_Copy(g.LastItemData.DisplayRect, frame_bb) -- If a NavLeft request is happening and ImGuiTreeNodeFlags.NavLeftJumpsToParent enabled: @@ -62595,22 +62638,22 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) -- For this purpose we essentially compare if g.NavIdIsAlive went from 0 to 1 between TreeNode() and TreePop(). -- It will become tempting to enable ImGuiTreeNodeFlags.NavLeftJumpsToParent by default or move it to ImGuiStyle. local store_tree_node_stack_data = false - if bit32.band(flags, ImGuiTreeNodeFlags.DrawLinesMask_) == 0 then + if bit32.band(flags, 1835008 --[[ImGuiTreeNodeFlags.DrawLinesMask_]]) == 0 then flags = bit32.bor(flags, g.Style.TreeLinesFlags) end - local draw_tree_lines = (bit32.band(flags, bit32.bor(ImGuiTreeNodeFlags.DrawLinesFull, ImGuiTreeNodeFlags.DrawLinesToNodes)) ~= 0) and (frame_bb.Min.y < window.ClipRect.Max.y) and (g.Style.TreeLinesSize > 0.0) - if bit32.band(flags, ImGuiTreeNodeFlags.NoTreePushOnOpen) == 0 then + local draw_tree_lines = (bit32.band(flags, bit32.bor(524288 --[[ImGuiTreeNodeFlags.DrawLinesFull]], 1048576 --[[ImGuiTreeNodeFlags.DrawLinesToNodes]])) ~= 0) and (frame_bb.Min.y < window.ClipRect.Max.y) and (g.Style.TreeLinesSize > 0.0) + if bit32.band(flags, 8 --[[ImGuiTreeNodeFlags.NoTreePushOnOpen]]) == 0 then store_tree_node_stack_data = draw_tree_lines - if bit32.band(flags, ImGuiTreeNodeFlags.NavLeftJumpsToParent) ~= 0 and not g.NavIdIsAlive then - if g.NavMoveDir == ImGuiDir.Left and g.NavWindow == window and ImGui.NavMoveRequestButNoResultYet() then + if bit32.band(flags, 131072 --[[ImGuiTreeNodeFlags.NavLeftJumpsToParent]]) ~= 0 and not g.NavIdIsAlive then + if g.NavMoveDir == 0 --[[ImGuiDir.Left]] and g.NavWindow == window and ImGui.NavMoveRequestButNoResultYet() then store_tree_node_stack_data = true end end end - local is_leaf = bit32.band(flags, ImGuiTreeNodeFlags.Leaf) ~= 0 + local is_leaf = bit32.band(flags, 256 --[[ImGuiTreeNodeFlags.Leaf]]) ~= 0 if not is_visible then - if bit32.band(flags, ImGuiTreeNodeFlags.DrawLinesToNodes) ~= 0 and bit32.band(window.DC.TreeRecordsClippedNodesY2Mask, bit32.lshift(1, (window.DC.TreeDepth - 1))) ~= 0 then + if bit32.band(flags, 1048576 --[[ImGuiTreeNodeFlags.DrawLinesToNodes]]) ~= 0 and bit32.band(window.DC.TreeRecordsClippedNodesY2Mask, bit32.lshift(1, (window.DC.TreeDepth - 1))) ~= 0 then local parent_data = g.TreeNodeStack.Data[g.TreeNodeStack.Size] parent_data.DrawLinesToNodesY2 = ImMax(parent_data.DrawLinesToNodesY2, window.DC.CursorPos.y) -- Don't need to aim to mid Y position as we are clipped anyway. if frame_bb.Min.y >= window.ClipRect.Max.y then @@ -62620,7 +62663,7 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) if is_open and store_tree_node_stack_data then TreeNodeStoreStackData(flags, text_pos.x - text_offset_x) -- Call before TreePushOverrideID() end - if is_open and bit32.band(flags, ImGuiTreeNodeFlags.NoTreePushOnOpen) == 0 then + if is_open and bit32.band(flags, 8 --[[ImGuiTreeNodeFlags.NoTreePushOnOpen]]) == 0 then ImGui.TreePushOverrideID(id) end -- IMGUI_TEST_ENGINE_ITEM_INFO(g.LastItemData.ID, label, g.LastItemData.StatusFlags | (is_leaf ? 0 : ImGuiItemStatusFlags_Openable) | (is_open ? ImGuiItemStatusFlags_Opened : 0)) @@ -62629,16 +62672,16 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) if span_all_columns or span_all_columns_label then ImGui.TablePushBackgroundChannel() - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HasClipRect) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 512 --[[ImGuiItemStatusFlags.HasClipRect]]) ImRect_Copy(g.LastItemData.ClipRect, window.ClipRect) end - local button_flags = ImGuiTreeNodeFlags.None - if bit32.band(flags, ImGuiTreeNodeFlags.AllowOverlap) ~= 0 or bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.AllowOverlap) ~= 0 then - button_flags = bit32.bor(button_flags, ImGuiButtonFlags.AllowOverlap) + local button_flags = 0 --[[ImGuiTreeNodeFlags.None]] + if bit32.band(flags, 4 --[[ImGuiTreeNodeFlags.AllowOverlap]]) ~= 0 or bit32.band(g.LastItemData.ItemFlags, 16384 --[[ImGuiItemFlags.AllowOverlap]]) ~= 0 then + button_flags = bit32.bor(button_flags, 4096 --[[ImGuiButtonFlags.AllowOverlap]]) end if not is_leaf then - button_flags = bit32.bor(button_flags, ImGuiButtonFlags.PressedOnDragDropHold) + button_flags = bit32.bor(button_flags, 512 --[[ImGuiButtonFlags.PressedOnDragDropHold]]) end -- We allow clicking on the arrow section with keyboard modifiers held, in order to easily @@ -62648,9 +62691,9 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) local arrow_hit_x2 = (text_pos.x - text_offset_x) + (g.FontSize + padding_x * 2.0) + style.TouchExtraPadding.x local is_mouse_x_over_arrow = (g.IO.MousePos.x >= arrow_hit_x1 and g.IO.MousePos.x < arrow_hit_x2) - local is_multi_select = bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.IsMultiSelect) ~= 0 + local is_multi_select = bit32.band(g.LastItemData.ItemFlags, 4194304 --[[ImGuiItemFlags.IsMultiSelect]]) ~= 0 if is_multi_select then -- We absolutely need to distinguish open vs select so _OpenOnArrow comes by default - flags = bit32.bor(flags, (bit32.band(flags, ImGuiTreeNodeFlags.OpenOnMask_) == 0) and bit32.bor(ImGuiTreeNodeFlags.OpenOnArrow, ImGuiTreeNodeFlags.OpenOnDoubleClick) or ImGuiTreeNodeFlags.OpenOnArrow) + flags = bit32.bor(flags, (bit32.band(flags, 192 --[[ImGuiTreeNodeFlags.OpenOnMask_]]) == 0) and bit32.bor(128 --[[ImGuiTreeNodeFlags.OpenOnArrow]], 64 --[[ImGuiTreeNodeFlags.OpenOnDoubleClick]]) or 128 --[[ImGuiTreeNodeFlags.OpenOnArrow]]) end -- Open behaviors can be altered with the _OpenOnArrow and _OnOnDoubleClick flags. @@ -62663,17 +62706,17 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) -- It is rather standard that arrow click react on Down rather than Up. -- We set ImGuiButtonFlags.PressedOnClickRelease on OpenOnDoubleClick because we want the item to be active on the initial MouseDown in order for drag and drop to work. if is_mouse_x_over_arrow then - button_flags = bit32.bor(button_flags, ImGuiButtonFlags.PressedOnClick) - elseif bit32.band(flags, ImGuiTreeNodeFlags.OpenOnDoubleClick) ~= 0 then - button_flags = bit32.bor(button_flags, ImGuiButtonFlags.PressedOnClickRelease, ImGuiButtonFlags.PressedOnDoubleClick) + button_flags = bit32.bor(button_flags, 16 --[[ImGuiButtonFlags.PressedOnClick]]) + elseif bit32.band(flags, 64 --[[ImGuiTreeNodeFlags.OpenOnDoubleClick]]) ~= 0 then + button_flags = bit32.bor(button_flags, 32 --[[ImGuiButtonFlags.PressedOnClickRelease]], 256 --[[ImGuiButtonFlags.PressedOnDoubleClick]]) else - button_flags = bit32.bor(button_flags, ImGuiButtonFlags.PressedOnClickRelease) + button_flags = bit32.bor(button_flags, 32 --[[ImGuiButtonFlags.PressedOnClickRelease]]) end - if bit32.band(flags, ImGuiTreeNodeFlags.NoNavFocus) ~= 0 then - button_flags = bit32.bor(button_flags, ImGuiButtonFlags.NoNavFocus) + if bit32.band(flags, 134217728 --[[ImGuiTreeNodeFlags.NoNavFocus]]) ~= 0 then + button_flags = bit32.bor(button_flags, 262144 --[[ImGuiButtonFlags.NoNavFocus]]) end - local selected = bit32.band(flags, ImGuiTreeNodeFlags.Selected) ~= 0 + local selected = bit32.band(flags, 1 --[[ImGuiTreeNodeFlags.Selected]]) ~= 0 local was_selected = selected -- Multi-selection support (header) @@ -62681,11 +62724,11 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) -- Handle multi-select + alter button flags for it selected, button_flags = ImGui.MultiSelectItemHeader(id, selected, button_flags) if is_mouse_x_over_arrow then - button_flags = bit32.band(bit32.bor(button_flags, ImGuiButtonFlags.PressedOnClick), bit32.bnot(ImGuiButtonFlags.PressedOnClickRelease)) + button_flags = bit32.band(bit32.bor(button_flags, 16 --[[ImGuiButtonFlags.PressedOnClick]]), bit32.bnot(32 --[[ImGuiButtonFlags.PressedOnClickRelease]])) end else if window ~= g.HoveredWindow or not is_mouse_x_over_arrow then - button_flags = bit32.bor(button_flags, ImGuiButtonFlags.NoKeyModsAllowed) + button_flags = bit32.bor(button_flags, 65536 --[[ImGuiButtonFlags.NoKeyModsAllowed]]) end end @@ -62693,17 +62736,17 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) local toggled = false if not is_leaf then if pressed and g.DragDropHoldJustPressedId ~= id then - if bit32.band(flags, ImGuiTreeNodeFlags.OpenOnMask_) == 0 or (g.NavActivateId == id and not is_multi_select) then + if bit32.band(flags, 192 --[[ImGuiTreeNodeFlags.OpenOnMask_]]) == 0 or (g.NavActivateId == id and not is_multi_select) then toggled = true -- Single click end - if bit32.band(flags, ImGuiTreeNodeFlags.OpenOnArrow) ~= 0 then + if bit32.band(flags, 128 --[[ImGuiTreeNodeFlags.OpenOnArrow]]) ~= 0 then toggled = toggled or (is_mouse_x_over_arrow and not g.NavHighlightItemUnderNav) -- Lightweight equivalent of IsMouseHoveringRect() since ButtonBehavior() already did the job end - if bit32.band(flags, ImGuiTreeNodeFlags.OpenOnDoubleClick) ~= 0 and g.IO.MouseClickedCount[0] == 2 then + if bit32.band(flags, 64 --[[ImGuiTreeNodeFlags.OpenOnDoubleClick]]) ~= 0 and g.IO.MouseClickedCount[0] == 2 then toggled = true -- Double click end elseif pressed and g.DragDropHoldJustPressedId == id then - IM_ASSERT(bit32.band(button_flags, ImGuiButtonFlags.PressedOnDragDropHold) ~= 0) + assert(bit32.band(button_flags, 512 --[[ImGuiButtonFlags.PressedOnDragDropHold]]) ~= 0) if not is_open then -- When using Drag and Drop "hold to open" we keep the node highlighted after opening, but never close it again. toggled = true else @@ -62711,21 +62754,21 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) end end - if g.NavId == id and g.NavMoveDir == ImGuiDir.Left and is_open then + if g.NavId == id and g.NavMoveDir == 0 --[[ImGuiDir.Left]] and is_open then toggled = true - ImGui.NavClearPreferredPosForAxis(ImGuiAxis.X) + ImGui.NavClearPreferredPosForAxis(1 --[[ImGuiAxis.X]]) ImGui.NavMoveRequestCancel() end - if g.NavId == id and g.NavMoveDir == ImGuiDir.Right and not is_open then -- If there's something upcoming on the line we may want to give it the priority? + if g.NavId == id and g.NavMoveDir == 1 --[[ImGuiDir.Right]] and not is_open then -- If there's something upcoming on the line we may want to give it the priority? toggled = true - ImGui.NavClearPreferredPosForAxis(ImGuiAxis.X) + ImGui.NavClearPreferredPosForAxis(1 --[[ImGuiAxis.X]]) ImGui.NavMoveRequestCancel() end if toggled then is_open = not is_open window.DC.StateStorage[storage_id] = is_open - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.ToggledOpen) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 16 --[[ImGuiItemStatusFlags.ToggledOpen]]) end end @@ -62739,32 +62782,32 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) end if selected ~= was_selected then - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.ToggledSelection) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 8 --[[ImGuiItemStatusFlags.ToggledSelection]]) end -- Render do - local text_col = ImGui.GetColorU32(ImGuiCol.Text) - local nav_render_cursor_flags = ImGuiNavRenderCursorFlags.Compact + local text_col = ImGui.GetColorU32(0 --[[ImGuiCol.Text]]) + local nav_render_cursor_flags = 2 --[[ImGuiNavRenderCursorFlags.Compact]] if is_multi_select then - nav_render_cursor_flags = bit32.bor(nav_render_cursor_flags, ImGuiNavRenderCursorFlags.AlwaysDraw) -- Always show the nav rectangle + nav_render_cursor_flags = bit32.bor(nav_render_cursor_flags, 4 --[[ImGuiNavRenderCursorFlags.AlwaysDraw]]) -- Always show the nav rectangle end if display_frame then -- Framed type - local bg_col = ImGui.GetColorU32((held and hovered) and ImGuiCol.HeaderActive or (hovered and ImGuiCol.HeaderHovered or ImGuiCol.Header)) + local bg_col = ImGui.GetColorU32((held and hovered) and 27 --[[ImGuiCol.HeaderActive]] or (hovered and 26 --[[ImGuiCol.HeaderHovered]] or 25 --[[ImGuiCol.Header]])) ImGui.RenderFrame(frame_bb.Min, frame_bb.Max, bg_col, true, style.FrameRounding) ImGui.RenderNavCursor(frame_bb, id, nav_render_cursor_flags) if span_all_columns and not span_all_columns_label then ImGui.TablePopBackgroundChannel() end - if bit32.band(flags, ImGuiTreeNodeFlags.Bullet) ~= 0 then + if bit32.band(flags, 512 --[[ImGuiTreeNodeFlags.Bullet]]) ~= 0 then ImGui.RenderBullet(window.DrawList, ImVec2(text_pos.x - text_offset_x * 0.60, text_pos.y + g.FontSize * 0.5), text_col) elseif not is_leaf then - ImGui.RenderArrow(window.DrawList, ImVec2(text_pos.x - text_offset_x + padding_x, text_pos.y), text_col, is_open and ((bit32.band(flags, ImGuiTreeNodeFlags.UpsideDownArrow) ~= 0) and ImGuiDir.Up or ImGuiDir.Down) or ImGuiDir.Right, 1.0) + ImGui.RenderArrow(window.DrawList, ImVec2(text_pos.x - text_offset_x + padding_x, text_pos.y), text_col, is_open and ((bit32.band(flags, 536870912 --[[ImGuiTreeNodeFlags.UpsideDownArrow]]) ~= 0) and 2 --[[ImGuiDir.Up]] or 3 --[[ImGuiDir.Down]]) or 1 --[[ImGuiDir.Right]], 1.0) else -- Leaf without bullet, left-adjusted text text_pos.x = text_pos.x - (text_offset_x - padding_x) end - if bit32.band(flags, ImGuiTreeNodeFlags.ClipLabelForTrailingButton) ~= 0 then + if bit32.band(flags, 268435456 --[[ImGuiTreeNodeFlags.ClipLabelForTrailingButton]]) ~= 0 then frame_bb.Max.x = frame_bb.Max.x - (g.FontSize + style.FramePadding.x) end -- if g.LogEnabled then @@ -62773,17 +62816,17 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) else -- Unframed typed for tree nodes if hovered or selected then - local bg_col = ImGui.GetColorU32((held and hovered) and ImGuiCol.HeaderActive or (hovered and ImGuiCol.HeaderHovered or ImGuiCol.Header)) + local bg_col = ImGui.GetColorU32((held and hovered) and 27 --[[ImGuiCol.HeaderActive]] or (hovered and 26 --[[ImGuiCol.HeaderHovered]] or 25 --[[ImGuiCol.Header]])) ImGui.RenderFrame(frame_bb.Min, frame_bb.Max, bg_col, false, 0.0) end ImGui.RenderNavCursor(frame_bb, id, nav_render_cursor_flags, 0.0) if span_all_columns and not span_all_columns_label then ImGui.TablePopBackgroundChannel() end - if bit32.band(flags, ImGuiTreeNodeFlags.Bullet) ~= 0 then + if bit32.band(flags, 512 --[[ImGuiTreeNodeFlags.Bullet]]) ~= 0 then ImGui.RenderBullet(window.DrawList, ImVec2(text_pos.x - text_offset_x * 0.5, text_pos.y + g.FontSize * 0.5), text_col) elseif not is_leaf then - ImGui.RenderArrow(window.DrawList, ImVec2(text_pos.x - text_offset_x + padding_x, text_pos.y + g.FontSize * 0.15), text_col, is_open and ((bit32.band(flags, ImGuiTreeNodeFlags.UpsideDownArrow) ~= 0) and ImGuiDir.Up or ImGuiDir.Down) or ImGuiDir.Right, 0.70) + ImGui.RenderArrow(window.DrawList, ImVec2(text_pos.x - text_offset_x + padding_x, text_pos.y + g.FontSize * 0.15), text_col, is_open and ((bit32.band(flags, 536870912 --[[ImGuiTreeNodeFlags.UpsideDownArrow]]) ~= 0) and 2 --[[ImGuiDir.Up]] or 3 --[[ImGuiDir.Down]]) or 1 --[[ImGuiDir.Right]], 0.70) end -- if g.LogEnabled then -- ImGui.LogSetNextTextDecoration(">", nil) @@ -62809,7 +62852,7 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) if is_open and store_tree_node_stack_data then TreeNodeStoreStackData(flags, text_pos.x - text_offset_x) -- Call before TreePushOverrideID() end - if is_open and bit32.band(flags, ImGuiTreeNodeFlags.NoTreePushOnOpen) == 0 then + if is_open and bit32.band(flags, 8 --[[ImGuiTreeNodeFlags.NoTreePushOnOpen]]) == 0 then ImGui.TreePushOverrideID(id) -- Could use TreePush(label) but this avoid computing twice end @@ -62843,9 +62886,9 @@ function ImGui.TreeNodeDrawLineToChildNode(target_pos) if x1 < x2 then window.DrawList:PathLineTo(ImVec2(x2, y)) end - window.DrawList:PathStroke(ImGui.GetColorU32(ImGuiCol.TreeLines), g.Style.TreeLinesSize) + window.DrawList:PathStroke(ImGui.GetColorU32(55 --[[ImGuiCol.TreeLines]]), g.Style.TreeLinesSize) else - window.DrawList:AddLineH(x1, x2, y, ImGui.GetColorU32(ImGuiCol.TreeLines), g.Style.TreeLinesSize) + window.DrawList:AddLineH(x1, x2, y, ImGui.GetColorU32(55 --[[ImGuiCol.TreeLines]]), g.Style.TreeLinesSize) end end @@ -62856,7 +62899,7 @@ function ImGui.TreeNodeDrawLineToTreePop(data) local window = g.CurrentWindow local y1 = ImMax(data.NavRect.Max.y, window.ClipRect.Min.y) local y2 = data.DrawLinesToNodesY2 - if bit32.band(data.TreeFlags, ImGuiTreeNodeFlags.DrawLinesFull) ~= 0 then + if bit32.band(data.TreeFlags, 524288 --[[ImGuiTreeNodeFlags.DrawLinesFull]]) ~= 0 then local y2_full = window.DC.CursorPos.y if g.CurrentTable then y2_full = ImMax(g.CurrentTable.RowPosY2, y2_full) @@ -62876,7 +62919,7 @@ function ImGui.TreeNodeDrawLineToTreePop(data) end -- We use AddLine() instead of AddLineV() as we provide coordinates for line center (FIXME-OPT) - window.DrawList:AddLine(ImVec2(x, y1), ImVec2(x, y2), ImGui.GetColorU32(ImGuiCol.TreeLines), g.Style.TreeLinesSize) + window.DrawList:AddLine(ImVec2(x, y1), ImVec2(x, y2), ImGui.GetColorU32(55 --[[ImGuiCol.TreeLines]]), g.Style.TreeLinesSize) if data.DrawLinesTableColumn ~= -1 then ImGui.TablePopColumnChannel() end @@ -62909,17 +62952,17 @@ function ImGui.TreePop() if bit32.band(window.DC.TreeHasStackDataDepthMask, tree_depth_mask) ~= 0 then local data = g.TreeNodeStack.Data[g.TreeNodeStack.Size] - IM_ASSERT(data.ID == window.IDStack:back()) + assert(data.ID == window.IDStack:back()) -- Handle Left arrow to move to parent tree node (when ImGuiTreeNodeFlags.NavLeftJumpsToParent is enabled) - if bit32.band(data.TreeFlags, ImGuiTreeNodeFlags.NavLeftJumpsToParent) ~= 0 then - if g.NavIdIsAlive and g.NavMoveDir == ImGuiDir.Left and g.NavWindow == window and ImGui.NavMoveRequestButNoResultYet() then + if bit32.band(data.TreeFlags, 131072 --[[ImGuiTreeNodeFlags.NavLeftJumpsToParent]]) ~= 0 then + if g.NavIdIsAlive and g.NavMoveDir == 0 --[[ImGuiDir.Left]] and g.NavWindow == window and ImGui.NavMoveRequestButNoResultYet() then ImGui.NavMoveRequestResolveWithPastTreeNode(g.NavMoveResultLocal, data) end end -- Draw hierarchy lines - if data.DrawLinesX1 ~= FLT_MAX and window.DC.CursorPos.y >= window.ClipRect.Min.y then + if data.DrawLinesX1 ~= 3.4028234663853e+38 --[[FLT_MAX]] and window.DC.CursorPos.y >= window.ClipRect.Min.y then ImGui.TreeNodeDrawLineToTreePop(data) end @@ -62928,7 +62971,7 @@ function ImGui.TreePop() window.DC.TreeRecordsClippedNodesY2Mask = bit32.band(window.DC.TreeRecordsClippedNodesY2Mask, bit32.bnot(tree_depth_mask)) end - IM_ASSERT(window.IDStack.Size > 1) -- There should always be 1 element in the IDStack (pushed during window creation). If this triggers you called TreePop/PopID too much. + assert(window.IDStack.Size > 1) -- There should always be 1 element in the IDStack (pushed during window creation). If this triggers you called TreePop/PopID too much. ImGui.PopID() end @@ -62942,9 +62985,9 @@ function ImGui.SetNextItemOpen(is_open, cond) if g.CurrentWindow.SkipItems then return end - g.NextItemData.HasFlags = bit32.bor(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasOpen) + g.NextItemData.HasFlags = bit32.bor(g.NextItemData.HasFlags, 2 --[[ImGuiNextItemDataFlags.HasOpen]]) g.NextItemData.OpenVal = is_open - g.NextItemData.OpenCond = (cond ~= 0) and cond or ImGuiCond.Always + g.NextItemData.OpenCond = (cond ~= 0) and cond or 1 --[[ImGuiCond.Always]] end -- Horizontal distance preceding label when using TreeNode() or Bullet() @@ -62960,7 +63003,7 @@ function ImGui.SetNextItemStorageID(storage_id) if g.CurrentWindow.SkipItems then return end - g.NextItemData.HasFlags = bit32.bor(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasStorageID) + g.NextItemData.HasFlags = bit32.bor(g.NextItemData.HasFlags, 16 --[[ImGuiNextItemDataFlags.HasStorageID]]) g.NextItemData.StorageId = storage_id end @@ -62989,9 +63032,9 @@ function ImGui.CollapsingHeader(label, a, b) end local id = window:GetID(label) - flags = bit32.bor(flags, ImGuiTreeNodeFlags.CollapsingHeader) + flags = bit32.bor(flags, 26 --[[ImGuiTreeNodeFlags.CollapsingHeader]]) if p_visible ~= nil then - flags = bit32.bor(flags, ImGuiTreeNodeFlags.AllowOverlap, ImGuiTreeNodeFlags.ClipLabelForTrailingButton) + flags = bit32.bor(flags, 4 --[[ImGuiTreeNodeFlags.AllowOverlap]], 268435456 --[[ImGuiTreeNodeFlags.ClipLabelForTrailingButton]]) end local is_open = ImGui.TreeNodeBehavior(id, flags, label) if p_visible ~= nil then @@ -63058,17 +63101,17 @@ function ImGui.Selectable(label, selected, flags, size_arg) -- Fill horizontal space -- We don't support (size < 0.0) in Selectable() because the ItemSpacing extension would make explicitly right-aligned sizes not visibly match other widgets. - local span_all_columns = bit32.band(flags, ImGuiSelectableFlags.SpanAllColumns) ~= 0 + local span_all_columns = bit32.band(flags, 2 --[[ImGuiSelectableFlags.SpanAllColumns]]) ~= 0 local min_x = span_all_columns and window.ParentWorkRect.Min.x or pos.x local max_x = span_all_columns and window.ParentWorkRect.Max.x or window.WorkRect.Max.x - if size_arg.x == 0.0 or bit32.band(flags, ImGuiSelectableFlags.SpanAvailWidth) ~= 0 then + if size_arg.x == 0.0 or bit32.band(flags, 16777216 --[[ImGuiSelectableFlags.SpanAvailWidth]]) ~= 0 then size.x = ImMax(label_size.x, max_x - min_x) end -- Selectables are meant to be tightly packed together with no click-gap, so we extend their box to cover spacing between selectable. -- FIXME: Not part of layout so not included in clipper calculation, but ItemSize currently doesn't allow offsetting CursorPos. local bb = ImRect(min_x, pos.y, min_x + size.x, pos.y + size.y) - if bit32.band(flags, ImGuiSelectableFlags.NoPadWithHalfSpacing) == 0 then + if bit32.band(flags, 67108864 --[[ImGuiSelectableFlags.NoPadWithHalfSpacing]]) == 0 then local spacing_x = span_all_columns and 0.0 or style.ItemSpacing.x local spacing_y = style.ItemSpacing.y local spacing_L = IM_TRUNC(spacing_x * 0.50) @@ -63081,8 +63124,8 @@ function ImGui.Selectable(label, selected, flags, size_arg) end -- if g.IO.KeyCtrl then ImGui.GetForegroundDrawList():AddRect(bb.Min, bb.Max, IM_COL32(0, 255, 0, 255)) end - local disabled_item = bit32.band(flags, ImGuiSelectableFlags.Disabled) ~= 0 - local extra_item_flags = disabled_item and ImGuiItemFlags.Disabled or ImGuiItemFlags.None + local disabled_item = bit32.band(flags, 8 --[[ImGuiSelectableFlags.Disabled]]) ~= 0 + local extra_item_flags = disabled_item and 64 --[[ImGuiItemFlags.Disabled]] or 0 --[[ImGuiItemFlags.None]] local is_visible if span_all_columns then @@ -63101,7 +63144,7 @@ function ImGui.Selectable(label, selected, flags, size_arg) is_visible = ImGui.ItemAdd(bb, id, nil, extra_item_flags) end - local is_multi_select = bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.IsMultiSelect) ~= 0 + local is_multi_select = bit32.band(g.LastItemData.ItemFlags, 4194304 --[[ImGuiItemFlags.IsMultiSelect]]) ~= 0 if not is_visible then if not is_multi_select or not g.BoxSelectState.UnclipMode or not g.BoxSelectState.UnclipRect:Overlaps(bb) then -- Extra layer of "no logic clip" for box-select support (would be more overhead to add to ItemAdd) @@ -63109,7 +63152,7 @@ function ImGui.Selectable(label, selected, flags, size_arg) end end - local disabled_global = bit32.band(g.CurrentItemFlags, ImGuiItemFlags.Disabled) ~= 0 + local disabled_global = bit32.band(g.CurrentItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) ~= 0 if disabled_item and not disabled_global then -- Only testing this as an optimization ImGui.BeginDisabled() @@ -63124,18 +63167,18 @@ function ImGui.Selectable(label, selected, flags, size_arg) ImGui.PushColumnsBackground() end - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HasClipRect) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 512 --[[ImGuiItemStatusFlags.HasClipRect]]) ImRect_Copy(g.LastItemData.ClipRect, window.ClipRect) end -- We use NoHoldingActiveID on menus so user can click and _hold_ on a menu then drag to browse child entries local button_flags = 0 - if bit32.band(flags, ImGuiSelectableFlags.NoHoldingActiveID) ~= 0 then button_flags = bit32.bor(button_flags, ImGuiButtonFlags.NoHoldingActiveId) end - if bit32.band(flags, ImGuiSelectableFlags.NoSetKeyOwner) ~= 0 then button_flags = bit32.bor(button_flags, ImGuiButtonFlags.NoSetKeyOwner) end - if bit32.band(flags, ImGuiSelectableFlags.SelectOnClick) ~= 0 then button_flags = bit32.bor(button_flags, ImGuiButtonFlags.PressedOnClick) end - if bit32.band(flags, ImGuiSelectableFlags.SelectOnRelease) ~= 0 then button_flags = bit32.bor(button_flags, ImGuiButtonFlags.PressedOnRelease) end - if bit32.band(flags, ImGuiSelectableFlags.AllowDoubleClick) ~= 0 then button_flags = bit32.bor(button_flags, ImGuiButtonFlags.PressedOnClickRelease, ImGuiButtonFlags.PressedOnDoubleClick) end - if bit32.band(flags, ImGuiSelectableFlags.AllowOverlap) ~= 0 or bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.AllowOverlap) ~= 0 then button_flags = bit32.bor(button_flags, ImGuiButtonFlags.AllowOverlap) end + if bit32.band(flags, 1048576 --[[ImGuiSelectableFlags.NoHoldingActiveID]]) ~= 0 then button_flags = bit32.bor(button_flags, 131072 --[[ImGuiButtonFlags.NoHoldingActiveId]]) end + if bit32.band(flags, 134217728 --[[ImGuiSelectableFlags.NoSetKeyOwner]]) ~= 0 then button_flags = bit32.bor(button_flags, 1048576 --[[ImGuiButtonFlags.NoSetKeyOwner]]) end + if bit32.band(flags, 4194304 --[[ImGuiSelectableFlags.SelectOnClick]]) ~= 0 then button_flags = bit32.bor(button_flags, 16 --[[ImGuiButtonFlags.PressedOnClick]]) end + if bit32.band(flags, 8388608 --[[ImGuiSelectableFlags.SelectOnRelease]]) ~= 0 then button_flags = bit32.bor(button_flags, 128 --[[ImGuiButtonFlags.PressedOnRelease]]) end + if bit32.band(flags, 4 --[[ImGuiSelectableFlags.AllowDoubleClick]]) ~= 0 then button_flags = bit32.bor(button_flags, 32 --[[ImGuiButtonFlags.PressedOnClickRelease]], 256 --[[ImGuiButtonFlags.PressedOnDoubleClick]]) end + if bit32.band(flags, 16 --[[ImGuiSelectableFlags.AllowOverlap]]) ~= 0 or bit32.band(g.LastItemData.ItemFlags, 16384 --[[ImGuiItemFlags.AllowOverlap]]) ~= 0 then button_flags = bit32.bor(button_flags, 4096 --[[ImGuiButtonFlags.AllowOverlap]]) end -- Multi-selection support (header) local was_selected = selected @@ -63158,8 +63201,8 @@ function ImGui.Selectable(label, selected, flags, size_arg) -- - (1) it would require focus scope to be set, need exposing PushFocusScope() or equivalent (e.g. BeginSelection() calling PushFocusScope()) -- - (2) usage will fail with clipped items -- The multi-select API aim to fix those issues, e.g. may be replaced with a BeginSelection() API. - if bit32.band(flags, ImGuiSelectableFlags.SelectOnNav) ~= 0 and g.NavJustMovedToId ~= 0 and g.NavJustMovedToFocusScopeId == g.CurrentFocusScopeId then - if g.NavJustMovedToId == id and bit32.band(g.NavJustMovedToKeyMods, ImGuiMod_Ctrl) == 0 then + if bit32.band(flags, 64 --[[ImGuiSelectableFlags.SelectOnNav]]) ~= 0 and g.NavJustMovedToId ~= 0 and g.NavJustMovedToFocusScopeId == g.CurrentFocusScopeId then + if g.NavJustMovedToId == id and bit32.band(g.NavJustMovedToKeyMods, 4096 --[[ImGuiMod_Ctrl]]) == 0 then selected = true pressed = true auto_selected = true @@ -63168,7 +63211,7 @@ function ImGui.Selectable(label, selected, flags, size_arg) end -- Update NavId when clicking or when Hovering (this doesn't happen on most widgets), so navigation can be resumed with keyboard/gamepad - if pressed or (hovered and bit32.band(flags, ImGuiSelectableFlags.SetNavIdOnHover) ~= 0) then + if pressed or (hovered and bit32.band(flags, 33554432 --[[ImGuiSelectableFlags.SetNavIdOnHover]]) ~= 0) then if not g.NavHighlightItemUnderNav and g.NavWindow == window and g.NavLayer == window.DC.NavLayerCurrent then ImGui.SetNavID(id, window.DC.NavLayerCurrent, g.CurrentFocusScopeId, ImGui.WindowRectAbsToRel(window, bb)) -- (bb == NavRect) if g.IO.ConfigNavCursorVisibleAuto then @@ -63181,7 +63224,7 @@ function ImGui.Selectable(label, selected, flags, size_arg) end if selected ~= was_selected then - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.ToggledSelection) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 8 --[[ImGuiItemStatusFlags.ToggledSelection]]) end if g.ActiveId == id and g.ActiveIdIsJustActivated then g.ActiveIdWasSelected = was_selected @@ -63190,25 +63233,25 @@ function ImGui.Selectable(label, selected, flags, size_arg) -- Render if is_visible then - local highlighted = hovered or (bit32.band(flags, ImGuiSelectableFlags.Highlight) ~= 0) + local highlighted = hovered or (bit32.band(flags, 32 --[[ImGuiSelectableFlags.Highlight]]) ~= 0) if highlighted or selected then -- Between 1.91.0 and 1.91.4 we made selected Selectable use an arbitrary lerp between _Header and _HeaderHovered. Removed that now. (#8106) local col if held and highlighted then - col = ImGui.GetColorU32(ImGuiCol.HeaderActive) + col = ImGui.GetColorU32(27 --[[ImGuiCol.HeaderActive]]) elseif highlighted then - col = ImGui.GetColorU32(ImGuiCol.HeaderHovered) + col = ImGui.GetColorU32(26 --[[ImGuiCol.HeaderHovered]]) else - col = ImGui.GetColorU32(ImGuiCol.Header) + col = ImGui.GetColorU32(25 --[[ImGuiCol.Header]]) end ImGui.RenderFrame(bb.Min, bb.Max, col, false, style.SelectableRounding) end if g.NavId == id then - local nav_render_cursor_flags = ImGuiNavRenderCursorFlags.Compact + local nav_render_cursor_flags = 2 --[[ImGuiNavRenderCursorFlags.Compact]] if is_multi_select then - nav_render_cursor_flags = bit32.bor(nav_render_cursor_flags, ImGuiNavRenderCursorFlags.AlwaysDraw) -- Always show the nav rectangle + nav_render_cursor_flags = bit32.bor(nav_render_cursor_flags, 4 --[[ImGuiNavRenderCursorFlags.AlwaysDraw]]) -- Always show the nav rectangle end ImGui.RenderNavCursor(bb, id, nav_render_cursor_flags, style.SelectableRounding) end @@ -63228,7 +63271,7 @@ function ImGui.Selectable(label, selected, flags, size_arg) end -- Automatically close popups - if pressed and not auto_selected and bit32.band(window.Flags, ImGuiWindowFlags.Popup) ~= 0 and bit32.band(flags, ImGuiSelectableFlags.NoAutoClosePopups) == 0 and bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.AutoClosePopups) ~= 0 then + if pressed and not auto_selected and bit32.band(window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 and bit32.band(flags, 1 --[[ImGuiSelectableFlags.NoAutoClosePopups]]) == 0 and bit32.band(g.LastItemData.ItemFlags, 16 --[[ImGuiItemFlags.AutoClosePopups]]) ~= 0 then ImGui.CloseCurrentPopup() end @@ -63294,14 +63337,14 @@ function ImGui.BeginListBox(label, size_arg) ImGui.AlignTextToFramePadding() end - ImGui.BeginChild(id, frame_bb:GetSize(), ImGuiChildFlags.FrameStyle) + ImGui.BeginChild(id, frame_bb:GetSize(), 128 --[[ImGuiChildFlags.FrameStyle]]) return true end function ImGui.EndListBox() local g = GImGui local window = g.CurrentWindow - IM_ASSERT(bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0, "Mismatched BeginListBox/EndListBox calls. Did you test the return value of BeginListBox?") + assert(bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0, "Mismatched BeginListBox/EndListBox calls. Did you test the return value of BeginListBox?") ImGui.EndChild() ImGui.EndGroup() -- This is only required to be able to do IsItemXXX query on the whole ListBox including label @@ -63403,50 +63446,50 @@ function ImGui.PlotEx(plot_type, label, values_getter, data, values_count, value local inner_bb = ImRect(frame_bb.Min + style.FramePadding, frame_bb.Max - style.FramePadding) local total_bb = ImRect(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0 and style.ItemInnerSpacing.x + label_size.x or 0.0, 0)) ImGui.ItemSize(total_bb, style.FramePadding.y) - if not ImGui.ItemAdd(total_bb, id, frame_bb, ImGuiItemFlags.NoNav) then + if not ImGui.ItemAdd(total_bb, id, frame_bb, 2 --[[ImGuiItemFlags.NoNav]]) then return -1 end local _, hovered, _ = ImGui.ButtonBehavior(frame_bb, id) -- Determine scale from values if not specified - if scale_min == FLT_MAX or scale_max == FLT_MAX then - local v_min = FLT_MAX - local v_max = -FLT_MAX + if scale_min == 3.4028234663853e+38 --[[FLT_MAX]] or scale_max == 3.4028234663853e+38 --[[FLT_MAX]] then + local v_min = 3.4028234663853e+38 --[[FLT_MAX]] + local v_max = -3.4028234663853e+38 --[[FLT_MAX]] for i = 1, values_count do local v = values_getter(data, i) -- NaN isn't checked here v_min = ImMin(v_min, v) v_max = ImMax(v_max, v) end - if scale_min == FLT_MAX then + if scale_min == 3.4028234663853e+38 --[[FLT_MAX]] then scale_min = v_min end - if scale_max == FLT_MAX then + if scale_max == 3.4028234663853e+38 --[[FLT_MAX]] then scale_max = v_max end end - ImGui.RenderFrame(frame_bb.Min, frame_bb.Max, ImGui.GetColorU32(ImGuiCol.FrameBg), true, style.FrameRounding) + ImGui.RenderFrame(frame_bb.Min, frame_bb.Max, ImGui.GetColorU32(7 --[[ImGuiCol.FrameBg]]), true, style.FrameRounding) - local values_count_min = (plot_type == ImGuiPlotType.Lines) and 2 or 1 + local values_count_min = (plot_type == 0 --[[ImGuiPlotType.Lines]]) and 2 or 1 local idx_hovered = -1 if values_count >= values_count_min then - local res_w = ImMin(math.floor(frame_size.x), values_count) + ((plot_type == ImGuiPlotType.Lines) and -1 or 0) - local item_count = values_count + ((plot_type == ImGuiPlotType.Lines) and -1 or 0) + local res_w = ImMin(math.floor(frame_size.x), values_count) + ((plot_type == 0 --[[ImGuiPlotType.Lines]]) and -1 or 0) + local item_count = values_count + ((plot_type == 0 --[[ImGuiPlotType.Lines]]) and -1 or 0) -- Tooltip on hover if hovered and inner_bb:Contains(g.IO.MousePos) then local t = ImClamp((g.IO.MousePos.x - inner_bb.Min.x) / (inner_bb.Max.x - inner_bb.Min.x), 0.0, 0.999) local v_idx = math.floor(t * item_count) + 1 - IM_ASSERT(v_idx >= 1 and v_idx <= values_count) + assert(v_idx >= 1 and v_idx <= values_count) local v0 = values_getter(data, (v_idx - 1 + values_offset) % values_count + 1) local v1 = values_getter(data, (v_idx - 1 + 1 + values_offset) % values_count + 1) - if plot_type == ImGuiPlotType.Lines then + if plot_type == 0 --[[ImGuiPlotType.Lines]] then ImGui.SetTooltip("%d: %8.4g\n%d: %8.4g", v_idx, v0, v_idx + 1, v1) - elseif plot_type == ImGuiPlotType.Histogram then + elseif plot_type == 1 --[[ImGuiPlotType.Histogram]] then ImGui.SetTooltip("%d: %8.4g", v_idx, v0) end idx_hovered = v_idx @@ -63460,28 +63503,28 @@ function ImGui.PlotEx(plot_type, label, values_getter, data, values_count, value local tp0 = ImVec2(t0, 1.0 - ImSaturate((v0 - scale_min) * inv_scale)) -- Point in the normalized space of our target rectangle local histogram_zero_line_t = (scale_min * scale_max < 0.0) and (1 + scale_min * inv_scale) or (scale_min < 0.0 and 0.0 or 1.0) -- Where does the zero line stands - local col_base = ImGui.GetColorU32((plot_type == ImGuiPlotType.Lines) and ImGuiCol.PlotLines or ImGuiCol.PlotHistogram) - local col_hovered = ImGui.GetColorU32((plot_type == ImGuiPlotType.Lines) and ImGuiCol.PlotLinesHovered or ImGuiCol.PlotHistogramHovered) + local col_base = ImGui.GetColorU32((plot_type == 0 --[[ImGuiPlotType.Lines]]) and 44 --[[ImGuiCol.PlotLines]] or 46 --[[ImGuiCol.PlotHistogram]]) + local col_hovered = ImGui.GetColorU32((plot_type == 0 --[[ImGuiPlotType.Lines]]) and 45 --[[ImGuiCol.PlotLinesHovered]] or 47 --[[ImGuiCol.PlotHistogramHovered]]) for _ = 0, res_w - 1 do local t1 = t0 + t_step local v1_idx = math.floor(t0 * item_count + 0.5) + 1 - IM_ASSERT(v1_idx >= 1 and v1_idx <= values_count) + assert(v1_idx >= 1 and v1_idx <= values_count) local v1 = values_getter(data, (v1_idx - 1 + values_offset + 1) % values_count + 1) local tp1 = ImVec2(t1, 1.0 - ImSaturate((v1 - scale_min) * inv_scale)) -- NB: Draw calls are merged together by the DrawList system. Still, we should render our batch are lower level to save a bit of CPU. local pos0 = ImLerp(inner_bb.Min, inner_bb.Max, tp0) local pos1 - if plot_type == ImGuiPlotType.Lines then + if plot_type == 0 --[[ImGuiPlotType.Lines]] then pos1 = ImLerp(inner_bb.Min, inner_bb.Max, tp1) else pos1 = ImLerp(inner_bb.Min, inner_bb.Max, ImVec2(tp1.x, histogram_zero_line_t)) end - if plot_type == ImGuiPlotType.Lines then + if plot_type == 0 --[[ImGuiPlotType.Lines]] then window.DrawList:AddLine(pos0, pos1, idx_hovered == v1_idx and col_hovered or col_base) - elseif plot_type == ImGuiPlotType.Histogram then + elseif plot_type == 1 --[[ImGuiPlotType.Histogram]] then if pos1.x >= pos0.x + 2.0 then pos1.x = pos1.x - 1.0 end @@ -63542,16 +63585,16 @@ end --- @param stride? int # Defaults to 1 function ImGui.PlotLines(label, values_or_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size, stride) if values_offset == nil then values_offset = 0 end - if scale_min == nil then scale_min = FLT_MAX end - if scale_max == nil then scale_max = FLT_MAX end + if scale_min == nil then scale_min = 3.4028234663853e+38 --[[FLT_MAX]] end + if scale_max == nil then scale_max = 3.4028234663853e+38 --[[FLT_MAX]] end if graph_size == nil then graph_size = ImVec2(0, 0) end if stride == nil then stride = 1 end if type(values_or_getter) == "function" then - ImGui.PlotEx(ImGuiPlotType.Lines, label, values_or_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size) + ImGui.PlotEx(0 --[[ImGuiPlotType.Lines]], label, values_or_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size) else data = ImGuiPlotArrayGetterData(values_or_getter, stride) - ImGui.PlotEx(ImGuiPlotType.Lines, label, Plot_ArrayGetter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size) + ImGui.PlotEx(0 --[[ImGuiPlotType.Lines]], label, Plot_ArrayGetter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size) end end @@ -63568,16 +63611,16 @@ end --- @param stride? int # Defaults to 1 function ImGui.PlotHistogram(label, values_or_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size, stride) if values_offset == nil then values_offset = 0 end - if scale_min == nil then scale_min = FLT_MAX end - if scale_max == nil then scale_max = FLT_MAX end + if scale_min == nil then scale_min = 3.4028234663853e+38 --[[FLT_MAX]] end + if scale_max == nil then scale_max = 3.4028234663853e+38 --[[FLT_MAX]] end if graph_size == nil then graph_size = ImVec2(0, 0) end if stride == nil then stride = 1 end if type(values_or_getter) == "function" then - ImGui.PlotEx(ImGuiPlotType.Histogram, label, values_or_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size) + ImGui.PlotEx(1 --[[ImGuiPlotType.Histogram]], label, values_or_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size) else data = ImGuiPlotArrayGetterData(values_or_getter, stride) - ImGui.PlotEx(ImGuiPlotType.Histogram, label, Plot_ArrayGetter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size) + ImGui.PlotEx(1 --[[ImGuiPlotType.Histogram]], label, Plot_ArrayGetter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size) end end @@ -63651,11 +63694,11 @@ function ImGui.BeginMenuBar() if window.SkipItems then return false end - if bit32.band(window.Flags, ImGuiWindowFlags.MenuBar) == 0 then + if bit32.band(window.Flags, 1024 --[[ImGuiWindowFlags.MenuBar]]) == 0 then return false end - IM_ASSERT(not window.DC.MenuBarAppending) + assert(not window.DC.MenuBarAppending) ImGui.BeginGroup() -- Backup position on layer 0 // FIXME: Misleading to use a group for that backup/restore ImGui.PushID("##MenuBar") @@ -63671,9 +63714,9 @@ function ImGui.BeginMenuBar() -- We overwrite CursorMaxPos because BeginGroup sets it to CursorPos (essentially the .EmitItem hack in EndMenuBar() would need something analogous here, maybe a BeginGroupEx() with flags). ImVec2_Copy(window.DC.CursorPos, ImVec2(bar_rect.Min.x + window.DC.MenuBarOffset.x, bar_rect.Min.y + window.DC.MenuBarOffset.y)) ImVec2_Copy(window.DC.CursorMaxPos, window.DC.CursorPos) - window.DC.LayoutType = ImGuiLayoutType.Horizontal + window.DC.LayoutType = 0 --[[ImGuiLayoutType.Horizontal]] window.DC.IsSameLine = false - window.DC.NavLayerCurrent = ImGuiNavLayer.Menu + window.DC.NavLayerCurrent = 1 --[[ImGuiNavLayer.Menu]] window.DC.MenuBarAppending = true ImGui.AlignTextToFramePadding() @@ -63687,21 +63730,21 @@ function ImGui.EndMenuBar() end local g = GImGui - IM_ASSERT(bit32.band(window.Flags, ImGuiWindowFlags.MenuBar) ~= 0) - IM_ASSERT(window.DC.MenuBarAppending) + assert(bit32.band(window.Flags, 1024 --[[ImGuiWindowFlags.MenuBar]]) ~= 0) + assert(window.DC.MenuBarAppending) -- Nav: When a move request within one of our child menu failed, capture the request to navigate among our siblings. - if ImGui.NavMoveRequestButNoResultYet() and (g.NavMoveDir == ImGuiDir.Left or g.NavMoveDir == ImGuiDir.Right) and bit32.band(g.NavWindow.Flags, ImGuiWindowFlags.ChildMenu) ~= 0 then + if ImGui.NavMoveRequestButNoResultYet() and (g.NavMoveDir == 0 --[[ImGuiDir.Left]] or g.NavMoveDir == 1 --[[ImGuiDir.Right]]) and bit32.band(g.NavWindow.Flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0 then -- Try to find out if the request is for one of our child menu local nav_earliest_child = g.NavWindow - while nav_earliest_child.ParentWindow and bit32.band(nav_earliest_child.ParentWindow.Flags, ImGuiWindowFlags.ChildMenu) ~= 0 do + while nav_earliest_child.ParentWindow and bit32.band(nav_earliest_child.ParentWindow.Flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0 do nav_earliest_child = nav_earliest_child.ParentWindow end - if nav_earliest_child.ParentWindow == window and nav_earliest_child.DC.ParentLayoutType == ImGuiLayoutType.Horizontal and bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.Forwarded) == 0 then + if nav_earliest_child.ParentWindow == window and nav_earliest_child.DC.ParentLayoutType == 0 --[[ImGuiLayoutType.Horizontal]] and bit32.band(g.NavMoveFlags, 128 --[[ImGuiNavMoveFlags.Forwarded]]) == 0 then -- To do so we claim focus back, restore NavId and then process the movement request for yet another frame. -- This involve a one-frame delay which isn't very problematic in this situation. We could remove it by scoring in advance for multiple window (probably not worth bothering) - local layer = ImGuiNavLayer.Menu - IM_ASSERT(bit32.band(window.DC.NavLayersActiveMaskNext, bit32.lshift(1, layer)) ~= 0) -- Sanity check (FIXME: Seems unnecessary) + local layer = 1 --[[ImGuiNavLayer.Menu]] + assert(bit32.band(window.DC.NavLayersActiveMaskNext, bit32.lshift(1, layer)) ~= 0) -- Sanity check (FIXME: Seems unnecessary) ImGui.FocusWindow(window) ImGui.SetNavID(window.NavLastIds[layer], layer, 0, window.NavRectRel[layer]) -- FIXME-NAV: How to deal with this when not using g.IO.ConfigNavCursorVisibleAuto? @@ -63714,7 +63757,7 @@ function ImGui.EndMenuBar() ImGui.NavMoveRequestForward(g.NavMoveDir, g.NavMoveClipDir, g.NavMoveFlags, g.NavMoveScrollFlags) -- Repeat end else - ImGui.NavMoveRequestTryWrapping(window, ImGuiNavMoveFlags.WrapX) + ImGui.NavMoveRequestTryWrapping(window, 4 --[[ImGuiNavMoveFlags.WrapX]]) end ImGui.PopClipRect() @@ -63728,9 +63771,9 @@ function ImGui.EndMenuBar() ImVec2_Copy(restore_cursor_max_pos, group_data.BackupCursorMaxPos) window.DC.IdealMaxPos.x = ImMax(window.DC.IdealMaxPos.x, window.DC.CursorMaxPos.x - window.Scroll.x) -- Convert ideal extents for scrolling layer equivalent. ImGui.EndGroup() -- Restore position on layer 0 // FIXME: Misleading to use a group for that backup/restore - window.DC.LayoutType = ImGuiLayoutType.Vertical + window.DC.LayoutType = 1 --[[ImGuiLayoutType.Vertical]] window.DC.IsSameLine = false - window.DC.NavLayerCurrent = ImGuiNavLayer.Main + window.DC.NavLayerCurrent = 0 --[[ImGuiNavLayer.Main]] window.DC.MenuBarAppending = false ImVec2_Copy(window.DC.CursorMaxPos, restore_cursor_max_pos) end @@ -63744,16 +63787,16 @@ end --- @param axis_size float --- @param window_flags ImGuiWindowFlags function ImGui.BeginViewportSideBar(name, viewport_p, dir, axis_size, window_flags) - IM_ASSERT(dir ~= ImGuiDir.None) + assert(dir ~= (-1) --[[ImGuiDir.None]]) local bar_window = ImGui.FindWindowByName(name) local viewport = viewport_p or ImGui.GetMainViewport() if bar_window == nil or bar_window.BeginCount == 0 then -- Calculate and set window size/position local avail_rect = viewport:GetBuildWorkRect() - local axis = (dir == ImGuiDir.Up or dir == ImGuiDir.Down) and ImGuiAxis.Y or ImGuiAxis.X + local axis = (dir == 2 --[[ImGuiDir.Up]] or dir == 3 --[[ImGuiDir.Down]]) and 2 --[[ImGuiAxis.Y]] or 1 --[[ImGuiAxis.X]] local pos = ImVec2(avail_rect.Min.x, avail_rect.Min.y) - if dir == ImGuiDir.Right or dir == ImGuiDir.Down then + if dir == 1 --[[ImGuiDir.Right]] or dir == 3 --[[ImGuiDir.Down]] then pos[axis] = avail_rect.Max[axis] - axis_size end local size = avail_rect:GetSize() @@ -63762,17 +63805,17 @@ function ImGui.BeginViewportSideBar(name, viewport_p, dir, axis_size, window_fla ImGui.SetNextWindowSize(size) -- Report our size into work area (for next frame) using actual window size - if dir == ImGuiDir.Up or dir == ImGuiDir.Left then + if dir == 2 --[[ImGuiDir.Up]] or dir == 0 --[[ImGuiDir.Left]] then viewport.BuildWorkInsetMin[axis] = viewport.BuildWorkInsetMin[axis] + axis_size - elseif dir == ImGuiDir.Down or dir == ImGuiDir.Right then + elseif dir == 3 --[[ImGuiDir.Down]] or dir == 1 --[[ImGuiDir.Right]] then viewport.BuildWorkInsetMax[axis] = viewport.BuildWorkInsetMax[axis] + axis_size end end - window_flags = bit32.bor(window_flags or 0, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoResize, ImGuiWindowFlags.NoMove, ImGuiWindowFlags.NoDocking) + window_flags = bit32.bor(window_flags or 0, 1 --[[ImGuiWindowFlags.NoTitleBar]], 2 --[[ImGuiWindowFlags.NoResize]], 4 --[[ImGuiWindowFlags.NoMove]], 524288 --[[ImGuiWindowFlags.NoDocking]]) ImGui.SetNextWindowViewport(viewport.ID) - ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 0.0) - ImGui.PushStyleVar(ImGuiStyleVar.WindowMinSize, ImVec2(0, 0)) -- Lift normal size constraint + ImGui.PushStyleVar(3 --[[ImGuiStyleVar.WindowRounding]], 0.0) + ImGui.PushStyleVar(5 --[[ImGuiStyleVar.WindowMinSize]], ImVec2(0, 0)) -- Lift normal size constraint local _, is_open = ImGui.Begin(name, nil, window_flags) ImGui.PopStyleVar(2) @@ -63790,9 +63833,9 @@ function ImGui.BeginMainMenuBar() -- FIXME: This could be generalized as an opt-in way to clamp window.DC.CursorStartPos to avoid SafeArea? -- FIXME: Consider removing support for safe area down the line... it's messy. Nowadays consoles have support for TV calibration in OS settings. g.NextWindowData.MenuBarOffsetMinVal = ImVec2(g.Style.DisplaySafeAreaPadding.x, ImMax(g.Style.DisplaySafeAreaPadding.y - g.Style.FramePadding.y, 0.0)) - local window_flags = bit32.bor(ImGuiWindowFlags.NoScrollbar, ImGuiWindowFlags.NoSavedSettings, ImGuiWindowFlags.MenuBar) + local window_flags = bit32.bor(8 --[[ImGuiWindowFlags.NoScrollbar]], 256 --[[ImGuiWindowFlags.NoSavedSettings]], 1024 --[[ImGuiWindowFlags.MenuBar]]) local height = ImGui.GetFrameHeight() - local is_open = ImGui.BeginViewportSideBar("##MainMenuBar", viewport, ImGuiDir.Up, height, window_flags) + local is_open = ImGui.BeginViewportSideBar("##MainMenuBar", viewport, 2 --[[ImGuiDir.Up]], height, window_flags) g.NextWindowData.MenuBarOffsetMinVal = ImVec2(0.0, 0.0) if not is_open then ImGui.End() @@ -63800,7 +63843,7 @@ function ImGui.BeginMainMenuBar() end -- Temporarily disable _NoSavedSettings, in the off-chance that tables or child windows submitted within the menu-bar may want to use settings. (#8356) - g.CurrentWindow.Flags = bit32.band(g.CurrentWindow.Flags, bit32.bnot(ImGuiWindowFlags.NoSavedSettings)) + g.CurrentWindow.Flags = bit32.band(g.CurrentWindow.Flags, bit32.bnot(256 --[[ImGuiWindowFlags.NoSavedSettings]])) ImGui.BeginMenuBar() return is_open end @@ -63810,12 +63853,12 @@ function ImGui.EndMainMenuBar() IM_ASSERT_USER_ERROR_RET(g.CurrentWindow.DC.MenuBarAppending, "Calling EndMainMenuBar() not from a menu-bar!") -- Not technically testing that it is the main menu bar ImGui.EndMenuBar() - g.CurrentWindow.Flags = bit32.bor(g.CurrentWindow.Flags, ImGuiWindowFlags.NoSavedSettings) -- Restore _NoSavedSettings (#8356) + g.CurrentWindow.Flags = bit32.bor(g.CurrentWindow.Flags, 256 --[[ImGuiWindowFlags.NoSavedSettings]]) -- Restore _NoSavedSettings (#8356) -- When the user has left the menu layer (typically: closed menus through activation of an item), we restore focus to the previous window -- FIXME: With this strategy we won't be able to restore a nil focus. - if g.CurrentWindow == g.NavWindow and g.NavLayer == ImGuiNavLayer.Main and not g.NavAnyRequest and g.ActiveId == 0 then - ImGui.FocusTopMostWindowUnderOne(g.NavWindow, nil, nil, bit32.bor(ImGuiFocusRequestFlags.UnlessBelowModal, ImGuiFocusRequestFlags.RestoreFocusedChild)) + if g.CurrentWindow == g.NavWindow and g.NavLayer == 0 --[[ImGuiNavLayer.Main]] and not g.NavAnyRequest and g.ActiveId == 0 then + ImGui.FocusTopMostWindowUnderOne(g.NavWindow, nil, nil, bit32.bor(2 --[[ImGuiFocusRequestFlags.UnlessBelowModal]], 1 --[[ImGuiFocusRequestFlags.RestoreFocusedChild]])) end ImGui.End() @@ -63824,7 +63867,7 @@ end local function IsRootOfOpenMenuSet() local g = GImGui local window = g.CurrentWindow - if (g.OpenPopupStack.Size <= g.BeginPopupStack.Size) or (bit32.band(window.Flags, ImGuiWindowFlags.ChildMenu) ~= 0) then + if (g.OpenPopupStack.Size <= g.BeginPopupStack.Size) or (bit32.band(window.Flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0) then return false end @@ -63843,7 +63886,7 @@ local function IsRootOfOpenMenuSet() if window.DC.NavLayerCurrent ~= upper_popup.ParentNavLayer then return false end - return upper_popup.Window and (bit32.band(upper_popup.Window.Flags, ImGuiWindowFlags.ChildMenu) ~= 0) and ImGui.IsWindowChildOf(upper_popup.Window, window, true, false) + return upper_popup.Window and (bit32.band(upper_popup.Window.Flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0) and ImGui.IsWindowChildOf(upper_popup.Window, window, true, false) end --- @param label string @@ -63858,13 +63901,13 @@ function ImGui.BeginMenuEx(label, icon, enabled) local g = GImGui local style = g.Style local id = window:GetID(label) - local menu_is_open = ImGui.IsPopupOpen(id, ImGuiPopupFlags.None) + local menu_is_open = ImGui.IsPopupOpen(id, 0 --[[ImGuiPopupFlags.None]]) -- Sub-menus are ChildWindow so that mouse can be hovering across them (otherwise top-most popup menu would steal focus and not allow hovering on parent menu) -- The first menu in a hierarchy isn't so hovering doesn't get across (otherwise e.g. resizing borders with ImGuiButtonFlags.FlattenChildren would react), but top-most BeginMenu() will bypass that limitation. - local window_flags = bit32.bor(ImGuiWindowFlags.ChildMenu, ImGuiWindowFlags.AlwaysAutoResize, ImGuiWindowFlags.NoMove, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoSavedSettings, ImGuiWindowFlags.NoNavFocus) - if bit32.band(window.Flags, ImGuiWindowFlags.ChildMenu) ~= 0 then - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.ChildWindow) + local window_flags = bit32.bor(268435456 --[[ImGuiWindowFlags.ChildMenu]], 64 --[[ImGuiWindowFlags.AlwaysAutoResize]], 4 --[[ImGuiWindowFlags.NoMove]], 1 --[[ImGuiWindowFlags.NoTitleBar]], 256 --[[ImGuiWindowFlags.NoSavedSettings]], 131072 --[[ImGuiWindowFlags.NoNavFocus]]) + if bit32.band(window.Flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0 then + window_flags = bit32.bor(window_flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) end -- If a menu with same the ID was already submitted, we will append to it, matching the behavior of Begin(). @@ -63889,7 +63932,7 @@ function ImGui.BeginMenuEx(label, icon, enabled) -- This is only done for items for the menu set and not the full parent window. local menuset_is_open = IsRootOfOpenMenuSet() if menuset_is_open then - g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, ImGuiItemFlags.NoWindowHoverableCheck) + g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, 8192 --[[ImGuiItemFlags.NoWindowHoverableCheck]]) end -- The reference position stored in popup_pos will be used by Begin() to find a suitable position for the child menu, @@ -63907,14 +63950,14 @@ function ImGui.BeginMenuEx(label, icon, enabled) local backup_rounding = style.SelectableRounding style.SelectableRounding = style.MenuItemRounding - local selectable_flags = bit32.bor(ImGuiSelectableFlags.SelectOnClick, ImGuiSelectableFlags.NoAutoClosePopups) + local selectable_flags = bit32.bor(4194304 --[[ImGuiSelectableFlags.SelectOnClick]], 1 --[[ImGuiSelectableFlags.NoAutoClosePopups]]) local offsets = window.DC.MenuColumns - if window.DC.LayoutType == ImGuiLayoutType.Horizontal then + if window.DC.LayoutType == 0 --[[ImGuiLayoutType.Horizontal]] then -- Menu inside a horizontal menu bar -- Selectable extend their highlight by half ItemSpacing in each direction. -- For ChildMenu, the popup position will be overwritten by the call to FindBestWindowPosForPopup() in Begin() window.DC.CursorPos.x = window.DC.CursorPos.x + IM_TRUNC(style.ItemSpacing.x * 0.5) - ImGui.PushStyleVarX(ImGuiStyleVar.ItemSpacing, style.ItemSpacing.x * 2.0) + ImGui.PushStyleVarX(14 --[[ImGuiStyleVar.ItemSpacing]], style.ItemSpacing.x * 2.0) local text_pos = ImVec2(window.DC.CursorPos.x + offsets.OffsetLabel, pos.y + window.DC.CurrLineTextBaseOffset) pressed = ImGui.Selectable("", menu_is_open, selectable_flags, label_size) -- TODO: ImGui.LogSetNextTextDecoration("[", "]") @@ -63932,14 +63975,14 @@ function ImGui.BeginMenuEx(label, icon, enabled) local min_w = offsets:DeclColumns(icon_w, label_size.x, 0.0, checkmark_w) -- Feedback to next frame local extra_w = ImMax(0.0, ImGui.GetContentRegionAvail().x - min_w) local text_pos = ImVec2(window.DC.CursorPos.x, pos.y + window.DC.CurrLineTextBaseOffset) - pressed = ImGui.Selectable("", menu_is_open, bit32.bor(selectable_flags, ImGuiSelectableFlags.SpanAvailWidth), ImVec2(min_w, label_size.y)) + pressed = ImGui.Selectable("", menu_is_open, bit32.bor(selectable_flags, 16777216 --[[ImGuiSelectableFlags.SpanAvailWidth]]), ImVec2(min_w, label_size.y)) -- ImGui.LogSetNextTextDecoration("", ">") ImGui.RenderText(ImVec2(text_pos.x + offsets.OffsetLabel, text_pos.y), label, 1, label_end, false) if icon_w > 0.0 then --- @cast icon string ImGui.RenderText(ImVec2(text_pos.x + offsets.OffsetIcon, text_pos.y), icon) end - ImGui.RenderArrow(window.DrawList, ImVec2(text_pos.x + offsets.OffsetMark + extra_w + g.FontSize * 0.30, text_pos.y), ImGui.GetColorU32(ImGuiCol.Text), ImGuiDir.Right) + ImGui.RenderArrow(window.DrawList, ImVec2(text_pos.x + offsets.OffsetMark + extra_w + g.FontSize * 0.30, text_pos.y), ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), 1 --[[ImGuiDir.Right]]) popup_pos = ImVec2(pos.x, text_pos.y - style.WindowPadding.y) end style.SelectableRounding = backup_rounding @@ -63950,9 +63993,9 @@ function ImGui.BeginMenuEx(label, icon, enabled) -- Once dragged, release ActiveId + key ownership. This is to allow the idiom of mouse down a menu, dragging elsewhere, up on some other MenuItem(). (#8233, #9394) -- Could move logic into lower-level ImGuiButtonFlags.AutoReleaseActiveId + ImGuiButtonFlags.AutoReleaseKeyOwner? Easier once we get rid of the Selectable() middle-man here. - if g.ActiveId == id and g.HoveredId ~= id and g.ActiveIdSource == ImGuiInputSource.Mouse and ImGui.IsMouseDragging(0) then + if g.ActiveId == id and g.HoveredId ~= id and g.ActiveIdSource == 1 --[[ImGuiInputSource.Mouse]] and ImGui.IsMouseDragging(0) then ImGui.ClearActiveID() - ImGui.SetKeyOwner(ImGuiKey.MouseLeft, ImGuiKeyOwner_NoOwner) + ImGui.SetKeyOwner(656 --[[ImGuiKey.MouseLeft]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) end local hovered = g.HoveredId == id and enabled and not g.NavHighlightItemUnderNav @@ -63960,7 +64003,7 @@ function ImGui.BeginMenuEx(label, icon, enabled) local want_open = false local want_open_nav_init = false local want_close = false - if window.DC.LayoutType == ImGuiLayoutType.Vertical then -- (window.Flags & (ImGuiWindowFlags.Popup|ImGuiWindowFlags.ChildMenu)) + if window.DC.LayoutType == 1 --[[ImGuiLayoutType.Vertical]] then -- (window.Flags & (ImGuiWindowFlags.Popup|ImGuiWindowFlags.ChildMenu)) -- Close menu when not hovering it anymore unless we are moving roughly in the direction of the menu -- Implement http://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown to avoid using timers, so menus feels more reactive. local moving_toward_child_menu = false @@ -64006,7 +64049,7 @@ function ImGui.BeginMenuEx(label, icon, enabled) elseif not menu_is_open and hovered and g.HoveredIdTimer >= 0.30 and g.MouseStationaryTimer >= 0.30 then -- Hover to open (timer fallback) want_open = true end - if g.NavId == id and g.NavMoveDir == ImGuiDir.Right then -- Nav-Right to open + if g.NavId == id and g.NavMoveDir == 1 --[[ImGuiDir.Right]] then -- Nav-Right to open want_open = true want_open_nav_init = true ImGui.NavMoveRequestCancel() @@ -64020,7 +64063,7 @@ function ImGui.BeginMenuEx(label, icon, enabled) menu_is_open = false elseif pressed or (hovered and menuset_is_open and not menu_is_open) then -- First click to open, then hover to open others want_open = true - elseif g.NavId == id and g.NavMoveDir == ImGuiDir.Down then -- Nav-Down to open + elseif g.NavId == id and g.NavMoveDir == 3 --[[ImGuiDir.Down]] then -- Nav-Down to open want_open = true ImGui.NavMoveRequestCancel() end @@ -64029,7 +64072,7 @@ function ImGui.BeginMenuEx(label, icon, enabled) if not enabled then -- explicitly close if an open menu becomes disabled, facilitate users code a lot in pattern such as 'if (BeginMenu("options", has_object)) { ..use object.. }' want_close = true end - if want_close and ImGui.IsPopupOpen(id, ImGuiPopupFlags.None) then + if want_close and ImGui.IsPopupOpen(id, 0 --[[ImGuiPopupFlags.None]]) then ImGui.ClosePopupToLevel(g.BeginPopupStack.Size, true) end @@ -64045,22 +64088,22 @@ function ImGui.BeginMenuEx(label, icon, enabled) ImGui.OpenPopup(label) elseif want_open then menu_is_open = true - ImGui.OpenPopup(label, ImGuiPopupFlags.NoReopen) -- | (want_open_nav_init ? ImGuiPopupFlags.NoReopenAlwaysNavInit : 0)) + ImGui.OpenPopup(label, 32 --[[ImGuiPopupFlags.NoReopen]]) -- | (want_open_nav_init ? ImGuiPopupFlags.NoReopenAlwaysNavInit : 0)) end if menu_is_open then local last_item_in_parent = ImGuiLastItemData() ImGuiLastItemData_Copy(last_item_in_parent, g.LastItemData) - ImGui.SetNextWindowPos(popup_pos, ImGuiCond.Always) -- Note: misleading: the value will serve as reference for FindBestWindowPosForPopup(), not actual pos. - ImGui.PushStyleVar(ImGuiStyleVar.ChildRounding, style.PopupRounding) -- First level will use _PopupRounding, subsequent will use _ChildRounding + ImGui.SetNextWindowPos(popup_pos, 1 --[[ImGuiCond.Always]]) -- Note: misleading: the value will serve as reference for FindBestWindowPosForPopup(), not actual pos. + ImGui.PushStyleVar(7 --[[ImGuiStyleVar.ChildRounding]], style.PopupRounding) -- First level will use _PopupRounding, subsequent will use _ChildRounding menu_is_open = ImGui.BeginPopupMenuEx(id, label, window_flags) -- menu_is_open may be 'false' when the popup is completely clipped (e.g. zero size display) ImGui.PopStyleVar() if menu_is_open then -- Implement what ImGuiPopupFlags.NoReopenAlwaysNavInit would do: -- Perform an init request in the case the popup was already open (via a previous mouse hover) if want_open and want_open_nav_init and not g.NavInitRequest then - ImGui.FocusWindow(g.CurrentWindow, ImGuiFocusRequestFlags.UnlessBelowModal) + ImGui.FocusWindow(g.CurrentWindow, 2 --[[ImGuiFocusRequestFlags.UnlessBelowModal]]) ImGui.NavInitWindow(g.CurrentWindow, false) end @@ -64068,7 +64111,7 @@ function ImGui.BeginMenuEx(label, icon, enabled) -- (This fixes using IsItemClicked() and IsItemHovered(), but IsItemHovered() also relies on its support for ImGuiItemFlags.NoWindowHoverableCheck) ImGuiLastItemData_Copy(g.LastItemData, last_item_in_parent) if g.HoveredWindow == window then - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HoveredWindow) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 128 --[[ImGuiItemStatusFlags.HoveredWindow]]) end end else @@ -64090,12 +64133,12 @@ function ImGui.EndMenu() -- Nav: When a left move request our menu failed, close ourselves. local g = GImGui local window = g.CurrentWindow - IM_ASSERT_USER_ERROR_RET(bit32.band(window.Flags, bit32.bor(ImGuiWindowFlags.Popup, ImGuiWindowFlags.ChildMenu)) == bit32.bor(ImGuiWindowFlags.Popup, ImGuiWindowFlags.ChildMenu), "Calling EndMenu() in wrong window!") + IM_ASSERT_USER_ERROR_RET(bit32.band(window.Flags, bit32.bor(67108864 --[[ImGuiWindowFlags.Popup]], 268435456 --[[ImGuiWindowFlags.ChildMenu]])) == bit32.bor(67108864 --[[ImGuiWindowFlags.Popup]], 268435456 --[[ImGuiWindowFlags.ChildMenu]]), "Calling EndMenu() in wrong window!") local parent_window = window.ParentWindow -- Should always be ~= nil is we passed assert. if window.BeginCount == window.BeginCountPreviousFrame then - if g.NavMoveDir == ImGuiDir.Left and ImGui.NavMoveRequestButNoResultYet() then - if g.NavWindow and g.NavWindow.RootWindowForNav == window and parent_window.DC.LayoutType == ImGuiLayoutType.Vertical then + if g.NavMoveDir == 0 --[[ImGuiDir.Left]] and ImGui.NavMoveRequestButNoResultYet() then + if g.NavWindow and g.NavWindow.RootWindowForNav == window and parent_window.DC.LayoutType == 1 --[[ImGuiLayoutType.Vertical]] then ImGui.ClosePopupToLevel(g.BeginPopupStack.Size - 1, true) ImGui.NavMoveRequestCancel() end @@ -64129,7 +64172,7 @@ function ImGui.MenuItemEx(label, icon, shortcut, selected, enabled) -- See BeginMenuEx() for comments about this. local menuset_is_open = IsRootOfOpenMenuSet() if menuset_is_open then - g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, ImGuiItemFlags.NoWindowHoverableCheck) + g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, 8192 --[[ImGuiItemFlags.NoWindowHoverableCheck]]) end -- We've been using the equivalent of ImGuiSelectableFlags.SetNavIdOnHover on all Selectable() since early Nav system days (commit 43ee5d73), @@ -64144,17 +64187,17 @@ function ImGui.MenuItemEx(label, icon, shortcut, selected, enabled) -- We use ImGuiSelectableFlags.NoSetKeyOwner to allow down on one menu item, move, up on another. local backup_rounding = style.SelectableRounding style.SelectableRounding = style.MenuItemRounding - local selectable_flags = bit32.bor(ImGuiSelectableFlags.SelectOnRelease, ImGuiSelectableFlags.SetNavIdOnHover) + local selectable_flags = bit32.bor(8388608 --[[ImGuiSelectableFlags.SelectOnRelease]], 33554432 --[[ImGuiSelectableFlags.SetNavIdOnHover]]) local offsets = window.DC.MenuColumns - if window.DC.LayoutType == ImGuiLayoutType.Horizontal then + if window.DC.LayoutType == 0 --[[ImGuiLayoutType.Horizontal]] then -- Mimic the exact layout spacing of BeginMenu() to allow MenuItem() inside a menu bar, which is a little misleading but may be useful -- Note that in this situation: we don't render the shortcut, we render a highlight instead of the selected tick mark. window.DC.CursorPos.x = window.DC.CursorPos.x + IM_TRUNC(style.ItemSpacing.x * 0.5) local text_pos = ImVec2(window.DC.CursorPos.x + offsets.OffsetLabel, window.DC.CursorPos.y + window.DC.CurrLineTextBaseOffset) - ImGui.PushStyleVarX(ImGuiStyleVar.ItemSpacing, style.ItemSpacing.x * 2.0) + ImGui.PushStyleVarX(14 --[[ImGuiStyleVar.ItemSpacing]], style.ItemSpacing.x * 2.0) pressed = ImGui.Selectable("", selected, selectable_flags, ImVec2(label_size.x, 0.0)) ImGui.PopStyleVar() - if bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.Visible) ~= 0 then + if bit32.band(g.LastItemData.StatusFlags, 256 --[[ImGuiItemStatusFlags.Visible]]) ~= 0 then ImGui.RenderText(text_pos, label, 1, label_end, false) end window.DC.CursorPos.x = window.DC.CursorPos.x + IM_TRUNC(style.ItemSpacing.x * (-1.0 + 0.5)) -- -1 spacing to compensate the spacing added when Selectable() did a SameLine(). It would also work to call SameLine() ourselves after the PopStyleVar(). @@ -64174,22 +64217,22 @@ function ImGui.MenuItemEx(label, icon, shortcut, selected, enabled) local min_w = offsets:DeclColumns(icon_w, label_size.x, shortcut_w, checkmark_w) -- Feedback for next frame local stretch_w = ImMax(0.0, ImGui.GetContentRegionAvail().x - min_w) local text_pos = ImVec2(pos.x, pos.y + window.DC.CurrLineTextBaseOffset) - pressed = ImGui.Selectable("", false, bit32.bor(selectable_flags, ImGuiSelectableFlags.SpanAvailWidth), ImVec2(min_w, label_size.y)) - if bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.Visible) ~= 0 then + pressed = ImGui.Selectable("", false, bit32.bor(selectable_flags, 16777216 --[[ImGuiSelectableFlags.SpanAvailWidth]]), ImVec2(min_w, label_size.y)) + if bit32.band(g.LastItemData.StatusFlags, 256 --[[ImGuiItemStatusFlags.Visible]]) ~= 0 then ImGui.RenderText(text_pos + ImVec2(offsets.OffsetLabel, 0.0), label, 1, label_end, false) if icon_w > 0.0 then --- @cast icon string ImGui.RenderText(text_pos + ImVec2(offsets.OffsetIcon, 0.0), icon) end if shortcut_w > 0.0 then - ImGui.PushStyleColor(ImGuiCol.Text, style.Colors[ImGuiCol.TextDisabled]) + ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], style.Colors[1 --[[ImGuiCol.TextDisabled]]]) -- ImGui.LogSetNextTextDecoration("(", ")") --- @cast shortcut string ImGui.RenderText(text_pos + ImVec2(offsets.OffsetShortcut + stretch_w, 0.0), shortcut, nil, nil, false) ImGui.PopStyleColor() end if selected then - ImGui.RenderCheckMark(window.DrawList, text_pos + ImVec2(offsets.OffsetMark + stretch_w + g.FontSize * 0.40, g.FontSize * 0.134 * 0.5), ImGui.GetColorU32(ImGuiCol.Text), g.FontSize * 0.866) + ImGui.RenderCheckMark(window.DrawList, text_pos + ImVec2(offsets.OffsetMark + stretch_w + g.FontSize * 0.40, g.FontSize * 0.134 * 0.5), ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), g.FontSize * 0.866) end end end @@ -64198,9 +64241,9 @@ function ImGui.MenuItemEx(label, icon, shortcut, selected, enabled) -- Once dragged, release ActiveId + key ownership. This is to allow the idiom of mouse down a menu, dragging elsewhere, up on some other MenuItem(). (#8233, #9394) -- Could move logic into lower-level ImGuiButtonFlags_AutoReleaseActiveId + ImGuiButtonFlags_AutoReleaseKeyOwner? Easier once we get rid of the Selectable() middle-man here. local id = g.LastItemData.ID - if g.ActiveId == id and g.HoveredId ~= id and g.ActiveIdSource == ImGuiInputSource.Mouse and ImGui.IsMouseDragging(0) then + if g.ActiveId == id and g.HoveredId ~= id and g.ActiveIdSource == 1 --[[ImGuiInputSource.Mouse]] and ImGui.IsMouseDragging(0) then ImGui.ClearActiveID() - ImGui.SetKeyOwner(ImGuiKey.MouseLeft, ImGuiKeyOwner_NoOwner) + ImGui.SetKeyOwner(656 --[[ImGuiKey.MouseLeft]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) end -- IMGUI_TEST_ENGINE_ITEM_INFO() @@ -64253,8 +64296,8 @@ local function ImLinearSweep(current, target, speed) end local function TabItemGetSectionIdx(tab) - if bit32.band(tab.Flags, ImGuiTabItemFlags.Leading) ~= 0 then return 0 end - if bit32.band(tab.Flags, ImGuiTabItemFlags.Trailing) ~= 0 then return 2 end + if bit32.band(tab.Flags, 64 --[[ImGuiTabItemFlags.Leading]]) ~= 0 then return 0 end + if bit32.band(tab.Flags, 128 --[[ImGuiTabItemFlags.Trailing]]) ~= 0 then return 2 end return 1 end @@ -64398,7 +64441,7 @@ function ImGui.BeginTabBar(str_id, flags) tab_bar.SeparatorMinX = tab_bar_bb.Min.x - IM_TRUNC(window.WindowPadding.x * 0.5) tab_bar.SeparatorMaxX = tab_bar_bb.Max.x + IM_TRUNC(window.WindowPadding.x * 0.5) -- if (g.NavWindow and ImGui.IsWindowChildOf(g.NavWindow, window, false, false)) - flags = bit32.bor(flags, ImGuiTabBarFlags.IsFocused) + flags = bit32.bor(flags, 2097152 --[[ImGuiTabBarFlags.IsFocused]]) return ImGui.BeginTabBarEx(tab_bar, tab_bar_bb, flags) end @@ -64408,8 +64451,8 @@ function ImGui.BeginTabBarEx(tab_bar, tab_bar_bb, flags) local window = g.CurrentWindow if window.SkipItems then return false end - IM_ASSERT(tab_bar.ID ~= 0) - if bit32.band(flags, ImGuiTabBarFlags.DockNode) == 0 then -- Already done + assert(tab_bar.ID ~= 0) + if bit32.band(flags, 1048576 --[[ImGuiTabBarFlags.DockNode]]) == 0 then -- Already done ImGui.PushOverrideID(tab_bar.ID) end @@ -64427,17 +64470,17 @@ function ImGui.BeginTabBarEx(tab_bar, tab_bar_bb, flags) end -- Ensure correct ordering when toggling ImGuiTabBarFlags.Reorderable flag, or when a new tab was added while being not reorderable - if bit32.band(flags, ImGuiTabBarFlags.Reorderable) ~= bit32.band(tab_bar.Flags, ImGuiTabBarFlags.Reorderable) - or (tab_bar.TabsAddedNew and bit32.band(flags, ImGuiTabBarFlags.Reorderable) == 0) then - if bit32.band(flags, ImGuiTabBarFlags.DockNode) == 0 then -- FIXME: TabBar with DockNode can now be hybrid + if bit32.band(flags, 1 --[[ImGuiTabBarFlags.Reorderable]]) ~= bit32.band(tab_bar.Flags, 1 --[[ImGuiTabBarFlags.Reorderable]]) + or (tab_bar.TabsAddedNew and bit32.band(flags, 1 --[[ImGuiTabBarFlags.Reorderable]]) == 0) then + if bit32.band(flags, 1048576 --[[ImGuiTabBarFlags.DockNode]]) == 0 then -- FIXME: TabBar with DockNode can now be hybrid SortTabsByBeginOrder(tab_bar) end end tab_bar.TabsAddedNew = false -- Flags - if bit32.band(flags, ImGuiTabBarFlags.FittingPolicyMask_) == 0 then - flags = bit32.bor(flags, ImGuiTabBarFlags.FittingPolicyDefault_) + if bit32.band(flags, 896 --[[ImGuiTabBarFlags.FittingPolicyMask_]]) == 0 then + flags = bit32.bor(flags, 128 --[[ImGuiTabBarFlags.FittingPolicyDefault_]]) end tab_bar.Flags = flags @@ -64458,7 +64501,7 @@ function ImGui.BeginTabBarEx(tab_bar, tab_bar_bb, flags) -- Draw separator -- (it would be misleading to draw this in EndTabBar() suggesting that it may be drawn over tabs, as tab bar are appendable) - local col = ImGui.GetColorU32(bit32.band(flags, ImGuiTabBarFlags.IsFocused) ~= 0 and ImGuiCol.TabSelected or ImGuiCol.TabDimmedSelected) + local col = ImGui.GetColorU32(bit32.band(flags, 2097152 --[[ImGuiTabBarFlags.IsFocused]]) ~= 0 and 37 --[[ImGuiCol.TabSelected]] or 40 --[[ImGuiCol.TabDimmedSelected]]) if g.Style.TabBarBorderSize > 0.0 then local y = tab_bar.BarRect.Max.y window.DrawList:AddRectFilled(ImVec2(tab_bar.SeparatorMinX, y - g.Style.TabBarBorderSize), ImVec2(tab_bar.SeparatorMaxX, y), col) @@ -64473,7 +64516,7 @@ function ImGui.EndTabBar() if window.SkipItems then return end local tab_bar = g.CurrentTabBar - IM_ASSERT(tab_bar ~= nil, "Mismatched BeginTabBar()/EndTabBar()!") + assert(tab_bar ~= nil, "Mismatched BeginTabBar()/EndTabBar()!") -- Fallback in case no TabItem have been submitted if tab_bar.WantLayout then ImGui.TabBarLayout(tab_bar) end @@ -64491,7 +64534,7 @@ function ImGui.EndTabBar() end tab_bar.LastTabItemIdx = -1 - if bit32.band(tab_bar.Flags, ImGuiTabBarFlags.DockNode) == 0 then -- Already done + if bit32.band(tab_bar.Flags, 1048576 --[[ImGuiTabBarFlags.DockNode]]) == 0 then -- Already done ImGui.PopID() end @@ -64574,7 +64617,7 @@ function ImGui.TabBarLayout(tab_bar) end -- Tab List Popup (will alter tab_bar.BarRect and therefore the available width!) - local tab_list_popup_button = bit32.band(tab_bar.Flags, ImGuiTabBarFlags.TabListPopupButton) ~= 0 + local tab_list_popup_button = bit32.band(tab_bar.Flags, 4 --[[ImGuiTabBarFlags.TabListPopupButton]]) ~= 0 if tab_list_popup_button then local tab_to_select = ImGui.TabBarTabListPopupButton(tab_bar) -- NB: Will alter BarRect.Min.x! if tab_to_select then @@ -64592,7 +64635,7 @@ function ImGui.TabBarLayout(tab_bar) for i = 1, tabs.Size do if swb.Data[i] == nil then swb.Data[i] = ImGuiShrinkWidthItem() end end -- Minimum shrink width - local shrink_min_width = (bit32.band(tab_bar.Flags, ImGuiTabBarFlags.FittingPolicyMixed) ~= 0) and g.Style.TabMinWidthShrink or 1.0 + local shrink_min_width = (bit32.band(tab_bar.Flags, 128 --[[ImGuiTabBarFlags.FittingPolicyMixed]]) ~= 0) and g.Style.TabMinWidthShrink or 1.0 -- Compute ideal tabs widths + store them into shrink buffer local most_recently_selected_tab = nil @@ -64600,9 +64643,9 @@ function ImGui.TabBarLayout(tab_bar) local found_selected_tab_id = false for tab_n = 0, tabs.Size - 1 do local tab = tabs.Data[tab_n + 1] - IM_ASSERT(tab.LastFrameVisible >= tab_bar.PrevFrameVisible) + assert(tab.LastFrameVisible >= tab_bar.PrevFrameVisible) - if (most_recently_selected_tab == nil or most_recently_selected_tab.LastFrameSelected < tab.LastFrameSelected) and bit32.band(tab.Flags, ImGuiTabItemFlags.Button) == 0 then + if (most_recently_selected_tab == nil or most_recently_selected_tab.LastFrameSelected < tab.LastFrameSelected) and bit32.band(tab.Flags, 2097152 --[[ImGuiTabItemFlags.Button]]) == 0 then most_recently_selected_tab = tab end if tab.ID == tab_bar.SelectedTabId then found_selected_tab_id = true end @@ -64612,9 +64655,9 @@ function ImGui.TabBarLayout(tab_bar) -- Additionally, when using TabBarAddTab() to manipulate tab bar order we occasionally insert new tabs that don't have a width yet, -- and we cannot wait for the next BeginTabItem() call. We cannot compute this width within TabBarAddTab() because font size depends on the active window. local tab_name = ImGui.TabBarGetTabName(tab_bar, tab) - local has_close_button_or_unsaved_marker = bit32.band(tab.Flags, ImGuiTabItemFlags.NoCloseButton) == 0 or bit32.band(tab.Flags, ImGuiTabItemFlags.UnsavedDocument) ~= 0 + local has_close_button_or_unsaved_marker = bit32.band(tab.Flags, 1048576 --[[ImGuiTabItemFlags.NoCloseButton]]) == 0 or bit32.band(tab.Flags, 1 --[[ImGuiTabItemFlags.UnsavedDocument]]) ~= 0 tab.ContentWidth = (tab.RequestedWidth >= 0.0) and tab.RequestedWidth or ImGui.TabItemCalcSize(tab_name, has_close_button_or_unsaved_marker).x - if bit32.band(tab.Flags, ImGuiTabItemFlags.Button) == 0 then + if bit32.band(tab.Flags, 2097152 --[[ImGuiTabItemFlags.Button]]) == 0 then tab.ContentWidth = ImMax(tab.ContentWidth, g.Style.TabMinWidthBase) end @@ -64644,14 +64687,14 @@ function ImGui.TabBarLayout(tab_bar) -- Horizontal scrolling buttons -- - Important: note that TabBarScrollButtons() will alter BarRect.Max.x. -- - Selection skips buttons and might cross through sections if there are Tabs in Leading/Trailing sections. - local can_scroll = bit32.band(tab_bar.Flags, ImGuiTabBarFlags.FittingPolicyScroll) ~= 0 or bit32.band(tab_bar.Flags, ImGuiTabBarFlags.FittingPolicyMixed) ~= 0 - local width_all_tabs_to_use_for_scroll = (bit32.band(tab_bar.Flags, ImGuiTabBarFlags.FittingPolicyScroll) ~= 0) and tab_bar.WidthAllTabs or width_all_tabs_after_min_width_shrink + local can_scroll = bit32.band(tab_bar.Flags, 512 --[[ImGuiTabBarFlags.FittingPolicyScroll]]) ~= 0 or bit32.band(tab_bar.Flags, 128 --[[ImGuiTabBarFlags.FittingPolicyMixed]]) ~= 0 + local width_all_tabs_to_use_for_scroll = (bit32.band(tab_bar.Flags, 512 --[[ImGuiTabBarFlags.FittingPolicyScroll]]) ~= 0) and tab_bar.WidthAllTabs or width_all_tabs_after_min_width_shrink tab_bar.ScrollButtonEnabled = (width_all_tabs_to_use_for_scroll > tab_bar.BarRect:GetWidth() and tabs.Size > 1) - and bit32.band(tab_bar.Flags, ImGuiTabBarFlags.NoTabListScrollingButtons) == 0 and can_scroll + and bit32.band(tab_bar.Flags, 16 --[[ImGuiTabBarFlags.NoTabListScrollingButtons]]) == 0 and can_scroll if tab_bar.ScrollButtonEnabled then local scroll_and_select_tab = ImGui.TabBarScrollingButtons(tab_bar) if scroll_and_select_tab then - if bit32.band(scroll_and_select_tab.Flags, ImGuiTabItemFlags.Button) == 0 then + if bit32.band(scroll_and_select_tab.Flags, 2097152 --[[ImGuiTabItemFlags.Button]]) == 0 then tab_bar.SelectedTabId = scroll_and_select_tab.ID end scroll_to_tab_id = scroll_and_select_tab.ID @@ -64674,7 +64717,7 @@ function ImGui.TabBarLayout(tab_bar) end -- With ImGuiTabBarFlags.FittingPolicyScroll policy, we will only shrink leading/trailing if the central section is not visible anymore - local can_shrink = bit32.band(tab_bar.Flags, ImGuiTabBarFlags.FittingPolicyShrink) ~= 0 or bit32.band(tab_bar.Flags, ImGuiTabBarFlags.FittingPolicyMixed) ~= 0 + local can_shrink = bit32.band(tab_bar.Flags, 256 --[[ImGuiTabBarFlags.FittingPolicyShrink]]) ~= 0 or bit32.band(tab_bar.Flags, 128 --[[ImGuiTabBarFlags.FittingPolicyMixed]]) ~= 0 if width_excess >= 1.0 and (can_shrink or not central_section_is_visible) then local shrink_data_count = central_section_is_visible and sections[2].TabCount or (sections[1].TabCount + sections[3].TabCount) local shrink_data_offset = central_section_is_visible and (sections[1].TabCount + sections[3].TabCount) or 0 @@ -64739,7 +64782,7 @@ function ImGui.TabBarLayout(tab_bar) ImGui.TabBarScrollToTab(tab_bar, scroll_to_tab_id, sections) elseif tab_bar.ScrollButtonEnabled and ImGui.IsMouseHoveringRect(tab_bar.BarRect.Min, tab_bar.BarRect.Max, true) and ImGui.IsWindowContentHoverable(g.CurrentWindow) then local wheel = g.IO.MouseWheelRequestAxisSwap and g.IO.MouseWheel or g.IO.MouseWheelH - local wheel_key = g.IO.MouseWheelRequestAxisSwap and ImGuiKey.MouseWheelY or ImGuiKey.MouseWheelX + local wheel_key = g.IO.MouseWheelRequestAxisSwap and 662 --[[ImGuiKey.MouseWheelY]] or 661 --[[ImGuiKey.MouseWheelX]] if ImGui.TestKeyOwner(wheel_key, tab_bar.ID) and wheel ~= 0.0 then local scroll_step = wheel * TabBarCalcScrollableWidth(tab_bar, sections) / 3.0 tab_bar.ScrollingTargetDistToVisibility = 0.0 @@ -64774,7 +64817,7 @@ end -- Dockable windows uses Name/ID in the global namespace. Non-dockable items use the ID stack. function ImGui.TabBarCalcTabID(tab_bar, label, docked_window) if docked_window ~= nil then - IM_ASSERT(bit32.band(tab_bar.Flags, ImGuiTabBarFlags.DockNode) ~= 0) + assert(bit32.band(tab_bar.Flags, 1048576 --[[ImGuiTabBarFlags.DockNode]]) ~= 0) local id = docked_window.TabId ImGui.KeepAliveID(id) return id @@ -64833,7 +64876,7 @@ function ImGui.TabBarGetTabName(tab_bar, tab) end function ImGui.TabBarGetTabPos(tab_bar, tab) - if bit32.band(tab.Flags, ImGuiTabItemFlags.SectionMask_) == 0 then + if bit32.band(tab.Flags, 192 --[[ImGuiTabItemFlags.SectionMask_]]) == 0 then return tab_bar.BarRect.Min + ImVec2(IM_TRUNC(tab.Offset - tab_bar.ScrollingAnim), 0.0) end return tab_bar.BarRect.Min + ImVec2(tab.Offset, 0.0) @@ -64843,10 +64886,10 @@ end -- Otherwise calling this is unnecessary as tabs are appending as needed by the BeginTabItem() function. function ImGui.TabBarAddTab(tab_bar, tab_flags, window) local g = ImGui.GetCurrentContext() - IM_ASSERT(ImGui.TabBarFindTabByID(tab_bar, window.TabId) == nil) - IM_ASSERT(g.CurrentTabBar ~= tab_bar) -- Can't work while the tab bar is active as our tab doesn't have an X offset yet, in theory we could/should test something like (tab_bar.CurrFrameVisible < g.FrameCount) but we'd need to solve why triggers the commented early-out assert in BeginTabBarEx() (probably dock node going from implicit to explicit in same frame) + assert(ImGui.TabBarFindTabByID(tab_bar, window.TabId) == nil) + assert(g.CurrentTabBar ~= tab_bar) -- Can't work while the tab bar is active as our tab doesn't have an X offset yet, in theory we could/should test something like (tab_bar.CurrFrameVisible < g.FrameCount) but we'd need to solve why triggers the commented early-out assert in BeginTabBarEx() (probably dock node going from implicit to explicit in same frame) if not window.HasCloseButton then - tab_flags = bit32.bor(tab_flags, ImGuiTabItemFlags.NoCloseButton) -- Set _NoCloseButton immediately because it will be used for first-frame width calculation. + tab_flags = bit32.bor(tab_flags, 1048576 --[[ImGuiTabItemFlags.NoCloseButton]]) -- Set _NoCloseButton immediately because it will be used for first-frame width calculation. end local new_tab = ImGuiTabItem() new_tab.ID = window.TabId @@ -64868,9 +64911,9 @@ end -- Called on manual closure attempt function ImGui.TabBarCloseTab(tab_bar, tab) - if bit32.band(tab.Flags, ImGuiTabItemFlags.Button) ~= 0 then return end -- A button appended with TabItemButton(). + if bit32.band(tab.Flags, 2097152 --[[ImGuiTabItemFlags.Button]]) ~= 0 then return end -- A button appended with TabItemButton(). - if bit32.band(tab.Flags, bit32.bor(ImGuiTabItemFlags.UnsavedDocument, ImGuiTabItemFlags.NoAssumedClosure)) == 0 then + if bit32.band(tab.Flags, bit32.bor(1 --[[ImGuiTabItemFlags.UnsavedDocument]], 256 --[[ImGuiTabItemFlags.NoAssumedClosure]])) == 0 then -- This will remove a frame of lag for selecting another tab on closure. -- However we don't run it in the case where the 'Unsaved' flag is set, so user gets a chance to fully undo the closure tab.WantClose = true @@ -64897,12 +64940,12 @@ function ImGui.TabBarScrollToTab(tab_bar, tab_id, sections) -- Clamp attempt to scroll to leading/trailing sections items. -- This could be done at the TabBarScrollingButtons() call site as well, but here works. - if bit32.band(tab.Flags, ImGuiTabItemFlags.Leading) ~= 0 then + if bit32.band(tab.Flags, 64 --[[ImGuiTabItemFlags.Leading]]) ~= 0 then tab = tab_bar.Tabs.Data[sections[1].TabCount + 1] - elseif bit32.band(tab.Flags, ImGuiTabItemFlags.Trailing) ~= 0 then + elseif bit32.band(tab.Flags, 128 --[[ImGuiTabItemFlags.Trailing]]) ~= 0 then tab = tab_bar.Tabs.Data[sections[1].TabCount + sections[2].TabCount + 1] end - if tab == nil or bit32.band(tab.Flags, ImGuiTabItemFlags.SectionMask_) ~= 0 then return end + if tab == nil or bit32.band(tab.Flags, 192 --[[ImGuiTabItemFlags.SectionMask_]]) ~= 0 then return end -- When scrolling to make Tab N+1 visible always make a bit of N visible to suggest more scrolling area (since we don't have a scrollbar) -- Disable the margin if the scrolling section is too small for the target tab: prefer displaying a maximum of the label. @@ -64931,7 +64974,7 @@ end --- TabBarQueueFocus(tab_bar, tab) or TabBarQueueFocus(tab_bar, tab_name) function ImGui.TabBarQueueFocus(tab_bar, tab) if type(tab) == "string" then - IM_ASSERT(bit32.band(tab_bar.Flags, ImGuiTabBarFlags.DockNode) == 0) -- Only supported for manual/explicit tab bars + assert(bit32.band(tab_bar.Flags, 1048576 --[[ImGuiTabBarFlags.DockNode]]) == 0) -- Only supported for manual/explicit tab bars tab_bar.NextSelectedTabId = ImGui.TabBarCalcTabID(tab_bar, tab, nil) return end @@ -64939,19 +64982,19 @@ function ImGui.TabBarQueueFocus(tab_bar, tab) end function ImGui.TabBarQueueReorder(tab_bar, tab, offset) - IM_ASSERT(offset ~= 0) - IM_ASSERT(tab_bar.ReorderRequestTabId == 0) + assert(offset ~= 0) + assert(tab_bar.ReorderRequestTabId == 0) tab_bar.ReorderRequestTabId = tab.ID tab_bar.ReorderRequestOffset = offset end function ImGui.TabBarQueueReorderFromMousePos(tab_bar, src_tab, mouse_pos) local g = ImGui.GetCurrentContext() - IM_ASSERT(tab_bar.ReorderRequestTabId == 0) - if bit32.band(tab_bar.Flags, ImGuiTabBarFlags.Reorderable) == 0 then return end + assert(tab_bar.ReorderRequestTabId == 0) + if bit32.band(tab_bar.Flags, 1 --[[ImGuiTabBarFlags.Reorderable]]) == 0 then return end local tab_spacing = g.Style.ItemInnerSpacing.x - local is_central_section = bit32.band(src_tab.Flags, ImGuiTabItemFlags.SectionMask_) == 0 + local is_central_section = bit32.band(src_tab.Flags, 192 --[[ImGuiTabItemFlags.SectionMask_]]) == 0 local bar_offset = tab_bar.BarRect.Min.x - (is_central_section and tab_bar.ScrollingTarget or 0) -- Count number of contiguous tabs we are crossing over @@ -64962,8 +65005,8 @@ function ImGui.TabBarQueueReorderFromMousePos(tab_bar, src_tab, mouse_pos) while i >= 0 and i < tab_bar.Tabs.Size do -- Reordered tabs must share the same section local dst_tab = tab_bar.Tabs.Data[i + 1] - if bit32.band(dst_tab.Flags, ImGuiTabItemFlags.NoReorder) ~= 0 then break end - if bit32.band(dst_tab.Flags, ImGuiTabItemFlags.SectionMask_) ~= bit32.band(src_tab.Flags, ImGuiTabItemFlags.SectionMask_) then break end + if bit32.band(dst_tab.Flags, 32 --[[ImGuiTabItemFlags.NoReorder]]) ~= 0 then break end + if bit32.band(dst_tab.Flags, 192 --[[ImGuiTabItemFlags.SectionMask_]]) ~= bit32.band(src_tab.Flags, 192 --[[ImGuiTabItemFlags.SectionMask_]]) then break end dst_idx = i -- Include spacing after tab, so when mouse cursor is between tabs we would not continue checking further tabs that are not hovered. @@ -64981,7 +65024,7 @@ end function ImGui.TabBarProcessReorder(tab_bar) local tab1 = ImGui.TabBarFindTabByID(tab_bar, tab_bar.ReorderRequestTabId) - if tab1 == nil or bit32.band(tab1.Flags, ImGuiTabItemFlags.NoReorder) ~= 0 then return false end + if tab1 == nil or bit32.band(tab1.Flags, 32 --[[ImGuiTabItemFlags.NoReorder]]) ~= 0 then return false end -- IM_ASSERT(bit32.band(tab_bar.Flags, ImGuiTabBarFlags.Reorderable) ~= 0) -- <- this may happen when using debug tools local tab1_order = ImGui.TabBarGetTabOrder(tab_bar, tab1) @@ -64991,14 +65034,14 @@ function ImGui.TabBarProcessReorder(tab_bar) -- Reordered tabs must share the same section -- (Note: TabBarQueueReorderFromMousePos() also has a similar test but since we allow direct calls to TabBarQueueReorder() we do it here too) local tab2 = tab_bar.Tabs.Data[tab2_order + 1] - if bit32.band(tab2.Flags, ImGuiTabItemFlags.NoReorder) ~= 0 then return false end - if bit32.band(tab1.Flags, ImGuiTabItemFlags.SectionMask_) ~= bit32.band(tab2.Flags, ImGuiTabItemFlags.SectionMask_) then return false end + if bit32.band(tab2.Flags, 32 --[[ImGuiTabItemFlags.NoReorder]]) ~= 0 then return false end + if bit32.band(tab1.Flags, 192 --[[ImGuiTabItemFlags.SectionMask_]]) ~= bit32.band(tab2.Flags, 192 --[[ImGuiTabItemFlags.SectionMask_]]) then return false end -- Move tab1 to tab2's position, shifting the tabs in between table.remove(tab_bar.Tabs.Data, tab1_order + 1) table.insert(tab_bar.Tabs.Data, tab2_order + 1, tab1) - if bit32.band(tab_bar.Flags, ImGuiTabBarFlags.SaveSettings) ~= 0 then ImGui.MarkIniSettingsDirty() end + if bit32.band(tab_bar.Flags, 4194304 --[[ImGuiTabBarFlags.SaveSettings]]) ~= 0 then ImGui.MarkIniSettingsDirty() end return true end @@ -65013,21 +65056,21 @@ function ImGui.TabBarScrollingButtons(tab_bar) -- window.DrawList:AddRect(ImVec2(tab_bar.BarRect.Max.x - scrolling_buttons_width, tab_bar.BarRect.Min.y), ImVec2(tab_bar.BarRect.Max.x, tab_bar.BarRect.Max.y), IM_COL32(255,0,0,255)) local select_dir = 0 - local tc = g.Style.Colors[ImGuiCol.Text] + local tc = g.Style.Colors[0 --[[ImGuiCol.Text]]] local arrow_col = ImVec4(tc.x, tc.y, tc.z, tc.w * 0.5) - ImGui.PushStyleColor(ImGuiCol.Text, arrow_col) - ImGui.PushStyleColor(ImGuiCol.Button, ImVec4(0, 0, 0, 0)) - ImGui.PushItemFlag(bit32.bor(ImGuiItemFlags.ButtonRepeat, ImGuiItemFlags.NoNav), true) + ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], arrow_col) + ImGui.PushStyleColor(22 --[[ImGuiCol.Button]], ImVec4(0, 0, 0, 0)) + ImGui.PushItemFlag(bit32.bor(8 --[[ImGuiItemFlags.ButtonRepeat]], 2 --[[ImGuiItemFlags.NoNav]]), true) local backup_repeat_delay = g.IO.KeyRepeatDelay local backup_repeat_rate = g.IO.KeyRepeatRate g.IO.KeyRepeatDelay = 0.250 g.IO.KeyRepeatRate = 0.200 local x = ImMax(tab_bar.BarRect.Min.x, tab_bar.BarRect.Max.x - scrolling_buttons_width) ImVec2_CopyV(window.DC.CursorPos, x, tab_bar.BarRect.Min.y) - if ImGui.ArrowButtonEx("##<", ImGuiDir.Left, arrow_button_size, ImGuiButtonFlags.PressedOnClick) then select_dir = -1 end + if ImGui.ArrowButtonEx("##<", 0 --[[ImGuiDir.Left]], arrow_button_size, 16 --[[ImGuiButtonFlags.PressedOnClick]]) then select_dir = -1 end ImVec2_CopyV(window.DC.CursorPos, x + arrow_button_size.x, tab_bar.BarRect.Min.y) - if ImGui.ArrowButtonEx("##>", ImGuiDir.Right, arrow_button_size, ImGuiButtonFlags.PressedOnClick) then select_dir = 1 end + if ImGui.ArrowButtonEx("##>", 1 --[[ImGuiDir.Right]], arrow_button_size, 16 --[[ImGuiButtonFlags.PressedOnClick]]) then select_dir = 1 end ImGui.PopItemFlag() ImGui.PopStyleColor(2) g.IO.KeyRepeatRate = backup_repeat_rate @@ -65048,7 +65091,7 @@ function ImGui.TabBarScrollingButtons(tab_bar) -- Cross through buttons -- (even if first/last item is a button, return it so we can update the scroll) - if bit32.band(tab_to_scroll_to.Flags, ImGuiTabItemFlags.Button) ~= 0 then + if bit32.band(tab_to_scroll_to.Flags, 2097152 --[[ImGuiTabItemFlags.Button]]) ~= 0 then target_order = target_order + select_dir selected_order = selected_order + select_dir if not (target_order < 0 or target_order >= tab_bar.Tabs.Size) then tab_to_scroll_to = nil end @@ -65072,17 +65115,17 @@ function ImGui.TabBarTabListPopupButton(tab_bar) ImVec2_CopyV(window.DC.CursorPos, tab_bar.BarRect.Min.x - g.Style.FramePadding.y, tab_bar.BarRect.Min.y) tab_bar.BarRect.Min.x = tab_bar.BarRect.Min.x + tab_list_popup_button_width - local tc = g.Style.Colors[ImGuiCol.Text] - ImGui.PushStyleColor(ImGuiCol.Text, ImVec4(tc.x, tc.y, tc.z, tc.w * 0.5)) - ImGui.PushStyleColor(ImGuiCol.Button, ImVec4(0, 0, 0, 0)) - local open = ImGui.BeginCombo("##v", nil, bit32.bor(ImGuiComboFlags.NoPreview, ImGuiComboFlags.HeightLargest)) + local tc = g.Style.Colors[0 --[[ImGuiCol.Text]]] + ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], ImVec4(tc.x, tc.y, tc.z, tc.w * 0.5)) + ImGui.PushStyleColor(22 --[[ImGuiCol.Button]], ImVec4(0, 0, 0, 0)) + local open = ImGui.BeginCombo("##v", nil, bit32.bor(64 --[[ImGuiComboFlags.NoPreview]], 16 --[[ImGuiComboFlags.HeightLargest]])) ImGui.PopStyleColor(2) local tab_to_select = nil if open then for n = 1, tab_bar.Tabs.Size do local tab = tab_bar.Tabs.Data[n] - if bit32.band(tab.Flags, ImGuiTabItemFlags.Button) == 0 then + if bit32.band(tab.Flags, 2097152 --[[ImGuiTabItemFlags.Button]]) == 0 then local tab_name = ImGui.TabBarGetTabName(tab_bar, tab) if ImGui.Selectable(tab_name, tab_bar.SelectedTabId == tab.ID) then tab_to_select = tab @@ -65117,12 +65160,12 @@ function ImGui.BeginTabItem(label, p_open, flags) if window.SkipItems then return false, p_open end local tab_bar = g.CurrentTabBar - IM_ASSERT(tab_bar ~= nil, "Needs to be called between BeginTabBar() and EndTabBar()!") - IM_ASSERT(bit32.band(flags, ImGuiTabItemFlags.Button) == 0) -- BeginTabItem() Can't be used with button flags, use TabItemButton() instead! + assert(tab_bar ~= nil, "Needs to be called between BeginTabBar() and EndTabBar()!") + assert(bit32.band(flags, 2097152 --[[ImGuiTabItemFlags.Button]]) == 0) -- BeginTabItem() Can't be used with button flags, use TabItemButton() instead! local ret ret, p_open = ImGui.TabItemEx(tab_bar, label, p_open, flags, nil) - if ret and bit32.band(flags, ImGuiTabItemFlags.NoPushId) == 0 then + if ret and bit32.band(flags, 8 --[[ImGuiTabItemFlags.NoPushId]]) == 0 then local tab = tab_bar.Tabs.Data[tab_bar.LastTabItemIdx + 1] ImGui.PushOverrideID(tab.ID) -- We already hashed 'label' so push into the ID stack directly instead of doing another hash through PushID(label) end @@ -65135,10 +65178,10 @@ function ImGui.EndTabItem() if window.SkipItems then return end local tab_bar = g.CurrentTabBar - IM_ASSERT(tab_bar ~= nil, "Needs to be called between BeginTabBar() and EndTabBar()!") - IM_ASSERT(tab_bar.LastTabItemIdx >= 0) + assert(tab_bar ~= nil, "Needs to be called between BeginTabBar() and EndTabBar()!") + assert(tab_bar.LastTabItemIdx >= 0) local tab = tab_bar.Tabs.Data[tab_bar.LastTabItemIdx + 1] - if bit32.band(tab.Flags, ImGuiTabItemFlags.NoPushId) == 0 then + if bit32.band(tab.Flags, 8 --[[ImGuiTabItemFlags.NoPushId]]) == 0 then ImGui.PopID() end end @@ -65149,8 +65192,8 @@ function ImGui.TabItemButton(label, flags) local window = g.CurrentWindow if window.SkipItems then return false end local tab_bar = g.CurrentTabBar - IM_ASSERT(tab_bar ~= nil, "Needs to be called between BeginTabBar() and EndTabBar()!") - return (ImGui.TabItemEx(tab_bar, label, nil, bit32.bor(flags, ImGuiTabItemFlags.Button, ImGuiTabItemFlags.NoReorder), nil)) + assert(tab_bar ~= nil, "Needs to be called between BeginTabBar() and EndTabBar()!") + return (ImGui.TabItemEx(tab_bar, label, nil, bit32.bor(flags, 2097152 --[[ImGuiTabItemFlags.Button]], 32 --[[ImGuiTabItemFlags.NoReorder]]), nil)) end function ImGui.TabItemSpacing(str_id, flags, width) @@ -65158,9 +65201,9 @@ function ImGui.TabItemSpacing(str_id, flags, width) local window = g.CurrentWindow if window.SkipItems then return end local tab_bar = g.CurrentTabBar - IM_ASSERT(tab_bar ~= nil, "Needs to be called between BeginTabBar() and EndTabBar()!") + assert(tab_bar ~= nil, "Needs to be called between BeginTabBar() and EndTabBar()!") ImGui.SetNextItemWidth(width) - ImGui.TabItemEx(tab_bar, str_id, nil, bit32.bor(flags or 0, ImGuiTabItemFlags.Button, ImGuiTabItemFlags.NoReorder, ImGuiTabItemFlags.Invisible), nil) + ImGui.TabItemEx(tab_bar, str_id, nil, bit32.bor(flags or 0, 2097152 --[[ImGuiTabItemFlags.Button]], 32 --[[ImGuiTabItemFlags.NoReorder]], 4194304 --[[ImGuiTabItemFlags.Invisible]]), nil) end --- @return bool ret, bool? p_open @@ -65182,19 +65225,19 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) -- If the user called us with p_open == false, we early out and don't render. -- We make a call to ItemAdd() so that attempts to use a contextual popup menu with an implicit ID won't use an older ID. if p_open ~= nil and not p_open then - ImGui.ItemAdd(ImRect(), id, nil, ImGuiItemFlags.NoNav) + ImGui.ItemAdd(ImRect(), id, nil, 2 --[[ImGuiItemFlags.NoNav]]) return false, p_open end - IM_ASSERT(p_open == nil or bit32.band(flags, ImGuiTabItemFlags.Button) == 0) - IM_ASSERT(bit32.band(flags, bit32.bor(ImGuiTabItemFlags.Leading, ImGuiTabItemFlags.Trailing)) ~= bit32.bor(ImGuiTabItemFlags.Leading, ImGuiTabItemFlags.Trailing)) -- Can't use both Leading and Trailing + assert(p_open == nil or bit32.band(flags, 2097152 --[[ImGuiTabItemFlags.Button]]) == 0) + assert(bit32.band(flags, bit32.bor(64 --[[ImGuiTabItemFlags.Leading]], 128 --[[ImGuiTabItemFlags.Trailing]])) ~= bit32.bor(64 --[[ImGuiTabItemFlags.Leading]], 128 --[[ImGuiTabItemFlags.Trailing]])) -- Can't use both Leading and Trailing -- Store into ImGuiTabItemFlags.NoCloseButton, also honor ImGuiTabItemFlags.NoCloseButton passed by user (although not documented) local has_p_open = (p_open ~= nil) - if bit32.band(flags, ImGuiTabItemFlags.NoCloseButton) ~= 0 then + if bit32.band(flags, 1048576 --[[ImGuiTabItemFlags.NoCloseButton]]) ~= 0 then has_p_open = false elseif not has_p_open then - flags = bit32.bor(flags, ImGuiTabItemFlags.NoCloseButton) + flags = bit32.bor(flags, 1048576 --[[ImGuiTabItemFlags.NoCloseButton]]) end -- Acquire tab data @@ -65210,9 +65253,9 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) tab_bar.LastTabItemIdx = ImGui.TabBarGetTabOrder(tab_bar, tab) -- Calculate tab contents size - local size = ImGui.TabItemCalcSize(label, has_p_open or bit32.band(flags, ImGuiTabItemFlags.UnsavedDocument) ~= 0) + local size = ImGui.TabItemCalcSize(label, has_p_open or bit32.band(flags, 1 --[[ImGuiTabItemFlags.UnsavedDocument]]) ~= 0) tab.RequestedWidth = -1.0 - if bit32.band(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasWidth) ~= 0 then + if bit32.band(g.NextItemData.HasFlags, 1 --[[ImGuiNextItemDataFlags.HasWidth]]) ~= 0 then size.x = g.NextItemData.Width tab.RequestedWidth = size.x end @@ -65222,10 +65265,10 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) tab_bar.TabsActiveCount = tab_bar.TabsActiveCount + 1 local tab_bar_appearing = (tab_bar.PrevFrameVisible + 1 < g.FrameCount) - local tab_bar_focused = bit32.band(tab_bar.Flags, ImGuiTabBarFlags.IsFocused) ~= 0 + local tab_bar_focused = bit32.band(tab_bar.Flags, 2097152 --[[ImGuiTabBarFlags.IsFocused]]) ~= 0 local tab_appearing = (tab.LastFrameVisible + 1 < g.FrameCount) - local tab_just_unsaved = bit32.band(flags, ImGuiTabItemFlags.UnsavedDocument) ~= 0 and bit32.band(tab.Flags, ImGuiTabItemFlags.UnsavedDocument) == 0 - local is_tab_button = bit32.band(flags, ImGuiTabItemFlags.Button) ~= 0 + local tab_just_unsaved = bit32.band(flags, 1 --[[ImGuiTabItemFlags.UnsavedDocument]]) ~= 0 and bit32.band(tab.Flags, 1 --[[ImGuiTabItemFlags.UnsavedDocument]]) == 0 + local is_tab_button = bit32.band(flags, 2097152 --[[ImGuiTabItemFlags.Button]]) ~= 0 tab.LastFrameVisible = g.FrameCount tab.Flags = flags tab.Window = docked_window @@ -65233,7 +65276,7 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) -- Append name (port: stored on tab.Name) -- (regular tabs are permitted in a DockNode tab bar, but window tabs not permitted in a non-DockNode tab bar) if docked_window ~= nil then - IM_ASSERT(bit32.band(tab_bar.Flags, ImGuiTabBarFlags.DockNode) ~= 0) + assert(bit32.band(tab_bar.Flags, 1048576 --[[ImGuiTabBarFlags.DockNode]]) ~= 0) tab.NameOffset = -1 tab.Name = nil else @@ -65243,12 +65286,12 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) -- Update selected tab if not is_tab_button then - if tab_appearing and bit32.band(tab_bar.Flags, ImGuiTabBarFlags.AutoSelectNewTabs) ~= 0 and tab_bar.NextSelectedTabId == 0 then + if tab_appearing and bit32.band(tab_bar.Flags, 2 --[[ImGuiTabBarFlags.AutoSelectNewTabs]]) ~= 0 and tab_bar.NextSelectedTabId == 0 then if not tab_bar_appearing or tab_bar.SelectedTabId == 0 then ImGui.TabBarQueueFocus(tab_bar, tab) -- New tabs gets activated end end - if bit32.band(flags, ImGuiTabItemFlags.SetSelected) ~= 0 and tab_bar.SelectedTabId ~= id then -- _SetSelected can only be passed on explicit tab bar + if bit32.band(flags, 2 --[[ImGuiTabItemFlags.SetSelected]]) ~= 0 and tab_bar.SelectedTabId ~= id then -- _SetSelected can only be passed on explicit tab bar ImGui.TabBarQueueFocus(tab_bar, tab) end end @@ -65260,7 +65303,7 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) -- On the very first frame of a tab bar we let first tab contents be visible to minimize appearing glitches if not tab_contents_visible and tab_bar.SelectedTabId == 0 and tab_bar_appearing and docked_window == nil then - if tab_bar.Tabs.Size == 1 and bit32.band(tab_bar.Flags, ImGuiTabBarFlags.AutoSelectNewTabs) == 0 then + if tab_bar.Tabs.Size == 1 and bit32.band(tab_bar.Flags, 2 --[[ImGuiTabBarFlags.AutoSelectNewTabs]]) == 0 then tab_contents_visible = true end end @@ -65268,7 +65311,7 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) -- Note that tab_is_new is not necessarily the same as tab_appearing! When a tab bar stops being submitted -- and then gets submitted again, the tabs will have 'tab_appearing=true' but 'tab_is_new=false'. if tab_appearing and (not tab_bar_appearing or tab_is_new) then - ImGui.ItemAdd(ImRect(), id, nil, ImGuiItemFlags.NoNav) + ImGui.ItemAdd(ImRect(), id, nil, 2 --[[ImGuiItemFlags.NoNav]]) if is_tab_button then return false, p_open end return tab_contents_visible, p_open end @@ -65279,7 +65322,7 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) local backup_main_cursor_pos = ImVec2(window.DC.CursorPos.x, window.DC.CursorPos.y) -- Layout - local is_central_section = bit32.band(tab.Flags, ImGuiTabItemFlags.SectionMask_) == 0 + local is_central_section = bit32.band(tab.Flags, 192 --[[ImGuiTabItemFlags.SectionMask_]]) == 0 size.x = tab.Width local pos = ImGui.TabBarGetTabPos(tab_bar, tab) ImVec2_Copy(window.DC.CursorPos, pos) @@ -65302,12 +65345,12 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) end -- Click to Select a tab - local button_flags = bit32.bor(is_tab_button and ImGuiButtonFlags.PressedOnClickRelease or ImGuiButtonFlags.PressedOnClick, ImGuiButtonFlags.AllowOverlap) + local button_flags = bit32.bor(is_tab_button and 32 --[[ImGuiButtonFlags.PressedOnClickRelease]] or 16 --[[ImGuiButtonFlags.PressedOnClick]], 4096 --[[ImGuiButtonFlags.AllowOverlap]]) if g.DragDropActive and not ImGuiPayload_IsDataType(g.DragDropPayload, IMGUI_PAYLOAD_TYPE_WINDOW) then -- FIXME: May be an opt-in property of the payload to disable this - button_flags = bit32.bor(button_flags, ImGuiButtonFlags.PressedOnDragDropHold) + button_flags = bit32.bor(button_flags, 512 --[[ImGuiButtonFlags.PressedOnDragDropHold]]) end local hovered, held, pressed - if bit32.band(flags, ImGuiTabItemFlags.Invisible) ~= 0 then + if bit32.band(flags, 4194304 --[[ImGuiTabItemFlags.Invisible]]) ~= 0 then hovered, held, pressed = false, false, false else pressed, hovered, held = ImGui.ButtonBehavior(bb, id, button_flags) @@ -65330,7 +65373,7 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) -- Drag and drop: re-order tabs local drag_dir = 0 local drag_distance_from_edge_x = 0.0 - if not g.DragDropActive and (bit32.band(tab_bar.Flags, ImGuiTabBarFlags.Reorderable) ~= 0 or docked_window ~= nil) then + if not g.DragDropActive and (bit32.band(tab_bar.Flags, 1 --[[ImGuiTabBarFlags.Reorderable]]) ~= 0 or docked_window ~= nil) then -- While moving a tab it will jump on the other side of the mouse, so we also test for MouseDelta.x if g.IO.MouseDelta.x < 0.0 and g.IO.MousePos.x < bb.Min.x then drag_dir = -1 @@ -65344,7 +65387,7 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) end -- Extract a Dockable window out of it's tab bar - local can_undock = docked_window ~= nil and bit32.band(docked_window.Flags, ImGuiWindowFlags.NoMove) == 0 and bit32.band(node.MergedFlags, ImGuiDockNodeFlags.NoUndocking) == 0 + local can_undock = docked_window ~= nil and bit32.band(docked_window.Flags, 4 --[[ImGuiWindowFlags.NoMove]]) == 0 and bit32.band(node.MergedFlags, 128 --[[ImGuiDockNodeFlags.NoUndocking]]) == 0 if can_undock then -- We use a variable threshold to distinguish dragging tabs within a tab bar and extracting them out of the tab bar local undocking_tab = (g.DragDropActive and g.DragDropPayload.SourceId == id) @@ -65377,19 +65420,19 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) end -- Render tab shape - local is_visible = bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.Visible) ~= 0 and bit32.band(flags, ImGuiTabItemFlags.Invisible) == 0 + local is_visible = bit32.band(g.LastItemData.StatusFlags, 256 --[[ImGuiItemStatusFlags.Visible]]) ~= 0 and bit32.band(flags, 4194304 --[[ImGuiTabItemFlags.Invisible]]) == 0 if is_visible then local display_draw_list = window.DrawList local col_idx - if held or hovered then col_idx = ImGuiCol.TabHovered - elseif tab_contents_visible then col_idx = tab_bar_focused and ImGuiCol.TabSelected or ImGuiCol.TabDimmedSelected - else col_idx = tab_bar_focused and ImGuiCol.Tab or ImGuiCol.TabDimmed end + if held or hovered then col_idx = 35 --[[ImGuiCol.TabHovered]] + elseif tab_contents_visible then col_idx = tab_bar_focused and 37 --[[ImGuiCol.TabSelected]] or 40 --[[ImGuiCol.TabDimmedSelected]] + else col_idx = tab_bar_focused and 36 --[[ImGuiCol.Tab]] or 39 --[[ImGuiCol.TabDimmed]] end ImGui.TabItemBackground(display_draw_list, bb, flags, ImGui.GetColorU32(col_idx)) - if tab_contents_visible and bit32.band(tab_bar.Flags, ImGuiTabBarFlags.DrawSelectedOverline) ~= 0 and style.TabBarOverlineSize > 0.0 then + if tab_contents_visible and bit32.band(tab_bar.Flags, 64 --[[ImGuiTabBarFlags.DrawSelectedOverline]]) ~= 0 and style.TabBarOverlineSize > 0.0 then -- Might be moved to TabItemBackground() ? local tl = ImVec2(bb.Min.x, bb.Min.y + style.TabBarOverlineSize * 0.5) local tr = ImVec2(bb.Max.x, bb.Min.y + style.TabBarOverlineSize * 0.5) - local overline_col = ImGui.GetColorU32(tab_bar_focused and ImGuiCol.TabSelectedOverline or ImGuiCol.TabDimmedSelectedOverline) + local overline_col = ImGui.GetColorU32(tab_bar_focused and 38 --[[ImGuiCol.TabSelectedOverline]] or 41 --[[ImGuiCol.TabDimmedSelectedOverline]]) if style.TabRounding > 0.0 then local rounding = style.TabRounding display_draw_list:PathArcToFast(tl + ImVec2(rounding, rounding), rounding, 7, 9) @@ -65402,18 +65445,18 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) ImGui.RenderNavCursor(bb, id) -- Select with right mouse button. This is so the common idiom for context menu automatically highlight the current widget. - local hovered_unblocked = ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenBlockedByPopup) + local hovered_unblocked = ImGui.IsItemHovered(32 --[[ImGuiHoveredFlags.AllowWhenBlockedByPopup]]) if tab_bar.SelectedTabId ~= tab.ID and hovered_unblocked and (ImGui.IsMouseClicked(1) or ImGui.IsMouseReleased(1)) and not is_tab_button then ImGui.TabBarQueueFocus(tab_bar, tab) end - if bit32.band(tab_bar.Flags, ImGuiTabBarFlags.NoCloseWithMiddleMouseButton) ~= 0 then - flags = bit32.bor(flags, ImGuiTabItemFlags.NoCloseWithMiddleMouseButton) + if bit32.band(tab_bar.Flags, 8 --[[ImGuiTabBarFlags.NoCloseWithMiddleMouseButton]]) ~= 0 then + flags = bit32.bor(flags, 4 --[[ImGuiTabItemFlags.NoCloseWithMiddleMouseButton]]) end -- Render tab label, process close button local close_button_id = has_p_open and ImGui.GetIDWithSeed("#CLOSE", nil, docked_window and docked_window.ID or id) or 0 - local label_flags = tab_just_unsaved and bit32.band(flags, bit32.bnot(ImGuiTabItemFlags.UnsavedDocument)) or flags + local label_flags = tab_just_unsaved and bit32.band(flags, bit32.bnot(1 --[[ImGuiTabItemFlags.UnsavedDocument]])) or flags local just_closed, text_clipped = ImGui.TabItemLabelAndCloseButton(display_draw_list, bb, label_flags, tab_bar.FramePadding, label, id, close_button_id, tab_contents_visible) if just_closed and has_p_open then p_open = false @@ -65423,7 +65466,7 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) -- Forward Hovered state so IsItemHovered() after Begin() can work (even though we are technically hovering our parent) -- That state is copied to window.DockTabItemStatusFlags by our caller. if docked_window and (hovered or g.HoveredId == close_button_id) then - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HoveredWindow) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 128 --[[ImGuiItemStatusFlags.HoveredWindow]]) end -- Tooltip @@ -65432,7 +65475,7 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) -- FIXME: This is a mess. -- FIXME: We may want disabled tab to still display the tooltip? if text_clipped and g.HoveredId == id and not held then - if bit32.band(tab_bar.Flags, ImGuiTabBarFlags.NoTooltip) == 0 and bit32.band(tab.Flags, ImGuiTabItemFlags.NoTooltip) == 0 then + if bit32.band(tab_bar.Flags, 32 --[[ImGuiTabBarFlags.NoTooltip]]) == 0 and bit32.band(tab.Flags, 16 --[[ImGuiTabItemFlags.NoTooltip]]) == 0 then local label_end = ImGui.FindRenderedTextEnd(label) ImGui.SetItemTooltip("%s", string.sub(label, 1, label_end - 1)) end @@ -65452,7 +65495,7 @@ end -- Tabs closed by the close button will automatically be flagged to avoid this issue. function ImGui.SetTabItemClosed(label) local g = ImGui.GetCurrentContext() - local is_within_manual_tab_bar = g.CurrentTabBar and bit32.band(g.CurrentTabBar.Flags, ImGuiTabBarFlags.DockNode) == 0 + local is_within_manual_tab_bar = g.CurrentTabBar and bit32.band(g.CurrentTabBar.Flags, 1048576 --[[ImGuiTabBarFlags.DockNode]]) == 0 if is_within_manual_tab_bar then local tab_bar = g.CurrentTabBar local tab_id = ImGui.TabBarCalcTabID(tab_bar, label, nil) @@ -65475,7 +65518,7 @@ end function ImGui.TabItemCalcSize(label, has_close_button_or_unsaved_marker) if type(label) == "table" then local window = label - return ImGui.TabItemCalcSize(window.Name, window.HasCloseButton or bit32.band(window.Flags, ImGuiWindowFlags.UnsavedDocument) ~= 0) + return ImGui.TabItemCalcSize(window.Name, window.HasCloseButton or bit32.band(window.Flags, 262144 --[[ImGuiWindowFlags.UnsavedDocument]]) ~= 0) end local g = ImGui.GetCurrentContext() local label_size = ImGui.CalcTextSize(label, nil, true) @@ -65492,17 +65535,17 @@ function ImGui.TabItemBackground(draw_list, bb, flags, col) -- While rendering tabs, we trim 1 pixel off the top of our bounding box so they can fit within a regular frame height while looking "detached" from it. local g = ImGui.GetCurrentContext() local width = bb:GetWidth() - IM_ASSERT(width > 0.0) - local rounding = ImMax(0.0, ImMin(bit32.band(flags, ImGuiTabItemFlags.Button) ~= 0 and g.Style.FrameRounding or g.Style.TabRounding, width * 0.5 - 1.0)) + assert(width > 0.0) + local rounding = ImMax(0.0, ImMin(bit32.band(flags, 2097152 --[[ImGuiTabItemFlags.Button]]) ~= 0 and g.Style.FrameRounding or g.Style.TabRounding, width * 0.5 - 1.0)) local y1 = bb.Min.y + 1.0 -- Leave a bit of room in title bars. local y2 = bb.Max.y - g.Style.TabBarBorderSize - draw_list:AddRectFilled(ImVec2(bb.Min.x, y1), ImVec2(bb.Max.x, y2), col, rounding, ImDrawFlags.RoundCornersTop) + draw_list:AddRectFilled(ImVec2(bb.Min.x, y1), ImVec2(bb.Max.x, y2), col, rounding, 48 --[[ImDrawFlags.RoundCornersTop]]) if g.Style.TabBorderSize > 0.0 then draw_list:PathLineTo(ImVec2(bb.Min.x, y2)) 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(ImGuiCol.Border), g.Style.TabBorderSize) + draw_list:PathStroke(ImGui.GetColorU32(5 --[[ImGuiCol.Border]]), g.Style.TabBorderSize) end end @@ -65544,10 +65587,10 @@ function ImGui.TabItemLabelAndCloseButton(draw_list, bb, flags, frame_padding, l end -- When tabs/document is unsaved, the unsaved marker takes priority over the close button. - local unsaved_marker_visible = bit32.band(flags, ImGuiTabItemFlags.UnsavedDocument) ~= 0 and (button_pos.x + button_sz <= bb.Max.x) and (not close_button_visible or not is_hovered) + local unsaved_marker_visible = bit32.band(flags, 1 --[[ImGuiTabItemFlags.UnsavedDocument]]) ~= 0 and (button_pos.x + button_sz <= bb.Max.x) and (not close_button_visible or not is_hovered) if unsaved_marker_visible then local bullet_pos = button_pos + ImVec2(button_sz, button_sz) * 0.5 - ImGui.RenderBullet(draw_list, bullet_pos, ImGui.GetColorU32(ImGuiCol.UnsavedMarker)) + ImGui.RenderBullet(draw_list, bullet_pos, ImGui.GetColorU32(58 --[[ImGuiCol.UnsavedMarker]])) elseif close_button_visible then local last_item_backup = ImGuiLastItemData() ImGuiLastItemData_Copy(last_item_backup, g.LastItemData) @@ -65555,7 +65598,7 @@ function ImGui.TabItemLabelAndCloseButton(draw_list, bb, flags, frame_padding, l ImGuiLastItemData_Copy(g.LastItemData, last_item_backup) -- Close with middle mouse button - if is_hovered and bit32.band(flags, ImGuiTabItemFlags.NoCloseWithMiddleMouseButton) == 0 and ImGui.IsMouseClicked(2) then + if is_hovered and bit32.band(flags, 4 --[[ImGuiTabItemFlags.NoCloseWithMiddleMouseButton]]) == 0 and ImGui.IsMouseClicked(2) then close_button_pressed = true end end @@ -66562,7 +66605,7 @@ end --- @nodiscard local function StbUndoState() local undo_rec = {} - for i = 1, IMSTB_TEXTEDIT_UNDOSTATECOUNT do + for i = 1, 99 --[[IMSTB_TEXTEDIT_UNDOSTATECOUNT]] do undo_rec[i] = StbUndoRecord() end @@ -66777,7 +66820,7 @@ function stb_text_locate_coord(str, x, y) -- if the last character is a newline, return that. otherwise return 'after' the last character out_side_on_line = true - if STB_TEXTEDIT_GETCHAR(str, i + r.num_chars - 1) == STB_TEXTEDIT_NEWLINE then + if STB_TEXTEDIT_GETCHAR(str, i + r.num_chars - 1) == 10 --[[STB_TEXTEDIT_NEWLINE]] then return i + r.num_chars - 1, out_side_on_line else return i + r.num_chars, out_side_on_line @@ -66809,7 +66852,7 @@ function stb_textedit_click(str, state, x, y) state.select_start = state.cursor state.select_end = state.cursor state.has_preferred_x = false - str.LastMoveDirectionLR = side_on_line and ImGuiDir.Right or ImGuiDir.Left + str.LastMoveDirectionLR = side_on_line and 1 --[[ImGuiDir.Right]] or 0 --[[ImGuiDir.Left]] end end @@ -66842,7 +66885,7 @@ function stb_textedit_drag(str, state, x, y) p, side_on_line = stb_text_locate_coord(str, x, y) state.cursor = p state.select_end = p - str.LastMoveDirectionLR = (side_on_line ~= false) and ImGuiDir.Right or ImGuiDir.Left + str.LastMoveDirectionLR = (side_on_line ~= false) and 1 --[[ImGuiDir.Right]] or 0 --[[ImGuiDir.Left]] end end @@ -66924,10 +66967,10 @@ function stb_textedit_find_charpos(find, str, n, single_line) if n < i + r.num_chars - 1 then break end - if str.LastMoveDirectionLR == ImGuiDir.Right and str.Stb.cursor > 1 and str.Stb.cursor == i + r.num_chars and STB_TEXTEDIT_GETCHAR(str, i + r.num_chars - 1) ~= STB_TEXTEDIT_NEWLINE then -- [DEAR IMGUI] Wrapping point handling + if str.LastMoveDirectionLR == 1 --[[ImGuiDir.Right]] and str.Stb.cursor > 1 and str.Stb.cursor == i + r.num_chars and STB_TEXTEDIT_GETCHAR(str, i + r.num_chars - 1) ~= 10 --[[STB_TEXTEDIT_NEWLINE]] then -- [DEAR IMGUI] Wrapping point handling break end - if (i - 1) + r.num_chars == z and z > 0 and STB_TEXTEDIT_GETCHAR(str, z) ~= STB_TEXTEDIT_NEWLINE then -- [DEAR IMGUI] special handling for last line + if (i - 1) + r.num_chars == z and z > 0 and STB_TEXTEDIT_GETCHAR(str, z) ~= 10 --[[STB_TEXTEDIT_NEWLINE]] then -- [DEAR IMGUI] special handling for last line break -- [DEAR IMGUI] end prev_start = i @@ -67090,7 +67133,7 @@ end --- @param text_len int local function stb_textedit_text(str, state, text, text_len) -- can't add newline in single-line mode - if text[1] == STB_TEXTEDIT_NEWLINE and state.single_line then + if text[1] == 10 --[[STB_TEXTEDIT_NEWLINE]] and state.single_line then return end @@ -67123,13 +67166,13 @@ local row = StbTexteditRow() --- @param state STB_TexteditState --- @param key STB_TEXTEDIT_KEYTYPE function stb_textedit_key(str, state, key) - if key == STB_TEXTEDIT_K_UNDO then + if key == 2097162 --[[STB_TEXTEDIT_K_UNDO]] then stb_text_undo(str, state) state.has_preferred_x = false - elseif key == STB_TEXTEDIT_K_REDO then + elseif key == 2097163 --[[STB_TEXTEDIT_K_REDO]] then stb_text_redo(str, state) state.has_preferred_x = false - elseif key == STB_TEXTEDIT_K_LEFT then + elseif key == 2097152 --[[STB_TEXTEDIT_K_LEFT]] then -- if currently there's a selection, move cursor to start of selection if STB_TEXT_HAS_SELECTION(state) then stb_textedit_move_to_first(state) @@ -67140,7 +67183,7 @@ function stb_textedit_key(str, state, key) end state.has_preferred_x = false - elseif key == STB_TEXTEDIT_K_RIGHT then + elseif key == 2097153 --[[STB_TEXTEDIT_K_RIGHT]] then -- if currently there's a selection, move cursor to end of selection if STB_TEXT_HAS_SELECTION(state) then stb_textedit_move_to_last(str, state) @@ -67150,7 +67193,7 @@ function stb_textedit_key(str, state, key) stb_textedit_clamp(str, state) state.has_preferred_x = false - elseif key == bit32.bor(STB_TEXTEDIT_K_LEFT, STB_TEXTEDIT_K_SHIFT) then + elseif key == bit32.bor(2097152 --[[STB_TEXTEDIT_K_LEFT]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then stb_textedit_clamp(str, state) stb_textedit_prep_selection_at_cursor(state) -- move selection left @@ -67159,7 +67202,7 @@ function stb_textedit_key(str, state, key) end state.cursor = state.select_end state.has_preferred_x = false - elseif key == STB_TEXTEDIT_K_WORDLEFT then + elseif key == 2097164 --[[STB_TEXTEDIT_K_WORDLEFT]] then -- if currently there's a selection, move cursor to start of selection if STB_TEXT_HAS_SELECTION(state) then stb_textedit_move_to_first(state) @@ -67167,7 +67210,7 @@ function stb_textedit_key(str, state, key) state.cursor = STB_TEXTEDIT_MOVEWORDLEFT(str, state.cursor) stb_textedit_clamp(str, state) end - elseif key == bit32.bor(STB_TEXTEDIT_K_WORDLEFT, STB_TEXTEDIT_K_SHIFT) then + elseif key == bit32.bor(2097164 --[[STB_TEXTEDIT_K_WORDLEFT]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then if not STB_TEXT_HAS_SELECTION(state) then stb_textedit_prep_selection_at_cursor(state) end @@ -67176,7 +67219,7 @@ function stb_textedit_key(str, state, key) state.select_end = state.cursor stb_textedit_clamp(str, state) - elseif key == STB_TEXTEDIT_K_WORDRIGHT then + elseif key == 2097165 --[[STB_TEXTEDIT_K_WORDRIGHT]] then -- if currently there's a selection, move cursor to end of selection if STB_TEXT_HAS_SELECTION(state) then stb_textedit_move_to_last(str, state) @@ -67184,7 +67227,7 @@ function stb_textedit_key(str, state, key) state.cursor = STB_TEXTEDIT_MOVEWORDRIGHT(str, state.cursor) stb_textedit_clamp(str, state) end - elseif key == bit32.bor(STB_TEXTEDIT_K_WORDRIGHT, STB_TEXTEDIT_K_SHIFT) then + elseif key == bit32.bor(2097165 --[[STB_TEXTEDIT_K_WORDRIGHT]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then if not STB_TEXT_HAS_SELECTION(state) then stb_textedit_prep_selection_at_cursor(state) end @@ -67193,27 +67236,27 @@ function stb_textedit_key(str, state, key) state.select_end = state.cursor stb_textedit_clamp(str, state) - elseif key == bit32.bor(STB_TEXTEDIT_K_RIGHT, STB_TEXTEDIT_K_SHIFT) then + elseif key == bit32.bor(2097153 --[[STB_TEXTEDIT_K_RIGHT]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then stb_textedit_prep_selection_at_cursor(state) -- move selection right state.select_end = IMSTB_TEXTEDIT_GETNEXTCHARINDEX(str, state.select_end) stb_textedit_clamp(str, state) state.cursor = state.select_end state.has_preferred_x = false - elseif key == STB_TEXTEDIT_K_DOWN - or key == bit32.bor(STB_TEXTEDIT_K_DOWN, STB_TEXTEDIT_K_SHIFT) - or key == STB_TEXTEDIT_K_PGDOWN - or key == bit32.bor(STB_TEXTEDIT_K_PGDOWN, STB_TEXTEDIT_K_SHIFT) then + elseif key == 2097155 --[[STB_TEXTEDIT_K_DOWN]] + or key == bit32.bor(2097155 --[[STB_TEXTEDIT_K_DOWN]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) + or key == 2097167 --[[STB_TEXTEDIT_K_PGDOWN]] + or key == bit32.bor(2097167 --[[STB_TEXTEDIT_K_PGDOWN]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then StbFindState_Reset(find) StbTexteditRow_Reset(row) - local sel = (bit32.band(key, STB_TEXTEDIT_K_SHIFT) ~= 0) - local is_page = (bit32.band(key, bit32.bnot(STB_TEXTEDIT_K_SHIFT)) == STB_TEXTEDIT_K_PGDOWN) + local sel = (bit32.band(key, 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) ~= 0) + local is_page = (bit32.band(key, bit32.bnot(4194304 --[[STB_TEXTEDIT_K_SHIFT]])) == 2097167 --[[STB_TEXTEDIT_K_PGDOWN]]) local row_count = is_page and state.row_count_per_page or 1 if not is_page and state.single_line then -- on windows, up&down in single-line behave like left&right - key = bit32.bor(STB_TEXTEDIT_K_RIGHT, bit32.band(key, STB_TEXTEDIT_K_SHIFT)) + key = bit32.bor(2097153 --[[STB_TEXTEDIT_K_RIGHT]], bit32.band(key, 4194304 --[[STB_TEXTEDIT_K_SHIFT]])) return stb_textedit_key(str, state, key) -- was `goto retry` end @@ -67260,7 +67303,7 @@ function stb_textedit_key(str, state, key) stb_textedit_clamp(str, state) if state.cursor == find.first_char + find.length then - str.LastMoveDirectionLR = ImGuiDir.Left + str.LastMoveDirectionLR = 0 --[[ImGuiDir.Left]] end state.has_preferred_x = true state.preferred_x = goal_x @@ -67273,20 +67316,20 @@ function stb_textedit_key(str, state, key) find.first_char = find.first_char + find.length find.length = row.num_chars end - elseif key == STB_TEXTEDIT_K_UP - or key == bit32.bor(STB_TEXTEDIT_K_UP, STB_TEXTEDIT_K_SHIFT) - or key == STB_TEXTEDIT_K_PGUP - or key == bit32.bor(STB_TEXTEDIT_K_PGUP, STB_TEXTEDIT_K_SHIFT) then + elseif key == 2097154 --[[STB_TEXTEDIT_K_UP]] + or key == bit32.bor(2097154 --[[STB_TEXTEDIT_K_UP]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) + or key == 2097166 --[[STB_TEXTEDIT_K_PGUP]] + or key == bit32.bor(2097166 --[[STB_TEXTEDIT_K_PGUP]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then StbFindState_Reset(find) StbTexteditRow_Reset(row) - local sel = (bit32.band(key, STB_TEXTEDIT_K_SHIFT) ~= 0) - local is_page = (bit32.band(key, bit32.bnot(STB_TEXTEDIT_K_SHIFT)) == STB_TEXTEDIT_K_PGUP) + local sel = (bit32.band(key, 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) ~= 0) + local is_page = (bit32.band(key, bit32.bnot(4194304 --[[STB_TEXTEDIT_K_SHIFT]])) == 2097166 --[[STB_TEXTEDIT_K_PGUP]]) local row_count = is_page and state.row_count_per_page or 1 if not is_page and state.single_line then -- on windows, up&down become left&right - key = bit32.bor(STB_TEXTEDIT_K_LEFT, bit32.band(key, STB_TEXTEDIT_K_SHIFT)) + key = bit32.bor(2097152 --[[STB_TEXTEDIT_K_LEFT]], bit32.band(key, 4194304 --[[STB_TEXTEDIT_K_SHIFT]])) return stb_textedit_key(str, state, key) -- was `goto retry` end @@ -67332,9 +67375,9 @@ function stb_textedit_key(str, state, key) stb_textedit_clamp(str, state) if state.cursor == find.first_char then - str.LastMoveDirectionLR = ImGuiDir.Right + str.LastMoveDirectionLR = 1 --[[ImGuiDir.Right]] elseif state.cursor == find.prev_first then - str.LastMoveDirectionLR = ImGuiDir.Left + str.LastMoveDirectionLR = 0 --[[ImGuiDir.Left]] end state.has_preferred_x = true state.preferred_x = goal_x @@ -67348,7 +67391,7 @@ function stb_textedit_key(str, state, key) local prev_scan = find.prev_first > 1 and find.prev_first - 1 or 1 while prev_scan > 1 do local prev = IMSTB_TEXTEDIT_GETPREVCHARINDEX(str, prev_scan) - if STB_TEXTEDIT_GETCHAR(str, prev) == STB_TEXTEDIT_NEWLINE then + if STB_TEXTEDIT_GETCHAR(str, prev) == 10 --[[STB_TEXTEDIT_NEWLINE]] then break end prev_scan = prev @@ -67356,8 +67399,8 @@ function stb_textedit_key(str, state, key) find.first_char = find.prev_first find.prev_first = STB_TEXTEDIT_MOVELINESTART(str, state, prev_scan) end - elseif key == STB_TEXTEDIT_K_DELETE - or key == bit32.bor(STB_TEXTEDIT_K_DELETE, STB_TEXTEDIT_K_SHIFT) then + elseif key == 2097160 --[[STB_TEXTEDIT_K_DELETE]] + or key == bit32.bor(2097160 --[[STB_TEXTEDIT_K_DELETE]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then if STB_TEXT_HAS_SELECTION(state) then stb_textedit_delete_selection(str, state) @@ -67368,8 +67411,8 @@ function stb_textedit_key(str, state, key) end end state.has_preferred_x = false - elseif key == STB_TEXTEDIT_K_BACKSPACE - or key == bit32.bor(STB_TEXTEDIT_K_BACKSPACE, STB_TEXTEDIT_K_SHIFT) then + elseif key == 2097161 --[[STB_TEXTEDIT_K_BACKSPACE]] + or key == bit32.bor(2097161 --[[STB_TEXTEDIT_K_BACKSPACE]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then if STB_TEXT_HAS_SELECTION(state) then stb_textedit_delete_selection(str, state) @@ -67382,43 +67425,43 @@ function stb_textedit_key(str, state, key) end end state.has_preferred_x = false - elseif key == STB_TEXTEDIT_K_TEXTSTART then + elseif key == 2097158 --[[STB_TEXTEDIT_K_TEXTSTART]] then state.cursor = 1 state.select_start = 1 state.select_end = 1 state.has_preferred_x = false - elseif key == STB_TEXTEDIT_K_TEXTEND then + elseif key == 2097159 --[[STB_TEXTEDIT_K_TEXTEND]] then state.cursor = STB_TEXTEDIT_STRINGLEN(str) + 1 state.select_start = 1 state.select_end = 1 state.has_preferred_x = false - elseif key == bit32.bor(STB_TEXTEDIT_K_TEXTSTART, STB_TEXTEDIT_K_SHIFT) then + elseif key == bit32.bor(2097158 --[[STB_TEXTEDIT_K_TEXTSTART]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then stb_textedit_prep_selection_at_cursor(state) state.cursor = 1 state.select_end = 1 state.has_preferred_x = false - elseif key == bit32.bor(STB_TEXTEDIT_K_TEXTEND, STB_TEXTEDIT_K_SHIFT) then + elseif key == bit32.bor(2097159 --[[STB_TEXTEDIT_K_TEXTEND]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then stb_textedit_prep_selection_at_cursor(state) state.cursor = STB_TEXTEDIT_STRINGLEN(str) + 1 state.select_end = state.cursor state.has_preferred_x = false - elseif key == STB_TEXTEDIT_K_LINESTART then + elseif key == 2097156 --[[STB_TEXTEDIT_K_LINESTART]] then stb_textedit_clamp(str, state) stb_textedit_move_to_first(state) state.cursor = STB_TEXTEDIT_MOVELINESTART(str, state, state.cursor) state.has_preferred_x = false - elseif key == STB_TEXTEDIT_K_LINEEND then + elseif key == 2097157 --[[STB_TEXTEDIT_K_LINEEND]] then stb_textedit_clamp(str, state) stb_textedit_move_to_last(str, state) state.cursor = STB_TEXTEDIT_MOVELINEEND(str, state, state.cursor) state.has_preferred_x = false - elseif key == bit32.bor(STB_TEXTEDIT_K_LINESTART, STB_TEXTEDIT_K_SHIFT) then + elseif key == bit32.bor(2097156 --[[STB_TEXTEDIT_K_LINESTART]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then stb_textedit_clamp(str, state) stb_textedit_prep_selection_at_cursor(state) state.cursor = STB_TEXTEDIT_MOVELINESTART(str, state, state.cursor) state.select_end = state.cursor state.has_preferred_x = false - elseif key == bit32.bor(STB_TEXTEDIT_K_LINEEND, STB_TEXTEDIT_K_SHIFT) then + elseif key == bit32.bor(2097157 --[[STB_TEXTEDIT_K_LINEEND]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then stb_textedit_clamp(str, state) stb_textedit_prep_selection_at_cursor(state) state.cursor = STB_TEXTEDIT_MOVELINEEND(str, state, state.cursor) @@ -67438,7 +67481,7 @@ end --- @param state StbUndoState local function stb_textedit_flush_redo(state) - state.redo_point = IMSTB_TEXTEDIT_UNDOSTATECOUNT + 1 + state.redo_point = 99 --[[IMSTB_TEXTEDIT_UNDOSTATECOUNT]] + 1 state.redo_char_point = IMSTB_TEXTEDIT_UNDOCHARCOUNT + 1 end @@ -67469,7 +67512,7 @@ end -- fill up even though the undo buffer didn't --- @param state StbUndoState local function stb_textedit_discard_redo(state) - local k = IMSTB_TEXTEDIT_UNDOSTATECOUNT + local k = 99 --[[IMSTB_TEXTEDIT_UNDOSTATECOUNT]] if state.redo_point <= k then -- if the k'th undo state has characters, clean those up @@ -67488,7 +67531,7 @@ local function stb_textedit_discard_redo(state) -- now move all the redo records towards the end of the buffer; the first one is at 'redo_point' -- [DEAR IMGUI] - local move_size = IMSTB_TEXTEDIT_UNDOSTATECOUNT - state.redo_point - 1 + local move_size = 99 --[[IMSTB_TEXTEDIT_UNDOSTATECOUNT]] - state.redo_point - 1 IMSTB_TEXTEDIT_memmove(state.undo_rec, state.redo_point + 1, state.undo_rec, state.redo_point, move_size) -- now move redo_point to point to the new one @@ -67504,7 +67547,7 @@ local function stb_text_create_undo_record(state, numchars) -- if we have no free records, we have to make room, by sliding the -- existing records down - if state.undo_point == IMSTB_TEXTEDIT_UNDOSTATECOUNT then + if state.undo_point == 99 --[[IMSTB_TEXTEDIT_UNDOSTATECOUNT]] then stb_textedit_discard_undo(state) end @@ -67586,7 +67629,7 @@ function stb_text_undo(str, state) -- there's definitely room to store the characters eventually while s.undo_char_point + u.delete_length > s.redo_char_point do -- should never happen: - if s.redo_point == IMSTB_TEXTEDIT_UNDOSTATECOUNT + 1 then + if s.redo_point == 99 --[[IMSTB_TEXTEDIT_UNDOSTATECOUNT]] + 1 then return end @@ -67625,7 +67668,7 @@ end --- @param state STB_TexteditState function stb_text_redo(str, state) local s = state.undostate - if s.undo_point == IMSTB_TEXTEDIT_UNDOSTATECOUNT + 1 then + if s.undo_point == 99 --[[IMSTB_TEXTEDIT_UNDOSTATECOUNT]] + 1 then return end @@ -67715,7 +67758,7 @@ end local function stb_textedit_clear_state(state, is_single_line) state.undostate.undo_point = 1 state.undostate.undo_char_point = 1 - state.undostate.redo_point = IMSTB_TEXTEDIT_UNDOSTATECOUNT + 1 + state.undostate.redo_point = 99 --[[IMSTB_TEXTEDIT_UNDOSTATECOUNT]] + 1 state.undostate.redo_char_point = IMSTB_TEXTEDIT_UNDOCHARCOUNT + 1 state.select_end = 1 state.select_start = 1 @@ -70619,8 +70662,8 @@ end -- we force this behavior by default local function clamp_if_overflow(spec, val) if spec == CHAR_d or spec == CHAR_x or spec == CHAR_X then - if val > INT_MAX then return INT_MAX end - if val < INT_MIN then return INT_MIN end + if val > 2147483647 --[[INT_MAX]] then return 2147483647 --[[INT_MAX]] end + if val < (-2147483648) --[[INT_MIN]] then return (-2147483648) --[[INT_MIN]] end end return val diff --git a/build/imgui_love.linemap.json b/build/imgui_love.linemap.json index e3cc3b2..9e37dd8 100644 --- a/build/imgui_love.linemap.json +++ b/build/imgui_love.linemap.json @@ -1 +1 @@ -[[149, "imgui.lua"], [21492, "imgui_demo.lua"], [29910, "imgui_draw.lua"], [35848, "imgui_h.lua"], [38514, "imgui_impl_love.lua"], [39054, "imgui_internal.lua"], [42515, "imgui_tables.lua"], [47574, "imgui_widgets.lua"], [58214, "imstb_rectpack.lua"], [58878, "imstb_textedit.lua"], [60420, "imstb_truetype.lua"], [63208, "imstd_minstdio.lua"]] \ No newline at end of file +[[183, "imgui.lua"], [21526, "imgui_demo.lua"], [29944, "imgui_draw.lua"], [35882, "imgui_h.lua"], [38549, "imgui_impl_love.lua"], [39089, "imgui_internal.lua"], [42558, "imgui_tables.lua"], [47617, "imgui_widgets.lua"], [58257, "imstb_rectpack.lua"], [58921, "imstb_textedit.lua"], [60463, "imstb_truetype.lua"], [63251, "imstd_minstdio.lua"]] \ No newline at end of file diff --git a/build/imgui_love.lua b/build/imgui_love.lua index 2b5c250..aa7cdeb 100644 --- a/build/imgui_love.lua +++ b/build/imgui_love.lua @@ -138,6 +138,40 @@ if not utf8 then end +local ImGui, ImVec2, ImVec4, ImRect, ImVec2_Copy, ImStd, ImVector, ImGuiKey, HelpMarker, IMGUI_DEMO_MARKER, ImGuiInputFlags, ImRect_Copy, ImGuiDataType, ImStb, IM_TRUNC, ImGuiStyleVarInfo, ImVec2_CopyV, IM_ASSERT_USER_ERROR, ImGuiHoveredFlags, ImFormatString, ImHashStr, ImS32, ImGuiColorEditFlags, IM_ASSERT_USER_ERROR_RET, ImDrawFlags, ImGuiTableFlags, ImIsPowerOfTwo, ImGuiWindowFlags, ImVec4_Copy, IM_ROUND, ImGuiTreeNodeFlags, ImGuiTableColumnFlags, ImU16, ImAbs, ImGuiItemFlags, stbte, ImGuiButtonFlags, ImGuiDebugLogFlags, ImGuiLocKey, ImU32, ImCos, ImGuiTabBarFlags, ImS16, ImSin, ImUpperPowerOfTwo, ImVec2_MulVX, IM_F32_TO_INT8_SAT, ImCeil, ImFontAtlasPackGetRect, ImGuiListClipper, ImGuiMouseCursor, DockSettingsRenameNodeReferences, IM_ASSERT_PARANOID, ImGuiCol, ImGuiTextFilter, ImLengthSqr, ImS8, ImU8, _PathArcToFastExXY, ImGuiScrollFlags, ImGui_ImplLOVE_GetBackendData, ImLog, ImGuiComboFlags, ImPow, DemoHas, IMGUI_DEBUG_LOG_FONT, ImAddClampOverflow, ImFontAtlasBuildInit, ImFontCalcWordWrapPositionEx, ImGuiPopupFlags, ImGuiSliderFlags, ImTextClassifierSetCharClass, ImVec2_AddVA, ImVec2_SubVA, DemoNotPorted, ImFontAtlasBakedAddFontGlyph, ImFontAtlasPackAddRect, ImFontBaked_BuildLoadGlyph, ImGuiInputTextFlags, ShowExampleMenuFile, ExampleTree_CreateNode, ImFontAtlasBuildRenderBitmapFromString, ImFontAtlasFontDestroyOutput, ImFontAtlasFontSourceAddToFont, ImFontAtlasFontSourceInit, ImGuiFocusedFlags, ImGuiTableColumn, stb_textedit_key, stbtt_GetGlyphBitmapBoxSubpixel, IMGUI_PAYLOAD_TYPE_COLOR_4F, IM_FREE, ImDrawListSplitter, ImGuiDragDropFlags, stb_text_locate_coord, stb_text_makeundo_insert, stb_text_makeundo_replace, stb_textedit_find_charpos, stbtt_GetGlyphShape, DemoClamp, DemoItems, DemoWindowLayout, DemoWindowPopups, DemoWindowTables, ExampleTree_CreateDemoTree, IMGUI_PAYLOAD_TYPE_COLOR_3F, ImGuiTableColumnSortSpecs, ImGuiTableInstanceData, ImGuiTableSettings, ShowDockingDisabledMessage, ShowExampleAppMainMenuBar, stb_text_makeundo_delete, stb_text_redo, stb_text_undo, stb_textedit_click, stb_textedit_drag, stbtt_FindGlyphIndex, stbtt_GetFontOffsetForIndex, stbtt_GetFontVMetrics, stbtt_GetGlyphBitmapBox, stbtt_GetGlyphHMetrics, stbtt_InitFont, stbtt_MakeGlyphBitmapSubpixelPrefilter, stbtt_ScaleForPixelHeight, stbtt__GetGlyphInfoT2, stbtt__GetGlyphShapeT2, stbtt_fontinfo, DemoNotSupported, DemoWindowWidgets, DemoWindowWidgetsBasic, DemoWindowWidgetsBullets, DemoWindowWidgetsCollapsingHeaders, DemoWindowWidgetsColorAndPickers, DemoWindowWidgetsComboBoxes, DemoWindowWidgetsDataTypes, ImGuiOldColumnData, ImGuiOldColumnFlags, ImGuiOldColumns, ImGuiTable, ImGuiTableColumnSettings, ImGuiTableSortSpecs, ImGuiTableTempData, ImGui_ImplLOVE_CreateTexture, ImGui_ImplLOVE_DestroyTexture, ImGui_ImplLOVE_Init, ImGui_ImplLOVE_NewFrame, ImGui_ImplLOVE_RenderDrawData, ImGui_ImplLOVE_Shutdown, ImGui_ImplLOVE_UpdateTexture, stbrp_init_target, IMGUI_TABLE_MAX_COLUMNS, IMSTB_TEXTEDIT_UNDOSTATECOUNT, IM_COL32_DISABLE, ImGui_ImplLove, STB_TEXTEDIT_K_BACKSPACE, STB_TEXTEDIT_K_DELETE, STB_TEXTEDIT_K_DOWN, STB_TEXTEDIT_K_LEFT, STB_TEXTEDIT_K_LINEEND, STB_TEXTEDIT_K_LINESTART, STB_TEXTEDIT_K_PGDOWN +local type, mathMin, mathMax, mathFloor, mathCeil, bitOr, bitLShift = type, math.min, math.max, math.floor, math.ceil, bit32.bor, bit32.lshift +local function IM_COL32(R, G, B, A) return (bitOr(bitLShift(A, 24 --[[IM_COL32_A_SHIFT]]), bitLShift(B, 16 --[[IM_COL32_B_SHIFT]]), bitLShift(G, 8 --[[IM_COL32_G_SHIFT]]), bitLShift(R, 0 --[[IM_COL32_R_SHIFT]]))) end + +local function ImMin(lhs, rhs) + if type(lhs) == "number" then return mathMin(lhs, rhs) end + return ImVec2(mathMin(lhs.x, rhs.x), mathMin(lhs.y, rhs.y)) +end + +local function ImMax(lhs, rhs) + if type(lhs) == "number" then return mathMax(lhs, rhs) end + return ImVec2(mathMax(lhs.x, rhs.x), mathMax(lhs.y, rhs.y)) +end + +local function ImClamp(v, mn, mx) + if type(v) == "number" and type(mn) == "number" and type(mx) == "number" then return mathMin(mathMax(v, mn), mx) + elseif type(v) == "table" and type(mn) == "table" and type(mx) == "table" then return ImVec2(mathMax(mn.x, mathMin(v.x, mx.x)), mathMax(mn.y, mathMin(v.y, mx.y))) + end +end + +local function ImLerp(a, b, t) + if type(a) == "number" and type(b) == "number" and type(t) == "number" then return ((a) + ((b) - (a)) * (t)) + elseif type(a) == "table" and type(b) == "table" and type(t) == "number" then return ImVec2(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t) + elseif type(a) == "table" and type(b) == "table" and type(t) == "table" then return ImVec2(a.x + (b.x - a.x) * t.x, a.y + (b.y - a.y) * t.y) + end +end +local function _Trunc(val) if val >= 0 then return mathFloor(val) else return mathCeil(val) end end +local function ImTrunc(v) + if type(v) == "number" then return _Trunc(v) + elseif type(v) == "table" then return ImVec2(_Trunc(v.x), _Trunc(v.y)) + end +end +local function ImFloor(f) if f >= 0 or math.floor(f) == f then return math.floor(f) else return math.floor(f) - 1 end end +local function ImSaturate(f) return ((f < 0.0 and 0.0) or (f > 1.0 and 1.0) or f) end local __FILES, __LOADED = {}, {} function IM_INCLUDE(name) local r = __LOADED[name] @@ -678,10 +712,10 @@ function ImGui.ClearDragDrop() local g = ImGui.GetCurrentContext() g.DragDropActive = false ImGuiPayload_Clear(g.DragDropPayload) - g.DragDropAcceptFlagsCurr = ImGuiDragDropFlags.None + g.DragDropAcceptFlagsCurr = 0 --[[ImGuiDragDropFlags.None]] g.DragDropAcceptIdCurr = 0 g.DragDropAcceptIdPrev = 0 - g.DragDropAcceptIdCurrRectSurface = FLT_MAX + g.DragDropAcceptIdCurrRectSurface = 3.4028234663853e+38 --[[FLT_MAX]] g.DragDropAcceptFrameCount = -1 end @@ -699,12 +733,12 @@ function ImGui.BeginDragDropSource(flags) -- FIXME-DRAGDROP: While in the common-most "drag from non-zero active id" case we can tell the mouse button, -- in both SourceExtern and id==0 cases we may requires something else (explicit flags or some heuristic). - local mouse_button = ImGuiMouseButton.Left + local mouse_button = 0 --[[ImGuiMouseButton.Left]] local source_drag_active = false local source_id = 0 local source_parent_id = 0 - if bit32.band(flags, ImGuiDragDropFlags.SourceExtern) == 0 then + if bit32.band(flags, 16 --[[ImGuiDragDropFlags.SourceExtern]]) == 0 then source_id = g.LastItemData.ID if source_id ~= 0 then -- Common path: items with ID @@ -715,14 +749,14 @@ function ImGui.BeginDragDropSource(flags) else -- Uncommon path: items without ID if g.IO.MouseDown[mouse_button] == false or window.SkipItems then return false end - if bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HoveredRect) == 0 and (g.ActiveId == 0 or g.ActiveIdWindow ~= window) then + if bit32.band(g.LastItemData.StatusFlags, 1 --[[ImGuiItemStatusFlags.HoveredRect]]) == 0 and (g.ActiveId == 0 or g.ActiveIdWindow ~= window) then return false end -- If you want to use BeginDragDropSource() on an item with no unique identifier for interaction, such as Text() or Image(), you need to: -- A) Read the explanation below, B) Use the ImGuiDragDropFlags.SourceAllowNullID flag. - if bit32.band(flags, ImGuiDragDropFlags.SourceAllowNullID) == 0 then - IM_ASSERT(false, "Use ImGuiDragDropFlags.SourceAllowNullID for items without an ID") + if bit32.band(flags, 8 --[[ImGuiDragDropFlags.SourceAllowNullID]]) == 0 then + assert(false, "Use ImGuiDragDropFlags.SourceAllowNullID for items without an ID") return false end @@ -757,12 +791,12 @@ function ImGui.BeginDragDropSource(flags) ImGui.SetActiveID(source_id, nil) end - IM_ASSERT(g.DragDropWithinTarget == false) -- Can't nest BeginDragDropSource() and BeginDragDropTarget() + assert(g.DragDropWithinTarget == false) -- Can't nest BeginDragDropSource() and BeginDragDropTarget() if not source_drag_active then return false end -- Activate drag and drop if not g.DragDropActive then - IM_ASSERT(source_id ~= 0) + assert(source_id ~= 0) ImGui.ClearDragDrop() local payload = g.DragDropPayload payload.SourceId = source_id @@ -775,30 +809,30 @@ function ImGui.BeginDragDropSource(flags) g.DragDropSourceFrameCount = g.FrameCount g.DragDropWithinSource = true - if bit32.band(flags, ImGuiDragDropFlags.SourceNoPreviewTooltip) == 0 then + if bit32.band(flags, 1 --[[ImGuiDragDropFlags.SourceNoPreviewTooltip]]) == 0 then -- Target can request the Source to not display its tooltip (we use a dedicated flag to make this request explicit) -- We unfortunately can't just modify the source flags and skip the call to BeginTooltip, as caller may be emitting contents. local ret - if g.DragDropAcceptIdPrev ~= 0 and bit32.band(g.DragDropAcceptFlagsPrev, ImGuiDragDropFlags.AcceptNoPreviewTooltip) ~= 0 then + if g.DragDropAcceptIdPrev ~= 0 and bit32.band(g.DragDropAcceptFlagsPrev, 4096 --[[ImGuiDragDropFlags.AcceptNoPreviewTooltip]]) ~= 0 then ret = ImGui.BeginTooltipHidden() else ret = ImGui.BeginTooltip() end - IM_ASSERT(ret) -- FIXME-NEWBEGIN: If this ever becomes false, we need to Begin("##Hidden", nil, ImGuiWindowFlags.NoSavedSettings) + SetWindowHiddenAndSkipItemsForCurrentFrame(). + assert(ret) -- FIXME-NEWBEGIN: If this ever becomes false, we need to Begin("##Hidden", nil, ImGuiWindowFlags.NoSavedSettings) + SetWindowHiddenAndSkipItemsForCurrentFrame(). end - if bit32.band(flags, ImGuiDragDropFlags.SourceNoDisableHover) == 0 and bit32.band(flags, ImGuiDragDropFlags.SourceExtern) == 0 then - g.LastItemData.StatusFlags = bit32.band(g.LastItemData.StatusFlags, bit32.bnot(ImGuiItemStatusFlags.HoveredRect)) + if bit32.band(flags, 2 --[[ImGuiDragDropFlags.SourceNoDisableHover]]) == 0 and bit32.band(flags, 16 --[[ImGuiDragDropFlags.SourceExtern]]) == 0 then + g.LastItemData.StatusFlags = bit32.band(g.LastItemData.StatusFlags, bit32.bnot(1 --[[ImGuiItemStatusFlags.HoveredRect]])) end return true end function ImGui.EndDragDropSource() local g = ImGui.GetCurrentContext() - IM_ASSERT(g.DragDropActive) - IM_ASSERT(g.DragDropWithinSource, "Not after a BeginDragDropSource()?") + assert(g.DragDropActive) + assert(g.DragDropWithinSource, "Not after a BeginDragDropSource()?") - if bit32.band(g.DragDropSourceFlags, ImGuiDragDropFlags.SourceNoPreviewTooltip) == 0 then + if bit32.band(g.DragDropSourceFlags, 1 --[[ImGuiDragDropFlags.SourceNoPreviewTooltip]]) == 0 then ImGui.EndTooltip() end @@ -813,14 +847,14 @@ end function ImGui.SetDragDropPayload(type, data, data_size, cond) local g = ImGui.GetCurrentContext() local payload = g.DragDropPayload - if cond == nil or cond == 0 then cond = ImGuiCond.Always end + if cond == nil or cond == 0 then cond = 1 --[[ImGuiCond.Always]] end - IM_ASSERT(type ~= nil) - IM_ASSERT(#type < 32, "Payload type can be at most 32 characters long") - IM_ASSERT(cond == ImGuiCond.Always or cond == ImGuiCond.Once) - IM_ASSERT(payload.SourceId ~= 0) -- Not called between BeginDragDropSource() and EndDragDropSource() + assert(type ~= nil) + assert(#type < 32, "Payload type can be at most 32 characters long") + assert(cond == 1 --[[ImGuiCond.Always]] or cond == 2 --[[ImGuiCond.Once]]) + assert(payload.SourceId ~= 0) -- Not called between BeginDragDropSource() and EndDragDropSource() - if cond == ImGuiCond.Always or payload.DataFrameCount == -1 then + if cond == 1 --[[ImGuiCond.Always]] or payload.DataFrameCount == -1 then -- Copy payload payload.DataType = type payload.Data = data @@ -839,11 +873,11 @@ function ImGui.BeginDragDropTargetCustom(bb, id) local window = g.CurrentWindow local hovered_window = g.HoveredWindowUnderMovingWindow if hovered_window == nil or window.RootWindowDockTree ~= hovered_window.RootWindowDockTree then return false end - IM_ASSERT(id ~= 0) + assert(id ~= 0) if not ImGui.IsMouseHoveringRect(bb.Min, bb.Max) or (id == g.DragDropPayload.SourceId) then return false end if window.SkipItems then return false end - IM_ASSERT(g.DragDropWithinTarget == false and g.DragDropWithinSource == false) -- Can't nest BeginDragDropSource() and BeginDragDropTarget() + assert(g.DragDropWithinTarget == false and g.DragDropWithinSource == false) -- Can't nest BeginDragDropSource() and BeginDragDropTarget() g.DragDropTargetRect = ImRect(bb.Min, bb.Max) g.DragDropTargetClipRect = ImRect(window.ClipRect.Min, window.ClipRect.Max) -- May want to be overridden by user depending on use case? g.DragDropTargetId = id @@ -866,7 +900,7 @@ function ImGui.BeginDragDropTargetViewport(viewport, p_bb) return false end - IM_ASSERT(g.DragDropWithinTarget == false and g.DragDropWithinSource == false) -- Can't nest BeginDragDropSource() and BeginDragDropTarget() + assert(g.DragDropWithinTarget == false and g.DragDropWithinSource == false) -- Can't nest BeginDragDropSource() and BeginDragDropTarget() g.DragDropTargetRect = ImRect(bb.Min, bb.Max) g.DragDropTargetClipRect = ImRect(bb.Min, bb.Max) g.DragDropTargetId = id @@ -884,11 +918,11 @@ function ImGui.BeginDragDropTarget() if not g.DragDropActive then return false end local window = g.CurrentWindow - if bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HoveredRect) == 0 then return false end + if bit32.band(g.LastItemData.StatusFlags, 1 --[[ImGuiItemStatusFlags.HoveredRect]]) == 0 then return false end local hovered_window = g.HoveredWindowUnderMovingWindow if hovered_window == nil or window.RootWindowDockTree ~= hovered_window.RootWindowDockTree or window.SkipItems then return false end - local display_rect = (bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HasDisplayRect) ~= 0) and g.LastItemData.DisplayRect or g.LastItemData.Rect + local display_rect = (bit32.band(g.LastItemData.StatusFlags, 2 --[[ImGuiItemStatusFlags.HasDisplayRect]]) ~= 0) and g.LastItemData.DisplayRect or g.LastItemData.Rect local id = g.LastItemData.ID if id == 0 then id = window:GetIDFromRectangle(display_rect) @@ -896,9 +930,9 @@ function ImGui.BeginDragDropTarget() end if g.DragDropPayload.SourceId == id then return false end - IM_ASSERT(g.DragDropWithinTarget == false and g.DragDropWithinSource == false) -- Can't nest BeginDragDropSource() and BeginDragDropTarget() + assert(g.DragDropWithinTarget == false and g.DragDropWithinSource == false) -- Can't nest BeginDragDropSource() and BeginDragDropTarget() g.DragDropTargetRect = ImRect(display_rect.Min, display_rect.Max) - local clip = (bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HasClipRect) ~= 0) and g.LastItemData.ClipRect or window.ClipRect + local clip = (bit32.band(g.LastItemData.StatusFlags, 512 --[[ImGuiItemStatusFlags.HasClipRect]]) ~= 0) and g.LastItemData.ClipRect or window.ClipRect g.DragDropTargetClipRect = ImRect(clip.Min, clip.Max) g.DragDropTargetId = id g.DragDropWithinTarget = true @@ -915,8 +949,8 @@ function ImGui.AcceptDragDropPayload(type, flags) if flags == nil then flags = 0 end local g = ImGui.GetCurrentContext() local payload = g.DragDropPayload - IM_ASSERT(g.DragDropActive) -- Not called between BeginDragDropTarget() and EndDragDropTarget() ? - IM_ASSERT(payload.DataFrameCount ~= -1) -- Forgot to call EndDragDropTarget() ? + assert(g.DragDropActive) -- Not called between BeginDragDropTarget() and EndDragDropTarget() ? + assert(payload.DataFrameCount ~= -1) -- Forgot to call EndDragDropTarget() ? if type ~= nil and not ImGuiPayload_IsDataType(payload, type) then return nil end -- Accept smallest drag target bounding box, this allows us to nest drag targets conveniently without ordering constraints. @@ -933,8 +967,8 @@ function ImGui.AcceptDragDropPayload(type, flags) -- Render default drop visuals payload.Preview = was_accepted_previously - flags = bit32.bor(flags, bit32.band(g.DragDropSourceFlags, ImGuiDragDropFlags.AcceptNoDrawDefaultRect)) -- Source can also inhibit the preview (useful for external sources that live for 1 frame) - local draw_target_rect = payload.Preview and bit32.band(flags, ImGuiDragDropFlags.AcceptNoDrawDefaultRect) == 0 + flags = bit32.bor(flags, bit32.band(g.DragDropSourceFlags, 2048 --[[ImGuiDragDropFlags.AcceptNoDrawDefaultRect]])) -- Source can also inhibit the preview (useful for external sources that live for 1 frame) + local draw_target_rect = payload.Preview and bit32.band(flags, 2048 --[[ImGuiDragDropFlags.AcceptNoDrawDefaultRect]]) == 0 if draw_target_rect and g.DragDropTargetFullViewport ~= 0 then ImGui.RenderDragDropTargetRectForViewport(g.DragDropTargetFullViewport, g.DragDropTargetRect) elseif draw_target_rect then @@ -942,12 +976,12 @@ function ImGui.AcceptDragDropPayload(type, flags) end g.DragDropAcceptFrameCount = g.FrameCount - if bit32.band(g.DragDropSourceFlags, ImGuiDragDropFlags.SourceExtern) ~= 0 and g.DragDropMouseButton == -1 then + if bit32.band(g.DragDropSourceFlags, 16 --[[ImGuiDragDropFlags.SourceExtern]]) ~= 0 and g.DragDropMouseButton == -1 then payload.Delivery = was_accepted_previously and (g.DragDropSourceFrameCount < g.FrameCount) else payload.Delivery = was_accepted_previously and not ImGui.IsMouseDown(g.DragDropMouseButton) -- For extern drag sources affecting OS window focus, it's easier to just test not IsMouseDown() instead of IsMouseReleased() end - if not payload.Delivery and bit32.band(flags, ImGuiDragDropFlags.AcceptBeforeDelivery) == 0 then return nil end + if not payload.Delivery and bit32.band(flags, 1024 --[[ImGuiDragDropFlags.AcceptBeforeDelivery]]) == 0 then return nil end return payload end @@ -967,7 +1001,7 @@ end function ImGui.RenderDragDropTargetRectForViewport(viewport_id, bb) local g = ImGui.GetCurrentContext() local viewport = ImGui.FindViewportByID(viewport_id) - IM_ASSERT(viewport ~= nil) + assert(viewport ~= nil) local bb_padded = ImRect(bb.Min, bb.Max) bb_padded:Expand(-g.Style.DragDropTargetPadding) ImGui.RenderDragDropTargetRectEx(ImGui.GetForegroundDrawList(viewport), bb_padded, g.Style.DragDropTargetRounding) @@ -975,8 +1009,8 @@ end function ImGui.RenderDragDropTargetRectEx(draw_list, bb, rounding) local g = ImGui.GetCurrentContext() - draw_list:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(ImGuiCol.DragDropTargetBg), rounding, 0) - draw_list:AddRect(bb.Min, bb.Max, ImGui.GetColorU32(ImGuiCol.DragDropTarget), rounding, g.Style.DragDropTargetBorderSize) + draw_list:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(57 --[[ImGuiCol.DragDropTargetBg]]), rounding, 0) + draw_list:AddRect(bb.Min, bb.Max, ImGui.GetColorU32(56 --[[ImGuiCol.DragDropTarget]]), rounding, g.Style.DragDropTargetBorderSize) end --- @return ImGuiPayload? @@ -987,8 +1021,8 @@ end function ImGui.EndDragDropTarget() local g = ImGui.GetCurrentContext() - IM_ASSERT(g.DragDropActive) - IM_ASSERT(g.DragDropWithinTarget) + assert(g.DragDropActive) + assert(g.DragDropWithinTarget) g.DragDropWithinTarget = false -- Clear drag and drop state payload right after delivery @@ -1171,7 +1205,7 @@ local function ImGuiDockRequest() -- DockTargetNode: Destination/Target Node to dock into -- DockPayload: Source/Payload window to dock (may be a loose window or a DockNode), [Optional] DockTargetWindow = nil, DockTargetNode = nil, DockPayload = nil, - DockSplitDir = ImGuiDir.None, DockSplitRatio = 0.5, DockSplitOuter = false, + DockSplitDir = (-1) --[[ImGuiDir.None]], DockSplitRatio = 0.5, DockSplitOuter = false, UndockTargetWindow = nil, UndockTargetNode = nil, } end @@ -1180,7 +1214,7 @@ end local function ImGuiDockNodeSettings() return { ID = 0, ParentNodeId = 0, ParentWindowId = 0, SelectedTabId = 0, - SplitAxis = ImGuiAxis.None, Depth = 0, Flags = 0, -- Flags: NB: We save individual flags one by one in ascii format (ImGuiDockNodeFlags.SavedFlagsMask_) + SplitAxis = 0 --[[ImGuiAxis.None]], Depth = 0, Flags = 0, -- Flags: NB: We save individual flags one by one in ascii format (ImGuiDockNodeFlags.SavedFlagsMask_) Pos = ImVec2(0, 0), Size = ImVec2(0, 0), SizeRef = ImVec2(0, 0), } end @@ -1202,7 +1236,7 @@ function ImGuiDockNode(id) -- LocalFlagsInWindows: (Write) Flags specific to this node, applied from windows -- MergedFlags: (Read) Effective flags (== SharedFlags | LocalFlagsInNode | LocalFlagsInWindows) SharedFlags = 0, LocalFlags = 0, LocalFlagsInWindows = 0, MergedFlags = 0, - State = ImGuiDockNodeState.Unknown, + State = 0 --[[ImGuiDockNodeState.Unknown]], ParentNode = nil, ChildNodes = { [0] = nil, [1] = nil }, -- [Split node only] Child nodes (left/right or top/bottom). Consider switching to an array. Windows = ImVector(), -- Note: unordered list! Iterate TabBar.Tabs for user-order. @@ -1211,8 +1245,8 @@ function ImGuiDockNode(id) -- Size: Current size -- SizeRef: [Split node only] Last explicitly written-to size (overridden when using a splitter affecting the node), used to calculate Size. Pos = ImVec2(0, 0), Size = ImVec2(0, 0), SizeRef = ImVec2(0, 0), - SplitAxis = ImGuiAxis.None, -- [Split node only] Split axis (X or Y) - LastBgColor = IM_COL32_WHITE, + SplitAxis = 0 --[[ImGuiAxis.None]], -- [Split node only] Split axis (X or Y) + LastBgColor = 4294967295 --[[IM_COL32_WHITE]], WindowClass = ImGuiWindowClass(), -- [Root node only] -- VisibleWindow: Generally point to window which is ID is == SelectedTabID, but when CTRL+Tabbing this can be a different window. HostWindow = nil, VisibleWindow = nil, @@ -1229,8 +1263,8 @@ function ImGuiDockNode(id) -- WantCloseTabId: [Leaf node only] Set when closing a specific tab/window. -- RefViewportId: Reference viewport ID from visible window when HostWindow == nil. LastFocusedNodeId = 0, SelectedTabId = 0, WantCloseTabId = 0, RefViewportId = 0, - AuthorityForPos = ImGuiDataAuthority.DockNode, AuthorityForSize = ImGuiDataAuthority.DockNode, -- ImGuiDataAuthority - AuthorityForViewport = ImGuiDataAuthority.Auto, + AuthorityForPos = 1 --[[ImGuiDataAuthority.DockNode]], AuthorityForSize = 1 --[[ImGuiDataAuthority.DockNode]], -- ImGuiDataAuthority + AuthorityForViewport = 0 --[[ImGuiDataAuthority.Auto]], IsVisible = true, IsFocused = false, IsBgDrawnThisFrame = false, -- IsVisible: Set to false when the node is hidden (usually disabled as it has no active window) HasCloseButton = false, HasWindowMenuButton = false, HasCentralNodeChild = false, -- HasCloseButton: Provide space for a close button (if any of the docked window has one). Note that button may be hidden on window without one. -- WantCloseAll: Set when closing all tabs at once. @@ -1241,11 +1275,11 @@ function ImGuiDockNode(id) end function DN:IsRootNode() return self.ParentNode == nil end -function DN:IsDockSpace() return bit32.band(self.MergedFlags, ImGuiDockNodeFlags.DockSpace) ~= 0 end -function DN:IsFloatingNode() return self.ParentNode == nil and bit32.band(self.MergedFlags, ImGuiDockNodeFlags.DockSpace) == 0 end -function DN:IsCentralNode() return bit32.band(self.MergedFlags, ImGuiDockNodeFlags.CentralNode) ~= 0 end -function DN:IsHiddenTabBar() return bit32.band(self.MergedFlags, ImGuiDockNodeFlags.HiddenTabBar) ~= 0 end -- Hidden tab bar can be shown back by clicking the small triangle -function DN:IsNoTabBar() return bit32.band(self.MergedFlags, ImGuiDockNodeFlags.NoTabBar) ~= 0 end -- Never show a tab bar +function DN:IsDockSpace() return bit32.band(self.MergedFlags, 1024 --[[ImGuiDockNodeFlags.DockSpace]]) ~= 0 end +function DN:IsFloatingNode() return self.ParentNode == nil and bit32.band(self.MergedFlags, 1024 --[[ImGuiDockNodeFlags.DockSpace]]) == 0 end +function DN:IsCentralNode() return bit32.band(self.MergedFlags, 2048 --[[ImGuiDockNodeFlags.CentralNode]]) ~= 0 end +function DN:IsHiddenTabBar() return bit32.band(self.MergedFlags, 8192 --[[ImGuiDockNodeFlags.HiddenTabBar]]) ~= 0 end -- Hidden tab bar can be shown back by clicking the small triangle +function DN:IsNoTabBar() return bit32.band(self.MergedFlags, 4096 --[[ImGuiDockNodeFlags.NoTabBar]]) ~= 0 end -- Never show a tab bar function DN:IsSplitNode() return self.ChildNodes[0] ~= nil end function DN:IsLeafNode() return self.ChildNodes[0] == nil end function DN:IsEmpty() return self.ChildNodes[0] == nil and self.Windows.Size == 0 end @@ -1259,10 +1293,10 @@ local function ImGuiDockPreviewData() -- IsSidesAvailable: Hold your breath, grammar freaks.. -- IsSplitDirExplicit: Set when hovered the drop rect (vs. implicit SplitDir==None when hovered the window) IsDropAllowed = false, IsCenterAvailable = false, IsSidesAvailable = false, IsSplitDirExplicit = false, - SplitNode = nil, SplitDir = ImGuiDir.None, SplitRatio = 0.0, + SplitNode = nil, SplitDir = (-1) --[[ImGuiDir.None]], SplitRatio = 0.0, DropRectsDraw = {}, -- May be slightly different from hit-testing drop rects used in DockNodeCalcDropRects() } - for n = 0, 4 do d.DropRectsDraw[n] = ImRect(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX) end + for n = 0, 4 do d.DropRectsDraw[n] = ImRect(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]]) end return d end @@ -1362,7 +1396,7 @@ end function ImGui.DockContextNewFrameUpdateUndocking(ctx) local g = ctx local dc = ctx.DockContext - if bit32.band(g.IO.ConfigFlags, ImGuiConfigFlags.DockingEnable) == 0 then + if bit32.band(g.IO.ConfigFlags, 128 --[[ImGuiConfigFlags.DockingEnable]]) == 0 then if next(dc.Nodes) ~= nil or dc.Requests.Size > 0 then ImGui.DockContextClearNodes(ctx, 0, true) end @@ -1400,7 +1434,7 @@ end function ImGui.DockContextNewFrameUpdateDocking(ctx) local g = ctx local dc = ctx.DockContext - if bit32.band(g.IO.ConfigFlags, ImGuiConfigFlags.DockingEnable) == 0 then return end + if bit32.band(g.IO.ConfigFlags, 128 --[[ImGuiConfigFlags.DockingEnable]]) == 0 then return end -- [DEBUG] Store hovered dock node. -- We could in theory use DockNodeTreeFindVisibleNodeByPos() on the root host dock node, but using .DockNode is a good shortcut. @@ -1465,7 +1499,7 @@ function ImGui.DockContextAddNode(ctx, id) if id == 0 then id = ImGui.DockContextGenNodeID(ctx) else - IM_ASSERT(ImGui.DockContextFindNodeByID(ctx, id) == nil) + assert(ImGui.DockContextFindNodeByID(ctx, id) == nil) end -- We don't set node.LastFrameAlive on construction. Nodes are always created at all time to reflect .ini settings! @@ -1475,16 +1509,16 @@ function ImGui.DockContextAddNode(ctx, id) end function ImGui.DockContextRemoveNode(ctx, node, merge_sibling_into_parent_node) - IM_ASSERT(ImGui.DockContextFindNodeByID(ctx, node.ID) == node) - IM_ASSERT(node.ChildNodes[0] == nil and node.ChildNodes[1] == nil) - IM_ASSERT(node.Windows.Size == 0) + assert(ImGui.DockContextFindNodeByID(ctx, node.ID) == node) + assert(node.ChildNodes[0] == nil and node.ChildNodes[1] == nil) + assert(node.Windows.Size == 0) if node.HostWindow then node.HostWindow.DockNodeAsHost = nil end local parent_node = node.ParentNode local merge = (merge_sibling_into_parent_node and parent_node ~= nil) if merge then - IM_ASSERT(parent_node.ChildNodes[0] == node or parent_node.ChildNodes[1] == node) + assert(parent_node.ChildNodes[0] == node or parent_node.ChildNodes[1] == node) local sibling_node = (parent_node.ChildNodes[0] == node) and parent_node.ChildNodes[1] or parent_node.ChildNodes[0] ImGui.DockNodeTreeMerge(ctx, parent_node, sibling_node) else @@ -1508,7 +1542,7 @@ end function ImGui.DockContextPruneUnusedSettingsNodes(ctx) local g = ctx local dc = ctx.DockContext - IM_ASSERT(g.Windows.Size == 0) + assert(g.Windows.Size == 0) local pool = {} local function GetOrAdd(id) @@ -1565,7 +1599,7 @@ function ImGui.DockContextPruneUnusedSettingsNodes(ctx) local data_parent = (settings.ParentNodeId ~= 0) and pool[settings.ParentNodeId] or nil local remove = false - remove = remove or (data.CountWindows == 1 and settings.ParentNodeId == 0 and data.CountChildNodes == 0 and bit32.band(settings.Flags, ImGuiDockNodeFlags.CentralNode) == 0) -- Floating root node with only 1 window + remove = remove or (data.CountWindows == 1 and settings.ParentNodeId == 0 and data.CountChildNodes == 0 and bit32.band(settings.Flags, 2048 --[[ImGuiDockNodeFlags.CentralNode]]) == 0) -- Floating root node with only 1 window remove = remove or (data.CountWindows == 0 and settings.ParentNodeId == 0 and data.CountChildNodes == 0) -- Leaf nodes with 0 window remove = remove or (data_root == nil or data_root.CountChildWindows == 0) if remove then @@ -1590,9 +1624,9 @@ function ImGui.DockContextBuildNodesFromSettings(ctx, node_settings_array, node_ node.Pos = ImVec2(settings.Pos.x, settings.Pos.y) node.Size = ImVec2(settings.Size.x, settings.Size.y) node.SizeRef = ImVec2(settings.SizeRef.x, settings.SizeRef.y) - node.AuthorityForPos = ImGuiDataAuthority.DockNode - node.AuthorityForSize = ImGuiDataAuthority.DockNode - node.AuthorityForViewport = ImGuiDataAuthority.DockNode + node.AuthorityForPos = 1 --[[ImGuiDataAuthority.DockNode]] + node.AuthorityForSize = 1 --[[ImGuiDataAuthority.DockNode]] + node.AuthorityForViewport = 1 --[[ImGuiDataAuthority.DockNode]] if node.ParentNode and node.ParentNode.ChildNodes[0] == nil then node.ParentNode.ChildNodes[0] = node elseif node.ParentNode and node.ParentNode.ChildNodes[1] == nil then @@ -1600,7 +1634,7 @@ function ImGui.DockContextBuildNodesFromSettings(ctx, node_settings_array, node_ end node.SelectedTabId = settings.SelectedTabId node.SplitAxis = settings.SplitAxis - node:SetLocalFlags(bit32.band(settings.Flags, ImGuiDockNodeFlags.SavedFlagsMask_)) + node:SetLocalFlags(bit32.band(settings.Flags, 261152 --[[ImGuiDockNodeFlags.SavedFlagsMask_]])) -- Bind host window immediately if it already exist (in case of a rebuild) -- This is useful as the RootWindowForTitleBarHighlight links necessary to highlight the currently focused node requires node.HostWindow to be set. @@ -1616,7 +1650,7 @@ function ImGui.DockContextBuildAddWindowsToNodes(ctx, root_id) for _, window in g.Windows:iter() do if window.DockId ~= 0 and window.LastFrameActive >= g.FrameCount - 1 and window.DockNode == nil then local node = ImGui.DockContextFindNodeByID(ctx, window.DockId) - IM_ASSERT(node ~= nil) -- This should have been called after DockContextBuildNodesFromSettings() + assert(node ~= nil) -- This should have been called after DockContextBuildNodesFromSettings() if root_id == 0 or ImGui.DockNodeGetRootNode(node).ID == root_id then ImGui.DockNodeAddWindow(node, window, true) end @@ -1638,7 +1672,7 @@ end ------------------------------------------------------------------------------- function ImGui.DockContextQueueDock(ctx, target, target_node, payload, split_dir, split_ratio, split_outer) - IM_ASSERT(target ~= payload) + assert(target ~= payload) local req = ImGuiDockRequest() req.Type = ImGuiDockRequestType.Dock req.DockTargetWindow = target @@ -1671,8 +1705,8 @@ function ImGui.DockContextQueueNotifyRemovedNode(ctx, node) end function ImGui.DockContextProcessDock(ctx, req) - IM_ASSERT((req.Type == ImGuiDockRequestType.Dock and req.DockPayload ~= nil) or (req.Type == ImGuiDockRequestType.Split and req.DockPayload == nil)) - IM_ASSERT(req.DockTargetWindow ~= nil or req.DockTargetNode ~= nil) + assert((req.Type == ImGuiDockRequestType.Dock and req.DockPayload ~= nil) or (req.Type == ImGuiDockRequestType.Split and req.DockPayload == nil)) + assert(req.DockTargetWindow ~= nil or req.DockTargetNode ~= nil) local g = ctx local payload_window = req.DockPayload -- Optional @@ -1693,9 +1727,9 @@ function ImGui.DockContextProcessDock(ctx, req) -- FIXME-DOCK: When we are trying to dock an existing single-window node into a loose window, transfer Node ID as well -- When processing an interactive split, usually LastFrameAlive will be < g.FrameCount. But DockBuilder operations can make it ==. - if node then IM_ASSERT(node.LastFrameAlive <= g.FrameCount) end + if node then assert(node.LastFrameAlive <= g.FrameCount) end if node and target_window and node == target_window.DockNodeAsHost then - IM_ASSERT(node.Windows.Size > 0 or node:IsSplitNode() or node:IsCentralNode()) + assert(node.Windows.Size > 0 or node:IsSplitNode() or node:IsCentralNode()) end -- Create new node and add existing window to it @@ -1706,30 +1740,30 @@ function ImGui.DockContextProcessDock(ctx, req) if target_window.DockNodeAsHost == nil then ImGui.DockNodeAddWindow(node, target_window, true) local t0 = node.TabBar.Tabs.Data[1] - t0.Flags = bit32.band(t0.Flags, bit32.bnot(ImGuiTabItemFlags.Unsorted)) + t0.Flags = bit32.band(t0.Flags, bit32.bnot(8388608 --[[ImGuiTabItemFlags.Unsorted]])) target_window.DockIsActive = true end end local split_dir = req.DockSplitDir - if split_dir ~= ImGuiDir.None then + if split_dir ~= (-1) --[[ImGuiDir.None]] then -- Split into two, one side will be our payload node unless we are dropping a loose window - local split_axis = (split_dir == ImGuiDir.Left or split_dir == ImGuiDir.Right) and ImGuiAxis.X or ImGuiAxis.Y - local split_inheritor_child_idx = (split_dir == ImGuiDir.Left or split_dir == ImGuiDir.Up) and 1 or 0 -- Current contents will be moved to the opposite side + local split_axis = (split_dir == 0 --[[ImGuiDir.Left]] or split_dir == 1 --[[ImGuiDir.Right]]) and 1 --[[ImGuiAxis.X]] or 2 --[[ImGuiAxis.Y]] + local split_inheritor_child_idx = (split_dir == 0 --[[ImGuiDir.Left]] or split_dir == 2 --[[ImGuiDir.Up]]) and 1 or 0 -- Current contents will be moved to the opposite side local split_ratio = req.DockSplitRatio ImGui.DockNodeTreeSplit(ctx, node, split_axis, split_inheritor_child_idx, split_ratio, payload_node) -- payload_node may be nil here! local new_node = node.ChildNodes[bit32.bxor(split_inheritor_child_idx, 1)] new_node.HostWindow = node.HostWindow node = new_node end - node:SetLocalFlags(bit32.band(node.LocalFlags, bit32.bnot(ImGuiDockNodeFlags.HiddenTabBar))) + node:SetLocalFlags(bit32.band(node.LocalFlags, bit32.bnot(8192 --[[ImGuiDockNodeFlags.HiddenTabBar]]))) if node ~= payload_node then -- Create tab bar before we call DockNodeMoveWindows (which would attempt to move the old tab-bar, which would lead us to payload tabs wrongly appearing before target tabs!) if node.Windows.Size > 0 and node.TabBar == nil then ImGui.DockNodeAddTabBar(node) for n = 1, node.Windows.Size do - ImGui.TabBarAddTab(node.TabBar, ImGuiTabItemFlags.None, node.Windows.Data[n]) + ImGui.TabBarAddTab(node.TabBar, 0 --[[ImGuiTabItemFlags.None]], node.Windows.Data[n]) end end @@ -1740,9 +1774,9 @@ function ImGui.DockContextProcessDock(ctx, req) -- We can dock a split payload into a node that already has windows _only_ if our payload is a node tree with a single visible node. -- In this situation, we move the windows of the target node into the currently visible node of the payload. -- This allows us to preserve some of the underlying dock tree settings nicely. - IM_ASSERT(payload_node.OnlyNodeWithWindows ~= nil) -- The docking should have been blocked by DockNodePreviewDockSetup() early on and never submitted. + assert(payload_node.OnlyNodeWithWindows ~= nil) -- The docking should have been blocked by DockNodePreviewDockSetup() early on and never submitted. local visible_node = payload_node.OnlyNodeWithWindows - if visible_node.TabBar then IM_ASSERT(visible_node.TabBar.Tabs.Size > 0) end + if visible_node.TabBar then assert(visible_node.TabBar.Tabs.Size > 0) end ImGui.DockNodeMoveWindows(node, visible_node) ImGui.DockNodeMoveWindows(visible_node, node) DockSettingsRenameNodeReferences(node.ID, visible_node.ID) @@ -1751,15 +1785,15 @@ function ImGui.DockContextProcessDock(ctx, req) -- Central node property needs to be moved to a leaf node, pick the last focused one. -- FIXME-DOCK: If we had to transfer other flags here, what would the policy be? local last_focused_node = ImGui.DockContextFindNodeByID(ctx, payload_node.LastFocusedNodeId) - IM_ASSERT(last_focused_node ~= nil) + assert(last_focused_node ~= nil) local last_focused_root_node = ImGui.DockNodeGetRootNode(last_focused_node) - IM_ASSERT(last_focused_root_node == ImGui.DockNodeGetRootNode(payload_node)) - last_focused_node:SetLocalFlags(bit32.bor(last_focused_node.LocalFlags, ImGuiDockNodeFlags.CentralNode)) - node:SetLocalFlags(bit32.band(node.LocalFlags, bit32.bnot(ImGuiDockNodeFlags.CentralNode))) + assert(last_focused_root_node == ImGui.DockNodeGetRootNode(payload_node)) + last_focused_node:SetLocalFlags(bit32.bor(last_focused_node.LocalFlags, 2048 --[[ImGuiDockNodeFlags.CentralNode]])) + node:SetLocalFlags(bit32.band(node.LocalFlags, bit32.bnot(2048 --[[ImGuiDockNodeFlags.CentralNode]]))) last_focused_root_node.CentralNode = last_focused_node end - IM_ASSERT(node.Windows.Size == 0) + assert(node.Windows.Size == 0) ImGui.DockNodeMoveChildNodes(node, payload_node) else local payload_dock_id = payload_node.ID @@ -1819,8 +1853,8 @@ function ImGui.DockContextProcessUndockWindow(ctx, window, clear_persistent_dock end function ImGui.DockContextProcessUndockNode(ctx, node) - IM_ASSERT(node:IsLeafNode()) - IM_ASSERT(node.Windows.Size >= 1) + assert(node:IsLeafNode()) + assert(node.Windows.Size >= 1) if node:IsRootNode() or node:IsCentralNode() then -- In the case of a root node or central node, the node will have to stay in place. Create a new node to receive the payload. @@ -1833,20 +1867,20 @@ function ImGui.DockContextProcessUndockNode(ctx, node) node = new_node else -- Otherwise extract our node and merge our sibling back into the parent node. - IM_ASSERT(node.ParentNode.ChildNodes[0] == node or node.ParentNode.ChildNodes[1] == node) + assert(node.ParentNode.ChildNodes[0] == node or node.ParentNode.ChildNodes[1] == node) local index_in_parent = (node.ParentNode.ChildNodes[0] == node) and 0 or 1 node.ParentNode.ChildNodes[index_in_parent] = nil ImGui.DockNodeTreeMerge(ctx, node.ParentNode, node.ParentNode.ChildNodes[bit32.bxor(index_in_parent, 1)]) - node.ParentNode.AuthorityForViewport = ImGuiDataAuthority.Window -- The node that stays in place keeps the viewport, so our newly dragged out node will create a new viewport + node.ParentNode.AuthorityForViewport = 2 --[[ImGuiDataAuthority.Window]] -- The node that stays in place keeps the viewport, so our newly dragged out node will create a new viewport node.ParentNode = nil end for _, window in node.Windows:iter() do - window.Flags = bit32.band(window.Flags, bit32.bnot(ImGuiWindowFlags.ChildWindow)) + window.Flags = bit32.band(window.Flags, bit32.bnot(16777216 --[[ImGuiWindowFlags.ChildWindow]])) if window.ParentWindow then window.ParentWindow.DC.ChildWindows:find_erase(window) end ImGui.UpdateWindowParentAndRootLinks(window, window.Flags, nil) end - node.AuthorityForPos = ImGuiDataAuthority.DockNode - node.AuthorityForSize = ImGuiDataAuthority.DockNode + node.AuthorityForPos = 1 --[[ImGuiDataAuthority.DockNode]] + node.AuthorityForSize = 1 --[[ImGuiDataAuthority.DockNode]] node.Size = FixLargeWindowsWhenUndocking(node.Size, node.Windows.Data[1].Viewport) node.WantMouseMove = true ImGui.MarkIniSettingsDirty() @@ -1859,7 +1893,7 @@ function ImGui.DockContextCalcDropPosForDocking(target, target_node, payload_win -- In DockNodePreviewDockSetup() for a root central node instead of showing both "inner" and "outer" drop rects -- (which would be functionally identical) we only show the outer one. Reflect this here. - if target_node and target_node.ParentNode == nil and target_node:IsCentralNode() and split_dir ~= ImGuiDir.None then + if target_node and target_node.ParentNode == nil and target_node:IsCentralNode() and split_dir ~= (-1) --[[ImGuiDir.None]] then split_outer = true end local split_data = ImGuiDockPreviewData() @@ -1917,10 +1951,10 @@ end function ImGui.DockNodeAddWindow(node, window, add_to_tab_bar) if window.DockNode then -- Can overwrite an existing window.DockNode (e.g. pointing to a disabled DockSpace node) - IM_ASSERT(window.DockNode.ID ~= node.ID) + assert(window.DockNode.ID ~= node.ID) ImGui.DockNodeRemoveWindow(window.DockNode, window, 0) end - IM_ASSERT(window.DockNode == nil or window.DockNodeAsHost == nil) + assert(window.DockNode == nil or window.DockNodeAsHost == nil) -- If more than 2 windows appeared on the same frame leading to the creation of a new hosting window, -- we'll hide windows until the host window is ready. Hide the 1st window after its been output (so it is not visible for one frame). @@ -1939,9 +1973,9 @@ function ImGui.DockNodeAddWindow(node, window, add_to_tab_bar) -- When reactivating a node with one or two loose window, the window pos/size/viewport are authoritative over the node storage. -- In particular it is important we init the viewport from the first window so we don't create two viewports and drop one. if node.HostWindow == nil and node:IsFloatingNode() then - if node.AuthorityForPos == ImGuiDataAuthority.Auto then node.AuthorityForPos = ImGuiDataAuthority.Window end - if node.AuthorityForSize == ImGuiDataAuthority.Auto then node.AuthorityForSize = ImGuiDataAuthority.Window end - if node.AuthorityForViewport == ImGuiDataAuthority.Auto then node.AuthorityForViewport = ImGuiDataAuthority.Window end + if node.AuthorityForPos == 0 --[[ImGuiDataAuthority.Auto]] then node.AuthorityForPos = 2 --[[ImGuiDataAuthority.Window]] end + if node.AuthorityForSize == 0 --[[ImGuiDataAuthority.Auto]] then node.AuthorityForSize = 2 --[[ImGuiDataAuthority.Window]] end + if node.AuthorityForViewport == 0 --[[ImGuiDataAuthority.Auto]] then node.AuthorityForViewport = 2 --[[ImGuiDataAuthority.Window]] end end -- Add to tab bar if requested @@ -1953,31 +1987,31 @@ function ImGui.DockNodeAddWindow(node, window, add_to_tab_bar) -- Add existing windows for n = 1, node.Windows.Size - 1 do - ImGui.TabBarAddTab(node.TabBar, ImGuiTabItemFlags.None, node.Windows.Data[n]) + ImGui.TabBarAddTab(node.TabBar, 0 --[[ImGuiTabItemFlags.None]], node.Windows.Data[n]) end end - ImGui.TabBarAddTab(node.TabBar, ImGuiTabItemFlags.Unsorted, window) + ImGui.TabBarAddTab(node.TabBar, 8388608 --[[ImGuiTabItemFlags.Unsorted]], window) end ImGui.DockNodeUpdateVisibleFlag(node) -- Update this without waiting for the next time we Begin() in the window, so our host window will have the proper title bar color on its first frame. if node.HostWindow then - ImGui.UpdateWindowParentAndRootLinks(window, bit32.bor(window.Flags, ImGuiWindowFlags.ChildWindow), node.HostWindow) + ImGui.UpdateWindowParentAndRootLinks(window, bit32.bor(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]), node.HostWindow) end end function ImGui.DockNodeRemoveWindow(node, window, save_dock_id) - IM_ASSERT(window.DockNode == node) + assert(window.DockNode == node) -- IM_ASSERT(window.RootWindowDockTree == node.HostWindow) -- IM_ASSERT(window.LastFrameActive < g.FrameCount) -- We may call this from Begin() - IM_ASSERT(save_dock_id == 0 or save_dock_id == node.ID) + assert(save_dock_id == 0 or save_dock_id == node.ID) window.DockNode = nil window.DockIsActive = false window.DockTabWantClose = false window.DockId = save_dock_id - window.Flags = bit32.band(window.Flags, bit32.bnot(ImGuiWindowFlags.ChildWindow)) + window.Flags = bit32.band(window.Flags, bit32.bnot(16777216 --[[ImGuiWindowFlags.ChildWindow]])) if window.ParentWindow then window.ParentWindow.DC.ChildWindows:find_erase(window) end ImGui.UpdateWindowParentAndRootLinks(window, window.Flags, nil) -- Update immediately @@ -1992,7 +2026,7 @@ function ImGui.DockNodeRemoveWindow(node, window, save_dock_id) -- Remove window local idx = node.Windows:find_index(window) - IM_ASSERT(idx ~= nil) + assert(idx ~= nil) node.Windows:erase(idx) if node.VisibleWindow == window then node.VisibleWindow = nil end @@ -2023,7 +2057,7 @@ function ImGui.DockNodeRemoveWindow(node, window, save_dock_id) end function ImGui.DockNodeMoveChildNodes(dst_node, src_node) - IM_ASSERT(dst_node.Windows.Size == 0) + assert(dst_node.Windows.Size == 0) dst_node.ChildNodes[0] = src_node.ChildNodes[0] dst_node.ChildNodes[1] = src_node.ChildNodes[1] if dst_node.ChildNodes[0] then dst_node.ChildNodes[0].ParentNode = dst_node end @@ -2036,9 +2070,9 @@ end function ImGui.DockNodeMoveWindows(dst_node, src_node) -- Insert tabs in the same orders as currently ordered (node.Windows isn't ordered) - IM_ASSERT(src_node and dst_node and dst_node ~= src_node) + assert(src_node and dst_node and dst_node ~= src_node) local src_tab_bar = src_node.TabBar - if src_tab_bar ~= nil then IM_ASSERT(src_node.Windows.Size <= src_node.TabBar.Tabs.Size) end + if src_tab_bar ~= nil then assert(src_node.Windows.Size <= src_node.TabBar.Tabs.Size) end -- If the dst_node is empty we can just move the entire tab bar (to preserve selection, scrolling, etc.) local move_tab_bar = (src_tab_bar ~= nil) and (dst_node.TabBar == nil) @@ -2066,8 +2100,8 @@ end function ImGui.DockNodeApplyPosSizeToWindows(node) for _, window in node.Windows:iter() do - ImGui.SetWindowPos(window, node.Pos, ImGuiCond.Always) -- We don't assign directly to Pos because it can break the calculation of SizeContents on next frame - ImGui.SetWindowSize(window, node.Size, ImGuiCond.Always) + ImGui.SetWindowPos(window, node.Pos, 1 --[[ImGuiCond.Always]]) -- We don't assign directly to Pos because it can break the calculation of SizeContents on next frame + ImGui.SetWindowSize(window, node.Size, 1 --[[ImGuiCond.Always]]) end end @@ -2090,8 +2124,8 @@ local function DockNodeFindInfo(node, info) info.CountNodesWithWindows = info.CountNodesWithWindows + 1 end if node:IsCentralNode() then - IM_ASSERT(info.CentralNode == nil) -- Should be only one - IM_ASSERT(node:IsLeafNode(), "If you get this assert: please submit .ini file + repro of actions leading to this.") + assert(info.CentralNode == nil) -- Should be only one + assert(node:IsLeafNode(), "If you get this assert: please submit .ini file + repro of actions leading to this.") info.CentralNode = node end if info.CountNodesWithWindows > 1 and info.CentralNode ~= nil then return end @@ -2100,7 +2134,7 @@ local function DockNodeFindInfo(node, info) end function ImGui.DockNodeFindWindowByID(node, id) - IM_ASSERT(id ~= 0) + assert(id ~= 0) for _, window in node.Windows:iter() do if window.ID == id then return window end end @@ -2111,11 +2145,11 @@ end -- - Update visibility flag. function ImGui.DockNodeUpdateFlagsAndCollapse(node) local g = ImGui.GetCurrentContext() - IM_ASSERT(node.ParentNode == nil or node.ParentNode.ChildNodes[0] == node or node.ParentNode.ChildNodes[1] == node) + assert(node.ParentNode == nil or node.ParentNode.ChildNodes[0] == node or node.ParentNode.ChildNodes[1] == node) -- Inherit most flags if node.ParentNode then - node.SharedFlags = bit32.band(node.ParentNode.SharedFlags, ImGuiDockNodeFlags.SharedFlagsInheritMask_) + node.SharedFlags = bit32.band(node.ParentNode.SharedFlags, 4294967295 --[[ImGuiDockNodeFlags.SharedFlagsInheritMask_]]) end -- Recurse into children @@ -2128,22 +2162,22 @@ function ImGui.DockNodeUpdateFlagsAndCollapse(node) -- Remove inactive windows, collapse nodes -- Merge node flags overrides stored in windows - node.LocalFlagsInWindows = ImGuiDockNodeFlags.None + node.LocalFlagsInWindows = 0 --[[ImGuiDockNodeFlags.None]] local window_n = 1 while window_n <= node.Windows.Size do local window = node.Windows.Data[window_n] - IM_ASSERT(window.DockNode == node) + assert(window.DockNode == node) local node_was_active = (node.LastFrameActive + 1 == g.FrameCount) local remove = false remove = remove or (node_was_active and (window.WasActive == false)) -- Can't use 'window.LastFrameActive + 1 < g.FrameCount'. (see #9151) - remove = remove or (node_was_active and (node.WantCloseAll or node.WantCloseTabId == window.TabId) and window.HasCloseButton and bit32.band(window.Flags, ImGuiWindowFlags.UnsavedDocument) == 0) -- Submit all _expected_ closure from last frame + remove = remove or (node_was_active and (node.WantCloseAll or node.WantCloseTabId == window.TabId) and window.HasCloseButton and bit32.band(window.Flags, 262144 --[[ImGuiWindowFlags.UnsavedDocument]]) == 0) -- Submit all _expected_ closure from last frame remove = remove or window.DockTabWantClose if remove then window.DockTabWantClose = false if node.Windows.Size == 1 and not node:IsCentralNode() then ImGui.DockNodeHideHostWindow(node) - node.State = ImGuiDockNodeState.HostWindowHiddenBecauseSingleWindow + node.State = 1 --[[ImGuiDockNodeState.HostWindowHiddenBecauseSingleWindow]] ImGui.DockNodeRemoveWindow(node, window, node.ID) -- Will delete the node so it'll be invalid on return return end @@ -2159,24 +2193,24 @@ function ImGui.DockNodeUpdateFlagsAndCollapse(node) -- Auto-hide tab bar option local node_flags = node.MergedFlags - if node.WantHiddenTabBarUpdate and node.Windows.Size == 1 and bit32.band(node_flags, ImGuiDockNodeFlags.AutoHideTabBar) ~= 0 and not node:IsHiddenTabBar() then + if node.WantHiddenTabBarUpdate and node.Windows.Size == 1 and bit32.band(node_flags, 64 --[[ImGuiDockNodeFlags.AutoHideTabBar]]) ~= 0 and not node:IsHiddenTabBar() then node.WantHiddenTabBarToggle = true end node.WantHiddenTabBarUpdate = false -- Cancel toggling if we know our tab bar is enforced to be hidden at all times - if node.WantHiddenTabBarToggle and node.VisibleWindow and bit32.band(node.VisibleWindow.WindowClass.DockNodeFlagsOverrideSet, ImGuiDockNodeFlags.HiddenTabBar) ~= 0 then + if node.WantHiddenTabBarToggle and node.VisibleWindow and bit32.band(node.VisibleWindow.WindowClass.DockNodeFlagsOverrideSet, 8192 --[[ImGuiDockNodeFlags.HiddenTabBar]]) ~= 0 then node.WantHiddenTabBarToggle = false end -- Apply toggles at a single point of the frame (here!) local prev_local_flags = node.LocalFlags if node.Windows.Size > 1 then - node:SetLocalFlags(bit32.band(node.LocalFlags, bit32.bnot(ImGuiDockNodeFlags.HiddenTabBar))) + node:SetLocalFlags(bit32.band(node.LocalFlags, bit32.bnot(8192 --[[ImGuiDockNodeFlags.HiddenTabBar]]))) elseif node.WantHiddenTabBarToggle then - node:SetLocalFlags(bit32.bxor(node.LocalFlags, ImGuiDockNodeFlags.HiddenTabBar)) + node:SetLocalFlags(bit32.bxor(node.LocalFlags, 8192 --[[ImGuiDockNodeFlags.HiddenTabBar]])) end - if bit32.band(bit32.bxor(node.LocalFlags, prev_local_flags), ImGuiDockNodeFlags.SavedFlagsMask_) ~= 0 then + if bit32.band(bit32.bxor(node.LocalFlags, prev_local_flags), 261152 --[[ImGuiDockNodeFlags.SavedFlagsMask_]]) ~= 0 then ImGui.MarkIniSettingsDirty() -- Bit flaky to only do this here. Perhaps compare node flags every frame? #9380 end node.WantHiddenTabBarToggle = false @@ -2209,7 +2243,7 @@ end function ImGui.DockNodeStartMouseMovingWindow(node, window) local g = ImGui.GetCurrentContext() - IM_ASSERT(node.WantMouseMove == true) + assert(node.WantMouseMove == true) ImGui.StartMouseMovingWindow(window) ImVec2_Copy(g.ActiveIdClickOffset, g.IO.MouseClickedPos[0] - node.Pos) g.MovingWindow = window -- If we are docked into a non moveable root window, StartMouseMovingWindow() won't set g.MovingWindow. Override that decision. @@ -2268,7 +2302,7 @@ end function ImGui.DockNodeUpdate(node) local g = ImGui.GetCurrentContext() - IM_ASSERT(node.LastFrameActive ~= g.FrameCount) + assert(node.LastFrameActive ~= g.FrameCount) node.LastFrameAlive = g.FrameCount node.IsBgDrawnThisFrame = false @@ -2295,9 +2329,9 @@ function ImGui.DockNodeUpdate(node) local single_window = node.Windows.Data[1] node.Pos = ImVec2(single_window.Pos.x, single_window.Pos.y) node.Size = ImVec2(single_window.SizeFull.x, single_window.SizeFull.y) - node.AuthorityForPos = ImGuiDataAuthority.Window - node.AuthorityForSize = ImGuiDataAuthority.Window - node.AuthorityForViewport = ImGuiDataAuthority.Window + node.AuthorityForPos = 2 --[[ImGuiDataAuthority.Window]] + node.AuthorityForSize = 2 --[[ImGuiDataAuthority.Window]] + node.AuthorityForViewport = 2 --[[ImGuiDataAuthority.Window]] -- Transfer focus immediately so when we revert to a regular window it is immediately selected if node.HostWindow and g.NavWindow == node.HostWindow then @@ -2311,7 +2345,7 @@ function ImGui.DockNodeUpdate(node) end ImGui.DockNodeHideHostWindow(node) - node.State = ImGuiDockNodeState.HostWindowHiddenBecauseSingleWindow + node.State = 1 --[[ImGuiDockNodeState.HostWindowHiddenBecauseSingleWindow]] node.WantCloseAll = false node.WantCloseTabId = 0 node.HasCloseButton = false @@ -2335,13 +2369,13 @@ function ImGui.DockNodeUpdate(node) -- It would require a generalization of CalcWindowExpectedSize(), probably extracting code away from Begin(). -- In reality it isn't very important as user quickly ends up with size data in .ini file. if node.IsVisible and node.HostWindow == nil and node:IsFloatingNode() and node:IsLeafNode() then - IM_ASSERT(node.Windows.Size > 0) + assert(node.Windows.Size > 0) local ref_window = nil -- Note that we prune single-window-node settings on .ini loading, so this is generally 0 for them! if node.SelectedTabId ~= 0 then ref_window = ImGui.DockNodeFindWindowByID(node, node.SelectedTabId) end if ref_window == nil then ref_window = node.Windows.Data[1] end if ref_window.AutoFitFramesX > 0 or ref_window.AutoFitFramesY > 0 then - node.State = ImGuiDockNodeState.HostWindowHiddenBecauseWindowsAreResizing + node.State = 2 --[[ImGuiDockNodeState.HostWindowHiddenBecauseWindowsAreResizing]] return end end @@ -2349,14 +2383,14 @@ function ImGui.DockNodeUpdate(node) local node_flags = node.MergedFlags -- Decide if the node will have a close button and a window menu button - node.HasWindowMenuButton = (node.Windows.Size > 0) and bit32.band(node_flags, ImGuiDockNodeFlags.NoWindowMenuButton) == 0 + node.HasWindowMenuButton = (node.Windows.Size > 0) and bit32.band(node_flags, 16384 --[[ImGuiDockNodeFlags.NoWindowMenuButton]]) == 0 node.HasCloseButton = false for _, window in node.Windows:iter() do -- FIXME-DOCK: Setting DockIsActive here means that for single active window in a leaf node, DockIsActive will be cleared until the next Begin() call. node.HasCloseButton = node.HasCloseButton or window.HasCloseButton window.DockIsActive = (node.Windows.Size > 1) end - if bit32.band(node_flags, ImGuiDockNodeFlags.NoCloseButton) ~= 0 or not g.Style.DockingNodeHasCloseButton then + if bit32.band(node_flags, 32768 --[[ImGuiDockNodeFlags.NoCloseButton]]) ~= 0 or not g.Style.DockingNodeHasCloseButton then node.HasCloseButton = false end @@ -2365,7 +2399,7 @@ function ImGui.DockNodeUpdate(node) local beginned_into_host_window = false if node:IsDockSpace() then -- [Explicit root dockspace node] - IM_ASSERT(node.HostWindow) + assert(node.HostWindow) host_window = node.HostWindow else -- [Automatic root or child nodes] @@ -2373,21 +2407,21 @@ function ImGui.DockNodeUpdate(node) local ref_window = (node.Windows.Size > 0) and node.Windows.Data[1] or nil -- Sync Pos - if node.AuthorityForPos == ImGuiDataAuthority.Window and ref_window then + if node.AuthorityForPos == 2 --[[ImGuiDataAuthority.Window]] and ref_window then ImGui.SetNextWindowPos(ref_window.Pos) - elseif node.AuthorityForPos == ImGuiDataAuthority.DockNode then + elseif node.AuthorityForPos == 1 --[[ImGuiDataAuthority.DockNode]] then ImGui.SetNextWindowPos(node.Pos) end -- Sync Size - if node.AuthorityForSize == ImGuiDataAuthority.Window and ref_window then + if node.AuthorityForSize == 2 --[[ImGuiDataAuthority.Window]] and ref_window then ImGui.SetNextWindowSize(ref_window.SizeFull) - elseif node.AuthorityForSize == ImGuiDataAuthority.DockNode then + elseif node.AuthorityForSize == 1 --[[ImGuiDataAuthority.DockNode]] then ImGui.SetNextWindowSize(node.Size) end -- Sync Collapsed - if node.AuthorityForSize == ImGuiDataAuthority.Window and ref_window then + if node.AuthorityForSize == 2 --[[ImGuiDataAuthority.Window]] and ref_window then ImGui.SetNextWindowCollapsed(ref_window.Collapsed) end @@ -2395,13 +2429,13 @@ function ImGui.DockNodeUpdate(node) -- Begin into the host window local window_label = DockNodeGetHostWindowTitle(node) - local window_flags = bit32.bor(ImGuiWindowFlags.NoScrollbar, ImGuiWindowFlags.NoScrollWithMouse, ImGuiWindowFlags.DockNodeHost) - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.NoFocusOnAppearing) - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.NoSavedSettings, ImGuiWindowFlags.NoNavFocus, ImGuiWindowFlags.NoCollapse) - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.NoTitleBar) + local window_flags = bit32.bor(8 --[[ImGuiWindowFlags.NoScrollbar]], 16 --[[ImGuiWindowFlags.NoScrollWithMouse]], 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) + window_flags = bit32.bor(window_flags, 4096 --[[ImGuiWindowFlags.NoFocusOnAppearing]]) + window_flags = bit32.bor(window_flags, 256 --[[ImGuiWindowFlags.NoSavedSettings]], 131072 --[[ImGuiWindowFlags.NoNavFocus]], 32 --[[ImGuiWindowFlags.NoCollapse]]) + window_flags = bit32.bor(window_flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) ImGui.SetNextWindowBgAlpha(0.0) -- Don't set ImGuiWindowFlags.NoBackground because it disables borders - ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, ImVec2(0, 0)) + ImGui.PushStyleVar(2 --[[ImGuiStyleVar.WindowPadding]], ImVec2(0, 0)) ImGui.Begin(window_label, nil, window_flags) ImGui.PopStyleVar() beginned_into_host_window = true @@ -2420,15 +2454,15 @@ function ImGui.DockNodeUpdate(node) -- after the dock host window, losing their top-most status. if node.HostWindow.Appearing then ImGui.BringWindowToDisplayFront(node.HostWindow) end - node.AuthorityForPos = ImGuiDataAuthority.Auto - node.AuthorityForSize = ImGuiDataAuthority.Auto - node.AuthorityForViewport = ImGuiDataAuthority.Auto + node.AuthorityForPos = 0 --[[ImGuiDataAuthority.Auto]] + node.AuthorityForSize = 0 --[[ImGuiDataAuthority.Auto]] + node.AuthorityForViewport = 0 --[[ImGuiDataAuthority.Auto]] elseif node.ParentNode then host_window = node.ParentNode.HostWindow node.HostWindow = host_window - node.AuthorityForPos = ImGuiDataAuthority.Auto - node.AuthorityForSize = ImGuiDataAuthority.Auto - node.AuthorityForViewport = ImGuiDataAuthority.Auto + node.AuthorityForPos = 0 --[[ImGuiDataAuthority.Auto]] + node.AuthorityForSize = 0 --[[ImGuiDataAuthority.Auto]] + node.AuthorityForViewport = 0 --[[ImGuiDataAuthority.Auto]] end if node.WantMouseMove and node.HostWindow then ImGui.DockNodeStartMouseMovingWindow(node, node.HostWindow) @@ -2437,7 +2471,7 @@ function ImGui.DockNodeUpdate(node) node.RefViewportId = 0 -- Clear when we have a host window -- Update focused node (the one whose title bar is highlight) within a node tree - if node:IsSplitNode() then IM_ASSERT(node.TabBar == nil) end + if node:IsSplitNode() then assert(node.TabBar == nil) end if node:IsRootNode() then local p_window = g.NavWindow and g.NavWindow.RootWindow or nil while p_window ~= nil and p_window.DockNode ~= nil do @@ -2452,7 +2486,7 @@ function ImGui.DockNodeUpdate(node) -- Register a hit-test hole in the window unless we are currently dragging a window that is compatible with our dockspace local central_node = node.CentralNode - local central_node_hole = node:IsRootNode() and host_window ~= nil and bit32.band(node_flags, ImGuiDockNodeFlags.PassthruCentralNode) ~= 0 and central_node ~= nil and central_node:IsEmpty() + local central_node_hole = node:IsRootNode() and host_window ~= nil and bit32.band(node_flags, 8 --[[ImGuiDockNodeFlags.PassthruCentralNode]]) ~= 0 and central_node ~= nil and central_node:IsEmpty() local central_node_hole_register_hit_test_hole = central_node_hole if central_node_hole then local payload = ImGui.GetDragDropPayload() @@ -2464,7 +2498,7 @@ function ImGui.DockNodeUpdate(node) -- We add a little padding to match the "resize from edges" behavior and allow grabbing the splitter easily. -- (But we only add it if there's something else on the other side of the hole, otherwise for e.g. fullscreen -- covering passthru node we'd have a gap on the edge not covered by the hole) - IM_ASSERT(node:IsDockSpace()) -- We cannot pass this flag without the DockSpace() api. Testing this because we also setup the hole in host_window.ParentNode + assert(node:IsDockSpace()) -- We cannot pass this flag without the DockSpace() api. Testing this because we also setup the hole in host_window.ParentNode local root_node = ImGui.DockNodeGetRootNode(central_node) local root_rect = ImRect(root_node.Pos, root_node.Pos + root_node.Size) local hole_rect = ImRect(central_node.Pos, central_node.Pos + central_node.Size) @@ -2484,9 +2518,9 @@ function ImGui.DockNodeUpdate(node) -- Update position/size, process and draw resizing splitters if node:IsRootNode() and host_window then ImGui.DockNodeTreeUpdatePosSize(node, host_window.Pos, host_window.Size) - ImGui.PushStyleColor(ImGuiCol.Separator, g.Style.Colors[ImGuiCol.Border]) - ImGui.PushStyleColor(ImGuiCol.SeparatorActive, g.Style.Colors[ImGuiCol.ResizeGripActive]) - ImGui.PushStyleColor(ImGuiCol.SeparatorHovered, g.Style.Colors[ImGuiCol.ResizeGripHovered]) + ImGui.PushStyleColor(28 --[[ImGuiCol.Separator]], g.Style.Colors[5 --[[ImGuiCol.Border]]]) + ImGui.PushStyleColor(30 --[[ImGuiCol.SeparatorActive]], g.Style.Colors[33 --[[ImGuiCol.ResizeGripActive]]]) + ImGui.PushStyleColor(29 --[[ImGuiCol.SeparatorHovered]], g.Style.Colors[32 --[[ImGuiCol.ResizeGripHovered]]]) ImGui.DockNodeTreeUpdateSplitter(node) ImGui.PopStyleColor(3) end @@ -2494,7 +2528,7 @@ function ImGui.DockNodeUpdate(node) -- Draw empty node background (currently can only be the Central Node) if host_window and node:IsEmpty() and node.IsVisible then host_window.DrawList:ChannelsSetCurrent(DOCKING_HOST_DRAW_CHANNEL_BG) - node.LastBgColor = (bit32.band(node_flags, ImGuiDockNodeFlags.PassthruCentralNode) ~= 0) and 0 or ImGui.GetColorU32(ImGuiCol.DockingEmptyBg) + node.LastBgColor = (bit32.band(node_flags, 8 --[[ImGuiDockNodeFlags.PassthruCentralNode]]) ~= 0) and 0 or ImGui.GetColorU32(43 --[[ImGuiCol.DockingEmptyBg]]) if node.LastBgColor ~= 0 then host_window.DrawList:AddRectFilled(node.Pos, node.Pos + node.Size, node.LastBgColor) end @@ -2504,13 +2538,13 @@ function ImGui.DockNodeUpdate(node) -- Draw whole dockspace background if ImGuiDockNodeFlags.PassthruCentralNode if set. -- We need to draw a background at the root level if requested by ImGuiDockNodeFlags.PassthruCentralNode, but we will only know the correct pos/size -- _after_ processing the resizing splitters. So we are using the DrawList channel splitting facility to submit drawing primitives out of order! - local render_dockspace_bg = node:IsRootNode() and host_window ~= nil and bit32.band(node_flags, ImGuiDockNodeFlags.PassthruCentralNode) ~= 0 + local render_dockspace_bg = node:IsRootNode() and host_window ~= nil and bit32.band(node_flags, 8 --[[ImGuiDockNodeFlags.PassthruCentralNode]]) ~= 0 if render_dockspace_bg and node.IsVisible then host_window.DrawList:ChannelsSetCurrent(DOCKING_HOST_DRAW_CHANNEL_BG) if central_node_hole then - ImGui.RenderRectFilledWithHole(host_window.DrawList, node:Rect(), central_node:Rect(), ImGui.GetColorU32(ImGuiCol.WindowBg), 0.0) + ImGui.RenderRectFilledWithHole(host_window.DrawList, node:Rect(), central_node:Rect(), ImGui.GetColorU32(2 --[[ImGuiCol.WindowBg]]), 0.0) else - host_window.DrawList:AddRectFilled(node.Pos, node.Pos + node.Size, ImGui.GetColorU32(ImGuiCol.WindowBg), 0.0) + host_window.DrawList:AddRectFilled(node.Pos, node.Pos + node.Size, ImGui.GetColorU32(2 --[[ImGuiCol.WindowBg]]), 0.0) end end @@ -2562,8 +2596,8 @@ ImGui.GWindowDockStyleColors = GWindowDockStyleColors -- Compare TabItem nodes given the last known DockOrder (will persist in .ini file as hint), used to sort tabs when multiple tabs are added on the same frame. local function TabItemComparerByDockOrder(ta, tb) local a, b = ta.Window, tb.Window - local ao = (a.DockOrder == -1) and INT_MAX or a.DockOrder - local bo = (b.DockOrder == -1) and INT_MAX or b.DockOrder + local ao = (a.DockOrder == -1) and 2147483647 --[[INT_MAX]] or a.DockOrder + local bo = (b.DockOrder == -1) and 2147483647 --[[INT_MAX]] or b.DockOrder if ao ~= bo then return ao < bo end return a.BeginOrderWithinContext < b.BeginOrderWithinContext end @@ -2576,14 +2610,14 @@ end function ImGui.DockNodeWindowMenuHandler_Default(ctx, node, tab_bar) if tab_bar.Tabs.Size == 1 then -- "Hide tab bar" option. Being one of our rare user-facing string we pull it from a table. - if ImGui.MenuItem(ImGui.LocalizeGetMsg(ImGuiLocKey.DockingHideTabBar), nil, node:IsHiddenTabBar()) then + if ImGui.MenuItem(ImGui.LocalizeGetMsg(13 --[[ImGuiLocKey.DockingHideTabBar]]), nil, node:IsHiddenTabBar()) then node.WantHiddenTabBarToggle = true end else -- Display a selectable list of windows in this docking node for tab_n = 1, tab_bar.Tabs.Size do local tab = tab_bar.Tabs.Data[tab_n] - if bit32.band(tab.Flags, ImGuiTabItemFlags.Button) == 0 then + if bit32.band(tab.Flags, 2097152 --[[ImGuiTabItemFlags.Button]]) == 0 then if ImGui.Selectable(ImGui.TabBarGetTabName(tab_bar, tab), tab.ID == tab_bar.SelectedTabId) then ImGui.TabBarQueueFocus(tab_bar, tab) end @@ -2597,10 +2631,10 @@ end function ImGui.DockNodeWindowMenuUpdate(node, tab_bar) -- Try to position the menu so it is more likely to stays within the same viewport local g = ImGui.GetCurrentContext() - if g.Style.WindowMenuButtonPosition == ImGuiDir.Left then - ImGui.SetNextWindowPos(ImVec2(node.Pos.x, node.Pos.y + ImGui.GetFrameHeight()), ImGuiCond.Always, ImVec2(0.0, 0.0)) + if g.Style.WindowMenuButtonPosition == 0 --[[ImGuiDir.Left]] then + ImGui.SetNextWindowPos(ImVec2(node.Pos.x, node.Pos.y + ImGui.GetFrameHeight()), 1 --[[ImGuiCond.Always]], ImVec2(0.0, 0.0)) else - ImGui.SetNextWindowPos(ImVec2(node.Pos.x + node.Size.x, node.Pos.y + ImGui.GetFrameHeight()), ImGuiCond.Always, ImVec2(1.0, 0.0)) + ImGui.SetNextWindowPos(ImVec2(node.Pos.x + node.Size.x, node.Pos.y + ImGui.GetFrameHeight()), 1 --[[ImGuiCond.Always]], ImVec2(1.0, 0.0)) end if ImGui.BeginPopup("#WindowMenu") then node.IsFocused = true @@ -2612,12 +2646,12 @@ end -- User helper to append/amend into a dock node tab bar. Most commonly used to add e.g. a "+" button. function ImGui.DockNodeBeginAmendTabBar(node) if node.TabBar == nil or node.HostWindow == nil then return false end - if bit32.band(node.MergedFlags, ImGuiDockNodeFlags.KeepAliveOnly) ~= 0 then return false end + if bit32.band(node.MergedFlags, 1 --[[ImGuiDockNodeFlags.KeepAliveOnly]]) ~= 0 then return false end if node.TabBar.ID == 0 then return false end ImGui.Begin(node.HostWindow.Name) ImGui.PushOverrideID(node.ID) local ret = ImGui.BeginTabBarEx(node.TabBar, node.TabBar.BarRect, node.TabBar.Flags) - IM_ASSERT(ret) + assert(ret) return true end @@ -2638,7 +2672,7 @@ local function IsDockNodeTitleBarHighlighted(node, root_node) if g.NavWindow and root_node.LastFocusedNodeId == node.ID then -- FIXME: This could all be backed in RootWindowForTitleBarHighlight? Probably need to reorganize for both dock nodes + other RootWindowForTitleBarHighlight users (not-node) local parent_window = g.NavWindow.RootWindow - while bit32.band(parent_window.Flags, ImGuiWindowFlags.ChildMenu) ~= 0 do + while bit32.band(parent_window.Flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0 do parent_window = parent_window.ParentWindow.RootWindow end local parent_node = parent_window.DockNodeAsHost or parent_window.DockNode @@ -2682,7 +2716,7 @@ function ImGui.DockNodeUpdateTabBar(node, host_window) local backup_skip_item = host_window.SkipItems if not node:IsDockSpace() then host_window.SkipItems = false - host_window.DC.NavLayerCurrent = ImGuiNavLayer.Menu + host_window.DC.NavLayerCurrent = 1 --[[ImGuiNavLayer.Menu]] end -- Use PushOverrideID() instead of PushID() to use the node id _without_ the host window ID. @@ -2700,7 +2734,7 @@ function ImGui.DockNodeUpdateTabBar(node, host_window) node.IsFocused = is_focused local node_flags = node.MergedFlags - local has_window_menu_button = bit32.band(node_flags, ImGuiDockNodeFlags.NoWindowMenuButton) == 0 and (style.WindowMenuButtonPosition ~= ImGuiDir.None) + local has_window_menu_button = bit32.band(node_flags, 16384 --[[ImGuiDockNodeFlags.NoWindowMenuButton]]) == 0 and (style.WindowMenuButtonPosition ~= (-1) --[[ImGuiDir.None]]) -- In a dock node, the Collapse Button turns into the Window Menu button. -- FIXME-DOCK FIXME-OPT: Could we recycle popups id across multiple dock nodes? @@ -2721,13 +2755,13 @@ function ImGui.DockNodeUpdateTabBar(node, host_window) for window_n = 1, node.Windows.Size do local window = node.Windows.Data[window_n] if ImGui.TabBarFindTabByID(tab_bar, window.TabId) == nil then - ImGui.TabBarAddTab(tab_bar, ImGuiTabItemFlags.Unsorted, window) + ImGui.TabBarAddTab(tab_bar, 8388608 --[[ImGuiTabItemFlags.Unsorted]], window) end end -- Title bar if is_focused then node.LastFrameFocused = g.FrameCount end - local title_bar_col = ImGui.GetColorU32(host_window.Collapsed and ImGuiCol.TitleBgCollapsed or (is_focused and ImGuiCol.TitleBgActive or ImGuiCol.TitleBg)) + local title_bar_col = ImGui.GetColorU32(host_window.Collapsed and 12 --[[ImGuiCol.TitleBgCollapsed]] or (is_focused and 11 --[[ImGuiCol.TitleBgActive]] or 10 --[[ImGuiCol.TitleBg]])) local rounding_flags = ImGui.CalcRoundingFlagsForRectInRect(title_bar_rect, host_window:Rect(), g.Style.DockingSeparatorSize) host_window.DrawList:AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, host_window.WindowRounding, rounding_flags) @@ -2737,18 +2771,18 @@ function ImGui.DockNodeUpdateTabBar(node, host_window) ImGui.OpenPopup("#WindowMenu") end if ImGui.IsItemActive() then focus_tab_id = tab_bar.SelectedTabId end - if ImGui.IsItemHovered(bit32.bor(ImGuiHoveredFlags.ForTooltip, ImGuiHoveredFlags.DelayNormal)) and g.HoveredIdTimer > 0.5 then - ImGui.SetTooltip("%s", ImGui.LocalizeGetMsg(ImGuiLocKey.DockingDragToUndockOrMoveNode)) + if ImGui.IsItemHovered(bit32.bor(4096 --[[ImGuiHoveredFlags.ForTooltip]], 65536 --[[ImGuiHoveredFlags.DelayNormal]])) and g.HoveredIdTimer > 0.5 then + ImGui.SetTooltip("%s", ImGui.LocalizeGetMsg(15 --[[ImGuiLocKey.DockingDragToUndockOrMoveNode]])) end end -- If multiple tabs are appearing on the same frame, sort them based on their persistent DockOrder value local tabs_unsorted_start = tab_bar.Tabs.Size -- 0-based local tab_n = tab_bar.Tabs.Size - 1 - while tab_n >= 0 and bit32.band(tab_bar.Tabs.Data[tab_n + 1].Flags, ImGuiTabItemFlags.Unsorted) ~= 0 do + while tab_n >= 0 and bit32.band(tab_bar.Tabs.Data[tab_n + 1].Flags, 8388608 --[[ImGuiTabItemFlags.Unsorted]]) ~= 0 do -- FIXME-DOCK: Consider only clearing the flag after the tab has been alive for a few consecutive frames, allowing late comers to not break sorting? local t = tab_bar.Tabs.Data[tab_n + 1] - t.Flags = bit32.band(t.Flags, bit32.bnot(ImGuiTabItemFlags.Unsorted)) + t.Flags = bit32.band(t.Flags, bit32.bnot(8388608 --[[ImGuiTabItemFlags.Unsorted]])) tabs_unsorted_start = tab_n tab_n = tab_n - 1 end @@ -2774,12 +2808,12 @@ function ImGui.DockNodeUpdateTabBar(node, host_window) end -- Begin tab bar - local tab_bar_flags = bit32.bor(ImGuiTabBarFlags.Reorderable, ImGuiTabBarFlags.AutoSelectNewTabs) -- | ImGuiTabBarFlags.NoTabListScrollingButtons) - tab_bar_flags = bit32.bor(tab_bar_flags, ImGuiTabBarFlags.SaveSettings, ImGuiTabBarFlags.DockNode) - tab_bar_flags = bit32.bor(tab_bar_flags, ImGuiTabBarFlags.FittingPolicyMixed) -- Enforce default policy. Since 1.92.2 this is now reasonable. May expose later if needed. (#8800, #3421) - tab_bar_flags = bit32.bor(tab_bar_flags, ImGuiTabBarFlags.DrawSelectedOverline) + local tab_bar_flags = bit32.bor(1 --[[ImGuiTabBarFlags.Reorderable]], 2 --[[ImGuiTabBarFlags.AutoSelectNewTabs]]) -- | ImGuiTabBarFlags.NoTabListScrollingButtons) + tab_bar_flags = bit32.bor(tab_bar_flags, 4194304 --[[ImGuiTabBarFlags.SaveSettings]], 1048576 --[[ImGuiTabBarFlags.DockNode]]) + tab_bar_flags = bit32.bor(tab_bar_flags, 128 --[[ImGuiTabBarFlags.FittingPolicyMixed]]) -- Enforce default policy. Since 1.92.2 this is now reasonable. May expose later if needed. (#8800, #3421) + tab_bar_flags = bit32.bor(tab_bar_flags, 64 --[[ImGuiTabBarFlags.DrawSelectedOverline]]) if not host_window.Collapsed and is_focused then - tab_bar_flags = bit32.bor(tab_bar_flags, ImGuiTabBarFlags.IsFocused) + tab_bar_flags = bit32.bor(tab_bar_flags, 2097152 --[[ImGuiTabBarFlags.IsFocused]]) end tab_bar.ID = node.ID -- GetID("#TabBar") tab_bar.SeparatorMinX = node.Pos.x + host_window.WindowBorderSize -- Separator cover the whole node width @@ -2789,7 +2823,7 @@ function ImGui.DockNodeUpdateTabBar(node, host_window) -- Backup style colors local backup_style_cols = {} - for color_n = 0, ImGuiWindowDockStyleCol.COUNT - 1 do + for color_n = 0, 9 --[[ImGuiWindowDockStyleCol.COUNT]] - 1 do local c = g.Style.Colors[GWindowDockStyleColors[color_n]] backup_style_cols[color_n] = ImVec4(c.x, c.y, c.z, c.w) end @@ -2802,15 +2836,15 @@ function ImGui.DockNodeUpdateTabBar(node, host_window) if not (window.LastFrameActive + 1 < g.FrameCount and node_was_active) then local tab_item_flags = 0 tab_item_flags = bit32.bor(tab_item_flags, window.WindowClass.TabItemFlagsOverrideSet or 0) - if bit32.band(window.Flags, ImGuiWindowFlags.UnsavedDocument) ~= 0 then - tab_item_flags = bit32.bor(tab_item_flags, ImGuiTabItemFlags.UnsavedDocument) + if bit32.band(window.Flags, 262144 --[[ImGuiWindowFlags.UnsavedDocument]]) ~= 0 then + tab_item_flags = bit32.bor(tab_item_flags, 1 --[[ImGuiTabItemFlags.UnsavedDocument]]) end - if bit32.band(tab_bar.Flags, ImGuiTabBarFlags.NoCloseWithMiddleMouseButton) ~= 0 then - tab_item_flags = bit32.bor(tab_item_flags, ImGuiTabItemFlags.NoCloseWithMiddleMouseButton) + if bit32.band(tab_bar.Flags, 8 --[[ImGuiTabBarFlags.NoCloseWithMiddleMouseButton]]) ~= 0 then + tab_item_flags = bit32.bor(tab_item_flags, 4 --[[ImGuiTabItemFlags.NoCloseWithMiddleMouseButton]]) end -- Apply stored style overrides for the window - for color_n = 0, ImGuiWindowDockStyleCol.COUNT - 1 do + for color_n = 0, 9 --[[ImGuiWindowDockStyleCol.COUNT]] - 1 do ImVec4_Copy(g.Style.Colors[GWindowDockStyleColors[color_n]], ImGui.ColorConvertU32ToFloat4(window.DockStyle.Colors[color_n])) end @@ -2824,14 +2858,14 @@ function ImGui.DockNodeUpdateTabBar(node, host_window) window.DC.DockTabItemRect = ImRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max) -- Update navigation ID on menu layer - if g.NavWindow and g.NavWindow.RootWindow == window and bit32.band(window.DC.NavLayersActiveMask, bit32.lshift(1, ImGuiNavLayer.Menu)) == 0 then + if g.NavWindow and g.NavWindow.RootWindow == window and bit32.band(window.DC.NavLayersActiveMask, bit32.lshift(1, 1 --[[ImGuiNavLayer.Menu]])) == 0 then host_window.NavLastIds[1] = window.TabId end end end -- Restore style colors - for color_n = 0, ImGuiWindowDockStyleCol.COUNT - 1 do + for color_n = 0, 9 --[[ImGuiWindowDockStyleCol.COUNT]] - 1 do ImVec4_Copy(g.Style.Colors[GWindowDockStyleColors[color_n]], backup_style_cols[color_n]) end @@ -2847,9 +2881,9 @@ function ImGui.DockNodeUpdateTabBar(node, host_window) -- local close_button_is_visible = close_button_is_enabled -- Most people would expect this behavior of not even showing the button (leaving a hole since we can't claim that space as other windows in the tba bar have one) if close_button_is_visible then if not close_button_is_enabled then - ImGui.PushItemFlag(ImGuiItemFlags.Disabled, true) - local tc = style.Colors[ImGuiCol.Text] - ImGui.PushStyleColor(ImGuiCol.Text, ImVec4(tc.x, tc.y, tc.z, tc.w * 0.4)) + ImGui.PushItemFlag(64 --[[ImGuiItemFlags.Disabled]], true) + local tc = style.Colors[0 --[[ImGuiCol.Text]]] + ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], ImVec4(tc.x, tc.y, tc.z, tc.w * 0.4)) end if ImGui.CloseButton(host_window:GetID("#CLOSE"), close_button_pos) then node.WantCloseAll = true @@ -2870,7 +2904,7 @@ function ImGui.DockNodeUpdateTabBar(node, host_window) -- AllowOverlap mode required for appending into dock node tab bar, -- otherwise dragging window will steal HoveredId and amended tabs cannot get them. ImGui.KeepAliveID(title_bar_id) - local _, _, held = ImGui.ButtonBehavior(title_bar_rect, title_bar_id, ImGuiButtonFlags.AllowOverlap) + local _, _, held = ImGui.ButtonBehavior(title_bar_rect, title_bar_id, 4096 --[[ImGuiButtonFlags.AllowOverlap]]) if g.HoveredId == title_bar_id then g.LastItemData.ID = title_bar_id end if held then if ImGui.IsMouseClicked(0) then focus_tab_id = tab_bar.SelectedTabId end @@ -2905,13 +2939,13 @@ function ImGui.DockNodeUpdateTabBar(node, host_window) -- Restore SkipItems flag if not node:IsDockSpace() then - host_window.DC.NavLayerCurrent = ImGuiNavLayer.Main + host_window.DC.NavLayerCurrent = 0 --[[ImGuiNavLayer.Main]] host_window.SkipItems = backup_skip_item end end function ImGui.DockNodeAddTabBar(node) - IM_ASSERT(node.TabBar == nil) + assert(node.TabBar == nil) node.TabBar = ImGuiTabBar() end @@ -2981,9 +3015,9 @@ function ImGui.DockNodeCalcTabBarLayout(node) out_close_button_pos = ImVec2(r.Max.x - button_sz, r.Min.y + style.FramePadding.y) r.Max.x = r.Max.x - (button_sz + style.ItemInnerSpacing.x) end - if node.HasWindowMenuButton and style.WindowMenuButtonPosition == ImGuiDir.Left then + if node.HasWindowMenuButton and style.WindowMenuButtonPosition == 0 --[[ImGuiDir.Left]] then r.Min.x = r.Min.x + button_sz + style.ItemInnerSpacing.x - elseif node.HasWindowMenuButton and style.WindowMenuButtonPosition == ImGuiDir.Right then + elseif node.HasWindowMenuButton and style.WindowMenuButtonPosition == 1 --[[ImGuiDir.Right]] then window_menu_button_pos = ImVec2(r.Max.x - button_sz, r.Min.y + style.FramePadding.y) r.Max.x = r.Max.x - (button_sz + style.ItemInnerSpacing.x) end @@ -2994,7 +3028,7 @@ end function ImGui.DockNodeCalcSplitRects(pos_old, size_old, pos_new, size_new, dir, size_new_desired) local g = ImGui.GetCurrentContext() local dock_spacing = g.Style.ItemInnerSpacing.x - local axis = (dir == ImGuiDir.Left or dir == ImGuiDir.Right) and ImGuiAxis.X or ImGuiAxis.Y + local axis = (dir == 0 --[[ImGuiDir.Left]] or dir == 1 --[[ImGuiDir.Right]]) and 1 --[[ImGuiAxis.X]] or 2 --[[ImGuiAxis.Y]] local a, o = axis, 3 - axis -- the port's ImGuiAxis is 1-based (X=1,Y=2): it is directly the ImVec2 index pos_new[o] = pos_old[o] size_new[o] = size_old[o] @@ -3010,9 +3044,9 @@ function ImGui.DockNodeCalcSplitRects(pos_old, size_old, pos_new, size_new, dir, end -- Position each node - if dir == ImGuiDir.Right or dir == ImGuiDir.Down then + if dir == 1 --[[ImGuiDir.Right]] or dir == 3 --[[ImGuiDir.Down]] then pos_new[a] = pos_old[a] + size_old[a] + dock_spacing - elseif dir == ImGuiDir.Left or dir == ImGuiDir.Up then + elseif dir == 0 --[[ImGuiDir.Left]] or dir == 2 --[[ImGuiDir.Up]] then pos_new[a] = pos_old[a] pos_old[a] = pos_new[a] + size_new[a] + dock_spacing end @@ -3020,9 +3054,9 @@ end local function ImGetDirQuadrantFromDeltaLocal(dx, dy) if math.abs(dx) > math.abs(dy) then - return (dx > 0.0) and ImGuiDir.Right or ImGuiDir.Left + return (dx > 0.0) and 1 --[[ImGuiDir.Right]] or 0 --[[ImGuiDir.Left]] end - return (dy > 0.0) and ImGuiDir.Down or ImGuiDir.Up + return (dy > 0.0) and 3 --[[ImGuiDir.Down]] or 2 --[[ImGuiDir.Up]] end -- Retrieve the drop rectangles for a given direction or for the center + perform hit testing. @@ -3049,11 +3083,11 @@ function ImGui.DockNodeCalcDropRectsAndTestMousePos(parent, dir, outer_docking, local pc = parent:GetCenter() local c = ImVec2(ImTrunc(pc.x), ImTrunc(pc.y)) local out_r - if dir == ImGuiDir.None then out_r = ImRect(c.x - hs_w, c.y - hs_w, c.x + hs_w, c.y + hs_w) - elseif dir == ImGuiDir.Up then out_r = ImRect(c.x - hs_w, c.y - off.y - hs_h, c.x + hs_w, c.y - off.y + hs_h) - elseif dir == ImGuiDir.Down then out_r = ImRect(c.x - hs_w, c.y + off.y - hs_h, c.x + hs_w, c.y + off.y + hs_h) - elseif dir == ImGuiDir.Left then out_r = ImRect(c.x - off.x - hs_h, c.y - hs_w, c.x - off.x + hs_h, c.y + hs_w) - elseif dir == ImGuiDir.Right then out_r = ImRect(c.x + off.x - hs_h, c.y - hs_w, c.x + off.x + hs_h, c.y + hs_w) end + if dir == (-1) --[[ImGuiDir.None]] then out_r = ImRect(c.x - hs_w, c.y - hs_w, c.x + hs_w, c.y + hs_w) + elseif dir == 2 --[[ImGuiDir.Up]] then out_r = ImRect(c.x - hs_w, c.y - off.y - hs_h, c.x + hs_w, c.y - off.y + hs_h) + elseif dir == 3 --[[ImGuiDir.Down]] then out_r = ImRect(c.x - hs_w, c.y + off.y - hs_h, c.x + hs_w, c.y + off.y + hs_h) + elseif dir == 0 --[[ImGuiDir.Left]] then out_r = ImRect(c.x - off.x - hs_h, c.y - hs_w, c.x - off.x + hs_h, c.y + hs_w) + elseif dir == 1 --[[ImGuiDir.Right]] then out_r = ImRect(c.x + off.x - hs_h, c.y - hs_w, c.x + off.x + hs_h, c.y + hs_w) end if test_mouse_pos == nil then return false, out_r end @@ -3066,7 +3100,7 @@ function ImGui.DockNodeCalcDropRectsAndTestMousePos(parent, dir, outer_docking, local r_threshold_center = hs_w * 1.4 local r_threshold_sides = hs_w * (1.4 + 1.2) if mouse_delta_len2 < r_threshold_center * r_threshold_center then - return (dir == ImGuiDir.None), out_r + return (dir == (-1) --[[ImGuiDir.None]]), out_r end if mouse_delta_len2 < r_threshold_sides * r_threshold_sides then return (dir == ImGetDirQuadrantFromDeltaLocal(mdx, mdy)), out_r @@ -3085,7 +3119,7 @@ function ImGui.DockNodePreviewDockSetup(host_window, host_node, payload_window, -- Because the inactive leaf node doesn't have proper pos/size yet, we'll use the root node as reference. if payload_node == nil then payload_node = payload_window.DockNodeAsHost end local ref_node_for_rect = (host_node and not host_node.IsVisible) and ImGui.DockNodeGetRootNode(host_node) or host_node - if ref_node_for_rect then IM_ASSERT(ref_node_for_rect.IsVisible == true) end + if ref_node_for_rect then assert(ref_node_for_rect.IsVisible == true) end -- Filter, figure out where we are allowed to dock local src_node_flags = payload_node and payload_node.MergedFlags or payload_window.WindowClass.DockNodeFlagsOverrideSet @@ -3095,30 +3129,30 @@ function ImGui.DockNodePreviewDockSetup(host_window, host_node, payload_window, data.IsCenterAvailable = false elseif g.IO.ConfigDockingNoDockingOver then data.IsCenterAvailable = false - elseif bit32.band(dst_node_flags, ImGuiDockNodeFlags.NoDockingOverMe) ~= 0 then + elseif bit32.band(dst_node_flags, 1048576 --[[ImGuiDockNodeFlags.NoDockingOverMe]]) ~= 0 then data.IsCenterAvailable = false - elseif host_node and bit32.band(dst_node_flags, ImGuiDockNodeFlags.NoDockingOverCentralNode) ~= 0 and host_node:IsCentralNode() then + elseif host_node and bit32.band(dst_node_flags, 4 --[[ImGuiDockNodeFlags.NoDockingOverCentralNode]]) ~= 0 and host_node:IsCentralNode() then data.IsCenterAvailable = false elseif (not host_node or not host_node:IsEmpty()) and payload_node and payload_node:IsSplitNode() and (payload_node.OnlyNodeWithWindows == nil) then -- Is _visibly_ split? data.IsCenterAvailable = false - elseif bit32.band(src_node_flags, ImGuiDockNodeFlags.NoDockingOverOther) ~= 0 and (not host_node or not host_node:IsEmpty()) then + elseif bit32.band(src_node_flags, 2097152 --[[ImGuiDockNodeFlags.NoDockingOverOther]]) ~= 0 and (not host_node or not host_node:IsEmpty()) then data.IsCenterAvailable = false - elseif bit32.band(src_node_flags, ImGuiDockNodeFlags.NoDockingOverEmpty) ~= 0 and host_node and host_node:IsEmpty() then + elseif bit32.band(src_node_flags, 4194304 --[[ImGuiDockNodeFlags.NoDockingOverEmpty]]) ~= 0 and host_node and host_node:IsEmpty() then data.IsCenterAvailable = false end data.IsSidesAvailable = true - if bit32.band(dst_node_flags, ImGuiDockNodeFlags.NoDockingSplit) ~= 0 or g.IO.ConfigDockingNoSplit then + if bit32.band(dst_node_flags, 16 --[[ImGuiDockNodeFlags.NoDockingSplit]]) ~= 0 or g.IO.ConfigDockingNoSplit then data.IsSidesAvailable = false elseif not is_outer_docking and host_node and host_node.ParentNode == nil and host_node:IsCentralNode() then data.IsSidesAvailable = false - elseif bit32.band(src_node_flags, ImGuiDockNodeFlags.NoDockingSplitOther) ~= 0 then + elseif bit32.band(src_node_flags, 524288 --[[ImGuiDockNodeFlags.NoDockingSplitOther]]) ~= 0 then data.IsSidesAvailable = false end -- Build a tentative future node (reuse same structure because it is practical. Shape will be readjusted when previewing a split) data.FutureNode.HasCloseButton = (host_node and host_node.HasCloseButton or (not host_node and host_window.HasCloseButton)) or payload_window.HasCloseButton - data.FutureNode.HasWindowMenuButton = host_node and true or (bit32.band(host_window.Flags, ImGuiWindowFlags.NoCollapse) == 0) + data.FutureNode.HasWindowMenuButton = host_node and true or (bit32.band(host_window.Flags, 32 --[[ImGuiWindowFlags.NoCollapse]]) == 0) local rp = ref_node_for_rect and ref_node_for_rect.Pos or host_window.Pos local rs = ref_node_for_rect and ref_node_for_rect.Size or host_window.Size data.FutureNode.Pos = ImVec2(rp.x, rp.y) @@ -3126,11 +3160,11 @@ function ImGui.DockNodePreviewDockSetup(host_window, host_node, payload_window, -- Calculate drop shapes geometry for allowed splitting directions data.SplitNode = host_node - data.SplitDir = ImGuiDir.None + data.SplitDir = (-1) --[[ImGuiDir.None]] data.IsSplitDirExplicit = false if not host_window.Collapsed then - for dir = ImGuiDir.None, ImGuiDir.COUNT - 1 do - if not ((dir == ImGuiDir.None and not data.IsCenterAvailable) or (dir ~= ImGuiDir.None and not data.IsSidesAvailable)) then + for dir = (-1) --[[ImGuiDir.None]], 4 --[[ImGuiDir.COUNT]] - 1 do + if not ((dir == (-1) --[[ImGuiDir.None]] and not data.IsCenterAvailable) or (dir ~= (-1) --[[ImGuiDir.None]] and not data.IsSidesAvailable)) then local hit, r = ImGui.DockNodeCalcDropRectsAndTestMousePos(data.FutureNode:Rect(), dir, is_outer_docking, g.IO.MousePos) data.DropRectsDraw[dir + 1] = r if hit then @@ -3142,16 +3176,16 @@ function ImGui.DockNodePreviewDockSetup(host_window, host_node, payload_window, end -- When docking without holding Shift, we only allow and preview docking when hovering over a drop rect or over the title bar - data.IsDropAllowed = (data.SplitDir ~= ImGuiDir.None) or data.IsCenterAvailable + data.IsDropAllowed = (data.SplitDir ~= (-1) --[[ImGuiDir.None]]) or data.IsCenterAvailable if not is_explicit_target and not data.IsSplitDirExplicit and not g.IO.ConfigDockingWithShift then data.IsDropAllowed = false end -- Calculate split area data.SplitRatio = 0.0 - if data.SplitDir ~= ImGuiDir.None then + if data.SplitDir ~= (-1) --[[ImGuiDir.None]] then local split_dir = data.SplitDir - local split_axis = (split_dir == ImGuiDir.Left or split_dir == ImGuiDir.Right) and ImGuiAxis.X or ImGuiAxis.Y + local split_axis = (split_dir == 0 --[[ImGuiDir.Left]] or split_dir == 1 --[[ImGuiDir.Right]]) and 1 --[[ImGuiAxis.X]] or 2 --[[ImGuiAxis.Y]] local pos_new, pos_old = ImVec2(0, 0), ImVec2(data.FutureNode.Pos.x, data.FutureNode.Pos.y) local size_new, size_old = ImVec2(0, 0), ImVec2(data.FutureNode.Size.x, data.FutureNode.Size.y) ImGui.DockNodeCalcSplitRects(pos_old, size_old, pos_new, size_new, split_dir, payload_window.Size) @@ -3160,13 +3194,13 @@ function ImGui.DockNodePreviewDockSetup(host_window, host_node, payload_window, local split_ratio = ImSaturate(size_new[split_axis] / data.FutureNode.Size[split_axis]) data.FutureNode.Pos = pos_new data.FutureNode.Size = size_new - data.SplitRatio = (split_dir == ImGuiDir.Right or split_dir == ImGuiDir.Down) and (1.0 - split_ratio) or split_ratio + data.SplitRatio = (split_dir == 1 --[[ImGuiDir.Right]] or split_dir == 3 --[[ImGuiDir.Down]]) and (1.0 - split_ratio) or split_ratio end end function ImGui.DockNodePreviewDockRender(host_window, host_node, root_payload, data) local g = ImGui.GetCurrentContext() - IM_ASSERT(g.CurrentWindow == host_window) -- Because we rely on font size to calculate tab sizes + assert(g.CurrentWindow == host_window) -- Because we rely on font size to calculate tab sizes -- With this option, we only display the preview on the target viewport, and the payload viewport is made transparent. -- To compensate for the single layer obstructed by the payload, we'll increase the alpha of the preview nodes. @@ -3175,19 +3209,19 @@ function ImGui.DockNodePreviewDockRender(host_window, host_node, root_payload, d local overlay_draw_lists = { ImGui.GetForegroundDrawList(host_window.Viewport) } -- Draw main preview rectangle - local overlay_col_main = ImGui.GetColorU32(ImGuiCol.DockingPreview, is_transparent_payload and 0.60 or 0.40) - local overlay_col_drop = ImGui.GetColorU32(ImGuiCol.DockingPreview, is_transparent_payload and 0.90 or 0.70) - local overlay_col_drop_hovered = ImGui.GetColorU32(ImGuiCol.DockingPreview, is_transparent_payload and 1.20 or 1.00) - local overlay_col_lines = ImGui.GetColorU32(ImGuiCol.NavWindowingHighlight, is_transparent_payload and 0.80 or 0.60) + local overlay_col_main = ImGui.GetColorU32(42 --[[ImGuiCol.DockingPreview]], is_transparent_payload and 0.60 or 0.40) + local overlay_col_drop = ImGui.GetColorU32(42 --[[ImGuiCol.DockingPreview]], is_transparent_payload and 0.90 or 0.70) + local overlay_col_drop_hovered = ImGui.GetColorU32(42 --[[ImGuiCol.DockingPreview]], is_transparent_payload and 1.20 or 1.00) + local overlay_col_lines = ImGui.GetColorU32(60 --[[ImGuiCol.NavWindowingHighlight]], is_transparent_payload and 0.80 or 0.60) -- Display area preview local can_preview_tabs = (root_payload.DockNodeAsHost == nil or root_payload.DockNodeAsHost.Windows.Size > 0) if data.IsDropAllowed then local overlay_rect = data.FutureNode:Rect() - if data.SplitDir == ImGuiDir.None and can_preview_tabs then + if data.SplitDir == (-1) --[[ImGuiDir.None]] and can_preview_tabs then overlay_rect.Min.y = overlay_rect.Min.y + ImGui.GetFrameHeight() end - if data.SplitDir ~= ImGuiDir.None or data.IsCenterAvailable then + if data.SplitDir ~= (-1) --[[ImGuiDir.None]] or data.IsCenterAvailable then for _, dl in ipairs(overlay_draw_lists) do dl:AddRectFilled(overlay_rect.Min, overlay_rect.Max, overlay_col_main, host_window.WindowRounding, ImGui.CalcRoundingFlagsForRectInRect(overlay_rect, host_window:Rect(), g.Style.DockingSeparatorSize)) end @@ -3195,7 +3229,7 @@ function ImGui.DockNodePreviewDockRender(host_window, host_node, root_payload, d end -- Display tab shape/label preview unless we are splitting node (it generally makes the situation harder to read) - if data.IsDropAllowed and can_preview_tabs and data.SplitDir == ImGuiDir.None and data.IsCenterAvailable then + if data.IsDropAllowed and can_preview_tabs and data.SplitDir == (-1) --[[ImGuiDir.None]] and data.IsCenterAvailable then -- Compute target tab bar geometry so we can locate our preview tabs local _, tab_bar_rect = ImGui.DockNodeCalcTabBarLayout(data.FutureNode) local tab_pos = ImVec2(tab_bar_rect.Min.x, tab_bar_rect.Min.y) @@ -3205,13 +3239,13 @@ function ImGui.DockNodePreviewDockRender(host_window, host_node, root_payload, d else tab_pos.x = tab_pos.x + g.Style.ItemInnerSpacing.x + ImGui.TabItemCalcSize(host_node.Windows.Data[1]).x end - elseif bit32.band(host_window.Flags, ImGuiWindowFlags.DockNodeHost) == 0 then + elseif bit32.band(host_window.Flags, 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) == 0 then tab_pos.x = tab_pos.x + g.Style.ItemInnerSpacing.x + ImGui.TabItemCalcSize(host_window).x -- Account for slight offset which will be added when changing from title bar to tab bar end -- Draw tab shape/label preview (payload may be a loose window or a host window carrying multiple tabbed windows) if root_payload.DockNodeAsHost then - IM_ASSERT(root_payload.DockNodeAsHost.Windows.Size <= root_payload.DockNodeAsHost.TabBar.Tabs.Size) + assert(root_payload.DockNodeAsHost.Windows.Size <= root_payload.DockNodeAsHost.TabBar.Tabs.Size) end local tab_bar_with_payload = root_payload.DockNodeAsHost and root_payload.DockNodeAsHost.TabBar or nil local payload_count = tab_bar_with_payload and tab_bar_with_payload.Tabs.Size or 1 @@ -3223,13 +3257,13 @@ function ImGui.DockNodePreviewDockRender(host_window, host_node, root_payload, d local tab_size = ImGui.TabItemCalcSize(payload_window) local tab_bb = ImRect(tab_pos.x, tab_pos.y, tab_pos.x + tab_size.x, tab_pos.y + tab_size.y) tab_pos.x = tab_pos.x + tab_size.x + g.Style.ItemInnerSpacing.x - local overlay_col_text = ImGui.GetColorU32(payload_window.DockStyle.Colors[ImGuiWindowDockStyleCol.Text], 1.0, true) - local overlay_col_tabs = ImGui.GetColorU32(payload_window.DockStyle.Colors[ImGuiWindowDockStyleCol.TabSelected], 1.0, true) - local overlay_col_unsaved_marker = ImGui.GetColorU32(payload_window.DockStyle.Colors[ImGuiWindowDockStyleCol.UnsavedMarker], 1.0, true) - ImGui.PushStyleColor(ImGuiCol.Text, ImGui.ColorConvertU32ToFloat4(overlay_col_text)) - ImGui.PushStyleColor(ImGuiCol.UnsavedMarker, ImGui.ColorConvertU32ToFloat4(overlay_col_unsaved_marker)) + local overlay_col_text = ImGui.GetColorU32(payload_window.DockStyle.Colors[0 --[[ImGuiWindowDockStyleCol.Text]]], 1.0, true) + local overlay_col_tabs = ImGui.GetColorU32(payload_window.DockStyle.Colors[3 --[[ImGuiWindowDockStyleCol.TabSelected]]], 1.0, true) + local overlay_col_unsaved_marker = ImGui.GetColorU32(payload_window.DockStyle.Colors[8 --[[ImGuiWindowDockStyleCol.UnsavedMarker]]], 1.0, true) + ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], ImGui.ColorConvertU32ToFloat4(overlay_col_text)) + ImGui.PushStyleColor(58 --[[ImGuiCol.UnsavedMarker]], ImGui.ColorConvertU32ToFloat4(overlay_col_unsaved_marker)) for _, dl in ipairs(overlay_draw_lists) do - local tab_flags = bit32.band(payload_window.Flags, ImGuiWindowFlags.UnsavedDocument) ~= 0 and ImGuiTabItemFlags.UnsavedDocument or 0 + local tab_flags = bit32.band(payload_window.Flags, 262144 --[[ImGuiWindowFlags.UnsavedDocument]]) ~= 0 and 1 --[[ImGuiTabItemFlags.UnsavedDocument]] or 0 local contains = tab_bar_rect:Contains(tab_bb) if not contains then dl:PushClipRect(tab_bar_rect.Min, tab_bar_rect.Max) end ImGui.TabItemBackground(dl, tab_bb, tab_flags, overlay_col_tabs) @@ -3244,7 +3278,7 @@ function ImGui.DockNodePreviewDockRender(host_window, host_node, root_payload, d -- Display drop boxes local scale = g.Style._MainScale or 1.0 -- FIXME-DPI local overlay_rounding = ImMax(math.floor(3.0 * scale), g.Style.FrameRounding) - for dir = ImGuiDir.None, ImGuiDir.COUNT - 1 do + for dir = (-1) --[[ImGuiDir.None]], 4 --[[ImGuiDir.COUNT]] - 1 do local draw_r = data.DropRectsDraw[dir + 1] if not IsRectInverted(draw_r) then local draw_r_in = ImRect(draw_r.Min, draw_r.Max) @@ -3256,17 +3290,17 @@ function ImGui.DockNodePreviewDockRender(host_window, host_node, root_payload, d local center = ImVec2(math.floor(cc.x), math.floor(cc.y)) dl:AddRectFilled(draw_r.Min, draw_r.Max, overlay_col, overlay_rounding) dl:AddRect(draw_r_in.Min, draw_r_in.Max, overlay_col_lines, overlay_rounding, thickness) - if dir == ImGuiDir.Left or dir == ImGuiDir.Right then + if dir == 0 --[[ImGuiDir.Left]] or dir == 1 --[[ImGuiDir.Right]] then dl:AddLineV(center.x, draw_r_in.Min.y, draw_r_in.Max.y, overlay_col_lines, thickness) end - if dir == ImGuiDir.Up or dir == ImGuiDir.Down then + if dir == 2 --[[ImGuiDir.Up]] or dir == 3 --[[ImGuiDir.Down]] then dl:AddLineH(draw_r_in.Min.x, draw_r_in.Max.x, center.y, overlay_col_lines, thickness) end end end -- Stop after ImGuiDir.None - if (host_node and bit32.band(host_node.MergedFlags, ImGuiDockNodeFlags.NoDockingSplit) ~= 0) or g.IO.ConfigDockingNoSplit then + if (host_node and bit32.band(host_node.MergedFlags, 16 --[[ImGuiDockNodeFlags.NoDockingSplit]]) ~= 0) or g.IO.ConfigDockingNoSplit then return end end @@ -3286,7 +3320,7 @@ end function ImGui.DockNodeTreeSplit(ctx, parent_node, split_axis, split_inheritor_child_idx, split_ratio, new_node) local g = ImGui.GetCurrentContext() - IM_ASSERT(split_axis ~= ImGuiAxis.None) + assert(split_axis ~= 0 --[[ImGuiAxis.None]]) local child_0 = (new_node and split_inheritor_child_idx ~= 0) and new_node or ImGui.DockContextAddNode(ctx, 0) child_0.ParentNode = parent_node @@ -3301,13 +3335,13 @@ function ImGui.DockNodeTreeSplit(ctx, parent_node, split_axis, split_inheritor_c parent_node.ChildNodes[split_inheritor_child_idx].VisibleWindow = parent_node.VisibleWindow parent_node.SplitAxis = split_axis parent_node.VisibleWindow = nil - parent_node.AuthorityForPos = ImGuiDataAuthority.DockNode - parent_node.AuthorityForSize = ImGuiDataAuthority.DockNode + parent_node.AuthorityForPos = 1 --[[ImGuiDataAuthority.DockNode]] + parent_node.AuthorityForSize = 1 --[[ImGuiDataAuthority.DockNode]] local a = split_axis local size_avail = parent_node.Size[a] - g.Style.DockingSeparatorSize size_avail = ImMax(size_avail, g.Style.WindowMinSize[a] * 2.0) - IM_ASSERT(size_avail > 0.0) -- If you created a node manually with DockBuilderAddNode(), you need to also call DockBuilderSetNodeSize() before splitting. + assert(size_avail > 0.0) -- If you created a node manually with DockBuilderAddNode(), you need to also call DockBuilderSetNodeSize() before splitting. child_0.SizeRef = ImVec2(parent_node.Size.x, parent_node.Size.y) child_1.SizeRef = ImVec2(parent_node.Size.x, parent_node.Size.y) child_0.SizeRef[a] = ImTrunc(size_avail * split_ratio) @@ -3319,10 +3353,10 @@ function ImGui.DockNodeTreeSplit(ctx, parent_node, split_axis, split_inheritor_c ImGui.DockNodeTreeUpdatePosSize(parent_node, parent_node.Pos, parent_node.Size) -- Flags transfer (e.g. this is where we transfer the ImGuiDockNodeFlags.CentralNode property) - child_0.SharedFlags = bit32.band(parent_node.SharedFlags, ImGuiDockNodeFlags.SharedFlagsInheritMask_) - child_1.SharedFlags = bit32.band(parent_node.SharedFlags, ImGuiDockNodeFlags.SharedFlagsInheritMask_) - child_inheritor.LocalFlags = bit32.band(parent_node.LocalFlags, ImGuiDockNodeFlags.LocalFlagsTransferMask_) - parent_node.LocalFlags = bit32.band(parent_node.LocalFlags, bit32.bnot(ImGuiDockNodeFlags.LocalFlagsTransferMask_)) + child_0.SharedFlags = bit32.band(parent_node.SharedFlags, 4294967295 --[[ImGuiDockNodeFlags.SharedFlagsInheritMask_]]) + child_1.SharedFlags = bit32.band(parent_node.SharedFlags, 4294967295 --[[ImGuiDockNodeFlags.SharedFlagsInheritMask_]]) + child_inheritor.LocalFlags = bit32.band(parent_node.LocalFlags, 260208 --[[ImGuiDockNodeFlags.LocalFlagsTransferMask_]]) + parent_node.LocalFlags = bit32.band(parent_node.LocalFlags, bit32.bnot(260208 --[[ImGuiDockNodeFlags.LocalFlagsTransferMask_]])) child_0:UpdateMergedFlags() child_1:UpdateMergedFlags() parent_node:UpdateMergedFlags() @@ -3335,11 +3369,11 @@ function ImGui.DockNodeTreeMerge(ctx, parent_node, merge_lead_child) -- When called from DockContextProcessUndockNode() it is possible that one of the child is nil. local child_0 = parent_node.ChildNodes[0] local child_1 = parent_node.ChildNodes[1] - IM_ASSERT(child_0 or child_1) - IM_ASSERT(merge_lead_child == child_0 or merge_lead_child == child_1) + assert(child_0 or child_1) + assert(merge_lead_child == child_0 or merge_lead_child == child_1) if (child_0 and child_0.Windows.Size > 0) or (child_1 and child_1.Windows.Size > 0) then - IM_ASSERT(parent_node.TabBar == nil) - IM_ASSERT(parent_node.Windows.Size == 0) + assert(parent_node.TabBar == nil) + assert(parent_node.Windows.Size == 0) end local backup_last_explicit_size = ImVec2(parent_node.SizeRef.x, parent_node.SizeRef.y) @@ -3353,14 +3387,14 @@ function ImGui.DockNodeTreeMerge(ctx, parent_node, merge_lead_child) DockSettingsRenameNodeReferences(child_1.ID, parent_node.ID) end ImGui.DockNodeApplyPosSizeToWindows(parent_node) - parent_node.AuthorityForPos = ImGuiDataAuthority.Auto - parent_node.AuthorityForSize = ImGuiDataAuthority.Auto - parent_node.AuthorityForViewport = ImGuiDataAuthority.Auto + parent_node.AuthorityForPos = 0 --[[ImGuiDataAuthority.Auto]] + parent_node.AuthorityForSize = 0 --[[ImGuiDataAuthority.Auto]] + parent_node.AuthorityForViewport = 0 --[[ImGuiDataAuthority.Auto]] parent_node.VisibleWindow = merge_lead_child.VisibleWindow parent_node.SizeRef = backup_last_explicit_size -- Flags transfer - local M = ImGuiDockNodeFlags.LocalFlagsTransferMask_ + local M = 260208 --[[ImGuiDockNodeFlags.LocalFlagsTransferMask_]] parent_node.LocalFlags = bit32.band(parent_node.LocalFlags, bit32.bnot(M)) -- Preserve Dockspace flag parent_node.LocalFlags = bit32.bor(parent_node.LocalFlags, bit32.band(child_0 and child_0.LocalFlags or 0, M)) parent_node.LocalFlags = bit32.bor(parent_node.LocalFlags, bit32.band(child_1 and child_1.LocalFlags or 0, M)) @@ -3479,7 +3513,7 @@ function ImGui.DockNodeTreeUpdateSplitter(node) if child_0.IsVisible and child_1.IsVisible then -- Bounding box of the splitter cover the space between both nodes (w = Spacing, h = Size[xy^1] for when splitting horizontally) local axis = node.SplitAxis - IM_ASSERT(axis ~= ImGuiAxis.None) + assert(axis ~= 0 --[[ImGuiAxis.None]]) local a, o = axis, 3 - axis -- the port's ImGuiAxis is 1-based (X=1,Y=2): it is directly the ImVec2 index local bb = ImRect(ImVec2(child_0.Pos.x, child_0.Pos.y), ImVec2(child_1.Pos.x, child_1.Pos.y)) bb.Min[a] = bb.Min[a] + child_0.Size[a] @@ -3487,10 +3521,10 @@ function ImGui.DockNodeTreeUpdateSplitter(node) -- if g.IO.KeyCtrl then GetForegroundDrawList(g.CurrentWindow.Viewport):AddRect(bb.Min, bb.Max, IM_COL32(255,0,255,255)) end local merged_flags = bit32.bor(child_0.MergedFlags, child_1.MergedFlags) -- Merged flags for BOTH childs - local no_resize_axis_flag = (axis == ImGuiAxis.X) and ImGuiDockNodeFlags.NoResizeX or ImGuiDockNodeFlags.NoResizeY - if bit32.band(merged_flags, ImGuiDockNodeFlags.NoResize) ~= 0 or bit32.band(merged_flags, no_resize_axis_flag) ~= 0 then + local no_resize_axis_flag = (axis == 1 --[[ImGuiAxis.X]]) and 65536 --[[ImGuiDockNodeFlags.NoResizeX]] or 131072 --[[ImGuiDockNodeFlags.NoResizeY]] + if bit32.band(merged_flags, 32 --[[ImGuiDockNodeFlags.NoResize]]) ~= 0 or bit32.band(merged_flags, no_resize_axis_flag) ~= 0 then local window = g.CurrentWindow - window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(ImGuiCol.Separator), g.Style.FrameRounding) + window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(28 --[[ImGuiCol.Separator]]), g.Style.FrameRounding) else -- bb.Min[axis] = bb.Min[axis] + 1 -- Display a little inward so highlight doesn't connect with nearby tabs on the neighbor node. -- bb.Max[axis] = bb.Max[axis] - 1 @@ -3518,7 +3552,7 @@ function ImGui.DockNodeTreeUpdateSplitter(node) local cur_size_1 = child_1.Size[a] local min_size_0 = resize_limits[0] - child_0.Pos[a] local min_size_1 = child_1.Pos[a] + child_1.Size[a] - resize_limits[1] - local bg_col = ImGui.GetColorU32(ImGuiCol.WindowBg) + local bg_col = ImGui.GetColorU32(2 --[[ImGuiCol.WindowBg]]) local changed changed, cur_size_0, cur_size_1 = ImGui.SplitterBehavior(bb, ImGui.GetID("##Splitter"), axis, cur_size_0, cur_size_1, min_size_0, min_size_1, g.WindowsBorderHoverPadding, WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER, bg_col) if changed then @@ -3591,7 +3625,7 @@ end function ImGui.SetWindowDock(window, dock_id, cond) -- Test condition (NB: bit 0 is always true) and clear flags for next time if cond and cond ~= 0 and bit32.band(window.SetWindowDockAllowFlags, cond) == 0 then return end - window.SetWindowDockAllowFlags = bit32.band(window.SetWindowDockAllowFlags, bit32.bnot(bit32.bor(ImGuiCond.Once, ImGuiCond.FirstUseEver, ImGuiCond.Appearing))) + window.SetWindowDockAllowFlags = bit32.band(window.SetWindowDockAllowFlags, bit32.bnot(bit32.bor(2 --[[ImGuiCond.Once]], 4 --[[ImGuiCond.FirstUseEver]], 8 --[[ImGuiCond.Appearing]]))) if window.DockId == dock_id then return end @@ -3602,7 +3636,7 @@ function ImGui.SetWindowDock(window, dock_id, cond) -- Policy: Find central node or latest focused node. We first move back to our root node. new_node = ImGui.DockNodeGetRootNode(new_node) if new_node.CentralNode then - IM_ASSERT(new_node.CentralNode:IsCentralNode()) + assert(new_node.CentralNode:IsCentralNode()) dock_id = new_node.CentralNode.ID else dock_id = new_node.LastFocusedNodeId @@ -3624,37 +3658,37 @@ function ImGui.DockSpace(dockspace_id, size_arg, flags, window_class) if flags == nil then flags = 0 end local g = ImGui.GetCurrentContext() local window = ImGui.GetCurrentWindowRead() - if bit32.band(g.IO.ConfigFlags, ImGuiConfigFlags.DockingEnable) == 0 then return 0 end + if bit32.band(g.IO.ConfigFlags, 128 --[[ImGuiConfigFlags.DockingEnable]]) == 0 then return 0 end -- Early out if parent window is hidden/collapsed -- This is faster but also DockNodeUpdateTabBar() relies on TabBarLayout() running (which won't if SkipItems=true) to set NextSelectedTabId = 0). See #2960. -- If for whichever reason this is causing problem we would need to ensure that DockNodeUpdateTabBar() ends up clearing NextSelectedTabId even if SkipItems=true. - if window.SkipItems then flags = bit32.bor(flags, ImGuiDockNodeFlags.KeepAliveOnly) end - if bit32.band(flags, ImGuiDockNodeFlags.KeepAliveOnly) == 0 then window = ImGui.GetCurrentWindow() end -- call to set window.WriteAccessed = true; + if window.SkipItems then flags = bit32.bor(flags, 1 --[[ImGuiDockNodeFlags.KeepAliveOnly]]) end + if bit32.band(flags, 1 --[[ImGuiDockNodeFlags.KeepAliveOnly]]) == 0 then window = ImGui.GetCurrentWindow() end -- call to set window.WriteAccessed = true; - IM_ASSERT(bit32.band(flags, ImGuiDockNodeFlags.DockSpace) == 0) -- Flag is automatically set by DockSpace() as LocalFlags, not SharedFlags! - IM_ASSERT(bit32.band(flags, ImGuiDockNodeFlags.CentralNode) == 0) -- Flag is automatically set by DockSpace() as LocalFlags, not SharedFlags! (#8145) + assert(bit32.band(flags, 1024 --[[ImGuiDockNodeFlags.DockSpace]]) == 0) -- Flag is automatically set by DockSpace() as LocalFlags, not SharedFlags! + assert(bit32.band(flags, 2048 --[[ImGuiDockNodeFlags.CentralNode]]) == 0) -- Flag is automatically set by DockSpace() as LocalFlags, not SharedFlags! (#8145) - IM_ASSERT(dockspace_id ~= 0) + assert(dockspace_id ~= 0) local node = ImGui.DockContextFindNodeByID(g, dockspace_id) if node == nil then node = ImGui.DockContextAddNode(g, dockspace_id) - node:SetLocalFlags(ImGuiDockNodeFlags.CentralNode) + node:SetLocalFlags(2048 --[[ImGuiDockNodeFlags.CentralNode]]) end node.SharedFlags = flags node.WindowClass = window_class or ImGuiWindowClass() -- When a DockSpace transitioned form implicit to explicit this may be called a second time -- It is possible that the node has already been claimed by a docked window which appeared before the DockSpace() node, so we overwrite IsDockSpace again. - if node.LastFrameActive == g.FrameCount and bit32.band(flags, ImGuiDockNodeFlags.KeepAliveOnly) == 0 then - IM_ASSERT(node:IsDockSpace() == false, "Cannot call DockSpace() twice a frame with the same ID") - node:SetLocalFlags(bit32.bor(node.LocalFlags, ImGuiDockNodeFlags.DockSpace)) + if node.LastFrameActive == g.FrameCount and bit32.band(flags, 1 --[[ImGuiDockNodeFlags.KeepAliveOnly]]) == 0 then + assert(node:IsDockSpace() == false, "Cannot call DockSpace() twice a frame with the same ID") + node:SetLocalFlags(bit32.bor(node.LocalFlags, 1024 --[[ImGuiDockNodeFlags.DockSpace]])) return dockspace_id end - node:SetLocalFlags(bit32.bor(node.LocalFlags, ImGuiDockNodeFlags.DockSpace)) + node:SetLocalFlags(bit32.bor(node.LocalFlags, 1024 --[[ImGuiDockNodeFlags.DockSpace]])) -- Keep alive mode, this is allow windows docked into this node so stay docked even if they are not visible - if bit32.band(flags, ImGuiDockNodeFlags.KeepAliveOnly) ~= 0 then + if bit32.band(flags, 1 --[[ImGuiDockNodeFlags.KeepAliveOnly]]) ~= 0 then node.LastFrameAlive = g.FrameCount return dockspace_id end @@ -3663,7 +3697,7 @@ function ImGui.DockSpace(dockspace_id, size_arg, flags, window_class) local size = ImVec2(ImTrunc(size_arg.x), ImTrunc(size_arg.y)) if size.x <= 0.0 then size.x = ImMax(content_avail.x + size.x, 4.0) end -- Arbitrary minimum child size (0.0f causing too much issues) if size.y <= 0.0 then size.y = ImMax(content_avail.y + size.y, 4.0) end - IM_ASSERT(size.x > 0.0 and size.y > 0.0) + assert(size.x > 0.0 and size.y > 0.0) node.Pos = ImVec2(window.DC.CursorPos.x, window.DC.CursorPos.y) node.Size = ImVec2(size.x, size.y) @@ -3674,14 +3708,14 @@ function ImGui.DockSpace(dockspace_id, size_arg, flags, window_class) -- FIXME-DOCK: Why do we need a child window to host a dockspace, could we host it in the existing window? -- FIXME-DOCK: What is the reason for not simply calling BeginChild()? (OK to have a reason but should be commented) - local window_flags = bit32.bor(ImGuiWindowFlags.ChildWindow, ImGuiWindowFlags.DockNodeHost) - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.NoSavedSettings, ImGuiWindowFlags.NoResize, ImGuiWindowFlags.NoCollapse, ImGuiWindowFlags.NoTitleBar) - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.NoScrollbar, ImGuiWindowFlags.NoScrollWithMouse) - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.NoBackground) + local window_flags = bit32.bor(16777216 --[[ImGuiWindowFlags.ChildWindow]], 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) + window_flags = bit32.bor(window_flags, 256 --[[ImGuiWindowFlags.NoSavedSettings]], 2 --[[ImGuiWindowFlags.NoResize]], 32 --[[ImGuiWindowFlags.NoCollapse]], 1 --[[ImGuiWindowFlags.NoTitleBar]]) + window_flags = bit32.bor(window_flags, 8 --[[ImGuiWindowFlags.NoScrollbar]], 16 --[[ImGuiWindowFlags.NoScrollWithMouse]]) + window_flags = bit32.bor(window_flags, 128 --[[ImGuiWindowFlags.NoBackground]]) local title = string.format("%s/DockSpace_%08X", window.Name, dockspace_id) - ImGui.PushStyleVar(ImGuiStyleVar.ChildBorderSize, 0.0) + ImGui.PushStyleVar(8 --[[ImGuiStyleVar.ChildBorderSize]], 0.0) ImGui.Begin(title, nil, window_flags) ImGui.PopStyleVar() @@ -3690,7 +3724,7 @@ function ImGui.DockSpace(dockspace_id, size_arg, flags, window_class) host_window.ChildId = window:GetID(title) node.OnlyNodeWithWindows = nil - IM_ASSERT(node:IsRootNode()) + assert(node:IsRootNode()) -- We need to handle the rare case were a central node is missing. -- This can happen if the node was first created manually with DockBuilderAddNode() but _without_ the ImGuiDockNodeFlags.Dockspace. @@ -3699,7 +3733,7 @@ function ImGui.DockSpace(dockspace_id, size_arg, flags, window_class) -- The specific sub-property of _CentralNode we are interested in recovering here is the "Don't delete when empty" property, -- as it doesn't make sense for an empty dockspace to not have this property. if node:IsLeafNode() and not node:IsCentralNode() then - node:SetLocalFlags(bit32.bor(node.LocalFlags, ImGuiDockNodeFlags.CentralNode)) + node:SetLocalFlags(bit32.bor(node.LocalFlags, 2048 --[[ImGuiDockNodeFlags.CentralNode]])) end -- Update the node @@ -3709,9 +3743,9 @@ function ImGui.DockSpace(dockspace_id, size_arg, flags, window_class) local bb = ImRect(node.Pos, node.Pos + size) ImGui.ItemSize(size) - ImGui.ItemAdd(bb, dockspace_id, nil, ImGuiItemFlags.NoNav) -- Not a nav point (could be, would need to draw the nav rect and replicate/refactor activation from BeginChild(), but seems like CTRL+Tab works better here?) - if bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HoveredRect) ~= 0 and ImGui.IsWindowChildOf(g.HoveredWindow, host_window, false, true) then -- To fullfill IsItemHovered(), similar to EndChild() - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HoveredWindow) + ImGui.ItemAdd(bb, dockspace_id, nil, 2 --[[ImGuiItemFlags.NoNav]]) -- Not a nav point (could be, would need to draw the nav rect and replicate/refactor activation from BeginChild(), but seems like CTRL+Tab works better here?) + if bit32.band(g.LastItemData.StatusFlags, 1 --[[ImGuiItemStatusFlags.HoveredRect]]) ~= 0 and ImGui.IsWindowChildOf(g.HoveredWindow, host_window, false, true) then -- To fullfill IsItemHovered(), similar to EndChild() + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 128 --[[ImGuiItemStatusFlags.HoveredWindow]]) end return dockspace_id @@ -3732,23 +3766,23 @@ function ImGui.DockSpaceOverViewport(dockspace_id, viewport, dockspace_flags, wi ImGui.SetNextWindowViewport(viewport.ID) local host_window_flags = 0 - host_window_flags = bit32.bor(host_window_flags, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoCollapse, ImGuiWindowFlags.NoResize, ImGuiWindowFlags.NoMove, ImGuiWindowFlags.NoDocking) - host_window_flags = bit32.bor(host_window_flags, ImGuiWindowFlags.NoBringToFrontOnFocus, ImGuiWindowFlags.NoNavFocus) - if bit32.band(dockspace_flags, ImGuiDockNodeFlags.PassthruCentralNode) ~= 0 then - host_window_flags = bit32.bor(host_window_flags, ImGuiWindowFlags.NoBackground) + host_window_flags = bit32.bor(host_window_flags, 1 --[[ImGuiWindowFlags.NoTitleBar]], 32 --[[ImGuiWindowFlags.NoCollapse]], 2 --[[ImGuiWindowFlags.NoResize]], 4 --[[ImGuiWindowFlags.NoMove]], 524288 --[[ImGuiWindowFlags.NoDocking]]) + host_window_flags = bit32.bor(host_window_flags, 8192 --[[ImGuiWindowFlags.NoBringToFrontOnFocus]], 131072 --[[ImGuiWindowFlags.NoNavFocus]]) + if bit32.band(dockspace_flags, 8 --[[ImGuiDockNodeFlags.PassthruCentralNode]]) ~= 0 then + host_window_flags = bit32.bor(host_window_flags, 128 --[[ImGuiWindowFlags.NoBackground]]) end -- FIXME-OPT: When using ImGuiDockNodeFlags.KeepAliveOnly with DockSpaceOverViewport() we might be able to spare submitting the window, -- since DockSpace() with that flag doesn't need a window. We'd only need to compute the default ID accordingly. - if bit32.band(dockspace_flags, ImGuiDockNodeFlags.KeepAliveOnly) ~= 0 then - host_window_flags = bit32.bor(host_window_flags, ImGuiWindowFlags.NoMouseInputs) + if bit32.band(dockspace_flags, 1 --[[ImGuiDockNodeFlags.KeepAliveOnly]]) ~= 0 then + host_window_flags = bit32.bor(host_window_flags, 512 --[[ImGuiWindowFlags.NoMouseInputs]]) end local label = string.format("WindowOverViewport_%08X", viewport.ID) - ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 0.0) - ImGui.PushStyleVar(ImGuiStyleVar.WindowBorderSize, 0.0) - ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, ImVec2(0.0, 0.0)) + ImGui.PushStyleVar(3 --[[ImGuiStyleVar.WindowRounding]], 0.0) + ImGui.PushStyleVar(4 --[[ImGuiStyleVar.WindowBorderSize]], 0.0) + ImGui.PushStyleVar(2 --[[ImGuiStyleVar.WindowPadding]], ImVec2(0.0, 0.0)) ImGui.Begin(label, nil, host_window_flags) ImGui.PopStyleVar(3) @@ -3791,7 +3825,7 @@ function ImGui.DockBuilderDockWindow(window_name, node_id) if window then -- Apply to created window local prev_node_id = window.DockId - ImGui.SetWindowDock(window, node_id, ImGuiCond.Always) + ImGui.SetWindowDock(window, node_id, 1 --[[ImGuiCond.Always]]) if window.DockId ~= prev_node_id then window.DockOrder = -1 end else -- Apply to settings @@ -3816,16 +3850,16 @@ function ImGui.DockBuilderSetNodePos(node_id, pos) local node = ImGui.DockContextFindNodeByID(ImGui.GetCurrentContext(), node_id) if node == nil then return end node.Pos = ImVec2(pos.x, pos.y) - node.AuthorityForPos = ImGuiDataAuthority.DockNode + node.AuthorityForPos = 1 --[[ImGuiDataAuthority.DockNode]] end function ImGui.DockBuilderSetNodeSize(node_id, size) local node = ImGui.DockContextFindNodeByID(ImGui.GetCurrentContext(), node_id) if node == nil then return end - IM_ASSERT(size.x > 0.0 and size.y > 0.0) + assert(size.x > 0.0 and size.y > 0.0) node.Size = ImVec2(size.x, size.y) node.SizeRef = ImVec2(size.x, size.y) - node.AuthorityForSize = ImGuiDataAuthority.DockNode + node.AuthorityForSize = 1 --[[ImGuiDataAuthority.DockNode]] end -- Make sure to use the ImGuiDockNodeFlags.DockSpace flag to create a dockspace node! Otherwise this will create a floating node! @@ -3842,8 +3876,8 @@ function ImGui.DockBuilderAddNode(node_id, flags) if node_id ~= 0 then ImGui.DockBuilderRemoveNode(node_id) end local node - if bit32.band(flags, ImGuiDockNodeFlags.DockSpace) ~= 0 then - ImGui.DockSpace(node_id, ImVec2(0, 0), bit32.bor(bit32.band(flags, bit32.bnot(ImGuiDockNodeFlags.DockSpace)), ImGuiDockNodeFlags.KeepAliveOnly)) + if bit32.band(flags, 1024 --[[ImGuiDockNodeFlags.DockSpace]]) ~= 0 then + ImGui.DockSpace(node_id, ImVec2(0, 0), bit32.bor(bit32.band(flags, bit32.bnot(1024 --[[ImGuiDockNodeFlags.DockSpace]])), 1 --[[ImGuiDockNodeFlags.KeepAliveOnly]])) node = ImGui.DockContextFindNodeByID(g, node_id) else node = ImGui.DockContextAddNode(g, node_id) @@ -3863,7 +3897,7 @@ function ImGui.DockBuilderRemoveNode(node_id) node = ImGui.DockContextFindNodeByID(g, node_id) if node == nil then return end if node:IsCentralNode() and node.ParentNode then - node.ParentNode:SetLocalFlags(bit32.bor(node.ParentNode.LocalFlags, ImGuiDockNodeFlags.CentralNode)) + node.ParentNode:SetLocalFlags(bit32.bor(node.ParentNode.LocalFlags, 2048 --[[ImGuiDockNodeFlags.CentralNode]])) end ImGui.DockContextRemoveNode(g, node, true) end @@ -3877,8 +3911,8 @@ function ImGui.DockBuilderRemoveNodeChildNodes(root_id) if root_id ~= 0 and root_node == nil then return end local has_central_node = false - local backup_root_node_authority_for_pos = root_node and root_node.AuthorityForPos or ImGuiDataAuthority.Auto - local backup_root_node_authority_for_size = root_node and root_node.AuthorityForSize or ImGuiDataAuthority.Auto + local backup_root_node_authority_for_pos = root_node and root_node.AuthorityForPos or 0 --[[ImGuiDataAuthority.Auto]] + local backup_root_node_authority_for_size = root_node and root_node.AuthorityForSize or 0 --[[ImGuiDataAuthority.Auto]] -- Process active windows local nodes_to_remove = {} @@ -3933,7 +3967,7 @@ function ImGui.DockBuilderRemoveNodeChildNodes(root_id) dc.Requests:clear() elseif has_central_node then root_node.CentralNode = root_node - root_node:SetLocalFlags(bit32.bor(root_node.LocalFlags, ImGuiDockNodeFlags.CentralNode)) + root_node:SetLocalFlags(bit32.bor(root_node.LocalFlags, 2048 --[[ImGuiDockNodeFlags.CentralNode]])) end end @@ -3959,7 +3993,7 @@ function ImGui.DockBuilderRemoveNodeDockedWindows(root_id, clear_settings_refs) if want_removal then local backup_dock_id = window.DockId ImGui.DockContextProcessUndockWindow(g, window, clear_settings_refs) - if not clear_settings_refs then IM_ASSERT(window.DockId == backup_dock_id) end + if not clear_settings_refs then assert(window.DockId == backup_dock_id) end end end end @@ -3970,11 +4004,11 @@ end --- @return ImGuiID id_at_dir, ImGuiID id_at_opposite_dir function ImGui.DockBuilderSplitNode(id, split_dir, size_ratio_for_node_at_dir) local g = ImGui.GetCurrentContext() - IM_ASSERT(split_dir ~= ImGuiDir.None) + assert(split_dir ~= (-1) --[[ImGuiDir.None]]) local node = ImGui.DockContextFindNodeByID(g, id) if node == nil then - IM_ASSERT(node ~= nil) + assert(node ~= nil) return 0, 0 end @@ -3984,11 +4018,11 @@ function ImGui.DockBuilderSplitNode(id, split_dir, size_ratio_for_node_at_dir) req.DockTargetNode = node req.DockPayload = nil req.DockSplitDir = split_dir - req.DockSplitRatio = ImSaturate((split_dir == ImGuiDir.Left or split_dir == ImGuiDir.Up) and size_ratio_for_node_at_dir or (1.0 - size_ratio_for_node_at_dir)) + req.DockSplitRatio = ImSaturate((split_dir == 0 --[[ImGuiDir.Left]] or split_dir == 2 --[[ImGuiDir.Up]]) and size_ratio_for_node_at_dir or (1.0 - size_ratio_for_node_at_dir)) req.DockSplitOuter = false ImGui.DockContextProcessDock(g, req) - local first = (split_dir == ImGuiDir.Left or split_dir == ImGuiDir.Up) + local first = (split_dir == 0 --[[ImGuiDir.Left]] or split_dir == 2 --[[ImGuiDir.Up]]) local id_at_dir = node.ChildNodes[first and 0 or 1].ID local id_at_opposite_dir = node.ChildNodes[first and 1 or 0].ID return id_at_dir, id_at_opposite_dir @@ -3999,7 +4033,7 @@ local function DockBuilderCopyNodeRec(src_node, dst_node_id_if_known, out_node_r local dst_node = ImGui.DockContextAddNode(g, dst_node_id_if_known) dst_node.SharedFlags = src_node.SharedFlags dst_node.LocalFlags = src_node.LocalFlags - dst_node.LocalFlagsInWindows = ImGuiDockNodeFlags.None + dst_node.LocalFlagsInWindows = 0 --[[ImGuiDockNodeFlags.None]] dst_node.Pos = ImVec2(src_node.Pos.x, src_node.Pos.y) dst_node.Size = ImVec2(src_node.Size.x, src_node.Size.y) dst_node.SizeRef = ImVec2(src_node.SizeRef.x, src_node.SizeRef.y) @@ -4021,18 +4055,18 @@ end --- @param out_node_remap_pairs table # 1-based array, cleared and filled with (src_id, dst_id) pairs function ImGui.DockBuilderCopyNode(src_node_id, dst_node_id, out_node_remap_pairs) local g = ImGui.GetCurrentContext() - IM_ASSERT(src_node_id ~= 0) - IM_ASSERT(dst_node_id ~= 0) - IM_ASSERT(out_node_remap_pairs ~= nil) + assert(src_node_id ~= 0) + assert(dst_node_id ~= 0) + assert(out_node_remap_pairs ~= nil) ImGui.DockBuilderRemoveNode(dst_node_id) local src_node = ImGui.DockContextFindNodeByID(g, src_node_id) - IM_ASSERT(src_node ~= nil) + assert(src_node ~= nil) for k in pairs(out_node_remap_pairs) do out_node_remap_pairs[k] = nil end DockBuilderCopyNodeRec(src_node, dst_node_id, out_node_remap_pairs) - IM_ASSERT((#out_node_remap_pairs % 2) == 0) + assert((#out_node_remap_pairs % 2) == 0) end function ImGui.DockBuilderCopyWindowSettings(src_name, dst_name) @@ -4063,10 +4097,10 @@ end -- FIXME: Will probably want to change this signature, in particular how the window remapping pairs are passed. --- @param in_window_remap_pairs table # 1-based array of window names: src0, dst0, src1, dst1, ... function ImGui.DockBuilderCopyDockSpace(src_dockspace_id, dst_dockspace_id, in_window_remap_pairs) - IM_ASSERT(src_dockspace_id ~= 0) - IM_ASSERT(dst_dockspace_id ~= 0) - IM_ASSERT(in_window_remap_pairs ~= nil) - IM_ASSERT((#in_window_remap_pairs % 2) == 0) + assert(src_dockspace_id ~= 0) + assert(dst_dockspace_id ~= 0) + assert(in_window_remap_pairs ~= nil) + assert((#in_window_remap_pairs % 2) == 0) -- Duplicate entire dock -- FIXME: When overwriting dst_dockspace_id, windows that aren't part of our dockspace window class but that are docked in a same node will be split apart, @@ -4152,7 +4186,7 @@ end function ImGui.GetWindowAlwaysWantOwnTabBar(window) local g = ImGui.GetCurrentContext() if g.IO.ConfigDockingAlwaysTabBar or window.WindowClass.DockingAlwaysTabBar then - if bit32.band(window.Flags, bit32.bor(ImGuiWindowFlags.ChildWindow, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoDocking)) == 0 then + if bit32.band(window.Flags, bit32.bor(16777216 --[[ImGuiWindowFlags.ChildWindow]], 1 --[[ImGuiWindowFlags.NoTitleBar]], 524288 --[[ImGuiWindowFlags.NoDocking]])) == 0 then if not window.IsFallbackWindow then return true end -- We don't support AlwaysTabBar on the fallback/implicit window to avoid unused dock-node overhead/noise end end @@ -4162,7 +4196,7 @@ end function ImGui.DockContextBindNodeToWindow(ctx, window) local g = ctx local node = ImGui.DockContextFindNodeByID(ctx, window.DockId) - IM_ASSERT(window.DockNode == nil) + assert(window.DockNode == nil) -- We should not be docking into a split node (SetWindowDock should avoid this) if node and node:IsSplitNode() then @@ -4173,9 +4207,9 @@ function ImGui.DockContextBindNodeToWindow(ctx, window) -- Create node if node == nil then node = ImGui.DockContextAddNode(ctx, window.DockId) - node.AuthorityForPos = ImGuiDataAuthority.Window - node.AuthorityForSize = ImGuiDataAuthority.Window - node.AuthorityForViewport = ImGuiDataAuthority.Window + node.AuthorityForPos = 2 --[[ImGuiDataAuthority.Window]] + node.AuthorityForSize = 2 --[[ImGuiDataAuthority.Window]] + node.AuthorityForViewport = 2 --[[ImGuiDataAuthority.Window]] node.LastFrameAlive = g.FrameCount end @@ -4188,7 +4222,7 @@ function ImGui.DockContextBindNodeToWindow(ctx, window) while not ancestor_node.IsVisible and ancestor_node.ParentNode do ancestor_node = ancestor_node.ParentNode end - IM_ASSERT(ancestor_node.Size.x > 0.0 and ancestor_node.Size.y > 0.0) + assert(ancestor_node.Size.x > 0.0 and ancestor_node.Size.y > 0.0) ImGui.DockNodeUpdateHasCentralNodeChild(ImGui.DockNodeGetRootNode(ancestor_node)) ImGui.DockNodeTreeUpdatePosSize(ancestor_node, ancestor_node.Pos, ancestor_node.Size, node) end @@ -4197,13 +4231,13 @@ function ImGui.DockContextBindNodeToWindow(ctx, window) local node_was_visible = node.IsVisible ImGui.DockNodeAddWindow(node, window, true) node.IsVisible = node_was_visible -- Don't mark visible right away (so DockContextEndFrame() doesn't render it, maybe other side effects? will see) - IM_ASSERT(node == window.DockNode) + assert(node == window.DockNode) return node end local function StoreDockStyleForWindow(window) local g = ImGui.GetCurrentContext() - for color_n = 0, ImGuiWindowDockStyleCol.COUNT - 1 do + for color_n = 0, 9 --[[ImGuiWindowDockStyleCol.COUNT]] - 1 do window.DockStyle.Colors[color_n] = ImGui.ColorConvertFloat4ToU32(g.Style.Colors[GWindowDockStyleColors[color_n]]) end end @@ -4222,14 +4256,14 @@ function ImGui.BeginDocked(window, p_open) local auto_dock_node = ImGui.GetWindowAlwaysWantOwnTabBar(window) if auto_dock_node then if window.DockId == 0 then - IM_ASSERT(window.DockNode == nil) + assert(window.DockNode == nil) window.DockId = ImGui.DockContextGenNodeID(g) end else -- Calling SetNextWindowPos() undock windows by default (by setting PosUndock) local want_undock = false - want_undock = want_undock or bit32.band(window.Flags, ImGuiWindowFlags.NoDocking) ~= 0 - want_undock = want_undock or (bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasPos) ~= 0 and bit32.band(window.SetWindowPosAllowFlags, g.NextWindowData.PosCond) ~= 0 and g.NextWindowData.PosUndock) + want_undock = want_undock or bit32.band(window.Flags, 524288 --[[ImGuiWindowFlags.NoDocking]]) ~= 0 + want_undock = want_undock or (bit32.band(g.NextWindowData.HasFlags, 1 --[[ImGuiNextWindowDataFlags.HasPos]]) ~= 0 and bit32.band(window.SetWindowPosAllowFlags, g.NextWindowData.PosCond) ~= 0 and g.NextWindowData.PosUndock) if want_undock then ImGui.DockContextProcessUndockWindow(g, window) return p_open @@ -4238,7 +4272,7 @@ function ImGui.BeginDocked(window, p_open) -- Bind to our dock node local node = window.DockNode - if node ~= nil then IM_ASSERT(window.DockId == node.ID) end + if node ~= nil then assert(window.DockId == node.ID) end if window.DockId ~= 0 and node == nil then node = ImGui.DockContextBindNodeToWindow(g, window) if node == nil then return p_open end @@ -4264,7 +4298,7 @@ function ImGui.BeginDocked(window, p_open) -- and never create neither a host window neither a tab bar. -- FIXME-DOCK: replace .HostWindow nil compare with something more explicit (~was initially intended as a first frame test) if node.HostWindow == nil then - if node.State == ImGuiDockNodeState.HostWindowHiddenBecauseWindowsAreResizing then + if node.State == 2 --[[ImGuiDockNodeState.HostWindowHiddenBecauseWindowsAreResizing]] then window.DockIsActive = true end if node.Windows.Size > 1 and window.Appearing then -- Only hide appearing window @@ -4274,13 +4308,13 @@ function ImGui.BeginDocked(window, p_open) end -- We can have zero-sized nodes (e.g. children of a small-size dockspace) - IM_ASSERT(node.HostWindow) - IM_ASSERT(node:IsLeafNode()) - IM_ASSERT(node.Size.x >= 0.0 and node.Size.y >= 0.0) - node.State = ImGuiDockNodeState.HostWindowVisible + assert(node.HostWindow) + assert(node:IsLeafNode()) + assert(node.Size.x >= 0.0 and node.Size.y >= 0.0) + node.State = 3 --[[ImGuiDockNodeState.HostWindowVisible]] -- Undock if we are submitted earlier than the host window - if bit32.band(node.MergedFlags, ImGuiDockNodeFlags.KeepAliveOnly) == 0 and window.BeginOrderWithinContext < node.HostWindow.BeginOrderWithinContext then + if bit32.band(node.MergedFlags, 1 --[[ImGuiDockNodeFlags.KeepAliveOnly]]) == 0 and window.BeginOrderWithinContext < node.HostWindow.BeginOrderWithinContext then ImGui.DockContextProcessUndockWindow(g, window) return p_open end @@ -4292,19 +4326,19 @@ function ImGui.BeginDocked(window, p_open) window.DockIsActive = true window.DockNodeIsVisible = true window.DockTabIsVisible = false - if bit32.band(node.MergedFlags, ImGuiDockNodeFlags.KeepAliveOnly) ~= 0 then return p_open end + if bit32.band(node.MergedFlags, 1 --[[ImGuiDockNodeFlags.KeepAliveOnly]]) ~= 0 then return p_open end -- When the window is selected we mark it as visible. if node.VisibleWindow == window then window.DockTabIsVisible = true end -- Update window flag - IM_ASSERT(bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) == 0) - window.Flags = bit32.bor(window.Flags, ImGuiWindowFlags.ChildWindow, ImGuiWindowFlags.NoResize) - window.ChildFlags = bit32.bor(window.ChildFlags, ImGuiChildFlags.AlwaysUseWindowPadding) + assert(bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0) + window.Flags = bit32.bor(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]], 2 --[[ImGuiWindowFlags.NoResize]]) + window.ChildFlags = bit32.bor(window.ChildFlags, 2 --[[ImGuiChildFlags.AlwaysUseWindowPadding]]) if node:IsHiddenTabBar() or node:IsNoTabBar() then - window.Flags = bit32.bor(window.Flags, ImGuiWindowFlags.NoTitleBar) + window.Flags = bit32.bor(window.Flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) else - window.Flags = bit32.band(window.Flags, bit32.bnot(ImGuiWindowFlags.NoTitleBar)) -- Clear the NoTitleBar flag in case the user set it: confusingly enough we need a title bar height so we are correctly offset, but it won't be displayed! + window.Flags = bit32.band(window.Flags, bit32.bnot(1 --[[ImGuiWindowFlags.NoTitleBar]])) -- Clear the NoTitleBar flag in case the user set it: confusingly enough we need a title bar height so we are correctly offset, but it won't be displayed! end -- Save new dock order only if the window has been visible once already @@ -4325,9 +4359,9 @@ end function ImGui.BeginDockableDragDropSource(window) local g = ImGui.GetCurrentContext() - IM_ASSERT(g.ActiveId == window.MoveId) - IM_ASSERT(g.MovingWindow == window) - IM_ASSERT(g.CurrentWindow == window) + assert(g.ActiveId == window.MoveId) + assert(g.MovingWindow == window) + assert(g.CurrentWindow == window) -- 0: Hold SHIFT to disable docking, 1: Hold SHIFT to enable docking. if g.IO.ConfigDockingWithShift ~= g.IO.KeyShift then @@ -4335,16 +4369,16 @@ function ImGui.BeginDockableDragDropSource(window) -- We cannot set for HoveredWindowUnderMovingWindow ~= nil here, as it is only valid/useful when drag and drop is already active -- (because of the 'is_mouse_dragging_with_an_expected_destination' logic in UpdateViewportsNewFrame() function) if g.IO.ConfigDockingWithShift and g.MouseStationaryTimer >= 1.0 and g.ActiveId >= 1 then - ImGui.SetTooltip("%s", ImGui.LocalizeGetMsg(ImGuiLocKey.DockingHoldShiftToDock)) + ImGui.SetTooltip("%s", ImGui.LocalizeGetMsg(14 --[[ImGuiLocKey.DockingHoldShiftToDock]])) end return end g.LastItemData.ID = window.MoveId window = window.RootWindowDockTree - IM_ASSERT(bit32.band(window.Flags, ImGuiWindowFlags.NoDocking) == 0) + assert(bit32.band(window.Flags, 524288 --[[ImGuiWindowFlags.NoDocking]]) == 0) local is_drag_docking = g.IO.ConfigDockingWithShift or ImRect(0, 0, window.SizeFull.x, ImGui.GetFrameHeight()):Contains(g.ActiveIdClickOffset) -- FIXME-DOCKING: Need to make this stateful and explicit - local drag_drop_flags = bit32.bor(ImGuiDragDropFlags.SourceNoPreviewTooltip, ImGuiDragDropFlags.SourceNoHoldToOpenOthers, ImGuiDragDropFlags.PayloadAutoExpire, ImGuiDragDropFlags.PayloadNoCrossContext, ImGuiDragDropFlags.PayloadNoCrossProcess) + local drag_drop_flags = bit32.bor(1 --[[ImGuiDragDropFlags.SourceNoPreviewTooltip]], 4 --[[ImGuiDragDropFlags.SourceNoHoldToOpenOthers]], 32 --[[ImGuiDragDropFlags.PayloadAutoExpire]], 64 --[[ImGuiDragDropFlags.PayloadNoCrossContext]], 128 --[[ImGuiDragDropFlags.PayloadNoCrossProcess]]) if is_drag_docking and ImGui.BeginDragDropSource(drag_drop_flags) then ImGui.SetDragDropPayload(IMGUI_PAYLOAD_TYPE_WINDOW, window) ImGui.EndDragDropSource() @@ -4356,7 +4390,7 @@ function ImGui.BeginDockableDragDropTarget(window) local g = ImGui.GetCurrentContext() --IM_ASSERT(window.RootWindowDockTree == window) -- May also be a DockSpace - IM_ASSERT(bit32.band(window.Flags, ImGuiWindowFlags.NoDocking) == 0) + assert(bit32.band(window.Flags, 524288 --[[ImGuiWindowFlags.NoDocking]]) == 0) if not g.DragDropActive then return end --GetForegroundDrawList(window):AddRect(window.Pos, window.Pos + window.Size, IM_COL32(255, 255, 0, 255)) if not ImGui.BeginDragDropTargetCustom(window:Rect(), window.ID) then return end @@ -4370,7 +4404,7 @@ function ImGui.BeginDockableDragDropTarget(window) end local payload_window = payload.Data - if ImGui.AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_WINDOW, bit32.bor(ImGuiDragDropFlags.AcceptBeforeDelivery, ImGuiDragDropFlags.AcceptNoDrawDefaultRect)) then + if ImGui.AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_WINDOW, bit32.bor(1024 --[[ImGuiDragDropFlags.AcceptBeforeDelivery]], 2048 --[[ImGuiDragDropFlags.AcceptNoDrawDefaultRect]])) then -- Select target node -- (Important: we cannot use g.HoveredDockNode here! Because each of our target node have filters based on payload, each candidate drop target will do its own evaluation) local dock_into_floating_window = false @@ -4517,7 +4551,7 @@ DockSettingsHandler_ReadLine = function(ctx, handler, entry, line) line = line:sub(9) elseif line:sub(1, 9) == "DockSpace" then line = line:sub(10) - node.Flags = bit32.bor(node.Flags, ImGuiDockNodeFlags.DockSpace) + node.Flags = bit32.bor(node.Flags, 1024 --[[ImGuiDockNodeFlags.DockSpace]]) else return end @@ -4549,18 +4583,18 @@ DockSettingsHandler_ReadLine = function(ctx, handler, entry, line) end local c = take(" Split=(%a)") if c then - if c == "X" then node.SplitAxis = ImGuiAxis.X elseif c == "Y" then node.SplitAxis = ImGuiAxis.Y end + if c == "X" then node.SplitAxis = 1 --[[ImGuiAxis.X]] elseif c == "Y" then node.SplitAxis = 2 --[[ImGuiAxis.Y]] end end local function flag(name, f) local x = take(" " .. name .. "=(%-?%d+)") if x and tonumber(x) ~= 0 then node.Flags = bit32.bor(node.Flags, f) end end - flag("NoResize", ImGuiDockNodeFlags.NoResize) - flag("CentralNode", ImGuiDockNodeFlags.CentralNode) - flag("NoTabBar", ImGuiDockNodeFlags.NoTabBar) - flag("HiddenTabBar", ImGuiDockNodeFlags.HiddenTabBar) - flag("NoWindowMenuButton", ImGuiDockNodeFlags.NoWindowMenuButton) - flag("NoCloseButton", ImGuiDockNodeFlags.NoCloseButton) + flag("NoResize", 32 --[[ImGuiDockNodeFlags.NoResize]]) + flag("CentralNode", 2048 --[[ImGuiDockNodeFlags.CentralNode]]) + flag("NoTabBar", 4096 --[[ImGuiDockNodeFlags.NoTabBar]]) + flag("HiddenTabBar", 8192 --[[ImGuiDockNodeFlags.HiddenTabBar]]) + flag("NoWindowMenuButton", 16384 --[[ImGuiDockNodeFlags.NoWindowMenuButton]]) + flag("NoCloseButton", 32768 --[[ImGuiDockNodeFlags.NoCloseButton]]) v = take(" Selected=0x(%x+)") if v then node.SelectedTabId = tonumber(v, 16) end if node.ParentNodeId ~= 0 then @@ -4576,9 +4610,9 @@ local function DockSettingsHandler_DockNodeToSettings(dc, node, depth) node_settings.ParentNodeId = node.ParentNode and node.ParentNode.ID or 0 node_settings.ParentWindowId = (node:IsDockSpace() and node.HostWindow and node.HostWindow.ParentWindow) and node.HostWindow.ParentWindow.ID or 0 node_settings.SelectedTabId = node.SelectedTabId - node_settings.SplitAxis = node:IsSplitNode() and node.SplitAxis or ImGuiAxis.None + node_settings.SplitAxis = node:IsSplitNode() and node.SplitAxis or 0 --[[ImGuiAxis.None]] node_settings.Depth = depth - node_settings.Flags = bit32.band(node.LocalFlags, ImGuiDockNodeFlags.SavedFlagsMask_) + node_settings.Flags = bit32.band(node.LocalFlags, 261152 --[[ImGuiDockNodeFlags.SavedFlagsMask_]]) node_settings.Pos = ImVec2(ImTrunc(node.Pos.x), ImTrunc(node.Pos.y)) node_settings.Size = ImVec2(ImTrunc(node.Size.x), ImTrunc(node.Size.y)) node_settings.SizeRef = ImVec2(ImTrunc(node.SizeRef.x), ImTrunc(node.SizeRef.y)) @@ -4590,7 +4624,7 @@ end DockSettingsHandler_WriteAll = function(ctx, handler, buf) local g = ctx local dc = ctx.DockContext - if bit32.band(g.IO.ConfigFlags, ImGuiConfigFlags.DockingEnable) == 0 then return end + if bit32.band(g.IO.ConfigFlags, 128 --[[ImGuiConfigFlags.DockingEnable]]) == 0 then return end -- Gather settings data -- (unlike our windows settings, because nodes are always built we can do a full rewrite of the SettingsNode buffer) @@ -4608,7 +4642,7 @@ DockSettingsHandler_WriteAll = function(ctx, handler, buf) -- Write to text buffer buf:appendf("[%s][Data]\n", handler.TypeName) for _, s in dc.NodesSettings:iter() do - buf:append(string.rep(" ", s.Depth * 2) .. ((bit32.band(s.Flags, ImGuiDockNodeFlags.DockSpace) ~= 0) and "DockSpace" or "DockNode ") .. string.rep(" ", (max_depth - s.Depth) * 2)) -- Text align nodes to facilitate looking at .ini file + buf:append(string.rep(" ", s.Depth * 2) .. ((bit32.band(s.Flags, 1024 --[[ImGuiDockNodeFlags.DockSpace]]) ~= 0) and "DockSpace" or "DockNode ") .. string.rep(" ", (max_depth - s.Depth) * 2)) -- Text align nodes to facilitate looking at .ini file buf:appendf(" ID=0x%08X", s.ID) if s.ParentNodeId ~= 0 then buf:appendf(" Parent=0x%08X SizeRef=%d,%d", s.ParentNodeId, s.SizeRef.x, s.SizeRef.y) @@ -4616,13 +4650,13 @@ DockSettingsHandler_WriteAll = function(ctx, handler, buf) if s.ParentWindowId ~= 0 then buf:appendf(" Window=0x%08X", s.ParentWindowId) end buf:appendf(" Pos=%d,%d Size=%d,%d", s.Pos.x, s.Pos.y, s.Size.x, s.Size.y) end - if s.SplitAxis ~= ImGuiAxis.None then buf:appendf(" Split=%s", (s.SplitAxis == ImGuiAxis.X) and "X" or "Y") end - if bit32.band(s.Flags, ImGuiDockNodeFlags.NoResize) ~= 0 then buf:append(" NoResize=1") end - if bit32.band(s.Flags, ImGuiDockNodeFlags.CentralNode) ~= 0 then buf:append(" CentralNode=1") end - if bit32.band(s.Flags, ImGuiDockNodeFlags.NoTabBar) ~= 0 then buf:append(" NoTabBar=1") end - if bit32.band(s.Flags, ImGuiDockNodeFlags.HiddenTabBar) ~= 0 then buf:append(" HiddenTabBar=1") end - if bit32.band(s.Flags, ImGuiDockNodeFlags.NoWindowMenuButton) ~= 0 then buf:append(" NoWindowMenuButton=1") end - if bit32.band(s.Flags, ImGuiDockNodeFlags.NoCloseButton) ~= 0 then buf:append(" NoCloseButton=1") end + if s.SplitAxis ~= 0 --[[ImGuiAxis.None]] then buf:appendf(" Split=%s", (s.SplitAxis == 1 --[[ImGuiAxis.X]]) and "X" or "Y") end + if bit32.band(s.Flags, 32 --[[ImGuiDockNodeFlags.NoResize]]) ~= 0 then buf:append(" NoResize=1") end + if bit32.band(s.Flags, 2048 --[[ImGuiDockNodeFlags.CentralNode]]) ~= 0 then buf:append(" CentralNode=1") end + if bit32.band(s.Flags, 4096 --[[ImGuiDockNodeFlags.NoTabBar]]) ~= 0 then buf:append(" NoTabBar=1") end + if bit32.band(s.Flags, 8192 --[[ImGuiDockNodeFlags.HiddenTabBar]]) ~= 0 then buf:append(" HiddenTabBar=1") end + if bit32.band(s.Flags, 16384 --[[ImGuiDockNodeFlags.NoWindowMenuButton]]) ~= 0 then buf:append(" NoWindowMenuButton=1") end + if bit32.band(s.Flags, 32768 --[[ImGuiDockNodeFlags.NoCloseButton]]) ~= 0 then buf:append(" NoCloseButton=1") end if s.SelectedTabId ~= 0 then buf:appendf(" Selected=0x%08X", s.SelectedTabId) end buf:append("\n") end @@ -4666,8 +4700,8 @@ end function ImGui.SetNextWindowDockID(id, cond) local g = ImGui.GetCurrentContext() - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasDock) - g.NextWindowData.DockCond = (cond and cond ~= 0) and cond or ImGuiCond.Always + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 4096 --[[ImGuiNextWindowDataFlags.HasDock]]) + g.NextWindowData.DockCond = (cond and cond ~= 0) and cond or 1 --[[ImGuiCond.Always]] g.NextWindowData.DockId = id end @@ -4675,7 +4709,7 @@ end function ImGui.StartMouseMovingWindowOrNode(window, node, undock) local g = ImGui.GetCurrentContext() local can_undock_node = false - if undock and node ~= nil and node.VisibleWindow and bit32.band(node.VisibleWindow.Flags, ImGuiWindowFlags.NoMove) == 0 and bit32.band(node.MergedFlags, ImGuiDockNodeFlags.NoUndocking) == 0 then + if undock and node ~= nil and node.VisibleWindow and bit32.band(node.VisibleWindow.Flags, 4 --[[ImGuiWindowFlags.NoMove]]) == 0 and bit32.band(node.MergedFlags, 128 --[[ImGuiDockNodeFlags.NoUndocking]]) == 0 then -- Can undock if: -- - part of a hierarchy with more than one visible node (if only one is visible, we'll just move the root window) -- - part of a dockspace node hierarchy: so we can undock the last single visible node too. Undocking from a fixed/central node will create a new node and copy windows. @@ -4698,7 +4732,7 @@ end -- and because the saved space means that the left-most tab label can stay at exactly the same position as the label of a loose window. function ImGui.RenderArrowDockMenu(draw_list, p_min, sz, col) draw_list:AddRectFilled(p_min + ImVec2(sz * 0.20, sz * 0.15), p_min + ImVec2(sz * 0.80, sz * 0.30), col) - ImGui.RenderArrowPointingAt(draw_list, p_min + ImVec2(sz * 0.50, sz * 0.85), ImVec2(sz * 0.30, sz * 0.40), ImGuiDir.Down, col) + ImGui.RenderArrowPointingAt(draw_list, p_min + ImVec2(sz * 0.50, sz * 0.85), ImVec2(sz * 0.30, sz * 0.40), 3 --[[ImGuiDir.Down]], col) end -- Upstream CollapseButton (docking branch): replaces the port's simpler version @@ -4709,22 +4743,22 @@ function ImGui.CollapseButton(id, pos, dock_node) local bb = ImRect(pos, pos + ImVec2(g.FontSize, g.FontSize)) local is_clipped = not ImGui.ItemAdd(bb, id) - local pressed, hovered, held = ImGui.ButtonBehavior(bb, id, ImGuiButtonFlags.None) + local pressed, hovered, held = ImGui.ButtonBehavior(bb, id, 0 --[[ImGuiButtonFlags.None]]) if is_clipped then return pressed end -- Render --local is_dock_menu = (window.DockNodeAsHost and not window.Collapsed) - local bg_col = ImGui.GetColorU32((held and hovered) and ImGuiCol.ButtonActive or (hovered and ImGuiCol.ButtonHovered or ImGuiCol.Button)) - local text_col = ImGui.GetColorU32(ImGuiCol.Text) + local bg_col = ImGui.GetColorU32((held and hovered) and 24 --[[ImGuiCol.ButtonActive]] or (hovered and 23 --[[ImGuiCol.ButtonHovered]] or 22 --[[ImGuiCol.Button]])) + local text_col = ImGui.GetColorU32(0 --[[ImGuiCol.Text]]) if hovered or held then window.DrawList:AddRectFilled(bb.Min, bb.Max, bg_col) end - ImGui.RenderNavCursor(bb, id, ImGuiNavRenderCursorFlags and ImGuiNavRenderCursorFlags.Compact or nil) + ImGui.RenderNavCursor(bb, id, ImGuiNavRenderCursorFlags and 2 --[[ImGuiNavRenderCursorFlags.Compact]] or nil) if dock_node then ImGui.RenderArrowDockMenu(window.DrawList, bb.Min, g.FontSize, text_col) else - ImGui.RenderArrow(window.DrawList, bb.Min, text_col, window.Collapsed and ImGuiDir.Right or ImGuiDir.Down, 1.0) + ImGui.RenderArrow(window.DrawList, bb.Min, text_col, window.Collapsed and 1 --[[ImGuiDir.Right]] or 3 --[[ImGuiDir.Down]], 1.0) end -- Switch to moving the window after mouse is moved beyond the initial drag threshold @@ -4744,22 +4778,22 @@ function ImGui.SplitterBehavior(bb, id, axis, size1, size2, min_size1, min_size2 local g = ImGui.GetCurrentContext() local window = g.CurrentWindow - if not ImGui.ItemAdd(bb, id, nil, ImGuiItemFlags.NoNav) then return false, size1, size2 end + if not ImGui.ItemAdd(bb, id, nil, 2 --[[ImGuiItemFlags.NoNav]]) then return false, size1, size2 end -- FIXME: AFAIK the only leftover reason for passing ImGuiButtonFlags.AllowOverlap here is -- to allow caller of SplitterBehavior() to call SetItemAllowOverlap() after the item. -- Nowadays we would instead want to use SetNextItemAllowOverlap() before the item. - local button_flags = bit32.bor(ImGuiButtonFlags.FlattenChildren, ImGuiButtonFlags.AllowOverlap) + local button_flags = bit32.bor(2048 --[[ImGuiButtonFlags.FlattenChildren]], 4096 --[[ImGuiButtonFlags.AllowOverlap]]) local bb_interact = ImRect(bb.Min, bb.Max) - bb_interact:Expand(axis == ImGuiAxis.Y and ImVec2(0.0, hover_extend) or ImVec2(hover_extend, 0.0)) + bb_interact:Expand(axis == 2 --[[ImGuiAxis.Y]] and ImVec2(0.0, hover_extend) or ImVec2(hover_extend, 0.0)) local _, hovered, held = ImGui.ButtonBehavior(bb_interact, id, button_flags) if hovered then - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HoveredRect) -- for IsItemHovered(), because bb_interact is larger than bb + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 1 --[[ImGuiItemStatusFlags.HoveredRect]]) -- for IsItemHovered(), because bb_interact is larger than bb end if held or (hovered and g.HoveredIdPreviousFrame == id and g.HoveredIdTimer >= hover_visibility_delay) then - ImGui.SetMouseCursor(axis == ImGuiAxis.Y and ImGuiMouseCursor.ResizeNS or ImGuiMouseCursor.ResizeEW) + ImGui.SetMouseCursor(axis == 2 --[[ImGuiAxis.Y]] and 3 --[[ImGuiMouseCursor.ResizeNS]] or 4 --[[ImGuiMouseCursor.ResizeEW]]) end local bb_render = ImRect(bb.Min, bb.Max) @@ -4777,16 +4811,16 @@ function ImGui.SplitterBehavior(bb, id, axis, size1, size2, min_size1, min_size2 if mouse_delta ~= 0.0 then size1 = ImMax(size1 + mouse_delta, min_size1) size2 = ImMax(size2 - mouse_delta, min_size2) - bb_render:Translate(axis == ImGuiAxis.X and ImVec2(mouse_delta, 0.0) or ImVec2(0.0, mouse_delta)) + bb_render:Translate(axis == 1 --[[ImGuiAxis.X]] and ImVec2(mouse_delta, 0.0) or ImVec2(0.0, mouse_delta)) ImGui.MarkItemEdited(id) end end -- Render at new position - if bit32.band(bg_col, IM_COL32_A_MASK) ~= 0 then + if bit32.band(bg_col, 4278190080 --[[IM_COL32_A_MASK]]) ~= 0 then window.DrawList:AddRectFilled(bb_render.Min, bb_render.Max, bg_col, 0.0) end - local col = ImGui.GetColorU32(held and ImGuiCol.SeparatorActive or ((hovered and g.HoveredIdTimer >= hover_visibility_delay) and ImGuiCol.SeparatorHovered or ImGuiCol.Separator)) + local col = ImGui.GetColorU32(held and 30 --[[ImGuiCol.SeparatorActive]] or ((hovered and g.HoveredIdTimer >= hover_visibility_delay) and 29 --[[ImGuiCol.SeparatorHovered]] or 28 --[[ImGuiCol.Separator]])) window.DrawList:AddRectFilled(bb_render.Min, bb_render.Max, col, 0.0) return held, size1, size2 @@ -4957,8 +4991,8 @@ function MT.ImGuiStyle:ScaleAllSizes(scale_factor) self.TabBorderSize = ImTrunc(self.TabBorderSize * scale_factor) self.TabMinWidthBase = ImTrunc(self.TabMinWidthBase * scale_factor) self.TabMinWidthShrink = ImTrunc(self.TabMinWidthShrink * scale_factor) - self.TabCloseButtonMinWidthSelected = (self.TabCloseButtonMinWidthSelected > 0.0 and self.TabCloseButtonMinWidthSelected ~= FLT_MAX) and ImTrunc(self.TabCloseButtonMinWidthSelected * scale_factor) or self.TabCloseButtonMinWidthSelected - self.TabCloseButtonMinWidthUnselected = (self.TabCloseButtonMinWidthUnselected > 0.0 and self.TabCloseButtonMinWidthUnselected ~= FLT_MAX) and ImTrunc(self.TabCloseButtonMinWidthUnselected * scale_factor) or self.TabCloseButtonMinWidthUnselected + self.TabCloseButtonMinWidthSelected = (self.TabCloseButtonMinWidthSelected > 0.0 and self.TabCloseButtonMinWidthSelected ~= 3.4028234663853e+38 --[[FLT_MAX]]) and ImTrunc(self.TabCloseButtonMinWidthSelected * scale_factor) or self.TabCloseButtonMinWidthSelected + self.TabCloseButtonMinWidthUnselected = (self.TabCloseButtonMinWidthUnselected > 0.0 and self.TabCloseButtonMinWidthUnselected ~= 3.4028234663853e+38 --[[FLT_MAX]]) and ImTrunc(self.TabCloseButtonMinWidthUnselected * scale_factor) or self.TabCloseButtonMinWidthUnselected self.TabBarBorderSize = ImTrunc(self.TabBarBorderSize * scale_factor) self.TabBarOverlineSize = ImTrunc(self.TabBarOverlineSize * scale_factor) self.TreeLinesSize = ImTrunc(self.TreeLinesSize * scale_factor) @@ -5006,19 +5040,19 @@ local function GetResizeBorderRect(window, border_n, perp_padding, thickness) if thickness == 0.0 then ImVec2_CopyV(rect.Max, rect.Max.x - 1, rect.Max.y - 1) end - if border_n == ImGuiDir.Left then + if border_n == 0 --[[ImGuiDir.Left]] then return ImRect(rect.Min.x - thickness, rect.Min.y + perp_padding, rect.Min.x + thickness, rect.Max.y - perp_padding) end - if border_n == ImGuiDir.Right then + if border_n == 1 --[[ImGuiDir.Right]] then return ImRect(rect.Max.x - thickness, rect.Min.y + perp_padding, rect.Max.x + thickness, rect.Max.y - perp_padding) end - if border_n == ImGuiDir.Up then + if border_n == 2 --[[ImGuiDir.Up]] then return ImRect(rect.Min.x + perp_padding, rect.Min.y - thickness, rect.Max.x - perp_padding, rect.Min.y + thickness) end - if border_n == ImGuiDir.Down then + if border_n == 3 --[[ImGuiDir.Down]] then return ImRect(rect.Min.x + perp_padding, rect.Max.y - thickness, rect.Max.x - perp_padding, rect.Max.y + thickness) end - IM_ASSERT(false) + assert(false) return ImRect() end @@ -5157,7 +5191,7 @@ function ImStd.ImTextCharFromUtf8(in_text, pos, in_text_end) local e = 0 e = bit32.lshift((out_char < mins[len + 1]) and 1 or 0, 6) -- non-canonical encoding e = bit32.bor(e, bit32.lshift((bit32.rshift(out_char, 11) == 0x1b) and 1 or 0, 7)) -- surrogate half? - e = bit32.bor(e, bit32.lshift((out_char > IM_UNICODE_CODEPOINT_MAX) and 1 or 0, 8)) -- out of range we can store in ImWchar (FIXME: May evolve) + e = bit32.bor(e, bit32.lshift((out_char > 65535 --[[IM_UNICODE_CODEPOINT_MAX]]) and 1 or 0, 8)) -- out of range we can store in ImWchar (FIXME: May evolve) e = bit32.bor(e, bit32.rshift(bit32.band(s[2], 0xc0), 2)) e = bit32.bor(e, bit32.rshift(bit32.band(s[3], 0xc0), 4)) e = bit32.bor(e, bit32.rshift(s[4], 6)) @@ -5170,7 +5204,7 @@ function ImStd.ImTextCharFromUtf8(in_text, pos, in_text_end) -- All available bytes (at most `len` bytes) are consumed on incomplete/invalid second to last bytes. -- Invalid or incomplete input may consume less bytes than wanted, therefore every byte has to be inspected in s. wanted = ImMin(wanted, (s[1] ~= 0 and 1 or 0) + (s[2] ~= 0 and 1 or 0) + (s[3] ~= 0 and 1 or 0) + (s[4] ~= 0 and 1 or 0)) - out_char = IM_UNICODE_CODEPOINT_INVALID + out_char = 65533 --[[IM_UNICODE_CODEPOINT_INVALID]] end return wanted, out_char @@ -5264,7 +5298,7 @@ function ImStd.ImTextFindValidUtf8CodepointEnd(text, in_text_start, in_text_end, local prev_c_len, prev_c = ImStd.ImTextCharFromUtf8(text, prev, in_text_end) -- Check if the previous character is valid and fits within the range - if prev_c ~= IM_UNICODE_CODEPOINT_INVALID and prev_c_len <= (in_p - prev) then + if prev_c ~= 65533 --[[IM_UNICODE_CODEPOINT_INVALID]] and prev_c_len <= (in_p - prev) then return in_p end return prev @@ -5446,8 +5480,8 @@ function ImGui.UpdateCurrentFontSize(restore_font_size_after_scaling) -- - We started rounding in 1.90 WIP (18991) as our layout system currently doesn't support non-rounded font size well yet. -- - We may support it better later and remove this rounding. final_size = ImGui.GetRoundedFontSize(final_size) - final_size = ImClamp(final_size, 4.0, IMGUI_FONT_SIZE_MAX) - if (g.Font ~= nil and bit32.band(g.IO.BackendFlags, ImGuiBackendFlags.RendererHasTextures) ~= 0) then + final_size = ImClamp(final_size, 4.0, 512 --[[IMGUI_FONT_SIZE_MAX]]) + if (g.Font ~= nil and bit32.band(g.IO.BackendFlags, 16 --[[ImGuiBackendFlags.RendererHasTextures]]) ~= 0) then g.Font.CurrentRasterizerDensity = g.FontRasterizerDensity end g.FontSize = final_size @@ -5473,7 +5507,7 @@ function ImGui.SetCurrentFont(font, font_size_before_scaling, font_size_after_sc ImGui.UpdateCurrentFontSize(font_size_after_scaling) if font ~= nil then - IM_ASSERT(font and font:IsLoaded()) -- Font Atlas not created. Did you call io.Fonts:GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ? + assert(font and font:IsLoaded()) -- Font Atlas not created. Did you call io.Fonts:GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ? local atlas = font.OwnerAtlas g.DrawListSharedData.FontAtlas = atlas g.DrawListSharedData.Font = font @@ -5492,8 +5526,8 @@ function ImGui.PushFont(font, font_size_base) font = g.Font end - IM_ASSERT(font ~= nil) - IM_ASSERT(font_size_base >= 0.0) + assert(font ~= nil) + assert(font_size_base >= 0.0) g.FontStack:push_back(ImFontStackData(font, g.FontSizeBase, g.FontSize)) @@ -5522,7 +5556,7 @@ end function ImGui.UpdateTexturesNewFrame() -- Cannot update every atlases based on atlas's FrameCount < g.FrameCount, because an atlas may be shared by multiple contexts with different frame count. local g = GImGui - local has_textures = bit32.band(g.IO.BackendFlags, ImGuiBackendFlags.RendererHasTextures) ~= 0 + local has_textures = bit32.band(g.IO.BackendFlags, 16 --[[ImGuiBackendFlags.RendererHasTextures]]) ~= 0 for _, atlas in g.FontAtlases:iter() do if (atlas.OwnerContext == g) then ImFontAtlasUpdateNewFrame(atlas, g.FrameCount, has_textures) @@ -5531,8 +5565,8 @@ function ImGui.UpdateTexturesNewFrame() -- Otherwise, calling ImGui.CreateContext() without parameter will create an atlas owned by the context. -- (2) If you have multiple font atlases, make sure the 'atlas.RendererHasTextures' as specified in the ImFontAtlasUpdateNewFrame() call matches for that. -- (3) If you have multiple imgui contexts, they also need to have a matching value for ImGuiBackendFlags.RendererHasTextures. - IM_ASSERT(atlas.Builder ~= nil and atlas.Builder.FrameCount ~= -1) - IM_ASSERT(atlas.RendererHasTextures == has_textures) + assert(atlas.Builder ~= nil and atlas.Builder.FrameCount ~= -1) + assert(atlas.RendererHasTextures == has_textures) end end @@ -5560,7 +5594,7 @@ end function ImGui.UpdateFontsNewFrame() local g = GImGui - if (bit32.band(g.IO.BackendFlags, ImGuiBackendFlags.RendererHasTextures) == 0) then + if (bit32.band(g.IO.BackendFlags, 16 --[[ImGuiBackendFlags.RendererHasTextures]]) == 0) then for _, atlas in g.FontAtlases:iter() do atlas.Locked = true end @@ -5584,7 +5618,7 @@ function ImGui.UpdateFontsNewFrame() local font_stack_data = ImFontStackData(font, g.Style.FontSizeBase, g.Style.FontSizeBase) -- <--- Will restore FontSize ImGui.SetCurrentFont(font_stack_data.Font, font_stack_data.FontSizeBeforeScaling, 0.0) -- <--- but use 0.0f to enable scale g.FontStack:push_back(font_stack_data) - IM_ASSERT(g.Font:IsLoaded()) + assert(g.Font:IsLoaded()) end function ImGui.UpdateFontsEndFrame() @@ -5605,7 +5639,7 @@ end function ImGui.RegisterFontAtlas(atlas) local g = GImGui if (g.FontAtlases.Size == 0) then - IM_ASSERT(atlas == g.IO.Fonts) + assert(atlas == g.IO.Fonts) end atlas.RefCount = atlas.RefCount + 1 g.FontAtlases:push_back(atlas) @@ -5618,7 +5652,7 @@ end --- @param atlas ImFontAtlas function ImGui.UnregisterFontAtlas(atlas) local g = GImGui - IM_ASSERT(atlas.RefCount > 0) + assert(atlas.RefCount > 0) ImFontAtlasRemoveDrawListSharedData(atlas, g.DrawListSharedData) g.FontAtlases:find_erase(atlas) atlas.RefCount = atlas.RefCount - 1 @@ -5685,7 +5719,7 @@ local GLocalizationEntriesEnUS = { function ImGui.Initialize() local g = GImGui - IM_ASSERT(not g.Initialized and not g.SettingsLoaded) + assert(not g.Initialized and not g.SettingsLoaded) -- Add .ini handle for ImGuiWindow and ImGuiTable types ImGui.WindowSettingsAddSettingsHandler() @@ -5700,17 +5734,17 @@ function ImGui.Initialize() viewport.ID = IMGUI_VIEWPORT_DEFAULT_ID viewport.Idx = 1 viewport.PlatformWindowCreated = true - viewport.Flags = ImGuiViewportFlags.OwnedByApp + viewport.Flags = 4 --[[ImGuiViewportFlags.OwnedByApp]] g.Viewports:push_back(viewport) g.ViewportCreatedCount = g.ViewportCreatedCount + 1 g.PlatformIO.Viewports:push_back(g.Viewports.Data[1]) -- Build KeysMayBeCharInput[] lookup table (1 bit per named key) - for key = ImGuiKey.NamedKey_BEGIN, ImGuiKey.NamedKey_END - 1 do - if (key >= ImGuiKey.K0 and key <= ImGuiKey.K9) or (key >= ImGuiKey.A and key <= ImGuiKey.Z) or (key >= ImGuiKey.Keypad0 and key <= ImGuiKey.Keypad9) - or key == ImGuiKey.Tab or key == ImGuiKey.Space or key == ImGuiKey.Apostrophe or key == ImGuiKey.Comma or key == ImGuiKey.Minus or key == ImGuiKey.Period - or key == ImGuiKey.Slash or key == ImGuiKey.Semicolon or key == ImGuiKey.Equal or key == ImGuiKey.LeftBracket or key == ImGuiKey.RightBracket or key == ImGuiKey.GraveAccent - or key == ImGuiKey.KeypadDecimal or key == ImGuiKey.KeypadDivide or key == ImGuiKey.KeypadMultiply or key == ImGuiKey.KeypadSubtract or key == ImGuiKey.KeypadAdd or key == ImGuiKey.KeypadEqual then + for key = 512 --[[ImGuiKey.NamedKey_BEGIN]], 667 --[[ImGuiKey.NamedKey_END]] - 1 do + if (key >= 536 --[[ImGuiKey.K0]] and key <= 545 --[[ImGuiKey.K9]]) or (key >= 546 --[[ImGuiKey.A]] and key <= 571 --[[ImGuiKey.Z]]) or (key >= 612 --[[ImGuiKey.Keypad0]] and key <= 621 --[[ImGuiKey.Keypad9]]) + or key == 512 --[[ImGuiKey.Tab]] or key == 524 --[[ImGuiKey.Space]] or key == 596 --[[ImGuiKey.Apostrophe]] or key == 597 --[[ImGuiKey.Comma]] or key == 598 --[[ImGuiKey.Minus]] or key == 599 --[[ImGuiKey.Period]] + or key == 600 --[[ImGuiKey.Slash]] or key == 601 --[[ImGuiKey.Semicolon]] or key == 602 --[[ImGuiKey.Equal]] or key == 603 --[[ImGuiKey.LeftBracket]] or key == 605 --[[ImGuiKey.RightBracket]] or key == 606 --[[ImGuiKey.GraveAccent]] + or key == 622 --[[ImGuiKey.KeypadDecimal]] or key == 623 --[[ImGuiKey.KeypadDivide]] or key == 624 --[[ImGuiKey.KeypadMultiply]] or key == 625 --[[ImGuiKey.KeypadSubtract]] or key == 626 --[[ImGuiKey.KeypadAdd]] or key == 628 --[[ImGuiKey.KeypadEqual]] then g.KeysMayBeCharInput:SetBit(key + 1) end end @@ -5818,14 +5852,14 @@ local function ApplyWindowSettings(window, settings) window.Collapsed = settings.Collapsed window.DockId = settings.DockId or 0 window.DockOrder = settings.DockOrder or -1 - SetWindowConditionAllowFlags(window, ImGuiCond.FirstUseEver, false) + SetWindowConditionAllowFlags(window, 4 --[[ImGuiCond.FirstUseEver]], false) end -- So first call to CalcWindowContentSizes() doesn't return crazy values ImVec2_Copy(window.DC.CursorStartPos, window.Pos) ImVec2_Copy(window.DC.CursorMaxPos, window.Pos) ImVec2_Copy(window.DC.IdealMaxPos, window.Pos) - if (bit32.band(window.Flags, ImGuiWindowFlags.AlwaysAutoResize) ~= 0) then + if (bit32.band(window.Flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) ~= 0) then window.AutoFitFramesX = 2; window.AutoFitFramesY = 2 window.AutoFitOnlyGrows = false else @@ -5847,7 +5881,7 @@ local function InitOrLoadWindowSettings(window, settings) ImVec2_Copy(window.Size, ImVec2(0, 0)) ImVec2_Copy(window.SizeFull, ImVec2(0, 0)) ImVec2_Copy(window.ViewportPos, main_viewport.Pos) - window.SetWindowPosAllowFlags = bit32.bor(ImGuiCond.Always, ImGuiCond.Once, ImGuiCond.FirstUseEver, ImGuiCond.Appearing) + window.SetWindowPosAllowFlags = bit32.bor(1 --[[ImGuiCond.Always]], 2 --[[ImGuiCond.Once]], 4 --[[ImGuiCond.FirstUseEver]], 8 --[[ImGuiCond.Appearing]]) window.SetWindowSizeAllowFlags = window.SetWindowPosAllowFlags window.SetWindowCollapsedAllowFlags = window.SetWindowPosAllowFlags window.SetWindowDockAllowFlags = window.SetWindowPosAllowFlags @@ -5875,7 +5909,7 @@ local function CreateNewWindow(name, flags) g.WindowsById[window_id] = window local settings = nil - if bit32.band(window.Flags, ImGuiWindowFlags.NoSavedSettings) == 0 then + if bit32.band(window.Flags, 256 --[[ImGuiWindowFlags.NoSavedSettings]]) == 0 then settings = ImGui.FindWindowSettingsByWindow(window) if settings ~= nil then window.SettingsOffset = g.SettingsWindows:index_from_ptr(settings) @@ -5884,7 +5918,7 @@ local function CreateNewWindow(name, flags) InitOrLoadWindowSettings(window, settings) - if bit32.band(flags, ImGuiWindowFlags.NoBringToFrontOnFocus) ~= 0 then + if bit32.band(flags, 8192 --[[ImGuiWindowFlags.NoBringToFrontOnFocus]]) ~= 0 then g.Windows:push_front(window) -- Quite slow but rare and only once else g.Windows:push_back(window) @@ -5937,7 +5971,7 @@ end --- @param window? ImGuiWindow function ImGui.MarkIniSettingsDirty(window) local g = GImGui - if window ~= nil and bit32.band(window.Flags, ImGuiWindowFlags.NoSavedSettings) ~= 0 then return end + if window ~= nil and bit32.band(window.Flags, 256 --[[ImGuiWindowFlags.NoSavedSettings]]) ~= 0 then return end if g.SettingsDirtyTimer <= 0.0 then g.SettingsDirtyTimer = g.IO.IniSavingRate end @@ -5946,7 +5980,7 @@ end --- @param handler ImGuiSettingsHandler function ImGui.AddSettingsHandler(handler) local g = GImGui - IM_ASSERT(ImGui.FindSettingsHandler(handler.TypeName) == nil) + assert(ImGui.FindSettingsHandler(handler.TypeName) == nil) if handler.TypeHash == 0 or handler.TypeHash == nil then handler.TypeHash = ImHashStr(handler.TypeName) end g.SettingsHandlers:push_back(handler) end @@ -5998,7 +6032,7 @@ end -- Set ini_size==0 (or nil) to use the whole string (Lua strings know their length). function ImGui.LoadIniSettingsFromMemory(ini_data, ini_size) local g = GImGui - IM_ASSERT(g.Initialized) + assert(g.Initialized) --IM_ASSERT(not g.WithinFrameScope, "Cannot be called between NewFrame() and EndFrame()") --IM_ASSERT(g.SettingsLoaded == false and g.FrameCount == 0) @@ -6079,7 +6113,7 @@ function ImGui.ClearWindowSettings(name) --IMGUI_DEBUG_LOG("ClearWindowSettings('%s')\n", name) local window = ImGui.FindWindowByName(name) if window ~= nil then - window.Flags = bit32.bor(window.Flags, ImGuiWindowFlags.NoSavedSettings) + window.Flags = bit32.bor(window.Flags, 256 --[[ImGuiWindowFlags.NoSavedSettings]]) InitOrLoadWindowSettings(window, nil) if window.DockId and window.DockId ~= 0 and ImGui.DockContextProcessUndockWindow then ImGui.DockContextProcessUndockWindow(GImGui, window, true) @@ -6151,13 +6185,13 @@ local function WindowSettingsHandler_WriteAll(ctx, handler, buf) -- (if a window wasn't opened in this session we preserve its settings) local g = ctx for _, window in g.Windows:iter() do - if bit32.band(window.Flags, ImGuiWindowFlags.NoSavedSettings) == 0 then + if bit32.band(window.Flags, 256 --[[ImGuiWindowFlags.NoSavedSettings]]) == 0 then local settings = ImGui.FindWindowSettingsByWindow(window) if not settings then settings = ImGui.CreateNewWindowSettings(window.Name) window.SettingsOffset = g.SettingsWindows:index_from_ptr(settings) end - IM_ASSERT(settings.ID == window.ID) + assert(settings.ID == window.ID) ImVec2_CopyV(settings.Pos, ImTrunc(window.Pos.x - window.ViewportPos.x), ImTrunc(window.Pos.y - window.ViewportPos.y)) ImVec2_CopyV(settings.Size, ImTrunc(window.SizeFull.x), ImTrunc(window.SizeFull.y)) settings.ViewportId = window.ViewportId or 0 @@ -6300,14 +6334,14 @@ end function ImGui.LogBegin(flags, auto_open_depth) local g = GImGui local window = g.CurrentWindow - IM_ASSERT(g.LogEnabled == false) + assert(g.LogEnabled == false) g.LogEnabled = true; g.ItemUnclipByLog = true g.LogFlags = flags g.LogWindow = window g.LogNextPrefix = nil; g.LogNextSuffix = nil g.LogDepthRef = window.DC.TreeDepth g.LogDepthToExpand = ((auto_open_depth or -1) >= 0) and auto_open_depth or g.LogDepthToExpandDefault - g.LogLinePosY = FLT_MAX + g.LogLinePosY = 3.4028234663853e+38 --[[FLT_MAX]] g.LogLineFirstItem = true g.LogBuffer = ImGuiTextBuffer() end @@ -6322,7 +6356,7 @@ end function ImGui.LogToTTY(auto_open_depth) local g = GImGui if g.LogEnabled then return end - ImGui.LogBegin(ImGuiLogFlags.OutputTTY, auto_open_depth or -1) + ImGui.LogBegin(1 --[[ImGuiLogFlags.OutputTTY]], auto_open_depth or -1) g.LogFile = "stdout" end @@ -6336,25 +6370,25 @@ end function ImGui.LogToClipboard(auto_open_depth) local g = GImGui if g.LogEnabled then return end - ImGui.LogBegin(ImGuiLogFlags.OutputClipboard, auto_open_depth or -1) + ImGui.LogBegin(8 --[[ImGuiLogFlags.OutputClipboard]], auto_open_depth or -1) end function ImGui.LogToBuffer(auto_open_depth) local g = GImGui if g.LogEnabled then return end - ImGui.LogBegin(ImGuiLogFlags.OutputBuffer, auto_open_depth or -1) + ImGui.LogBegin(4 --[[ImGuiLogFlags.OutputBuffer]], auto_open_depth or -1) end function ImGui.LogFinish() local g = GImGui if not g.LogEnabled then return end ImGui.LogText("\n") - local out = bit32.band(g.LogFlags, ImGuiLogFlags.OutputMask_) - if out == ImGuiLogFlags.OutputClipboard then + local out = bit32.band(g.LogFlags, 15 --[[ImGuiLogFlags.OutputMask_]]) + if out == 8 --[[ImGuiLogFlags.OutputClipboard]] then if not g.LogBuffer:empty() then ImGui.SetClipboardText(g.LogBuffer:c_str()) end end g.LogEnabled = false; g.ItemUnclipByLog = false - g.LogFlags = ImGuiLogFlags.None + g.LogFlags = 0 --[[ImGuiLogFlags.None]] g.LogFile = nil g.LogBuffer = ImGuiTextBuffer() end @@ -6367,7 +6401,7 @@ function ImGui.LogButtons() local log_to_tty = ImGui.Button("Log To TTY"); ImGui.SameLine() local log_to_file = ImGui.Button("Log To File"); ImGui.SameLine() local log_to_clipboard = ImGui.Button("Log To Clipboard"); ImGui.SameLine() - ImGui.PushItemFlag(ImGuiItemFlags.NoTabStop, true) + ImGui.PushItemFlag(1 --[[ImGuiItemFlags.NoTabStop]], true) ImGui.SetNextItemWidth(ImGui.CalcTextSize("999").x) g.LogDepthToExpandDefault = ImGui.SliderInt("Default Depth", g.LogDepthToExpandDefault, 0, 9, nil) ImGui.PopItemFlag() @@ -6448,7 +6482,7 @@ function ImGui.IsMouseDragPastThreshold(button, lock_threshold) if lock_threshold == nil then lock_threshold = -1.0 end local g = GImGui - IM_ASSERT(button >= 0 and button < 3) -- IM_COUNTOF(g.IO.MouseDown) + assert(button >= 0 and button < 3) -- IM_COUNTOF(g.IO.MouseDown) if lock_threshold < 0.0 then lock_threshold = g.IO.MouseDragThreshold end @@ -6461,7 +6495,7 @@ function ImGui.IsMouseDragging(button, lock_threshold) if lock_threshold == nil then lock_threshold = -1.0 end local g = GImGui - IM_ASSERT(button >= 0 and button < 3) -- IM_COUNTOF(g.IO.MouseDown) + assert(button >= 0 and button < 3) -- IM_COUNTOF(g.IO.MouseDown) if not g.IO.MouseDown[button] then return false end @@ -6485,22 +6519,22 @@ end function ImGui.ItemHandleShortcut(id) local g = GImGui local flags = g.NextItemData.ShortcutFlags - IM_ASSERT(bit32.band(flags, bit32.bnot(ImGuiInputFlags.SupportedBySetNextItemShortcut)) == 0) -- Passing flags not supported by SetNextItemShortcut()! + assert(bit32.band(flags, bit32.bnot(523519 --[[ImGuiInputFlags.SupportedBySetNextItemShortcut]])) == 0) -- Passing flags not supported by SetNextItemShortcut()! - if bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.Disabled) ~= 0 then + if bit32.band(g.LastItemData.ItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) ~= 0 then return end - if bit32.band(flags, ImGuiInputFlags.Tooltip) ~= 0 then - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HasShortcut) + if bit32.band(flags, 262144 --[[ImGuiInputFlags.Tooltip]]) ~= 0 then + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 1024 --[[ImGuiItemStatusFlags.HasShortcut]]) g.LastItemData.Shortcut = g.NextItemData.Shortcut end - if not ImGui.Shortcut(g.NextItemData.Shortcut, bit32.band(flags, ImGuiInputFlags.SupportedByShortcut), id) or g.NavActivateId ~= 0 then + if not ImGui.Shortcut(g.NextItemData.Shortcut, bit32.band(flags, 261375 --[[ImGuiInputFlags.SupportedByShortcut]]), id) or g.NavActivateId ~= 0 then return end -- FIXME: Generalize Activation queue? g.NavActivateId = id -- Will effectively disable clipping. - g.NavActivateFlags = bit32.bor(ImGuiActivateFlags.PreferInput, ImGuiActivateFlags.FromShortcut) + g.NavActivateFlags = bit32.bor(1 --[[ImGuiActivateFlags.PreferInput]], 16 --[[ImGuiActivateFlags.FromShortcut]]) -- if (g.ActiveId == 0 || g.ActiveId == id) g.NavActivateDownId = id g.NavActivatePressedId = id @@ -6534,7 +6568,7 @@ function ImGui.ItemAdd(bb, id, nav_bb_arg, extra_flags) r = last_item_data.NavRect r.Min.x = nav_bb.Min.x; r.Min.y = nav_bb.Min.y; r.Max.x = nav_bb.Max.x; r.Max.y = nav_bb.Max.y last_item_data.ItemFlags = bit32.bor(g.CurrentItemFlags, next_item_data.ItemFlagsSet, extra_flags) - last_item_data.StatusFlags = ImGuiItemStatusFlags.None + last_item_data.StatusFlags = 0 --[[ImGuiItemStatusFlags.None]] -- Note: we don't copy 'g.NextItemData.SelectionUserData' to an hypothetical g.LastItemData.SelectionUserData: since the former is not cleared. if id ~= 0 then @@ -6552,27 +6586,27 @@ function ImGui.ItemAdd(bb, id, nav_bb_arg, extra_flags) -- to reach unclipped widgets. This would work if user had explicit scrolling control (e.g. mapped on a stick). -- We intentionally don't check if g.NavWindow ~= nil because g.NavAnyRequest should only be set when it is non nil. -- If we crash on a nil g.NavWindow we need to fix the bug elsewhere. - if bit32.band(last_item_data.ItemFlags, ImGuiItemFlags.NoNav) == 0 then + if bit32.band(last_item_data.ItemFlags, 2 --[[ImGuiItemFlags.NoNav]]) == 0 then -- FIXME-NAV: investigate changing the window tests into a simple 'if (g.NavFocusScopeId == g.CurrentFocusScopeId)' test. window.DC.NavLayersActiveMaskNext = bit32.bor(window.DC.NavLayersActiveMaskNext, bit32.lshift(1, window.DC.NavLayerCurrent)) if g.NavId == id or g.NavAnyRequest then if g.NavWindow.RootWindowForNav == window.RootWindowForNav then - if window == g.NavWindow or bit32.band(bit32.bor(window.ChildFlags, g.NavWindow.ChildFlags), ImGuiChildFlags.NavFlattened) ~= 0 then + if window == g.NavWindow or bit32.band(bit32.bor(window.ChildFlags, g.NavWindow.ChildFlags), 256 --[[ImGuiChildFlags.NavFlattened]]) ~= 0 then ImGui.NavProcessItem() end end end end - if bit32.band(next_item_data.HasFlags, ImGuiNextItemDataFlags.HasShortcut) ~= 0 then + if bit32.band(next_item_data.HasFlags, 4 --[[ImGuiNextItemDataFlags.HasShortcut]]) ~= 0 then ImGui.ItemHandleShortcut(id) end end -- Lightweight clear of SetNextItemXXX data. - next_item_data.HasFlags = ImGuiNextItemDataFlags.None - next_item_data.ItemFlagsSet = ImGuiItemFlags.None + next_item_data.HasFlags = 0 --[[ImGuiNextItemDataFlags.None]] + next_item_data.ItemFlagsSet = 0 --[[ImGuiItemFlags.None]] -- Clipping test -- (this is an inline copy of IsClippedEx() so we can reuse the is_rect_visible value, otherwise we'd do 'if (IsClippedEx(bb, id)) return false') @@ -6591,11 +6625,11 @@ function ImGui.ItemAdd(bb, id, nav_bb_arg, extra_flags) -- We need to calculate this now to take account of the current clipping rectangle (as items like Selectable may change them) if is_rect_visible then - last_item_data.StatusFlags = bit32.bor(last_item_data.StatusFlags, ImGuiItemStatusFlags.Visible) + last_item_data.StatusFlags = bit32.bor(last_item_data.StatusFlags, 256 --[[ImGuiItemStatusFlags.Visible]]) end if ImGui.IsMouseHoveringRect(bb.Min, bb.Max) then - last_item_data.StatusFlags = bit32.bor(last_item_data.StatusFlags, ImGuiItemStatusFlags.HoveredRect) + last_item_data.StatusFlags = bit32.bor(last_item_data.StatusFlags, 1 --[[ImGuiItemStatusFlags.HoveredRect]]) end return true @@ -6698,7 +6732,7 @@ function ImGui.ItemSize(size_or_bb, text_baseline_y) dc.IsSameLine = false -- Horizontal layout mode - if (dc.LayoutType == ImGuiLayoutType.Horizontal) then + if (dc.LayoutType == 0 --[[ImGuiLayoutType.Horizontal]]) then ImGui.SameLine() end end @@ -6773,7 +6807,7 @@ end --- @param item_width float function ImGui.SetNextItemWidth(item_width) local g = GImGui - g.NextItemData.HasFlags = bit32.bor(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasWidth) + g.NextItemData.HasFlags = bit32.bor(g.NextItemData.HasFlags, 1 --[[ImGuiNextItemDataFlags.HasWidth]]) g.NextItemData.Width = item_width end @@ -6787,7 +6821,7 @@ function ImGui.PushItemWidth(item_width) local n = stack.Size + 1 if n > stack.Capacity then stack:push_back(window.DC.ItemWidth) else stack.Data[n] = window.DC.ItemWidth; stack.Size = n end window.DC.ItemWidth = (item_width == 0.0) and window.DC.ItemWidthDefault or item_width - g.NextItemData.HasFlags = bit32.band(g.NextItemData.HasFlags, bit32.bnot(ImGuiNextItemDataFlags.HasWidth)) + g.NextItemData.HasFlags = bit32.band(g.NextItemData.HasFlags, bit32.bnot(1 --[[ImGuiNextItemDataFlags.HasWidth]])) end function ImGui.PopItemWidth() @@ -6807,7 +6841,7 @@ end function ImGui.PushMultiItemsWidths(components, w_full) local g = GImGui local window = g.CurrentWindow - IM_ASSERT(components > 0) + assert(components > 0) local style = g.Style window.DC.ItemWidthStack:push_back(window.DC.ItemWidth) -- Backup current width local w_items = w_full - style.ItemInnerSpacing.x * (components - 1) @@ -6818,7 +6852,7 @@ function ImGui.PushMultiItemsWidths(components, w_full) prev_split = next_split end window.DC.ItemWidth = ImMax(prev_split, 1.0) - g.NextItemData.HasFlags = bit32.band(g.NextItemData.HasFlags, bit32.bnot(ImGuiNextItemDataFlags.HasWidth)) + g.NextItemData.HasFlags = bit32.band(g.NextItemData.HasFlags, bit32.bnot(1 --[[ImGuiNextItemDataFlags.HasWidth]])) end --- @return float @@ -6979,7 +7013,7 @@ function ImGui.BeginGroup() ImVec2_Copy(window.DC.CursorMaxPos, window.DC.CursorPos) ImVec2_CopyV(window.DC.CurrLineSize, 0.0, 0.0) if (g.LogEnabled) then - g.LogLinePosY = -FLT_MAX -- To enforce a carriage return + g.LogLinePosY = -3.4028234663853e+38 --[[FLT_MAX]] -- To enforce a carriage return end end @@ -6987,10 +7021,10 @@ end function ImGui.EndGroup() local g = GImGui local window = g.CurrentWindow - IM_ASSERT(g.GroupStack.Size > 0) -- Mismatched BeginGroup()/EndGroup() calls + assert(g.GroupStack.Size > 0) -- Mismatched BeginGroup()/EndGroup() calls local group_data = g.GroupStack:back() - IM_ASSERT(group_data.WindowID == window.ID) -- EndGroup() in wrong window? + assert(group_data.WindowID == window.ID) -- EndGroup() in wrong window? if (window.DC.IsSetPos) then -- TODO: ImGui.ErrorCheckUsingSetCursorPosToExtendParentBoundaries() @@ -7007,7 +7041,7 @@ function ImGui.EndGroup() window.DC.CurrLineTextBaseOffset = group_data.BackupCurrLineTextBaseOffset window.DC.IsSameLine = group_data.BackupIsSameLine if (g.LogEnabled) then - g.LogLinePosY = -FLT_MAX -- To enforce a carriage return + g.LogLinePosY = -3.4028234663853e+38 --[[FLT_MAX]] -- To enforce a carriage return end if (not group_data.EmitItem) then @@ -7017,7 +7051,7 @@ function ImGui.EndGroup() window.DC.CurrLineTextBaseOffset = ImMax(window.DC.PrevLineTextBaseOffset, group_data.BackupCurrLineTextBaseOffset) -- FIXME: Incorrect, we should grab the base offset from the *first line* of the group but it is hard to obtain now. ImGui.ItemSize(group_bb:GetSize()) - ImGui.ItemAdd(group_bb, 0, nil, ImGuiItemFlags.NoTabStop) + ImGui.ItemAdd(group_bb, 0, nil, 1 --[[ImGuiItemFlags.NoTabStop]]) -- If the current ActiveId was declared within the boundary of our group, we copy it to LastItemId so IsItemActive(), IsItemDeactivated() etc. will be functional on the entire group. -- It would be neater if we replaced window.DC.LastItemId by e.g. 'bool LastItemIsActive', but would put a little more burden on individual widgets. @@ -7035,18 +7069,18 @@ function ImGui.EndGroup() -- Forward Hovered flag local group_contains_curr_hovered_id = (group_data.BackupHoveredIdIsAlive == false) and g.HoveredId ~= 0 if group_contains_curr_hovered_id then - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HoveredWindow) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 128 --[[ImGuiItemStatusFlags.HoveredWindow]]) end -- Forward Edited flag if g.AnyIdHasBeenEditedThisFrame and not group_data.BackupAnyIdHasBeenEditedThisFrame then - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.Edited) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 4 --[[ImGuiItemStatusFlags.Edited]]) end -- Forward Deactivated flag - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HasDeactivated) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 32 --[[ImGuiItemStatusFlags.HasDeactivated]]) if group_contains_deactivated_id then - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.Deactivated) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 64 --[[ImGuiItemStatusFlags.Deactivated]]) end g.GroupStack:pop_back() @@ -7063,7 +7097,7 @@ function ImGui.CalcItemWidth() local window = g.CurrentWindow local w - if bit32.band(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasWidth) ~= 0 then + if bit32.band(g.NextItemData.HasFlags, 1 --[[ImGuiNextItemDataFlags.HasWidth]]) ~= 0 then w = g.NextItemData.Width else w = window.DC.ItemWidth @@ -7147,8 +7181,8 @@ end function ImGui.IsItemDeactivated() local g = GImGui - if bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HasDeactivated) ~= 0 then - return bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.Deactivated) ~= 0 + if bit32.band(g.LastItemData.StatusFlags, 32 --[[ImGuiItemStatusFlags.HasDeactivated]]) ~= 0 then + return bit32.band(g.LastItemData.StatusFlags, 64 --[[ImGuiItemStatusFlags.Deactivated]]) ~= 0 end return g.DeactivatedItemData.ID == g.LastItemData.ID and g.LastItemData.ID ~= 0 and g.DeactivatedItemData.ElapseFrame >= g.FrameCount end @@ -7174,11 +7208,11 @@ end --- @param mouse_button? ImGuiMouseButton function ImGui.IsItemClicked(mouse_button) if mouse_button == nil then mouse_button = 0 end - return ImGui.IsMouseClicked(mouse_button) and ImGui.IsItemHovered(ImGuiHoveredFlags.None) + return ImGui.IsMouseClicked(mouse_button) and ImGui.IsItemHovered(0 --[[ImGuiHoveredFlags.None]]) end function ImGui.IsItemToggledOpen() - return bit32.band(GImGui.LastItemData.StatusFlags, ImGuiItemStatusFlags.ToggledOpen) ~= 0 + return bit32.band(GImGui.LastItemData.StatusFlags, 16 --[[ImGuiItemStatusFlags.ToggledOpen]]) ~= 0 end -- Call after a Selectable() or TreeNode() items inside a BeginMultiSelect()/EndMultiSelect() scope. @@ -7189,8 +7223,8 @@ end -- Prefer using 'if (IsItemClicked() && !IsItemToggledOpen())' for a manual reimplementation of selection. function ImGui.IsItemToggledSelection() local g = GImGui - IM_ASSERT(g.CurrentMultiSelect ~= nil) -- Can only be used inside a BeginMultiSelect()/EndMultiSelect() - return bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.ToggledSelection) ~= 0 + assert(g.CurrentMultiSelect ~= nil) -- Can only be used inside a BeginMultiSelect()/EndMultiSelect() + return bit32.band(g.LastItemData.StatusFlags, 8 --[[ImGuiItemStatusFlags.ToggledSelection]]) ~= 0 end -- IMPORTANT: If you are trying to check whether your mouse should be dispatched to Dear ImGui or to your underlying app, @@ -7211,11 +7245,11 @@ function ImGui.IsAnyItemFocused() end function ImGui.IsItemVisible() - return bit32.band(GImGui.LastItemData.StatusFlags, ImGuiItemStatusFlags.Visible) ~= 0 + return bit32.band(GImGui.LastItemData.StatusFlags, 256 --[[ImGuiItemStatusFlags.Visible]]) ~= 0 end function ImGui.IsItemEdited() - return bit32.band(GImGui.LastItemData.StatusFlags, ImGuiItemStatusFlags.Edited) ~= 0 + return bit32.band(GImGui.LastItemData.StatusFlags, 4 --[[ImGuiItemStatusFlags.Edited]]) ~= 0 end -- Allow next item to be overlapped by subsequent items. @@ -7223,7 +7257,7 @@ end -- so if a following items overwrite it our interactions will naturally be disabled. function ImGui.SetNextItemAllowOverlap() local g = GImGui - g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, ImGuiItemFlags.AllowOverlap) + g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, 16384 --[[ImGuiItemFlags.AllowOverlap]]) end function ImGui.GetItemID() @@ -7269,14 +7303,14 @@ function ImGui.FocusWindow(window, flags) local g = GImGui -- Modal check? - if bit32.band(flags, ImGuiFocusRequestFlags.UnlessBelowModal) ~= 0 and g.NavWindow ~= window then -- Early out in common case. + if bit32.band(flags, 2 --[[ImGuiFocusRequestFlags.UnlessBelowModal]]) ~= 0 and g.NavWindow ~= window then -- Early out in common case. local blocking_modal = ImGui.FindBlockingModal(window) if blocking_modal then -- This block would typically be reached in two situations: -- - API call to FocusWindow() with a window under a modal and ImGuiFocusRequestFlags.UnlessBelowModal flag. -- - User clicking on void or anything behind a modal while a modal is open (window == nil) -- IMGUI_DEBUG_LOG_FOCUS("[focus] FocusWindow(\"%s\", UnlessBelowModal): prevented by \"%s\".", window ? window->Name : "", blocking_modal->Name) - if window and window == window.RootWindow and bit32.band(window.Flags, ImGuiWindowFlags.NoBringToFrontOnFocus) == 0 then + if window and window == window.RootWindow and bit32.band(window.Flags, 8192 --[[ImGuiWindowFlags.NoBringToFrontOnFocus]]) == 0 then ImGui.BringWindowToDisplayBehind(window, blocking_modal) -- Still bring right under modal. (FIXME: Could move in focus list too?) end ImGui.ClosePopupsOverWindow(ImGui.GetTopMostPopupModal(), false) -- Note how we need to use GetTopMostPopupModal() aad NOT blocking_modal, to handle nested modals @@ -7285,7 +7319,7 @@ function ImGui.FocusWindow(window, flags) end -- Find last focused child (if any) and focus it instead. - if bit32.band(flags, ImGuiFocusRequestFlags.RestoreFocusedChild) ~= 0 and window ~= nil then + if bit32.band(flags, 1 --[[ImGuiFocusRequestFlags.RestoreFocusedChild]]) ~= 0 and window ~= nil then window = ImGui.NavRestoreLastChildNavWindow(window) end @@ -7296,17 +7330,17 @@ function ImGui.FocusWindow(window, flags) g.NavMousePosDirty = true end g.NavId = window and window.NavLastIds[0] or 0 -- Restore NavId - g.NavLayer = ImGuiNavLayer.Main + g.NavLayer = 0 --[[ImGuiNavLayer.Main]] ImGui.SetNavFocusScope(window and window.NavRootFocusScopeId or 0) g.NavIdIsAlive = false - g.NavLastValidSelectionUserData = ImGuiSelectionUserData_Invalid + g.NavLastValidSelectionUserData = (-1) --[[ImGuiSelectionUserData_Invalid]] -- Close popups if any ImGui.ClosePopupsOverWindow(window, false) end -- Move the root window to the top of the pile - IM_ASSERT(window == nil or window.RootWindowDockTree ~= nil) + assert(window == nil or window.RootWindowDockTree ~= nil) local focus_front_window = window and window.RootWindow or nil local display_front_window = window and window.RootWindowDockTree or nil local dock_node = window and window.DockNode or nil @@ -7335,7 +7369,7 @@ function ImGui.FocusWindow(window, flags) -- Bring to front ImGui.BringWindowToFocusFront(focus_front_window) - if bit32.band(bit32.bor(window.Flags, focus_front_window.Flags, display_front_window.Flags), ImGuiWindowFlags.NoBringToFrontOnFocus) == 0 then + if bit32.band(bit32.bor(window.Flags, focus_front_window.Flags, display_front_window.Flags), 8192 --[[ImGuiWindowFlags.NoBringToFrontOnFocus]]) == 0 then ImGui.BringWindowToDisplayFront(display_front_window) end end @@ -7346,8 +7380,8 @@ function ImGui.FindWindowFocusIndex(window) local g = GImGui -- IM_UNUSED(g) local order = window.FocusOrder - IM_ASSERT(window.RootWindow == window) -- No child window (not testing _ChildWindow because of docking) - IM_ASSERT(g.WindowsFocusOrder.Data[order] == window) + assert(window.RootWindow == window) -- No child window (not testing _ChildWindow because of docking) + assert(g.WindowsFocusOrder.Data[order] == window) return order end @@ -7357,7 +7391,7 @@ end --- @param window ImGuiWindow --- @return bool function ImGui.IsWindowNavFocusable(window) - return window.WasActive and window == window.RootWindow and bit32.band(window.Flags, ImGuiWindowFlags.NoNavFocus) == 0 + return window.WasActive and window == window.RootWindow and bit32.band(window.Flags, 131072 --[[ImGuiWindowFlags.NoNavFocus]]) == 0 end --- @param i_start int @@ -7380,15 +7414,15 @@ end function ImGui.UpdateWindowInFocusOrderList(window, just_created, new_flags) local g = GImGui - local new_is_explicit_child = (bit32.band(new_flags, ImGuiWindowFlags.ChildWindow) ~= 0) and ((bit32.band(new_flags, ImGuiWindowFlags.Popup) == 0) or (bit32.band(new_flags, ImGuiWindowFlags.ChildMenu) ~= 0)) + local new_is_explicit_child = (bit32.band(new_flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0) and ((bit32.band(new_flags, 67108864 --[[ImGuiWindowFlags.Popup]]) == 0) or (bit32.band(new_flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0)) local child_flag_changed = (new_is_explicit_child ~= window.IsExplicitChild) if (just_created or child_flag_changed) and not new_is_explicit_child then - IM_ASSERT(not g.WindowsFocusOrder:contains(window)) + assert(not g.WindowsFocusOrder:contains(window)) g.WindowsFocusOrder:push_back(window) window.FocusOrder = g.WindowsFocusOrder.Size elseif not just_created and child_flag_changed and new_is_explicit_child then - IM_ASSERT(g.WindowsFocusOrder.Data[window.FocusOrder] == window) + assert(g.WindowsFocusOrder.Data[window.FocusOrder] == window) for n = window.FocusOrder + 1, g.WindowsFocusOrder.Size do g.WindowsFocusOrder.Data[n].FocusOrder = g.WindowsFocusOrder.Data[n].FocusOrder - 1 @@ -7404,10 +7438,10 @@ end --- @param window? ImGuiWindow function ImGui.BringWindowToFocusFront(window) local g = GImGui - IM_ASSERT(window == window.RootWindow) + assert(window == window.RootWindow) local cur_order = window.FocusOrder - IM_ASSERT(g.WindowsFocusOrder.Data[cur_order] == window) + assert(g.WindowsFocusOrder.Data[cur_order] == window) if g.WindowsFocusOrder:back() == window then return @@ -7418,7 +7452,7 @@ function ImGui.BringWindowToFocusFront(window) for n = cur_order, new_order - 1 do g.WindowsFocusOrder.Data[n] = g.WindowsFocusOrder.Data[n + 1] g.WindowsFocusOrder.Data[n].FocusOrder = g.WindowsFocusOrder.Data[n].FocusOrder - 1 - IM_ASSERT(g.WindowsFocusOrder.Data[n].FocusOrder == n) + assert(g.WindowsFocusOrder.Data[n].FocusOrder == n) end g.WindowsFocusOrder.Data[new_order] = window @@ -7450,7 +7484,7 @@ end --- @param window ImGuiWindow --- @param behind_window ImGuiWindow function ImGui.BringWindowToDisplayBehind(window, behind_window) - IM_ASSERT(window ~= nil and behind_window ~= nil) + assert(window ~= nil and behind_window ~= nil) local g = GImGui window = window.RootWindow behind_window = behind_window.RootWindow @@ -7467,7 +7501,7 @@ function ImGui.FocusTopMostWindowUnderOne(under_this_window, ignore_window, filt if under_this_window ~= nil then -- Aim at root window behind us, if we are in a child window that's our own root (see #4640) local offset = -1 - while bit32.band(under_this_window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 do + while bit32.band(under_this_window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 do under_this_window = under_this_window.ParentWindow offset = 0 end @@ -7484,7 +7518,7 @@ function ImGui.FocusTopMostWindowUnderOne(under_this_window, ignore_window, filt if filter_viewport ~= nil and window.Viewport ~= filter_viewport then break end - if bit32.band(window.Flags, bit32.bor(ImGuiWindowFlags.NoMouseInputs, ImGuiWindowFlags.NoNavInputs)) ~= bit32.bor(ImGuiWindowFlags.NoMouseInputs, ImGuiWindowFlags.NoNavInputs) then + if bit32.band(window.Flags, bit32.bor(512 --[[ImGuiWindowFlags.NoMouseInputs]], 65536 --[[ImGuiWindowFlags.NoNavInputs]])) ~= bit32.bor(512 --[[ImGuiWindowFlags.NoMouseInputs]], 65536 --[[ImGuiWindowFlags.NoNavInputs]]) then -- FIXME-DOCK: When ImGuiFocusRequestFlags.RestoreFocusedChild is set... -- This is failing (lagging by one frame) for docked windows. -- If A and B are docked into window and B disappear, at the NewFrame() call site window.NavLastChildNavWindow will still point to B. @@ -7503,7 +7537,7 @@ end --- @param window ImGuiWindow function ImGui.SetFocusID(id, window) local g = GImGui - IM_ASSERT(id ~= 0) + assert(id ~= 0) if g.NavWindow ~= window then ImGui.SetNavWindow(window) @@ -7519,20 +7553,20 @@ function ImGui.SetFocusID(id, window) if g.LastItemData.ID == id then ImRect_Copy(window.NavRectRel[nav_layer], ImGui.WindowRectAbsToRel(window, g.LastItemData.NavRect)) end - g.NavIdItemFlags = (g.LastItemData.ID == id) and g.LastItemData.ItemFlags or ImGuiItemFlags.None + g.NavIdItemFlags = (g.LastItemData.ID == id) and g.LastItemData.ItemFlags or 0 --[[ImGuiItemFlags.None]] if id == g.ActiveIdIsAlive then g.NavIdIsAlive = true end - if g.ActiveIdSource == ImGuiInputSource.Keyboard or g.ActiveIdSource == ImGuiInputSource.Gamepad then + if g.ActiveIdSource == 2 --[[ImGuiInputSource.Keyboard]] or g.ActiveIdSource == 3 --[[ImGuiInputSource.Gamepad]] then g.NavHighlightItemUnderNav = true elseif g.IO.ConfigNavCursorVisibleAuto then g.NavCursorVisible = false end -- Clear preferred scoring position (NavMoveRequestApplyResult() will tend to restore it) - ImGui.NavClearPreferredPosForAxis(ImGuiAxis.X) - ImGui.NavClearPreferredPosForAxis(ImGuiAxis.Y) + ImGui.NavClearPreferredPosForAxis(1 --[[ImGuiAxis.X]]) + ImGui.NavClearPreferredPosForAxis(2 --[[ImGuiAxis.Y]]) end -- This is not 100% symmetric with StartMouseMovingWindow(). @@ -7547,7 +7581,7 @@ function ImGui.StopMouseMovingWindow() if window and window.Viewport then -- Try to merge the window back into the main viewport. -- This works because MouseViewport should be ~= MovingWindow.Viewport on release (as per code in UpdateViewports) - if bit32.band(g.ConfigFlagsCurrFrame, ImGuiConfigFlags.ViewportsEnable) ~= 0 then + if bit32.band(g.ConfigFlagsCurrFrame, 1024 --[[ImGuiConfigFlags.ViewportsEnable]]) ~= 0 then ImGui.UpdateTryMergeWindowIntoHostViewport(window.RootWindowDockTree, g.MouseViewport) end @@ -7557,9 +7591,9 @@ function ImGui.StopMouseMovingWindow() end -- Clear the NoInputs window flag set by the Viewport system in AddUpdateViewport() - local window_can_use_inputs = bit32.band(window.Flags, ImGuiWindowFlags.NoMouseInputs) == 0 or bit32.band(window.Flags, ImGuiWindowFlags.NoNavInputs) == 0 + local window_can_use_inputs = bit32.band(window.Flags, 512 --[[ImGuiWindowFlags.NoMouseInputs]]) == 0 or bit32.band(window.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) == 0 if window_can_use_inputs then - window.Viewport.Flags = bit32.band(window.Viewport.Flags, bit32.bnot(ImGuiViewportFlags.NoInputs)) + window.Viewport.Flags = bit32.band(window.Viewport.Flags, bit32.bnot(128 --[[ImGuiViewportFlags.NoInputs]])) end end @@ -7623,9 +7657,9 @@ function ImGui.SetActiveID(id, window) if g.NavActivateId == id or g.NavJustMovedToId == id then g.ActiveIdSource = g.NavInputSource else - g.ActiveIdSource = ImGuiInputSource.Mouse + g.ActiveIdSource = 1 --[[ImGuiInputSource.Mouse]] end - IM_ASSERT(g.ActiveIdSource ~= ImGuiInputSource.None) + assert(g.ActiveIdSource ~= 0 --[[ImGuiInputSource.None]]) end -- Clear declaration of inputs claimed by the widget @@ -7660,7 +7694,7 @@ function ImGui.PushOverrideID(id) local g = GImGui local window = g.CurrentWindow if g.DebugHookIdInfoId == id and id ~= 0 then - ImGui.DebugHookIdInfo(id, ImGuiDataType.ID, nil) + ImGui.DebugHookIdInfo(id, 12 --[[ImGuiDataType.ID]], nil) end -- [Luau] inline window.IDStack:push_back(id) local stack = window.IDStack @@ -7693,7 +7727,7 @@ function MT.ImGuiWindow:GetID(id) end local g = GImGui if g.DebugHookIdInfoId == h and h ~= 0 then - ImGui.DebugHookIdInfo(h, (type(id) == "string") and ImGuiDataType.String or ImGuiDataType.S32, id) + ImGui.DebugHookIdInfo(h, (type(id) == "string") and 9 --[[ImGuiDataType.String]] or 4 --[[ImGuiDataType.S32]], id) end return h end @@ -7741,7 +7775,7 @@ function ImGui.GetIDWithSeed(a, b, c) id = ImHashStr(a, b and (b - 1) or nil, c) end if GImGui.DebugHookIdInfoId == id and id ~= 0 then - ImGui.DebugHookIdInfo(id, (type(a) == "number") and ImGuiDataType.S32 or ImGuiDataType.String, (b and type(a) == "string") and string.sub(a, 1, b - 1) or a) + ImGui.DebugHookIdInfo(id, (type(a) == "number") and 4 --[[ImGuiDataType.S32]] or 9 --[[ImGuiDataType.String]], (b and type(a) == "string") and string.sub(a, 1, b - 1) or a) end return id end @@ -7762,10 +7796,10 @@ end --- @return float local function CalcDelayFromHoveredFlags(flags) local g = GImGui - if bit32.band(flags, ImGuiHoveredFlags.DelayNormal) ~= 0 then + if bit32.band(flags, 65536 --[[ImGuiHoveredFlags.DelayNormal]]) ~= 0 then return g.Style.HoverDelayNormal end - if bit32.band(flags, ImGuiHoveredFlags.DelayShort) ~= 0 then + if bit32.band(flags, 32768 --[[ImGuiHoveredFlags.DelayShort]]) ~= 0 then return g.Style.HoverDelayShort end return 0.0 @@ -7775,8 +7809,8 @@ end --- @param shared_flags ImGuiHoveredFlags local function ApplyHoverFlagsForTooltip(user_flags, shared_flags) -- Allow instance flags to override shared flags - if bit32.band(user_flags, bit32.bor(ImGuiHoveredFlags.DelayNone, ImGuiHoveredFlags.DelayShort, ImGuiHoveredFlags.DelayNormal)) ~= 0 then - shared_flags = bit32.band(shared_flags, bit32.bnot(bit32.bor(ImGuiHoveredFlags.DelayNone, ImGuiHoveredFlags.DelayShort, ImGuiHoveredFlags.DelayNormal))) + if bit32.band(user_flags, bit32.bor(16384 --[[ImGuiHoveredFlags.DelayNone]], 32768 --[[ImGuiHoveredFlags.DelayShort]], 65536 --[[ImGuiHoveredFlags.DelayNormal]])) ~= 0 then + shared_flags = bit32.band(shared_flags, bit32.bnot(bit32.bor(16384 --[[ImGuiHoveredFlags.DelayNone]], 32768 --[[ImGuiHoveredFlags.DelayShort]], 65536 --[[ImGuiHoveredFlags.DelayNormal]]))) end return bit32.bor(user_flags, shared_flags) end @@ -7788,11 +7822,11 @@ function ImGui.MarkItemEdited(id) local g = GImGui -- IM_ASSERT(g.LastItemData.ID == id) -- Failing cases include: "widgets_inputtext_scrolling", "widgets_inputtext_multiline_status", "widgets_selectable_input" = case of e.g TempInputText() overlayed manually with different ID (#2718) - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.EditedInternal) - if bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.NoMarkEdited) ~= 0 then + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 2048 --[[ImGuiItemStatusFlags.EditedInternal]]) + if bit32.band(g.LastItemData.ItemFlags, 65536 --[[ImGuiItemFlags.NoMarkEdited]]) ~= 0 then return end - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.Edited) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 4 --[[ImGuiItemStatusFlags.Edited]]) if g.ActiveId == id or g.ActiveId == 0 then -- FIXME: Can't we fully rely on LastItemData yet? @@ -7807,10 +7841,10 @@ function ImGui.MarkItemEdited(id) -- We accept a MarkItemEdited() on drag and drop targets (see https://github.com/ocornut/imgui/issues/1875#issuecomment-978243343) -- We accept 'ActiveIdPreviousFrame == id' for InputText() returning an edit after it has been taken ActiveId away (#4714) -- FIXME: This assert is getting a bit meaningless over time. It helped detect some unusual use cases but eventually it is becoming an unnecessary restriction. - IM_ASSERT(g.DragDropActive or g.ActiveId == id or g.ActiveId == 0 or g.DeactivatedItemData.ID == id or g.ActiveIdPreviousFrame == id or g.NavJustMovedToId or (g.CurrentMultiSelect ~= nil and g.BoxSelectState.IsActive)) + assert(g.DragDropActive or g.ActiveId == id or g.ActiveId == 0 or g.DeactivatedItemData.ID == id or g.ActiveIdPreviousFrame == id or g.NavJustMovedToId or (g.CurrentMultiSelect ~= nil and g.BoxSelectState.IsActive)) -- IM_ASSERT(g.CurrentWindow.DC.LastItemId == id) - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.Edited) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 4 --[[ImGuiItemStatusFlags.Edited]]) end --- @param window ImGuiWindow @@ -7825,9 +7859,9 @@ function ImGui.IsWindowContentHoverable(window, flags) -- For the purpose of those flags we differentiate "standard popup" from "modal popup" -- NB: The 'else' is important because Modal windows are also Popups. local want_inhibit = false - if bit32.band(focused_root_window.Flags, ImGuiWindowFlags.Modal) ~= 0 then + if bit32.band(focused_root_window.Flags, 134217728 --[[ImGuiWindowFlags.Modal]]) ~= 0 then want_inhibit = true - elseif (bit32.band(focused_root_window.Flags, ImGuiWindowFlags.Popup) ~= 0) and (bit32.band(flags, ImGuiHoveredFlags.AllowWhenBlockedByPopup) == 0) then + elseif (bit32.band(focused_root_window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0) and (bit32.band(flags, 32 --[[ImGuiHoveredFlags.AllowWhenBlockedByPopup]]) == 0) then want_inhibit = true end @@ -7860,27 +7894,27 @@ function ImGui.IsItemHovered(flags) local g = GImGui local window = g.CurrentWindow - IM_ASSERT_USER_ERROR(bit32.band(flags, bit32.bnot(ImGuiHoveredFlags.AllowedMaskForIsItemHovered)) == 0, "Invalid flags for IsItemHovered()!") + IM_ASSERT_USER_ERROR(bit32.band(flags, bit32.bnot(262048 --[[ImGuiHoveredFlags.AllowedMaskForIsItemHovered]])) == 0, "Invalid flags for IsItemHovered()!") - if g.NavHighlightItemUnderNav and g.NavCursorVisible and bit32.band(flags, ImGuiHoveredFlags.NoNavOverride) == 0 then + if g.NavHighlightItemUnderNav and g.NavCursorVisible and bit32.band(flags, 2048 --[[ImGuiHoveredFlags.NoNavOverride]]) == 0 then if not ImGui.IsItemFocused() then return false end - if bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.Disabled) ~= 0 and bit32.band(flags, ImGuiHoveredFlags.AllowWhenDisabled) == 0 then + if bit32.band(g.LastItemData.ItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) ~= 0 and bit32.band(flags, 1024 --[[ImGuiHoveredFlags.AllowWhenDisabled]]) == 0 then return false end - if bit32.band(flags, ImGuiHoveredFlags.ForTooltip) ~= 0 then + if bit32.band(flags, 4096 --[[ImGuiHoveredFlags.ForTooltip]]) ~= 0 then flags = ApplyHoverFlagsForTooltip(flags, g.Style.HoverFlagsForTooltipNav) end else -- Test for bounding box overlap, as updated as ItemAdd() local status_flags = g.LastItemData.StatusFlags - if bit32.band(status_flags, ImGuiItemStatusFlags.HoveredRect) == 0 then + if bit32.band(status_flags, 1 --[[ImGuiItemStatusFlags.HoveredRect]]) == 0 then return false end - if bit32.band(flags, ImGuiHoveredFlags.ForTooltip) ~= 0 then + if bit32.band(flags, 4096 --[[ImGuiHoveredFlags.ForTooltip]]) ~= 0 then flags = ApplyHoverFlagsForTooltip(flags, g.Style.HoverFlagsForTooltipMouse) end @@ -7890,15 +7924,15 @@ function ImGui.IsItemHovered(flags) -- [2017/10/16] Reverted commit 344d48be3 and testing RootWindow instead. I believe it is correct to NOT test for RootWindow but this leaves us unable -- to use IsItemHovered() after EndChild() itself. Until a solution is found I believe reverting to the test from 2017/09/27 is safe since this was -- the test that has been running for a long while. - if g.HoveredWindow ~= window and bit32.band(status_flags, ImGuiItemStatusFlags.HoveredWindow) == 0 then - if bit32.band(flags, ImGuiHoveredFlags.AllowWhenOverlappedByWindow) == 0 then + if g.HoveredWindow ~= window and bit32.band(status_flags, 128 --[[ImGuiItemStatusFlags.HoveredWindow]]) == 0 then + if bit32.band(flags, 512 --[[ImGuiHoveredFlags.AllowWhenOverlappedByWindow]]) == 0 then return false end end -- Test if another item is active (e.g. being dragged) local id = g.LastItemData.ID - if bit32.band(flags, ImGuiHoveredFlags.AllowWhenBlockedByActiveItem) == 0 then + if bit32.band(flags, 128 --[[ImGuiHoveredFlags.AllowWhenBlockedByActiveItem]]) == 0 then if g.ActiveId ~= 0 and g.ActiveId ~= id and not g.ActiveIdAllowOverlap and not g.ActiveIdFromShortcut then -- When ActiveId == MoveId it means that either: -- - (1) user clicked on void _or_ an item with no id, which triggers moving window (ActiveId is set even when window has _NoMove flag) @@ -7920,12 +7954,12 @@ function ImGui.IsItemHovered(flags) -- Test if interactions on this window are blocked by an active popup or modal. -- The ImGuiHoveredFlags.AllowWhenBlockedByPopup flag will be tested here. - if not ImGui.IsWindowContentHoverable(window, flags) and bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.NoWindowHoverableCheck) == 0 then + if not ImGui.IsWindowContentHoverable(window, flags) and bit32.band(g.LastItemData.ItemFlags, 8192 --[[ImGuiItemFlags.NoWindowHoverableCheck]]) == 0 then return false end -- Test if the item is disabled - if bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.Disabled) ~= 0 and bit32.band(flags, ImGuiHoveredFlags.AllowWhenDisabled) == 0 then + if bit32.band(g.LastItemData.ItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) ~= 0 and bit32.band(flags, 1024 --[[ImGuiHoveredFlags.AllowWhenDisabled]]) == 0 then return false end @@ -7937,8 +7971,8 @@ function ImGui.IsItemHovered(flags) end -- Test if using AllowOverlap and overlapped - if bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.AllowOverlap) ~= 0 and id ~= 0 then - if bit32.band(flags, ImGuiHoveredFlags.AllowWhenOverlappedByItem) == 0 then + if bit32.band(g.LastItemData.ItemFlags, 16384 --[[ImGuiItemFlags.AllowOverlap]]) ~= 0 and id ~= 0 then + if bit32.band(flags, 256 --[[ImGuiHoveredFlags.AllowWhenOverlappedByItem]]) == 0 then if g.HoveredIdPreviousFrame ~= g.LastItemData.ID then return false end @@ -7949,14 +7983,14 @@ function ImGui.IsItemHovered(flags) -- Handle hover delay -- (some ideas: https://www.nngroup.com/articles/timing-exposing-content) local delay = CalcDelayFromHoveredFlags(flags) - if delay > 0.0 or bit32.band(flags, ImGuiHoveredFlags.Stationary) ~= 0 then + if delay > 0.0 or bit32.band(flags, 8192 --[[ImGuiHoveredFlags.Stationary]]) ~= 0 then local hover_delay_id if g.LastItemData.ID ~= 0 then hover_delay_id = g.LastItemData.ID else hover_delay_id = window:GetIDFromPos(g.LastItemData.Rect.Min) end - if bit32.band(flags, ImGuiHoveredFlags.NoSharedDelay) ~= 0 and g.HoverItemDelayIdPreviousFrame ~= hover_delay_id then + if bit32.band(flags, 131072 --[[ImGuiHoveredFlags.NoSharedDelay]]) ~= 0 and g.HoverItemDelayIdPreviousFrame ~= hover_delay_id then g.HoverItemDelayTimer = 0.0 end g.HoverItemDelayId = hover_delay_id @@ -7964,7 +7998,7 @@ function ImGui.IsItemHovered(flags) -- When changing hovered item we requires a bit of stationary delay before activating hover timer, -- but once unlocked on a given item we also moving. -- if (g.HoverDelayTimer >= delay && (g.HoverDelayTimer - g.IO.DeltaTime < delay || g.MouseStationaryTimer - g.IO.DeltaTime < g.Style.HoverStationaryDelay)) { IMGUI_DEBUG_LOG("HoverDelayTimer = %f/%f, MouseStationaryTimer = %f\n", g.HoverDelayTimer, delay, g.MouseStationaryTimer); } - if bit32.band(flags, ImGuiHoveredFlags.Stationary) ~= 0 and g.HoverItemUnlockedStationaryId ~= hover_delay_id then + if bit32.band(flags, 8192 --[[ImGuiHoveredFlags.Stationary]]) ~= 0 and g.HoverItemUnlockedStationaryId ~= hover_delay_id then return false end @@ -7994,10 +8028,10 @@ function ImGui.ItemHoverable(bb, id, item_flags) -- Detect ID conflicts -- (this is specifically done here by comparing on hover because it allows us a detection of duplicates that is algorithmically extra cheap, 1 u32 compare per item. No O(log N) lookup whatsoever) if not IMGUI_DISABLE_DEBUG_TOOLS then - if id ~= 0 and g.HoveredIdPreviousFrame == id and bit32.band(item_flags, ImGuiItemFlags.AllowDuplicateId) == 0 then + if id ~= 0 and g.HoveredIdPreviousFrame == id and bit32.band(item_flags, 32 --[[ImGuiItemFlags.AllowDuplicateId]]) == 0 then g.HoveredIdPreviousFrameItemCount = g.HoveredIdPreviousFrameItemCount + 1 if g.DebugDrawIdConflictsId == id then - window.DrawList:AddRect(bb.Min - ImVec2(1, 1), bb.Max + ImVec2(1, 1), IM_COL32(255, 0, 0, 255), 0.0, 2.0, ImDrawFlags.None) + window.DrawList:AddRect(bb.Min - ImVec2(1, 1), bb.Max + ImVec2(1, 1), IM_COL32(255, 0, 0, 255), 0.0, 2.0, 0 --[[ImDrawFlags.None]]) end end end @@ -8021,7 +8055,7 @@ end end -- We are done with rectangle culling so we can perform heavier checks now. - if (bit32.band(item_flags, ImGuiItemFlags.NoWindowHoverableCheck) == 0) and not ImGui.IsWindowContentHoverable(window, ImGuiHoveredFlags.None) then + if (bit32.band(item_flags, 8192 --[[ImGuiItemFlags.NoWindowHoverableCheck]]) == 0) and not ImGui.IsWindowContentHoverable(window, 0 --[[ImGuiHoveredFlags.None]]) then g.HoveredIdIsDisabled = true return false end @@ -8030,7 +8064,7 @@ end -- hover test in widgets code. We could also decide to split this function is two. if id ~= 0 then -- Drag source doesn't report as hovered - if g.DragDropActive and g.DragDropPayload.SourceId == id and (bit32.band(g.DragDropSourceFlags, ImGuiDragDropFlags.SourceNoDisableHover) == 0) then + if g.DragDropActive and g.DragDropPayload.SourceId == id and (bit32.band(g.DragDropSourceFlags, 2 --[[ImGuiDragDropFlags.SourceNoDisableHover]]) == 0) then return false end @@ -8038,7 +8072,7 @@ end -- AllowOverlap mode (rarely used) requires previous frame HoveredId to be nil or to match. -- This allows using patterns where a later submitted widget overlaps a previous one. Generally perceived as a front-to-back hit-test. - if bit32.band(item_flags, ImGuiItemFlags.AllowOverlap) ~= 0 then + if bit32.band(item_flags, 16384 --[[ImGuiItemFlags.AllowOverlap]]) ~= 0 then g.HoveredIdAllowOverlap = true if g.HoveredIdPreviousFrame ~= id then return false @@ -8047,15 +8081,15 @@ end -- Display shortcut (only works with mouse) -- (ImGuiItemStatusFlags.HasShortcut in LastItemData denotes we want a tooltip) - if id == g.LastItemData.ID and (bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HasShortcut) ~= 0) and g.ActiveId ~= id then - if ImGui.IsItemHovered(bit32.bor(ImGuiHoveredFlags.ForTooltip, ImGuiHoveredFlags.DelayNormal)) then + if id == g.LastItemData.ID and (bit32.band(g.LastItemData.StatusFlags, 1024 --[[ImGuiItemStatusFlags.HasShortcut]]) ~= 0) and g.ActiveId ~= id then + if ImGui.IsItemHovered(bit32.bor(4096 --[[ImGuiHoveredFlags.ForTooltip]], 65536 --[[ImGuiHoveredFlags.DelayNormal]])) then ImGui.SetTooltip("%s", ImGui.GetKeyChordName(g.LastItemData.Shortcut)) end end end -- When disabled we'll return false but still set HoveredId - if bit32.band(item_flags, ImGuiItemFlags.Disabled) ~= 0 then + if bit32.band(item_flags, 64 --[[ImGuiItemFlags.Disabled]]) ~= 0 then -- Release active id if turning disabled if g.ActiveId == id and id ~= 0 then ImGui.ClearActiveID() @@ -8064,7 +8098,7 @@ end return false end - if g.NavHighlightItemUnderNav and (bit32.band(item_flags, ImGuiItemFlags.NoNavDisableMouseHover) == 0) then + if g.NavHighlightItemUnderNav and (bit32.band(item_flags, 32768 --[[ImGuiItemFlags.NoNavDisableMouseHover]]) == 0) then return false end @@ -8123,15 +8157,15 @@ end -- FIXME: Should in theory be called "AddCharacterEvent()" to be consistent with new API --- @param c unsigned_int function MT.ImGuiIO:AddInputCharacter(c) - IM_ASSERT(self.Ctx ~= nil) + assert(self.Ctx ~= nil) local g = self.Ctx if c == 0 or not self.AppAcceptingEvents then return end local e = ImGuiInputEvent() - e.Type = ImGuiInputEventType.Text - e.Source = ImGuiInputSource.Keyboard + e.Type = 6 --[[ImGuiInputEventType.Text]] + e.Source = 2 --[[ImGuiInputSource.Keyboard]] e.EventId = g.InputEventsNextEventId g.InputEventsNextEventId = g.InputEventsNextEventId + 1 e.Text = ImGuiInputEventText() @@ -8150,7 +8184,7 @@ function MT.ImGuiIO:AddInputCharacterUTF16(c) if bit32.band(c, 0xFC00) == 0xD800 then -- High surrogate, must save if self.InputQueueSurrogate ~= 0 then - self:AddInputCharacter(IM_UNICODE_CODEPOINT_INVALID) + self:AddInputCharacter(65533 --[[IM_UNICODE_CODEPOINT_INVALID]]) end self.InputQueueSurrogate = c return @@ -8159,10 +8193,10 @@ function MT.ImGuiIO:AddInputCharacterUTF16(c) local cp = c if self.InputQueueSurrogate ~= 0 then if bit32.band(c, 0xFC00) ~= 0xDC00 then -- Invalid low surrogate - self:AddInputCharacter(IM_UNICODE_CODEPOINT_INVALID) + self:AddInputCharacter(65533 --[[IM_UNICODE_CODEPOINT_INVALID]]) else -- #if IM_UNICODE_CODEPOINT_MAX == 0xFFFF - cp = IM_UNICODE_CODEPOINT_INVALID -- Codepoint will not fit in ImWchar + cp = 65533 --[[IM_UNICODE_CODEPOINT_INVALID]] -- Codepoint will not fit in ImWchar -- #endif end @@ -8173,7 +8207,7 @@ end -- Clear all incoming events. function MT.ImGuiIO:ClearEventsQueue() - IM_ASSERT(self.Ctx ~= nil) + assert(self.Ctx ~= nil) local g = GImGui g.InputEventsQueue:clear() end @@ -8181,9 +8215,9 @@ end -- Clear current keyboard/gamepad state + current frame text input buffer. Equivalent to releasing all keys/buttons. function MT.ImGuiIO:ClearInputKeys() local g = self.Ctx - for key = ImGuiKey.NamedKey_BEGIN, ImGuiKey.NamedKey_END - 1 do + for key = 512 --[[ImGuiKey.NamedKey_BEGIN]], 667 --[[ImGuiKey.NamedKey_END]] - 1 do if not ImGui.IsMouseKey(key) then - local key_data = g.IO.KeysData[key - ImGuiKey.NamedKey_BEGIN] + local key_data = g.IO.KeysData[key - 512 --[[ImGuiKey.NamedKey_BEGIN]]] key_data.Down = false key_data.DownDuration = -1.0 key_data.DownDurationPrev = -1.0 @@ -8193,13 +8227,13 @@ function MT.ImGuiIO:ClearInputKeys() self.KeyShift = false self.KeyAlt = false self.KeySuper = false - self.KeyMods = ImGuiMod_None + self.KeyMods = 0 --[[ImGuiMod_None]] self.InputQueueCharacters:resize(0) -- Behavior of old ClearInputCharacters(). end function MT.ImGuiIO:ClearInputMouse() - for key = ImGuiKey_Mouse_BEGIN, ImGuiKey_Mouse_END - 1 do - local key_data = self.KeysData[key - ImGuiKey.NamedKey_BEGIN] + for key = 656 --[[ImGuiKey_Mouse_BEGIN]], 663 --[[ImGuiKey_Mouse_END]] - 1 do + local key_data = self.KeysData[key - 512 --[[ImGuiKey.NamedKey_BEGIN]]] if key_data then key_data.Down = false key_data.DownDuration = -1.0 @@ -8207,7 +8241,7 @@ function MT.ImGuiIO:ClearInputMouse() end end - self.MousePos = ImVec2(-FLT_MAX, -FLT_MAX) + self.MousePos = ImVec2(-3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]]) for n = 0, 2 do -- IM_COUNTOF(MouseDown) self.MouseDown[n] = false @@ -8231,8 +8265,8 @@ function MT.ImGuiIO:FindLatestInputEvent(ctx, type, arg) local e = g.InputEventsQueue.Data[n] if e.Type ~= type then - elseif type == ImGuiInputEventType.Key and e.Key.Key ~= arg then - elseif type == ImGuiInputEventType.MouseButton and e.MouseButton.Button ~= arg then + elseif type == 5 --[[ImGuiInputEventType.Key]] and e.Key.Key ~= arg then + elseif type == 3 --[[ImGuiInputEventType.MouseButton]] and e.MouseButton.Button ~= arg then else return e end @@ -8252,28 +8286,28 @@ end --- @param analog_value float function MT.ImGuiIO:AddKeyAnalogEvent(key, down, analog_value) -- if (e->Down) { IMGUI_DEBUG_LOG_IO("AddKeyEvent() Key='%s' %d, NativeKeycode = %d, NativeScancode = %d\n", ImGui::GetKeyName(e->Key), e->Down, e->NativeKeycode, e->NativeScancode); } - IM_ASSERT(self.Ctx ~= nil) - if key == ImGuiKey.None or not self.AppAcceptingEvents then + assert(self.Ctx ~= nil) + if key == 0 --[[ImGuiKey.None]] or not self.AppAcceptingEvents then return end local g = self.Ctx - IM_ASSERT(ImGui.IsNamedKeyOrMod(key)) -- Backend needs to pass a valid ImGuiKey constant. 0..511 values are legacy native key codes which are not accepted by this API. - IM_ASSERT(ImGui.IsAliasKey(key) == false) -- Backend cannot submit ImGuiKey.MouseXXX values they are automatically inferred from AddMouseXXX() events. + assert(ImGui.IsNamedKeyOrMod(key)) -- Backend needs to pass a valid ImGuiKey constant. 0..511 values are legacy native key codes which are not accepted by this API. + assert(ImGui.IsAliasKey(key) == false) -- Backend cannot submit ImGuiKey.MouseXXX values they are automatically inferred from AddMouseXXX() events. -- MacOS: swap Cmd(Super) and Ctrl if (g.IO.ConfigMacOSXBehaviors) then - if (key == ImGuiMod_Super) then key = ImGuiMod_Ctrl - elseif (key == ImGuiMod_Ctrl) then key = ImGuiMod_Super - elseif (key == ImGuiKey.LeftSuper) then key = ImGuiKey.LeftCtrl - elseif (key == ImGuiKey.RightSuper) then key = ImGuiKey.RightCtrl - elseif (key == ImGuiKey.LeftCtrl) then key = ImGuiKey.LeftSuper - elseif (key == ImGuiKey.RightCtrl) then key = ImGuiKey.RightSuper + if (key == 32768 --[[ImGuiMod_Super]]) then key = 4096 --[[ImGuiMod_Ctrl]] + elseif (key == 4096 --[[ImGuiMod_Ctrl]]) then key = 32768 --[[ImGuiMod_Super]] + elseif (key == 530 --[[ImGuiKey.LeftSuper]]) then key = 527 --[[ImGuiKey.LeftCtrl]] + elseif (key == 534 --[[ImGuiKey.RightSuper]]) then key = 531 --[[ImGuiKey.RightCtrl]] + elseif (key == 527 --[[ImGuiKey.LeftCtrl]]) then key = 530 --[[ImGuiKey.LeftSuper]] + elseif (key == 531 --[[ImGuiKey.RightCtrl]]) then key = 534 --[[ImGuiKey.RightSuper]] end end -- Filter duplicate (in particular: key mods and gamepad analog values are commonly spammed) - local latest_event = self:FindLatestInputEvent(g, ImGuiInputEventType.Key, key) + local latest_event = self:FindLatestInputEvent(g, 5 --[[ImGuiInputEventType.Key]], key) local key_data = ImGui.GetKeyData(g, key) local latest_key_down = latest_event and latest_event.Key.Down or key_data.Down local latest_key_analog = latest_event and latest_event.Key.AnalogValue or key_data.AnalogValue @@ -8283,8 +8317,8 @@ function MT.ImGuiIO:AddKeyAnalogEvent(key, down, analog_value) -- Add event local e = ImGuiInputEvent() - e.Type = ImGuiInputEventType.Key - e.Source = ImGui.IsGamepadKey(key) and ImGuiInputSource.Gamepad or ImGuiInputSource.Keyboard + e.Type = 5 --[[ImGuiInputEventType.Key]] + e.Source = ImGui.IsGamepadKey(key) and 3 --[[ImGuiInputSource.Gamepad]] or 2 --[[ImGuiInputSource.Keyboard]] e.EventId = g.InputEventsNextEventId g.InputEventsNextEventId = g.InputEventsNextEventId + 1 e.Key = ImGuiInputEventKey() @@ -8313,14 +8347,14 @@ end -- This is so that duplicate events (e.g. Windows sending extraneous WM_MOUSEMOVE) gets filtered and are not leading to actual source changes. --- @param source ImGuiMouseSource function MT.ImGuiIO:AddMouseSourceEvent(source) - IM_ASSERT(self.Ctx ~= nil) + assert(self.Ctx ~= nil) local g = self.Ctx g.InputEventsNextMouseSource = source end --- @param viewport_id ImGuiID function MT.ImGuiIO:AddMouseViewportEvent(viewport_id) - IM_ASSERT(self.Ctx ~= nil) + assert(self.Ctx ~= nil) local g = self.Ctx -- IM_ASSERT(g.IO.BackendFlags & ImGuiBackendFlags.HasMouseHoveredViewport) if (not self.AppAcceptingEvents) then @@ -8328,7 +8362,7 @@ function MT.ImGuiIO:AddMouseViewportEvent(viewport_id) end -- Filter duplicate - local latest_event = self:FindLatestInputEvent(g, ImGuiInputEventType.MouseViewport) + local latest_event = self:FindLatestInputEvent(g, 4 --[[ImGuiInputEventType.MouseViewport]]) local latest_viewport_id if latest_event then latest_viewport_id = latest_event.MouseViewport.HoveredViewportID @@ -8340,8 +8374,8 @@ function MT.ImGuiIO:AddMouseViewportEvent(viewport_id) end local e = ImGuiInputEvent() - e.Type = ImGuiInputEventType.MouseViewport - e.Source = ImGuiInputSource.Mouse + e.Type = 4 --[[ImGuiInputEventType.MouseViewport]] + e.Source = 1 --[[ImGuiInputSource.Mouse]] e.MouseViewport = ImGuiInputEventMouseViewport() e.MouseViewport.HoveredViewportID = viewport_id g.InputEventsQueue:push_back(e) @@ -8349,18 +8383,18 @@ end --- @param focused bool function MT.ImGuiIO:AddFocusEvent(focused) - IM_ASSERT(self.Ctx ~= nil) + assert(self.Ctx ~= nil) local g = self.Ctx -- Filter duplicate - local latest_event = self:FindLatestInputEvent(g, ImGuiInputEventType.Focus) + local latest_event = self:FindLatestInputEvent(g, 7 --[[ImGuiInputEventType.Focus]]) local latest_focused = latest_event and latest_event.AppFocused.Focused or (not g.IO.AppFocusLost) if latest_focused == focused or (self.ConfigDebugIgnoreFocusLoss and not focused) then return end local e = ImGuiInputEvent() - e.Type = ImGuiInputEventType.Focus + e.Type = 7 --[[ImGuiInputEventType.Focus]] e.EventId = g.InputEventsNextEventId g.InputEventsNextEventId = g.InputEventsNextEventId + 1 e.AppFocused = ImGuiInputEventAppFocused() @@ -8372,7 +8406,7 @@ end --- @param x float --- @param y float function MT.ImGuiIO:AddMousePosEvent(x, y) - IM_ASSERT(self.Ctx ~= nil) + assert(self.Ctx ~= nil) if not self.AppAcceptingEvents then return end @@ -8381,24 +8415,24 @@ function MT.ImGuiIO:AddMousePosEvent(x, y) -- Apply same flooring as UpdateMouseInputs() local x_val = x - if x > -FLT_MAX then + if x > -3.4028234663853e+38 --[[FLT_MAX]] then x_val = ImFloor(x) end local y_val = y - if y > -FLT_MAX then + if y > -3.4028234663853e+38 --[[FLT_MAX]] then y_val = ImFloor(y) end -- Filter duplicate - local latest_event = self:FindLatestInputEvent(g, ImGuiInputEventType.MousePos) + local latest_event = self:FindLatestInputEvent(g, 1 --[[ImGuiInputEventType.MousePos]]) local latest_pos = latest_event and ImVec2(latest_event.MousePos.PosX, latest_event.MousePos.PosY) or self.MousePos if latest_pos.x == x_val and latest_pos.y == y_val then return end local e = ImGuiInputEvent() - e.Type = ImGuiInputEventType.MousePos - e.Source = ImGuiInputSource.Mouse + e.Type = 1 --[[ImGuiInputEventType.MousePos]] + e.Source = 1 --[[ImGuiInputSource.Mouse]] e.EventId = g.InputEventsNextEventId g.InputEventsNextEventId = g.InputEventsNextEventId + 1 e.MousePos = ImGuiInputEventMousePos() @@ -8411,9 +8445,9 @@ end --- @param mouse_button ImGuiMouseButton --- @param down bool function MT.ImGuiIO:AddMouseButtonEvent(mouse_button, down) - IM_ASSERT(self.Ctx ~= nil) + assert(self.Ctx ~= nil) local g = self.Ctx - IM_ASSERT(mouse_button >= 0 and mouse_button < ImGuiMouseButton.COUNT) + assert(mouse_button >= 0 and mouse_button < 5 --[[ImGuiMouseButton.COUNT]]) if not self.AppAcceptingEvents then return end @@ -8428,7 +8462,7 @@ function MT.ImGuiIO:AddMouseButtonEvent(mouse_button, down) end -- Filter duplicate - local latest_event = self:FindLatestInputEvent(g, ImGuiInputEventType.MouseButton, mouse_button) + local latest_event = self:FindLatestInputEvent(g, 3 --[[ImGuiInputEventType.MouseButton]], mouse_button) local latest_button_down = latest_event and latest_event.MouseButton.Down or self.MouseDown[mouse_button] if latest_button_down == down then return @@ -8438,7 +8472,7 @@ function MT.ImGuiIO:AddMouseButtonEvent(mouse_button, down) -- - Note that this is actual physical Ctrl which is ImGuiMod_Super for us. -- - At this point we want from !down to down, so this is handling the initial press. if self.ConfigMacOSXBehaviors and mouse_button == 0 and down then - local latest_super_event = self:FindLatestInputEvent(g, ImGuiInputEventType.Key, ImGuiMod_Super) + local latest_super_event = self:FindLatestInputEvent(g, 5 --[[ImGuiInputEventType.Key]], 32768 --[[ImGuiMod_Super]]) if latest_super_event and latest_super_event.Key.Down or self.KeySuper then -- IMGUI_DEBUG_LOG_IO("[io] Super+Left Click aliased into Right Click\n") self.MouseCtrlLeftAsRightClick = true @@ -8448,8 +8482,8 @@ function MT.ImGuiIO:AddMouseButtonEvent(mouse_button, down) end local e = ImGuiInputEvent() - e.Type = ImGuiInputEventType.MouseButton - e.Source = ImGuiInputSource.Mouse + e.Type = 3 --[[ImGuiInputEventType.MouseButton]] + e.Source = 1 --[[ImGuiInputSource.Mouse]] e.EventId = g.InputEventsNextEventId g.InputEventsNextEventId = g.InputEventsNextEventId + 1 e.MouseButton = ImGuiInputEventMouseButton() @@ -8463,7 +8497,7 @@ end --- @param wheel_x float --- @param wheel_y float function MT.ImGuiIO:AddMouseWheelEvent(wheel_x, wheel_y) - IM_ASSERT(self.Ctx ~= nil) + assert(self.Ctx ~= nil) local g = self.Ctx -- Filter duplicate (unlike most events, wheel values are relative and easy to filter) if not self.AppAcceptingEvents or (wheel_x == 0 and wheel_y == 0) then @@ -8471,8 +8505,8 @@ function MT.ImGuiIO:AddMouseWheelEvent(wheel_x, wheel_y) end local e = ImGuiInputEvent() - e.Type = ImGuiInputEventType.MouseWheel - e.Source = ImGuiInputSource.Mouse + e.Type = 2 --[[ImGuiInputEventType.MouseWheel]] + e.Source = 1 --[[ImGuiInputSource.Mouse]] e.EventId = g.InputEventsNextEventId g.InputEventsNextEventId = g.InputEventsNextEventId + 1 e.MouseWheel = ImGuiInputEventMouseWheel() @@ -8551,25 +8585,25 @@ end --- @param key ImGuiKey local function GetModForLRModKey(key) - if key == ImGuiKey.LeftCtrl or key == ImGuiKey.RightCtrl then - return ImGuiMod_Ctrl + if key == 527 --[[ImGuiKey.LeftCtrl]] or key == 531 --[[ImGuiKey.RightCtrl]] then + return 4096 --[[ImGuiMod_Ctrl]] end - if key == ImGuiKey.LeftShift or key == ImGuiKey.RightShift then - return ImGuiMod_Shift + if key == 528 --[[ImGuiKey.LeftShift]] or key == 532 --[[ImGuiKey.RightShift]] then + return 8192 --[[ImGuiMod_Shift]] end - if key == ImGuiKey.LeftAlt or key == ImGuiKey.RightAlt then - return ImGuiMod_Alt + if key == 529 --[[ImGuiKey.LeftAlt]] or key == 533 --[[ImGuiKey.RightAlt]] then + return 16384 --[[ImGuiMod_Alt]] end - if key == ImGuiKey.LeftSuper or key == ImGuiKey.RightSuper then - return ImGuiMod_Super + if key == 530 --[[ImGuiKey.LeftSuper]] or key == 534 --[[ImGuiKey.RightSuper]] then + return 32768 --[[ImGuiMod_Super]] end - return ImGuiMod_None + return 0 --[[ImGuiMod_None]] end --- @param key_chord ImGuiKeyChord function ImGui.FixupKeyChord(key_chord) -- Add ImGuiMod_XXXX when a corresponding ImGuiKey.LeftXXX/ImGuiKey.RightXXX is specified. - local key = bit32.band(key_chord, bit32.bnot(ImGuiMod_Mask_)) + local key = bit32.band(key_chord, bit32.bnot(61440 --[[ImGuiMod_Mask_]])) if ImGui.IsLRModKey(key) then key_chord = bit32.bor(key_chord, GetModForLRModKey(key)) end @@ -8583,12 +8617,12 @@ function ImGui.GetKeyData(ctx, key) if ctx == nil then ctx = GImGui end -- Special storage location for mods - if bit32.band(key, ImGuiMod_Mask_) ~= 0 then + if bit32.band(key, 61440 --[[ImGuiMod_Mask_]]) ~= 0 then key = ImGui.ConvertSingleModFlagToKey(key) end - IM_ASSERT(ImGui.IsNamedKey(key), "Support for user key indices was dropped in favor of ImGuiKey. Please update backend & user code.") - local idx = key - ImGuiKey.NamedKey_BEGIN + assert(ImGui.IsNamedKey(key), "Support for user key indices was dropped in favor of ImGuiKey. Please update backend & user code.") + local idx = key - 512 --[[ImGuiKey.NamedKey_BEGIN]] return ctx.IO.KeysData[idx], idx end @@ -8616,14 +8650,14 @@ function ImGui.TestKeyOwner(key, owner_id) end local g = GImGui --- @cast g ImGuiContext - if g.ActiveIdUsingAllKeyboardKeys and owner_id ~= g.ActiveId and owner_id ~= ImGuiKeyOwner_Any then - if key >= ImGuiKey_Keyboard_BEGIN and key < ImGuiKey_Keyboard_END then + if g.ActiveIdUsingAllKeyboardKeys and owner_id ~= g.ActiveId and owner_id ~= 0 --[[ImGuiKeyOwner_Any]] then + if key >= 512 --[[ImGuiKey_Keyboard_BEGIN]] and key < 632 --[[ImGuiKey_Keyboard_END]] then return false end end local owner_data = ImGui.GetKeyOwnerData(g, key) - if owner_id == ImGuiKeyOwner_Any then + if owner_id == 0 --[[ImGuiKeyOwner_Any]] then return not owner_data.LockThisFrame end @@ -8634,7 +8668,7 @@ function ImGui.TestKeyOwner(key, owner_id) if owner_data.LockThisFrame then return false end - if owner_data.OwnerCurr ~= ImGuiKeyOwner_NoOwner then + if owner_data.OwnerCurr ~= 4294967295 --[[ImGuiKeyOwner_NoOwner]] then return false end end @@ -8647,7 +8681,7 @@ end --- @param key ImGuiKey --- @param owner_id? ImGuiID function ImGui.IsKeyDown(key, owner_id) - if owner_id == nil then owner_id = ImGuiKeyOwner_Any end + if owner_id == nil then owner_id = 0 --[[ImGuiKeyOwner_Any]] end local key_data = ImGui.GetKeyData(nil, key) if not key_data.Down then @@ -8664,14 +8698,14 @@ end function ImGui.IsKeyPressed(key, is_repeat) if is_repeat == nil then is_repeat = true end - return ImGui.IsKeyPressedEx(key, is_repeat and ImGuiInputFlags.Repeat or ImGuiInputFlags.None, ImGuiKeyOwner_Any) + return ImGui.IsKeyPressedEx(key, is_repeat and 1 --[[ImGuiInputFlags.Repeat]] or 0 --[[ImGuiInputFlags.None]], 0 --[[ImGuiKeyOwner_Any]]) end --- @param key ImGuiKey --- @param owner_id? ImGuiID --- @return bool function ImGui.IsKeyReleased(key, owner_id) - if owner_id == nil then owner_id = ImGuiKeyOwner_Any end + if owner_id == nil then owner_id = 0 --[[ImGuiKeyOwner_Any]] end local key_data = ImGui.GetKeyData(nil, key) if key_data.DownDurationPrev < 0.0 or key_data.Down then @@ -8700,26 +8734,26 @@ function ImGui.IsKeyPressedEx(key, flags, owner_id) if t < 0.0 then return false end - IM_ASSERT(bit32.band(flags, bit32.bnot(ImGuiInputFlags.SupportedByIsKeyPressed)) == 0) -- Passing flags not supported by this function! - if bit32.band(flags, bit32.bor(ImGuiInputFlags.RepeatRateMask_, ImGuiInputFlags.RepeatUntilMask_)) ~= 0 then -- Setting any _RepeatXXX option enables _Repeat - flags = bit32.bor(flags, ImGuiInputFlags.Repeat) + assert(bit32.band(flags, bit32.bnot(255 --[[ImGuiInputFlags.SupportedByIsKeyPressed]])) == 0) -- Passing flags not supported by this function! + if bit32.band(flags, bit32.bor(14 --[[ImGuiInputFlags.RepeatRateMask_]], 240 --[[ImGuiInputFlags.RepeatUntilMask_]])) ~= 0 then -- Setting any _RepeatXXX option enables _Repeat + flags = bit32.bor(flags, 1 --[[ImGuiInputFlags.Repeat]]) end local pressed = (t == 0.0) - if not pressed and bit32.band(flags, ImGuiInputFlags.Repeat) ~= 0 then + if not pressed and bit32.band(flags, 1 --[[ImGuiInputFlags.Repeat]]) ~= 0 then local repeat_delay, repeat_rate = ImGui.GetTypematicRepeatRate(flags) pressed = (t > repeat_delay) and (ImGui.GetKeyPressedAmount(key, repeat_delay, repeat_rate) > 0) - if pressed and bit32.band(flags, ImGuiInputFlags.RepeatUntilMask_) ~= 0 then + if pressed and bit32.band(flags, 240 --[[ImGuiInputFlags.RepeatUntilMask_]]) ~= 0 then -- Slightly bias 'key_pressed_time' as DownDuration is an accumulation of DeltaTime which we compare to an absolute time value. -- Ideally we'd replace DownDuration with KeyPressedTime but it would break user's code. local key_pressed_time = g.Time - t + 0.00001 - if bit32.band(flags, ImGuiInputFlags.RepeatUntilKeyModsChange) ~= 0 and g.LastKeyModsChangeTime > key_pressed_time then + if bit32.band(flags, 32 --[[ImGuiInputFlags.RepeatUntilKeyModsChange]]) ~= 0 and g.LastKeyModsChangeTime > key_pressed_time then pressed = false end - if bit32.band(flags, ImGuiInputFlags.RepeatUntilKeyModsChangeFromNone) ~= 0 and g.LastKeyModsChangeFromNoneTime > key_pressed_time then + if bit32.band(flags, 64 --[[ImGuiInputFlags.RepeatUntilKeyModsChangeFromNone]]) ~= 0 and g.LastKeyModsChangeFromNoneTime > key_pressed_time then pressed = false end - if bit32.band(flags, ImGuiInputFlags.RepeatUntilOtherKeyPress) ~= 0 and g.LastKeyboardKeyPressTime > key_pressed_time then + if bit32.band(flags, 128 --[[ImGuiInputFlags.RepeatUntilOtherKeyPress]]) ~= 0 and g.LastKeyboardKeyPressTime > key_pressed_time then pressed = false end end @@ -8738,16 +8772,16 @@ end -- TODO: -- Return untranslated names: on macOS, Cmd key will show as Ctrl, Ctrl key will show as super. function ImGui.GetKeyChordName(key_chord) - local key = bit32.band(key_chord, bit32.bnot(ImGuiMod_Mask_)) + local key = bit32.band(key_chord, bit32.bnot(61440 --[[ImGuiMod_Mask_]])) if ImGui.IsLRModKey(key) then key_chord = bit32.band(key_chord, bit32.bnot(GetModForLRModKey(key))) -- Return "Ctrl+LeftShift" instead of "Ctrl+Shift+LeftShift" end - local s = ((bit32.band(key_chord, ImGuiMod_Ctrl) ~= 0) and "Ctrl+" or "") - .. ((bit32.band(key_chord, ImGuiMod_Shift) ~= 0) and "Shift+" or "") - .. ((bit32.band(key_chord, ImGuiMod_Alt) ~= 0) and "Alt+" or "") - .. ((bit32.band(key_chord, ImGuiMod_Super) ~= 0) and "Super+" or "") - .. ((key ~= ImGuiKey.None or key_chord == ImGuiKey.None) and ImGui.GetKeyName(key) or "") - if key == ImGuiKey.None and key_chord ~= 0 and #s > 0 then + local s = ((bit32.band(key_chord, 4096 --[[ImGuiMod_Ctrl]]) ~= 0) and "Ctrl+" or "") + .. ((bit32.band(key_chord, 8192 --[[ImGuiMod_Shift]]) ~= 0) and "Shift+" or "") + .. ((bit32.band(key_chord, 16384 --[[ImGuiMod_Alt]]) ~= 0) and "Alt+" or "") + .. ((bit32.band(key_chord, 32768 --[[ImGuiMod_Super]]) ~= 0) and "Super+" or "") + .. ((key ~= 0 --[[ImGuiKey.None]] or key_chord == 0 --[[ImGuiKey.None]]) and ImGui.GetKeyName(key) or "") + if key == 0 --[[ImGuiKey.None]] and key_chord ~= 0 and #s > 0 then s = string.sub(s, 1, #s - 1) -- Remove trailing '+' end return s @@ -8781,33 +8815,33 @@ local GKeyNames = { --- @param key ImGuiKey --- @return string function ImGui.GetKeyName(key) - if key == ImGuiKey.None then + if key == 0 --[[ImGuiKey.None]] then return "None" end - IM_ASSERT(ImGui.IsNamedKeyOrMod(key), "Support for user key indices was dropped in favor of ImGuiKey. Please update backend and user code.") - if bit32.band(key, ImGuiMod_Mask_) ~= 0 then + assert(ImGui.IsNamedKeyOrMod(key), "Support for user key indices was dropped in favor of ImGuiKey. Please update backend and user code.") + if bit32.band(key, 61440 --[[ImGuiMod_Mask_]]) ~= 0 then key = ImGui.ConvertSingleModFlagToKey(key) end if not ImGui.IsNamedKey(key) then return "Unknown" end - return GKeyNames[key - ImGuiKey.NamedKey_BEGIN + 1] or "Unknown" + return GKeyNames[key - 512 --[[ImGuiKey.NamedKey_BEGIN]] + 1] or "Unknown" end --- @param key ImGuiKey --- @return ImGuiID function ImGui.GetKeyOwner(key) if not ImGui.IsNamedKeyOrMod(key) then - return ImGuiKeyOwner_NoOwner + return 4294967295 --[[ImGuiKeyOwner_NoOwner]] end local g = GImGui local owner_data = ImGui.GetKeyOwnerData(g, key) local owner_id = owner_data.OwnerCurr - if g.ActiveIdUsingAllKeyboardKeys and owner_id ~= g.ActiveId and owner_id ~= ImGuiKeyOwner_Any then - if key >= ImGuiKey_Keyboard_BEGIN and key < ImGuiKey_Keyboard_END then - return ImGuiKeyOwner_NoOwner + if g.ActiveIdUsingAllKeyboardKeys and owner_id ~= g.ActiveId and owner_id ~= 0 --[[ImGuiKeyOwner_Any]] then + if key >= 512 --[[ImGuiKey_Keyboard_BEGIN]] and key < 632 --[[ImGuiKey_Keyboard_END]] then + return 4294967295 --[[ImGuiKeyOwner_NoOwner]] end end @@ -8855,9 +8889,9 @@ end --- @return float repeat_rate function ImGui.GetTypematicRepeatRate(flags) local g = GImGui - flags = bit32.band(flags, ImGuiInputFlags.RepeatRateMask_) - if flags == ImGuiInputFlags.RepeatRateNavMove then repeat_delay = g.IO.KeyRepeatDelay * 0.72; repeat_rate = g.IO.KeyRepeatRate * 0.80; return repeat_delay, repeat_rate - elseif flags == ImGuiInputFlags.RepeatRateNavTweak then repeat_delay = g.IO.KeyRepeatDelay * 0.72; repeat_rate = g.IO.KeyRepeatRate * 0.30; return repeat_delay, repeat_rate + flags = bit32.band(flags, 14 --[[ImGuiInputFlags.RepeatRateMask_]]) + if flags == 4 --[[ImGuiInputFlags.RepeatRateNavMove]] then repeat_delay = g.IO.KeyRepeatDelay * 0.72; repeat_rate = g.IO.KeyRepeatRate * 0.80; return repeat_delay, repeat_rate + elseif flags == 8 --[[ImGuiInputFlags.RepeatRateNavTweak]] then repeat_delay = g.IO.KeyRepeatDelay * 0.72; repeat_rate = g.IO.KeyRepeatRate * 0.30; return repeat_delay, repeat_rate else repeat_delay = g.IO.KeyRepeatDelay * 1.00; repeat_rate = g.IO.KeyRepeatRate * 1.00; return repeat_delay, repeat_rate end end @@ -8884,18 +8918,18 @@ end function ImGui.UpdateKeyRoutingTable(rt) local g = GImGui --[[@as ImGuiContext]] rt.EntriesNext:resize(0) - for key = ImGuiKey.NamedKey_BEGIN, ImGuiKey.NamedKey_END - 1 do + for key = 512 --[[ImGuiKey.NamedKey_BEGIN]], 667 --[[ImGuiKey.NamedKey_END]] - 1 do local new_routing_start_idx = rt.EntriesNext.Size + 1 local routing_entry - local old_routing_idx = rt.Index[key - ImGuiKey.NamedKey_BEGIN + 1] + local old_routing_idx = rt.Index[key - 512 --[[ImGuiKey.NamedKey_BEGIN]] + 1] while old_routing_idx ~= -1 do repeat routing_entry = rt.Entries[old_routing_idx] routing_entry.RoutingCurrScore = routing_entry.RoutingNextScore routing_entry.RoutingCurr = routing_entry.RoutingNext -- Update entry - routing_entry.RoutingNext = ImGuiKeyOwner_NoOwner + routing_entry.RoutingNext = 4294967295 --[[ImGuiKeyOwner_NoOwner]] routing_entry.RoutingNextScore = 0 - if routing_entry.RoutingCurr == ImGuiKeyOwner_NoOwner then + if routing_entry.RoutingCurr == 4294967295 --[[ImGuiKeyOwner_NoOwner]] then break end @@ -8905,7 +8939,7 @@ function ImGui.UpdateKeyRoutingTable(rt) -- This is the result of previous frame's SetShortcutRouting() call. if routing_entry.Mods == g.IO.KeyMods then local owner_data = ImGui.GetKeyOwnerData(g, key) - if owner_data.OwnerCurr == ImGuiKeyOwner_NoOwner then + if owner_data.OwnerCurr == 4294967295 --[[ImGuiKeyOwner_NoOwner]] then owner_data.OwnerCurr = routing_entry.RoutingCurr -- IMGUI_DEBUG_LOG("SetKeyOwner(%s, owner_id=0x%08X) via Routing\n", GetKeyName(key), routing_entry->RoutingCurr); end @@ -8917,7 +8951,7 @@ function ImGui.UpdateKeyRoutingTable(rt) end -- Rewrite linked-list - rt.Index[key - ImGuiKey.NamedKey_BEGIN + 1] = (new_routing_start_idx <= rt.EntriesNext.Size and new_routing_start_idx or -1) + rt.Index[key - 512 --[[ImGuiKey.NamedKey_BEGIN]] + 1] = (new_routing_start_idx <= rt.EntriesNext.Size and new_routing_start_idx or -1) for n = new_routing_start_idx, rt.EntriesNext.Size do rt.EntriesNext[n].NextEntryIndex = (n + 1 <= rt.EntriesNext.Size) and (n + 1) or -1 end @@ -8929,7 +8963,7 @@ end --- @param owner_id ImGuiID local function GetRoutingIdFromOwnerId(owner_id) local g = GImGui - return (owner_id ~= ImGuiKeyOwner_NoOwner and owner_id ~= ImGuiKeyOwner_Any) and owner_id or g.CurrentFocusScopeId + return (owner_id ~= 4294967295 --[[ImGuiKeyOwner_NoOwner]] and owner_id ~= 0 --[[ImGuiKeyOwner_Any]]) and owner_id or g.CurrentFocusScopeId end --- @param key_chord ImGuiKeyChord @@ -8943,17 +8977,17 @@ function ImGui.GetShortcutRoutingData(key_chord) -- - Shortcut(ImGuiMod_Ctrl | ImGuiMod_Shift) -- Not legal local g = GImGui local rt = g.KeysRoutingTable - local key = bit32.band(key_chord, bit32.bnot(ImGuiMod_Mask_)) - local mods = bit32.band(key_chord, ImGuiMod_Mask_) - if key == ImGuiKey.None then + local key = bit32.band(key_chord, bit32.bnot(61440 --[[ImGuiMod_Mask_]])) + local mods = bit32.band(key_chord, 61440 --[[ImGuiMod_Mask_]]) + if key == 0 --[[ImGuiKey.None]] then key = ImGui.ConvertSingleModFlagToKey(mods) end - IM_ASSERT(ImGui.IsNamedKey(key)) + assert(ImGui.IsNamedKey(key)) -- Get (in the majority of case, the linked list will have one element so this should be 2 reads. -- Subsequent elements will be contiguous in memory as list is sorted/rebuilt in NewFrame). local routing_data - local idx = rt.Index[key - ImGuiKey.NamedKey_BEGIN + 1] + local idx = rt.Index[key - 512 --[[ImGuiKey.NamedKey_BEGIN]] + 1] while idx ~= -1 do routing_data = rt.Entries.Data[idx] if routing_data.Mods == mods then @@ -8968,8 +9002,8 @@ function ImGui.GetShortcutRoutingData(key_chord) rt.Entries:push_back(ImGuiKeyRoutingData()) routing_data = rt.Entries[routing_data_idx] routing_data.Mods = mods - routing_data.NextEntryIndex = rt.Index[key - ImGuiKey.NamedKey_BEGIN + 1] -- Setup linked list - rt.Index[key - ImGuiKey.NamedKey_BEGIN + 1] = routing_data_idx + routing_data.NextEntryIndex = rt.Index[key - 512 --[[ImGuiKey.NamedKey_BEGIN]] + 1] -- Setup linked list + rt.Index[key - 512 --[[ImGuiKey.NamedKey_BEGIN]] + 1] = routing_data_idx return routing_data end @@ -8988,7 +9022,7 @@ end --- @param flags ImGuiInputFlags local function CalcRoutingScore(focus_scope_id, owner_id, flags) local g = GImGui - if bit32.band(flags, ImGuiInputFlags.RouteFocused) ~= 0 then + if bit32.band(flags, 2048 --[[ImGuiInputFlags.RouteFocused]]) ~= 0 then -- ActiveID gets high priority -- (we don't check g.ActiveIdUsingAllKeys here. Routing is applied but if input ownership is tested later it may discard it) if owner_id ~= 0 and g.ActiveId == owner_id then @@ -9007,7 +9041,7 @@ local function CalcRoutingScore(focus_scope_id, owner_id, flags) end for index_in_focus_path = 1, g.NavFocusRoute.Size do if g.NavFocusRoute.Data[index_in_focus_path].ID == focus_scope_id then - if bit32.band(flags, ImGuiInputFlags.RouteOverActive) ~= 0 then -- && g.ActiveId != 0 && g.ActiveId != owner_id) + if bit32.band(flags, 32768 --[[ImGuiInputFlags.RouteOverActive]]) ~= 0 then -- && g.ActiveId != 0 && g.ActiveId != owner_id) return 599 - (index_in_focus_path - 1) else return 199 - (index_in_focus_path - 1) @@ -9015,24 +9049,24 @@ local function CalcRoutingScore(focus_scope_id, owner_id, flags) end end return 0 - elseif bit32.band(flags, ImGuiInputFlags.RouteActive) ~= 0 then + elseif bit32.band(flags, 1024 --[[ImGuiInputFlags.RouteActive]]) ~= 0 then if owner_id ~= 0 and g.ActiveId == owner_id then return 300 end return 0 - elseif bit32.band(flags, ImGuiInputFlags.RouteGlobal) ~= 0 then - if bit32.band(flags, ImGuiInputFlags.RouteOverActive) ~= 0 then + elseif bit32.band(flags, 4096 --[[ImGuiInputFlags.RouteGlobal]]) ~= 0 then + if bit32.band(flags, 32768 --[[ImGuiInputFlags.RouteOverActive]]) ~= 0 then return 400 end if owner_id ~= 0 and g.ActiveId == owner_id then return 300 end - if bit32.band(flags, ImGuiInputFlags.RouteOverFocused) ~= 0 then + if bit32.band(flags, 16384 --[[ImGuiInputFlags.RouteOverFocused]]) ~= 0 then return 200 end return 1 end - IM_ASSERT(false) + assert(false) return 0 end @@ -9045,15 +9079,15 @@ local function IsKeyChordPotentiallyCharInput(key_chord) local g = GImGui -- When the right mods are pressed it cannot be a char input so we won't filter the shortcut out. - local mods = bit32.band(key_chord, ImGuiMod_Mask_) - local ignore_char_inputs = ((bit32.band(mods, ImGuiMod_Ctrl) ~= 0) and (bit32.band(mods, ImGuiMod_Alt) == 0)) or (g.IO.ConfigMacOSXBehaviors and (bit32.band(mods, ImGuiMod_Ctrl) ~= 0)) + local mods = bit32.band(key_chord, 61440 --[[ImGuiMod_Mask_]]) + local ignore_char_inputs = ((bit32.band(mods, 4096 --[[ImGuiMod_Ctrl]]) ~= 0) and (bit32.band(mods, 16384 --[[ImGuiMod_Alt]]) == 0)) or (g.IO.ConfigMacOSXBehaviors and (bit32.band(mods, 4096 --[[ImGuiMod_Ctrl]]) ~= 0)) if ignore_char_inputs then return false end -- Return true for A-Z, 0-9 and other keys associated to char inputs. Other keys such as F1-F12 won't be filtered. - local key = bit32.band(key_chord, bit32.bnot(ImGuiMod_Mask_)) - if key == ImGuiKey.None then + local key = bit32.band(key_chord, bit32.bnot(61440 --[[ImGuiMod_Mask_]])) + if key == 0 --[[ImGuiKey.None]] then return false end return g.KeysMayBeCharInput:TestBit(key + 1) -- TestBit requires 1-based index @@ -9070,17 +9104,17 @@ end function ImGui.SetShortcutRouting(key_chord, flags, owner_id) local g = GImGui - if bit32.band(flags, ImGuiInputFlags.RouteTypeMask_) == 0 then - flags = bit32.bor(flags, ImGuiInputFlags.RouteGlobal, ImGuiInputFlags.RouteOverFocused, ImGuiInputFlags.RouteOverActive) -- IMPORTANT: This is the default for SetShortcutRouting() but NOT Shortcut() + if bit32.band(flags, 15360 --[[ImGuiInputFlags.RouteTypeMask_]]) == 0 then + flags = bit32.bor(flags, 4096 --[[ImGuiInputFlags.RouteGlobal]], 16384 --[[ImGuiInputFlags.RouteOverFocused]], 32768 --[[ImGuiInputFlags.RouteOverActive]]) -- IMPORTANT: This is the default for SetShortcutRouting() but NOT Shortcut() else - IM_ASSERT(ImIsPowerOfTwo(bit32.band(flags, ImGuiInputFlags.RouteTypeMask_))) -- Check that only 1 routing flag is used + assert(ImIsPowerOfTwo(bit32.band(flags, 15360 --[[ImGuiInputFlags.RouteTypeMask_]]))) -- Check that only 1 routing flag is used end - IM_ASSERT(owner_id ~= ImGuiKeyOwner_Any and owner_id ~= ImGuiKeyOwner_NoOwner) - if bit32.band(flags, bit32.bor(ImGuiInputFlags.RouteOverFocused, ImGuiInputFlags.RouteUnlessBgFocused)) ~= 0 then - IM_ASSERT(bit32.band(flags, ImGuiInputFlags.RouteGlobal) ~= 0) + assert(owner_id ~= 0 --[[ImGuiKeyOwner_Any]] and owner_id ~= 4294967295 --[[ImGuiKeyOwner_NoOwner]]) + if bit32.band(flags, bit32.bor(16384 --[[ImGuiInputFlags.RouteOverFocused]], 65536 --[[ImGuiInputFlags.RouteUnlessBgFocused]])) ~= 0 then + assert(bit32.band(flags, 4096 --[[ImGuiInputFlags.RouteGlobal]]) ~= 0) end - if bit32.band(flags, ImGuiInputFlags.RouteOverActive) ~= 0 then - IM_ASSERT(bit32.band(flags, bit32.bor(ImGuiInputFlags.RouteGlobal, ImGuiInputFlags.RouteFocused)) ~= 0) + if bit32.band(flags, 32768 --[[ImGuiInputFlags.RouteOverActive]]) ~= 0 then + assert(bit32.band(flags, bit32.bor(4096 --[[ImGuiInputFlags.RouteGlobal]], 2048 --[[ImGuiInputFlags.RouteFocused]])) ~= 0) end -- Add ImGuiMod_XXXX when a corresponding ImGuiKey.LeftXXX/ImGuiKey.RightXXX is specified. @@ -9091,21 +9125,21 @@ function ImGui.SetShortcutRouting(key_chord, flags, owner_id) -- IM_DEBUG_BREAK() end - if bit32.band(flags, ImGuiInputFlags.RouteUnlessBgFocused) ~= 0 then + if bit32.band(flags, 65536 --[[ImGuiInputFlags.RouteUnlessBgFocused]]) ~= 0 then if g.NavWindow == nil then return false end end -- Note how ImGuiInputFlags.RouteAlways won't set routing and thus won't set owner. May want to rework this? - if bit32.band(flags, ImGuiInputFlags.RouteAlways) ~= 0 then + if bit32.band(flags, 8192 --[[ImGuiInputFlags.RouteAlways]]) ~= 0 then -- IMGUI_DEBUG_LOG_INPUTROUTING("SetShortcutRouting(%s, flags=%04X, owner_id=0x%08X) -> always, no register", ImGui.GetKeyChordName(key_chord), flags, owner_id) return true end -- Specific culling when there's an active item. if g.ActiveId ~= 0 and g.ActiveId ~= owner_id then - if bit32.band(flags, ImGuiInputFlags.RouteActive) ~= 0 then + if bit32.band(flags, 1024 --[[ImGuiInputFlags.RouteActive]]) ~= 0 then return false end @@ -9120,12 +9154,12 @@ function ImGui.SetShortcutRouting(key_chord, flags, owner_id) end -- ActiveIdUsingAllKeyboardKeys trumps all for ActiveId - if bit32.band(flags, ImGuiInputFlags.RouteOverActive) == 0 and g.ActiveIdUsingAllKeyboardKeys then - local key = bit32.band(key_chord, bit32.bnot(ImGuiMod_Mask_)) - if key == ImGuiKey.None then - key = ImGui.ConvertSingleModFlagToKey(bit32.band(key_chord, ImGuiMod_Mask_)) + if bit32.band(flags, 32768 --[[ImGuiInputFlags.RouteOverActive]]) == 0 and g.ActiveIdUsingAllKeyboardKeys then + local key = bit32.band(key_chord, bit32.bnot(61440 --[[ImGuiMod_Mask_]])) + if key == 0 --[[ImGuiKey.None]] then + key = ImGui.ConvertSingleModFlagToKey(bit32.band(key_chord, 61440 --[[ImGuiMod_Mask_]])) end - if key >= ImGuiKey_Keyboard_BEGIN and key < ImGuiKey_Keyboard_END then + if key >= 512 --[[ImGuiKey_Keyboard_BEGIN]] and key < 632 --[[ImGuiKey_Keyboard_END]] then return false end end @@ -9133,7 +9167,7 @@ function ImGui.SetShortcutRouting(key_chord, flags, owner_id) -- Where do we evaluate route for? local focus_scope_id = g.CurrentFocusScopeId - if bit32.band(flags, ImGuiInputFlags.RouteFromRootWindow) ~= 0 then + if bit32.band(flags, 131072 --[[ImGuiInputFlags.RouteFromRootWindow]]) ~= 0 then focus_scope_id = g.CurrentWindow.RootWindow.ID -- See PushFocusScope() call in Begin() end @@ -9183,10 +9217,10 @@ end --- @param button ImGuiMouseButton --- @param owner_id? ImGuiID function ImGui.IsMouseDown(button, owner_id) - if owner_id == nil then owner_id = ImGuiKeyOwner_Any end + if owner_id == nil then owner_id = 0 --[[ImGuiKeyOwner_Any]] end local g = GImGui - IM_ASSERT(button >= 0 and button < 3) -- IM_COUNTOF(g.IO.MouseDown) + assert(button >= 0 and button < 3) -- IM_COUNTOF(g.IO.MouseDown) return g.IO.MouseDown[button] and ImGui.TestKeyOwner(ImGui.MouseButtonToKey(button), owner_id) -- Should be same as IsKeyDown(MouseButtonToKey(button), owner_id), but this allows legacy code hijacking the io.Mousedown[] array. end @@ -9195,7 +9229,7 @@ end function ImGui.IsMouseClicked(button, is_repeat) if is_repeat == nil then is_repeat = false end - return ImGui.IsMouseClickedEx(button, is_repeat and ImGuiInputFlags.Repeat or ImGuiInputFlags.None, ImGuiKeyOwner_Any) + return ImGui.IsMouseClickedEx(button, is_repeat and 1 --[[ImGuiInputFlags.Repeat]] or 0 --[[ImGuiInputFlags.None]], 0 --[[ImGuiKeyOwner_Any]]) end --- @param button ImGuiMouseButton @@ -9203,10 +9237,10 @@ end --- @param owner_id? ImGuiID function ImGui.IsMouseClickedEx(button, flags, owner_id) - if owner_id == nil then owner_id = ImGuiKeyOwner_Any end + if owner_id == nil then owner_id = 0 --[[ImGuiKeyOwner_Any]] end local g = GImGui - IM_ASSERT(button >= 0 and button < 3) -- IM_COUNTOF(g.IO.MouseDown) + assert(button >= 0 and button < 3) -- IM_COUNTOF(g.IO.MouseDown) if not g.IO.MouseDown[button] then -- In theory this should already be encoded as (DownDuration < 0.0f), but testing this facilitates eating mechanism (until we finish work on key ownership) return false @@ -9215,9 +9249,9 @@ function ImGui.IsMouseClickedEx(button, flags, owner_id) if t < 0.0 then return false end - IM_ASSERT(bit32.band(flags, bit32.bnot(ImGuiInputFlags.SupportedByIsMouseClicked)) == 0) -- Passing flags not supported by this function! -- FIXME: Could support RepeatRate and RepeatUntil flags here. + assert(bit32.band(flags, bit32.bnot(1 --[[ImGuiInputFlags.SupportedByIsMouseClicked]])) == 0) -- Passing flags not supported by this function! -- FIXME: Could support RepeatRate and RepeatUntil flags here. - local is_repeat = (bit32.band(flags, ImGuiInputFlags.Repeat) ~= 0) + local is_repeat = (bit32.band(flags, 1 --[[ImGuiInputFlags.Repeat]]) ~= 0) local pressed = (t == 0.0) or (is_repeat and t > g.IO.KeyRepeatDelay and ImGui.CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, g.IO.KeyRepeatDelay, g.IO.KeyRepeatRate) > 0) if not pressed then @@ -9234,10 +9268,10 @@ end --- @param button ImGuiMouseButton --- @param owner_id? ImGuiID function ImGui.IsMouseReleased(button, owner_id) - if owner_id == nil then owner_id = ImGuiKeyOwner_Any end + if owner_id == nil then owner_id = 0 --[[ImGuiKeyOwner_Any]] end local g = GImGui - IM_ASSERT(button >= 0 and button < 3) -- IM_COUNTOF(g.IO.MouseDown) + assert(button >= 0 and button < 3) -- IM_COUNTOF(g.IO.MouseDown) return g.IO.MouseReleased[button] and ImGui.TestKeyOwner(ImGui.MouseButtonToKey(button), owner_id) -- Should be same as IsKeyReleased(MouseButtonToKey(button), owner_id) end @@ -9250,7 +9284,7 @@ end function ImGui.IsMouseReleasedWithDelay(button, delay) if delay == nil then delay = -1.0 end local g = GImGui - IM_ASSERT(button >= 0 and button < 3) + assert(button >= 0 and button < 3) if ImGui.IsMouseDown(button) then return false end @@ -9264,16 +9298,16 @@ end --- @param button ImGuiMouseButton --- @param owner_id? ImGuiID function ImGui.IsMouseDoubleClicked(button, owner_id) - if owner_id == nil then owner_id = ImGuiKeyOwner_Any end + if owner_id == nil then owner_id = 0 --[[ImGuiKeyOwner_Any]] end local g = GImGui - IM_ASSERT(button >= 0 and button < 3) + assert(button >= 0 and button < 3) return g.IO.MouseClickedCount[button] == 2 and ImGui.TestKeyOwner(ImGui.MouseButtonToKey(button), owner_id) end --- @param button ImGuiMouseButton function ImGui.GetMouseClickedCount(button) local g = GImGui - IM_ASSERT(button >= 0 and button < 3) + assert(button >= 0 and button < 3) return g.IO.MouseClickedCount[button] end @@ -9281,7 +9315,7 @@ end --- @param mouse_button ImGuiMouseButton local function LastItemOverlayButtonForNullId(mouse_button) local g = GImGui - IM_ASSERT(g.LastItemData.ID == 0) + assert(g.LastItemData.ID == 0) local window = g.CurrentWindow local id = window:GetIDFromRectangle(g.LastItemData.Rect) if g.IO.MouseClicked[mouse_button] and ImGui.ItemHoverable(g.LastItemData.Rect, id, g.LastItemData.ItemFlags) then @@ -9364,7 +9398,7 @@ function ImGui.GetMouseDragDelta(button, lock_threshold) if button == nil then button = 0 end if lock_threshold == nil then lock_threshold = -1.0 end local g = GImGui - IM_ASSERT(button >= 0 and button < 3) + assert(button >= 0 and button < 3) if lock_threshold < 0.0 then lock_threshold = g.IO.MouseDragThreshold end @@ -9382,7 +9416,7 @@ end function ImGui.ResetMouseDragDelta(button) if button == nil then button = 0 end local g = GImGui - IM_ASSERT(button >= 0 and button < 3) + assert(button >= 0 and button < 3) -- NB: We don't need to reset g.IO.MouseDragMaxDistanceSqr ImVec2_Copy(g.IO.MouseClickedPos[button], g.IO.MousePos) end @@ -9419,7 +9453,7 @@ function ImGui.UpdateInputEvents(trickle_fast_inputs) while event_n <= g.InputEventsQueue.Size do repeat local e = g.InputEventsQueue.Data[event_n] - if e.Type == ImGuiInputEventType.MousePos then + if e.Type == 1 --[[ImGuiInputEventType.MousePos]] then if g.IO.WantSetMousePos then break end @@ -9431,21 +9465,21 @@ function ImGui.UpdateInputEvents(trickle_fast_inputs) io.MousePos = event_pos io.MouseSource = e.MousePos.MouseSource mouse_moved = true - elseif e.Type == ImGuiInputEventType.MouseButton then + elseif e.Type == 3 --[[ImGuiInputEventType.MouseButton]] then -- Trickling Rule: Stop processing queued events if we got multiple action on the same button local button = e.MouseButton.Button - IM_ASSERT(button >= 0 and button < ImGuiMouseButton.COUNT) + assert(button >= 0 and button < 5 --[[ImGuiMouseButton.COUNT]]) if trickle_fast_inputs and ((bit32.band(mouse_button_changed, bit32.lshift(1, button)) ~= 0) or mouse_wheeled) then stop_3231 = true; break end - if trickle_fast_inputs and e.MouseButton.MouseSource == ImGuiMouseSource.TouchScreen and mouse_moved then -- #2702: TouchScreen have no initial hover. + if trickle_fast_inputs and e.MouseButton.MouseSource == 1 --[[ImGuiMouseSource.TouchScreen]] and mouse_moved then -- #2702: TouchScreen have no initial hover. stop_3231 = true; break end io.MouseDown[button] = e.MouseButton.Down io.MouseSource = e.MouseButton.MouseSource mouse_button_changed = bit32.bor(mouse_button_changed, bit32.lshift(1, button)) - elseif e.Type == ImGuiInputEventType.MouseWheel then + elseif e.Type == 2 --[[ImGuiInputEventType.MouseWheel]] then -- Trickling Rule: Stop processing queued events if we got multiple action on the event if trickle_fast_inputs and (mouse_moved or mouse_button_changed ~= 0) then stop_3231 = true; break @@ -9455,16 +9489,16 @@ function ImGui.UpdateInputEvents(trickle_fast_inputs) io.MouseWheel = io.MouseWheel + e.MouseWheel.WheelY io.MouseSource = e.MouseWheel.MouseSource mouse_wheeled = true - elseif e.Type == ImGuiInputEventType.MouseViewport then + elseif e.Type == 4 --[[ImGuiInputEventType.MouseViewport]] then io.MouseHoveredViewport = e.MouseViewport.HoveredViewportID - elseif e.Type == ImGuiInputEventType.Key then + elseif e.Type == 5 --[[ImGuiInputEventType.Key]] then -- Trickling Rule: Stop processing queued events if we got multiple action on the same button - if bit32.band(io.ConfigFlags, ImGuiConfigFlags.NoKeyboard) ~= 0 then + if bit32.band(io.ConfigFlags, 64 --[[ImGuiConfigFlags.NoKeyboard]]) ~= 0 then break end local key = e.Key.Key - IM_ASSERT(key ~= ImGuiKey.None) + assert(key ~= 0 --[[ImGuiKey.None]]) -- TODO: Also gets 0-based index here, consider making key_data storage 1-based local key_data, key_data_index = ImGui.GetKeyData(g, key) @@ -9488,8 +9522,8 @@ function ImGui.UpdateInputEvents(trickle_fast_inputs) key_data.Down = e.Key.Down key_data.AnalogValue = e.Key.AnalogValue - elseif e.Type == ImGuiInputEventType.Text then - if bit32.band(io.ConfigFlags, ImGuiConfigFlags.NoKeyboard) ~= 0 then + elseif e.Type == 6 --[[ImGuiInputEventType.Text]] then + if bit32.band(io.ConfigFlags, 64 --[[ImGuiConfigFlags.NoKeyboard]]) ~= 0 then break end -- Trickling Rule: Stop processing queued events if keys/mouse have been interacted with @@ -9500,17 +9534,17 @@ function ImGui.UpdateInputEvents(trickle_fast_inputs) stop_3231 = true; break end local c = e.Text.Char - io.InputQueueCharacters:push_back((c <= IM_UNICODE_CODEPOINT_MAX) and c or IM_UNICODE_CODEPOINT_INVALID) + io.InputQueueCharacters:push_back((c <= 65535 --[[IM_UNICODE_CODEPOINT_MAX]]) and c or 65533 --[[IM_UNICODE_CODEPOINT_INVALID]]) if trickle_interleaved_nonchar_keys_and_text then text_inputted = true end - elseif e.Type == ImGuiInputEventType.Focus then + elseif e.Type == 7 --[[ImGuiInputEventType.Focus]] then -- We intentionally overwrite this and process in NewFrame(), in order to give a chance -- to multi-viewports backends to queue AddFocusEvent(false) + AddFocusEvent(true) in same frame. local focus_lost = not e.AppFocused.Focused io.AppFocusLost = focus_lost else - IM_ASSERT(false, "Unknown event!") + assert(false, "Unknown event!") end until true @@ -9555,8 +9589,8 @@ function ImGui.SetKeyOwner(key, owner_id, flags) if flags == nil then flags = 0 end local g = GImGui --- @cast g ImGuiContext - IM_ASSERT(ImGui.IsNamedKeyOrMod(key) and (owner_id ~= ImGuiKeyOwner_Any or (bit32.band(flags, bit32.bor(ImGuiInputFlags.LockThisFrame, ImGuiInputFlags.LockUntilRelease)) ~= 0)), "Can only use _Any with _LockXXX flags (to eat a key away without an ID to retrieve it)") - IM_ASSERT(bit32.band(flags, bit32.bnot(ImGuiInputFlags.SupportedBySetKeyOwner)) == 0, "Passing flags not supported by this function!") + assert(ImGui.IsNamedKeyOrMod(key) and (owner_id ~= 0 --[[ImGuiKeyOwner_Any]] or (bit32.band(flags, bit32.bor(1048576 --[[ImGuiInputFlags.LockThisFrame]], 2097152 --[[ImGuiInputFlags.LockUntilRelease]])) ~= 0)), "Can only use _Any with _LockXXX flags (to eat a key away without an ID to retrieve it)") + assert(bit32.band(flags, bit32.bnot(3145728 --[[ImGuiInputFlags.SupportedBySetKeyOwner]])) == 0, "Passing flags not supported by this function!") -- IMGUI_DEBUG_LOG("SetKeyOwner(%s, owner_id=0x%08X, flags=%08X)\n", GetKeyName(key), owner_id, flags) local owner_data = ImGui.GetKeyOwnerData(g, key) @@ -9565,8 +9599,8 @@ function ImGui.SetKeyOwner(key, owner_id, flags) -- We cannot lock by default as it would likely break lots of legacy code. -- In the case of using LockUntilRelease while key is not down we still lock during the frame (no key_data.Down test) - owner_data.LockUntilRelease = (bit32.band(flags, ImGuiInputFlags.LockUntilRelease) ~= 0) - owner_data.LockThisFrame = (bit32.band(flags, ImGuiInputFlags.LockThisFrame) ~= 0) or owner_data.LockUntilRelease + owner_data.LockUntilRelease = (bit32.band(flags, 2097152 --[[ImGuiInputFlags.LockUntilRelease]]) ~= 0) + owner_data.LockThisFrame = (bit32.band(flags, 1048576 --[[ImGuiInputFlags.LockThisFrame]]) ~= 0) or owner_data.LockUntilRelease end -- Rarely used helper @@ -9576,20 +9610,20 @@ end function ImGui.SetKeyOwnersForKeyChord(key_chord, owner_id, flags) if flags == nil then flags = 0 end - if bit32.band(key_chord, ImGuiMod_Ctrl) ~= 0 then - ImGui.SetKeyOwner(ImGuiMod_Ctrl, owner_id, flags) + if bit32.band(key_chord, 4096 --[[ImGuiMod_Ctrl]]) ~= 0 then + ImGui.SetKeyOwner(4096 --[[ImGuiMod_Ctrl]], owner_id, flags) end - if bit32.band(key_chord, ImGuiMod_Shift) ~= 0 then - ImGui.SetKeyOwner(ImGuiMod_Shift, owner_id, flags) + if bit32.band(key_chord, 8192 --[[ImGuiMod_Shift]]) ~= 0 then + ImGui.SetKeyOwner(8192 --[[ImGuiMod_Shift]], owner_id, flags) end - if bit32.band(key_chord, ImGuiMod_Alt) ~= 0 then - ImGui.SetKeyOwner(ImGuiMod_Alt, owner_id, flags) + if bit32.band(key_chord, 16384 --[[ImGuiMod_Alt]]) ~= 0 then + ImGui.SetKeyOwner(16384 --[[ImGuiMod_Alt]], owner_id, flags) end - if bit32.band(key_chord, ImGuiMod_Super) ~= 0 then - ImGui.SetKeyOwner(ImGuiMod_Super, owner_id, flags) + if bit32.band(key_chord, 32768 --[[ImGuiMod_Super]]) ~= 0 then + ImGui.SetKeyOwner(32768 --[[ImGuiMod_Super]], owner_id, flags) end - if bit32.band(key_chord, bit32.bnot(ImGuiMod_Mask_)) ~= 0 then - ImGui.SetKeyOwner(bit32.band(key_chord, bit32.bnot(ImGuiMod_Mask_)), owner_id, flags) + if bit32.band(key_chord, bit32.bnot(61440 --[[ImGuiMod_Mask_]])) ~= 0 then + ImGui.SetKeyOwner(bit32.band(key_chord, bit32.bnot(61440 --[[ImGuiMod_Mask_]])), owner_id, flags) end end @@ -9602,22 +9636,22 @@ end --- @param key ImGuiKey --- @param flags? ImGuiInputFlags function ImGui.SetItemKeyOwner(key, flags) - if flags == nil then flags = ImGuiInputFlags.None end + if flags == nil then flags = 0 --[[ImGuiInputFlags.None]] end local g = GImGui local id = g.LastItemData.ID if id == 0 or (g.HoveredId ~= id and g.ActiveId ~= id) then return false end - if bit32.band(flags, ImGuiInputFlags.CondMask_) == 0 then - flags = bit32.bor(flags, ImGuiInputFlags.CondDefault_) + if bit32.band(flags, 12582912 --[[ImGuiInputFlags.CondMask_]]) == 0 then + flags = bit32.bor(flags, 12582912 --[[ImGuiInputFlags.CondDefault_]]) end - if (g.HoveredId == id and bit32.band(flags, ImGuiInputFlags.CondHovered) ~= 0) or (g.ActiveId == id and bit32.band(flags, ImGuiInputFlags.CondActive) ~= 0) then - IM_ASSERT(bit32.band(flags, bit32.bnot(ImGuiInputFlags.SupportedBySetItemKeyOwner)) == 0) -- Passing flags not supported by this function! + if (g.HoveredId == id and bit32.band(flags, 4194304 --[[ImGuiInputFlags.CondHovered]]) ~= 0) or (g.ActiveId == id and bit32.band(flags, 8388608 --[[ImGuiInputFlags.CondActive]]) ~= 0) then + assert(bit32.band(flags, bit32.bnot(15728640 --[[ImGuiInputFlags.SupportedBySetItemKeyOwner]])) == 0) -- Passing flags not supported by this function! if not ImGui.TestKeyOwner(key, id) then return false end - ImGui.SetKeyOwner(key, id, bit32.band(flags, bit32.bnot(ImGuiInputFlags.CondMask_))) + ImGui.SetKeyOwner(key, id, bit32.band(flags, bit32.bnot(12582912 --[[ImGuiInputFlags.CondMask_]]))) return true end return false @@ -9630,17 +9664,17 @@ end function ImGui.IsKeyChordPressed(key_chord, flags, owner_id) local g = GImGui key_chord = ImGui.FixupKeyChord(key_chord) - local mods = bit32.band(key_chord, ImGuiMod_Mask_) + local mods = bit32.band(key_chord, 61440 --[[ImGuiMod_Mask_]]) if g.IO.KeyMods ~= mods then return false end -- Special storage location for mods - local key = bit32.band(key_chord, bit32.bnot(ImGuiMod_Mask_)) - if key == ImGuiKey.None then + local key = bit32.band(key_chord, bit32.bnot(61440 --[[ImGuiMod_Mask_]])) + if key == 0 --[[ImGuiKey.None]] then key = ImGui.ConvertSingleModFlagToKey(mods) end - if not ImGui.IsKeyPressedEx(key, bit32.band(flags, ImGuiInputFlags.RepeatMask_), owner_id) then + if not ImGui.IsKeyPressedEx(key, bit32.band(flags, 255 --[[ImGuiInputFlags.RepeatMask_]]), owner_id) then return false end return true @@ -9652,7 +9686,7 @@ function ImGui.SetNextItemShortcut(key_chord, flags) if flags == nil then flags = 0 end local g = GImGui - g.NextItemData.HasFlags = bit32.bor(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasShortcut) + g.NextItemData.HasFlags = bit32.bor(g.NextItemData.HasFlags, 4 --[[ImGuiNextItemDataFlags.HasShortcut]]) g.NextItemData.Shortcut = key_chord g.NextItemData.ShortcutFlags = flags end @@ -9665,17 +9699,17 @@ function ImGui.Shortcut(key_chord, flags, owner_id) -- IMGUI_DEBUG_LOG("Shortcut(%s, flags=%X, owner_id=0x%08X)\n", ImGui.GetKeyChordName(key_chord, g.TempBuffer.Data, g.TempBuffer.Size), flags, owner_id) -- When using (owner_id == 0/Any): SetShortcutRouting() will use CurrentFocusScopeId and filter with this, so IsKeyPressed() is fine with he 0/Any. - if bit32.band(flags, ImGuiInputFlags.RouteTypeMask_) == 0 then - flags = bit32.bor(flags, ImGuiInputFlags.RouteFocused) + if bit32.band(flags, 15360 --[[ImGuiInputFlags.RouteTypeMask_]]) == 0 then + flags = bit32.bor(flags, 2048 --[[ImGuiInputFlags.RouteFocused]]) end -- Using 'owner_id == ImGuiKeyOwner_Any/0': auto-assign an owner based on current focus scope (each window has its focus scope by default) -- Effectively makes Shortcut() always input-owner aware. - if owner_id == ImGuiKeyOwner_Any or owner_id == ImGuiKeyOwner_NoOwner then + if owner_id == 0 --[[ImGuiKeyOwner_Any]] or owner_id == 4294967295 --[[ImGuiKeyOwner_NoOwner]] then owner_id = GetRoutingIdFromOwnerId(owner_id) end - if bit32.band(g.CurrentItemFlags, ImGuiItemFlags.Disabled) ~= 0 then + if bit32.band(g.CurrentItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) ~= 0 then return false end @@ -9686,8 +9720,8 @@ function ImGui.Shortcut(key_chord, flags, owner_id) -- Default repeat behavior for Shortcut() -- So e.g. pressing Ctrl+W and releasing Ctrl while holding W will not trigger the W shortcut. - if bit32.band(flags, ImGuiInputFlags.Repeat) ~= 0 and bit32.band(flags, ImGuiInputFlags.RepeatUntilMask_) == 0 then - flags = bit32.bor(flags, ImGuiInputFlags.RepeatUntilKeyModsChange) + if bit32.band(flags, 1 --[[ImGuiInputFlags.Repeat]]) ~= 0 and bit32.band(flags, 240 --[[ImGuiInputFlags.RepeatUntilMask_]]) == 0 then + flags = bit32.bor(flags, 32 --[[ImGuiInputFlags.RepeatUntilKeyModsChange]]) end if not ImGui.IsKeyChordPressed(key_chord, flags, owner_id) then @@ -9695,9 +9729,9 @@ function ImGui.Shortcut(key_chord, flags, owner_id) end -- Claim mods during the press - ImGui.SetKeyOwnersForKeyChord(bit32.band(key_chord, ImGuiMod_Mask_), owner_id) + ImGui.SetKeyOwnersForKeyChord(bit32.band(key_chord, 61440 --[[ImGuiMod_Mask_]]), owner_id) - IM_ASSERT(bit32.band(flags, bit32.bnot(ImGuiInputFlags.SupportedByShortcut)) == 0) -- Passing flags not supported by this function! + assert(bit32.band(flags, bit32.bnot(261375 --[[ImGuiInputFlags.SupportedByShortcut]])) == 0) -- Passing flags not supported by this function! return true end @@ -9717,29 +9751,29 @@ local function CalcWindowMinSize(window) local size_min = ImVec2() - if (bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0) and (bit32.band(window.Flags, ImGuiWindowFlags.Popup) == 0) then - if bit32.band(window.ChildFlags, ImGuiChildFlags.ResizeX) ~= 0 then + if (bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0) and (bit32.band(window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) == 0) then + if bit32.band(window.ChildFlags, 4 --[[ImGuiChildFlags.ResizeX]]) ~= 0 then size_min.x = g.Style.WindowMinSize.x else - size_min.x = IMGUI_WINDOW_HARD_MIN_SIZE + size_min.x = 4 --[[IMGUI_WINDOW_HARD_MIN_SIZE]] end - if bit32.band(window.ChildFlags, ImGuiChildFlags.ResizeY) ~= 0 then + if bit32.band(window.ChildFlags, 8 --[[ImGuiChildFlags.ResizeY]]) ~= 0 then size_min.y = g.Style.WindowMinSize.y else - size_min.y = IMGUI_WINDOW_HARD_MIN_SIZE + size_min.y = 4 --[[IMGUI_WINDOW_HARD_MIN_SIZE]] end else - if bit32.band(window.Flags, ImGuiWindowFlags.AlwaysAutoResize) == 0 then + if bit32.band(window.Flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) == 0 then size_min.x = g.Style.WindowMinSize.x else - size_min.x = IMGUI_WINDOW_HARD_MIN_SIZE + size_min.x = 4 --[[IMGUI_WINDOW_HARD_MIN_SIZE]] end - if bit32.band(window.Flags, ImGuiWindowFlags.AlwaysAutoResize) == 0 then + if bit32.band(window.Flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) == 0 then size_min.y = g.Style.WindowMinSize.y else - size_min.y = IMGUI_WINDOW_HARD_MIN_SIZE + size_min.y = 4 --[[IMGUI_WINDOW_HARD_MIN_SIZE]] end end @@ -9760,7 +9794,7 @@ local function CalcWindowSizeAfterConstraint(window, size_desired) local new_size = ImVec2() ImVec2_Copy(new_size, size_desired) - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasSizeConstraint) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 16 --[[ImGuiNextWindowDataFlags.HasSizeConstraint]]) ~= 0 then -- See comments in SetNextWindowSizeConstraints() for details about setting size_min an size_max. local cr = ImRect() ImRect_Copy(cr, g.NextWindowData.SizeConstraintRect) @@ -9826,8 +9860,8 @@ local function CalcWindowAutoFitSize(window, size_contents, axis_mask) -- Determine maximum window size -- Child windows are laid within their parent (unless they are also popups/menus) and thus have no restriction - local size_max = ImVec2(FLT_MAX, FLT_MAX) - if bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) == 0 or bit32.band(window.Flags, ImGuiWindowFlags.Popup) ~= 0 then + local size_max = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]) + if bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0 or bit32.band(window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 then if not window.ViewportOwned then size_max = ImGui.GetMainViewport().WorkSize - style.DisplaySafeAreaPadding * 2.0 end @@ -9837,7 +9871,7 @@ local function CalcWindowAutoFitSize(window, size_contents, axis_mask) end end - if bit32.band(window.Flags, ImGuiWindowFlags.Tooltip) ~= 0 then + if bit32.band(window.Flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0 then -- Tooltip always resize (up to maximum size) return ImMin(size_desired, size_max) else @@ -9849,8 +9883,8 @@ local function CalcWindowAutoFitSize(window, size_contents, axis_mask) local size_auto_fit_after_constraint = CalcWindowSizeAfterConstraint(window, size_auto_fit) local size_contents_for_scrollbar_x = (bit32.band(axis_mask, 1) ~= 0) and size_contents.x or window.ContentSize.x -- See #9352. In theory this should use same logic as `window.ScrollbarY = ...` codepath in Begin(). Needs some plumbling. local size_contents_for_scrollbar_y = (bit32.band(axis_mask, 2) ~= 0) and size_contents.y or window.ContentSize.y - local will_have_scrollbar_x = (size_auto_fit_after_constraint.x < size_contents_for_scrollbar_x + size_pad.x + decoration_w_without_scrollbars and bit32.band(window.Flags, ImGuiWindowFlags.NoScrollbar) == 0 and bit32.band(window.Flags, ImGuiWindowFlags.HorizontalScrollbar) ~= 0) or bit32.band(window.Flags, ImGuiWindowFlags.AlwaysHorizontalScrollbar) ~= 0 - local will_have_scrollbar_y = (size_auto_fit_after_constraint.y < size_contents_for_scrollbar_y + size_pad.y + decoration_h_without_scrollbars and bit32.band(window.Flags, ImGuiWindowFlags.NoScrollbar) == 0) or bit32.band(window.Flags, ImGuiWindowFlags.AlwaysVerticalScrollbar) ~= 0 + local will_have_scrollbar_x = (size_auto_fit_after_constraint.x < size_contents_for_scrollbar_x + size_pad.x + decoration_w_without_scrollbars and bit32.band(window.Flags, 8 --[[ImGuiWindowFlags.NoScrollbar]]) == 0 and bit32.band(window.Flags, 2048 --[[ImGuiWindowFlags.HorizontalScrollbar]]) ~= 0) or bit32.band(window.Flags, 32768 --[[ImGuiWindowFlags.AlwaysHorizontalScrollbar]]) ~= 0 + local will_have_scrollbar_y = (size_auto_fit_after_constraint.y < size_contents_for_scrollbar_y + size_pad.y + decoration_h_without_scrollbars and bit32.band(window.Flags, 8 --[[ImGuiWindowFlags.NoScrollbar]]) == 0) or bit32.band(window.Flags, 16384 --[[ImGuiWindowFlags.AlwaysVerticalScrollbar]]) ~= 0 if will_have_scrollbar_x then size_auto_fit.y = size_auto_fit.y + style.ScrollbarSize end @@ -9875,12 +9909,12 @@ end --- @param window ImGuiWindow --- @return ImGuiCol local function GetWindowBgColorIdx(window) - if bit32.band(window.Flags, bit32.bor(ImGuiWindowFlags.Tooltip, ImGuiWindowFlags.Popup)) ~= 0 then - return ImGuiCol.PopupBg - elseif bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 and not window.DockIsActive then - return ImGuiCol.ChildBg + if bit32.band(window.Flags, bit32.bor(33554432 --[[ImGuiWindowFlags.Tooltip]], 67108864 --[[ImGuiWindowFlags.Popup]])) ~= 0 then + return 4 --[[ImGuiCol.PopupBg]] + elseif bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 and not window.DockIsActive then + return 3 --[[ImGuiCol.ChildBg]] else - return ImGuiCol.WindowBg + return 2 --[[ImGuiCol.WindowBg]] end end @@ -9893,7 +9927,7 @@ local function CalcResizePosSizeFromAnyCorner(window, corner_target_arg, corner_ local corner_target = ImVec2() ImVec2_Copy(corner_target, corner_target_arg) - if bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 then -- Clamp resizing of childs within parent + if bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 then -- Clamp resizing of childs within parent local parent_window = window.ParentWindow local parent_flags = parent_window.Flags @@ -9901,10 +9935,10 @@ local function CalcResizePosSizeFromAnyCorner(window, corner_target_arg, corner_ ImRect_Copy(limit_rect, parent_window.InnerRect) limit_rect:Expand(ImVec2(-ImMax(parent_window.WindowPadding.x, parent_window.WindowBorderSize), -ImMax(parent_window.WindowPadding.y, parent_window.WindowBorderSize))) - if (bit32.band(parent_flags, bit32.bor(ImGuiWindowFlags.HorizontalScrollbar, ImGuiWindowFlags.AlwaysHorizontalScrollbar)) == 0) or (bit32.band(parent_flags, ImGuiWindowFlags.NoScrollbar) ~= 0) then + if (bit32.band(parent_flags, bit32.bor(2048 --[[ImGuiWindowFlags.HorizontalScrollbar]], 32768 --[[ImGuiWindowFlags.AlwaysHorizontalScrollbar]])) == 0) or (bit32.band(parent_flags, 8 --[[ImGuiWindowFlags.NoScrollbar]]) ~= 0) then corner_target.x = ImClamp(corner_target.x, limit_rect.Min.x, limit_rect.Max.x) end - if bit32.band(parent_flags, ImGuiWindowFlags.NoScrollbar) ~= 0 then + if bit32.band(parent_flags, 8 --[[ImGuiWindowFlags.NoScrollbar]]) ~= 0 then corner_target.y = ImClamp(corner_target.y, limit_rect.Min.y, limit_rect.Max.y) end end @@ -9936,10 +9970,10 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c local g = GImGui local flags = window.Flags - if (bit32.band(flags, ImGuiWindowFlags.NoResize) ~= 0 or window.AutoFitFramesX > 0 or window.AutoFitFramesY > 0) then + if (bit32.band(flags, 2 --[[ImGuiWindowFlags.NoResize]]) ~= 0 or window.AutoFitFramesX > 0 or window.AutoFitFramesY > 0) then return 0, -1, -1 end - if (bit32.band(flags, ImGuiWindowFlags.AlwaysAutoResize) ~= 0 and bit32.band(window.ChildFlags, bit32.bor(ImGuiChildFlags.ResizeX, ImGuiChildFlags.ResizeY)) == 0) then + if (bit32.band(flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) ~= 0 and bit32.band(window.ChildFlags, bit32.bor(4 --[[ImGuiChildFlags.ResizeX]], 8 --[[ImGuiChildFlags.ResizeY]])) == 0) then return 0, -1, -1 end if window.WasActive == false then -- Early out to avoid running this code for e.g. a hidden implicit/fallback Debug window. @@ -9956,8 +9990,8 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c ImGui.PushID("#RESIZE") - local pos_target = ImVec2(FLT_MAX, FLT_MAX) - local size_target = ImVec2(FLT_MAX, FLT_MAX) + local pos_target = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]) + local size_target = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]) -- Clip mouse interaction rectangles within the viewport rectangle (in practice the narrowing is going to happen most of the time). -- - Not narrowing would mostly benefit the situation where OS windows _without_ decoration have a threshold for hovering when outside their limits. @@ -9965,7 +9999,7 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c -- - When decoration are enabled we typically benefit from that distance, but then our resize elements would be conflicting with OS resize elements, so we also narrow. -- - Note that we are unable to tell if the platform setup allows hovering with a distance threshold (on Win32, decorated window have such threshold). -- We only clip interaction so we overwrite window.ClipRect, cannot call PushClipRect() yet as DrawList is not yet setup. - local clip_with_viewport_rect = bit32.band(g.IO.BackendFlags, ImGuiBackendFlags.HasMouseHoveredViewport) == 0 or g.IO.MouseHoveredViewport ~= window.ViewportId or bit32.band(window.Viewport.Flags, ImGuiViewportFlags.NoDecoration) == 0 + local clip_with_viewport_rect = bit32.band(g.IO.BackendFlags, 4096 --[[ImGuiBackendFlags.HasMouseHoveredViewport]]) == 0 or g.IO.MouseHoveredViewport ~= window.ViewportId or bit32.band(window.Viewport.Flags, 8 --[[ImGuiViewportFlags.NoDecoration]]) == 0 if (clip_with_viewport_rect) then ImRect_Copy(window.ClipRect, window.Viewport:GetMainRect()) end @@ -9973,7 +10007,7 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c local clamp_rect = ImRect() ImRect_Copy(clamp_rect, visibility_rect) - local window_move_from_title_bar = (bit32.band(window.BgClickFlags, ImGuiWindowBgClickFlags.Move) == 0) and (bit32.band(window.Flags, ImGuiWindowFlags.NoTitleBar) == 0) + local window_move_from_title_bar = (bit32.band(window.BgClickFlags, 1 --[[ImGuiWindowBgClickFlags.Move]]) == 0) and (bit32.band(window.Flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) == 0) if window_move_from_title_bar then clamp_rect.Min.y = clamp_rect.Min.y - window.TitleBarHeight end @@ -9993,12 +10027,12 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c local resize_grip_id = window:GetID(resize_grip_n) -- == GetWindowResizeCornerID() - ImGui.ItemAdd(resize_rect, resize_grip_id, nil, ImGuiItemFlags.NoNav) - local _, hovered, held = ImGui.ButtonBehavior(resize_rect, resize_grip_id, bit32.bor(ImGuiButtonFlags.FlattenChildren, ImGuiButtonFlags.NoNavFocus)) + ImGui.ItemAdd(resize_rect, resize_grip_id, nil, 2 --[[ImGuiItemFlags.NoNav]]) + local _, hovered, held = ImGui.ButtonBehavior(resize_rect, resize_grip_id, bit32.bor(2048 --[[ImGuiButtonFlags.FlattenChildren]], 262144 --[[ImGuiButtonFlags.NoNavFocus]])) -- GetForegroundDrawList(window):AddRect(resize_rect.Min, resize_rect.Max, IM_COL32(255, 255, 0, 255)) if hovered or held then - ImGui.SetMouseCursor((bit32.band(resize_grip_n, 1) ~= 0) and ImGuiMouseCursor.ResizeNESW or ImGuiMouseCursor.ResizeNWSE) + ImGui.SetMouseCursor((bit32.band(resize_grip_n, 1) ~= 0) and 5 --[[ImGuiMouseCursor.ResizeNESW]] or 6 --[[ImGuiMouseCursor.ResizeNWSE]]) end if held and g.IO.MouseDoubleClicked[0] then @@ -10010,8 +10044,8 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c elseif held then -- Resize from any of the four corners -- We don't use an incremental MouseDelta but rather compute an absolute target size based on mouse position - local clamp_min = ImVec2((corner_pos.x == 1.0) and clamp_rect.Min.x or -FLT_MAX, (corner_pos.y == 1.0) and clamp_rect.Min.y or -FLT_MAX) - local clamp_max = ImVec2((corner_pos.x == 0.0) and clamp_rect.Max.x or FLT_MAX, (corner_pos.y == 0.0) and clamp_rect.Max.y or FLT_MAX) + local clamp_min = ImVec2((corner_pos.x == 1.0) and clamp_rect.Min.x or -3.4028234663853e+38 --[[FLT_MAX]], (corner_pos.y == 1.0) and clamp_rect.Min.y or -3.4028234663853e+38 --[[FLT_MAX]]) + local clamp_max = ImVec2((corner_pos.x == 0.0) and clamp_rect.Max.x or 3.4028234663853e+38 --[[FLT_MAX]], (corner_pos.y == 0.0) and clamp_rect.Max.y or 3.4028234663853e+38 --[[FLT_MAX]]) local corner_target = g.IO.MousePos - g.ActiveIdClickOffset + ImLerp(def.InnerDir * grip_hover_outer_size, def.InnerDir * -grip_hover_inner_size, def.CornerPosN) -- Corner of the window corresponding to our corner grip corner_target = ImClamp(corner_target, clamp_min, clamp_max) @@ -10020,16 +10054,16 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c end -- Only lower-left grip is visible before hovering/activating - local resize_grip_visible = held or hovered or (resize_grip_n == 0 and bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) == 0) + local resize_grip_visible = held or hovered or (resize_grip_n == 0 and bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0) if resize_grip_visible then local color if held then - color = ImGui.GetColorU32(ImGuiCol.ResizeGripActive) + color = ImGui.GetColorU32(33 --[[ImGuiCol.ResizeGripActive]]) else if hovered then - color = ImGui.GetColorU32(ImGuiCol.ResizeGripHovered) + color = ImGui.GetColorU32(32 --[[ImGuiCol.ResizeGripHovered]]) else - color = ImGui.GetColorU32(ImGuiCol.ResizeGrip) + color = ImGui.GetColorU32(31 --[[ImGuiCol.ResizeGrip]]) end end resize_grip_col[resize_grip_n + 1] = color @@ -10037,9 +10071,9 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c end local resize_border_mask = 0x00 - if bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 then - local mask_x = (bit32.band(window.ChildFlags, ImGuiChildFlags.ResizeX) ~= 0) and 0x02 or 0 - local mask_y = (bit32.band(window.ChildFlags, ImGuiChildFlags.ResizeY) ~= 0) and 0x08 or 0 + if bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 then + local mask_x = (bit32.band(window.ChildFlags, 4 --[[ImGuiChildFlags.ResizeX]]) ~= 0) and 0x02 or 0 + local mask_y = (bit32.band(window.ChildFlags, 8 --[[ImGuiChildFlags.ResizeY]]) ~= 0) and 0x08 or 0 resize_border_mask = bit32.bor(mask_x, mask_y) else resize_border_mask = g.IO.ConfigWindowsResizeFromEdges and 0x0F or 0x00 @@ -10053,23 +10087,23 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c local def = ImGuiResizeBorderDef[border_n + 1] local axis - if border_n == ImGuiDir.Left or border_n == ImGuiDir.Right then - axis = ImGuiAxis.X + if border_n == 0 --[[ImGuiDir.Left]] or border_n == 1 --[[ImGuiDir.Right]] then + axis = 1 --[[ImGuiAxis.X]] else - axis = ImGuiAxis.Y + axis = 2 --[[ImGuiAxis.Y]] end local border_rect = GetResizeBorderRect(window, border_n, grip_hover_inner_size, g.WindowsBorderHoverPadding) local border_id = window:GetID(border_n + 4) -- == GetWindowResizeBorderID() - ImGui.ItemAdd(border_rect, border_id, nil, ImGuiItemFlags.NoNav) - local _, hovered, held = ImGui.ButtonBehavior(border_rect, border_id, bit32.bor(ImGuiButtonFlags.FlattenChildren, ImGuiButtonFlags.NoNavFocus)) + ImGui.ItemAdd(border_rect, border_id, nil, 2 --[[ImGuiItemFlags.NoNav]]) + local _, hovered, held = ImGui.ButtonBehavior(border_rect, border_id, bit32.bor(2048 --[[ImGuiButtonFlags.FlattenChildren]], 262144 --[[ImGuiButtonFlags.NoNavFocus]])) -- GetForegroundDrawList(window):AddRect(border_rect.Min, border_rect.Max, IM_COL32(255, 255, 0, 255)) if hovered and g.HoveredIdTimer <= WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER then hovered = false end if hovered or held then - ImGui.SetMouseCursor((axis == ImGuiAxis.X) and ImGuiMouseCursor.ResizeEW or ImGuiMouseCursor.ResizeNS) + ImGui.SetMouseCursor((axis == 1 --[[ImGuiAxis.X]]) and 4 --[[ImGuiMouseCursor.ResizeEW]] or 3 --[[ImGuiMouseCursor.ResizeNS]]) end if held and g.IO.MouseDoubleClicked[0] then -- Double-clicking bottom or right border auto-fit on this axis @@ -10092,7 +10126,7 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c g.WindowResizeRelativeMode = false end - if (bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0) and g.WindowResizeBorderExpectedRect ~= border_rect then + if (bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0) and g.WindowResizeBorderExpectedRect ~= border_rect then g.WindowResizeRelativeMode = true end @@ -10118,8 +10152,8 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c end -- Clamp, apply - local clamp_min = ImVec2((border_n == ImGuiDir.Right) and clamp_rect.Min.x or -FLT_MAX, (border_n == ImGuiDir.Down or (border_n == ImGuiDir.Up and window_move_from_title_bar)) and clamp_rect.Min.y or -FLT_MAX) - local clamp_max = ImVec2((border_n == ImGuiDir.Left) and clamp_rect.Max.x or FLT_MAX, (border_n == ImGuiDir.Up) and clamp_rect.Max.y or FLT_MAX) + local clamp_min = ImVec2((border_n == 1 --[[ImGuiDir.Right]]) and clamp_rect.Min.x or -3.4028234663853e+38 --[[FLT_MAX]], (border_n == 3 --[[ImGuiDir.Down]] or (border_n == 2 --[[ImGuiDir.Up]] and window_move_from_title_bar)) and clamp_rect.Min.y or -3.4028234663853e+38 --[[FLT_MAX]]) + local clamp_max = ImVec2((border_n == 0 --[[ImGuiDir.Left]]) and clamp_rect.Max.x or 3.4028234663853e+38 --[[FLT_MAX]], (border_n == 2 --[[ImGuiDir.Up]]) and clamp_rect.Max.y or 3.4028234663853e+38 --[[FLT_MAX]]) border_target = ImClamp(border_target, clamp_min, clamp_max) if not ignore_resize then @@ -10138,24 +10172,24 @@ local function UpdateWindowManualResize(window, resize_grip_count, resize_grip_c ImGui.PopID() -- Restore nav layer - window.DC.NavLayerCurrent = ImGuiNavLayer.Main + window.DC.NavLayerCurrent = 0 --[[ImGuiNavLayer.Main]] -- Apply back modified position/size to window - if size_target.x ~= FLT_MAX and (window.Size.x ~= size_target.x or window.SizeFull.x ~= size_target.x) then + if size_target.x ~= 3.4028234663853e+38 --[[FLT_MAX]] and (window.Size.x ~= size_target.x or window.SizeFull.x ~= size_target.x) then window.Size.x = size_target.x window.SizeFull.x = size_target.x end - if size_target.y ~= FLT_MAX and (window.Size.y ~= size_target.y or window.SizeFull.y ~= size_target.y) then + if size_target.y ~= 3.4028234663853e+38 --[[FLT_MAX]] and (window.Size.y ~= size_target.y or window.SizeFull.y ~= size_target.y) then window.Size.y = size_target.y window.SizeFull.y = size_target.y end - if pos_target.x ~= FLT_MAX and window.Pos.x ~= ImFloor(pos_target.x) then + if pos_target.x ~= 3.4028234663853e+38 --[[FLT_MAX]] and window.Pos.x ~= ImFloor(pos_target.x) then window.Pos.x = ImFloor(pos_target.x) end - if pos_target.y ~= FLT_MAX and window.Pos.y ~= ImFloor(pos_target.y) then + if pos_target.y ~= 3.4028234663853e+38 --[[FLT_MAX]] and window.Pos.y ~= ImFloor(pos_target.y) then window.Pos.y = ImFloor(pos_target.y) end @@ -10242,7 +10276,7 @@ function ImGui.RenderText(pos, text, text_begin, text_end, hide_text_after_hash) end if text ~= "" and text_display_end > 1 then - window.DrawList:AddText(g.Font, g.FontSize, pos, ImGui.GetColorU32(ImGuiCol.Text), text, text_begin, text_display_end, 0.0) + window.DrawList:AddText(g.Font, g.FontSize, pos, ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), text, text_begin, text_display_end, 0.0) if g.LogEnabled then -- ImGui.LogRenderedText(&pos, text, text_display_end); end @@ -10262,7 +10296,7 @@ function ImGui.RenderTextWrapped(pos, text, text_end, wrap_width) end if text ~= "" then - window.DrawList:AddText(g.Font, g.FontSize, pos, ImGui.GetColorU32(ImGuiCol.Text), text, 1, text_end, wrap_width) + window.DrawList:AddText(g.Font, g.FontSize, pos, ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), text, 1, text_end, wrap_width) end end @@ -10310,9 +10344,9 @@ function ImGui.RenderTextClippedEx(draw_list, pos_min, pos_max, text, text_begin if (need_clipping) then local fine_clip_rect = RenderTextClippedEx_fine_clip fine_clip_rect.x = clip_min.x; fine_clip_rect.y = clip_min.y; fine_clip_rect.z = clip_max.x; fine_clip_rect.w = clip_max.y - draw_list:AddText(nil, 0.0, pos, ImGui.GetColorU32(ImGuiCol.Text), text, text_begin, text_display_end, 0.0, fine_clip_rect) + draw_list:AddText(nil, 0.0, pos, ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), text, text_begin, text_display_end, 0.0, fine_clip_rect) else - draw_list:AddText(nil, 0.0, pos, ImGui.GetColorU32(ImGuiCol.Text), text, text_begin, text_display_end, 0.0, nil) + draw_list:AddText(nil, 0.0, pos, ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), text, text_begin, text_display_end, 0.0, nil) end end @@ -10347,17 +10381,17 @@ end --- @param rounding? float function ImGui.RenderNavCursor(bb, id, flags, rounding) - if flags == nil then flags = ImGuiNavRenderCursorFlags.None end + if flags == nil then flags = 0 --[[ImGuiNavRenderCursorFlags.None]] end if rounding == nil then rounding = -1.0 end local g = GImGui if id ~= g.NavId then return end - if not g.NavCursorVisible and bit32.band(flags, ImGuiNavRenderCursorFlags.AlwaysDraw) == 0 then + if not g.NavCursorVisible and bit32.band(flags, 4 --[[ImGuiNavRenderCursorFlags.AlwaysDraw]]) == 0 then return end - if id == g.LastItemData.ID and bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.NoNav) ~= 0 then + if id == g.LastItemData.ID and bit32.band(g.LastItemData.ItemFlags, 2 --[[ImGuiItemFlags.NoNav]]) ~= 0 then return end @@ -10377,8 +10411,8 @@ function ImGui.RenderNavCursor(bb, id, flags, rounding) display_rect:ClipWith(window.ClipRect) local scale_factor = ImGui.GetScale() -- FIXME-DPI local thickness = ImTrunc(ImMax(2.0, 1.5 * scale_factor)) - if bit32.band(flags, ImGuiNavRenderCursorFlags.Compact) ~= 0 then - window.DrawList:AddRect(display_rect.Min, display_rect.Max, ImGui.GetColorU32(ImGuiCol.NavCursor), rounding, thickness) + if bit32.band(flags, 2 --[[ImGuiNavRenderCursorFlags.Compact]]) ~= 0 then + window.DrawList:AddRect(display_rect.Min, display_rect.Max, ImGui.GetColorU32(59 --[[ImGuiCol.NavCursor]]), rounding, thickness) else local distance = ImTrunc(3.0 + thickness * 0.5) display_rect:Expand(ImVec2(distance, distance)) @@ -10386,7 +10420,7 @@ function ImGui.RenderNavCursor(bb, id, flags, rounding) if not fully_visible then window.DrawList:PushClipRect(display_rect.Min, display_rect.Max) end - window.DrawList:AddRect(display_rect.Min, display_rect.Max, ImGui.GetColorU32(ImGuiCol.NavCursor), rounding, thickness) + window.DrawList:AddRect(display_rect.Min, display_rect.Max, ImGui.GetColorU32(59 --[[ImGuiCol.NavCursor]]), rounding, thickness) if not fully_visible then window.DrawList:PopClipRect() end @@ -10408,8 +10442,8 @@ local uv_fill = {ImVec2(), ImVec2()} --- @param col_shadow ImU32 function ImGui.RenderMouseCursor(base_pos, base_scale, mouse_cursor, col_fill, col_border, col_shadow) local g = GImGui - if mouse_cursor <= ImGuiMouseCursor.None or mouse_cursor >= ImGuiMouseCursor.COUNT then -- We intentionally accept out of bound values. - mouse_cursor = ImGuiMouseCursor.Arrow + if mouse_cursor <= (-1) --[[ImGuiMouseCursor.None]] or mouse_cursor >= 11 --[[ImGuiMouseCursor.COUNT]] then -- We intentionally accept out of bound values. + mouse_cursor = 0 --[[ImGuiMouseCursor.Arrow]] end local font_atlas = g.DrawListSharedData.FontAtlas @@ -10433,9 +10467,9 @@ function ImGui.RenderMouseCursor(base_pos, base_scale, mouse_cursor, col_fill, c draw_list:AddImage(tex_ref, pos + ImVec2(2, 0) * scale, pos + (ImVec2(2, 0) + size) * scale, uv_fill[1], uv_fill[2], col_shadow) draw_list:AddImage(tex_ref, pos, pos + size * scale, uv_fill[1], uv_fill[2], col_border) draw_list:AddImage(tex_ref, pos, pos + size * scale, uv_border[1], uv_border[2], col_fill) - if mouse_cursor == ImGuiMouseCursor.Wait or mouse_cursor == ImGuiMouseCursor.Progress then - local a_min = ImFmod(g.Time * 5.0, 2.0 * IM_PI) - local a_max = a_min + IM_PI * 1.65 + if mouse_cursor == 8 --[[ImGuiMouseCursor.Wait]] or mouse_cursor == 9 --[[ImGuiMouseCursor.Progress]] then + local a_min = ImFmod(g.Time * 5.0, 2.0 * 3.141592653589793 --[[IM_PI]]) + local a_max = a_min + 3.141592653589793 --[[IM_PI]] * 1.65 draw_list:PathArcTo(pos + ImVec2(14, -1) * scale, 6.0 * scale, a_min, a_max) draw_list:PathStroke(col_fill, 3.0 * scale) end @@ -10500,7 +10534,7 @@ function ImGui.RenderTextEllipsis(draw_list, pos_min, pos_max, ellipsis_max_x, t ImGui.RenderTextClippedEx(draw_list, pos_min, pos_max, text, 1, text_end_ellipsis, text_size, ImVec2(0.0, 0.0)) local cpu_fine_clip_rect = ImVec4(pos_min.x, pos_min.y, pos_max.x, pos_max.y) local ellipsis_pos = ImTrunc(ImVec2(pos_min.x + text_size_clipped_x, pos_min.y)) - font:RenderChar(draw_list, font_size, ellipsis_pos, ImGui.GetColorU32(ImGuiCol.Text), font.EllipsisChar, cpu_fine_clip_rect) + font:RenderChar(draw_list, font_size, ellipsis_pos, ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), font.EllipsisChar, cpu_fine_clip_rect) else ImGui.RenderTextClippedEx(draw_list, pos_min, pos_max, text, 1, text_end_full, text_size, ImVec2(0.0, 0.0)) end @@ -10528,8 +10562,8 @@ function ImGui.RenderFrame(p_min, p_max, fill_col, borders, rounding) local border_size = g.Style.FrameBorderSize if borders and border_size > 0 then - window.DrawList:AddRect(p_min + ImVec2(1, 1), p_max + ImVec2(1, 1), ImGui.GetColorU32(ImGuiCol.BorderShadow), rounding, border_size, 0) - window.DrawList:AddRect(p_min, p_max, ImGui.GetColorU32(ImGuiCol.Border), rounding, border_size, 0) + window.DrawList:AddRect(p_min + ImVec2(1, 1), p_max + ImVec2(1, 1), ImGui.GetColorU32(6 --[[ImGuiCol.BorderShadow]]), rounding, border_size, 0) + window.DrawList:AddRect(p_min, p_max, ImGui.GetColorU32(5 --[[ImGuiCol.Border]]), rounding, border_size, 0) end end @@ -10542,8 +10576,8 @@ function ImGui.RenderFrameBorder(p_min, p_max, rounding) local window = g.CurrentWindow local border_size = g.Style.FrameBorderSize if border_size > 0.0 then - window.DrawList:AddRect(p_min + ImVec2(1, 1), p_max + ImVec2(1, 1), ImGui.GetColorU32(ImGuiCol.BorderShadow), rounding, border_size, 0) - window.DrawList:AddRect(p_min, p_max, ImGui.GetColorU32(ImGuiCol.Border), rounding, border_size, 0) + window.DrawList:AddRect(p_min + ImVec2(1, 1), p_max + ImVec2(1, 1), ImGui.GetColorU32(6 --[[ImGuiCol.BorderShadow]]), rounding, border_size, 0) + window.DrawList:AddRect(p_min, p_max, ImGui.GetColorU32(5 --[[ImGuiCol.Border]]), rounding, border_size, 0) end end @@ -10567,33 +10601,33 @@ local function RenderWindowOuterSingleBorder(window, border_n, border_col, borde local def = ImGuiResizeBorderDef[border_n + 1] local rounding = window.WindowRounding local border_r = GetResizeBorderRect(window, border_n, rounding, 0.0) - window.DrawList:PathArcTo(ImLerp(border_r.Min, border_r.Max, def.SegmentN1) + ImVec2(0.5, 0.5) + def.InnerDir * rounding, rounding, def.OuterAngle - IM_PI * 0.25, def.OuterAngle) - window.DrawList:PathArcTo(ImLerp(border_r.Min, border_r.Max, def.SegmentN2) + ImVec2(0.5, 0.5) + def.InnerDir * rounding, rounding, def.OuterAngle, def.OuterAngle + IM_PI * 0.25) + window.DrawList:PathArcTo(ImLerp(border_r.Min, border_r.Max, def.SegmentN1) + ImVec2(0.5, 0.5) + def.InnerDir * rounding, rounding, def.OuterAngle - 3.141592653589793 --[[IM_PI]] * 0.25, def.OuterAngle) + window.DrawList:PathArcTo(ImLerp(border_r.Min, border_r.Max, def.SegmentN2) + ImVec2(0.5, 0.5) + def.InnerDir * rounding, rounding, def.OuterAngle, def.OuterAngle + 3.141592653589793 --[[IM_PI]] * 0.25) window.DrawList:PathStroke(border_col, border_size) end local function RenderWindowOuterBorders(window) local g = GImGui local border_size = window.WindowBorderSize - local border_col = ImGui.GetColorU32(ImGuiCol.Border) - if border_size > 0.0 and (bit32.band(window.Flags, ImGuiWindowFlags.NoBackground) == 0) then + local border_col = ImGui.GetColorU32(5 --[[ImGuiCol.Border]]) + if border_size > 0.0 and (bit32.band(window.Flags, 128 --[[ImGuiWindowFlags.NoBackground]]) == 0) then window.DrawList:AddRect(window.Pos, window.Pos + window.Size, border_col, window.WindowRounding, window.WindowBorderSize, 0) elseif border_size > 0.0 then - if bit32.band(window.ChildFlags, ImGuiChildFlags.ResizeX) ~= 0 then -- Similar code as 'resize_border_mask' computation in UpdateWindowManualResize() but we specifically only always draw explicit child resize border. + if bit32.band(window.ChildFlags, 4 --[[ImGuiChildFlags.ResizeX]]) ~= 0 then -- Similar code as 'resize_border_mask' computation in UpdateWindowManualResize() but we specifically only always draw explicit child resize border. RenderWindowOuterSingleBorder(window, 1, border_col, border_size) end - if bit32.band(window.ChildFlags, ImGuiChildFlags.ResizeY) ~= 0 then + if bit32.band(window.ChildFlags, 8 --[[ImGuiChildFlags.ResizeY]]) ~= 0 then RenderWindowOuterSingleBorder(window, 3, border_col, border_size) end end if window.ResizeBorderHovered ~= -1 or window.ResizeBorderHeld ~= -1 then local border_n = (window.ResizeBorderHeld ~= -1) and window.ResizeBorderHeld or window.ResizeBorderHovered - local border_col_resizing = ImGui.GetColorU32((window.ResizeBorderHeld ~= -1) and ImGuiCol.SeparatorActive or ImGuiCol.SeparatorHovered) + local border_col_resizing = ImGui.GetColorU32((window.ResizeBorderHeld ~= -1) and 30 --[[ImGuiCol.SeparatorActive]] or 29 --[[ImGuiCol.SeparatorHovered]]) RenderWindowOuterSingleBorder(window, border_n, border_col_resizing, ImMax(2.0, window.WindowBorderSize)) -- Thicker than usual end - if g.Style.FrameBorderSize > 0 and (bit32.band(window.Flags, ImGuiWindowFlags.NoTitleBar) == 0) and not window.DockIsActive then + 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) end @@ -10622,37 +10656,37 @@ local function RenderWindowDecorations(window, title_bar_rect, title_bar_is_high local backup_border_size = style.FrameBorderSize g.Style.FrameBorderSize = window.WindowBorderSize - local title_bar_col = ImGui.GetColorU32((title_bar_is_highlight and g.NavCursorVisible) and ImGuiCol.TitleBgActive or ImGuiCol.TitleBgCollapsed) + local title_bar_col = ImGui.GetColorU32((title_bar_is_highlight and g.NavCursorVisible) and 11 --[[ImGuiCol.TitleBgActive]] or 12 --[[ImGuiCol.TitleBgCollapsed]]) ImGui.RenderFrame(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, true, window_rounding) g.Style.FrameBorderSize = backup_border_size else -- Window background - if bit32.band(flags, ImGuiWindowFlags.NoBackground) == 0 then + if bit32.band(flags, 128 --[[ImGuiWindowFlags.NoBackground]]) == 0 then local bg_col = ImGui.GetColorU32(GetWindowBgColorIdx(window)) -- Adjust alpha. For docking local override_alpha = false local alpha = 1.0 - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasBgAlpha) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 64 --[[ImGuiNextWindowDataFlags.HasBgAlpha]]) ~= 0 then alpha = g.NextWindowData.BgAlphaVal override_alpha = true end if override_alpha then - bg_col = bit32.bor(bit32.band(bg_col, bit32.bnot(IM_COL32_A_MASK)), bit32.lshift(IM_F32_TO_INT8_SAT(alpha), IM_COL32_A_SHIFT)) + bg_col = bit32.bor(bit32.band(bg_col, bit32.bnot(4278190080 --[[IM_COL32_A_MASK]])), bit32.lshift(IM_F32_TO_INT8_SAT(alpha), 24 --[[IM_COL32_A_SHIFT]])) end -- Render, for docked windows and host windows we ensure BG goes before decorations if window.DockIsActive then window.DockNode.LastBgColor = bg_col end - if bit32.band(flags, ImGuiWindowFlags.DockNodeHost) ~= 0 then bg_col = 0 end + if bit32.band(flags, 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) ~= 0 then bg_col = 0 end - if bit32.band(bg_col, IM_COL32_A_MASK) ~= 0 then + if bit32.band(bg_col, 4278190080 --[[IM_COL32_A_MASK]]) ~= 0 then local bg_rect = ImRect(window.Pos + ImVec2(0, window.TitleBarHeight), window.Pos + window.Size) local bg_rounding_flags if window.DockIsActive then bg_rounding_flags = ImGui.CalcRoundingFlagsForRectInRect(bg_rect, window.DockNode.HostWindow:Rect(), 0.0) else - bg_rounding_flags = (bit32.band(flags, ImGuiWindowFlags.NoTitleBar) ~= 0) and ImDrawFlags.RoundCornersAll or ImDrawFlags.RoundCornersBottom + bg_rounding_flags = (bit32.band(flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) ~= 0) and 240 --[[ImDrawFlags.RoundCornersAll]] or 192 --[[ImDrawFlags.RoundCornersBottom]] end local bg_draw_list = window.DockIsActive and window.DockNode.HostWindow.DrawList or window.DrawList if window.DockIsActive then bg_draw_list:ChannelsSetCurrent(0) end @@ -10665,18 +10699,18 @@ local function RenderWindowDecorations(window, title_bar_rect, title_bar_is_high -- Title bar -- (when docked, DockNode are drawing their own title bar. Individual windows however do NOT set the _NoTitleBar flag, -- in order for their pos/size to be matching their undocking state.) - if bit32.band(flags, ImGuiWindowFlags.NoTitleBar) == 0 and not window.DockIsActive then - local title_bar_col = ImGui.GetColorU32(title_bar_is_highlight and ImGuiCol.TitleBgActive or ImGuiCol.TitleBg) - window.DrawList:AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, window_rounding, ImDrawFlags.RoundCornersTop) + if bit32.band(flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) == 0 and not window.DockIsActive then + local title_bar_col = ImGui.GetColorU32(title_bar_is_highlight and 11 --[[ImGuiCol.TitleBgActive]] or 10 --[[ImGuiCol.TitleBg]]) + window.DrawList:AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, window_rounding, 48 --[[ImDrawFlags.RoundCornersTop]]) end -- Menu bar - if bit32.band(flags, ImGuiWindowFlags.MenuBar) ~= 0 then + if bit32.band(flags, 1024 --[[ImGuiWindowFlags.MenuBar]]) ~= 0 then local menu_bar_rect = window:MenuBarRect() 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(ImGuiCol.MenuBarBg), (bit32.band(flags, ImGuiWindowFlags.NoTitleBar) ~= 0) and window_rounding or 0.0, ImDrawFlags.RoundCornersTop) + 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.RoundCornersTop]]) 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(ImGuiCol.Border), style.FrameBorderSize) + 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) end end @@ -10689,7 +10723,7 @@ local function RenderWindowDecorations(window, title_bar_rect, title_bar_is_high local r = ImRect(p, p + ImVec2(unhide_sz_hit, unhide_sz_hit)) local unhide_id = window:GetID("#UNHIDE") ImGui.KeepAliveID(unhide_id) - local pressed, hovered, held = ImGui.ButtonBehavior(r, unhide_id, ImGuiButtonFlags.FlattenChildren) + local pressed, hovered, held = ImGui.ButtonBehavior(r, unhide_id, 2048 --[[ImGuiButtonFlags.FlattenChildren]]) if pressed then node.WantHiddenTabBarToggle = true elseif held and ImGui.IsMouseDragging(0) then @@ -10697,24 +10731,24 @@ local function RenderWindowDecorations(window, title_bar_rect, title_bar_is_high end -- FIXME-DOCK: Ideally we'd use ImGuiCol.TitleBgActive/ImGuiCol.TitleBg here, but neither is guaranteed to be visible enough at this sort of size.. - local col = ImGui.GetColorU32(((held and hovered) or (node.IsFocused and not hovered)) and ImGuiCol.ButtonActive or (hovered and ImGuiCol.ButtonHovered or ImGuiCol.Button)) + local col = ImGui.GetColorU32(((held and hovered) or (node.IsFocused and not hovered)) and 24 --[[ImGuiCol.ButtonActive]] or (hovered and 23 --[[ImGuiCol.ButtonHovered]] or 22 --[[ImGuiCol.Button]])) window.DrawList:AddTriangleFilled(p, p + ImVec2(unhide_sz_draw, 0.0), p + ImVec2(0.0, unhide_sz_draw), col) end -- Scrollbars if window.ScrollbarX then - ImGui.Scrollbar(ImGuiAxis.X) + ImGui.Scrollbar(1 --[[ImGuiAxis.X]]) end if window.ScrollbarY then - ImGui.Scrollbar(ImGuiAxis.Y) + ImGui.Scrollbar(2 --[[ImGuiAxis.Y]]) end -- Render resize grips (after their input handling so we don't have a frame of latency) - if handle_borders_and_resize_grips and (bit32.band(flags, ImGuiWindowFlags.NoResize) == 0) then + if handle_borders_and_resize_grips and (bit32.band(flags, 2 --[[ImGuiWindowFlags.NoResize]]) == 0) then for resize_grip_n = 1, #ImGuiResizeGripDef do repeat local col = resize_grip_col[resize_grip_n] - if bit32.band(col, IM_COL32_A_MASK) == 0 then + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then break end @@ -10736,7 +10770,7 @@ local function RenderWindowDecorations(window, title_bar_rect, title_bar_is_high end end - window.DC.NavLayerCurrent = ImGuiNavLayer.Main + window.DC.NavLayerCurrent = 0 --[[ImGuiNavLayer.Main]] end ImGui.RenderWindowOuterBorders = RenderWindowOuterBorders @@ -10754,13 +10788,13 @@ local function RenderWindowTitleBarContents(window, title_bar_rect, name, open) local flags = window.Flags local has_close_button = (open ~= nil) - local has_collapse_button = bit32.band(flags, ImGuiWindowFlags.NoCollapse) == 0 and (style.WindowMenuButtonPosition ~= ImGuiDir.None) + local has_collapse_button = bit32.band(flags, 32 --[[ImGuiWindowFlags.NoCollapse]]) == 0 and (style.WindowMenuButtonPosition ~= (-1) --[[ImGuiDir.None]]) -- Close & Collapse button are on the Menu NavLayer and don't default focus (unless there's nothing else on that layer) -- FIXME-NAV: Might want (or not?) to set the equivalent of ImGuiButtonFlags.NoNavFocus so that mouse clicks on standard title bar items don't necessarily set nav/keyboard ref? local item_flags_backup = g.CurrentItemFlags - g.CurrentItemFlags = bit32.bor(g.CurrentItemFlags, ImGuiItemFlags.NoNavDefaultFocus) - window.DC.NavLayerCurrent = ImGuiNavLayer.Menu + g.CurrentItemFlags = bit32.bor(g.CurrentItemFlags, 4 --[[ImGuiItemFlags.NoNavDefaultFocus]]) + window.DC.NavLayerCurrent = 1 --[[ImGuiNavLayer.Menu]] -- Layout buttons -- FIXME: Would be nice to generalize the subtleties expressed here into reusable code. @@ -10773,11 +10807,11 @@ local function RenderWindowTitleBarContents(window, title_bar_rect, name, open) close_button_pos = ImVec2(title_bar_rect.Max.x - pad_r - button_sz, title_bar_rect.Min.y + style.FramePadding.y) pad_r = pad_r + button_sz + style.ItemInnerSpacing.x end - if has_collapse_button and style.WindowMenuButtonPosition == ImGuiDir.Right then + if has_collapse_button and style.WindowMenuButtonPosition == 1 --[[ImGuiDir.Right]] then collapse_button_pos = ImVec2(title_bar_rect.Max.x - pad_r - button_sz, title_bar_rect.Min.y + style.FramePadding.y) pad_r = pad_r + button_sz + style.ItemInnerSpacing.x end - if has_collapse_button and style.WindowMenuButtonPosition == ImGuiDir.Left then + if has_collapse_button and style.WindowMenuButtonPosition == 0 --[[ImGuiDir.Left]] then collapse_button_pos = ImVec2(title_bar_rect.Min.x + pad_l, title_bar_rect.Min.y + style.FramePadding.y) pad_l = pad_l + button_sz + style.ItemInnerSpacing.x end @@ -10792,19 +10826,19 @@ local function RenderWindowTitleBarContents(window, title_bar_rect, name, open) -- Close button if has_close_button then local backup_item_flags = g.CurrentItemFlags - g.CurrentItemFlags = bit32.bor(g.CurrentItemFlags, ImGuiItemFlags.NoFocus) + g.CurrentItemFlags = bit32.bor(g.CurrentItemFlags, 131072 --[[ImGuiItemFlags.NoFocus]]) if ImGui.CloseButton(window:GetID("#CLOSE"), close_button_pos) then open = false end g.CurrentItemFlags = backup_item_flags end - window.DC.NavLayerCurrent = ImGuiNavLayer.Main + window.DC.NavLayerCurrent = 0 --[[ImGuiNavLayer.Main]] g.CurrentItemFlags = item_flags_backup -- Title bar text (with: horizontal alignment, avoiding collapse/close button, optional "unsaved document" marker) -- FIXME: Refactor text alignment facilities along with RenderText helpers, this is WAY too much messy code.. - local marker_size_x = (bit32.band(flags, ImGuiWindowFlags.UnsavedDocument) ~= 0) and (button_sz * 0.80) or 0.0 + local marker_size_x = (bit32.band(flags, 262144 --[[ImGuiWindowFlags.UnsavedDocument]]) ~= 0) and (button_sz * 0.80) or 0.0 local text_size = ImGui.CalcTextSize(name, nil, true) + ImVec2(marker_size_x, 0.0) -- As a nice touch we try to ensure that centered title text doesn't get affected by visibility of Close/Collapse button, @@ -10825,12 +10859,12 @@ local function RenderWindowTitleBarContents(window, title_bar_rect, name, open) local layout_r = ImRect(title_bar_rect.Min.x + pad_l, title_bar_rect.Min.y, title_bar_rect.Max.x - pad_r, title_bar_rect.Max.y) local clip_r = ImRect(layout_r.Min.x, layout_r.Min.y, ImMin(layout_r.Max.x + g.Style.ItemInnerSpacing.x, title_bar_rect.Max.x), layout_r.Max.y) - if bit32.band(flags, ImGuiWindowFlags.UnsavedDocument) ~= 0 then + if bit32.band(flags, 262144 --[[ImGuiWindowFlags.UnsavedDocument]]) ~= 0 then local marker_pos = ImVec2() marker_pos.x = ImClamp(layout_r.Min.x + (layout_r:GetWidth() - text_size.x) * style.WindowTitleAlign.x + text_size.x, layout_r.Min.x, layout_r.Max.x) marker_pos.y = (layout_r.Min.y + layout_r.Max.y) * 0.5 if marker_pos.x > layout_r.Min.x then - ImGui.RenderBullet(window.DrawList, marker_pos, ImGui.GetColorU32(ImGuiCol.UnsavedMarker)) + ImGui.RenderBullet(window.DrawList, marker_pos, ImGui.GetColorU32(58 --[[ImGuiCol.UnsavedMarker]])) clip_r.Max.x = ImMin(clip_r.Max.x, marker_pos.x - math.floor(marker_size_x * 0.5)) end end @@ -10852,21 +10886,21 @@ function ImGui.UpdateWindowParentAndRootLinks(window, flags, parent_window) window.RootWindowForTitleBarHighlight = window window.RootWindowForNav = window - if parent_window and (bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0) and (bit32.band(flags, ImGuiWindowFlags.Tooltip) == 0) then + if parent_window and (bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0) and (bit32.band(flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) == 0) then window.RootWindowDockTree = parent_window.RootWindowDockTree - if not window.DockIsActive and (bit32.band(parent_window.Flags, ImGuiWindowFlags.DockNodeHost) == 0) then + if not window.DockIsActive and (bit32.band(parent_window.Flags, 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) == 0) then window.RootWindow = parent_window.RootWindow end end - if parent_window and (bit32.band(flags, ImGuiWindowFlags.Popup) ~= 0) then + if parent_window and (bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0) then window.RootWindowPopupTree = parent_window.RootWindowPopupTree end - if parent_window and (bit32.band(flags, ImGuiWindowFlags.Modal) == 0) and (bit32.band(flags, bit32.bor(ImGuiWindowFlags.ChildWindow, ImGuiWindowFlags.Popup, ImGuiWindowFlags.Tooltip)) ~= 0) then -- FIXME: simply use _NoTitleBar ? + if parent_window and (bit32.band(flags, 134217728 --[[ImGuiWindowFlags.Modal]]) == 0) and (bit32.band(flags, bit32.bor(16777216 --[[ImGuiWindowFlags.ChildWindow]], 67108864 --[[ImGuiWindowFlags.Popup]], 33554432 --[[ImGuiWindowFlags.Tooltip]])) ~= 0) then -- FIXME: simply use _NoTitleBar ? window.RootWindowForTitleBarHighlight = parent_window.RootWindowForTitleBarHighlight end - while bit32.band(window.RootWindowForNav.ChildFlags, ImGuiChildFlags.NavFlattened) ~= 0 do - IM_ASSERT(window.RootWindowForNav.ParentWindow ~= nil) + while bit32.band(window.RootWindowForNav.ChildFlags, 256 --[[ImGuiChildFlags.NavFlattened]]) ~= 0 do + assert(window.RootWindowForNav.ParentWindow ~= nil) window.RootWindowForNav = window.RootWindowForNav.ParentWindow end end @@ -10878,11 +10912,11 @@ function ImGui.UpdateWindowSkipRefresh(window) local g = GImGui window.SkipRefresh = false - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasRefreshPolicy) == 0 then + if bit32.band(g.NextWindowData.HasFlags, 1024 --[[ImGuiNextWindowDataFlags.HasRefreshPolicy]]) == 0 then return end - if bit32.band(g.NextWindowData.RefreshFlagsVal, ImGuiWindowRefreshFlags.TryToAvoidRefresh) ~= 0 then + if bit32.band(g.NextWindowData.RefreshFlagsVal, 1 --[[ImGuiWindowRefreshFlags.TryToAvoidRefresh]]) ~= 0 then -- [Port] SetNextWindowCached(): refresh on any change since the last refresh (and one frame after being busy) if g.NextWindowData.CacheKeySet then local function related(w) return w ~= nil and (w.RootWindow == window.RootWindow or ImGui.IsWindowWithinBeginStackOf(w.RootWindow, window)) end @@ -10890,7 +10924,7 @@ function ImGui.UpdateWindowSkipRefresh(window) local c, key, ds, tex = window.CacheSnap, g.NextWindowData.CacheKeyVal, g.IO.DisplaySize, g.IO.Fonts.TexData if busy or c == nil or c.Busy or c.Key ~= key or c.Tex ~= tex or c.Collapsed ~= window.Collapsed or c.PosX ~= window.Pos.x or c.PosY ~= window.Pos.y or c.SizeX ~= window.SizeFull.x or c.SizeY ~= window.SizeFull.y - or c.ScrollX ~= window.Scroll.x or c.ScrollY ~= window.Scroll.y or window.ScrollTarget.x < FLT_MAX or window.ScrollTarget.y < FLT_MAX + or c.ScrollX ~= window.Scroll.x or c.ScrollY ~= window.Scroll.y or window.ScrollTarget.x < 3.4028234663853e+38 --[[FLT_MAX]] or window.ScrollTarget.y < 3.4028234663853e+38 --[[FLT_MAX]] or c.DisplayX ~= ds.x or c.DisplayY ~= ds.y then c = c or {} window.CacheSnap = c @@ -10910,12 +10944,12 @@ function ImGui.UpdateWindowSkipRefresh(window) if window.Hidden then -- If was hidden (previous frame) return end - if bit32.band(g.NextWindowData.RefreshFlagsVal, ImGuiWindowRefreshFlags.RefreshOnHover) ~= 0 and g.HoveredWindow then + if bit32.band(g.NextWindowData.RefreshFlagsVal, 2 --[[ImGuiWindowRefreshFlags.RefreshOnHover]]) ~= 0 and g.HoveredWindow then if window.RootWindow == g.HoveredWindow.RootWindow or ImGui.IsWindowWithinBeginStackOf(g.HoveredWindow.RootWindow, window) then return end end - if bit32.band(g.NextWindowData.RefreshFlagsVal, ImGuiWindowRefreshFlags.RefreshOnFocus) ~= 0 and g.NavWindow then + if bit32.band(g.NextWindowData.RefreshFlagsVal, 4 --[[ImGuiWindowRefreshFlags.RefreshOnFocus]]) ~= 0 and g.NavWindow then if window.RootWindow == g.NavWindow.RootWindow or ImGui.IsWindowWithinBeginStackOf(g.NavWindow.RootWindow, window) then return end @@ -10945,7 +10979,7 @@ local function SetCurrentWindow(window) g.CurrentTable = (window and window.DC.CurrentTableIdx ~= -1) and g.Tables:GetByIndex(window.DC.CurrentTableIdx) or nil if window then - if bit32.band(g.IO.BackendFlags, ImGuiBackendFlags.RendererHasTextures) ~= 0 then + if bit32.band(g.IO.BackendFlags, 16 --[[ImGuiBackendFlags.RendererHasTextures]]) ~= 0 then local viewport = window.Viewport g.FontRasterizerDensity = (viewport.FramebufferScale.x ~= 0.0) and viewport.FramebufferScale.x or g.IO.DisplayFramebufferScale.x end @@ -11021,9 +11055,9 @@ function ImGui.SetWindowPos(window, pos, cond) return end - IM_ASSERT(cond == 0 or ImIsPowerOfTwo(cond)) -- Make sure the user doesn't attempt to combine multiple condition flags. - window.SetWindowPosAllowFlags = bit32.band(window.SetWindowPosAllowFlags, bit32.bnot(bit32.bor(ImGuiCond.Once, ImGuiCond.FirstUseEver, ImGuiCond.Appearing))) - ImVec2_Copy(window.SetWindowPosVal, ImVec2(FLT_MAX, FLT_MAX)) + assert(cond == 0 or ImIsPowerOfTwo(cond)) -- Make sure the user doesn't attempt to combine multiple condition flags. + window.SetWindowPosAllowFlags = bit32.band(window.SetWindowPosAllowFlags, bit32.bnot(bit32.bor(2 --[[ImGuiCond.Once]], 4 --[[ImGuiCond.FirstUseEver]], 8 --[[ImGuiCond.Appearing]]))) + ImVec2_Copy(window.SetWindowPosVal, ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]])) -- Set local old_pos = ImVec2() @@ -11063,14 +11097,14 @@ function ImGui.SetWindowSize(window, size, cond) return end - IM_ASSERT(cond == 0 or ImIsPowerOfTwo(cond)) -- Make sure the user doesn't attempt to combine multiple condition flags. - window.SetWindowSizeAllowFlags = bit32.band(window.SetWindowSizeAllowFlags, bit32.bnot(bit32.bor(ImGuiCond.Once, ImGuiCond.FirstUseEver, ImGuiCond.Appearing))) + assert(cond == 0 or ImIsPowerOfTwo(cond)) -- Make sure the user doesn't attempt to combine multiple condition flags. + window.SetWindowSizeAllowFlags = bit32.band(window.SetWindowSizeAllowFlags, bit32.bnot(bit32.bor(2 --[[ImGuiCond.Once]], 4 --[[ImGuiCond.FirstUseEver]], 8 --[[ImGuiCond.Appearing]]))) -- Enable auto-fit (not done in BeginChild() path unless appearing or combined with ImGuiChildFlags.AlwaysAutoResize) - if bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) == 0 or window.Appearing or bit32.band(window.ChildFlags, ImGuiChildFlags.AlwaysAutoResize) ~= 0 then + if bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0 or window.Appearing or bit32.band(window.ChildFlags, 64 --[[ImGuiChildFlags.AlwaysAutoResize]]) ~= 0 then window.AutoFitFramesX = (size.x <= 0.0) and 2 or 0 end - if bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) == 0 or window.Appearing or bit32.band(window.ChildFlags, ImGuiChildFlags.AlwaysAutoResize) ~= 0 then + if bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0 or window.Appearing or bit32.band(window.ChildFlags, 64 --[[ImGuiChildFlags.AlwaysAutoResize]]) ~= 0 then window.AutoFitFramesY = (size.y <= 0.0) and 2 or 0 end @@ -11105,7 +11139,7 @@ function ImGui.SetWindowCollapsed(window, collapsed, cond) if cond ~= 0 and bit32.band(window.SetWindowCollapsedAllowFlags, cond) == 0 then return end - window.SetWindowCollapsedAllowFlags = bit32.band(window.SetWindowCollapsedAllowFlags, bit32.bnot(bit32.bor(ImGuiCond.Once, ImGuiCond.FirstUseEver, ImGuiCond.Appearing))) + window.SetWindowCollapsedAllowFlags = bit32.band(window.SetWindowCollapsedAllowFlags, bit32.bnot(bit32.bor(2 --[[ImGuiCond.Once]], 4 --[[ImGuiCond.FirstUseEver]], 8 --[[ImGuiCond.Appearing]]))) -- Queue applying in Begin() if window.WantCollapseToggle then @@ -11118,7 +11152,7 @@ end --- @param pos ImVec2 --- @param size ImVec2 function ImGui.SetWindowHitTestHole(window, pos, size) - IM_ASSERT(window.HitTestHoleSize.x == 0) -- We don't support multiple holes/hit test filters + assert(window.HitTestHoleSize.x == 0) -- We don't support multiple holes/hit test filters window.HitTestHoleSize = ImVec2(math.floor(size.x), math.floor(size.y)) window.HitTestHoleOffset = ImVec2(math.floor(pos.x - window.Pos.x), math.floor(pos.y - window.Pos.y)) end @@ -11178,12 +11212,12 @@ function ImGui.SetNextWindowPos(pos, cond, pivot) if pivot == nil then pivot = ImVec2(0, 0) end local g = GImGui - IM_ASSERT(cond == 0 or ImIsPowerOfTwo(cond)) -- Make sure the user doesn't attempt to combine multiple condition flags. + assert(cond == 0 or ImIsPowerOfTwo(cond)) -- Make sure the user doesn't attempt to combine multiple condition flags. - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasPos) + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 1 --[[ImGuiNextWindowDataFlags.HasPos]]) ImVec2_Copy(g.NextWindowData.PosVal, pos) ImVec2_Copy(g.NextWindowData.PosPivotVal, pivot) - g.NextWindowData.PosCond = (cond ~= 0) and cond or ImGuiCond.Always + g.NextWindowData.PosCond = (cond ~= 0) and cond or 1 --[[ImGuiCond.Always]] g.NextWindowData.PosUndock = true end @@ -11193,11 +11227,11 @@ function ImGui.SetNextWindowSize(size, cond) if cond == nil then cond = 0 end local g = GImGui - IM_ASSERT(cond == 0 or ImIsPowerOfTwo(cond)) -- Make sure the user doesn't attempt to combine multiple condition flags. + assert(cond == 0 or ImIsPowerOfTwo(cond)) -- Make sure the user doesn't attempt to combine multiple condition flags. - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasSize) + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 2 --[[ImGuiNextWindowDataFlags.HasSize]]) ImVec2_Copy(g.NextWindowData.SizeVal, size) - g.NextWindowData.SizeCond = (cond ~= 0) and cond or ImGuiCond.Always + g.NextWindowData.SizeCond = (cond ~= 0) and cond or 1 --[[ImGuiCond.Always]] end -- For each axis: @@ -11210,7 +11244,7 @@ end --- @param custom_callback_user_data? any function ImGui.SetNextWindowSizeConstraints(size_min, size_max, custom_callback, custom_callback_user_data) local g = GImGui - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasSizeConstraint) + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 16 --[[ImGuiNextWindowDataFlags.HasSizeConstraint]]) g.NextWindowData.SizeConstraintRect = ImRect(size_min, size_max) g.NextWindowData.SizeCallback = custom_callback g.NextWindowData.SizeCallbackUserData = custom_callback_user_data @@ -11219,7 +11253,7 @@ end --- @param alpha float function ImGui.SetNextWindowBgAlpha(alpha) local g = GImGui - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasBgAlpha) + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 64 --[[ImGuiNextWindowDataFlags.HasBgAlpha]]) g.NextWindowData.BgAlphaVal = alpha end @@ -11248,8 +11282,8 @@ end -- FIXME: It might be undesirable that this will likely disable KeyOwner-aware shortcuts systems. Consider a more fine-tuned version if needed? function ImGui.SetActiveIdUsingAllKeyboardKeys() local g = GImGui - IM_ASSERT(g.ActiveId ~= 0) - g.ActiveIdUsingNavDirMask = (bit32.lshift(1, ImGuiDir.COUNT) - 1) + assert(g.ActiveId ~= 0) + g.ActiveIdUsingNavDirMask = (bit32.lshift(1, 4 --[[ImGuiDir.COUNT]]) - 1) g.ActiveIdUsingAllKeyboardKeys = true ImGui.NavMoveRequestCancel() end @@ -11274,69 +11308,69 @@ end function ImGui.BeginChildEx(name, id, size_arg, child_flags, window_flags) local g = GImGui local parent_window = g.CurrentWindow - IM_ASSERT(id ~= 0) + assert(id ~= 0) if child_flags == nil then child_flags = 0 end if window_flags == nil then window_flags = 0 end if size_arg == nil then size_arg = ImVec2(0, 0) end - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasChildFlags) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 512 --[[ImGuiNextWindowDataFlags.HasChildFlags]]) ~= 0 then child_flags = bit32.band(bit32.bor(child_flags, g.NextWindowData.ChildFlagsSet), bit32.bnot(g.NextWindowData.ChildFlagsClear)) end -- Sanity check as it is likely that some user will accidentally pass ImGuiWindowFlags into the ImGuiChildFlags argument. - local ImGuiChildFlags_SupportedMask_ = bit32.bor(ImGuiChildFlags.Borders, ImGuiChildFlags.AlwaysUseWindowPadding, ImGuiChildFlags.ResizeX, ImGuiChildFlags.ResizeY, ImGuiChildFlags.AutoResizeX, ImGuiChildFlags.AutoResizeY, ImGuiChildFlags.AlwaysAutoResize, ImGuiChildFlags.FrameStyle, ImGuiChildFlags.NavFlattened) + local ImGuiChildFlags_SupportedMask_ = bit32.bor(1 --[[ImGuiChildFlags.Borders]], 2 --[[ImGuiChildFlags.AlwaysUseWindowPadding]], 4 --[[ImGuiChildFlags.ResizeX]], 8 --[[ImGuiChildFlags.ResizeY]], 16 --[[ImGuiChildFlags.AutoResizeX]], 32 --[[ImGuiChildFlags.AutoResizeY]], 64 --[[ImGuiChildFlags.AlwaysAutoResize]], 128 --[[ImGuiChildFlags.FrameStyle]], 256 --[[ImGuiChildFlags.NavFlattened]]) -- IM_UNUSED(ImGuiChildFlags_SupportedMask_) - IM_ASSERT(bit32.band(child_flags, bit32.bnot(ImGuiChildFlags_SupportedMask_)) == 0, "Illegal ImGuiChildFlags value. Did you pass ImGuiWindowFlags values instead of ImGuiChildFlags?") - IM_ASSERT(bit32.band(window_flags, ImGuiWindowFlags.AlwaysAutoResize) == 0, "Cannot specify ImGuiWindowFlags.AlwaysAutoResize for BeginChild(). Use ImGuiChildFlags.AlwaysAutoResize!") - if bit32.band(child_flags, ImGuiChildFlags.AlwaysAutoResize) ~= 0 then - IM_ASSERT(bit32.band(child_flags, bit32.bor(ImGuiChildFlags.ResizeX, ImGuiChildFlags.ResizeY)) == 0, "Cannot use ImGuiChildFlags.ResizeX or ImGuiChildFlags.ResizeY with ImGuiChildFlags.AlwaysAutoResize!") - IM_ASSERT(bit32.band(child_flags, bit32.bor(ImGuiChildFlags.AutoResizeX, ImGuiChildFlags.AutoResizeY)) ~= 0, "Must use ImGuiChildFlags.AutoResizeX or ImGuiChildFlags.AutoResizeY with ImGuiChildFlags.AlwaysAutoResize!") + assert(bit32.band(child_flags, bit32.bnot(ImGuiChildFlags_SupportedMask_)) == 0, "Illegal ImGuiChildFlags value. Did you pass ImGuiWindowFlags values instead of ImGuiChildFlags?") + assert(bit32.band(window_flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) == 0, "Cannot specify ImGuiWindowFlags.AlwaysAutoResize for BeginChild(). Use ImGuiChildFlags.AlwaysAutoResize!") + if bit32.band(child_flags, 64 --[[ImGuiChildFlags.AlwaysAutoResize]]) ~= 0 then + assert(bit32.band(child_flags, bit32.bor(4 --[[ImGuiChildFlags.ResizeX]], 8 --[[ImGuiChildFlags.ResizeY]])) == 0, "Cannot use ImGuiChildFlags.ResizeX or ImGuiChildFlags.ResizeY with ImGuiChildFlags.AlwaysAutoResize!") + assert(bit32.band(child_flags, bit32.bor(16 --[[ImGuiChildFlags.AutoResizeX]], 32 --[[ImGuiChildFlags.AutoResizeY]])) ~= 0, "Must use ImGuiChildFlags.AutoResizeX or ImGuiChildFlags.AutoResizeY with ImGuiChildFlags.AlwaysAutoResize!") end - if bit32.band(child_flags, ImGuiChildFlags.AutoResizeX) ~= 0 then - child_flags = bit32.band(child_flags, bit32.bnot(ImGuiChildFlags.ResizeX)) + if bit32.band(child_flags, 16 --[[ImGuiChildFlags.AutoResizeX]]) ~= 0 then + child_flags = bit32.band(child_flags, bit32.bnot(4 --[[ImGuiChildFlags.ResizeX]])) end - if bit32.band(child_flags, ImGuiChildFlags.AutoResizeY) ~= 0 then - child_flags = bit32.band(child_flags, bit32.bnot(ImGuiChildFlags.ResizeY)) + if bit32.band(child_flags, 32 --[[ImGuiChildFlags.AutoResizeY]]) ~= 0 then + child_flags = bit32.band(child_flags, bit32.bnot(8 --[[ImGuiChildFlags.ResizeY]])) end -- Set window flags - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.ChildWindow, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoDocking) - window_flags = bit32.bor(window_flags, bit32.band(parent_window.Flags, ImGuiWindowFlags.NoMove)) -- Inherit the NoMove flag - if bit32.band(child_flags, bit32.bor(ImGuiChildFlags.AutoResizeX, ImGuiChildFlags.AutoResizeY, ImGuiChildFlags.AlwaysAutoResize)) ~= 0 then - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.AlwaysAutoResize) -- FIXME: Would be sane to not make single-axis flag set this. (#9355) + window_flags = bit32.bor(window_flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]], 1 --[[ImGuiWindowFlags.NoTitleBar]], 524288 --[[ImGuiWindowFlags.NoDocking]]) + window_flags = bit32.bor(window_flags, bit32.band(parent_window.Flags, 4 --[[ImGuiWindowFlags.NoMove]])) -- Inherit the NoMove flag + if bit32.band(child_flags, bit32.bor(16 --[[ImGuiChildFlags.AutoResizeX]], 32 --[[ImGuiChildFlags.AutoResizeY]], 64 --[[ImGuiChildFlags.AlwaysAutoResize]])) ~= 0 then + window_flags = bit32.bor(window_flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) -- FIXME: Would be sane to not make single-axis flag set this. (#9355) end - if bit32.band(child_flags, bit32.bor(ImGuiChildFlags.ResizeX, ImGuiChildFlags.ResizeY)) == 0 then - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.NoResize, ImGuiWindowFlags.NoSavedSettings) + if bit32.band(child_flags, bit32.bor(4 --[[ImGuiChildFlags.ResizeX]], 8 --[[ImGuiChildFlags.ResizeY]])) == 0 then + window_flags = bit32.bor(window_flags, 2 --[[ImGuiWindowFlags.NoResize]], 256 --[[ImGuiWindowFlags.NoSavedSettings]]) end -- Special framed style - if bit32.band(child_flags, ImGuiChildFlags.FrameStyle) ~= 0 then - ImGui.PushStyleColor(ImGuiCol.ChildBg, g.Style.Colors[ImGuiCol.FrameBg]) - ImGui.PushStyleVar(ImGuiStyleVar.ChildRounding, g.Style.FrameRounding) - ImGui.PushStyleVar(ImGuiStyleVar.ChildBorderSize, g.Style.FrameBorderSize) - ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, g.Style.FramePadding) - child_flags = bit32.bor(child_flags, ImGuiChildFlags.Borders, ImGuiChildFlags.AlwaysUseWindowPadding) - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.NoMove) + if bit32.band(child_flags, 128 --[[ImGuiChildFlags.FrameStyle]]) ~= 0 then + ImGui.PushStyleColor(3 --[[ImGuiCol.ChildBg]], g.Style.Colors[7 --[[ImGuiCol.FrameBg]]]) + ImGui.PushStyleVar(7 --[[ImGuiStyleVar.ChildRounding]], g.Style.FrameRounding) + ImGui.PushStyleVar(8 --[[ImGuiStyleVar.ChildBorderSize]], g.Style.FrameBorderSize) + ImGui.PushStyleVar(2 --[[ImGuiStyleVar.WindowPadding]], g.Style.FramePadding) + child_flags = bit32.bor(child_flags, 1 --[[ImGuiChildFlags.Borders]], 2 --[[ImGuiChildFlags.AlwaysUseWindowPadding]]) + window_flags = bit32.bor(window_flags, 4 --[[ImGuiWindowFlags.NoMove]]) end -- Forward size -- Important: Begin() has special processing to switch condition to ImGuiCond.FirstUseEver for a given axis when ImGuiChildFlags.ResizeXXX is set. -- (the alternative would to store conditional flags per axis, which is possible but more code) local size_avail = ImGui.GetContentRegionAvail() - local size_default = ImVec2((bit32.band(child_flags, ImGuiChildFlags.AutoResizeX) ~= 0) and 0.0 or size_avail.x, (bit32.band(child_flags, ImGuiChildFlags.AutoResizeY) ~= 0) and 0.0 or size_avail.y) + local size_default = ImVec2((bit32.band(child_flags, 16 --[[ImGuiChildFlags.AutoResizeX]]) ~= 0) and 0.0 or size_avail.x, (bit32.band(child_flags, 32 --[[ImGuiChildFlags.AutoResizeY]]) ~= 0) and 0.0 or size_avail.y) local size = ImGui.CalcItemSize(size_arg, size_default.x, size_default.y) -- A SetNextWindowSize() call always has priority (#8020) -- (since the code in Begin() never supported SizeVal==0.0 aka auto-resize via SetNextWindowSize() call, we don't support it here for now) -- FIXME: We only support ImGuiCond.Always in this path. Supporting other paths would requires to obtain window pointer. - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasSize) ~= 0 and bit32.band(g.NextWindowData.SizeCond, ImGuiCond.Always) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 2 --[[ImGuiNextWindowDataFlags.HasSize]]) ~= 0 and bit32.band(g.NextWindowData.SizeCond, 1 --[[ImGuiCond.Always]]) ~= 0 then if g.NextWindowData.SizeVal.x > 0.0 then size.x = g.NextWindowData.SizeVal.x - child_flags = bit32.band(child_flags, bit32.bnot(ImGuiChildFlags.ResizeX)) + child_flags = bit32.band(child_flags, bit32.bnot(4 --[[ImGuiChildFlags.ResizeX]])) end if g.NextWindowData.SizeVal.y > 0.0 then size.y = g.NextWindowData.SizeVal.y - child_flags = bit32.band(child_flags, bit32.bnot(ImGuiChildFlags.ResizeY)) + child_flags = bit32.band(child_flags, bit32.bnot(8 --[[ImGuiChildFlags.ResizeY]])) end end ImGui.SetNextWindowSize(size) @@ -11357,7 +11391,7 @@ function ImGui.BeginChildEx(name, id, size_arg, child_flags, window_flags) -- Set style local backup_border_size = g.Style.ChildBorderSize - if bit32.band(child_flags, ImGuiChildFlags.Borders) == 0 then + if bit32.band(child_flags, 1 --[[ImGuiChildFlags.Borders]]) == 0 then g.Style.ChildBorderSize = 0.0 end @@ -11367,7 +11401,7 @@ function ImGui.BeginChildEx(name, id, size_arg, child_flags, window_flags) -- Restore style g.Style.ChildBorderSize = backup_border_size - if bit32.band(child_flags, ImGuiChildFlags.FrameStyle) ~= 0 then + if bit32.band(child_flags, 128 --[[ImGuiChildFlags.FrameStyle]]) ~= 0 then ImGui.PopStyleVar(3) ImGui.PopStyleColor() end @@ -11387,7 +11421,7 @@ function ImGui.BeginChildEx(name, id, size_arg, child_flags, window_flags) if g.ActiveId == temp_id_for_activation then ImGui.ClearActiveID() end - if g.NavActivateId == id and bit32.band(child_flags, ImGuiChildFlags.NavFlattened) == 0 and (child_window.DC.NavLayersActiveMask ~= 0 or child_window.DC.NavWindowHasScrollY) then + if g.NavActivateId == id and bit32.band(child_flags, 256 --[[ImGuiChildFlags.NavFlattened]]) == 0 and (child_window.DC.NavLayersActiveMask ~= 0 or child_window.DC.NavWindowHasScrollY) then ImGui.FocusWindow(child_window) ImGui.NavInitWindow(child_window, false) ImGui.SetActiveID(temp_id_for_activation, child_window) -- Steal ActiveId with another arbitrary id so that key-press won't activate child item @@ -11406,7 +11440,7 @@ end --- @param window_flags? ImGuiWindowFlags --- @return bool # visible (always call EndChild()!) function ImGui.BeginChild(str_id_or_id, size_arg, child_flags, window_flags) - if child_flags == true then child_flags = ImGuiChildFlags.Borders elseif not child_flags then child_flags = 0 end + if child_flags == true then child_flags = 1 --[[ImGuiChildFlags.Borders]] elseif not child_flags then child_flags = 0 end if type(str_id_or_id) == "number" then return ImGui.BeginChildEx(nil, str_id_or_id, size_arg, child_flags, window_flags) end @@ -11426,7 +11460,7 @@ function ImGui.EndChild() local child_window = g.CurrentWindow local backup_within_end_child_id = g.WithinEndChildID - IM_ASSERT(bit32.band(child_window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0) -- Mismatched BeginChild()/EndChild() calls + assert(bit32.band(child_window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0) -- Mismatched BeginChild()/EndChild() calls g.WithinEndChildID = child_window.ID local child_size = ImVec2(child_window.Size.x, child_window.Size.y) @@ -11435,20 +11469,20 @@ function ImGui.EndChild() local parent_window = g.CurrentWindow local bb = ImRect(parent_window.DC.CursorPos, parent_window.DC.CursorPos + child_size) ImGui.ItemSize(child_size) - local nav_flattened = bit32.band(child_window.ChildFlags, ImGuiChildFlags.NavFlattened) ~= 0 + local nav_flattened = bit32.band(child_window.ChildFlags, 256 --[[ImGuiChildFlags.NavFlattened]]) ~= 0 if (child_window.DC.NavLayersActiveMask ~= 0 or child_window.DC.NavWindowHasScrollY) and not nav_flattened then ImGui.ItemAdd(bb, child_window.ChildId) ImGui.RenderNavCursor(bb, child_window.ChildId) -- When browsing a window that has no activable items (scroll only) we keep a highlight on the child (pass g.NavId to trick into always displaying) if child_window.DC.NavLayersActiveMask == 0 and child_window == g.NavWindow then - ImGui.RenderNavCursor(ImRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2)), g.NavId, ImGuiNavRenderCursorFlags.Compact) + ImGui.RenderNavCursor(ImRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2)), g.NavId, 2 --[[ImGuiNavRenderCursorFlags.Compact]]) end else -- Not navigable into -- - This is a bit of a fringe use case, mostly useful for undecorated, non-scrolling contents childs, or empty childs. -- - We could later decide to not apply this path if ImGuiChildFlags.FrameStyle or ImGuiChildFlags.Borders is set. - ImGui.ItemAdd(bb, child_window.ChildId, nil, ImGuiItemFlags.NoNav) + ImGui.ItemAdd(bb, child_window.ChildId, nil, 2 --[[ImGuiItemFlags.NoNav]]) -- But when flattened we directly reach items, adjust active layer mask accordingly if nav_flattened then @@ -11456,7 +11490,7 @@ function ImGui.EndChild() end end if g.HoveredWindow == child_window then - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HoveredWindow) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 128 --[[ImGuiItemStatusFlags.HoveredWindow]]) end child_window.DC.ChildItemStatusFlags = g.LastItemData.StatusFlags -- SetLastItemDataForChildWindowItem(child_window, child_window:Rect()) -- Not needed, effectively done by ItemAdd() @@ -11465,7 +11499,7 @@ function ImGui.EndChild() end g.WithinEndChildID = backup_within_end_child_id - g.LogLinePosY = -FLT_MAX -- To enforce a carriage return + g.LogLinePosY = -3.4028234663853e+38 --[[FLT_MAX]] -- To enforce a carriage return end --- @param flags ImGuiChildFlags @@ -11473,7 +11507,7 @@ end function ImGui.SetNextWindowChildFlags(flags, enabled) local g = GImGui local nwd = g.NextWindowData - if bit32.band(nwd.HasFlags, ImGuiNextWindowDataFlags.HasChildFlags) == 0 then + if bit32.band(nwd.HasFlags, 512 --[[ImGuiNextWindowDataFlags.HasChildFlags]]) == 0 then nwd.ChildFlagsSet = 0; nwd.ChildFlagsClear = 0 end if enabled then @@ -11483,7 +11517,7 @@ function ImGui.SetNextWindowChildFlags(flags, enabled) nwd.ChildFlagsSet = bit32.band(nwd.ChildFlagsSet, bit32.bnot(flags)) nwd.ChildFlagsClear = bit32.bor(nwd.ChildFlagsClear, flags) end - nwd.HasFlags = bit32.bor(nwd.HasFlags, ImGuiNextWindowDataFlags.HasChildFlags) + nwd.HasFlags = bit32.bor(nwd.HasFlags, 512 --[[ImGuiNextWindowDataFlags.HasChildFlags]]) end --- @param flags ImGuiWindowFlags @@ -11491,7 +11525,7 @@ end function ImGui.SetNextWindowFlags(flags, enabled) local g = GImGui local nwd = g.NextWindowData - if bit32.band(nwd.HasFlags, ImGuiNextWindowDataFlags.HasWindowFlags) == 0 then + if bit32.band(nwd.HasFlags, 256 --[[ImGuiNextWindowDataFlags.HasWindowFlags]]) == 0 then nwd.WindowFlagsSet = 0; nwd.WindowFlagsClear = 0 end if enabled then @@ -11501,7 +11535,7 @@ function ImGui.SetNextWindowFlags(flags, enabled) nwd.WindowFlagsSet = bit32.band(nwd.WindowFlagsSet, bit32.bnot(flags)) nwd.WindowFlagsClear = bit32.bor(nwd.WindowFlagsClear, flags) end - nwd.HasFlags = bit32.bor(nwd.HasFlags, ImGuiNextWindowDataFlags.HasWindowFlags) + nwd.HasFlags = bit32.bor(nwd.HasFlags, 256 --[[ImGuiNextWindowDataFlags.HasWindowFlags]]) end -- Content size = inner scrollable rectangle, padded with WindowPadding. @@ -11509,14 +11543,14 @@ end --- @param size ImVec2 function ImGui.SetNextWindowContentSize(size) local g = GImGui - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasContentSize) + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 4 --[[ImGuiNextWindowDataFlags.HasContentSize]]) ImVec2_CopyV(g.NextWindowData.ContentSizeVal, ImTrunc(size.x), ImTrunc(size.y)) end --- @param scroll ImVec2 function ImGui.SetNextWindowScroll(scroll) local g = GImGui - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasScroll) + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 128 --[[ImGuiNextWindowDataFlags.HasScroll]]) ImVec2_Copy(g.NextWindowData.ScrollVal, scroll) end @@ -11525,28 +11559,28 @@ end function ImGui.SetNextWindowCollapsed(collapsed, cond) if cond == nil then cond = 0 end local g = GImGui - IM_ASSERT(cond == 0 or ImIsPowerOfTwo(cond)) -- Make sure the user doesn't attempt to combine multiple condition flags. - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasCollapsed) + assert(cond == 0 or ImIsPowerOfTwo(cond)) -- Make sure the user doesn't attempt to combine multiple condition flags. + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 8 --[[ImGuiNextWindowDataFlags.HasCollapsed]]) g.NextWindowData.CollapsedVal = collapsed - g.NextWindowData.CollapsedCond = (cond ~= 0) and cond or ImGuiCond.Always + g.NextWindowData.CollapsedCond = (cond ~= 0) and cond or 1 --[[ImGuiCond.Always]] end function ImGui.SetNextWindowFocus() local g = GImGui - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasFocus) + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 32 --[[ImGuiNextWindowDataFlags.HasFocus]]) end --- @param id ImGuiID function ImGui.SetNextWindowViewport(id) local g = GImGui - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasViewport) + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 2048 --[[ImGuiNextWindowDataFlags.HasViewport]]) g.NextWindowData.ViewportId = id end --- @param window_class ImGuiWindowClass function ImGui.SetNextWindowClass(window_class) local g = GImGui - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasWindowClass) + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 8192 --[[ImGuiNextWindowDataFlags.HasWindowClass]]) local wc = ImGuiWindowClass() for k, v in pairs(window_class) do wc[k] = v end -- C++ copies the struct g.NextWindowData.WindowClass = wc @@ -11556,7 +11590,7 @@ end --- @param flags ImGuiWindowRefreshFlags function ImGui.SetNextWindowRefreshPolicy(flags) local g = GImGui - g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasRefreshPolicy) + g.NextWindowData.HasFlags = bit32.bor(g.NextWindowData.HasFlags, 1024 --[[ImGuiNextWindowDataFlags.HasRefreshPolicy]]) g.NextWindowData.RefreshFlagsVal = flags g.NextWindowData.CacheKeySet = false end @@ -11569,7 +11603,7 @@ end -- Anything else that changes the contents (style, fonts, time) must be part of `key`. function ImGui.SetNextWindowCached(key) local g = GImGui - ImGui.SetNextWindowRefreshPolicy(bit32.bor(ImGuiWindowRefreshFlags.TryToAvoidRefresh, ImGuiWindowRefreshFlags.RefreshOnHover, ImGuiWindowRefreshFlags.RefreshOnFocus)) + ImGui.SetNextWindowRefreshPolicy(bit32.bor(1 --[[ImGuiWindowRefreshFlags.TryToAvoidRefresh]], 2 --[[ImGuiWindowRefreshFlags.RefreshOnHover]], 4 --[[ImGuiWindowRefreshFlags.RefreshOnFocus]])) g.NextWindowData.CacheKeySet = true g.NextWindowData.CacheKeyVal = key end @@ -11586,7 +11620,7 @@ end -- Prefer using PushFont(nil, style.FontSizeBase * factor), or use style.FontScaleMain to scale all windows. --- @param scale float function ImGui.SetWindowFontScale(scale) - IM_ASSERT(scale > 0.0) + assert(scale > 0.0) local window = ImGui.GetCurrentWindow() window.FontWindowScale = scale ImGui.UpdateCurrentFontSize(0.0) @@ -11608,11 +11642,11 @@ function ImGui.StartMouseMovingWindow(window) ImGui.SetActiveIdUsingAllKeyboardKeys() local can_move_window = true - if bit32.band(window.Flags, ImGuiWindowFlags.NoMove) ~= 0 or bit32.band(window.RootWindowDockTree.Flags, ImGuiWindowFlags.NoMove) ~= 0 then + if bit32.band(window.Flags, 4 --[[ImGuiWindowFlags.NoMove]]) ~= 0 or bit32.band(window.RootWindowDockTree.Flags, 4 --[[ImGuiWindowFlags.NoMove]]) ~= 0 then can_move_window = false end local node = window.DockNodeAsHost - if node and node.VisibleWindow and bit32.band(node.VisibleWindow.Flags, ImGuiWindowFlags.NoMove) ~= 0 then + if node and node.VisibleWindow and bit32.band(node.VisibleWindow.Flags, 4 --[[ImGuiWindowFlags.NoMove]]) ~= 0 then can_move_window = false end if can_move_window then @@ -11632,7 +11666,7 @@ function ImGui.UpdateMouseMovingWindowNewFrame() -- We actually want to move the root window. g.MovingWindow == window we clicked on (could be a child window). -- We track it to preserve Focus and so that generally ActiveIdWindow == MovingWindow and ActiveId == MovingWindow.MoveId for consistency. ImGui.KeepAliveID(g.ActiveId) - IM_ASSERT(g.MovingWindow and g.MovingWindow.RootWindowDockTree) + assert(g.MovingWindow and g.MovingWindow.RootWindowDockTree) local moving_window = g.MovingWindow.RootWindowDockTree @@ -11641,7 +11675,7 @@ function ImGui.UpdateMouseMovingWindowNewFrame() if g.IO.MouseDown[0] and ImGui.IsMousePosValid(g.IO.MousePos) and not window_disappeared then local pos = g.IO.MousePos - g.ActiveIdClickOffset if moving_window.Pos.x ~= pos.x or moving_window.Pos.y ~= pos.y then - ImGui.SetWindowPos(moving_window, pos, ImGuiCond.Always) + ImGui.SetWindowPos(moving_window, pos, 1 --[[ImGuiCond.Always]]) if moving_window.Viewport and moving_window.ViewportOwned then -- Synchronize viewport immediately because some overlays may relies on clipping rectangle before we Begin() into the window. ImVec2_Copy(moving_window.Viewport.Pos, pos) moving_window.Viewport:UpdateWorkRect() @@ -11676,20 +11710,20 @@ function ImGui.IsPopupOpen(id, popup_flags) if popup_flags == nil then popup_flags = 0 end if type(id) == "string" then -- str_id overload: with AnyPopupId the id must be 0, otherwise it is hashed with the current window's ID stack - id = (bit32.band(popup_flags, ImGuiPopupFlags.AnyPopupId) ~= 0) and 0 or g.CurrentWindow:GetID(id) + id = (bit32.band(popup_flags, 1024 --[[ImGuiPopupFlags.AnyPopupId]]) ~= 0) and 0 or g.CurrentWindow:GetID(id) end - if bit32.band(popup_flags, ImGuiPopupFlags.AnyPopupId) ~= 0 then + if bit32.band(popup_flags, 1024 --[[ImGuiPopupFlags.AnyPopupId]]) ~= 0 then -- Return true if any popup is open at the current BeginPopup() level of the popup stack -- This may be used to e.g. test for another popups already opened to handle popups priorities at the same level. - IM_ASSERT(id == 0) - if bit32.band(popup_flags, ImGuiPopupFlags.AnyPopupLevel) ~= 0 then + assert(id == 0) + if bit32.band(popup_flags, 2048 --[[ImGuiPopupFlags.AnyPopupLevel]]) ~= 0 then return g.OpenPopupStack.Size > 0 else return g.OpenPopupStack.Size > g.BeginPopupStack.Size end else - if bit32.band(popup_flags, ImGuiPopupFlags.AnyPopupLevel) ~= 0 then + if bit32.band(popup_flags, 2048 --[[ImGuiPopupFlags.AnyPopupLevel]]) ~= 0 then -- Return true if the popup is open anywhere in the popup stack for n = 1, g.OpenPopupStack.Size do if g.OpenPopupStack.Data[n].PopupId == id then @@ -11711,7 +11745,7 @@ function ImGui.GetTopMostPopupModal() for n = g.OpenPopupStack.Size, 1, -1 do local popup = g.OpenPopupStack.Data[n].Window if popup then - if bit32.band(popup.Flags, ImGuiWindowFlags.Modal) ~= 0 then + if bit32.band(popup.Flags, 134217728 --[[ImGuiWindowFlags.Modal]]) ~= 0 then return popup end end @@ -11738,7 +11772,7 @@ function ImGui.UpdateMouseMovingWindowEndFrame() -- Click on empty space to focus window and start moving -- (after we're done with all our widgets, so e.g. clicking on docking tab-bar which have set HoveredId already and not get us here!) - if ImGui.IsMouseClickedEx(0, ImGuiInputFlags.None, ImGuiKeyOwner_NoOwner) then + if ImGui.IsMouseClickedEx(0, 0 --[[ImGuiInputFlags.None]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) then -- Handle the edge case of a popup being closed while clicking in its empty space. -- If we try to focus it, FocusWindow() > ClosePopupsOverWindow() will accidentally close any parent popups because they are not linked together any more. local hovered_root @@ -11747,8 +11781,8 @@ function ImGui.UpdateMouseMovingWindowEndFrame() else hovered_root = nil end - local is_closed_popup = hovered_root and (bit32.band(hovered_root.Flags, ImGuiWindowFlags.Popup) ~= 0) and not ImGui.IsPopupOpen(hovered_root.PopupId, ImGuiPopupFlags.AnyPopupLevel) - local is_queued_focus_request = g.NavMoveSubmitted and (bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.FocusApi) ~= 0) + local is_closed_popup = hovered_root and (bit32.band(hovered_root.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0) and not ImGui.IsPopupOpen(hovered_root.PopupId, 2048 --[[ImGuiPopupFlags.AnyPopupLevel]]) + local is_queued_focus_request = g.NavMoveSubmitted and (bit32.band(g.NavMoveFlags, 512 --[[ImGuiNavMoveFlags.FocusApi]]) ~= 0) if hovered_window ~= nil and not is_closed_popup and not is_queued_focus_request then ImGui.StartMouseMovingWindow(hovered_window) @@ -11757,8 +11791,8 @@ function ImGui.UpdateMouseMovingWindowEndFrame() -- Please note how StartMouseMovingWindow() and StopMouseMovingWindow() and not entirely symmetrical, at the later doesn't clear ActiveId. -- Cancel moving if clicked outside of title bar - if bit32.band(hovered_window.BgClickFlags, ImGuiWindowBgClickFlags.Move) == 0 then -- set by io.ConfigWindowsMoveFromTitleBarOnly - if bit32.band(hovered_root.Flags, ImGuiWindowFlags.NoTitleBar) == 0 then + if bit32.band(hovered_window.BgClickFlags, 1 --[[ImGuiWindowBgClickFlags.Move]]) == 0 then -- set by io.ConfigWindowsMoveFromTitleBarOnly + if bit32.band(hovered_root.Flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) == 0 then if not hovered_root:TitleBarRect():Contains(g.IO.MouseClickedPos[0]) then g.MovingWindow = nil end @@ -11773,14 +11807,14 @@ function ImGui.UpdateMouseMovingWindowEndFrame() end elseif hovered_window == nil and g.NavWindow ~= nil then -- Clicking on void disable focus - ImGui.FocusWindow(nil, ImGuiFocusRequestFlags.UnlessBelowModal) + ImGui.FocusWindow(nil, 2 --[[ImGuiFocusRequestFlags.UnlessBelowModal]]) end end -- With right mouse button we close popups without changing focus based on where the mouse is aimed -- Instead, focus will be restored to the window under the bottom-most closed popup. -- (The left mouse button path calls FocusWindow on the hovered window, which will lead NewFrame->ClosePopupsOverWindow to trigger) - if g.HoveredId == 0 and ImGui.IsMouseClickedEx(1, ImGuiInputFlags.None, ImGuiKeyOwner_NoOwner) then + if g.HoveredId == 0 and ImGui.IsMouseClickedEx(1, 0 --[[ImGuiInputFlags.None]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) then -- Find the top-most window between HoveredWindow and the top-most Modal Window. -- This is where we can trim the popup stack. local modal = ImGui.GetTopMostPopupModal() @@ -11839,9 +11873,9 @@ function ImGui.Begin(name, open, flags) local g = GImGui local style = g.Style - IM_ASSERT(name ~= nil and name ~= "") -- Window name required - IM_ASSERT(g.WithinFrameScope) -- Forgot to call ImGui.NewFrame() - IM_ASSERT(g.FrameCountEnded ~= g.FrameCount) -- Called ImGui.Render() or ImGui.EndFrame() and haven't called ImGui.NewFrame() again yet + assert(name ~= nil and name ~= "") -- Window name required + assert(g.WithinFrameScope) -- Forgot to call ImGui.NewFrame() + assert(g.FrameCountEnded ~= g.FrameCount) -- Called ImGui.Render() or ImGui.EndFrame() and haven't called ImGui.NewFrame() again yet -- Find or create local window = ImGui.FindWindowByName(name) @@ -11850,13 +11884,13 @@ function ImGui.Begin(name, open, flags) window = CreateNewWindow(name, flags) --- @cast window ImGuiWindow end - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasWindowFlags) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 256 --[[ImGuiNextWindowDataFlags.HasWindowFlags]]) ~= 0 then flags = bit32.band(bit32.bor(flags, g.NextWindowData.WindowFlagsSet), bit32.bnot(g.NextWindowData.WindowFlagsClear)) end -- Automatically disable manual moving/resizing when NoInputs is set - if bit32.band(flags, ImGuiWindowFlags.NoInputs) == ImGuiWindowFlags.NoInputs then - flags = bit32.bor(flags, ImGuiWindowFlags.NoMove, ImGuiWindowFlags.NoResize) + if bit32.band(flags, 197120 --[[ImGuiWindowFlags.NoInputs]]) == 197120 --[[ImGuiWindowFlags.NoInputs]] then + flags = bit32.bor(flags, 4 --[[ImGuiWindowFlags.NoMove]], 2 --[[ImGuiWindowFlags.NoResize]]) end local current_frame = g.FrameCount @@ -11865,7 +11899,7 @@ function ImGui.Begin(name, open, flags) -- Update the Appearing flag (note: the BeginDocked() path may also set this to true later) local window_just_activated_by_user = (window.LastFrameActive < (current_frame - 1)) -- Not using !WasActive because the implicit "Debug" window would always toggle off->on - if bit32.band(flags, ImGuiWindowFlags.Popup) ~= 0 then + if bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 then local popup_ref = g.OpenPopupStack.Data[g.BeginPopupStack.Size + 1] window_just_activated_by_user = window_just_activated_by_user or (window.PopupId ~= popup_ref.PopupId) -- We recycle popups so treat window as activated if popup id changed window_just_activated_by_user = window_just_activated_by_user or (window ~= popup_ref.Window) @@ -11877,11 +11911,11 @@ function ImGui.Begin(name, open, flags) ImGui.UpdateWindowInFocusOrderList(window, window_just_created, flags) window.Appearing = window_just_activated_by_user if (window.Appearing) then - SetWindowConditionAllowFlags(window, ImGuiCond.Appearing, true) + SetWindowConditionAllowFlags(window, 8 --[[ImGuiCond.Appearing]], true) end window.FlagsPreviousFrame = window.Flags window.Flags = flags - window.ChildFlags = (bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasChildFlags) ~= 0) and g.NextWindowData.ChildFlagsSet or 0 + window.ChildFlags = (bit32.band(g.NextWindowData.HasFlags, 512 --[[ImGuiNextWindowDataFlags.HasChildFlags]]) ~= 0) and g.NextWindowData.ChildFlagsSet or 0 window.LastFrameActive = current_frame window.LastTimeActive = g.Time window.BeginOrderWithinParent = 0 @@ -11893,8 +11927,8 @@ function ImGui.Begin(name, open, flags) -- Docking -- (NB: during the frame dock nodes are created, it is possible that (window->DockIsActive == false) even though (window->DockNode->Windows.Size > 1) - IM_ASSERT(window.DockNode == nil or window.DockNodeAsHost == nil) -- Cannot be both - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasDock) ~= 0 then + assert(window.DockNode == nil or window.DockNodeAsHost == nil) -- Cannot be both + if bit32.band(g.NextWindowData.HasFlags, 4096 --[[ImGuiNextWindowDataFlags.HasDock]]) ~= 0 then ImGui.SetWindowDock(window, g.NextWindowData.DockId, g.NextWindowData.DockCond) end if first_begin_of_the_frame then @@ -11910,14 +11944,14 @@ function ImGui.Begin(name, open, flags) open = ImGui.BeginDocked(window, open) flags = window.Flags if window.DockIsActive then - IM_ASSERT(window.DockNode ~= nil) - g.NextWindowData.HasFlags = bit32.band(g.NextWindowData.HasFlags, bit32.bnot(ImGuiNextWindowDataFlags.HasSizeConstraint)) -- Docking currently override constraints + assert(window.DockNode ~= nil) + g.NextWindowData.HasFlags = bit32.band(g.NextWindowData.HasFlags, bit32.bnot(16 --[[ImGuiNextWindowDataFlags.HasSizeConstraint]])) -- Docking currently override constraints end -- Amend the Appearing flag if window.DockTabIsVisible and not dock_tab_was_visible and dock_node_was_visible and not window.Appearing and not window_was_appearing then window.Appearing = true - SetWindowConditionAllowFlags(window, ImGuiCond.Appearing, true) + SetWindowConditionAllowFlags(window, 8 --[[ImGuiCond.Appearing]], true) end end end @@ -11933,7 +11967,7 @@ function ImGui.Begin(name, open, flags) end local parent_window if first_begin_of_the_frame then - if (bit32.band(flags, bit32.bor(ImGuiWindowFlags.ChildWindow, ImGuiWindowFlags.Popup, ImGuiWindowFlags.Tooltip)) ~= 0) then + if (bit32.band(flags, bit32.bor(16777216 --[[ImGuiWindowFlags.ChildWindow]], 67108864 --[[ImGuiWindowFlags.Popup]], 33554432 --[[ImGuiWindowFlags.Tooltip]])) ~= 0) then parent_window = parent_window_in_stack else parent_window = nil @@ -11954,12 +11988,12 @@ function ImGui.Begin(name, open, flags) local window_stack_data = g.CurrentWindowStack.Data[g.CurrentWindowStack.Size] window_stack_data.Window = window ImGuiLastItemData_Copy(window_stack_data.ParentLastItemDataBackup, g.LastItemData) - window_stack_data.DisabledOverrideReenable = (bit32.band(flags, ImGuiWindowFlags.Tooltip) ~= 0) and (bit32.band(g.CurrentItemFlags, ImGuiItemFlags.Disabled) ~= 0) + window_stack_data.DisabledOverrideReenable = (bit32.band(flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0) and (bit32.band(g.CurrentItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) ~= 0) window_stack_data.DisabledOverrideReenableAlphaBackup = 0.0 window_stack_data.StackSizesInBegin = ImGuiErrorRecoveryState() ImGui.ErrorRecoveryStoreState(window_stack_data.StackSizesInBegin) g.StackSizesInBeginForCurrentWindow = window_stack_data.StackSizesInBegin - if bit32.band(flags, ImGuiWindowFlags.ChildMenu) ~= 0 then + if bit32.band(flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0 then g.BeginMenuDepth = g.BeginMenuDepth + 1 end @@ -11977,7 +12011,7 @@ function ImGui.Begin(name, open, flags) window.ParentWindowForFocusRoute = nil end if window.ParentWindowForFocusRoute == nil and window.DockNode ~= nil then - if bit32.band(window.DockNode.MergedFlags, ImGuiDockNodeFlags.DockedWindowsInFocusRoute) ~= 0 then + if bit32.band(window.DockNode.MergedFlags, 262144 --[[ImGuiDockNodeFlags.DockedWindowsInFocusRoute]]) ~= 0 then window.ParentWindowForFocusRoute = window.DockNode.HostWindow end end @@ -11995,11 +12029,11 @@ function ImGui.Begin(name, open, flags) end -- Add to focus scope stack - ImGui.PushFocusScope((bit32.band(window.ChildFlags, ImGuiChildFlags.NavFlattened) ~= 0) and g.CurrentFocusScopeId or window.ID) + ImGui.PushFocusScope((bit32.band(window.ChildFlags, 256 --[[ImGuiChildFlags.NavFlattened]]) ~= 0) and g.CurrentFocusScopeId or window.ID) window.NavRootFocusScopeId = g.CurrentFocusScopeId -- Add to popup stacks: update OpenPopupStack[] data, push to BeginPopupStack[] - if bit32.band(flags, ImGuiWindowFlags.Popup) ~= 0 then + if bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 then local popup_ref = g.OpenPopupStack.Data[g.BeginPopupStack.Size + 1] popup_ref.Window = window popup_ref.ParentNavLayer = parent_window_in_stack.DC.NavLayerCurrent @@ -12012,30 +12046,30 @@ function ImGui.Begin(name, open, flags) local window_pos_set_by_api = false local window_size_x_set_by_api = false local window_size_y_set_by_api = false - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasPos) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 1 --[[ImGuiNextWindowDataFlags.HasPos]]) ~= 0 then window_pos_set_by_api = (bit32.band(window.SetWindowPosAllowFlags, g.NextWindowData.PosCond) ~= 0) if window_pos_set_by_api and ImLengthSqr(g.NextWindowData.PosPivotVal) > 1e-5 then -- May be processed on the next frame if this is our first frame and we are measuring size -- FIXME: Look into removing the branch so everything can go through this same code path for consistency. ImVec2_Copy(window.SetWindowPosVal, g.NextWindowData.PosVal) ImVec2_Copy(window.SetWindowPosPivot, g.NextWindowData.PosPivotVal) - window.SetWindowPosAllowFlags = bit32.band(window.SetWindowPosAllowFlags, bit32.bnot(bit32.bor(ImGuiCond.Once, ImGuiCond.FirstUseEver, ImGuiCond.Appearing))) + window.SetWindowPosAllowFlags = bit32.band(window.SetWindowPosAllowFlags, bit32.bnot(bit32.bor(2 --[[ImGuiCond.Once]], 4 --[[ImGuiCond.FirstUseEver]], 8 --[[ImGuiCond.Appearing]]))) else ImGui.SetWindowPos(window, g.NextWindowData.PosVal, g.NextWindowData.PosCond) end end - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasSize) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 2 --[[ImGuiNextWindowDataFlags.HasSize]]) ~= 0 then window_size_x_set_by_api = (bit32.band(window.SetWindowSizeAllowFlags, g.NextWindowData.SizeCond) ~= 0) and (g.NextWindowData.SizeVal.x > 0.0) window_size_y_set_by_api = (bit32.band(window.SetWindowSizeAllowFlags, g.NextWindowData.SizeCond) ~= 0) and (g.NextWindowData.SizeVal.y > 0.0) - if (bit32.band(window.ChildFlags, ImGuiChildFlags.ResizeX) ~= 0 and bit32.band(window.SetWindowSizeAllowFlags, ImGuiCond.FirstUseEver) == 0) then -- Axis-specific conditions for BeginChild() + if (bit32.band(window.ChildFlags, 4 --[[ImGuiChildFlags.ResizeX]]) ~= 0 and bit32.band(window.SetWindowSizeAllowFlags, 4 --[[ImGuiCond.FirstUseEver]]) == 0) then -- Axis-specific conditions for BeginChild() g.NextWindowData.SizeVal.x = window.SizeFull.x end - if (bit32.band(window.ChildFlags, ImGuiChildFlags.ResizeY) ~= 0 and bit32.band(window.SetWindowSizeAllowFlags, ImGuiCond.FirstUseEver) == 0) then + if (bit32.band(window.ChildFlags, 8 --[[ImGuiChildFlags.ResizeY]]) ~= 0 and bit32.band(window.SetWindowSizeAllowFlags, 4 --[[ImGuiCond.FirstUseEver]]) == 0) then g.NextWindowData.SizeVal.y = window.SizeFull.y end ImGui.SetWindowSize(window, g.NextWindowData.SizeVal, g.NextWindowData.SizeCond); end - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasScroll) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 128 --[[ImGuiNextWindowDataFlags.HasScroll]]) ~= 0 then if g.NextWindowData.ScrollVal.x >= 0.0 then window.ScrollTarget.x = g.NextWindowData.ScrollVal.x window.ScrollTargetCenterRatio.x = 0.0 @@ -12045,22 +12079,22 @@ function ImGui.Begin(name, open, flags) window.ScrollTargetCenterRatio.y = 0.0 end end - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasContentSize) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 4 --[[ImGuiNextWindowDataFlags.HasContentSize]]) ~= 0 then ImVec2_Copy(window.ContentSizeExplicit, g.NextWindowData.ContentSizeVal) elseif first_begin_of_the_frame then window.ContentSizeExplicit = ImVec2(0.0, 0.0) end - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasWindowClass) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 8192 --[[ImGuiNextWindowDataFlags.HasWindowClass]]) ~= 0 then window.WindowClass = g.NextWindowData.WindowClass end - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasCollapsed) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 8 --[[ImGuiNextWindowDataFlags.HasCollapsed]]) ~= 0 then ImGui.SetWindowCollapsed(window, g.NextWindowData.CollapsedVal, g.NextWindowData.CollapsedCond) end - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasFocus) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 32 --[[ImGuiNextWindowDataFlags.HasFocus]]) ~= 0 then ImGui.FocusWindow(window) end if window.Appearing then - SetWindowConditionAllowFlags(window, ImGuiCond.Appearing, false) + SetWindowConditionAllowFlags(window, 8 --[[ImGuiCond.Appearing]], false) end -- [EXPERIMENTAL] Skip Refresh mode @@ -12077,18 +12111,18 @@ function ImGui.Begin(name, open, flags) -- When reusing window again multiple times a frame, just append content (don't need to setup again) if first_begin_of_the_frame and not window.SkipRefresh then -- Initialize - local window_is_child_tooltip = (bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0 and bit32.band(flags, ImGuiWindowFlags.Tooltip) ~= 0) -- FIXME-WIP: Undocumented behavior of Child+Tooltip for pinned tooltip (#1345) + local window_is_child_tooltip = (bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 and bit32.band(flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0) -- FIXME-WIP: Undocumented behavior of Child+Tooltip for pinned tooltip (#1345) local window_just_appearing_after_hidden_for_resize = (window.HiddenFramesCannotSkipItems > 0) window.Active = true window.HasCloseButton = (open ~= nil) - ImRect_CopyFromV4(window.ClipRect, ImVec4(-FLT_MAX, -FLT_MAX, FLT_MAX, FLT_MAX)) + ImRect_CopyFromV4(window.ClipRect, ImVec4(-3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]])) window.IDStack:resize(1) window.DrawList:_ResetForNewFrame() window.DC.CurrentTableIdx = -1 - if bit32.band(flags, ImGuiWindowFlags.DockNodeHost) ~= 0 then + if bit32.band(flags, 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) ~= 0 then window.DrawList:ChannelsSplit(2) window.DrawList:ChannelsSetCurrent(1) -- DOCKING_HOST_DRAW_CHANNEL_FG: Render decorations on channel 1 as we will render the backgrounds manually later end @@ -12123,9 +12157,9 @@ function ImGui.Begin(name, open, flags) -- Hide popup/tooltip window when re-opening while we measure size (because we recycle the windows) -- We reset Size/ContentSize for reappearing popups/tooltips early in this function, so further code won't be tempted to use the old size. - if window_just_activated_by_user and bit32.band(flags, bit32.bor(ImGuiWindowFlags.Popup, ImGuiWindowFlags.Tooltip)) ~= 0 then + if window_just_activated_by_user and bit32.band(flags, bit32.bor(67108864 --[[ImGuiWindowFlags.Popup]], 33554432 --[[ImGuiWindowFlags.Tooltip]])) ~= 0 then window.HiddenFramesCannotSkipItems = 1 - if bit32.band(flags, ImGuiWindowFlags.AlwaysAutoResize) ~= 0 then + if bit32.band(flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) ~= 0 then if not window_size_x_set_by_api then window.SizeFull.x = 0.0 window.Size.x = 0.0 @@ -12150,14 +12184,14 @@ function ImGui.Begin(name, open, flags) -- LOCK BORDER SIZE AND PADDING FOR THE FRAME (so that altering them doesn't cause inconsistencies) -- We read Style data after the call to UpdateSelectWindowViewport() which might be swapping the style. - if not window.DockIsActive and bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0 then + if not window.DockIsActive and bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 then window.WindowBorderSize = style.ChildBorderSize else - window.WindowBorderSize = (bit32.band(flags, bit32.bor(ImGuiWindowFlags.Popup, ImGuiWindowFlags.Tooltip)) ~= 0 and bit32.band(flags, ImGuiWindowFlags.Modal) == 0) and style.PopupBorderSize or style.WindowBorderSize + window.WindowBorderSize = (bit32.band(flags, bit32.bor(67108864 --[[ImGuiWindowFlags.Popup]], 33554432 --[[ImGuiWindowFlags.Tooltip]])) ~= 0 and bit32.band(flags, 134217728 --[[ImGuiWindowFlags.Modal]]) == 0) and style.PopupBorderSize or style.WindowBorderSize end window.WindowPadding = style.WindowPadding - if not window.DockIsActive and (bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0) and (bit32.band(flags, ImGuiWindowFlags.Popup) == 0) and (bit32.band(window.ChildFlags, ImGuiChildFlags.AlwaysUseWindowPadding) == 0) and window.WindowBorderSize == 0.0 then - if bit32.band(flags, ImGuiWindowFlags.MenuBar) ~= 0 then + if not window.DockIsActive and (bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0) and (bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) == 0) and (bit32.band(window.ChildFlags, 2 --[[ImGuiChildFlags.AlwaysUseWindowPadding]]) == 0) and window.WindowBorderSize == 0.0 then + if bit32.band(flags, 1024 --[[ImGuiWindowFlags.MenuBar]]) ~= 0 then window.WindowPadding = ImVec2(0.0, style.WindowPadding.y) else window.WindowPadding = ImVec2(0.0, 0.0) @@ -12168,19 +12202,19 @@ function ImGui.Begin(name, open, flags) window.DC.MenuBarOffset.x = ImMax(ImMax(window.WindowPadding.x, style.ItemSpacing.x), g.NextWindowData.MenuBarOffsetMinVal.x) window.DC.MenuBarOffset.y = g.NextWindowData.MenuBarOffsetMinVal.y - if bit32.band(flags, ImGuiWindowFlags.NoTitleBar) ~= 0 then + if bit32.band(flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) ~= 0 then window.TitleBarHeight = 0.0 else window.TitleBarHeight = g.FontSize + g.Style.FramePadding.y * 2.0 end - if bit32.band(flags, ImGuiWindowFlags.MenuBar) ~= 0 then + if bit32.band(flags, 1024 --[[ImGuiWindowFlags.MenuBar]]) ~= 0 then window.MenuBarHeight = window.DC.MenuBarOffset.y + g.FontSize + g.Style.FramePadding.y * 2.0 else window.MenuBarHeight = 0.0 end - window.TitleBarHeight = (bit32.band(flags, ImGuiWindowFlags.NoTitleBar) ~= 0) and 0 or g.FontSize + g.Style.FramePadding.y * 2 + window.TitleBarHeight = (bit32.band(flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) ~= 0) and 0 or g.FontSize + g.Style.FramePadding.y * 2 window.FontRefSize = g.FontSize -- Lock this to discourage calling window:CalcFontSize() outside of current window. @@ -12197,14 +12231,14 @@ function ImGui.Begin(name, open, flags) -- Collapse window by double-clicking on title bar -- At this point we don't have a clipping rectangle setup yet, so we can use the title bar area for hit detection and drawing - if bit32.band(flags, ImGuiWindowFlags.NoTitleBar) == 0 and bit32.band(flags, ImGuiWindowFlags.NoCollapse) == 0 and not window.DockIsActive then + if bit32.band(flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) == 0 and bit32.band(flags, 32 --[[ImGuiWindowFlags.NoCollapse]]) == 0 and not window.DockIsActive then -- We don't use a regular button+id to test for double-click on title bar (mostly due to legacy reason, could be fixed), -- so verify that we don't have items over the title bar. local title_bar_rect = window:TitleBarRect() if g.HoveredWindow == window and g.HoveredId == 0 and g.HoveredIdPreviousFrame == 0 and g.ActiveId == 0 and ImGui.IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max) then - if g.IO.MouseClickedCount[0] == 2 and ImGui.GetKeyOwner(ImGuiKey.MouseLeft) == ImGuiKeyOwner_NoOwner then + if g.IO.MouseClickedCount[0] == 2 and ImGui.GetKeyOwner(656 --[[ImGuiKey.MouseLeft]]) == 4294967295 --[[ImGuiKeyOwner_NoOwner]] then window.WantCollapseToggle = true - ImGui.SetKeyOwner(ImGuiKey.MouseLeft, window.MoveId) -- Claim input the same way ButtonBehavior() does. Prevent a same-frame move from triggering other items. (#9439) + ImGui.SetKeyOwner(656 --[[ImGuiKey.MouseLeft]], window.MoveId) -- Claim input the same way ButtonBehavior() does. Prevent a same-frame move from triggering other items. (#9439) end end if window.WantCollapseToggle then @@ -12237,17 +12271,17 @@ function ImGui.Begin(name, open, flags) -- - We still process initial auto-fit on collapsed windows to get a window width, but otherwise don't honor ImGuiWindowFlags.AlwaysAutoResize when collapsed. -- - Auto-fit may only grow window during the first few frames. do - local size_auto_fit_x_always = not window_size_x_set_by_api and (bit32.band(flags, ImGuiWindowFlags.AlwaysAutoResize) ~= 0) and not window.Collapsed - local size_auto_fit_y_always = not window_size_y_set_by_api and (bit32.band(flags, ImGuiWindowFlags.AlwaysAutoResize) ~= 0) and not window.Collapsed + local size_auto_fit_x_always = not window_size_x_set_by_api and (bit32.band(flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) ~= 0) and not window.Collapsed + local size_auto_fit_y_always = not window_size_y_set_by_api and (bit32.band(flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) ~= 0) and not window.Collapsed local size_auto_fit_x_current = not window_size_x_set_by_api and (window.AutoFitFramesX > 0) local size_auto_fit_y_current = not window_size_y_set_by_api and (window.AutoFitFramesY > 0) local size_auto_fit_mask = 0 if size_auto_fit_x_always or size_auto_fit_x_current then - size_auto_fit_mask = bit32.bor(size_auto_fit_mask, bit32.lshift(1, ImGuiAxis.X - 1)) + size_auto_fit_mask = bit32.bor(size_auto_fit_mask, bit32.lshift(1, 1 --[[ImGuiAxis.X]] - 1)) end if size_auto_fit_y_always or size_auto_fit_y_current then - size_auto_fit_mask = bit32.bor(size_auto_fit_mask, bit32.lshift(1, ImGuiAxis.Y - 1)) + size_auto_fit_mask = bit32.bor(size_auto_fit_mask, bit32.lshift(1, 2 --[[ImGuiAxis.Y]] - 1)) end local size_auto_fit = CalcWindowAutoFitSize(window, window.ContentSizeIdeal, size_auto_fit_mask) @@ -12285,45 +12319,45 @@ function ImGui.Begin(name, open, flags) -- Apply minimum/maximum window size constraints and final size ImVec2_Copy(window.SizeFull, CalcWindowSizeAfterConstraint(window, window.SizeFull)) - ImVec2_Copy(window.Size, (window.Collapsed and bit32.band(flags, ImGuiWindowFlags.ChildWindow) == 0) and window:TitleBarRect():GetSize() or window.SizeFull) + ImVec2_Copy(window.Size, (window.Collapsed and bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0) and window:TitleBarRect():GetSize() or window.SizeFull) -- POSITION -- Popup latch its initial position, will position itself when it appears next frame if window_just_activated_by_user then - window.AutoPosLastDirection = ImGuiDir.None - if bit32.band(flags, ImGuiWindowFlags.Popup) ~= 0 and bit32.band(flags, ImGuiWindowFlags.Modal) == 0 and not window_pos_set_by_api then -- FIXME: BeginPopup() could use SetNextWindowPos() + window.AutoPosLastDirection = (-1) --[[ImGuiDir.None]] + if bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 and bit32.band(flags, 134217728 --[[ImGuiWindowFlags.Modal]]) == 0 and not window_pos_set_by_api then -- FIXME: BeginPopup() could use SetNextWindowPos() ImVec2_Copy(window.Pos, g.BeginPopupStack:back().OpenPopupPos) end end -- Position child window - if bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0 then - IM_ASSERT(parent_window and parent_window.Active) + if bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 then + assert(parent_window and parent_window.Active) window.BeginOrderWithinParent = parent_window.DC.ChildWindows.Size parent_window.DC.ChildWindows:push_back(window) - if (bit32.band(flags, ImGuiWindowFlags.Popup) == 0) and not window_pos_set_by_api and not window_is_child_tooltip then + if (bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) == 0) and not window_pos_set_by_api and not window_is_child_tooltip then ImVec2_Copy(window.Pos, parent_window.DC.CursorPos) end end - local window_pos_with_pivot = (window.SetWindowPosVal.x ~= FLT_MAX and window.HiddenFramesCannotSkipItems == 0) + local window_pos_with_pivot = (window.SetWindowPosVal.x ~= 3.4028234663853e+38 --[[FLT_MAX]] and window.HiddenFramesCannotSkipItems == 0) if window_pos_with_pivot then ImGui.SetWindowPos(window, window.SetWindowPosVal - window.Size * window.SetWindowPosPivot, 0) -- Position given a pivot (e.g. for centering) - elseif (bit32.band(flags, ImGuiWindowFlags.ChildMenu) ~= 0) then + elseif (bit32.band(flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0) then ImVec2_Copy(window.Pos, ImGui.FindBestWindowPosForPopup(window)) - elseif (bit32.band(flags, ImGuiWindowFlags.Popup) ~= 0) and not window_pos_set_by_api and window_just_appearing_after_hidden_for_resize then + elseif (bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0) and not window_pos_set_by_api and window_just_appearing_after_hidden_for_resize then ImVec2_Copy(window.Pos, ImGui.FindBestWindowPosForPopup(window)) - elseif (bit32.band(flags, ImGuiWindowFlags.Tooltip) ~= 0) and not window_pos_set_by_api and not window_is_child_tooltip then + elseif (bit32.band(flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0) and not window_pos_set_by_api and not window_is_child_tooltip then ImVec2_Copy(window.Pos, ImGui.FindBestWindowPosForPopup(window)) end -- Late create viewport if we don't fit within our current host viewport. - if window.ViewportAllowPlatformMonitorExtend >= 0 and not window.ViewportOwned and bit32.band(window.Viewport.Flags, ImGuiViewportFlags.IsMinimized) == 0 then + if window.ViewportAllowPlatformMonitorExtend >= 0 and not window.ViewportOwned and bit32.band(window.Viewport.Flags, 4096 --[[ImGuiViewportFlags.IsMinimized]]) == 0 then if not window.Viewport:GetMainRect():Contains(window:Rect()) then -- This is based on the assumption that the DPI will be known ahead (same as the DPI of the selection done in UpdateSelectWindowViewport) -- local old_viewport = window.Viewport - window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.Pos, window.Size, ImGuiViewportFlags.NoFocusOnAppearing) + window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.Pos, window.Size, 32 --[[ImGuiViewportFlags.NoFocusOnAppearing]]) -- FIXME-DPI -- IM_ASSERT(old_viewport.DpiScale == window.Viewport.DpiScale) -- FIXME-DPI: Something went wrong @@ -12346,10 +12380,10 @@ function ImGui.Begin(name, open, flags) -- Clamp position/size so window stays visible within its viewport or monitor -- Ignore zero-sized display explicitly to avoid losing positions if a window manager reports zero-sized window when initializing or minimizing. -- FIXME: Similar to code in GetWindowAllowedExtentRect() - if not window_pos_set_by_api and bit32.band(flags, ImGuiWindowFlags.ChildWindow) == 0 then + if not window_pos_set_by_api and bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0 then if not window.ViewportOwned and viewport_rect:GetWidth() > 0 and viewport_rect:GetHeight() > 0.0 then local size_for_clamping_y = window.Size.y - if bit32.band(window.BgClickFlags, ImGuiWindowBgClickFlags.Move) == 0 and bit32.band(window.Flags, ImGuiWindowFlags.NoTitleBar) == 0 then + if bit32.band(window.BgClickFlags, 1 --[[ImGuiWindowBgClickFlags.Move]]) == 0 and bit32.band(window.Flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) == 0 then size_for_clamping_y = window.TitleBarHeight end window.Pos.x = ImClamp(window.Pos.x, visibility_rect.Min.x - window.Size.x, visibility_rect.Max.x) @@ -12360,22 +12394,22 @@ function ImGui.Begin(name, open, flags) -- Apply window focus (new and reactivated windows are moved to front) local want_focus = false - if (window_just_activated_by_user and bit32.band(flags, ImGuiWindowFlags.NoFocusOnAppearing) == 0) then - if bit32.band(flags, ImGuiWindowFlags.Popup) ~= 0 then + if (window_just_activated_by_user and bit32.band(flags, 4096 --[[ImGuiWindowFlags.NoFocusOnAppearing]]) == 0) then + if bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 then want_focus = true - elseif (window.DockIsActive or bit32.band(flags, ImGuiWindowFlags.ChildWindow) == 0) and bit32.band(flags, ImGuiWindowFlags.Tooltip) == 0 then + elseif (window.DockIsActive or bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0) and bit32.band(flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) == 0 then want_focus = true end end -- Lock window rounding for the frame (so that altering them doesn't cause inconsistencies) -- Large values tend to lead to variety of artifacts and are not recommended. - if bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0 and not window.DockIsActive then + if bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 and not window.DockIsActive then window.WindowRounding = style.ChildRounding elseif window.RootWindowDockTree.ViewportOwned then window.WindowRounding = 0.0 else - if (bit32.band(flags, ImGuiWindowFlags.Popup) ~= 0 and bit32.band(flags, ImGuiWindowFlags.Modal) == 0) then + if (bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 and bit32.band(flags, 134217728 --[[ImGuiWindowFlags.Modal]]) == 0) then window.WindowRounding = style.PopupRounding else window.WindowRounding = style.WindowRounding @@ -12386,7 +12420,7 @@ function ImGui.Begin(name, open, flags) -- 'window.SkipItems' is not updated yet so for child windows we rely on ParentWindow to avoid submitting decorations. (#8815) -- Whenever we add support for full decorated child windows we will likely make this logic more general. local handle_borders_and_resize_grips = (window.DockNodeAsHost ~= nil or not window.DockIsActive) - if bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0 and window.ParentWindow.SkipItems then + if bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 and window.ParentWindow.SkipItems then handle_borders_and_resize_grips = false end @@ -12396,8 +12430,8 @@ function ImGui.Begin(name, open, flags) local resize_grip_col = {0, 0, 0, 0} local resize_grip_count - if (bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0) and (bit32.band(flags, ImGuiWindowFlags.Popup) == 0) then - if (bit32.band(window.ChildFlags, ImGuiChildFlags.ResizeX) ~= 0) and (bit32.band(window.ChildFlags, ImGuiChildFlags.ResizeY) ~= 0) then + if (bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0) and (bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) == 0) then + if (bit32.band(window.ChildFlags, 4 --[[ImGuiChildFlags.ResizeX]]) ~= 0) and (bit32.band(window.ChildFlags, 8 --[[ImGuiChildFlags.ResizeY]]) ~= 0) then resize_grip_count = 1 else resize_grip_count = 0 @@ -12411,10 +12445,10 @@ function ImGui.Begin(name, open, flags) local auto_fit_mask auto_fit_mask, border_hovered, border_held = UpdateWindowManualResize(window, resize_grip_count, resize_grip_col, visibility_rect) if auto_fit_mask ~= 0 then - if bit32.band(auto_fit_mask, bit32.lshift(1, ImGuiAxis.X - 1)) ~= 0 then + if bit32.band(auto_fit_mask, bit32.lshift(1, 1 --[[ImGuiAxis.X]] - 1)) ~= 0 then use_current_size_for_scrollbar_x = true end - if bit32.band(auto_fit_mask, bit32.lshift(1, ImGuiAxis.Y - 1)) ~= 0 then + if bit32.band(auto_fit_mask, bit32.lshift(1, 2 --[[ImGuiAxis.Y]] - 1)) ~= 0 then use_current_size_for_scrollbar_y = true end end @@ -12454,8 +12488,8 @@ function ImGui.Begin(name, open, flags) local scrollbar_x_prev = window.ScrollbarX -- local scrollbar_y_from_last_frame = window.ScrollbarY -- FIXME: May want to use that in the ScrollbarX expression? How many pros vs cons? - window.ScrollbarY = (bit32.band(flags, ImGuiWindowFlags.AlwaysVerticalScrollbar) ~= 0) or ((needed_size_from_last_frame.y > size_for_scrollbars_y) and not (bit32.band(flags, ImGuiWindowFlags.NoScrollbar) ~= 0)) - window.ScrollbarX = (bit32.band(flags, ImGuiWindowFlags.AlwaysHorizontalScrollbar) ~= 0) or ((needed_size_from_last_frame.x > size_for_scrollbars_x - (window.ScrollbarY and style.ScrollbarSize or 0.0)) and not (bit32.band(flags, ImGuiWindowFlags.NoScrollbar) ~= 0) and (bit32.band(flags, ImGuiWindowFlags.HorizontalScrollbar) ~= 0)) + window.ScrollbarY = (bit32.band(flags, 16384 --[[ImGuiWindowFlags.AlwaysVerticalScrollbar]]) ~= 0) or ((needed_size_from_last_frame.y > size_for_scrollbars_y) and not (bit32.band(flags, 8 --[[ImGuiWindowFlags.NoScrollbar]]) ~= 0)) + window.ScrollbarX = (bit32.band(flags, 32768 --[[ImGuiWindowFlags.AlwaysHorizontalScrollbar]]) ~= 0) or ((needed_size_from_last_frame.x > size_for_scrollbars_x - (window.ScrollbarY and style.ScrollbarSize or 0.0)) and not (bit32.band(flags, 8 --[[ImGuiWindowFlags.NoScrollbar]]) ~= 0) and (bit32.band(flags, 2048 --[[ImGuiWindowFlags.HorizontalScrollbar]]) ~= 0)) -- Track when ScrollbarX visibility keeps toggling, which is a sign of a feedback loop, and stabilize by enforcing visibility (#3285, #8488) -- (Feedback loops of this sort can manifest in various situations, but combining horizontal + vertical scrollbar + using a clipper with varying width items is one frequent cause. @@ -12476,7 +12510,7 @@ function ImGui.Begin(name, open, flags) window.ScrollbarXStabilizeEnabled = scrollbar_x_stabilize if window.ScrollbarX and not window.ScrollbarY then - window.ScrollbarY = (needed_size_from_last_frame.y > size_for_scrollbars_y - style.ScrollbarSize) and not (bit32.band(flags, ImGuiWindowFlags.NoScrollbar) ~= 0) + window.ScrollbarY = (needed_size_from_last_frame.y > size_for_scrollbars_y - style.ScrollbarSize) and not (bit32.band(flags, 8 --[[ImGuiWindowFlags.NoScrollbar]]) ~= 0) end window.ScrollbarSizes = ImVec2(window.ScrollbarY and style.ScrollbarSize or 0.0, window.ScrollbarX and style.ScrollbarSize or 0.0) @@ -12496,7 +12530,7 @@ function ImGui.Begin(name, open, flags) -- - Begin() initial clipping rect for drawing window background and borders. -- - Begin() clipping whole child local host_rect - if (bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0 and bit32.band(flags, ImGuiWindowFlags.Popup) == 0 and not window_is_child_tooltip) then + if (bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 and bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) == 0 and not window_is_child_tooltip) then host_rect = parent_window.ClipRect else host_rect = viewport_rect @@ -12529,7 +12563,7 @@ function ImGui.Begin(name, open, flags) -- Note that if our window is collapsed we will end up with an inverted (~null) clipping rectangle which is the correct behavior. -- Affected by window/frame border size. Used by: -- - Begin() initial clip rect - local top_border_size = ((bit32.band(flags, ImGuiWindowFlags.MenuBar) ~= 0 or bit32.band(flags, ImGuiWindowFlags.NoTitleBar) == 0) and style.FrameBorderSize or window.WindowBorderSize) + local top_border_size = ((bit32.band(flags, 1024 --[[ImGuiWindowFlags.MenuBar]]) ~= 0 or bit32.band(flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) == 0) and style.FrameBorderSize or window.WindowBorderSize) -- Try to match the fact that our border is drawn centered over the window rectangle, rather than inner. -- This is why we do a *0.5 here. We don't currently even technically support large values for WindowBorderSize, @@ -12550,13 +12584,13 @@ function ImGui.Begin(name, open, flags) -- Apply scrolling ImVec2_Copy(window.Scroll, CalcNextScrollFromScrollTargetAndClamp(window)) - ImVec2_CopyV(window.ScrollTarget, FLT_MAX, FLT_MAX) + ImVec2_CopyV(window.ScrollTarget, 3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]) window.DecoInnerSizeX1 = 0.0; window.DecoInnerSizeY1 = 0.0 -- DRAWING -- Setup draw list and outer clipping rectangle - IM_ASSERT(window.DrawList.CmdBuffer.Size == 1 and window.DrawList.CmdBuffer.Data[1].ElemCount == 0) + assert(window.DrawList.CmdBuffer.Size == 1 and window.DrawList.CmdBuffer.Data[1].ElemCount == 0) window.DrawList:PushTexture(g.Font.OwnerAtlas.TexRef) ImGui.PushClipRect(host_rect.Min, host_rect.Max, false) @@ -12566,7 +12600,7 @@ function ImGui.Begin(name, open, flags) local is_undocked_or_docked_visible = not window.DockIsActive or window.DockTabIsVisible if is_undocked_or_docked_visible then local render_decorations_in_parent = false - if (bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0) and (bit32.band(flags, ImGuiWindowFlags.Popup) == 0) and not window_is_child_tooltip then + if (bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0) and (bit32.band(flags, 67108864 --[[ImGuiWindowFlags.Popup]]) == 0) and not window_is_child_tooltip then -- - We test overlap with the previous child window only (testing all would end up being O(log N) not a good investment here) -- - We disable this when the parent window has zero vertices, which is a common pattern leading to laying out multiple overlapping childs local previous_child @@ -12609,8 +12643,8 @@ function ImGui.Begin(name, open, flags) -- - Columns() for right-most edge -- - TreeNode(), CollapsingHeader() for right-most edge -- - BeginTabBar() for right-most edge - local allow_scrollbar_x = (bit32.band(flags, ImGuiWindowFlags.NoScrollbar) == 0) and (bit32.band(flags, ImGuiWindowFlags.HorizontalScrollbar) ~= 0) - local allow_scrollbar_y = (bit32.band(flags, ImGuiWindowFlags.NoScrollbar) == 0) + local allow_scrollbar_x = (bit32.band(flags, 8 --[[ImGuiWindowFlags.NoScrollbar]]) == 0) and (bit32.band(flags, 2048 --[[ImGuiWindowFlags.HorizontalScrollbar]]) ~= 0) + local allow_scrollbar_y = (bit32.band(flags, 8 --[[ImGuiWindowFlags.NoScrollbar]]) == 0) local work_rect_size_x if window.ContentSizeExplicit.x ~= 0.0 then @@ -12669,7 +12703,7 @@ function ImGui.Begin(name, open, flags) window.DC.IsSameLine = false window.DC.IsSetPos = false - window.DC.NavLayerCurrent = ImGuiNavLayer.Main + window.DC.NavLayerCurrent = 0 --[[ImGuiNavLayer.Main]] window.DC.NavLayersActiveMask = window.DC.NavLayersActiveMaskNext window.DC.NavLayersActiveMaskNext = 0x00 window.DC.NavIsScrollPushableX = true @@ -12684,16 +12718,16 @@ function ImGui.Begin(name, open, flags) window.DC.ChildWindows:resize(0) window.DC.StateStorage = window.StateStorage window.DC.CurrentColumns = nil - window.DC.LayoutType = ImGuiLayoutType.Vertical - window.DC.ParentLayoutType = (parent_window ~= nil) and parent_window.DC.LayoutType or ImGuiLayoutType.Vertical + window.DC.LayoutType = 1 --[[ImGuiLayoutType.Vertical]] + window.DC.ParentLayoutType = (parent_window ~= nil) and parent_window.DC.LayoutType or 1 --[[ImGuiLayoutType.Vertical]] -- Default item width. Make it proportional to window size if window can be manually resized. -- (we cannot use AutoFitFramesX/AutoFitFramesY which is a temporary state) local is_resizable_width - if bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0 and not window.DockIsActive then - is_resizable_width = (window.Size.x > 0.0) and (bit32.band(window.ChildFlags, bit32.bor(ImGuiChildFlags.AutoResizeX, ImGuiChildFlags.AlwaysAutoResize)) == 0) + if bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 and not window.DockIsActive then + is_resizable_width = (window.Size.x > 0.0) and (bit32.band(window.ChildFlags, bit32.bor(16 --[[ImGuiChildFlags.AutoResizeX]], 64 --[[ImGuiChildFlags.AlwaysAutoResize]])) == 0) else - is_resizable_width = (window.Size.x > 0.0) and (bit32.band(flags, ImGuiWindowFlags.AlwaysAutoResize) == 0) + is_resizable_width = (window.Size.x > 0.0) and (bit32.band(flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) == 0) end if is_resizable_width then @@ -12705,8 +12739,8 @@ function ImGui.Begin(name, open, flags) window.DC.ItemWidthStack:resize(0) window.DC.TextWrapPos = -1.0 -- Disabled window.DC.TextWrapPosStack:resize(0) - if bit32.band(flags, ImGuiWindowFlags.Modal) ~= 0 then - window.DC.ModalDimBgColor = ImGui.ColorConvertFloat4ToU32(ImGui.GetStyleColorVec4(ImGuiCol.ModalWindowDimBg)) + if bit32.band(flags, 134217728 --[[ImGuiWindowFlags.Modal]]) ~= 0 then + window.DC.ModalDimBgColor = ImGui.ColorConvertFloat4ToU32(ImGui.GetStyleColorVec4(62 --[[ImGuiCol.ModalWindowDimBg]])) end if window.AutoFitFramesX > 0 then @@ -12724,7 +12758,7 @@ function ImGui.Begin(name, open, flags) -- - Avoid focusing a window that is created outside of a modal. This will prevent active modal from being closed. -- - Position window behind the modal that is not a begin-parent of this window. if want_focus then - ImGui.FocusWindow(window, ImGuiFocusRequestFlags.UnlessBelowModal) + ImGui.FocusWindow(window, 2 --[[ImGuiFocusRequestFlags.UnlessBelowModal]]) end if want_focus and window == g.NavWindow then ImGui.NavInitWindow(window, false) -- <-- this is in the way for us to be able to defer and sort reappearing FocusWindow() calls @@ -12734,36 +12768,36 @@ function ImGui.Begin(name, open, flags) -- [EXPERIMENTAL] Breaks on nested Begin/End pairs. We need to work that out and add better logging scope. -- [EXPERIMENTAL] Text outputs has many issues. if g.IO.ConfigWindowsCopyContentsWithCtrlC then - if g.NavWindow and g.NavWindow.RootWindow == window and g.ActiveId == 0 and ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.C)) then + if g.NavWindow and g.NavWindow.RootWindow == window and g.ActiveId == 0 and ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 548 --[[ImGuiKey.C]])) then ImGui.LogToClipboard(0) end end -- Title bar - if bit32.band(flags, ImGuiWindowFlags.NoTitleBar) == 0 and not window.DockIsActive then + if bit32.band(flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) == 0 and not window.DockIsActive then open = RenderWindowTitleBarContents(window, ImRect(title_bar_rect.Min.x + window.WindowBorderSize, title_bar_rect.Min.y, title_bar_rect.Max.x - window.WindowBorderSize, title_bar_rect.Max.y), name, open) - elseif bit32.band(flags, ImGuiWindowFlags.NoTitleBar) == 0 and window.DockIsActive then + elseif bit32.band(flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) == 0 and window.DockIsActive then ImGui.LogText("%s\n", string.sub(window.Name, 1, ImGui.FindRenderedTextEnd(window.Name) - 1)) end -- Clear hit test shape every frame window.HitTestHoleSize.x = 0; window.HitTestHoleSize.y = 0 - if bit32.band(flags, ImGuiWindowFlags.Tooltip) ~= 0 then + if bit32.band(flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0 then g.TooltipPreviousWindow = window end - if bit32.band(g.IO.ConfigFlags, ImGuiConfigFlags.DockingEnable) ~= 0 then + if bit32.band(g.IO.ConfigFlags, 128 --[[ImGuiConfigFlags.DockingEnable]]) ~= 0 then -- Docking: Dragging a dockable window (or any of its child) turns it into a drag and drop source. -- We need to do this _before_ we overwrite window.DC.LastItemId below because BeginDockableDragDropSource() also overwrites it. - if g.MovingWindow == window and bit32.band(window.RootWindowDockTree.Flags, ImGuiWindowFlags.NoDocking) == 0 then + if g.MovingWindow == window and bit32.band(window.RootWindowDockTree.Flags, 524288 --[[ImGuiWindowFlags.NoDocking]]) == 0 then ImGui.BeginDockableDragDropSource(window) end -- Docking: Any dockable window can act as a target. For dock node hosts we call BeginDockableDragDropTarget() in DockNodeUpdate() instead. - if g.DragDropActive and bit32.band(flags, ImGuiWindowFlags.NoDocking) == 0 then + if g.DragDropActive and bit32.band(flags, 524288 --[[ImGuiWindowFlags.NoDocking]]) == 0 then if g.MovingWindow == nil or g.MovingWindow.RootWindowDockTree ~= window then - if window == window.RootWindowDockTree and bit32.band(window.Flags, ImGuiWindowFlags.DockNodeHost) == 0 then + if window == window.RootWindowDockTree and bit32.band(window.Flags, 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) == 0 then ImGui.BeginDockableDragDropTarget(window) end end @@ -12773,18 +12807,18 @@ function ImGui.Begin(name, open, flags) -- Set default BgClickFlags -- This is set at the end of this function, so UpdateWindowManualResize()/ClampWindowPos() may use last-frame value if overridden by user code. -- FIXME: The general intent is that we will later expose config options to default to enable scrolling + select scrolling mouse button. - if bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0 then + if bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 then window.BgClickFlags = parent_window.BgClickFlags else - window.BgClickFlags = g.IO.ConfigWindowsMoveFromTitleBarOnly and ImGuiWindowBgClickFlags.None or ImGuiWindowBgClickFlags.Move + window.BgClickFlags = g.IO.ConfigWindowsMoveFromTitleBarOnly and 0 --[[ImGuiWindowBgClickFlags.None]] or 1 --[[ImGuiWindowBgClickFlags.Move]] end -- We fill last item data based on Title Bar/Tab, in order for IsItemHovered() and IsItemActive() to be usable after Begin(). -- This is useful to allow creating context menus on title bar only, etc. - window.DC.WindowItemStatusFlags = ImGuiItemStatusFlags.None + window.DC.WindowItemStatusFlags = 0 --[[ImGuiItemStatusFlags.None]] if ImGui.IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max, false) then - window.DC.WindowItemStatusFlags = bit32.bor(window.DC.WindowItemStatusFlags, ImGuiItemStatusFlags.HoveredRect) + window.DC.WindowItemStatusFlags = bit32.bor(window.DC.WindowItemStatusFlags, 1 --[[ImGuiItemStatusFlags.HoveredRect]]) end ImGui.SetLastItemDataForWindow(window, title_bar_rect) else @@ -12800,7 +12834,7 @@ function ImGui.Begin(name, open, flags) ImGui.SetLastItemDataForWindow(window, window:TitleBarRect()) end - if bit32.band(flags, ImGuiWindowFlags.DockNodeHost) == 0 and not window.SkipRefresh then + if bit32.band(flags, 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) == 0 and not window.SkipRefresh then ImGui.PushClipRect(window.InnerClipRect.Min, window.InnerClipRect.Max, true) -- [Roblox backend] content clip + scroll origin: lets the backend move scrolled content instead of redrawing it local dl, cr = window.DrawList, window.DrawList._CmdHeader.ClipRect @@ -12827,12 +12861,12 @@ function ImGui.Begin(name, open, flags) end end - if (bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0) and (bit32.band(flags, ImGuiWindowFlags.ChildMenu) == 0) then + if (bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0) and (bit32.band(flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) == 0) then -- Child window can be out of sight and have "negative" clip windows. -- Mark them as collapsed so commands are skipped earlier (we can't manually collapse them because they have no title bar). - IM_ASSERT((bit32.band(flags, ImGuiWindowFlags.NoTitleBar) ~= 0) or window.DockIsActive) + assert((bit32.band(flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) ~= 0) or window.DockIsActive) - local nav_request = (bit32.band(window.ChildFlags, ImGuiChildFlags.NavFlattened) ~= 0) and (g.NavAnyRequest and g.NavWindow and g.NavWindow.RootWindowForNav == window.RootWindowForNav) + local nav_request = (bit32.band(window.ChildFlags, 256 --[[ImGuiChildFlags.NavFlattened]]) ~= 0) and (g.NavAnyRequest and g.NavWindow and g.NavWindow.RootWindowForNav == window.RootWindowForNav) if not g.LogEnabled and not nav_request then if window.OuterRectClipped.Min.x >= window.OuterRectClipped.Max.x or window.OuterRectClipped.Min.y >= window.OuterRectClipped.Max.y then @@ -12865,7 +12899,7 @@ function ImGui.Begin(name, open, flags) -- Disable inputs for requested number of frames if window.DisableInputsFrames > 0 then window.DisableInputsFrames = window.DisableInputsFrames - 1 - window.Flags = bit32.bor(window.Flags, ImGuiWindowFlags.NoInputs) + window.Flags = bit32.bor(window.Flags, 197120 --[[ImGuiWindowFlags.NoInputs]]) end -- Update the SkipItems flag, used to early out of all items functions (no layout required) @@ -12903,10 +12937,10 @@ function ImGui.End() local window_stack_data = g.CurrentWindowStack:back() -- Error checking: verify that user doesn't directly call End() on a child window. - if bit32.band(window.Flags, ImGuiWindowFlags.Popup) ~= 0 then + if bit32.band(window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 then IM_ASSERT_USER_ERROR(g.WithinEndPopupID == window.ID, "Must call EndPopup() and not End()!") end - if bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 and bit32.band(window.Flags, ImGuiWindowFlags.DockNodeHost) == 0 and not window.DockIsActive then + if bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 and bit32.band(window.Flags, 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) == 0 and not window.DockIsActive then IM_ASSERT_USER_ERROR(g.WithinEndChildID == window.ID, "Must call EndChild() and not End()!") end @@ -12914,7 +12948,7 @@ function ImGui.End() if window.DC.CurrentColumns then ImGui.EndColumns() end - if bit32.band(window.Flags, ImGuiWindowFlags.DockNodeHost) == 0 and not window.SkipRefresh then -- Pop inner window clip rectangle + if bit32.band(window.Flags, 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) == 0 and not window.SkipRefresh then -- Pop inner window clip rectangle ImGui.PopClipRect() end ImGui.PopFocusScope() @@ -12924,7 +12958,7 @@ function ImGui.End() end if (window.SkipRefresh) then - IM_ASSERT(window.DrawList == nil) + assert(window.DrawList == nil) window.DrawList = window.DrawListInst end if window.CacheSkipItemsBackup ~= nil then -- [Port] SetNextWindowCached() @@ -12951,10 +12985,10 @@ function ImGui.End() -- Pop from window stack ImGuiLastItemData_Copy(g.LastItemData, window_stack_data.ParentLastItemDataBackup) - if bit32.band(window.Flags, ImGuiWindowFlags.ChildMenu) ~= 0 then + if bit32.band(window.Flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0 then g.BeginMenuDepth = g.BeginMenuDepth - 1 end - if bit32.band(window.Flags, ImGuiWindowFlags.Popup) ~= 0 then + if bit32.band(window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 then g.BeginPopupStack:pop_back() end @@ -12982,7 +13016,7 @@ end function ImGui.PushItemFlag(option, enabled) local g = GImGui local item_flags = g.CurrentItemFlags - IM_ASSERT(item_flags == g.ItemFlagsStack:back()) + assert(item_flags == g.ItemFlagsStack:back()) if enabled then item_flags = bit32.bor(item_flags, option) @@ -13013,13 +13047,13 @@ function ImGui.BeginDisabled(disabled) if disabled == nil then disabled = true end local g = GImGui - local was_disabled = bit32.band(g.CurrentItemFlags, ImGuiItemFlags.Disabled) ~= 0 + local was_disabled = bit32.band(g.CurrentItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) ~= 0 if not was_disabled and disabled then g.DisabledAlphaBackup = g.Style.Alpha g.Style.Alpha = g.Style.Alpha * g.Style.DisabledAlpha -- PushStyleVar(ImGuiStyleVar.Alpha, g.Style.Alpha * g.Style.DisabledAlpha) end if was_disabled or disabled then - g.CurrentItemFlags = bit32.bor(g.CurrentItemFlags, ImGuiItemFlags.Disabled) + g.CurrentItemFlags = bit32.bor(g.CurrentItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) end g.ItemFlagsStack:push_back(g.CurrentItemFlags) -- FIXME-OPT: can we simply skip this and use DisabledStackSize? g.DisabledStackSize = g.DisabledStackSize + 1 @@ -13029,11 +13063,11 @@ function ImGui.EndDisabled() local g = GImGui IM_ASSERT_USER_ERROR_RET(g.DisabledStackSize > 0, "Calling EndDisabled() too many times!") g.DisabledStackSize = g.DisabledStackSize - 1 - local was_disabled = bit32.band(g.CurrentItemFlags, ImGuiItemFlags.Disabled) ~= 0 + local was_disabled = bit32.band(g.CurrentItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) ~= 0 -- PopItemFlag() g.ItemFlagsStack:pop_back() g.CurrentItemFlags = g.ItemFlagsStack:back() - if was_disabled and bit32.band(g.CurrentItemFlags, ImGuiItemFlags.Disabled) == 0 then + if was_disabled and bit32.band(g.CurrentItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) == 0 then g.Style.Alpha = g.DisabledAlphaBackup -- PopStyleVar() end end @@ -13043,18 +13077,18 @@ end -- The whole code for this is awkward, will reevaluate if we find a way to implement SetNextItemDisabled(). function ImGui.BeginDisabledOverrideReenable() local g = GImGui - IM_ASSERT(bit32.band(g.CurrentItemFlags, ImGuiItemFlags.Disabled) ~= 0) + assert(bit32.band(g.CurrentItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) ~= 0) g.CurrentWindowStack.Data[g.CurrentWindowStack.Size].DisabledOverrideReenableAlphaBackup = g.Style.Alpha g.Style.Alpha = g.DisabledAlphaBackup - g.CurrentItemFlags = bit32.band(g.CurrentItemFlags, bit32.bnot(ImGuiItemFlags.Disabled)) + g.CurrentItemFlags = bit32.band(g.CurrentItemFlags, bit32.bnot(64 --[[ImGuiItemFlags.Disabled]])) g.ItemFlagsStack:push_back(g.CurrentItemFlags) g.DisabledStackSize = g.DisabledStackSize + 1 end function ImGui.EndDisabledOverrideReenable() local g = GImGui - IM_ASSERT(g.DisabledStackSize > 0) + assert(g.DisabledStackSize > 0) g.DisabledStackSize = g.DisabledStackSize - 1 g.ItemFlagsStack:pop_back() g.CurrentItemFlags = g.ItemFlagsStack:back() @@ -13081,7 +13115,7 @@ local function FindHoveredWindowEx(pos, find_first_and_in_any_viewport) if (find_first_and_in_any_viewport == false and g.MovingWindow) then backup_moving_window_viewport = g.MovingWindow.Viewport g.MovingWindow.Viewport = g.MouseViewport - if (bit32.band(g.MovingWindow.Flags, ImGuiWindowFlags.NoMouseInputs) == 0) then + if (bit32.band(g.MovingWindow.Flags, 512 --[[ImGuiWindowFlags.NoMouseInputs]]) == 0) then hovered_window = g.MovingWindow end end @@ -13097,18 +13131,18 @@ local function FindHoveredWindowEx(pos, find_first_and_in_any_viewport) if not window.WasActive or window.Hidden then break end - if bit32.band(window.Flags, ImGuiWindowFlags.NoMouseInputs) ~= 0 then + if bit32.band(window.Flags, 512 --[[ImGuiWindowFlags.NoMouseInputs]]) ~= 0 then break end - IM_ASSERT(window.Viewport) + assert(window.Viewport) if (window.Viewport ~= g.MouseViewport) then break end -- Using the clipped AABB, a child window will typically be clipped by its parent (not always) local hit_padding - if bit32.band(window.Flags, bit32.bor(ImGuiWindowFlags.NoResize, ImGuiWindowFlags.AlwaysAutoResize)) ~= 0 then + if bit32.band(window.Flags, bit32.bor(2 --[[ImGuiWindowFlags.NoResize]], 64 --[[ImGuiWindowFlags.AlwaysAutoResize]])) ~= 0 then hit_padding = padding_regular else hit_padding = padding_for_resize @@ -13170,7 +13204,7 @@ function ImGui.UpdateHoveredWindowAndCaptureFlags(mouse_pos) -- - We also support the moved window toggling the NoInputs flag after moving has started in order to be able to detect windows below it, which is useful for e.g. docking mechanisms. local clear_hovered_windows = false g.HoveredWindow, g.HoveredWindowUnderMovingWindow = FindHoveredWindowEx(mouse_pos, false) - IM_ASSERT(g.HoveredWindow == nil or g.HoveredWindow == g.MovingWindow or g.HoveredWindow.Viewport == g.MouseViewport) + assert(g.HoveredWindow == nil or g.HoveredWindow == g.MovingWindow or g.HoveredWindow.Viewport == g.MouseViewport) g.HoveredWindowBeforeClear = g.HoveredWindow -- Modal windows prevents mouse from hovering behind them. @@ -13180,7 +13214,7 @@ function ImGui.UpdateHoveredWindowAndCaptureFlags(mouse_pos) end -- Disabled mouse hovering (we don't currently clear MousePos, we could) - if bit32.band(io.ConfigFlags, ImGuiConfigFlags.NoMouse) ~= 0 then + if bit32.band(io.ConfigFlags, 16 --[[ImGuiConfigFlags.NoMouse]]) ~= 0 then clear_hovered_windows = true end @@ -13210,7 +13244,7 @@ function ImGui.UpdateHoveredWindowAndCaptureFlags(mouse_pos) -- If mouse was first clicked outside of ImGui bounds we also cancel out hovering. -- FIXME: For patterns of drag and drop across OS windows, we may need to rework/remove this test (first committed 311c0ca9 on 2015/02) - local mouse_dragging_extern_payload = g.DragDropActive and bit32.band(g.DragDropSourceFlags, ImGuiDragDropFlags.SourceExtern) ~= 0 + local mouse_dragging_extern_payload = g.DragDropActive and bit32.band(g.DragDropSourceFlags, 16 --[[ImGuiDragDropFlags.SourceExtern]]) ~= 0 if not mouse_avail and not mouse_dragging_extern_payload then clear_hovered_windows = true end @@ -13232,10 +13266,10 @@ function ImGui.UpdateHoveredWindowAndCaptureFlags(mouse_pos) -- Update io.WantCaptureKeyboard for the user application (true = dispatch keyboard info to Dear ImGui only, false = dispatch keyboard info to Dear ImGui + underlying app) io.WantCaptureKeyboard = false - if bit32.band(io.ConfigFlags, ImGuiConfigFlags.NoKeyboard) == 0 then + if bit32.band(io.ConfigFlags, 64 --[[ImGuiConfigFlags.NoKeyboard]]) == 0 then if (g.ActiveId ~= 0) or (modal_window ~= nil) then io.WantCaptureKeyboard = true - elseif io.NavActive and bit32.band(io.ConfigFlags, ImGuiConfigFlags.NavEnableKeyboard) ~= 0 and io.ConfigNavCaptureKeyboard then + elseif io.NavActive and bit32.band(io.ConfigFlags, 1 --[[ImGuiConfigFlags.NavEnableKeyboard]]) ~= 0 and io.ConfigNavCaptureKeyboard then io.WantCaptureKeyboard = true end end @@ -13251,7 +13285,7 @@ end --- @param v bool --- @param analog_value float function ImGui.UpdateAliasKey(key, v, analog_value) - IM_ASSERT(ImGui.IsAliasKey(key)) + assert(ImGui.IsAliasKey(key)) local key_data = ImGui.GetKeyData(nil, key) key_data.Down = v key_data.AnalogValue = analog_value @@ -13263,10 +13297,10 @@ function ImGui.GetMergedModsFromKeys() -- Bypass IsKeyDown() for the unlikely case where user used a ImGuiInputFlags.LockXXXX on those. local mods = 0 - if ImGui.GetKeyData(g, ImGuiMod_Ctrl).Down then mods = bit32.bor(mods, ImGuiMod_Ctrl) end - if ImGui.GetKeyData(g, ImGuiMod_Shift).Down then mods = bit32.bor(mods, ImGuiMod_Shift) end - if ImGui.GetKeyData(g, ImGuiMod_Alt).Down then mods = bit32.bor(mods, ImGuiMod_Alt) end - if ImGui.GetKeyData(g, ImGuiMod_Super).Down then mods = bit32.bor(mods, ImGuiMod_Super) end + if ImGui.GetKeyData(g, 4096 --[[ImGuiMod_Ctrl]]).Down then mods = bit32.bor(mods, 4096 --[[ImGuiMod_Ctrl]]) end + if ImGui.GetKeyData(g, 8192 --[[ImGuiMod_Shift]]).Down then mods = bit32.bor(mods, 8192 --[[ImGuiMod_Shift]]) end + if ImGui.GetKeyData(g, 16384 --[[ImGuiMod_Alt]]).Down then mods = bit32.bor(mods, 16384 --[[ImGuiMod_Alt]]) end + if ImGui.GetKeyData(g, 32768 --[[ImGuiMod_Super]]).Down then mods = bit32.bor(mods, 32768 --[[ImGuiMod_Super]]) end return mods end @@ -13275,7 +13309,7 @@ function ImGui.UpdateKeyboardInputs() local g = GImGui local io = g.IO - if bit32.band(io.ConfigFlags, ImGuiConfigFlags.NoKeyboard) ~= 0 then + if bit32.band(io.ConfigFlags, 64 --[[ImGuiConfigFlags.NoKeyboard]]) ~= 0 then io:ClearInputKeys() end @@ -13283,8 +13317,8 @@ function ImGui.UpdateKeyboardInputs() for n = 0, 2 do -- TODO: ImGuiMouseButton.COUNT - 1 ImGui.UpdateAliasKey(ImGui.MouseButtonToKey(n), io.MouseDown[n], io.MouseDown[n] and 1.0 or 0.0) end - ImGui.UpdateAliasKey(ImGuiKey.MouseWheelX, io.MouseWheelH ~= 0.0, io.MouseWheelH) - ImGui.UpdateAliasKey(ImGuiKey.MouseWheelY, io.MouseWheel ~= 0.0, io.MouseWheel) + ImGui.UpdateAliasKey(661 --[[ImGuiKey.MouseWheelX]], io.MouseWheelH ~= 0.0, io.MouseWheelH) + ImGui.UpdateAliasKey(662 --[[ImGuiKey.MouseWheelY]], io.MouseWheel ~= 0.0, io.MouseWheel) -- Synchronize io.KeyMods and io.KeyCtrl/io.KeyShift/etc. values. -- - New backends (1.87+): send io.AddKeyEvent(ImGuiMod_XXX) -> -> (here) deriving io.KeyMods + io.KeyXXX from key array. @@ -13292,10 +13326,10 @@ function ImGui.UpdateKeyboardInputs() -- So with legacy backends the 4 values will do a unnecessary back-and-forth but it makes the code simpler and future facing. local prev_key_mods = io.KeyMods io.KeyMods = ImGui.GetMergedModsFromKeys() - io.KeyCtrl = bit32.band(io.KeyMods, ImGuiMod_Ctrl) ~= 0 - io.KeyShift = bit32.band(io.KeyMods, ImGuiMod_Shift) ~= 0 - io.KeyAlt = bit32.band(io.KeyMods, ImGuiMod_Alt) ~= 0 - io.KeySuper = bit32.band(io.KeyMods, ImGuiMod_Super) ~= 0 + io.KeyCtrl = bit32.band(io.KeyMods, 4096 --[[ImGuiMod_Ctrl]]) ~= 0 + io.KeyShift = bit32.band(io.KeyMods, 8192 --[[ImGuiMod_Shift]]) ~= 0 + io.KeyAlt = bit32.band(io.KeyMods, 16384 --[[ImGuiMod_Alt]]) ~= 0 + io.KeySuper = bit32.band(io.KeyMods, 32768 --[[ImGuiMod_Super]]) ~= 0 if prev_key_mods ~= io.KeyMods then g.LastKeyModsChangeTime = g.Time end @@ -13304,16 +13338,16 @@ function ImGui.UpdateKeyboardInputs() end -- Clear gamepad data if disabled - if bit32.band(io.BackendFlags, ImGuiBackendFlags.HasGamepad) == 0 then - for key = ImGuiKey_Gamepad_BEGIN, ImGuiKey_Gamepad_END - 1 do - io.KeysData[key - ImGuiKey.NamedKey_BEGIN].Down = false - io.KeysData[key - ImGuiKey.NamedKey_BEGIN].AnalogValue = 0.0 + if bit32.band(io.BackendFlags, 1 --[[ImGuiBackendFlags.HasGamepad]]) == 0 then + for key = 632 --[[ImGuiKey_Gamepad_BEGIN]], 656 --[[ImGuiKey_Gamepad_END]] - 1 do + io.KeysData[key - 512 --[[ImGuiKey.NamedKey_BEGIN]]].Down = false + io.KeysData[key - 512 --[[ImGuiKey.NamedKey_BEGIN]]].AnalogValue = 0.0 end end -- Update keys - for key = ImGuiKey.NamedKey_BEGIN, ImGuiKey.NamedKey_END - 1 do - local key_data = io.KeysData[key - ImGuiKey.NamedKey_BEGIN] + for key = 512 --[[ImGuiKey.NamedKey_BEGIN]], 667 --[[ImGuiKey.NamedKey_END]] - 1 do + local key_data = io.KeysData[key - 512 --[[ImGuiKey.NamedKey_BEGIN]]] key_data.DownDurationPrev = key_data.DownDuration if key_data.Down then if key_data.DownDuration < 0.0 then @@ -13327,19 +13361,19 @@ function ImGui.UpdateKeyboardInputs() if key_data.DownDuration == 0.0 then if ImGui.IsKeyboardKey(key) then g.LastKeyboardKeyPressTime = g.Time - elseif key == ImGuiKey.ReservedForModCtrl or key == ImGuiKey.ReservedForModShift or key == ImGuiKey.ReservedForModAlt or key == ImGuiKey.ReservedForModSuper then + elseif key == 663 --[[ImGuiKey.ReservedForModCtrl]] or key == 664 --[[ImGuiKey.ReservedForModShift]] or key == 665 --[[ImGuiKey.ReservedForModAlt]] or key == 666 --[[ImGuiKey.ReservedForModSuper]] then g.LastKeyboardKeyPressTime = g.Time end end end -- Update keys/input owner (named keys only): one entry per key - for key = ImGuiKey.NamedKey_BEGIN, ImGuiKey.NamedKey_END - 1 do - local key_data = io.KeysData[key - ImGuiKey.NamedKey_BEGIN] - local owner_data = g.KeysOwnerData[key - ImGuiKey.NamedKey_BEGIN] + for key = 512 --[[ImGuiKey.NamedKey_BEGIN]], 667 --[[ImGuiKey.NamedKey_END]] - 1 do + local key_data = io.KeysData[key - 512 --[[ImGuiKey.NamedKey_BEGIN]]] + local owner_data = g.KeysOwnerData[key - 512 --[[ImGuiKey.NamedKey_BEGIN]]] owner_data.OwnerCurr = owner_data.OwnerNext if not key_data.Down then -- Important: ownership is released on the frame after a release. Ensure a 'MouseDown -> CloseWindow -> MouseUp' chain doesn't lead to someone else seeing the MouseUp. - owner_data.OwnerNext = ImGuiKeyOwner_NoOwner + owner_data.OwnerNext = 4294967295 --[[ImGuiKeyOwner_NoOwner]] end owner_data.LockThisFrame = owner_data.LockUntilRelease and key_data.Down owner_data.LockUntilRelease = owner_data.LockUntilRelease and key_data.Down -- Clear LockUntilRelease when key is not Down anymore @@ -13378,7 +13412,7 @@ function ImGui.UpdateMouseInputs() -- Update stationary timer. -- FIXME: May need to rework again to have some tolerance for occasional small movement, while being functional on high-framerates. - local mouse_stationary_threshold = (io.MouseSource == ImGuiMouseSource.Mouse) and 2.0 or 3.0 -- Slightly higher threshold for ImGuiMouseSource.TouchScreen/ImGuiMouseSource.Pen, may need rework. + local mouse_stationary_threshold = (io.MouseSource == 0 --[[ImGuiMouseSource.Mouse]]) and 2.0 or 3.0 -- Slightly higher threshold for ImGuiMouseSource.TouchScreen/ImGuiMouseSource.Pen, may need rework. local mouse_stationary = (ImLengthSqr(io.MouseDelta) <= mouse_stationary_threshold * mouse_stationary_threshold) g.MouseStationaryTimer = mouse_stationary and (g.MouseStationaryTimer + io.DeltaTime) or 0.0 -- IMGUI_DEBUG_LOG("%.4f\n", g.MouseStationaryTimer) @@ -13482,17 +13516,17 @@ local function FindBestWheelingWindow(wheel) -- For each axis, find window in the hierarchy that may want to use scrolling local g = GImGui local windows = {nil, nil} - for axis = ImGuiAxis.X, ImGuiAxis.Y do + for axis = 1 --[[ImGuiAxis.X]], 2 --[[ImGuiAxis.Y]] do if wheel[axis] ~= 0.0 then windows[axis] = g.HoveredWindow local window = g.HoveredWindow - while bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 do + while bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 do -- Bubble up into parent window if: -- - a child window doesn't allow any scrolling. -- - a child window has the ImGuiWindowFlags.NoScrollWithMouse flag. -- -- - a child window doesn't need scrolling because it is already at the edge for the direction we are going in (FIXME-WIP) local has_scrolling = (window.ScrollMax[axis] ~= 0.0) - local inputs_disabled = (bit32.band(window.Flags, ImGuiWindowFlags.NoScrollWithMouse) ~= 0) and not (bit32.band(window.Flags, ImGuiWindowFlags.NoMouseInputs) ~= 0) + local inputs_disabled = (bit32.band(window.Flags, 16 --[[ImGuiWindowFlags.NoScrollWithMouse]]) ~= 0) and not (bit32.band(window.Flags, 512 --[[ImGuiWindowFlags.NoMouseInputs]]) ~= 0) -- local scrolling_past_limits = (wheel_v < 0.0) and (window.Scroll[axis] <= 0.0) or (window.Scroll[axis] >= window.ScrollMax[axis]) if has_scrolling and not inputs_disabled then -- and not scrolling_past_limits @@ -13550,12 +13584,12 @@ function ImGui.UpdateMouseWheel() local owner_id = mouse_window.ID local wheel = ImVec2() - wheel.x = ImGui.TestKeyOwner(ImGuiKey.MouseWheelX, owner_id) and g.IO.MouseWheelH or 0.0 - wheel.y = ImGui.TestKeyOwner(ImGuiKey.MouseWheelY, owner_id) and g.IO.MouseWheel or 0.0 + wheel.x = ImGui.TestKeyOwner(661 --[[ImGuiKey.MouseWheelX]], owner_id) and g.IO.MouseWheelH or 0.0 + wheel.y = ImGui.TestKeyOwner(662 --[[ImGuiKey.MouseWheelY]], owner_id) and g.IO.MouseWheel or 0.0 -- IMGUI_DEBUG_LOG("MouseWheel X:%.3f Y:%.3f\n", wheel_x, wheel_y) if g.WheelingWindow ~= nil then - ImGui.SetKeyOwner(ImGuiKey.MouseWheelX, owner_id) - ImGui.SetKeyOwner(ImGuiKey.MouseWheelY, owner_id) + ImGui.SetKeyOwner(661 --[[ImGuiKey.MouseWheelX]], owner_id) + ImGui.SetKeyOwner(662 --[[ImGuiKey.MouseWheelY]], owner_id) end -- Zoom / Scale window @@ -13605,14 +13639,14 @@ function ImGui.UpdateMouseWheel() window = FindBestWheelingWindow(wheel) end if window then - if not (bit32.band(window.Flags, ImGuiWindowFlags.NoScrollWithMouse) ~= 0) and not (bit32.band(window.Flags, ImGuiWindowFlags.NoMouseInputs) ~= 0) then + if not (bit32.band(window.Flags, 16 --[[ImGuiWindowFlags.NoScrollWithMouse]]) ~= 0) and not (bit32.band(window.Flags, 512 --[[ImGuiWindowFlags.NoMouseInputs]]) ~= 0) then local do_scroll = { wheel.x ~= 0.0 and window.ScrollMax.x ~= 0.0, wheel.y ~= 0.0 and window.ScrollMax.y ~= 0.0 } - if do_scroll[ImGuiAxis.X] and do_scroll[ImGuiAxis.Y] then - do_scroll[(g.WheelingAxisAvg.x > g.WheelingAxisAvg.y) and ImGuiAxis.Y or ImGuiAxis.X] = false + if do_scroll[1 --[[ImGuiAxis.X]]] and do_scroll[2 --[[ImGuiAxis.Y]]] then + do_scroll[(g.WheelingAxisAvg.x > g.WheelingAxisAvg.y) and 2 --[[ImGuiAxis.Y]] or 1 --[[ImGuiAxis.X]]] = false end - if do_scroll[ImGuiAxis.X] then + if do_scroll[1 --[[ImGuiAxis.X]]] then LockWheelingWindow(window, wheel.x) local max_step = window.InnerRect:GetWidth() * 0.67 local scroll_step = ImTrunc(ImMin(2 * window.FontRefSize, max_step)) @@ -13620,7 +13654,7 @@ function ImGui.UpdateMouseWheel() g.WheelingWindowScrolledFrame = g.FrameCount end - if do_scroll[ImGuiAxis.Y] then + if do_scroll[2 --[[ImGuiAxis.Y]]] then LockWheelingWindow(window, wheel.y) local max_step = window.InnerRect:GetHeight() * 0.67 local scroll_step = ImTrunc(ImMin(5 * window.FontRefSize, max_step)) @@ -13635,25 +13669,25 @@ end -- FIXME-VIEWPORT: the concept of a single ClipRectFullscreen is not ideal! local function SetupDrawListSharedData() local g = GImGui - local virtual_space = ImRect(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX) + local virtual_space = ImRect(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]]) for _, viewport in g.Viewports:iter() do virtual_space:Add(viewport:GetMainRect()) end g.DrawListSharedData.ClipRectFullscreen = virtual_space:ToVec4() g.DrawListSharedData.CurveTessellationTol = g.Style.CurveTessellationTol g.DrawListSharedData:SetCircleTessellationMaxError(g.Style.CircleTessellationMaxError) - g.DrawListSharedData.InitialFlags = ImDrawListFlags.None + g.DrawListSharedData.InitialFlags = 0 --[[ImDrawListFlags.None]] if g.Style.AntiAliasedLines then - g.DrawListSharedData.InitialFlags = bit32.bor(g.DrawListSharedData.InitialFlags, ImDrawListFlags.AntiAliasedLines) + g.DrawListSharedData.InitialFlags = bit32.bor(g.DrawListSharedData.InitialFlags, 1 --[[ImDrawListFlags.AntiAliasedLines]]) end - if g.Style.AntiAliasedLinesUseTex and not bit32.band(g.IO.Fonts.Flags, ImFontAtlasFlags.NoBakedLines) then - g.DrawListSharedData.InitialFlags = bit32.bor(g.DrawListSharedData.InitialFlags, ImDrawListFlags.AntiAliasedLinesUseTex) + if g.Style.AntiAliasedLinesUseTex and not bit32.band(g.IO.Fonts.Flags, 4 --[[ImFontAtlasFlags.NoBakedLines]]) then + g.DrawListSharedData.InitialFlags = bit32.bor(g.DrawListSharedData.InitialFlags, 2 --[[ImDrawListFlags.AntiAliasedLinesUseTex]]) end if g.Style.AntiAliasedFill then - g.DrawListSharedData.InitialFlags = bit32.bor(g.DrawListSharedData.InitialFlags, ImDrawListFlags.AntiAliasedFill) + g.DrawListSharedData.InitialFlags = bit32.bor(g.DrawListSharedData.InitialFlags, 4 --[[ImDrawListFlags.AntiAliasedFill]]) end - if bit32.band(g.IO.BackendFlags, ImGuiBackendFlags.RendererHasVtxOffset) then - g.DrawListSharedData.InitialFlags = bit32.bor(g.DrawListSharedData.InitialFlags, ImDrawListFlags.AllowVtxOffset) + if bit32.band(g.IO.BackendFlags, 8 --[[ImGuiBackendFlags.RendererHasVtxOffset]]) then + g.DrawListSharedData.InitialFlags = bit32.bor(g.DrawListSharedData.InitialFlags, 8 --[[ImDrawListFlags.AllowVtxOffset]]) end g.DrawListSharedData.InitialFringeScale = 1.0 end @@ -13674,7 +13708,7 @@ local function InitViewportDrawData(viewport) -- FIXME: Note that we however do NOT attempt to report "zero drawlist / vertices" into the ImDrawData structure. -- This is because the work has been done already, and its wasted! We should fix that and add optimizations for -- it earlier in the pipeline, rather than pretend to hide the data at the end of the pipeline. - local is_minimized = bit32.band(viewport.Flags, ImGuiViewportFlags.IsMinimized) ~= 0 + local is_minimized = bit32.band(viewport.Flags, 4096 --[[ImGuiViewportFlags.IsMinimized]]) ~= 0 draw_data.Valid = true draw_data.FrameCount = g.FrameCount @@ -13753,7 +13787,7 @@ end local function GetViewportBgFgDrawList(viewport, drawlist_no, drawlist_name) -- Create the draw list on demand, because they are not frequently used for all viewports local g = GImGui - IM_ASSERT(drawlist_no <= 2) -- IM_COUNTOF(viewport->BgFgDrawLists) + assert(drawlist_no <= 2) -- IM_COUNTOF(viewport->BgFgDrawLists) local draw_list = viewport.BgFgDrawLists[drawlist_no] if draw_list == nil then draw_list = ImDrawList(g.DrawListSharedData) @@ -13801,11 +13835,11 @@ end --- @param rhs ImGuiWindow local function ChildWindowComparer(lhs, rhs) local a, b = lhs, rhs - local d = (bit32.band(a.Flags, ImGuiWindowFlags.Popup) ~= 0 and 1 or 0) - (bit32.band(b.Flags, ImGuiWindowFlags.Popup) ~= 0 and 1 or 0) + local d = (bit32.band(a.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 and 1 or 0) - (bit32.band(b.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 and 1 or 0) if d ~= 0 then return (d < 0) end - d = (bit32.band(a.Flags, ImGuiWindowFlags.Tooltip) ~= 0 and 1 or 0) - (bit32.band(b.Flags, ImGuiWindowFlags.Tooltip) ~= 0 and 1 or 0) + d = (bit32.band(a.Flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0 and 1 or 0) - (bit32.band(b.Flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0 and 1 or 0) if d ~= 0 then return (d < 0) end @@ -13845,7 +13879,7 @@ end --- @param window ImGuiWindow local function GetWindowDisplayLayer(window) - return (bit32.band(window.Flags, ImGuiWindowFlags.Tooltip) ~= 0) and 2 or 1 + return (bit32.band(window.Flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0) and 2 or 1 end -- Layer is locked for the root window, however child windows may use a different viewport (e.g. extruding menu) @@ -13880,7 +13914,7 @@ local function FlattenDrawDataIntoSingleLayer(builder) end function ImGui.NewFrame() - IM_ASSERT(GImGui ~= nil, "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?") + assert(GImGui ~= nil, "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?") local g = GImGui g.ConfigFlagsLastFrame = g.ConfigFlagsCurrFrame @@ -13905,7 +13939,7 @@ function ImGui.NewFrame() if g.FramerateSecPerFrameAccum > 0 then g.IO.Framerate = (1.0 / (g.FramerateSecPerFrameAccum / g.FramerateSecPerFrameCount)) else - g.IO.Framerate = FLT_MAX + g.IO.Framerate = 3.4028234663853e+38 --[[FLT_MAX]] end -- Process input queue (trickle as many events as possible), turn events into writes to IO structure @@ -14049,8 +14083,8 @@ function ImGui.NewFrame() g.DragDropAcceptIdPrev = g.DragDropAcceptIdCurr g.DragDropAcceptIdCurr = 0 g.DragDropAcceptFlagsPrev = g.DragDropAcceptFlagsCurr - g.DragDropAcceptFlagsCurr = ImGuiDragDropFlags.None - g.DragDropAcceptIdCurrRectSurface = FLT_MAX + g.DragDropAcceptFlagsCurr = 0 --[[ImGuiDragDropFlags.None]] + g.DragDropAcceptIdCurrRectSurface = 3.4028234663853e+38 --[[FLT_MAX]] g.DragDropWithinSource = false g.DragDropWithinTarget = false g.DragDropHoldJustPressedId = 0 @@ -14060,7 +14094,7 @@ function ImGui.NewFrame() -- 'if (GetDragDropPayload() ~= nil) then Shortcut(ImGuiKey.Escape, ImGuiInputFlags.RouteGlobal | ImGuiInputFlags.RouteOverActive) end -- but you will not get a return value from Shortcut() due to ActiveIdUsingAllKeyboardKeys logic. You can however poll IsKeyPressed(ImGuiKey.Escape) afterwards. local owner_id = (g.ActiveId ~= 0) and g.ActiveId or ImHashStr("##DragDropCancelHandler") - if ImGui.Shortcut(ImGuiKey.Escape, ImGuiInputFlags.RouteGlobal, owner_id) then + if ImGui.Shortcut(526 --[[ImGuiKey.Escape]], 4096 --[[ImGuiInputFlags.RouteGlobal]], owner_id) then ImGui.ClearActiveID() ImGui.ClearDragDrop() end @@ -14078,9 +14112,9 @@ function ImGui.NewFrame() ImGui.DockContextNewFrameUpdateUndocking(g) -- Mark all windows as not visible and compact unused memory. - IM_ASSERT(g.WindowsFocusOrder.Size <= g.Windows.Size) + assert(g.WindowsFocusOrder.Size <= g.Windows.Size) local gc_all = g.GcCompactAll or g.IO.ConfigMemoryCompactTimer < 0.0 - local memory_compact_start_time = gc_all and FLT_MAX or (g.Time - g.IO.ConfigMemoryCompactTimer) + local memory_compact_start_time = gc_all and 3.4028234663853e+38 --[[FLT_MAX]] or (g.Time - g.IO.ConfigMemoryCompactTimer) for _, window in g.Windows:iter() do window.WasActive = window.Active @@ -14110,7 +14144,7 @@ function ImGui.NewFrame() g.DimBgRatio = ImMax(g.DimBgRatio - g.IO.DeltaTime * 10.0, 0.0) end - g.MouseCursor = ImGuiMouseCursor.Arrow + g.MouseCursor = 0 --[[ImGuiMouseCursor.Arrow]] g.WantCaptureMouseNextFrame = -1 g.WantCaptureKeyboardNextFrame = -1 g.WantTextInputNextFrame = -1 @@ -14142,7 +14176,7 @@ function ImGui.NewFrame() -- Closing the focused window restore focus to the first active root window in descending z-order if (g.NavWindow and not g.NavWindow.WasActive) then - ImGui.FocusTopMostWindowUnderOne(nil, nil, nil, ImGuiFocusRequestFlags.RestoreFocusedChild) + ImGui.FocusTopMostWindowUnderOne(nil, nil, nil, 1 --[[ImGuiFocusRequestFlags.RestoreFocusedChild]]) end -- No window should be open at the beginning of the frame. @@ -14150,7 +14184,7 @@ function ImGui.NewFrame() g.CurrentWindowStack:resize(0) g.BeginPopupStack:resize(0) g.ItemFlagsStack:resize(0) - g.ItemFlagsStack:push_back(ImGuiItemFlags.Default_) -- Default flags + g.ItemFlagsStack:push_back(144 --[[ImGuiItemFlags.Default_]]) -- Default flags g.CurrentItemFlags = g.ItemFlagsStack:back() g.GroupStack:resize(0) @@ -14164,9 +14198,9 @@ function ImGui.NewFrame() -- We don't use "Debug" to avoid colliding with user trying to create a "Debug" window with custom flags. -- This fallback is particularly important as it prevents ImGui:: calls from crashing. g.WithinFrameScopeWithImplicitWindow = true - ImGui.SetNextWindowSize(ImVec2(400, 400), ImGuiCond.FirstUseEver) + ImGui.SetNextWindowSize(ImVec2(400, 400), 4 --[[ImGuiCond.FirstUseEver]]) ImGui.Begin("Debug##Default") - IM_ASSERT(g.CurrentWindow.IsFallbackWindow == true) + assert(g.CurrentWindow.IsFallbackWindow == true) -- Store stack sizes g.ErrorCountCurrentFrame = 0 @@ -14177,7 +14211,7 @@ end -- This is normally called by Render(). You may want to call it directly if you want to avoid calling Render() but the gain will be very minimal. function ImGui.EndFrame() local g = GImGui - IM_ASSERT(g.Initialized) + assert(g.Initialized) -- Don't process EndFrame() multiple times. if g.FrameCountEnded == g.FrameCount then @@ -14221,7 +14255,7 @@ function ImGui.EndFrame() -- Drag and Drop: Elapse payload (if delivered, or if source stops being submitted) if g.DragDropActive then local is_delivered = g.DragDropPayload.Delivery - local is_elapsed = (g.DragDropSourceFrameCount + 1 < g.FrameCount) and (bit32.band(g.DragDropSourceFlags, ImGuiDragDropFlags.PayloadAutoExpire) ~= 0 or g.DragDropMouseButton == -1 or not ImGui.IsMouseDown(g.DragDropMouseButton)) + local is_elapsed = (g.DragDropSourceFrameCount + 1 < g.FrameCount) and (bit32.band(g.DragDropSourceFlags, 32 --[[ImGuiDragDropFlags.PayloadAutoExpire]]) ~= 0 or g.DragDropMouseButton == -1 or not ImGui.IsMouseDown(g.DragDropMouseButton)) if is_delivered or is_elapsed then ImGui.ClearDragDrop() end end @@ -14230,7 +14264,7 @@ function ImGui.EndFrame() -- in the BeginDragDropSource() block of the dragged item, you can submit them from a safe single spot -- (e.g. end of your item loop, or before EndFrame) by reading payload data. -- In the typical case, the contents of drag tooltip should be possible to infer solely from payload data. - if g.DragDropActive and g.DragDropSourceFrameCount + 1 < g.FrameCount and (bit32.band(g.DragDropSourceFlags, ImGuiDragDropFlags.SourceNoPreviewTooltip) == 0) then + if g.DragDropActive and g.DragDropSourceFrameCount + 1 < g.FrameCount and (bit32.band(g.DragDropSourceFlags, 1 --[[ImGuiDragDropFlags.SourceNoPreviewTooltip]]) == 0) then g.DragDropWithinSource = true ImGui.SetTooltip("...") g.DragDropWithinSource = false @@ -14253,7 +14287,7 @@ function ImGui.EndFrame() g.WindowsTempSortBuffer:reserve(g.Windows.Size) for _, window in g.Windows:iter() do repeat - if window.Active and bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 then -- if a child is active its parent will add it + if window.Active and bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 then -- if a child is active its parent will add it break end @@ -14263,7 +14297,7 @@ function ImGui.EndFrame() end -- This usually assert if there is a mismatch between the ImGuiWindowFlags.ChildWindow / ParentWindow values and DC.ChildWindows[] in parents, aka we've done something wrong. - IM_ASSERT(g.Windows.Size == g.WindowsTempSortBuffer.Size) + assert(g.Windows.Size == g.WindowsTempSortBuffer.Size) g.Windows:swap(g.WindowsTempSortBuffer) g.IO.MetricsActiveWindows = g.WindowsActiveCount @@ -14288,7 +14322,7 @@ end -- it is the role of the ImGui_ImplXXXX_RenderDrawData() function provided by the renderer backend) function ImGui.Render() local g = GImGui - IM_ASSERT(g.Initialized) + assert(g.Initialized) if g.FrameCountEnded ~= g.FrameCount then ImGui.EndFrame() @@ -14311,10 +14345,10 @@ function ImGui.Render() -- Add ImDrawList to render local windows_to_render_top_most = {nil, nil} - windows_to_render_top_most[1] = (g.NavWindowingTarget and (bit32.band(g.NavWindowingTarget.Flags, ImGuiWindowFlags.NoBringToFrontOnFocus) == 0)) and g.NavWindowingTarget.RootWindowDockTree or nil + windows_to_render_top_most[1] = (g.NavWindowingTarget and (bit32.band(g.NavWindowingTarget.Flags, 8192 --[[ImGuiWindowFlags.NoBringToFrontOnFocus]]) == 0)) and g.NavWindowingTarget.RootWindowDockTree or nil windows_to_render_top_most[2] = g.NavWindowingTarget and g.NavWindowingListWindow or nil for _, window in g.Windows:iter() do - if ImGui.IsWindowActiveAndVisible(window) and (bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) == 0) and window ~= windows_to_render_top_most[1] and window ~= windows_to_render_top_most[2] then + if ImGui.IsWindowActiveAndVisible(window) and (bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0) and window ~= windows_to_render_top_most[1] and window ~= windows_to_render_top_most[2] then AddRootWindowToDrawData(window) end end @@ -14325,8 +14359,8 @@ function ImGui.Render() end -- Draw software mouse cursor if requested by io.MouseDrawCursor flag - if g.IO.MouseDrawCursor and g.MouseCursor ~= ImGuiMouseCursor.None then - ImGui.RenderMouseCursor(g.IO.MousePos, g.Style.MouseCursorScale, g.MouseCursor, IM_COL32_WHITE, IM_COL32_BLACK, IM_COL32(0, 0, 0, 48)) + if g.IO.MouseDrawCursor and g.MouseCursor ~= (-1) --[[ImGuiMouseCursor.None]] then + ImGui.RenderMouseCursor(g.IO.MousePos, g.Style.MouseCursorScale, g.MouseCursor, 4294967295 --[[IM_COL32_WHITE]], 4278190080 --[[IM_COL32_BLACK]], IM_COL32(0, 0, 0, 48)) end -- Setup ImDrawData structures for end-user @@ -14388,7 +14422,7 @@ function ImGui.CalcTextSizeEx(text, text_begin, text_end, hide_text_after_double if text == "" or (text_end and text_end <= text_begin) then return ImVec2(0.0, font_size) end - local text_size = ImFontCalcTextSizeEx(font, font_size, FLT_MAX, wrap_width, text, text_begin, text_display_end, text_display_end, nil, ImDrawTextFlags.None) -- [Luau] inline font:CalcTextSizeA() + local text_size = ImFontCalcTextSizeEx(font, font_size, 3.4028234663853e+38 --[[FLT_MAX]], wrap_width, text, text_begin, text_display_end, text_display_end, nil, 0 --[[ImDrawTextFlags.None]]) -- [Luau] inline font:CalcTextSizeA() -- Round -- (see 7b0bf230, 4622fa4b6, #791 for details about this.) @@ -14423,7 +14457,7 @@ function ImGui.Shutdown() for _, atlas in g.FontAtlases:iter() do ImGui.UnregisterFontAtlas(atlas) if atlas.OwnerContext == g then - IM_ASSERT(atlas.RefCount == 0, "Destroying context owning a ImFontAtlas which is still used elsewhere!") + assert(atlas.RefCount == 0, "Destroying context owning a ImFontAtlas which is still used elsewhere!") if atlas.RefCount == 0 then atlas.Locked = false end @@ -14463,7 +14497,7 @@ function ImGui.GetIO() return GImGui.IO end --- @return ImGuiPlatformIO function ImGui.GetPlatformIO() - IM_ASSERT(GImGui ~= nil, "No current context. Did you call ImGui.CreateContext() and ImGui.SetCurrentContext()?") + assert(GImGui ~= nil, "No current context. Did you call ImGui.CreateContext() and ImGui.SetCurrentContext()?") return GImGui.PlatformIO end @@ -14494,10 +14528,10 @@ end --- @param col_b ImU32 --- @return ImU32 function ImStd.ImAlphaBlendColors(col_a, col_b) - local t = bit32.band(bit32.rshift(col_b, IM_COL32_A_SHIFT), 0xFF) / 255.0 - local r = ImLerp(bit32.band(bit32.rshift(col_a, IM_COL32_R_SHIFT), 0xFF), bit32.band(bit32.rshift(col_b, IM_COL32_R_SHIFT), 0xFF), t) - local g = ImLerp(bit32.band(bit32.rshift(col_a, IM_COL32_G_SHIFT), 0xFF), bit32.band(bit32.rshift(col_b, IM_COL32_G_SHIFT), 0xFF), t) - local b = ImLerp(bit32.band(bit32.rshift(col_a, IM_COL32_B_SHIFT), 0xFF), bit32.band(bit32.rshift(col_b, IM_COL32_B_SHIFT), 0xFF), t) + local t = bit32.band(bit32.rshift(col_b, 24 --[[IM_COL32_A_SHIFT]]), 0xFF) / 255.0 + local r = ImLerp(bit32.band(bit32.rshift(col_a, 0 --[[IM_COL32_R_SHIFT]]), 0xFF), bit32.band(bit32.rshift(col_b, 0 --[[IM_COL32_R_SHIFT]]), 0xFF), t) + local g = ImLerp(bit32.band(bit32.rshift(col_a, 8 --[[IM_COL32_G_SHIFT]]), 0xFF), bit32.band(bit32.rshift(col_b, 8 --[[IM_COL32_G_SHIFT]]), 0xFF), t) + local b = ImLerp(bit32.band(bit32.rshift(col_a, 16 --[[IM_COL32_B_SHIFT]]), 0xFF), bit32.band(bit32.rshift(col_b, 16 --[[IM_COL32_B_SHIFT]]), 0xFF), t) return IM_COL32(r, g, b, 0xFF) end @@ -14506,10 +14540,10 @@ end --- @return ImVec4? function ImGui.ColorConvertU32ToFloat4(in_col, out_col) local s = 1.0 / 255.0 - local r = bit32.band(bit32.rshift(in_col, IM_COL32_R_SHIFT), 0xFF) * s - local g = bit32.band(bit32.rshift(in_col, IM_COL32_G_SHIFT), 0xFF) * s - local b = bit32.band(bit32.rshift(in_col, IM_COL32_B_SHIFT), 0xFF) * s - local a = bit32.band(bit32.rshift(in_col, IM_COL32_A_SHIFT), 0xFF) * s + local r = bit32.band(bit32.rshift(in_col, 0 --[[IM_COL32_R_SHIFT]]), 0xFF) * s + local g = bit32.band(bit32.rshift(in_col, 8 --[[IM_COL32_G_SHIFT]]), 0xFF) * s + local b = bit32.band(bit32.rshift(in_col, 16 --[[IM_COL32_B_SHIFT]]), 0xFF) * s + local a = bit32.band(bit32.rshift(in_col, 24 --[[IM_COL32_A_SHIFT]]), 0xFF) * s if out_col then out_col[1] = r; out_col[2] = g; out_col[3] = b; out_col[4] = a @@ -14602,7 +14636,7 @@ end ------------------------------------------------------------------------------- function ImGui.GetStyle() - IM_ASSERT(GImGui ~= nil, "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?") + assert(GImGui ~= nil, "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?") return GImGui.Style end @@ -14642,9 +14676,9 @@ function ImGui.GetColorU32(col, alpha_mul, col_is_u32) if alpha_mul >= 1.0 then return col end - local a = bit32.rshift(bit32.band(col, IM_COL32_A_MASK), IM_COL32_A_SHIFT) + local a = bit32.rshift(bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]), 24 --[[IM_COL32_A_SHIFT]]) a = math.floor(a * alpha_mul) -- We don't need to clamp 0..255 because alpha is in 0..1 range. - return bit32.bor(bit32.band(col, bit32.bnot(IM_COL32_A_MASK)), bit32.lshift(a, IM_COL32_A_SHIFT)) + return bit32.bor(bit32.band(col, bit32.bnot(4278190080 --[[IM_COL32_A_MASK]])), bit32.lshift(a, 24 --[[IM_COL32_A_SHIFT]])) end end @@ -14738,7 +14772,7 @@ local GStyleVarsInfo = { --- @param idx ImGuiStyleVar --- @return ImGuiStyleVarInfo function ImGui.GetStyleVarInfo(idx) - IM_ASSERT(idx >= 0 and idx < ImGuiStyleVar.COUNT) + assert(idx >= 0 and idx < 43 --[[ImGuiStyleVar.COUNT]]) -- IM_STATIC_ASSERT(IM_COUNTOF(GStyleVarsInfo) == ImGuiStyleVar.COUNT) return GStyleVarsInfo[idx + 1] end @@ -14749,9 +14783,9 @@ function ImGui.PushStyleVar(idx, val) local g = GImGui local var_info = ImGui.GetStyleVarInfo(idx) if type(val) == "number" then - IM_ASSERT_USER_ERROR_RET(var_info.DataType == ImGuiDataType.Float and var_info.Count == 1, "Calling PushStyleVar() with wrong type!") + IM_ASSERT_USER_ERROR_RET(var_info.DataType == 6 --[[ImGuiDataType.Float]] and var_info.Count == 1, "Calling PushStyleVar() with wrong type!") else -- ImVec2 - IM_ASSERT_USER_ERROR_RET(var_info.DataType == ImGuiDataType.Float and var_info.Count == 2, "Calling PushStyleVar() with wrong type!") + IM_ASSERT_USER_ERROR_RET(var_info.DataType == 6 --[[ImGuiDataType.Float]] and var_info.Count == 2, "Calling PushStyleVar() with wrong type!") end local var = g.Style[var_info.Key] g.StyleVarStack:push_back(ImGuiStyleMod(idx, var)) @@ -14767,7 +14801,7 @@ end function ImGui.PushStyleVarX(idx, val_x) local g = GImGui local var_info = ImGui.GetStyleVarInfo(idx) - IM_ASSERT_USER_ERROR_RET(var_info.DataType == ImGuiDataType.Float and var_info.Count == 2, "Calling PushStyleVarX() with wrong type!") + IM_ASSERT_USER_ERROR_RET(var_info.DataType == 6 --[[ImGuiDataType.Float]] and var_info.Count == 2, "Calling PushStyleVarX() with wrong type!") local pvar = g.Style[var_info.Key] g.StyleVarStack:push_back(ImGuiStyleMod(idx, pvar)) pvar.x = val_x @@ -14778,7 +14812,7 @@ end function ImGui.PushStyleVarY(idx, val_y) local g = GImGui local var_info = ImGui.GetStyleVarInfo(idx) - IM_ASSERT_USER_ERROR_RET(var_info.DataType == ImGuiDataType.Float and var_info.Count == 2, "Calling PushStyleVarY() with wrong type!") + IM_ASSERT_USER_ERROR_RET(var_info.DataType == 6 --[[ImGuiDataType.Float]] and var_info.Count == 2, "Calling PushStyleVarY() with wrong type!") local pvar = g.Style[var_info.Key] g.StyleVarStack:push_back(ImGuiStyleMod(idx, pvar)) pvar.y = val_y @@ -14798,9 +14832,9 @@ function ImGui.PopStyleVar(count) local backup = stack.Data[stack.Size] -- [Luau] inline back()/pop_back() local var_info = ImGui.GetStyleVarInfo(backup.VarIdx) local data = g.Style[var_info.Key] - if (var_info.DataType == ImGuiDataType.Float and var_info.Count == 1) then + if (var_info.DataType == 6 --[[ImGuiDataType.Float]] and var_info.Count == 1) then g.Style[var_info.Key] = backup.BackupVal[1] - elseif (var_info.DataType == ImGuiDataType.Float and var_info.Count == 2) then + elseif (var_info.DataType == 6 --[[ImGuiDataType.Float]] and var_info.Count == 2) then data.x = backup.BackupVal[1]; data.y = backup.BackupVal[2] end stack.Size = stack.Size - 1 @@ -14931,7 +14965,7 @@ end function ImGui.IsWindowHovered(flags) if flags == nil then flags = 0 end local g = GImGui - IM_ASSERT_USER_ERROR(bit32.band(flags, bit32.bnot(ImGuiHoveredFlags.AllowedMaskForIsWindowHovered)) == 0, "Invalid flags for IsWindowHovered()!") + IM_ASSERT_USER_ERROR(bit32.band(flags, bit32.bnot(12479 --[[ImGuiHoveredFlags.AllowedMaskForIsWindowHovered]])) == 0, "Invalid flags for IsWindowHovered()!") local ref_window = g.HoveredWindow local cur_window = g.CurrentWindow @@ -14939,16 +14973,16 @@ function ImGui.IsWindowHovered(flags) return false end - if bit32.band(flags, ImGuiHoveredFlags.AnyWindow) == 0 then - IM_ASSERT(cur_window) -- Not inside a Begin()/End() - local popup_hierarchy = bit32.band(flags, ImGuiHoveredFlags.NoPopupHierarchy) == 0 - local dock_hierarchy = bit32.band(flags, ImGuiHoveredFlags.DockHierarchy) ~= 0 - if bit32.band(flags, ImGuiHoveredFlags.RootWindow) ~= 0 then + if bit32.band(flags, 4 --[[ImGuiHoveredFlags.AnyWindow]]) == 0 then + assert(cur_window) -- Not inside a Begin()/End() + local popup_hierarchy = bit32.band(flags, 8 --[[ImGuiHoveredFlags.NoPopupHierarchy]]) == 0 + local dock_hierarchy = bit32.band(flags, 16 --[[ImGuiHoveredFlags.DockHierarchy]]) ~= 0 + if bit32.band(flags, 2 --[[ImGuiHoveredFlags.RootWindow]]) ~= 0 then cur_window = GetCombinedRootWindow(cur_window, popup_hierarchy, dock_hierarchy) end local result - if bit32.band(flags, ImGuiHoveredFlags.ChildWindows) ~= 0 then + if bit32.band(flags, 1 --[[ImGuiHoveredFlags.ChildWindows]]) ~= 0 then result = ImGui.IsWindowChildOf(ref_window, cur_window, popup_hierarchy, dock_hierarchy) else result = (ref_window == cur_window) @@ -14961,7 +14995,7 @@ function ImGui.IsWindowHovered(flags) if not ImGui.IsWindowContentHoverable(ref_window, flags) then return false end - if bit32.band(flags, ImGuiHoveredFlags.AllowWhenBlockedByActiveItem) == 0 then + if bit32.band(flags, 128 --[[ImGuiHoveredFlags.AllowWhenBlockedByActiveItem]]) == 0 then if g.ActiveId ~= 0 and not g.ActiveIdAllowOverlap and g.ActiveId ~= ref_window.MoveId then return false end @@ -14972,10 +15006,10 @@ function ImGui.IsWindowHovered(flags) -- to fulfill the possibility that multiple IsWindowHovered() with varying flag could return true -- for different windows of the hierarchy. Possibly need a Hash(Current+Flags) ==> (Timer) cache. -- We can implement this for _Stationary because the data is linked to HoveredWindow rather than CurrentWindow. - if bit32.band(flags, ImGuiHoveredFlags.ForTooltip) ~= 0 then + if bit32.band(flags, 4096 --[[ImGuiHoveredFlags.ForTooltip]]) ~= 0 then flags = ApplyHoverFlagsForTooltip(flags, g.Style.HoverFlagsForTooltipMouse) end - if bit32.band(flags, ImGuiHoveredFlags.Stationary) ~= 0 and g.HoverWindowUnlockedStationaryId ~= ref_window.ID then + if bit32.band(flags, 8192 --[[ImGuiHoveredFlags.Stationary]]) ~= 0 and g.HoverWindowUnlockedStationaryId ~= ref_window.ID then return false end @@ -14993,18 +15027,18 @@ function ImGui.IsWindowFocused(flags) if ref_window == nil then return false end - if bit32.band(flags, ImGuiFocusedFlags.AnyWindow) ~= 0 then + if bit32.band(flags, 4 --[[ImGuiFocusedFlags.AnyWindow]]) ~= 0 then return true end - IM_ASSERT(cur_window) -- Not inside a Begin()/End() - local popup_hierarchy = bit32.band(flags, ImGuiFocusedFlags.NoPopupHierarchy) == 0 - local dock_hierarchy = bit32.band(flags, ImGuiFocusedFlags.DockHierarchy) ~= 0 - if bit32.band(flags, ImGuiFocusedFlags.RootWindow) ~= 0 then + assert(cur_window) -- Not inside a Begin()/End() + local popup_hierarchy = bit32.band(flags, 8 --[[ImGuiFocusedFlags.NoPopupHierarchy]]) == 0 + local dock_hierarchy = bit32.band(flags, 16 --[[ImGuiFocusedFlags.DockHierarchy]]) ~= 0 + if bit32.band(flags, 2 --[[ImGuiFocusedFlags.RootWindow]]) ~= 0 then cur_window = GetCombinedRootWindow(cur_window, popup_hierarchy, dock_hierarchy) end - if bit32.band(flags, ImGuiFocusedFlags.ChildWindows) ~= 0 then + if bit32.band(flags, 1 --[[ImGuiFocusedFlags.ChildWindows]]) ~= 0 then return ImGui.IsWindowChildOf(ref_window, cur_window, popup_hierarchy, dock_hierarchy) else return ref_window == cur_window @@ -15068,9 +15102,9 @@ function CalcNextScrollFromScrollTargetAndClamp(window) ImVec2_Copy(scroll, window.Scroll) local decoration_size = ImVec2(window.DecoOuterSizeX1 + window.DecoInnerSizeX1 + window.DecoOuterSizeX2, window.DecoOuterSizeY1 + window.DecoInnerSizeY1 + window.DecoOuterSizeY2) - for axis_n = ImGuiAxis.X, ImGuiAxis.Y do - local axis = (axis_n == ImGuiAxis.X) and "x" or "y" -- [Luau] named key: ImVec2[1]/[2] go through IM_VEC2.__index - if window.ScrollTarget[axis] < FLT_MAX then + for axis_n = 1 --[[ImGuiAxis.X]], 2 --[[ImGuiAxis.Y]] do + local axis = (axis_n == 1 --[[ImGuiAxis.X]]) and "x" or "y" -- [Luau] named key: ImVec2[1]/[2] go through IM_VEC2.__index + if window.ScrollTarget[axis] < 3.4028234663853e+38 --[[FLT_MAX]] then local center_ratio = window.ScrollTargetCenterRatio[axis] local scroll_target = window.ScrollTarget[axis] @@ -15106,30 +15140,30 @@ function ImGui.ScrollToRectEx(window, item_rect, flags) -- GetForegroundDrawList(window):AddRect(scroll_rect.Min, scroll_rect.Max, IM_COL32_WHITE) -- [DEBUG] -- Check that only one behavior is selected per axis - IM_ASSERT(bit32.band(flags, ImGuiScrollFlags.MaskX_) == 0 or ImIsPowerOfTwo(bit32.band(flags, ImGuiScrollFlags.MaskX_))) - IM_ASSERT(bit32.band(flags, ImGuiScrollFlags.MaskY_) == 0 or ImIsPowerOfTwo(bit32.band(flags, ImGuiScrollFlags.MaskY_))) + assert(bit32.band(flags, 21 --[[ImGuiScrollFlags.MaskX_]]) == 0 or ImIsPowerOfTwo(bit32.band(flags, 21 --[[ImGuiScrollFlags.MaskX_]]))) + assert(bit32.band(flags, 42 --[[ImGuiScrollFlags.MaskY_]]) == 0 or ImIsPowerOfTwo(bit32.band(flags, 42 --[[ImGuiScrollFlags.MaskY_]]))) -- Defaults local in_flags = flags - if bit32.band(flags, ImGuiScrollFlags.MaskX_) == 0 and window.ScrollbarX then - flags = bit32.bor(flags, ImGuiScrollFlags.KeepVisibleEdgeX) + if bit32.band(flags, 21 --[[ImGuiScrollFlags.MaskX_]]) == 0 and window.ScrollbarX then + flags = bit32.bor(flags, 1 --[[ImGuiScrollFlags.KeepVisibleEdgeX]]) end - if bit32.band(flags, ImGuiScrollFlags.MaskY_) == 0 then - flags = bit32.bor(flags, window.Appearing and ImGuiScrollFlags.AlwaysCenterY or ImGuiScrollFlags.KeepVisibleEdgeY) + if bit32.band(flags, 42 --[[ImGuiScrollFlags.MaskY_]]) == 0 then + flags = bit32.bor(flags, window.Appearing and 32 --[[ImGuiScrollFlags.AlwaysCenterY]] or 2 --[[ImGuiScrollFlags.KeepVisibleEdgeY]]) end local fully_visible_x = item_rect.Min.x >= scroll_rect.Min.x and item_rect.Max.x <= scroll_rect.Max.x local fully_visible_y = item_rect.Min.y >= scroll_rect.Min.y and item_rect.Max.y <= scroll_rect.Max.y - local can_be_fully_visible_x = (item_rect:GetWidth() + g.Style.ItemSpacing.x * 2.0) <= scroll_rect:GetWidth() or (window.AutoFitFramesX > 0) or bit32.band(window.Flags, ImGuiWindowFlags.AlwaysAutoResize) ~= 0 - local can_be_fully_visible_y = (item_rect:GetHeight() + g.Style.ItemSpacing.y * 2.0) <= scroll_rect:GetHeight() or (window.AutoFitFramesY > 0) or bit32.band(window.Flags, ImGuiWindowFlags.AlwaysAutoResize) ~= 0 + local can_be_fully_visible_x = (item_rect:GetWidth() + g.Style.ItemSpacing.x * 2.0) <= scroll_rect:GetWidth() or (window.AutoFitFramesX > 0) or bit32.band(window.Flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) ~= 0 + local can_be_fully_visible_y = (item_rect:GetHeight() + g.Style.ItemSpacing.y * 2.0) <= scroll_rect:GetHeight() or (window.AutoFitFramesY > 0) or bit32.band(window.Flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) ~= 0 - if bit32.band(flags, ImGuiScrollFlags.KeepVisibleEdgeX) ~= 0 and not fully_visible_x then + if bit32.band(flags, 1 --[[ImGuiScrollFlags.KeepVisibleEdgeX]]) ~= 0 and not fully_visible_x then if item_rect.Min.x < scroll_rect.Min.x or not can_be_fully_visible_x then ImGui.SetScrollFromPosX(window, item_rect.Min.x - g.Style.ItemSpacing.x - window.Pos.x, 0.0) elseif item_rect.Max.x >= scroll_rect.Max.x then ImGui.SetScrollFromPosX(window, item_rect.Max.x + g.Style.ItemSpacing.x - window.Pos.x, 1.0) end - elseif (bit32.band(flags, ImGuiScrollFlags.KeepVisibleCenterX) ~= 0 and not fully_visible_x) or bit32.band(flags, ImGuiScrollFlags.AlwaysCenterX) ~= 0 then + elseif (bit32.band(flags, 4 --[[ImGuiScrollFlags.KeepVisibleCenterX]]) ~= 0 and not fully_visible_x) or bit32.band(flags, 16 --[[ImGuiScrollFlags.AlwaysCenterX]]) ~= 0 then if can_be_fully_visible_x then ImGui.SetScrollFromPosX(window, ImTrunc((item_rect.Min.x + item_rect.Max.x) * 0.5) - window.Pos.x, 0.5) else @@ -15137,13 +15171,13 @@ function ImGui.ScrollToRectEx(window, item_rect, flags) end end - if bit32.band(flags, ImGuiScrollFlags.KeepVisibleEdgeY) ~= 0 and not fully_visible_y then + if bit32.band(flags, 2 --[[ImGuiScrollFlags.KeepVisibleEdgeY]]) ~= 0 and not fully_visible_y then if item_rect.Min.y < scroll_rect.Min.y or not can_be_fully_visible_y then ImGui.SetScrollFromPosY(window, item_rect.Min.y - g.Style.ItemSpacing.y - window.Pos.y, 0.0) elseif item_rect.Max.y >= scroll_rect.Max.y then ImGui.SetScrollFromPosY(window, item_rect.Max.y + g.Style.ItemSpacing.y - window.Pos.y, 1.0) end - elseif (bit32.band(flags, ImGuiScrollFlags.KeepVisibleCenterY) ~= 0 and not fully_visible_y) or bit32.band(flags, ImGuiScrollFlags.AlwaysCenterY) ~= 0 then + elseif (bit32.band(flags, 8 --[[ImGuiScrollFlags.KeepVisibleCenterY]]) ~= 0 and not fully_visible_y) or bit32.band(flags, 32 --[[ImGuiScrollFlags.AlwaysCenterY]]) ~= 0 then if can_be_fully_visible_y then ImGui.SetScrollFromPosY(window, ImTrunc((item_rect.Min.y + item_rect.Max.y) * 0.5) - window.Pos.y, 0.5) else @@ -15155,13 +15189,13 @@ function ImGui.ScrollToRectEx(window, item_rect, flags) local delta_scroll = next_scroll - window.Scroll -- Also scroll parent window to keep us into view if necessary - if bit32.band(flags, ImGuiScrollFlags.NoScrollParent) == 0 and bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 then + if bit32.band(flags, 64 --[[ImGuiScrollFlags.NoScrollParent]]) == 0 and bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 then -- FIXME-SCROLL: May be an option? - if bit32.band(in_flags, bit32.bor(ImGuiScrollFlags.AlwaysCenterX, ImGuiScrollFlags.KeepVisibleCenterX)) ~= 0 then - in_flags = bit32.bor(bit32.band(in_flags, bit32.bnot(ImGuiScrollFlags.MaskX_)), ImGuiScrollFlags.KeepVisibleEdgeX) + if bit32.band(in_flags, bit32.bor(16 --[[ImGuiScrollFlags.AlwaysCenterX]], 4 --[[ImGuiScrollFlags.KeepVisibleCenterX]])) ~= 0 then + in_flags = bit32.bor(bit32.band(in_flags, bit32.bnot(21 --[[ImGuiScrollFlags.MaskX_]])), 1 --[[ImGuiScrollFlags.KeepVisibleEdgeX]]) end - if bit32.band(in_flags, bit32.bor(ImGuiScrollFlags.AlwaysCenterY, ImGuiScrollFlags.KeepVisibleCenterY)) ~= 0 then - in_flags = bit32.bor(bit32.band(in_flags, bit32.bnot(ImGuiScrollFlags.MaskY_)), ImGuiScrollFlags.KeepVisibleEdgeY) + if bit32.band(in_flags, bit32.bor(32 --[[ImGuiScrollFlags.AlwaysCenterY]], 8 --[[ImGuiScrollFlags.KeepVisibleCenterY]])) ~= 0 then + in_flags = bit32.bor(bit32.band(in_flags, bit32.bnot(42 --[[ImGuiScrollFlags.MaskY_]])), 2 --[[ImGuiScrollFlags.KeepVisibleEdgeY]]) end local parent_delta = ImGui.ScrollToRectEx(window.ParentWindow, ImRect(item_rect.Min - delta_scroll, item_rect.Max - delta_scroll), in_flags) delta_scroll = delta_scroll + parent_delta @@ -15264,7 +15298,7 @@ end function ImGui.SetScrollFromPosX(window, local_x, center_x_ratio) if type(window) == "number" then window, local_x, center_x_ratio = GImGui.CurrentWindow, window, local_x end if center_x_ratio == nil then center_x_ratio = 0.5 end - IM_ASSERT(center_x_ratio >= 0.0 and center_x_ratio <= 1.0) + assert(center_x_ratio >= 0.0 and center_x_ratio <= 1.0) window.ScrollTarget.x = IM_TRUNC(local_x - window.DecoOuterSizeX1 - window.DecoInnerSizeX1 + window.Scroll.x) -- Convert local position to scroll offset window.ScrollTargetCenterRatio.x = center_x_ratio window.ScrollTargetEdgeSnapDist.x = 0.0 @@ -15276,7 +15310,7 @@ end function ImGui.SetScrollFromPosY(window, local_y, center_y_ratio) if type(window) == "number" then window, local_y, center_y_ratio = GImGui.CurrentWindow, window, local_y end if center_y_ratio == nil then center_y_ratio = 0.5 end - IM_ASSERT(center_y_ratio >= 0.0 and center_y_ratio <= 1.0) + assert(center_y_ratio >= 0.0 and center_y_ratio <= 1.0) window.ScrollTarget.y = IM_TRUNC(local_y - window.DecoOuterSizeY1 - window.DecoInnerSizeY1 + window.Scroll.y) -- Convert local position to scroll offset window.ScrollTargetCenterRatio.y = center_y_ratio window.ScrollTargetEdgeSnapDist.y = 0.0 @@ -15299,9 +15333,9 @@ function ImGui.BeginTooltipEx(tooltip_flags, extra_window_flags) -- We call SetNextWindowPos() to enforce position and disable clamping. -- See FindBestWindowPosForPopup() for positioning logic of other tooltips (not drag and drop ones). -- local tooltip_pos = g.IO.MousePos - g.ActiveIdClickOffset - g.Style.WindowPadding - local is_touchscreen = (g.IO.MouseSource == ImGuiMouseSource.TouchScreen) + local is_touchscreen = (g.IO.MouseSource == 1 --[[ImGuiMouseSource.TouchScreen]]) - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasPos) == 0 then + if bit32.band(g.NextWindowData.HasFlags, 1 --[[ImGuiNextWindowDataFlags.HasPos]]) == 0 then local tooltip_pos if is_touchscreen then tooltip_pos = g.IO.MousePos + TOOLTIP_DEFAULT_OFFSET_TOUCH * g.Style.MouseCursorScale @@ -15310,18 +15344,18 @@ function ImGui.BeginTooltipEx(tooltip_flags, extra_window_flags) end local tooltip_pivot = is_touchscreen and TOOLTIP_DEFAULT_PIVOT_TOUCH or ImVec2(0.0, 0.0) - ImGui.SetNextWindowPos(tooltip_pos, ImGuiCond.None, tooltip_pivot) + ImGui.SetNextWindowPos(tooltip_pos, 0 --[[ImGuiCond.None]], tooltip_pivot) end - local bg_alpha = g.Style.Colors[ImGuiCol.PopupBg].w * 0.60 + local bg_alpha = g.Style.Colors[4 --[[ImGuiCol.PopupBg]]].w * 0.60 ImGui.SetNextWindowBgAlpha(bg_alpha) -- PushStyleVar(ImGuiStyleVar.Alpha, g.Style.Alpha * 0.60) -- This would be nice but e.g ColorButton with checkerboard has issue with transparent colors :( - tooltip_flags = bit32.bor(tooltip_flags, ImGuiTooltipFlags.OverridePrevious) + tooltip_flags = bit32.bor(tooltip_flags, 2 --[[ImGuiTooltipFlags.OverridePrevious]]) end -- Hide previous tooltip from being displayed. We can't easily "reset" the content of a window so we create a new one. - if (bit32.band(tooltip_flags, ImGuiTooltipFlags.OverridePrevious) ~= 0) and g.TooltipPreviousWindow ~= nil and g.TooltipPreviousWindow.Active and not ImGui.IsWindowInBeginStack(g.TooltipPreviousWindow) then + if (bit32.band(tooltip_flags, 2 --[[ImGuiTooltipFlags.OverridePrevious]]) ~= 0) and g.TooltipPreviousWindow ~= nil and g.TooltipPreviousWindow.Active and not ImGui.IsWindowInBeginStack(g.TooltipPreviousWindow) then -- IMGUI_DEBUG_LOG("[tooltip] '%s' already active, using +1 for this frame\n", window_name) ImGui.SetWindowHiddenAndSkipItemsForCurrentFrame(g.TooltipPreviousWindow) g.TooltipOverrideCount = g.TooltipOverrideCount + 1 @@ -15330,7 +15364,7 @@ function ImGui.BeginTooltipEx(tooltip_flags, extra_window_flags) local window_name_template = is_dragdrop_tooltip and "##Tooltip_DragDrop_%02d" or "##Tooltip_%02d" local window_name = ImFormatString(window_name_template, g.TooltipOverrideCount) - local flags = bit32.bor(ImGuiWindowFlags.Tooltip, ImGuiWindowFlags.NoInputs, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoMove, ImGuiWindowFlags.NoResize, ImGuiWindowFlags.NoSavedSettings, ImGuiWindowFlags.AlwaysAutoResize) + local flags = bit32.bor(33554432 --[[ImGuiWindowFlags.Tooltip]], 197120 --[[ImGuiWindowFlags.NoInputs]], 1 --[[ImGuiWindowFlags.NoTitleBar]], 4 --[[ImGuiWindowFlags.NoMove]], 2 --[[ImGuiWindowFlags.NoResize]], 256 --[[ImGuiWindowFlags.NoSavedSettings]], 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) ImGui.Begin(window_name, nil, bit32.bor(flags, extra_window_flags)) -- 2023-03-09: Added bool return value to the API, but currently always returning true. @@ -15342,25 +15376,25 @@ function ImGui.BeginTooltipEx(tooltip_flags, extra_window_flags) end function ImGui.BeginTooltip() - return ImGui.BeginTooltipEx(ImGuiTooltipFlags.None, ImGuiWindowFlags.None) + return ImGui.BeginTooltipEx(0 --[[ImGuiTooltipFlags.None]], 0 --[[ImGuiWindowFlags.None]]) end function ImGui.BeginItemTooltip() - if not ImGui.IsItemHovered(ImGuiHoveredFlags.ForTooltip) then + if not ImGui.IsItemHovered(4096 --[[ImGuiHoveredFlags.ForTooltip]]) then return false end - return ImGui.BeginTooltipEx(ImGuiTooltipFlags.None, ImGuiWindowFlags.None) + return ImGui.BeginTooltipEx(0 --[[ImGuiTooltipFlags.None]], 0 --[[ImGuiWindowFlags.None]]) end function ImGui.EndTooltip() - IM_ASSERT(bit32.band(ImGui.GetCurrentWindowRead().Flags, ImGuiWindowFlags.Tooltip) ~= 0) -- Mismatched BeginTooltip()/EndTooltip() calls + assert(bit32.band(ImGui.GetCurrentWindowRead().Flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0) -- Mismatched BeginTooltip()/EndTooltip() calls ImGui.End() end --- @param fmt string --- @param ... any function ImGui.SetTooltip(fmt, ...) - if not ImGui.BeginTooltipEx(ImGuiTooltipFlags.OverridePrevious, ImGuiWindowFlags.None) then + if not ImGui.BeginTooltipEx(2 --[[ImGuiTooltipFlags.OverridePrevious]], 0 --[[ImGuiWindowFlags.None]]) then return end ImGui.TextV(fmt, ...) @@ -15372,7 +15406,7 @@ end --- @param fmt string --- @param ... any function ImGui.SetItemTooltip(fmt, ...) - if ImGui.IsItemHovered(ImGuiHoveredFlags.ForTooltip) then + if ImGui.IsItemHovered(4096 --[[ImGuiHoveredFlags.ForTooltip]]) then ImGui.SetTooltip(fmt, ...) end end @@ -15406,7 +15440,7 @@ function ImGui.FindBlockingModal(window) repeat local popup_data = g.OpenPopupStack.Data[i] local popup_window = popup_data.Window - if popup_window == nil or bit32.band(popup_window.Flags, ImGuiWindowFlags.Modal) == 0 then + if popup_window == nil or bit32.band(popup_window.Flags, 134217728 --[[ImGuiWindowFlags.Modal]]) == 0 then break end if not popup_window.Active and not popup_window.WasActive then -- Check WasActive, because this code may run before popup renders on current frame, also check Active to handle newly created windows. @@ -15454,8 +15488,8 @@ function ImGui.OpenPopupEx(id, popup_flags) local parent_window = g.CurrentWindow local current_stack_size = g.BeginPopupStack.Size - if bit32.band(popup_flags, ImGuiPopupFlags.NoOpenOverExistingPopup) ~= 0 then - if ImGui.IsPopupOpen(0, ImGuiPopupFlags.AnyPopupId) then + if bit32.band(popup_flags, 128 --[[ImGuiPopupFlags.NoOpenOverExistingPopup]]) ~= 0 then + if ImGui.IsPopupOpen(0, 1024 --[[ImGuiPopupFlags.AnyPopupId]]) then return false end end @@ -15466,7 +15500,7 @@ function ImGui.OpenPopupEx(id, popup_flags) popup_ref.RestoreNavWindow = g.NavWindow -- When popup closes focus may be restored to NavWindow (depend on window type). popup_ref.OpenFrameCount = g.FrameCount popup_ref.OpenParentId = parent_window.IDStack:back() - ImVec2_Copy(popup_ref.OpenPopupPos, ImGui.NavCalcPreferredRefPos(ImGuiWindowFlags.Popup)) + ImVec2_Copy(popup_ref.OpenPopupPos, ImGui.NavCalcPreferredRefPos(67108864 --[[ImGuiWindowFlags.Popup]])) if ImGui.IsMousePosValid(g.IO.MousePos) then ImVec2_Copy(popup_ref.OpenMousePos, g.IO.MousePos) else @@ -15485,7 +15519,7 @@ function ImGui.OpenPopupEx(id, popup_flags) local keep_existing = false if g.OpenPopupStack.Data[current_stack_size + 1].PopupId == id then - if (g.OpenPopupStack.Data[current_stack_size + 1].OpenFrameCount == g.FrameCount - 1) or (bit32.band(popup_flags, ImGuiPopupFlags.NoReopen) ~= 0) then + if (g.OpenPopupStack.Data[current_stack_size + 1].OpenFrameCount == g.FrameCount - 1) or (bit32.band(popup_flags, 32 --[[ImGuiPopupFlags.NoReopen]]) ~= 0) then keep_existing = true end end @@ -15532,7 +15566,7 @@ function ImGui.ClosePopupsOverWindow(ref_window, restore_focus_to_window_under_p break end - IM_ASSERT(bit32.band(popup.Window.Flags, ImGuiWindowFlags.Popup) ~= 0) + assert(bit32.band(popup.Window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0) -- Trim the stack unless the popup is a direct parent of the reference window (the reference window is often the NavWindow) -- - Clicking/Focusing Window2 won't close Popup1: @@ -15573,7 +15607,7 @@ end function ImGui.ClosePopupToLevel(remaining, restore_focus_to_window_under_popup) local g = GImGui -- IMGUI_DEBUG_LOG_POPUP("[popup] ClosePopupToLevel(%d), restore_under=%d\n", remaining, restore_focus_to_window_under_popup) - IM_ASSERT(remaining >= 0 and remaining < g.OpenPopupStack.Size) + assert(remaining >= 0 and remaining < g.OpenPopupStack.Size) -- if bit32.band(g.DebugLogFlags, ImGuiDebugLogFlags.EventPopup) ~= 0 then -- for n = remaining + 1, g.OpenPopupStack.Size do -- local popup = g.OpenPopupStack.Data[n] @@ -15590,16 +15624,16 @@ function ImGui.ClosePopupToLevel(remaining, restore_focus_to_window_under_popup) if restore_focus_to_window_under_popup and prev_popup.Window then local popup_window = prev_popup.Window local focus_window - if bit32.band(popup_window.Flags, ImGuiWindowFlags.ChildMenu) ~= 0 then + if bit32.band(popup_window.Flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0 then focus_window = popup_window.ParentWindow else focus_window = prev_popup.RestoreNavWindow end if focus_window and not focus_window.WasActive then - ImGui.FocusTopMostWindowUnderOne(popup_window, nil, nil, ImGuiFocusRequestFlags.RestoreFocusedChild) -- Fallback + ImGui.FocusTopMostWindowUnderOne(popup_window, nil, nil, 1 --[[ImGuiFocusRequestFlags.RestoreFocusedChild]]) -- Fallback else - local focus_flags = (g.NavLayer == ImGuiNavLayer.Main) and ImGuiFocusRequestFlags.RestoreFocusedChild or ImGuiFocusRequestFlags.None + local focus_flags = (g.NavLayer == 0 --[[ImGuiNavLayer.Main]]) and 1 --[[ImGuiFocusRequestFlags.RestoreFocusedChild]] or 0 --[[ImGuiFocusRequestFlags.None]] ImGui.FocusWindow(focus_window, focus_flags) end end @@ -15618,8 +15652,8 @@ function ImGui.CloseCurrentPopup() local popup_window = g.OpenPopupStack.Data[popup_idx].Window local parent_popup_window = g.OpenPopupStack.Data[popup_idx - 1].Window local close_parent = false - if popup_window and bit32.band(popup_window.Flags, ImGuiWindowFlags.ChildMenu) ~= 0 then - if parent_popup_window and not (bit32.band(parent_popup_window.Flags, ImGuiWindowFlags.MenuBar) ~= 0) then + if popup_window and bit32.band(popup_window.Flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0 then + if parent_popup_window and not (bit32.band(parent_popup_window.Flags, 1024 --[[ImGuiWindowFlags.MenuBar]]) ~= 0) then close_parent = true end end @@ -15648,16 +15682,16 @@ end --- @param extra_window_flags ImGuiWindowFlags function ImGui.BeginPopupEx(id, extra_window_flags) local g = GImGui - if not ImGui.IsPopupOpen(id, ImGuiPopupFlags.None) then + if not ImGui.IsPopupOpen(id, 0 --[[ImGuiPopupFlags.None]]) then g.NextWindowData:ClearFlags() -- We behave like Begin() and need to consume those values return false end - IM_ASSERT(bit32.band(extra_window_flags, ImGuiWindowFlags.ChildMenu) == 0) -- Use BeginPopupMenuEx() + assert(bit32.band(extra_window_flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) == 0) -- Use BeginPopupMenuEx() local name = ImFormatString("##Popup_%08x", id) -- No recycling, so we can close/open during the same frame local is_open - _, is_open = ImGui.Begin(name, nil, bit32.bor(extra_window_flags, ImGuiWindowFlags.Popup, ImGuiWindowFlags.NoDocking)) + _, is_open = ImGui.Begin(name, nil, bit32.bor(extra_window_flags, 67108864 --[[ImGuiWindowFlags.Popup]], 524288 --[[ImGuiWindowFlags.NoDocking]])) if not is_open then -- NB: Begin can return false when the popup is completely clipped (e.g. zero size display) ImGui.EndPopup() @@ -15671,21 +15705,21 @@ end --- @param extra_window_flags ImGuiWindowFlags function ImGui.BeginPopupMenuEx(id, label, extra_window_flags) local g = GImGui - if not ImGui.IsPopupOpen(id, ImGuiPopupFlags.None) then + if not ImGui.IsPopupOpen(id, 0 --[[ImGuiPopupFlags.None]]) then g.NextWindowData:ClearFlags() -- We behave like Begin() and need to consume those values return false end -- As we bypass BeginChild(), set ImGuiChildFlags.AlwaysAutoResize as it is checked independently from ImGuiWindowFlags.AlwaysAutoResize for now (see #9355) -- Ideally we should remove setting ImGuiWindowFlags.AlwaysAutoResize in BeginChild(). - if bit32.band(extra_window_flags, ImGuiWindowFlags.ChildWindow) ~= 0 and bit32.band(extra_window_flags, ImGuiWindowFlags.AlwaysAutoResize) ~= 0 then - ImGui.SetNextWindowChildFlags(ImGuiChildFlags.AlwaysAutoResize, true) + if bit32.band(extra_window_flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 and bit32.band(extra_window_flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) ~= 0 then + ImGui.SetNextWindowChildFlags(64 --[[ImGuiChildFlags.AlwaysAutoResize]], true) end - IM_ASSERT(bit32.band(extra_window_flags, ImGuiWindowFlags.ChildMenu) ~= 0) + assert(bit32.band(extra_window_flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0) local name = ImFormatString("%s###Menu_%02d", label, g.BeginMenuDepth) -- Recycle windows based on depth local is_open - _, is_open = ImGui.Begin(name, nil, bit32.bor(extra_window_flags, ImGuiWindowFlags.Popup)) + _, is_open = ImGui.Begin(name, nil, bit32.bor(extra_window_flags, 67108864 --[[ImGuiWindowFlags.Popup]])) if not is_open then -- NB: Begin can return false when the popup is completely clipped (e.g. zero size display) ImGui.EndPopup() end @@ -15703,7 +15737,7 @@ function ImGui.BeginPopup(str_id, flags) g.NextWindowData:ClearFlags() -- We behave like Begin() and need to consume those values return false end - flags = bit32.bor(flags, ImGuiWindowFlags.AlwaysAutoResize, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoSavedSettings) + flags = bit32.bor(flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]], 1 --[[ImGuiWindowFlags.NoTitleBar]], 256 --[[ImGuiWindowFlags.NoSavedSettings]]) local id = g.CurrentWindow:GetID(str_id) return ImGui.BeginPopupEx(id, flags) end @@ -15711,18 +15745,18 @@ end function ImGui.EndPopup() local g = GImGui local window = g.CurrentWindow - IM_ASSERT_USER_ERROR_RET((bit32.band(window.Flags, ImGuiWindowFlags.Popup) ~= 0) and (g.BeginPopupStack.Size > 0), "Calling EndPopup() in wrong window!") + IM_ASSERT_USER_ERROR_RET((bit32.band(window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0) and (g.BeginPopupStack.Size > 0), "Calling EndPopup() in wrong window!") -- Make all menus and popups wrap around for now, may need to expose that policy (e.g. focus scope could include wrap/loop policy flags used by new move requests) if g.NavWindow == window then - ImGui.NavMoveRequestTryWrapping(window, ImGuiNavMoveFlags.LoopY) + ImGui.NavMoveRequestTryWrapping(window, 2 --[[ImGuiNavMoveFlags.LoopY]]) end -- Child-popups don't need to be laid out local backup_within_end_popup_id = g.WithinEndPopupID local backup_within_end_child_id = g.WithinEndChildID g.WithinEndPopupID = window.ID - if bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 then + if bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 then g.WithinEndChildID = window.ID end @@ -15749,10 +15783,10 @@ function ImGui.FindBestWindowPosForPopupEx(ref_pos, size, last_dir, r_outer, r_a local base_pos_clamped -- Combo Box policy (we want a connecting edge) - if policy == ImGuiPopupPositionPolicy.ComboBox then - local dir_preferred_order = {ImGuiDir.Down, ImGuiDir.Right, ImGuiDir.Left, ImGuiDir.Up} + if policy == 1 --[[ImGuiPopupPositionPolicy.ComboBox]] then + local dir_preferred_order = {3 --[[ImGuiDir.Down]], 1 --[[ImGuiDir.Right]], 0 --[[ImGuiDir.Left]], 2 --[[ImGuiDir.Up]]} - for n = (last_dir ~= ImGuiDir.None) and 0 or 1, ImGuiDir.COUNT do + for n = (last_dir ~= (-1) --[[ImGuiDir.None]]) and 0 or 1, 4 --[[ImGuiDir.COUNT]] do repeat local dir = (n == 0) and last_dir or dir_preferred_order[n] @@ -15761,10 +15795,10 @@ function ImGui.FindBestWindowPosForPopupEx(ref_pos, size, last_dir, r_outer, r_a end local pos - if dir == ImGuiDir.Down then pos = ImVec2(r_avoid.Min.x, r_avoid.Max.y) -- Below, Toward Right (default) - elseif dir == ImGuiDir.Right then pos = ImVec2(r_avoid.Min.x, r_avoid.Min.y - size.y) -- Above, Toward Right - elseif dir == ImGuiDir.Left then pos = ImVec2(r_avoid.Max.x - size.x, r_avoid.Max.y) -- Below, Toward Left - elseif dir == ImGuiDir.Up then pos = ImVec2(r_avoid.Max.x - size.x, r_avoid.Min.y - size.y) -- Above, Toward Left + if dir == 3 --[[ImGuiDir.Down]] then pos = ImVec2(r_avoid.Min.x, r_avoid.Max.y) -- Below, Toward Right (default) + elseif dir == 1 --[[ImGuiDir.Right]] then pos = ImVec2(r_avoid.Min.x, r_avoid.Min.y - size.y) -- Above, Toward Right + elseif dir == 0 --[[ImGuiDir.Left]] then pos = ImVec2(r_avoid.Max.x - size.x, r_avoid.Max.y) -- Below, Toward Left + elseif dir == 2 --[[ImGuiDir.Up]] then pos = ImVec2(r_avoid.Max.x - size.x, r_avoid.Min.y - size.y) -- Above, Toward Left end if not r_outer:Contains(ImRect(pos, pos + size)) then @@ -15780,10 +15814,10 @@ function ImGui.FindBestWindowPosForPopupEx(ref_pos, size, last_dir, r_outer, r_a -- Tooltip and Default popup policy -- (Always first try the direction we used on the last frame, if any) - if policy == ImGuiPopupPositionPolicy.Tooltip or policy == ImGuiPopupPositionPolicy.Default then - local dir_preferred_order = {ImGuiDir.Right, ImGuiDir.Down, ImGuiDir.Up, ImGuiDir.Left} + if policy == 2 --[[ImGuiPopupPositionPolicy.Tooltip]] or policy == 0 --[[ImGuiPopupPositionPolicy.Default]] then + local dir_preferred_order = {1 --[[ImGuiDir.Right]], 3 --[[ImGuiDir.Down]], 2 --[[ImGuiDir.Up]], 0 --[[ImGuiDir.Left]]} - for n = (last_dir ~= ImGuiDir.None) and 0 or 1, ImGuiDir.COUNT do + for n = (last_dir ~= (-1) --[[ImGuiDir.None]]) and 0 or 1, 4 --[[ImGuiDir.COUNT]] do repeat local dir = (n == 0) and last_dir or dir_preferred_order[n] @@ -15791,22 +15825,22 @@ function ImGui.FindBestWindowPosForPopupEx(ref_pos, size, last_dir, r_outer, r_a break end - local avail_w = ((dir == ImGuiDir.Left) and r_avoid.Min.x or r_outer.Max.x) - ((dir == ImGuiDir.Right) and r_avoid.Max.x or r_outer.Min.x) - local avail_h = ((dir == ImGuiDir.Up) and r_avoid.Min.y or r_outer.Max.y) - ((dir == ImGuiDir.Down) and r_avoid.Max.y or r_outer.Min.y) + local avail_w = ((dir == 0 --[[ImGuiDir.Left]]) and r_avoid.Min.x or r_outer.Max.x) - ((dir == 1 --[[ImGuiDir.Right]]) and r_avoid.Max.x or r_outer.Min.x) + local avail_h = ((dir == 2 --[[ImGuiDir.Up]]) and r_avoid.Min.y or r_outer.Max.y) - ((dir == 3 --[[ImGuiDir.Down]]) and r_avoid.Max.y or r_outer.Min.y) -- If there's not enough room on one axis, there's no point in positioning on a side on this axis (e.g. when not enough width, use a top/bottom position to maximize available width) - if avail_w < size.x and (dir == ImGuiDir.Left or dir == ImGuiDir.Right) then + if avail_w < size.x and (dir == 0 --[[ImGuiDir.Left]] or dir == 1 --[[ImGuiDir.Right]]) then break end - if avail_h < size.y and (dir == ImGuiDir.Up or dir == ImGuiDir.Down) then + if avail_h < size.y and (dir == 2 --[[ImGuiDir.Up]] or dir == 3 --[[ImGuiDir.Down]]) then break end base_pos_clamped = ImClamp(ref_pos, r_outer.Min, r_outer.Max - size) local pos = ImVec2() - pos.x = (dir == ImGuiDir.Left) and (r_avoid.Min.x - size.x) or ((dir == ImGuiDir.Right) and r_avoid.Max.x or base_pos_clamped.x) - pos.y = (dir == ImGuiDir.Up) and (r_avoid.Min.y - size.y) or ((dir == ImGuiDir.Down) and r_avoid.Max.y or base_pos_clamped.y) + pos.x = (dir == 0 --[[ImGuiDir.Left]]) and (r_avoid.Min.x - size.x) or ((dir == 1 --[[ImGuiDir.Right]]) and r_avoid.Max.x or base_pos_clamped.x) + pos.y = (dir == 2 --[[ImGuiDir.Up]]) and (r_avoid.Min.y - size.y) or ((dir == 3 --[[ImGuiDir.Down]]) and r_avoid.Max.y or base_pos_clamped.y) -- Clamp top-left corner of popup pos.x = ImMax(pos.x, r_outer.Min.x) @@ -15820,10 +15854,10 @@ function ImGui.FindBestWindowPosForPopupEx(ref_pos, size, last_dir, r_outer, r_a end -- Fallback when not enough room: - last_dir = ImGuiDir.None + last_dir = (-1) --[[ImGuiDir.None]] -- For tooltip we prefer avoiding the cursor at all cost even if it means that part of the tooltip won't be visible. - if policy == ImGuiPopupPositionPolicy.Tooltip then + if policy == 2 --[[ImGuiPopupPositionPolicy.Tooltip]] then return ref_pos + ImVec2(2, 2), last_dir end @@ -15866,7 +15900,7 @@ function ImGui.FindBestWindowPosForPopup(window) local r_outer = ImGui.GetPopupAllowedExtentRect(window) - if bit32.band(window.Flags, ImGuiWindowFlags.ChildMenu) ~= 0 then + if bit32.band(window.Flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0 then -- Child menus typically request _any_ position within the parent menu item, and then we move the new menu outside the parent bounds. -- This is how we end up with child menus appearing (most-commonly) on the right of the parent menu. local parent_window = window.ParentWindow @@ -15874,34 +15908,34 @@ function ImGui.FindBestWindowPosForPopup(window) local r_avoid if parent_window.DC.MenuBarAppending then - r_avoid = ImRect(-FLT_MAX, parent_window.ClipRect.Min.y, FLT_MAX, parent_window.ClipRect.Max.y) -- Avoid parent menu-bar. If we wanted multi-line menu-bar, we may instead want to have the calling window setup e.g. a NextWindowData.PosConstraintAvoidRect field + r_avoid = ImRect(-3.4028234663853e+38 --[[FLT_MAX]], parent_window.ClipRect.Min.y, 3.4028234663853e+38 --[[FLT_MAX]], parent_window.ClipRect.Max.y) -- Avoid parent menu-bar. If we wanted multi-line menu-bar, we may instead want to have the calling window setup e.g. a NextWindowData.PosConstraintAvoidRect field else - r_avoid = ImRect(parent_window.Pos.x + horizontal_overlap, -FLT_MAX, parent_window.Pos.x + parent_window.Size.x - horizontal_overlap - parent_window.ScrollbarSizes.x, FLT_MAX) + r_avoid = ImRect(parent_window.Pos.x + horizontal_overlap, -3.4028234663853e+38 --[[FLT_MAX]], parent_window.Pos.x + parent_window.Size.x - horizontal_overlap - parent_window.ScrollbarSizes.x, 3.4028234663853e+38 --[[FLT_MAX]]) end local pos - pos, window.AutoPosLastDirection = ImGui.FindBestWindowPosForPopupEx(window.Pos, window.Size, window.AutoPosLastDirection, r_outer, r_avoid, ImGuiPopupPositionPolicy.Default) + pos, window.AutoPosLastDirection = ImGui.FindBestWindowPosForPopupEx(window.Pos, window.Size, window.AutoPosLastDirection, r_outer, r_avoid, 0 --[[ImGuiPopupPositionPolicy.Default]]) return pos end - if bit32.band(window.Flags, ImGuiWindowFlags.Popup) ~= 0 then + if bit32.band(window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 then local pos - pos, window.AutoPosLastDirection = ImGui.FindBestWindowPosForPopupEx(window.Pos, window.Size, window.AutoPosLastDirection, r_outer, ImRect(window.Pos, window.Pos), ImGuiPopupPositionPolicy.Default) -- Ideally we'd disable r_avoid here + pos, window.AutoPosLastDirection = ImGui.FindBestWindowPosForPopupEx(window.Pos, window.Size, window.AutoPosLastDirection, r_outer, ImRect(window.Pos, window.Pos), 0 --[[ImGuiPopupPositionPolicy.Default]]) -- Ideally we'd disable r_avoid here return pos end - if bit32.band(window.Flags, ImGuiWindowFlags.Tooltip) ~= 0 then + if bit32.band(window.Flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0 then -- Position tooltip (always follows mouse + clamp within outer boundaries) -- FIXME: -- - Too many paths. One problem is that FindBestWindowPosForPopupEx() doesn't allow passing a suggested position (so touch screen path doesn't use it by default). -- - Drag and drop tooltips are not using this path either: BeginTooltipEx() manually sets their position. -- - Require some tidying up. In theory we could handle both cases in same location, but requires a bit of shuffling -- as drag and drop tooltips are calling SetNextWindowPos() leading to 'window_pos_set_by_api' being set in Begin(). - IM_ASSERT(g.CurrentWindow == window) + assert(g.CurrentWindow == window) local scale = g.Style.MouseCursorScale - local ref_pos = ImGui.NavCalcPreferredRefPos(ImGuiWindowFlags.Tooltip) + local ref_pos = ImGui.NavCalcPreferredRefPos(33554432 --[[ImGuiWindowFlags.Tooltip]]) - if g.IO.MouseSource == ImGuiMouseSource.TouchScreen and ImGui.NavCalcPreferredRefPosSource(ImGuiWindowFlags.Tooltip) == ImGuiInputSource.Mouse then + if g.IO.MouseSource == 1 --[[ImGuiMouseSource.TouchScreen]] and ImGui.NavCalcPreferredRefPosSource(33554432 --[[ImGuiWindowFlags.Tooltip]]) == 1 --[[ImGuiInputSource.Mouse]] then local tooltip_pos = ref_pos + TOOLTIP_DEFAULT_OFFSET_TOUCH * scale - TOOLTIP_DEFAULT_PIVOT_TOUCH * window.Size if r_outer:Contains(ImRect(tooltip_pos, tooltip_pos + window.Size)) then return tooltip_pos @@ -15918,11 +15952,11 @@ function ImGui.FindBestWindowPosForPopup(window) -- ImGui.GetForegroundDrawList():AddRect(r_avoid.Min, r_avoid.Max, IM_COL32(255, 0, 255, 255)) local pos - pos, window.AutoPosLastDirection = ImGui.FindBestWindowPosForPopupEx(tooltip_pos, window.Size, window.AutoPosLastDirection, r_outer, r_avoid, ImGuiPopupPositionPolicy.Tooltip) + pos, window.AutoPosLastDirection = ImGui.FindBestWindowPosForPopupEx(tooltip_pos, window.Size, window.AutoPosLastDirection, r_outer, r_avoid, 2 --[[ImGuiPopupPositionPolicy.Tooltip]]) return pos end - IM_ASSERT(false) + assert(false) return window.Pos end @@ -15930,12 +15964,12 @@ end --- @param flags ImGuiPopupFlags --- @return ImGuiMouseButton function ImGui.GetMouseButtonFromPopupFlags(flags) - IM_ASSERT(bit32.band(flags, ImGuiPopupFlags.InvalidMask_) == 0) - if bit32.band(flags, ImGuiPopupFlags.MouseButtonMask_) ~= 0 then - return bit32.rshift(bit32.band(flags, ImGuiPopupFlags.MouseButtonMask_), ImGuiPopupFlags.MouseButtonShift_) - 1 + assert(bit32.band(flags, 3 --[[ImGuiPopupFlags.InvalidMask_]]) == 0) + if bit32.band(flags, 12 --[[ImGuiPopupFlags.MouseButtonMask_]]) ~= 0 then + return bit32.rshift(bit32.band(flags, 12 --[[ImGuiPopupFlags.MouseButtonMask_]]), 2 --[[ImGuiPopupFlags.MouseButtonShift_]]) - 1 end - return ImGuiMouseButton.Right -- Default == 1 + return 1 --[[ImGuiMouseButton.Right]] -- Default == 1 end --- @param popup_flags ImGuiPopupFlags @@ -15944,7 +15978,7 @@ end function ImGui.IsPopupOpenRequestForItem(popup_flags, id) local g = GImGui local mouse_button = ImGui.GetMouseButtonFromPopupFlags(popup_flags) - if ImGui.IsMouseReleased(mouse_button) and ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenBlockedByPopup) then + if ImGui.IsMouseReleased(mouse_button) and ImGui.IsItemHovered(32 --[[ImGuiHoveredFlags.AllowWhenBlockedByPopup]]) then return true end if g.NavOpenContextMenuItemId == id and (ImGui.IsItemFocused() or id == g.CurrentWindow.MoveId) then @@ -15966,7 +16000,7 @@ function ImGui.OpenPopupOnItemClick(str_id, popup_flags) local window = g.CurrentWindow local id if str_id then id = window:GetID(str_id) else id = g.LastItemData.ID end -- If user hasn't passed an ID, we can use the LastItemID. Using LastItemID as a Popup ID won't conflict! - IM_ASSERT(id ~= 0) -- You cannot pass a nil str_id if the last item has no identifier (e.g. a Text() item) + assert(id ~= 0) -- You cannot pass a nil str_id if the last item has no identifier (e.g. a Text() item) return ImGui.OpenPopupEx(id, popup_flags) end @@ -16002,11 +16036,11 @@ function ImGui.BeginPopupContextItem(str_id, popup_flags) end local id if str_id then id = window:GetID(str_id) else id = g.LastItemData.ID end -- If user hasn't passed an ID, we can use the LastItem ID. Using LastItem ID as a Popup ID won't conflict! - IM_ASSERT(id ~= 0) -- You cannot pass a nil str_id if the last item has no identifier (e.g. a Text() item) + assert(id ~= 0) -- You cannot pass a nil str_id if the last item has no identifier (e.g. a Text() item) if ImGui.IsPopupOpenRequestForItem(popup_flags, g.LastItemData.ID) then ImGui.OpenPopupEx(id, popup_flags) end - return ImGui.BeginPopupEx(id, bit32.bor(ImGuiWindowFlags.AlwaysAutoResize, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoSavedSettings)) + return ImGui.BeginPopupEx(id, bit32.bor(64 --[[ImGuiWindowFlags.AlwaysAutoResize]], 1 --[[ImGuiWindowFlags.NoTitleBar]], 256 --[[ImGuiWindowFlags.NoSavedSettings]])) end ------------------------------------------------------------------------------- @@ -16060,7 +16094,7 @@ function ImGui.SetNavFocusScope(focus_scope_id) if focus_scope_id == 0 then return end - IM_ASSERT(g.NavWindow ~= nil) + assert(g.NavWindow ~= nil) -- Store current path (in reverse order) if focus_scope_id == g.CurrentFocusScopeId then @@ -16090,7 +16124,7 @@ function ImGui.SetNavFocusScope(focus_scope_id) g.NavFocusRoute:push_back(data) window = window.ParentWindowForFocusRoute end - IM_ASSERT(g.NavFocusRoute.Size < 100) -- Maximum depth is technically 251 as per CalcRoutingScore(): 254 - 3 + assert(g.NavFocusRoute.Size < 100) -- Maximum depth is technically 251 as per CalcRoutingScore(): 254 - 3 end function ImGui.SetItemDefaultFocus() @@ -16109,18 +16143,18 @@ function ImGui.SetItemDefaultFocus() -- Scroll could be done in NavInitRequestApplyResult() via an opt-in flag (we however don't want regular init requests to scroll) if not window.ClipRect:Contains(g.LastItemData.Rect) then - ImGui.ScrollToRectEx(window, g.LastItemData.Rect, ImGuiScrollFlags.None) + ImGui.ScrollToRectEx(window, g.LastItemData.Rect, 0 --[[ImGuiScrollFlags.None]]) end end -- (was called NavRestoreHighlightAfterMove() before 1.91.4) function ImGui.SetNavCursorVisibleAfterMove() local g = GImGui - if g.NavWindow and (bit32.band(g.NavWindow.Flags, ImGuiWindowFlags.NoNavInputs) ~= 0) then + if g.NavWindow and (bit32.band(g.NavWindow.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) ~= 0) then g.NavCursorVisible = false - elseif g.NavInputSource == ImGuiInputSource.Keyboard and (bit32.band(g.IO.ConfigFlags, ImGuiConfigFlags.NavEnableKeyboard) == 0) then + elseif g.NavInputSource == 2 --[[ImGuiInputSource.Keyboard]] and (bit32.band(g.IO.ConfigFlags, 1 --[[ImGuiConfigFlags.NavEnableKeyboard]]) == 0) then g.NavCursorVisible = false - elseif g.NavInputSource == ImGuiInputSource.Gamepad and (bit32.band(g.IO.ConfigFlags, ImGuiConfigFlags.NavEnableGamepad) == 0) then + elseif g.NavInputSource == 3 --[[ImGuiInputSource.Gamepad]] and (bit32.band(g.IO.ConfigFlags, 2 --[[ImGuiConfigFlags.NavEnableGamepad]]) == 0) then g.NavCursorVisible = false elseif g.IO.ConfigNavCursorVisibleAuto then g.NavCursorVisible = true @@ -16135,7 +16169,7 @@ function ImGui.SetNavWindow(window) if g.NavWindow ~= window then -- IMGUI_DEBUG_LOG_FOCUS("[focus] SetNavWindow(\"%s\")", window and window.Name or "") g.NavWindow = window - g.NavLastValidSelectionUserData = ImGuiSelectionUserData_Invalid + g.NavLastValidSelectionUserData = (-1) --[[ImGuiSelectionUserData_Invalid]] end g.NavInitRequest = false g.NavMoveSubmitted = false @@ -16146,7 +16180,7 @@ end --- @param axis ImGuiAxis function ImGui.NavClearPreferredPosForAxis(axis) local g = GImGui - g.NavWindow.RootWindowForNav.NavPreferredScoringPosRel[g.NavLayer][axis] = FLT_MAX + g.NavWindow.RootWindowForNav.NavPreferredScoringPosRel[g.NavLayer][axis] = 3.4028234663853e+38 --[[FLT_MAX]] end --- @param id ImGuiID @@ -16155,8 +16189,8 @@ end --- @param rect_rel ImRect function ImGui.SetNavID(id, nav_layer, focus_scope_id, rect_rel) local g = GImGui - IM_ASSERT(g.NavWindow ~= nil) - IM_ASSERT(nav_layer == ImGuiNavLayer.Main or nav_layer == ImGuiNavLayer.Menu) + assert(g.NavWindow ~= nil) + assert(nav_layer == 0 --[[ImGuiNavLayer.Main]] or nav_layer == 1 --[[ImGuiNavLayer.Menu]]) g.NavId = id g.NavLayer = nav_layer ImGui.SetNavFocusScope(focus_scope_id) @@ -16164,8 +16198,8 @@ function ImGui.SetNavID(id, nav_layer, focus_scope_id, rect_rel) ImRect_Copy(g.NavWindow.NavRectRel[nav_layer], rect_rel) -- Clear preferred scoring position (NavMoveRequestApplyResult() will tend to restore it) - ImGui.NavClearPreferredPosForAxis(ImGuiAxis.X) - ImGui.NavClearPreferredPosForAxis(ImGuiAxis.Y) + ImGui.NavClearPreferredPosForAxis(1 --[[ImGuiAxis.X]]) + ImGui.NavClearPreferredPosForAxis(2 --[[ImGuiAxis.Y]]) end -- FIXME: This could be replaced by updating a frame number in each window when (window == NavWindow) and (NavLayer == 0). @@ -16173,7 +16207,7 @@ end --- @param nav_window ImGuiWindow function ImGui.NavSaveLastChildNavWindowIntoParent(nav_window) local parent = nav_window - while parent and parent.RootWindow ~= parent and bit32.band(parent.Flags, bit32.bor(ImGuiWindowFlags.Popup, ImGuiWindowFlags.ChildMenu)) == 0 do + while parent and parent.RootWindow ~= parent and bit32.band(parent.Flags, bit32.bor(67108864 --[[ImGuiWindowFlags.Popup]], 268435456 --[[ImGuiWindowFlags.ChildMenu]])) == 0 do parent = parent.ParentWindow end if parent and parent ~= nav_window then @@ -16194,10 +16228,10 @@ end --- @param layer ImGuiNavLayer function ImGui.NavRestoreLayer(layer) local g = GImGui - if layer == ImGuiNavLayer.Main then + if layer == 0 --[[ImGuiNavLayer.Main]] then local prev_nav_window = g.NavWindow g.NavWindow = ImGui.NavRestoreLastChildNavWindow(g.NavWindow) -- FIXME-NAV: Should clear ongoing nav requests? - g.NavLastValidSelectionUserData = ImGuiSelectionUserData_Invalid + g.NavLastValidSelectionUserData = (-1) --[[ImGuiSelectionUserData_Invalid]] -- if (prev_nav_window) IMGUI_DEBUG_LOG_FOCUS("[focus] NavRestoreLayer: from \"%s\" to SetNavWindow(\"%s\")\n", prev_nav_window->Name, g.NavWindow->Name) end local window = g.NavWindow @@ -16213,14 +16247,14 @@ end function ImGui.NavHighlightActivated(id) local g = GImGui g.NavHighlightActivatedId = id - g.NavHighlightActivatedTimer = NAV_ACTIVATE_HIGHLIGHT_TIMER + g.NavHighlightActivatedTimer = 0.1 --[[NAV_ACTIVATE_HIGHLIGHT_TIMER]] end function ImGui.NavUpdateAnyRequestFlag() local g = GImGui g.NavAnyRequest = g.NavMoveScoringItems or g.NavInitRequest or (IMGUI_DEBUG_NAV_SCORING and g.NavWindow ~= nil) if g.NavAnyRequest then - IM_ASSERT(g.NavWindow ~= nil) + assert(g.NavWindow ~= nil) end end @@ -16230,16 +16264,16 @@ end function ImGui.NavInitWindow(window, force_reinit) -- FIXME: ChildWindow test here is wrong for docking local g = GImGui - IM_ASSERT(window == g.NavWindow) + assert(window == g.NavWindow) - if bit32.band(window.Flags, ImGuiWindowFlags.NoNavInputs) ~= 0 then + if bit32.band(window.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) ~= 0 then g.NavId = 0 ImGui.SetNavFocusScope(window.NavRootFocusScopeId) return end local init_for_nav = false - if window == window.RootWindow or bit32.band(window.Flags, ImGuiWindowFlags.Popup) ~= 0 or window.NavLastIds[0] == 0 or force_reinit then + if window == window.RootWindow or bit32.band(window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 or window.NavLastIds[0] == 0 or force_reinit then init_for_nav = true end -- IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: from NavInitWindow(), init_for_nav=%d, window=\"%s\", layer=%d", init_for_nav, window->Name, g.NavLayer) @@ -16264,14 +16298,14 @@ function ImGui.NavCalcPreferredRefPosSource(window_type) local window = g.NavWindow local activated_shortcut = g.ActiveId ~= 0 and g.ActiveIdFromShortcut and g.ActiveId == g.LastItemData.ID - if (bit32.band(window_type, ImGuiWindowFlags.Popup) ~= 0) and activated_shortcut then - return ImGuiInputSource.Keyboard + if (bit32.band(window_type, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0) and activated_shortcut then + return 2 --[[ImGuiInputSource.Keyboard]] end if not g.NavCursorVisible or not g.NavHighlightItemUnderNav or not window then - return ImGuiInputSource.Mouse + return 1 --[[ImGuiInputSource.Mouse]] else - return ImGuiInputSource.Keyboard -- or Nav in general + return 2 --[[ImGuiInputSource.Keyboard]] -- or Nav in general end end @@ -16283,7 +16317,7 @@ function ImGui.NavCalcPreferredRefPos(window_type) local window = g.NavWindow local source = ImGui.NavCalcPreferredRefPosSource(window_type) - if source == ImGuiInputSource.Mouse then + if source == 1 --[[ImGuiInputSource.Mouse]] then -- Mouse (we need a fallback in case the mouse becomes invalid after being used) -- The +1.0f offset when stored by OpenPopupEx() allows reopening this or another popup (same or another mouse button) while not moving the mouse, it is pretty standard. -- In theory we could move that +1.0f offset in OpenPopupEx() @@ -16294,14 +16328,14 @@ function ImGui.NavCalcPreferredRefPos(window_type) local activated_shortcut = g.ActiveId ~= 0 and g.ActiveIdFromShortcut and g.ActiveId == g.LastItemData.ID local ref_rect = ImRect() - if activated_shortcut and (bit32.band(window_type, ImGuiWindowFlags.Popup) ~= 0) then + if activated_shortcut and (bit32.band(window_type, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0) then ImRect_Copy(ref_rect, g.LastItemData.NavRect) elseif window ~= nil then ImRect_Copy(ref_rect, ImGui.WindowRectRelToAbs(window, window.NavRectRel[g.NavLayer])) end -- Take account of upcoming scrolling (maybe set mouse pos should be done in EndFrame?) - if window ~= nil and window.LastFrameActive ~= g.FrameCount and (window.ScrollTarget.x ~= FLT_MAX or window.ScrollTarget.y ~= FLT_MAX) then + if window ~= nil and window.LastFrameActive ~= g.FrameCount and (window.ScrollTarget.x ~= 3.4028234663853e+38 --[[FLT_MAX]] or window.ScrollTarget.y ~= 3.4028234663853e+38 --[[FLT_MAX]]) then local next_scroll = CalcNextScrollFromScrollTargetAndClamp(window) ref_rect:Translate(window.Scroll - next_scroll) end @@ -16322,15 +16356,15 @@ end --- @return float function ImGui.GetNavTweakPressedAmount(axis) local g = GImGui - local repeat_delay, repeat_rate = ImGui.GetTypematicRepeatRate(ImGuiInputFlags.RepeatRateNavTweak) + local repeat_delay, repeat_rate = ImGui.GetTypematicRepeatRate(8 --[[ImGuiInputFlags.RepeatRateNavTweak]]) local key_less, key_more - if g.NavInputSource == ImGuiInputSource.Gamepad then - key_less = (axis == ImGuiAxis.X) and ImGuiKey.GamepadDpadLeft or ImGuiKey.GamepadDpadUp - key_more = (axis == ImGuiAxis.X) and ImGuiKey.GamepadDpadRight or ImGuiKey.GamepadDpadDown + if g.NavInputSource == 3 --[[ImGuiInputSource.Gamepad]] then + key_less = (axis == 1 --[[ImGuiAxis.X]]) and 638 --[[ImGuiKey.GamepadDpadLeft]] or 640 --[[ImGuiKey.GamepadDpadUp]] + key_more = (axis == 1 --[[ImGuiAxis.X]]) and 639 --[[ImGuiKey.GamepadDpadRight]] or 641 --[[ImGuiKey.GamepadDpadDown]] else - key_less = (axis == ImGuiAxis.X) and ImGuiKey.LeftArrow or ImGuiKey.UpArrow - key_more = (axis == ImGuiAxis.X) and ImGuiKey.RightArrow or ImGuiKey.DownArrow + key_less = (axis == 1 --[[ImGuiAxis.X]]) and 513 --[[ImGuiKey.LeftArrow]] or 515 --[[ImGuiKey.UpArrow]] + key_more = (axis == 1 --[[ImGuiAxis.X]]) and 514 --[[ImGuiKey.RightArrow]] or 516 --[[ImGuiKey.DownArrow]] end local amount = ImGui.GetKeyPressedAmount(key_more, repeat_delay, repeat_rate) - ImGui.GetKeyPressedAmount(key_less, repeat_delay, repeat_rate) @@ -16350,8 +16384,8 @@ local nav_keyboard_keys_to_change_source = { ImGuiKey.Space, ImGuiKey.Enter, ImG --- @param focus_change_dir int function ImGui.NavUpdateWindowingTarget(focus_change_dir) local g = GImGui - IM_ASSERT(g.NavWindowingTarget) - if bit32.band(g.NavWindowingTarget.Flags, ImGuiWindowFlags.Modal) ~= 0 then + assert(g.NavWindowingTarget) + if bit32.band(g.NavWindowingTarget.Flags, 134217728 --[[ImGuiWindowFlags.Modal]]) ~= 0 then return end @@ -16380,10 +16414,10 @@ function ImGui.NavUpdateWindowingApplyFocus(apply_focus_window) ImGui.ClearActiveID() ImGui.SetNavCursorVisibleAfterMove() ImGui.ClosePopupsOverWindow(apply_focus_window, false) - ImGui.FocusWindow(apply_focus_window, ImGuiFocusRequestFlags.RestoreFocusedChild) - IM_ASSERT(g.NavWindow ~= nil) + ImGui.FocusWindow(apply_focus_window, 1 --[[ImGuiFocusRequestFlags.RestoreFocusedChild]]) + assert(g.NavWindow ~= nil) apply_focus_window = g.NavWindow - if apply_focus_window.NavLastIds[ImGuiNavLayer.Main] == 0 then -- FIXME: This is the equivalent of the 'if (g.NavId == 0) { NavInitWindow() }' in DockNodeUpdateTabBar(). + if apply_focus_window.NavLastIds[0 --[[ImGuiNavLayer.Main]]] == 0 then -- FIXME: This is the equivalent of the 'if (g.NavId == 0) { NavInitWindow() }' in DockNodeUpdateTabBar(). ImGui.NavInitWindow(apply_focus_window, false) end @@ -16394,8 +16428,8 @@ function ImGui.NavUpdateWindowingApplyFocus(apply_focus_window) -- FIXME-NAV: This should be done in NavInit.. or in FocusWindow... However in both of those cases, -- we won't have a guarantee that windows has been visible before and therefore NavLayersActiveMask* -- won't be valid. - if apply_focus_window.DC.NavLayersActiveMaskNext == bit32.lshift(1, ImGuiNavLayer.Menu) then - g.NavLayer = ImGuiNavLayer.Menu + if apply_focus_window.DC.NavLayersActiveMaskNext == bit32.lshift(1, 1 --[[ImGuiNavLayer.Menu]]) then + g.NavLayer = 1 --[[ImGuiNavLayer.Menu]] end -- Request OS level focus @@ -16433,19 +16467,19 @@ function ImGui.NavUpdateWindowing() -- Start Ctrl+Tab or Square+L/R window selection -- (g.ConfigNavWindowingKeyNext/g.ConfigNavWindowingKeyPrev defaults are ImGuiMod_Ctrl|ImGuiKey.Tab and ImGuiMod_Ctrl|ImGuiMod_Shift|ImGuiKey.Tab) local owner_id = ImHashStr("##NavUpdateWindowing") - local nav_gamepad_active = bit32.band(io.ConfigFlags, ImGuiConfigFlags.NavEnableGamepad) ~= 0 and bit32.band(io.BackendFlags, ImGuiBackendFlags.HasGamepad) ~= 0 - local nav_keyboard_active = bit32.band(io.ConfigFlags, ImGuiConfigFlags.NavEnableKeyboard) ~= 0 - local keyboard_next_window = allow_windowing and g.ConfigNavWindowingKeyNext ~= 0 and ImGui.Shortcut(g.ConfigNavWindowingKeyNext, bit32.bor(ImGuiInputFlags.Repeat, ImGuiInputFlags.RouteAlways), owner_id) - local keyboard_prev_window = allow_windowing and g.ConfigNavWindowingKeyPrev ~= 0 and ImGui.Shortcut(g.ConfigNavWindowingKeyPrev, bit32.bor(ImGuiInputFlags.Repeat, ImGuiInputFlags.RouteAlways), owner_id) - local start_toggling_with_gamepad = nav_gamepad_active and g.NavWindowingTarget == nil and ImGui.Shortcut(ImGuiKey.NavGamepadMenu, ImGuiInputFlags.RouteAlways, owner_id) + local nav_gamepad_active = bit32.band(io.ConfigFlags, 2 --[[ImGuiConfigFlags.NavEnableGamepad]]) ~= 0 and bit32.band(io.BackendFlags, 1 --[[ImGuiBackendFlags.HasGamepad]]) ~= 0 + local nav_keyboard_active = bit32.band(io.ConfigFlags, 1 --[[ImGuiConfigFlags.NavEnableKeyboard]]) ~= 0 + local keyboard_next_window = allow_windowing and g.ConfigNavWindowingKeyNext ~= 0 and ImGui.Shortcut(g.ConfigNavWindowingKeyNext, bit32.bor(1 --[[ImGuiInputFlags.Repeat]], 8192 --[[ImGuiInputFlags.RouteAlways]]), owner_id) + local keyboard_prev_window = allow_windowing and g.ConfigNavWindowingKeyPrev ~= 0 and ImGui.Shortcut(g.ConfigNavWindowingKeyPrev, bit32.bor(1 --[[ImGuiInputFlags.Repeat]], 8192 --[[ImGuiInputFlags.RouteAlways]]), owner_id) + local start_toggling_with_gamepad = nav_gamepad_active and g.NavWindowingTarget == nil and ImGui.Shortcut(634 --[[ImGuiKey.NavGamepadMenu]], 8192 --[[ImGuiInputFlags.RouteAlways]], owner_id) local start_windowing_with_gamepad = allow_windowing and start_toggling_with_gamepad local start_windowing_with_keyboard = allow_windowing and g.NavWindowingTarget == nil and (keyboard_next_window or keyboard_prev_window) -- Note: enabled even without NavEnableKeyboard! local just_started_windowing_from_null_focus = false if start_toggling_with_gamepad then g.NavWindowingToggleLayer = true -- Gamepad starts toggling layer - g.NavWindowingToggleKey = ImGuiKey.NavGamepadMenu - g.NavWindowingInputSource = ImGuiInputSource.Gamepad - g.NavInputSource = ImGuiInputSource.Gamepad + g.NavWindowingToggleKey = 634 --[[ImGuiKey.NavGamepadMenu]] + g.NavWindowingInputSource = 3 --[[ImGuiInputSource.Gamepad]] + g.NavInputSource = 3 --[[ImGuiInputSource.Gamepad]] end if start_windowing_with_gamepad or start_windowing_with_keyboard then local window = (g.NavWindow and ImGui.IsWindowNavFocusable(g.NavWindow)) and g.NavWindow or ImGui.FindWindowNavFocusable(g.WindowsFocusOrder.Size, 0, -1) @@ -16458,7 +16492,7 @@ function ImGui.NavUpdateWindowing() g.NavWindowingHighlightAlpha = 0.0 ImVec2_CopyV(g.NavWindowingAccumDeltaPos, 0.0, 0.0) ImVec2_CopyV(g.NavWindowingAccumDeltaSize, 0.0, 0.0) - g.NavWindowingInputSource = start_windowing_with_keyboard and ImGuiInputSource.Keyboard or ImGuiInputSource.Gamepad + g.NavWindowingInputSource = start_windowing_with_keyboard and 2 --[[ImGuiInputSource.Keyboard]] or 3 --[[ImGuiInputSource.Gamepad]] g.NavInputSource = g.NavWindowingInputSource if g.NavWindow == nil then just_started_windowing_from_null_focus = true @@ -16466,21 +16500,21 @@ function ImGui.NavUpdateWindowing() -- Manually register ownership of our mods. Using a global route in the Shortcut() calls instead would probably be correct but may have more side-effects. if keyboard_next_window or keyboard_prev_window then - ImGui.SetKeyOwnersForKeyChord(bit32.band(bit32.bor(g.ConfigNavWindowingKeyNext, g.ConfigNavWindowingKeyPrev), ImGuiMod_Mask_), owner_id) + ImGui.SetKeyOwnersForKeyChord(bit32.band(bit32.bor(g.ConfigNavWindowingKeyNext, g.ConfigNavWindowingKeyPrev), 61440 --[[ImGuiMod_Mask_]]), owner_id) end end end -- Gamepad update - if (g.NavWindowingTarget or g.NavWindowingToggleLayer) and g.NavWindowingInputSource == ImGuiInputSource.Gamepad then + if (g.NavWindowingTarget or g.NavWindowingToggleLayer) and g.NavWindowingInputSource == 3 --[[ImGuiInputSource.Gamepad]] then if g.NavWindowingTarget ~= nil then -- Highlight only appears after a brief time holding the button, so that a fast tap on ImGuiKey.NavGamepadMenu (to toggle NavLayer) doesn't add visual noise -- However inputs are accepted immediately, so you press ImGuiKey.NavGamepadMenu + L1/R1 fast. g.NavWindowingTimer = g.NavWindowingTimer + io.DeltaTime - g.NavWindowingHighlightAlpha = ImMax(g.NavWindowingHighlightAlpha, ImSaturate((g.NavWindowingTimer - NAV_WINDOWING_HIGHLIGHT_DELAY) / 0.05)) + g.NavWindowingHighlightAlpha = ImMax(g.NavWindowingHighlightAlpha, ImSaturate((g.NavWindowingTimer - 0.5 --[[NAV_WINDOWING_HIGHLIGHT_DELAY]]) / 0.05)) -- Select window to focus - local focus_change_dir = (ImGui.IsKeyPressedEx(ImGuiKey.GamepadL1, ImGuiInputFlags.None, ImGuiKeyOwner_Any) and 1 or 0) - (ImGui.IsKeyPressedEx(ImGuiKey.GamepadR1, ImGuiInputFlags.None, ImGuiKeyOwner_Any) and 1 or 0) + local focus_change_dir = (ImGui.IsKeyPressedEx(642 --[[ImGuiKey.GamepadL1]], 0 --[[ImGuiInputFlags.None]], 0 --[[ImGuiKeyOwner_Any]]) and 1 or 0) - (ImGui.IsKeyPressedEx(643 --[[ImGuiKey.GamepadR1]], 0 --[[ImGuiInputFlags.None]], 0 --[[ImGuiKeyOwner_Any]]) and 1 or 0) if focus_change_dir ~= 0 and not just_started_windowing_from_null_focus then ImGui.NavUpdateWindowingTarget(focus_change_dir) g.NavWindowingHighlightAlpha = 1.0 @@ -16488,7 +16522,7 @@ function ImGui.NavUpdateWindowing() end -- Single press toggles NavLayer, long press with L/R apply actual focus on release (until then the window was merely rendered top-most) - if not ImGui.IsKeyDown(ImGuiKey.NavGamepadMenu) then + if not ImGui.IsKeyDown(634 --[[ImGuiKey.NavGamepadMenu]]) then g.NavWindowingToggleLayer = g.NavWindowingToggleLayer and (g.NavWindowingHighlightAlpha < 1.0) -- Once button was held long enough we don't consider it a tap-to-toggle-layer press anymore. if g.NavWindowingToggleLayer and g.NavWindow then apply_toggle_layer = true @@ -16501,14 +16535,14 @@ function ImGui.NavUpdateWindowing() end -- Keyboard: Focus - if g.NavWindowingTarget and g.NavWindowingInputSource == ImGuiInputSource.Keyboard then + if g.NavWindowingTarget and g.NavWindowingInputSource == 2 --[[ImGuiInputSource.Keyboard]] then -- Visuals only appears after a brief time after pressing TAB the first time, so that a fast Ctrl+Tab doesn't add visual noise local shared_mods = bit32.band( - bit32.band((g.ConfigNavWindowingKeyNext ~= 0) and g.ConfigNavWindowingKeyNext or ImGuiMod_Mask_, (g.ConfigNavWindowingKeyPrev ~= 0) and g.ConfigNavWindowingKeyPrev or ImGuiMod_Mask_), - ImGuiMod_Mask_) - IM_ASSERT(shared_mods ~= 0) -- Next/Prev shortcut currently needs a shared modifier to "hold", otherwise Prev actions would keep cycling between two windows. + bit32.band((g.ConfigNavWindowingKeyNext ~= 0) and g.ConfigNavWindowingKeyNext or 61440 --[[ImGuiMod_Mask_]], (g.ConfigNavWindowingKeyPrev ~= 0) and g.ConfigNavWindowingKeyPrev or 61440 --[[ImGuiMod_Mask_]]), + 61440 --[[ImGuiMod_Mask_]]) + assert(shared_mods ~= 0) -- Next/Prev shortcut currently needs a shared modifier to "hold", otherwise Prev actions would keep cycling between two windows. g.NavWindowingTimer = g.NavWindowingTimer + io.DeltaTime - g.NavWindowingHighlightAlpha = ImMax(g.NavWindowingHighlightAlpha, ImSaturate((g.NavWindowingTimer - NAV_WINDOWING_HIGHLIGHT_DELAY) / 0.05)) -- 1.0f + g.NavWindowingHighlightAlpha = ImMax(g.NavWindowingHighlightAlpha, ImSaturate((g.NavWindowingTimer - 0.5 --[[NAV_WINDOWING_HIGHLIGHT_DELAY]]) / 0.05)) -- 1.0f if (keyboard_next_window or keyboard_prev_window) and not just_started_windowing_from_null_focus then ImGui.NavUpdateWindowingTarget(keyboard_next_window and -1 or 1) elseif bit32.band(io.KeyMods, shared_mods) ~= shared_mods then @@ -16517,21 +16551,21 @@ function ImGui.NavUpdateWindowing() end -- Keyboard: Press and Release Alt to toggle menu layer - local windowing_toggle_keys = { ImGuiKey.LeftAlt, ImGuiKey.RightAlt } + local windowing_toggle_keys = { 529 --[[ImGuiKey.LeftAlt]], 533 --[[ImGuiKey.RightAlt]] } local windowing_toggle_layer_start = false - if g.NavWindow and bit32.band(g.NavWindow.Flags, ImGuiWindowFlags.NoNavInputs) == 0 then + if g.NavWindow and bit32.band(g.NavWindow.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) == 0 then for _, windowing_toggle_key in ipairs(windowing_toggle_keys) do - if nav_keyboard_active and ImGui.IsKeyPressedEx(windowing_toggle_key, ImGuiInputFlags.None, ImGuiKeyOwner_NoOwner) then + if nav_keyboard_active and ImGui.IsKeyPressedEx(windowing_toggle_key, 0 --[[ImGuiInputFlags.None]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) then windowing_toggle_layer_start = true g.NavWindowingToggleLayer = true g.NavWindowingToggleKey = windowing_toggle_key - g.NavWindowingInputSource = ImGuiInputSource.Keyboard - g.NavInputSource = ImGuiInputSource.Keyboard + g.NavWindowingInputSource = 2 --[[ImGuiInputSource.Keyboard]] + g.NavInputSource = 2 --[[ImGuiInputSource.Keyboard]] break end end end - if g.NavWindowingToggleLayer and g.NavWindowingInputSource == ImGuiInputSource.Keyboard then + if g.NavWindowingToggleLayer and g.NavWindowingInputSource == 2 --[[ImGuiInputSource.Keyboard]] then -- We cancel toggling nav layer when any text has been typed (generally while holding Alt). (See #370) -- We cancel toggling nav layer when other modifiers are pressed. (See #4439) -- - AltGR is Alt+Ctrl on some layout but we can't reliably detect it (not all backends/systems/layout emit it as Alt+Ctrl). @@ -16540,7 +16574,7 @@ function ImGui.NavUpdateWindowing() g.NavWindowingToggleLayer = false elseif windowing_toggle_layer_start == false and g.LastKeyboardKeyPressTime == g.Time then g.NavWindowingToggleLayer = false - elseif ImGui.TestKeyOwner(g.NavWindowingToggleKey, ImGuiKeyOwner_NoOwner) == false or ImGui.TestKeyOwner(ImGuiMod_Alt, ImGuiKeyOwner_NoOwner) == false then + elseif ImGui.TestKeyOwner(g.NavWindowingToggleKey, 4294967295 --[[ImGuiKeyOwner_NoOwner]]) == false or ImGui.TestKeyOwner(16384 --[[ImGuiMod_Alt]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) == false then g.NavWindowingToggleLayer = false end @@ -16559,13 +16593,13 @@ function ImGui.NavUpdateWindowing() end -- Move window - if g.NavWindowingTarget and bit32.band(g.NavWindowingTarget.Flags, ImGuiWindowFlags.NoMove) == 0 then + if g.NavWindowingTarget and bit32.band(g.NavWindowingTarget.Flags, 4 --[[ImGuiWindowFlags.NoMove]]) == 0 then local nav_move_dir - if g.NavInputSource == ImGuiInputSource.Keyboard and not io.KeyShift then - nav_move_dir = ImGui.GetKeyMagnitude2d(ImGuiKey.LeftArrow, ImGuiKey.RightArrow, ImGuiKey.UpArrow, ImGuiKey.DownArrow) + if g.NavInputSource == 2 --[[ImGuiInputSource.Keyboard]] and not io.KeyShift then + nav_move_dir = ImGui.GetKeyMagnitude2d(513 --[[ImGuiKey.LeftArrow]], 514 --[[ImGuiKey.RightArrow]], 515 --[[ImGuiKey.UpArrow]], 516 --[[ImGuiKey.DownArrow]]) end - if g.NavInputSource == ImGuiInputSource.Gamepad then - nav_move_dir = ImGui.GetKeyMagnitude2d(ImGuiKey.GamepadLStickLeft, ImGuiKey.GamepadLStickRight, ImGuiKey.GamepadLStickUp, ImGuiKey.GamepadLStickDown) + if g.NavInputSource == 3 --[[ImGuiInputSource.Gamepad]] then + nav_move_dir = ImGui.GetKeyMagnitude2d(648 --[[ImGuiKey.GamepadLStickLeft]], 649 --[[ImGuiKey.GamepadLStickRight]], 650 --[[ImGuiKey.GamepadLStickUp]], 651 --[[ImGuiKey.GamepadLStickDown]]) end if nav_move_dir and (nav_move_dir.x ~= 0.0 or nav_move_dir.y ~= 0.0) then local NAV_MOVE_SPEED = 800.0 @@ -16575,7 +16609,7 @@ function ImGui.NavUpdateWindowing() local accum_floored = ImTrunc(g.NavWindowingAccumDeltaPos) if accum_floored.x ~= 0.0 or accum_floored.y ~= 0.0 then local moving_window = g.NavWindowingTarget.RootWindowDockTree - ImGui.SetWindowPos(moving_window, moving_window.Pos + accum_floored, ImGuiCond.Always) + ImGui.SetWindowPos(moving_window, moving_window.Pos + accum_floored, 1 --[[ImGuiCond.Always]]) ImVec2_Copy(g.NavWindowingAccumDeltaPos, g.NavWindowingAccumDeltaPos - accum_floored) end end @@ -16593,9 +16627,9 @@ function ImGui.NavUpdateWindowing() -- Move to parent menu if necessary local new_nav_window = g.NavWindow while new_nav_window.ParentWindow - and bit32.band(new_nav_window.DC.NavLayersActiveMask, bit32.lshift(1, ImGuiNavLayer.Menu)) == 0 - and bit32.band(new_nav_window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 - and bit32.band(new_nav_window.Flags, bit32.bor(ImGuiWindowFlags.Popup, ImGuiWindowFlags.ChildMenu)) == 0 do + and bit32.band(new_nav_window.DC.NavLayersActiveMask, bit32.lshift(1, 1 --[[ImGuiNavLayer.Menu]])) == 0 + and bit32.band(new_nav_window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 + and bit32.band(new_nav_window.Flags, bit32.bor(67108864 --[[ImGuiWindowFlags.Popup]], 268435456 --[[ImGuiWindowFlags.ChildMenu]])) == 0 do new_nav_window = new_nav_window.ParentWindow end if new_nav_window ~= g.NavWindow then @@ -16605,11 +16639,11 @@ function ImGui.NavUpdateWindowing() end -- Toggle layer - local new_nav_layer = (bit32.band(g.NavWindow.DC.NavLayersActiveMask, bit32.lshift(1, ImGuiNavLayer.Menu)) ~= 0) and bit32.bxor(g.NavLayer, 1) or ImGuiNavLayer.Main + local new_nav_layer = (bit32.band(g.NavWindow.DC.NavLayersActiveMask, bit32.lshift(1, 1 --[[ImGuiNavLayer.Menu]])) ~= 0) and bit32.bxor(g.NavLayer, 1) or 0 --[[ImGuiNavLayer.Main]] if new_nav_layer ~= g.NavLayer then -- Reinitialize navigation when entering menu bar with the Alt key (FIXME: could be a properly of the layer?) local preserve_layer_1_nav_id = (new_nav_window.DockNodeAsHost ~= nil) - if new_nav_layer == ImGuiNavLayer.Menu and not preserve_layer_1_nav_id then + if new_nav_layer == 1 --[[ImGuiNavLayer.Menu]] and not preserve_layer_1_nav_id then g.NavWindow.NavLastIds[new_nav_layer] = 0 end ImGui.NavRestoreLayer(new_nav_layer) @@ -16623,15 +16657,15 @@ function ImGui.NavUpdateContextMenuRequest() local io = g.IO g.NavOpenContextMenuItemId = 0 g.NavOpenContextMenuWindowId = 0 - local nav_keyboard_active = bit32.band(io.ConfigFlags, ImGuiConfigFlags.NavEnableKeyboard) ~= 0 - local nav_gamepad_active = bit32.band(io.ConfigFlags, ImGuiConfigFlags.NavEnableGamepad) ~= 0 + local nav_keyboard_active = bit32.band(io.ConfigFlags, 1 --[[ImGuiConfigFlags.NavEnableKeyboard]]) ~= 0 + local nav_gamepad_active = bit32.band(io.ConfigFlags, 2 --[[ImGuiConfigFlags.NavEnableGamepad]]) ~= 0 if (not nav_keyboard_active and not nav_gamepad_active) or g.NavWindow == nil then return end local request = false - request = request or (nav_keyboard_active and (ImGui.IsKeyReleased(ImGuiKey.Menu, ImGuiKeyOwner_NoOwner) or (ImGui.IsKeyPressedEx(ImGuiKey.F10, ImGuiInputFlags.None, ImGuiKeyOwner_NoOwner) and io.KeyMods == ImGuiMod_Shift))) - request = request or (nav_gamepad_active and ImGui.IsKeyPressedEx(ImGuiKey.NavGamepadContextMenu, ImGuiInputFlags.None, ImGuiKeyOwner_NoOwner)) + request = request or (nav_keyboard_active and (ImGui.IsKeyReleased(535 --[[ImGuiKey.Menu]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) or (ImGui.IsKeyPressedEx(581 --[[ImGuiKey.F10]], 0 --[[ImGuiInputFlags.None]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) and io.KeyMods == 8192 --[[ImGuiMod_Shift]]))) + request = request or (nav_gamepad_active and ImGui.IsKeyPressedEx(636 --[[ImGuiKey.NavGamepadContextMenu]], 0 --[[ImGuiInputFlags.None]], 4294967295 --[[ImGuiKeyOwner_NoOwner]])) if not request then return end @@ -16644,7 +16678,7 @@ function ImGui.NavUpdateContextMenuRequest() g.NavOpenContextMenuItemId = g.NavWindow.MoveId end - g.NavInputSource = ImGuiInputSource.Keyboard + g.NavInputSource = 2 --[[ImGuiInputSource.Keyboard]] ImGui.SetNavCursorVisibleAfterMove() end @@ -16655,11 +16689,11 @@ end --- @param scroll_flags ImGuiScrollFlags function ImGui.NavMoveRequestSubmit(move_dir, clip_dir, move_flags, scroll_flags) local g = GImGui - IM_ASSERT(g.NavWindow ~= nil) + assert(g.NavWindow ~= nil) -- IMGUI_DEBUG_LOG_NAV("[nav] NavMoveRequestSubmit: dir %c, window \"%s\"\n", "-WENS"[move_dir + 1], g.NavWindow->Name) - if bit32.band(move_flags, ImGuiNavMoveFlags.IsTabbing) ~= 0 then - move_flags = bit32.bor(move_flags, ImGuiNavMoveFlags.AllowCurrentNavId) + if bit32.band(move_flags, 1024 --[[ImGuiNavMoveFlags.IsTabbing]]) ~= 0 then + move_flags = bit32.bor(move_flags, 16 --[[ImGuiNavMoveFlags.AllowCurrentNavId]]) end g.NavMoveSubmitted = true; g.NavMoveScoringItems = true g.NavMoveDir = move_dir @@ -16668,7 +16702,7 @@ function ImGui.NavMoveRequestSubmit(move_dir, clip_dir, move_flags, scroll_flags g.NavMoveFlags = move_flags g.NavMoveScrollFlags = scroll_flags g.NavMoveForwardToNextFrame = false - g.NavMoveKeyMods = (bit32.band(move_flags, ImGuiNavMoveFlags.FocusApi) ~= 0) and 0 or g.IO.KeyMods + g.NavMoveKeyMods = (bit32.band(move_flags, 512 --[[ImGuiNavMoveFlags.FocusApi]]) ~= 0) and 0 or g.IO.KeyMods g.NavMoveResultLocal:Clear() g.NavMoveResultLocalVisible:Clear() g.NavMoveResultOther:Clear() @@ -16690,20 +16724,20 @@ function ImGui.NavBiasScoringRect(r, preferred_pos_rel, move_dir, move_flags) -- Initialize bias on departure if we don't have any. So mouse-click + arrow will record bias. -- - We default to L/U bias, so moving down from a large source item into several columns will land on left-most column. -- - But each successful move sets new bias on one axis, only cleared when using mouse. - if bit32.band(move_flags, ImGuiNavMoveFlags.Forwarded) == 0 then - if preferred_pos_rel.x == FLT_MAX then + if bit32.band(move_flags, 128 --[[ImGuiNavMoveFlags.Forwarded]]) == 0 then + if preferred_pos_rel.x == 3.4028234663853e+38 --[[FLT_MAX]] then preferred_pos_rel.x = ImMin(r.Min.x + 1.0, r.Max.x) - rel_to_abs_offset.x end - if preferred_pos_rel.y == FLT_MAX then + if preferred_pos_rel.y == 3.4028234663853e+38 --[[FLT_MAX]] then preferred_pos_rel.y = r:GetCenter().y - rel_to_abs_offset.y end end -- Apply general bias on the other axis - if (move_dir == ImGuiDir.Up or move_dir == ImGuiDir.Down) and preferred_pos_rel.x ~= FLT_MAX then + if (move_dir == 2 --[[ImGuiDir.Up]] or move_dir == 3 --[[ImGuiDir.Down]]) and preferred_pos_rel.x ~= 3.4028234663853e+38 --[[FLT_MAX]] then local new_x = preferred_pos_rel.x + rel_to_abs_offset.x r.Min.x = new_x; r.Max.x = new_x - elseif (move_dir == ImGuiDir.Left or move_dir == ImGuiDir.Right) and preferred_pos_rel.y ~= FLT_MAX then + elseif (move_dir == 0 --[[ImGuiDir.Left]] or move_dir == 1 --[[ImGuiDir.Right]]) and preferred_pos_rel.y ~= 3.4028234663853e+38 --[[FLT_MAX]] then local new_y = preferred_pos_rel.y + rel_to_abs_offset.y r.Min.y = new_y; r.Max.y = new_y end @@ -16717,27 +16751,27 @@ end function ImGui.NavUpdatePageUpPageDown() local g = GImGui local window = g.NavWindow - if bit32.band(window.Flags, ImGuiWindowFlags.NoNavInputs) ~= 0 or g.NavWindowingTarget ~= nil then + if bit32.band(window.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) ~= 0 or g.NavWindowingTarget ~= nil then return 0.0 end - local page_up_held = ImGui.IsKeyDown(ImGuiKey.PageUp, ImGuiKeyOwner_NoOwner) - local page_down_held = ImGui.IsKeyDown(ImGuiKey.PageDown, ImGuiKeyOwner_NoOwner) - local home_pressed = ImGui.IsKeyPressedEx(ImGuiKey.Home, ImGuiInputFlags.Repeat, ImGuiKeyOwner_NoOwner) - local end_pressed = ImGui.IsKeyPressedEx(ImGuiKey.End, ImGuiInputFlags.Repeat, ImGuiKeyOwner_NoOwner) + local page_up_held = ImGui.IsKeyDown(517 --[[ImGuiKey.PageUp]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) + local page_down_held = ImGui.IsKeyDown(518 --[[ImGuiKey.PageDown]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) + local home_pressed = ImGui.IsKeyPressedEx(519 --[[ImGuiKey.Home]], 1 --[[ImGuiInputFlags.Repeat]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) + local end_pressed = ImGui.IsKeyPressedEx(520 --[[ImGuiKey.End]], 1 --[[ImGuiInputFlags.Repeat]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) if page_up_held == page_down_held and home_pressed == end_pressed then -- Proceed if either (not both) are pressed, otherwise early out return 0.0 end - if g.NavLayer ~= ImGuiNavLayer.Main then - ImGui.NavRestoreLayer(ImGuiNavLayer.Main) + if g.NavLayer ~= 0 --[[ImGuiNavLayer.Main]] then + ImGui.NavRestoreLayer(0 --[[ImGuiNavLayer.Main]]) end - if bit32.band(window.DC.NavLayersActiveMask, bit32.lshift(1, ImGuiNavLayer.Main)) == 0 and window.DC.NavWindowHasScrollY then + if bit32.band(window.DC.NavLayersActiveMask, bit32.lshift(1, 0 --[[ImGuiNavLayer.Main]])) == 0 and window.DC.NavWindowHasScrollY then -- Fallback manual-scroll when window has no navigable item - if ImGui.IsKeyPressedEx(ImGuiKey.PageUp, ImGuiInputFlags.Repeat, ImGuiKeyOwner_NoOwner) then + if ImGui.IsKeyPressedEx(517 --[[ImGuiKey.PageUp]], 1 --[[ImGuiInputFlags.Repeat]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) then ImGui.SetScrollY(window, window.Scroll.y - window.InnerRect:GetHeight()) - elseif ImGui.IsKeyPressedEx(ImGuiKey.PageDown, ImGuiInputFlags.Repeat, ImGuiKeyOwner_NoOwner) then + elseif ImGui.IsKeyPressedEx(518 --[[ImGuiKey.PageDown]], 1 --[[ImGuiInputFlags.Repeat]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) then ImGui.SetScrollY(window, window.Scroll.y + window.InnerRect:GetHeight()) elseif home_pressed then ImGui.SetScrollY(window, 0.0) @@ -16748,16 +16782,16 @@ function ImGui.NavUpdatePageUpPageDown() local nav_rect_rel = window.NavRectRel[g.NavLayer] local page_offset_y = ImMax(0.0, window.InnerRect:GetHeight() - window.FontRefSize * 1.0 + nav_rect_rel:GetHeight()) local nav_scoring_rect_offset_y = 0.0 - if ImGui.IsKeyPressedEx(ImGuiKey.PageUp, ImGuiInputFlags.Repeat, ImGuiKeyOwner_NoOwner) then + if ImGui.IsKeyPressedEx(517 --[[ImGuiKey.PageUp]], 1 --[[ImGuiInputFlags.Repeat]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) then nav_scoring_rect_offset_y = -page_offset_y - g.NavMoveDir = ImGuiDir.Down -- Because our scoring rect is offset up, we request the down direction (so we can always land on the last item) - g.NavMoveClipDir = ImGuiDir.Up - g.NavMoveFlags = bit32.bor(ImGuiNavMoveFlags.AllowCurrentNavId, ImGuiNavMoveFlags.IsPageMove) -- ImGuiNavMoveFlags.AlsoScoreVisibleSet may be added later - elseif ImGui.IsKeyPressedEx(ImGuiKey.PageDown, ImGuiInputFlags.Repeat, ImGuiKeyOwner_NoOwner) then + g.NavMoveDir = 3 --[[ImGuiDir.Down]] -- Because our scoring rect is offset up, we request the down direction (so we can always land on the last item) + g.NavMoveClipDir = 2 --[[ImGuiDir.Up]] + g.NavMoveFlags = bit32.bor(16 --[[ImGuiNavMoveFlags.AllowCurrentNavId]], 2048 --[[ImGuiNavMoveFlags.IsPageMove]]) -- ImGuiNavMoveFlags.AlsoScoreVisibleSet may be added later + elseif ImGui.IsKeyPressedEx(518 --[[ImGuiKey.PageDown]], 1 --[[ImGuiInputFlags.Repeat]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) then nav_scoring_rect_offset_y = page_offset_y - g.NavMoveDir = ImGuiDir.Up -- Because our scoring rect is offset down, we request the up direction (so we can always land on the last item) - g.NavMoveClipDir = ImGuiDir.Down - g.NavMoveFlags = bit32.bor(ImGuiNavMoveFlags.AllowCurrentNavId, ImGuiNavMoveFlags.IsPageMove) -- ImGuiNavMoveFlags.AlsoScoreVisibleSet may be added later + g.NavMoveDir = 2 --[[ImGuiDir.Up]] -- Because our scoring rect is offset down, we request the up direction (so we can always land on the last item) + g.NavMoveClipDir = 3 --[[ImGuiDir.Down]] + g.NavMoveFlags = bit32.bor(16 --[[ImGuiNavMoveFlags.AllowCurrentNavId]], 2048 --[[ImGuiNavMoveFlags.IsPageMove]]) -- ImGuiNavMoveFlags.AlsoScoreVisibleSet may be added later elseif home_pressed then -- FIXME-NAV: handling of Home/End is assuming that the top/bottom most item will be visible with Scroll.y == 0/ScrollMax.y -- Scrolling will be handled via the ImGuiNavMoveFlags.ScrollToEdgeY flag, we don't scroll immediately to avoid scrolling happening before nav result. @@ -16766,16 +16800,16 @@ function ImGui.NavUpdatePageUpPageDown() if nav_rect_rel:IsInverted() then nav_rect_rel.Min.x = 0.0; nav_rect_rel.Max.x = 0.0 end - g.NavMoveDir = ImGuiDir.Down - g.NavMoveFlags = bit32.bor(ImGuiNavMoveFlags.AllowCurrentNavId, ImGuiNavMoveFlags.ScrollToEdgeY) + g.NavMoveDir = 3 --[[ImGuiDir.Down]] + g.NavMoveFlags = bit32.bor(16 --[[ImGuiNavMoveFlags.AllowCurrentNavId]], 64 --[[ImGuiNavMoveFlags.ScrollToEdgeY]]) -- FIXME-NAV: MoveClipDir left to _None, intentional? elseif end_pressed then nav_rect_rel.Min.y = window.ContentSize.y; nav_rect_rel.Max.y = window.ContentSize.y if nav_rect_rel:IsInverted() then nav_rect_rel.Min.x = 0.0; nav_rect_rel.Max.x = 0.0 end - g.NavMoveDir = ImGuiDir.Up - g.NavMoveFlags = bit32.bor(ImGuiNavMoveFlags.AllowCurrentNavId, ImGuiNavMoveFlags.ScrollToEdgeY) + g.NavMoveDir = 2 --[[ImGuiDir.Up]] + g.NavMoveFlags = bit32.bor(16 --[[ImGuiNavMoveFlags.AllowCurrentNavId]], 64 --[[ImGuiNavMoveFlags.ScrollToEdgeY]]) -- FIXME-NAV: MoveClipDir left to _None, intentional? end return nav_scoring_rect_offset_y @@ -16787,41 +16821,41 @@ function ImGui.NavUpdateCreateMoveRequest() local g = GImGui local io = g.IO local window = g.NavWindow - local nav_gamepad_active = bit32.band(io.ConfigFlags, ImGuiConfigFlags.NavEnableGamepad) ~= 0 and bit32.band(io.BackendFlags, ImGuiBackendFlags.HasGamepad) ~= 0 - local nav_keyboard_active = bit32.band(io.ConfigFlags, ImGuiConfigFlags.NavEnableKeyboard) ~= 0 + local nav_gamepad_active = bit32.band(io.ConfigFlags, 2 --[[ImGuiConfigFlags.NavEnableGamepad]]) ~= 0 and bit32.band(io.BackendFlags, 1 --[[ImGuiBackendFlags.HasGamepad]]) ~= 0 + local nav_keyboard_active = bit32.band(io.ConfigFlags, 1 --[[ImGuiConfigFlags.NavEnableKeyboard]]) ~= 0 if g.NavMoveForwardToNextFrame and window ~= nil then -- Forwarding previous request (which has been modified, e.g. wrap around menus rewrite the requests with a starting rectangle at the other side of the window) -- (preserve most state, which were already set by the NavMoveRequestForward() function) - IM_ASSERT(g.NavMoveDir ~= ImGuiDir.None and g.NavMoveClipDir ~= ImGuiDir.None) - IM_ASSERT(bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.Forwarded) ~= 0) + assert(g.NavMoveDir ~= (-1) --[[ImGuiDir.None]] and g.NavMoveClipDir ~= (-1) --[[ImGuiDir.None]]) + assert(bit32.band(g.NavMoveFlags, 128 --[[ImGuiNavMoveFlags.Forwarded]]) ~= 0) -- IMGUI_DEBUG_LOG_NAV("[nav] NavMoveRequestForward %d\n", g.NavMoveDir) else -- Initiate directional inputs request - g.NavMoveDir = ImGuiDir.None - g.NavMoveFlags = ImGuiNavMoveFlags.None - g.NavMoveScrollFlags = ImGuiScrollFlags.None - if window and not g.NavWindowingTarget and bit32.band(window.Flags, ImGuiWindowFlags.NoNavInputs) == 0 then - local repeat_mode = bit32.bor(ImGuiInputFlags.Repeat, ImGuiInputFlags.RepeatRateNavMove) - if not ImGui.IsActiveIdUsingNavDir(ImGuiDir.Left) and ((nav_gamepad_active and ImGui.IsKeyPressedEx(ImGuiKey.GamepadDpadLeft, repeat_mode, ImGuiKeyOwner_NoOwner)) or (nav_keyboard_active and ImGui.IsKeyPressedEx(ImGuiKey.LeftArrow, repeat_mode, ImGuiKeyOwner_NoOwner))) then g.NavMoveDir = ImGuiDir.Left end - if not ImGui.IsActiveIdUsingNavDir(ImGuiDir.Right) and ((nav_gamepad_active and ImGui.IsKeyPressedEx(ImGuiKey.GamepadDpadRight, repeat_mode, ImGuiKeyOwner_NoOwner)) or (nav_keyboard_active and ImGui.IsKeyPressedEx(ImGuiKey.RightArrow, repeat_mode, ImGuiKeyOwner_NoOwner))) then g.NavMoveDir = ImGuiDir.Right end - if not ImGui.IsActiveIdUsingNavDir(ImGuiDir.Up) and ((nav_gamepad_active and ImGui.IsKeyPressedEx(ImGuiKey.GamepadDpadUp, repeat_mode, ImGuiKeyOwner_NoOwner)) or (nav_keyboard_active and ImGui.IsKeyPressedEx(ImGuiKey.UpArrow, repeat_mode, ImGuiKeyOwner_NoOwner))) then g.NavMoveDir = ImGuiDir.Up end - if not ImGui.IsActiveIdUsingNavDir(ImGuiDir.Down) and ((nav_gamepad_active and ImGui.IsKeyPressedEx(ImGuiKey.GamepadDpadDown, repeat_mode, ImGuiKeyOwner_NoOwner)) or (nav_keyboard_active and ImGui.IsKeyPressedEx(ImGuiKey.DownArrow, repeat_mode, ImGuiKeyOwner_NoOwner))) then g.NavMoveDir = ImGuiDir.Down end + g.NavMoveDir = (-1) --[[ImGuiDir.None]] + g.NavMoveFlags = 0 --[[ImGuiNavMoveFlags.None]] + g.NavMoveScrollFlags = 0 --[[ImGuiScrollFlags.None]] + if window and not g.NavWindowingTarget and bit32.band(window.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) == 0 then + local repeat_mode = bit32.bor(1 --[[ImGuiInputFlags.Repeat]], 4 --[[ImGuiInputFlags.RepeatRateNavMove]]) + if not ImGui.IsActiveIdUsingNavDir(0 --[[ImGuiDir.Left]]) and ((nav_gamepad_active and ImGui.IsKeyPressedEx(638 --[[ImGuiKey.GamepadDpadLeft]], repeat_mode, 4294967295 --[[ImGuiKeyOwner_NoOwner]])) or (nav_keyboard_active and ImGui.IsKeyPressedEx(513 --[[ImGuiKey.LeftArrow]], repeat_mode, 4294967295 --[[ImGuiKeyOwner_NoOwner]]))) then g.NavMoveDir = 0 --[[ImGuiDir.Left]] end + if not ImGui.IsActiveIdUsingNavDir(1 --[[ImGuiDir.Right]]) and ((nav_gamepad_active and ImGui.IsKeyPressedEx(639 --[[ImGuiKey.GamepadDpadRight]], repeat_mode, 4294967295 --[[ImGuiKeyOwner_NoOwner]])) or (nav_keyboard_active and ImGui.IsKeyPressedEx(514 --[[ImGuiKey.RightArrow]], repeat_mode, 4294967295 --[[ImGuiKeyOwner_NoOwner]]))) then g.NavMoveDir = 1 --[[ImGuiDir.Right]] end + if not ImGui.IsActiveIdUsingNavDir(2 --[[ImGuiDir.Up]]) and ((nav_gamepad_active and ImGui.IsKeyPressedEx(640 --[[ImGuiKey.GamepadDpadUp]], repeat_mode, 4294967295 --[[ImGuiKeyOwner_NoOwner]])) or (nav_keyboard_active and ImGui.IsKeyPressedEx(515 --[[ImGuiKey.UpArrow]], repeat_mode, 4294967295 --[[ImGuiKeyOwner_NoOwner]]))) then g.NavMoveDir = 2 --[[ImGuiDir.Up]] end + if not ImGui.IsActiveIdUsingNavDir(3 --[[ImGuiDir.Down]]) and ((nav_gamepad_active and ImGui.IsKeyPressedEx(641 --[[ImGuiKey.GamepadDpadDown]], repeat_mode, 4294967295 --[[ImGuiKeyOwner_NoOwner]])) or (nav_keyboard_active and ImGui.IsKeyPressedEx(516 --[[ImGuiKey.DownArrow]], repeat_mode, 4294967295 --[[ImGuiKeyOwner_NoOwner]]))) then g.NavMoveDir = 3 --[[ImGuiDir.Down]] end end g.NavMoveClipDir = g.NavMoveDir - ImRect_Copy(g.NavScoringNoClipRect, ImRect(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX)) + ImRect_Copy(g.NavScoringNoClipRect, ImRect(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]])) end -- Update PageUp/PageDown/Home/End scroll -- FIXME-NAV: Consider enabling those keys even without the master ImGuiConfigFlags.NavEnableKeyboard flag? local scoring_page_offset_y = 0.0 - if window and g.NavMoveDir == ImGuiDir.None and nav_keyboard_active then + if window and g.NavMoveDir == (-1) --[[ImGuiDir.None]] and nav_keyboard_active then scoring_page_offset_y = ImGui.NavUpdatePageUpPageDown() end -- Submit g.NavMoveForwardToNextFrame = false - if g.NavMoveDir ~= ImGuiDir.None then + if g.NavMoveDir ~= (-1) --[[ImGuiDir.None]] then ImGui.NavMoveRequestSubmit(g.NavMoveDir, g.NavMoveClipDir, g.NavMoveFlags, g.NavMoveScrollFlags) end @@ -16838,9 +16872,9 @@ function ImGui.NavUpdateCreateMoveRequest() -- When using gamepad, we project the reference nav bounding box into window visible area. -- This is to allow resuming navigation inside the visible area after doing a large amount of scrolling, -- since with gamepad all movements are relative (can't focus a visible object like we can with the mouse). - if g.NavMoveSubmitted and g.NavInputSource == ImGuiInputSource.Gamepad and g.NavLayer == ImGuiNavLayer.Main and window ~= nil then -- and (g.NavMoveFlags & ImGuiNavMoveFlags_Forwarded)) - local clamp_x = bit32.band(g.NavMoveFlags, bit32.bor(ImGuiNavMoveFlags.LoopX, ImGuiNavMoveFlags.WrapX)) == 0 - local clamp_y = bit32.band(g.NavMoveFlags, bit32.bor(ImGuiNavMoveFlags.LoopY, ImGuiNavMoveFlags.WrapY)) == 0 + if g.NavMoveSubmitted and g.NavInputSource == 3 --[[ImGuiInputSource.Gamepad]] and g.NavLayer == 0 --[[ImGuiNavLayer.Main]] and window ~= nil then -- and (g.NavMoveFlags & ImGuiNavMoveFlags_Forwarded)) + local clamp_x = bit32.band(g.NavMoveFlags, bit32.bor(1 --[[ImGuiNavMoveFlags.LoopX]], 4 --[[ImGuiNavMoveFlags.WrapX]])) == 0 + local clamp_y = bit32.band(g.NavMoveFlags, bit32.bor(2 --[[ImGuiNavMoveFlags.LoopY]], 8 --[[ImGuiNavMoveFlags.WrapY]])) == 0 local inner_rect_rel = ImGui.WindowRectAbsToRel(window, ImRect(ImVec2(window.InnerRect.Min.x - 1, window.InnerRect.Min.y - 1), ImVec2(window.InnerRect.Max.x + 1, window.InnerRect.Max.y + 1))) -- Take account of changing scroll to handle triggering a new move request on a scrolling frame. (#6171) @@ -16852,10 +16886,10 @@ function ImGui.NavUpdateCreateMoveRequest() -- IMGUI_DEBUG_LOG_NAV("[nav] NavMoveRequest: clamp NavRectRel for gamepad move\n") local pad_x = ImMin(inner_rect_rel:GetWidth(), window.FontRefSize * 0.5) local pad_y = ImMin(inner_rect_rel:GetHeight(), window.FontRefSize * 0.5) -- Terrible approximation for the intent of starting navigation from first fully visible item - inner_rect_rel.Min.x = clamp_x and (inner_rect_rel.Min.x + pad_x) or -FLT_MAX - inner_rect_rel.Max.x = clamp_x and (inner_rect_rel.Max.x - pad_x) or FLT_MAX - inner_rect_rel.Min.y = clamp_y and (inner_rect_rel.Min.y + pad_y) or -FLT_MAX - inner_rect_rel.Max.y = clamp_y and (inner_rect_rel.Max.y - pad_y) or FLT_MAX + inner_rect_rel.Min.x = clamp_x and (inner_rect_rel.Min.x + pad_x) or -3.4028234663853e+38 --[[FLT_MAX]] + inner_rect_rel.Max.x = clamp_x and (inner_rect_rel.Max.x - pad_x) or 3.4028234663853e+38 --[[FLT_MAX]] + inner_rect_rel.Min.y = clamp_y and (inner_rect_rel.Min.y + pad_y) or -3.4028234663853e+38 --[[FLT_MAX]] + inner_rect_rel.Max.y = clamp_y and (inner_rect_rel.Max.y - pad_y) or 3.4028234663853e+38 --[[FLT_MAX]] window.NavRectRel[g.NavLayer]:ClipWithFull(inner_rect_rel) g.NavId = 0 end @@ -16871,10 +16905,10 @@ function ImGui.NavUpdateCreateMoveRequest() end scoring_rect = ImGui.WindowRectRelToAbs(window, nav_rect_rel) - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.IsPageMove) ~= 0 then + if bit32.band(g.NavMoveFlags, 2048 --[[ImGuiNavMoveFlags.IsPageMove]]) ~= 0 then -- When we start from a visible location, score visible items and prioritize this result. if window.InnerRect:Contains(scoring_rect) then - g.NavMoveFlags = bit32.bor(g.NavMoveFlags, ImGuiNavMoveFlags.AlsoScoreVisibleSet) + g.NavMoveFlags = bit32.bor(g.NavMoveFlags, 32 --[[ImGuiNavMoveFlags.AlsoScoreVisibleSet]]) end ImRect_Copy(g.NavScoringNoClipRect, scoring_rect) scoring_rect:TranslateY(scoring_page_offset_y) @@ -16885,7 +16919,7 @@ function ImGui.NavUpdateCreateMoveRequest() if g.NavMoveSubmitted then ImGui.NavBiasScoringRect(scoring_rect, window.RootWindowForNav.NavPreferredScoringPosRel[g.NavLayer], g.NavMoveDir, g.NavMoveFlags) end - IM_ASSERT(not scoring_rect:IsInverted()) -- Ensure we have a non-inverted bounding box here will allow us to remove extraneous ImFabs() calls in NavScoreItem(). + assert(not scoring_rect:IsInverted()) -- Ensure we have a non-inverted bounding box here will allow us to remove extraneous ImFabs() calls in NavScoreItem(). -- ImGui.GetForegroundDrawList():AddRectFilled(scoring_rect.Min - ImVec2(1, 1), scoring_rect.Max + ImVec2(1, 1), IM_COL32(255, 100, 0, 80)) -- [DEBUG] Post-bias -- if not g.NavScoringNoClipRect:IsInverted() then ImGui.GetForegroundDrawList():AddRectFilled(g.NavScoringNoClipRect.Min, g.NavScoringNoClipRect.Max, IM_COL32(100, 255, 0, 80)) end -- [DEBUG] end @@ -16896,12 +16930,12 @@ end function ImGui.NavUpdateCreateTabbingRequest() local g = GImGui local window = g.NavWindow - IM_ASSERT(g.NavMoveDir == ImGuiDir.None) - if window == nil or g.NavWindowingTarget ~= nil or bit32.band(window.Flags, ImGuiWindowFlags.NoNavInputs) ~= 0 or not g.ConfigNavEnableTabbing then + assert(g.NavMoveDir == (-1) --[[ImGuiDir.None]]) + if window == nil or g.NavWindowingTarget ~= nil or bit32.band(window.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) ~= 0 or not g.ConfigNavEnableTabbing then return end - local tab_pressed = ImGui.IsKeyPressedEx(ImGuiKey.Tab, ImGuiInputFlags.Repeat, ImGuiKeyOwner_NoOwner) and not g.IO.KeyCtrl and not g.IO.KeyAlt + local tab_pressed = ImGui.IsKeyPressedEx(512 --[[ImGuiKey.Tab]], 1 --[[ImGuiInputFlags.Repeat]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) and not g.IO.KeyCtrl and not g.IO.KeyAlt if not tab_pressed then return end @@ -16909,16 +16943,16 @@ function ImGui.NavUpdateCreateTabbingRequest() -- Initiate tabbing request -- (this is ALWAYS ENABLED, regardless of ImGuiConfigFlags.NavEnableKeyboard flag!) -- See NavProcessItemForTabbingRequest() for a description of the various forward/backward tabbing cases with and without wrapping. - local nav_keyboard_active = bit32.band(g.IO.ConfigFlags, ImGuiConfigFlags.NavEnableKeyboard) ~= 0 + local nav_keyboard_active = bit32.band(g.IO.ConfigFlags, 1 --[[ImGuiConfigFlags.NavEnableKeyboard]]) ~= 0 if nav_keyboard_active then g.NavTabbingDir = g.IO.KeyShift and -1 or ((g.NavCursorVisible == false and g.ActiveId == 0) and 0 or 1) else g.NavTabbingDir = g.IO.KeyShift and -1 or ((g.ActiveId == 0) and 0 or 1) end - local move_flags = bit32.bor(ImGuiNavMoveFlags.IsTabbing, ImGuiNavMoveFlags.Activate) - local scroll_flags = window.Appearing and bit32.bor(ImGuiScrollFlags.KeepVisibleEdgeX, ImGuiScrollFlags.AlwaysCenterY) or bit32.bor(ImGuiScrollFlags.KeepVisibleEdgeX, ImGuiScrollFlags.KeepVisibleEdgeY) - local clip_dir = (g.NavTabbingDir < 0) and ImGuiDir.Up or ImGuiDir.Down - ImGui.NavMoveRequestSubmit(ImGuiDir.None, clip_dir, move_flags, scroll_flags) -- FIXME-NAV: Once we refactor tabbing, add LegacyApi flag to not activate non-inputable. + local move_flags = bit32.bor(1024 --[[ImGuiNavMoveFlags.IsTabbing]], 4096 --[[ImGuiNavMoveFlags.Activate]]) + local scroll_flags = window.Appearing and bit32.bor(1 --[[ImGuiScrollFlags.KeepVisibleEdgeX]], 32 --[[ImGuiScrollFlags.AlwaysCenterY]]) or bit32.bor(1 --[[ImGuiScrollFlags.KeepVisibleEdgeX]], 2 --[[ImGuiScrollFlags.KeepVisibleEdgeY]]) + local clip_dir = (g.NavTabbingDir < 0) and 2 --[[ImGuiDir.Up]] or 3 --[[ImGuiDir.Down]] + ImGui.NavMoveRequestSubmit((-1) --[[ImGuiDir.None]], clip_dir, move_flags, scroll_flags) -- FIXME-NAV: Once we refactor tabbing, add LegacyApi flag to not activate non-inputable. g.NavTabbingCounter = -1 end @@ -16931,20 +16965,20 @@ function ImGui.NavUpdate() -- Set input source based on which keys are last pressed (as some features differs when used with Gamepad vs Keyboard) -- FIXME-NAV: Now that keys are separated maybe we can get rid of NavInputSource? - local nav_gamepad_active = bit32.band(io.ConfigFlags, ImGuiConfigFlags.NavEnableGamepad) ~= 0 and bit32.band(io.BackendFlags, ImGuiBackendFlags.HasGamepad) ~= 0 - if nav_gamepad_active and g.NavInputSource ~= ImGuiInputSource.Gamepad then + local nav_gamepad_active = bit32.band(io.ConfigFlags, 2 --[[ImGuiConfigFlags.NavEnableGamepad]]) ~= 0 and bit32.band(io.BackendFlags, 1 --[[ImGuiBackendFlags.HasGamepad]]) ~= 0 + if nav_gamepad_active and g.NavInputSource ~= 3 --[[ImGuiInputSource.Gamepad]] then for _, key in ipairs(nav_gamepad_keys_to_change_source) do if ImGui.IsKeyDown(key) then - g.NavInputSource = ImGuiInputSource.Gamepad + g.NavInputSource = 3 --[[ImGuiInputSource.Gamepad]] end end end - local nav_keyboard_active = bit32.band(io.ConfigFlags, ImGuiConfigFlags.NavEnableKeyboard) ~= 0 - if nav_keyboard_active and g.NavInputSource ~= ImGuiInputSource.Keyboard then + local nav_keyboard_active = bit32.band(io.ConfigFlags, 1 --[[ImGuiConfigFlags.NavEnableKeyboard]]) ~= 0 + if nav_keyboard_active and g.NavInputSource ~= 2 --[[ImGuiInputSource.Keyboard]] then for _, key in ipairs(nav_keyboard_keys_to_change_source) do if ImGui.IsKeyDown(key) then - g.NavInputSource = ImGuiInputSource.Keyboard + g.NavInputSource = 2 --[[ImGuiInputSource.Keyboard]] end end end @@ -16982,13 +17016,13 @@ function ImGui.NavUpdate() end end g.NavMousePosDirty = false - IM_ASSERT(g.NavLayer == ImGuiNavLayer.Main or g.NavLayer == ImGuiNavLayer.Menu) + assert(g.NavLayer == 0 --[[ImGuiNavLayer.Main]] or g.NavLayer == 1 --[[ImGuiNavLayer.Menu]]) -- Store our return window (for returning from Menu Layer to Main Layer) and clear it as soon as we step back in our own Layer 0 if g.NavWindow then ImGui.NavSaveLastChildNavWindowIntoParent(g.NavWindow) end - if g.NavWindow and g.NavWindow.NavLastChildNavWindow ~= nil and g.NavLayer == ImGuiNavLayer.Main then + if g.NavWindow and g.NavWindow.NavLastChildNavWindow ~= nil and g.NavLayer == 0 --[[ImGuiNavLayer.Main]] then g.NavWindow.NavLastChildNavWindow = nil end @@ -16996,7 +17030,7 @@ function ImGui.NavUpdate() ImGui.NavUpdateWindowing() -- Set output flags for user application - io.NavActive = (nav_keyboard_active or nav_gamepad_active) and g.NavWindow and bit32.band(g.NavWindow.Flags, ImGuiWindowFlags.NoNavInputs) == 0 + io.NavActive = (nav_keyboard_active or nav_gamepad_active) and g.NavWindow and bit32.band(g.NavWindow.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) == 0 io.NavVisible = (io.NavActive and g.NavId ~= 0 and g.NavCursorVisible) or (g.NavWindowingTarget ~= nil) -- Process NavCancel input (to close a popup, get back to parent, clear focus) @@ -17007,26 +17041,26 @@ function ImGui.NavUpdate() g.NavActivateId = 0 g.NavActivateDownId = 0 g.NavActivatePressedId = 0 - g.NavActivateFlags = ImGuiActivateFlags.None + g.NavActivateFlags = 0 --[[ImGuiActivateFlags.None]] - if g.NavId ~= 0 and g.NavCursorVisible and not g.NavWindowingTarget and g.NavWindow and bit32.band(g.NavWindow.Flags, ImGuiWindowFlags.NoNavInputs) == 0 then - local activate_down = (nav_keyboard_active and ImGui.IsKeyDown(ImGuiKey.Space, ImGuiKeyOwner_NoOwner)) or (nav_gamepad_active and ImGui.IsKeyDown(ImGuiKey.NavGamepadActivate, ImGuiKeyOwner_NoOwner)) - local activate_pressed = activate_down and ((nav_keyboard_active and ImGui.IsKeyPressedEx(ImGuiKey.Space, ImGuiInputFlags.None, ImGuiKeyOwner_NoOwner)) or (nav_gamepad_active and ImGui.IsKeyPressedEx(ImGuiKey.NavGamepadActivate, ImGuiInputFlags.None, ImGuiKeyOwner_NoOwner))) - local input_pressed_keyboard = nav_keyboard_active and (ImGui.IsKeyPressedEx(ImGuiKey.Enter, ImGuiInputFlags.None, ImGuiKeyOwner_NoOwner) or ImGui.IsKeyPressedEx(ImGuiKey.KeypadEnter, ImGuiInputFlags.None, ImGuiKeyOwner_NoOwner)) + if g.NavId ~= 0 and g.NavCursorVisible and not g.NavWindowingTarget and g.NavWindow and bit32.band(g.NavWindow.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) == 0 then + local activate_down = (nav_keyboard_active and ImGui.IsKeyDown(524 --[[ImGuiKey.Space]], 4294967295 --[[ImGuiKeyOwner_NoOwner]])) or (nav_gamepad_active and ImGui.IsKeyDown(ImGuiKey.NavGamepadActivate, 4294967295 --[[ImGuiKeyOwner_NoOwner]])) + local activate_pressed = activate_down and ((nav_keyboard_active and ImGui.IsKeyPressedEx(524 --[[ImGuiKey.Space]], 0 --[[ImGuiInputFlags.None]], 4294967295 --[[ImGuiKeyOwner_NoOwner]])) or (nav_gamepad_active and ImGui.IsKeyPressedEx(ImGuiKey.NavGamepadActivate, 0 --[[ImGuiInputFlags.None]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]))) + local input_pressed_keyboard = nav_keyboard_active and (ImGui.IsKeyPressedEx(525 --[[ImGuiKey.Enter]], 0 --[[ImGuiInputFlags.None]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) or ImGui.IsKeyPressedEx(627 --[[ImGuiKey.KeypadEnter]], 0 --[[ImGuiInputFlags.None]], 4294967295 --[[ImGuiKeyOwner_NoOwner]])) local input_pressed_gamepad = false - if activate_down and nav_gamepad_active and ImGui.IsKeyDown(ImGuiKey.NavGamepadActivate, ImGuiKeyOwner_NoOwner) and bit32.band(g.NavIdItemFlags, ImGuiItemFlags.Inputable) ~= 0 then -- requires ImGuiItemFlags.Inputable to avoid retriggering regular buttons. - if ImGui.GetKeyData(g, ImGuiKey.NavGamepadActivate).DownDurationPrev < NAV_ACTIVATE_INPUT_WITH_GAMEPAD_DELAY and ImGui.GetKeyData(g, ImGuiKey.NavGamepadActivate).DownDuration >= NAV_ACTIVATE_INPUT_WITH_GAMEPAD_DELAY then + if activate_down and nav_gamepad_active and ImGui.IsKeyDown(ImGuiKey.NavGamepadActivate, 4294967295 --[[ImGuiKeyOwner_NoOwner]]) and bit32.band(g.NavIdItemFlags, 1048576 --[[ImGuiItemFlags.Inputable]]) ~= 0 then -- requires ImGuiItemFlags.Inputable to avoid retriggering regular buttons. + if ImGui.GetKeyData(g, ImGuiKey.NavGamepadActivate).DownDurationPrev < 0.6 --[[NAV_ACTIVATE_INPUT_WITH_GAMEPAD_DELAY]] and ImGui.GetKeyData(g, ImGuiKey.NavGamepadActivate).DownDuration >= 0.6 --[[NAV_ACTIVATE_INPUT_WITH_GAMEPAD_DELAY]] then input_pressed_gamepad = true end end if g.ActiveId == 0 and activate_pressed then g.NavActivateId = g.NavId - g.NavActivateFlags = ImGuiActivateFlags.PreferTweak + g.NavActivateFlags = 2 --[[ImGuiActivateFlags.PreferTweak]] end if (g.ActiveId == 0 or g.ActiveId == g.NavId) and (input_pressed_keyboard or input_pressed_gamepad) then g.NavActivateId = g.NavId - g.NavActivateFlags = ImGuiActivateFlags.PreferInput + g.NavActivateFlags = 1 --[[ImGuiActivateFlags.PreferInput]] end if (g.ActiveId == 0 or g.ActiveId == g.NavId) and (activate_down or input_pressed_keyboard or input_pressed_gamepad) then -- FIXME-NAV: Unsure why input_pressed_xxx (migrated from input_down which was already dubious) g.NavActivateDownId = g.NavId @@ -17036,13 +17070,13 @@ function ImGui.NavUpdate() ImGui.NavHighlightActivated(g.NavId) end end - if g.NavWindow and bit32.band(g.NavWindow.Flags, ImGuiWindowFlags.NoNavInputs) ~= 0 then + if g.NavWindow and bit32.band(g.NavWindow.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) ~= 0 then g.NavCursorVisible = false elseif g.IO.ConfigNavCursorVisibleAlways and g.NavCursorHideFrames == 0 then g.NavCursorVisible = true end if g.NavActivateId ~= 0 then - IM_ASSERT(g.NavActivateDownId == g.NavActivateId) + assert(g.NavActivateDownId == g.NavActivateId) end -- Highlight @@ -17065,25 +17099,25 @@ function ImGui.NavUpdate() -- Process move requests ImGui.NavUpdateCreateMoveRequest() - if g.NavMoveDir == ImGuiDir.None then + if g.NavMoveDir == (-1) --[[ImGuiDir.None]] then ImGui.NavUpdateCreateTabbingRequest() end ImGui.NavUpdateAnyRequestFlag() g.NavIdIsAlive = false -- Scrolling - if g.NavWindow and bit32.band(g.NavWindow.Flags, ImGuiWindowFlags.NoNavInputs) == 0 and not g.NavWindowingTarget then + if g.NavWindow and bit32.band(g.NavWindow.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) == 0 and not g.NavWindowingTarget then -- *Fallback* manual-scroll with Nav directional keys when window has no navigable item local window = g.NavWindow local scroll_speed = IM_ROUND(window.FontRefSize * 100 * io.DeltaTime) -- We need round the scrolling speed because sub-pixel scroll isn't reliably supported. local move_dir = g.NavMoveDir - if window.DC.NavLayersActiveMask == 0x00 and window.DC.NavWindowHasScrollY and move_dir ~= ImGuiDir.None then - if move_dir == ImGuiDir.Left or move_dir == ImGuiDir.Right then - local delta = (move_dir == ImGuiDir.Left) and -1.0 or 1.0 + if window.DC.NavLayersActiveMask == 0x00 and window.DC.NavWindowHasScrollY and move_dir ~= (-1) --[[ImGuiDir.None]] then + if move_dir == 0 --[[ImGuiDir.Left]] or move_dir == 1 --[[ImGuiDir.Right]] then + local delta = (move_dir == 0 --[[ImGuiDir.Left]]) and -1.0 or 1.0 ImGui.SetScrollX(window, ImTrunc(window.Scroll.x + delta * scroll_speed)) end - if move_dir == ImGuiDir.Up or move_dir == ImGuiDir.Down then - local delta = (move_dir == ImGuiDir.Up) and -1.0 or 1.0 + if move_dir == 2 --[[ImGuiDir.Up]] or move_dir == 3 --[[ImGuiDir.Down]] then + local delta = (move_dir == 2 --[[ImGuiDir.Up]]) and -1.0 or 1.0 ImGui.SetScrollY(window, ImTrunc(window.Scroll.y + delta * scroll_speed)) end end @@ -17091,11 +17125,11 @@ function ImGui.NavUpdate() -- *Normal* Manual scroll with LStick -- Next movement request will clamp the NavId reference rectangle to the visible area, so navigation will resume within those bounds. if nav_gamepad_active then - local scroll_dir = ImGui.GetKeyMagnitude2d(ImGuiKey.GamepadLStickLeft, ImGuiKey.GamepadLStickRight, ImGuiKey.GamepadLStickUp, ImGuiKey.GamepadLStickDown) + local scroll_dir = ImGui.GetKeyMagnitude2d(648 --[[ImGuiKey.GamepadLStickLeft]], 649 --[[ImGuiKey.GamepadLStickRight]], 650 --[[ImGuiKey.GamepadLStickUp]], 651 --[[ImGuiKey.GamepadLStickDown]]) local tweak_factor = 1.0 - if ImGui.IsKeyDown(ImGuiKey.NavGamepadTweakSlow) then + if ImGui.IsKeyDown(642 --[[ImGuiKey.NavGamepadTweakSlow]]) then tweak_factor = 1.0 / 10.0 - elseif ImGui.IsKeyDown(ImGuiKey.NavGamepadTweakFast) then + elseif ImGui.IsKeyDown(643 --[[ImGuiKey.NavGamepadTweakFast]]) then tweak_factor = 10.0 end if scroll_dir.x ~= 0.0 and window.ScrollbarX then @@ -17116,8 +17150,8 @@ function ImGui.NavUpdate() -- Update mouse position if requested -- (This will take into account the possibility that a Scroll was queued in the window to offset our absolute mouse position before scroll has been applied) - if set_mouse_pos and io.ConfigNavMoveSetMousePos and bit32.band(io.BackendFlags, ImGuiBackendFlags.HasSetMousePos) ~= 0 then - ImGui.TeleportMousePos(ImGui.NavCalcPreferredRefPos(ImGuiWindowFlags.Popup)) + if set_mouse_pos and io.ConfigNavMoveSetMousePos and bit32.band(io.BackendFlags, 4 --[[ImGuiBackendFlags.HasSetMousePos]]) ~= 0 then + ImGui.TeleportMousePos(ImGui.NavCalcPreferredRefPos(67108864 --[[ImGuiWindowFlags.Popup]])) end -- [DEBUG] @@ -17132,35 +17166,35 @@ end -- - either to move most/all of those tests to the epilogue/end functions of the scope they are dealing with (e.g. exit child window in EndChild()) or in EndFrame(), to allow an earlier intercept function ImGui.NavUpdateCancelRequest() local g = GImGui - local nav_gamepad_active = bit32.band(g.IO.ConfigFlags, ImGuiConfigFlags.NavEnableGamepad) ~= 0 and bit32.band(g.IO.BackendFlags, ImGuiBackendFlags.HasGamepad) ~= 0 - local nav_keyboard_active = bit32.band(g.IO.ConfigFlags, ImGuiConfigFlags.NavEnableKeyboard) ~= 0 - if not (nav_keyboard_active and ImGui.IsKeyPressedEx(ImGuiKey.Escape, 0, ImGuiKeyOwner_NoOwner)) and not (nav_gamepad_active and ImGui.IsKeyPressedEx(ImGuiKey.NavGamepadCancel, 0, ImGuiKeyOwner_NoOwner)) then + local nav_gamepad_active = bit32.band(g.IO.ConfigFlags, 2 --[[ImGuiConfigFlags.NavEnableGamepad]]) ~= 0 and bit32.band(g.IO.BackendFlags, 1 --[[ImGuiBackendFlags.HasGamepad]]) ~= 0 + local nav_keyboard_active = bit32.band(g.IO.ConfigFlags, 1 --[[ImGuiConfigFlags.NavEnableKeyboard]]) ~= 0 + if not (nav_keyboard_active and ImGui.IsKeyPressedEx(526 --[[ImGuiKey.Escape]], 0, 4294967295 --[[ImGuiKeyOwner_NoOwner]])) and not (nav_gamepad_active and ImGui.IsKeyPressedEx(ImGuiKey.NavGamepadCancel, 0, 4294967295 --[[ImGuiKeyOwner_NoOwner]])) then return end -- IMGUI_DEBUG_LOG_NAV("[nav] NavUpdateCancelRequest()") if g.ActiveId ~= 0 then ImGui.ClearActiveID() - elseif g.NavLayer ~= ImGuiNavLayer.Main then + elseif g.NavLayer ~= 0 --[[ImGuiNavLayer.Main]] then -- Leave the "menu" layer - ImGui.NavRestoreLayer(ImGuiNavLayer.Main) + ImGui.NavRestoreLayer(0 --[[ImGuiNavLayer.Main]]) ImGui.SetNavCursorVisibleAfterMove() - elseif g.NavWindow and g.NavWindow ~= g.NavWindow.RootWindow and bit32.band(g.NavWindow.RootWindowForNav.Flags, ImGuiWindowFlags.Popup) == 0 and g.NavWindow.RootWindowForNav.ParentWindow then + elseif g.NavWindow and g.NavWindow ~= g.NavWindow.RootWindow and bit32.band(g.NavWindow.RootWindowForNav.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) == 0 and g.NavWindow.RootWindowForNav.ParentWindow then -- Exit child window local child_window = g.NavWindow.RootWindowForNav local parent_window = child_window.ParentWindow - IM_ASSERT(child_window.ChildId ~= 0) + assert(child_window.ChildId ~= 0) ImGui.FocusWindow(parent_window) - ImGui.SetNavID(child_window.ChildId, ImGuiNavLayer.Main, 0, ImGui.WindowRectAbsToRel(parent_window, child_window:Rect())) + ImGui.SetNavID(child_window.ChildId, 0 --[[ImGuiNavLayer.Main]], 0, ImGui.WindowRectAbsToRel(parent_window, child_window:Rect())) ImGui.SetNavCursorVisibleAfterMove() - elseif g.OpenPopupStack.Size > 0 and g.OpenPopupStack:back().Window ~= nil and bit32.band(g.OpenPopupStack:back().Window.Flags, ImGuiWindowFlags.Modal) == 0 then + elseif g.OpenPopupStack.Size > 0 and g.OpenPopupStack:back().Window ~= nil and bit32.band(g.OpenPopupStack:back().Window.Flags, 134217728 --[[ImGuiWindowFlags.Modal]]) == 0 then -- Close open popup/menu ImGui.ClosePopupToLevel(g.OpenPopupStack.Size - 1, true) else -- Clear NavLastId for popups but keep it for regular child window so we can leave one and come back where we were -- FIXME-NAV: This should happen on window appearing. if g.IO.ConfigNavEscapeClearFocusItem or g.IO.ConfigNavEscapeClearFocusWindow then - if g.NavWindow and bit32.band(g.NavWindow.Flags, ImGuiWindowFlags.Popup) ~= 0 then -- or not (g.NavWindow.Flags & ImGuiWindowFlags.ChildWindow) + if g.NavWindow and bit32.band(g.NavWindow.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 then -- or not (g.NavWindow.Flags & ImGuiWindowFlags.ChildWindow) g.NavWindow.NavLastIds[0] = 0 end end @@ -17182,9 +17216,9 @@ end local function ImGetDirQuadrantFromDelta(dx, dy) if ImFabs(dx) > ImFabs(dy) then - return (dx > 0.0) and ImGuiDir.Right or ImGuiDir.Left + return (dx > 0.0) and 1 --[[ImGuiDir.Right]] or 0 --[[ImGuiDir.Left]] end - return (dy > 0.0) and ImGuiDir.Down or ImGuiDir.Up + return (dy > 0.0) and 3 --[[ImGuiDir.Down]] or 2 --[[ImGuiDir.Up]] end local function NavScoreItemDistInterval(cand_min, cand_max, curr_min, curr_max) @@ -17216,7 +17250,7 @@ function ImGui.NavScoreItem(result, nav_bb) -- When entering through a NavFlattened border, we consider child window items as fully clipped for scoring if window.ParentWindow == g.NavWindow then - IM_ASSERT(bit32.band(bit32.bor(window.ChildFlags, g.NavWindow.ChildFlags), ImGuiChildFlags.NavFlattened) ~= 0) + assert(bit32.band(bit32.bor(window.ChildFlags, g.NavWindow.ChildFlags), 256 --[[ImGuiChildFlags.NavFlattened]]) ~= 0) if not window.ClipRect:Overlaps(cand) then return false end @@ -17259,7 +17293,7 @@ function ImGui.NavScoreItem(result, nav_bb) quadrant = ImGetDirQuadrantFromDelta(dcx, dcy) else -- Degenerate case: two overlapping buttons with same center, break ties arbitrarily (note that LastItemId here is really the _previous_ item order, but it doesn't matter) - quadrant = (g.LastItemData.ID < g.NavId) and ImGuiDir.Left or ImGuiDir.Right + quadrant = (g.LastItemData.ID < g.NavId) and 0 --[[ImGuiDir.Left]] or 1 --[[ImGuiDir.Right]] end local move_dir = g.NavMoveDir @@ -17282,7 +17316,7 @@ function ImGui.NavScoreItem(result, nav_bb) -- Still tied! we need to be extra-careful to make sure everything gets linked properly. We consistently break ties by symbolically moving "later" items -- (with higher index) to the right/downwards by an infinitesimal amount since we the current "best" button already (so it must have a lower index), -- this is fairly easy. This rule ensures that all buttons with dx==dy==0 will end up being linked in order of appearance along the x axis. - if (((move_dir == ImGuiDir.Up or move_dir == ImGuiDir.Down) and dby) or dbx) < 0.0 then -- moving bj to the right/down decreases distance + if (((move_dir == 2 --[[ImGuiDir.Up]] or move_dir == 3 --[[ImGuiDir.Down]]) and dby) or dbx) < 0.0 then -- moving bj to the right/down decreases distance new_best = true end end @@ -17294,9 +17328,9 @@ function ImGui.NavScoreItem(result, nav_bb) -- This is just to avoid buttons having no links in a particular direction when there's a suitable neighbor. you get good graphs without this too. -- 2017/09/29: FIXME: This now currently only enabled inside menu bars, ideally we'd disable it everywhere. Menus in particular need to catch failure. For general navigation it feels awkward. -- Disabling it may lead to disconnected graphs when nodes are very spaced out on different axis. Perhaps consider offering this as an option? - if result.DistBox == FLT_MAX and dist_axial < result.DistAxial then -- Check axial match - if g.NavLayer == ImGuiNavLayer.Menu and bit32.band(g.NavWindow.Flags, ImGuiWindowFlags.ChildMenu) == 0 then - if (move_dir == ImGuiDir.Left and dax < 0.0) or (move_dir == ImGuiDir.Right and dax > 0.0) or (move_dir == ImGuiDir.Up and day < 0.0) or (move_dir == ImGuiDir.Down and day > 0.0) then + if result.DistBox == 3.4028234663853e+38 --[[FLT_MAX]] and dist_axial < result.DistAxial then -- Check axial match + if g.NavLayer == 1 --[[ImGuiNavLayer.Menu]] and bit32.band(g.NavWindow.Flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) == 0 then + if (move_dir == 0 --[[ImGuiDir.Left]] and dax < 0.0) or (move_dir == 1 --[[ImGuiDir.Right]] and dax > 0.0) or (move_dir == 2 --[[ImGuiDir.Up]] and day < 0.0) or (move_dir == 3 --[[ImGuiDir.Down]] and day > 0.0) then result.DistAxial = dist_axial new_best = true end @@ -17315,8 +17349,8 @@ function ImGui.NavApplyItemToResult(result) result.FocusScopeId = g.CurrentFocusScopeId result.ItemFlags = g.LastItemData.ItemFlags ImRect_Copy(result.RectRel, ImGui.WindowRectAbsToRel(window, g.LastItemData.NavRect)) - if bit32.band(result.ItemFlags, ImGuiItemFlags.HasSelectionUserData) ~= 0 then - IM_ASSERT(g.NextItemData.SelectionUserData ~= ImGuiSelectionUserData_Invalid) + if bit32.band(result.ItemFlags, 2097152 --[[ImGuiItemFlags.HasSelectionUserData]]) ~= 0 then + assert(g.NextItemData.SelectionUserData ~= (-1) --[[ImGuiSelectionUserData_Invalid]]) result.SelectionUserData = g.NextItemData.SelectionUserData -- INTENTIONAL: At this point this field is not cleared in NextItemData. Avoid unnecessary copy to LastItemData. end end @@ -17342,7 +17376,7 @@ end function ImGui.NavProcessItemForTabbingRequest(id, item_flags, move_flags) local g = GImGui - if bit32.band(move_flags, ImGuiNavMoveFlags.FocusApi) == 0 then + if bit32.band(move_flags, 512 --[[ImGuiNavMoveFlags.FocusApi]]) == 0 then if g.NavLayer ~= g.CurrentWindow.DC.NavLayerCurrent then return end @@ -17355,10 +17389,10 @@ function ImGui.NavProcessItemForTabbingRequest(id, item_flags, move_flags) -- - Tabbing with _NavEnableKeyboard (space/enter/arrows): goes through every item. -- - Tabbing without _NavEnableKeyboard: goes through inputable items only. local can_stop - if bit32.band(move_flags, ImGuiNavMoveFlags.FocusApi) ~= 0 then + if bit32.band(move_flags, 512 --[[ImGuiNavMoveFlags.FocusApi]]) ~= 0 then can_stop = true else - can_stop = bit32.band(item_flags, ImGuiItemFlags.NoTabStop) == 0 and (bit32.band(g.IO.ConfigFlags, ImGuiConfigFlags.NavEnableKeyboard) ~= 0 or bit32.band(item_flags, ImGuiItemFlags.Inputable) ~= 0) + can_stop = bit32.band(item_flags, 1 --[[ImGuiItemFlags.NoTabStop]]) == 0 and (bit32.band(g.IO.ConfigFlags, 1 --[[ImGuiConfigFlags.NavEnableKeyboard]]) ~= 0 or bit32.band(item_flags, 1048576 --[[ImGuiItemFlags.Inputable]]) ~= 0) end -- Always store in NavMoveResultLocal (unlike directional request which uses NavMoveResultOther on sibling/flattened windows) @@ -17414,9 +17448,9 @@ function ImGui.NavProcessItem() end -- Process Init Request - if g.NavInitRequest and g.NavLayer == window.DC.NavLayerCurrent and bit32.band(item_flags, ImGuiItemFlags.Disabled) == 0 then + if g.NavInitRequest and g.NavLayer == window.DC.NavLayerCurrent and bit32.band(item_flags, 64 --[[ImGuiItemFlags.Disabled]]) == 0 then -- Even if 'ImGuiItemFlags.NoNavDefaultFocus' is on (typically collapse/close button) we record the first ResultId so they can be used as a fallback - local candidate_for_nav_default_focus = bit32.band(item_flags, ImGuiItemFlags.NoNavDefaultFocus) == 0 + local candidate_for_nav_default_focus = bit32.band(item_flags, 4 --[[ImGuiItemFlags.NoNavDefaultFocus]]) == 0 if candidate_for_nav_default_focus or g.NavInitResult.ID == 0 then ImGui.NavApplyItemToResult(g.NavInitResult) end @@ -17428,12 +17462,12 @@ function ImGui.NavProcessItem() -- Process Move Request (scoring for navigation) -- FIXME-NAV: Consider policy for double scoring (scoring from NavScoringRect + scoring from a rect wrapped according to current wrapping policy) - if g.NavMoveScoringItems and bit32.band(item_flags, ImGuiItemFlags.Disabled) == 0 then - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.FocusApi) ~= 0 or bit32.band(window.Flags, ImGuiWindowFlags.NoNavInputs) == 0 then - local is_tabbing = bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.IsTabbing) ~= 0 + if g.NavMoveScoringItems and bit32.band(item_flags, 64 --[[ImGuiItemFlags.Disabled]]) == 0 then + if bit32.band(g.NavMoveFlags, 512 --[[ImGuiNavMoveFlags.FocusApi]]) ~= 0 or bit32.band(window.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) == 0 then + local is_tabbing = bit32.band(g.NavMoveFlags, 1024 --[[ImGuiNavMoveFlags.IsTabbing]]) ~= 0 if is_tabbing then ImGui.NavProcessItemForTabbingRequest(id, item_flags, g.NavMoveFlags) - elseif g.NavId ~= id or bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.AllowCurrentNavId) ~= 0 then + elseif g.NavId ~= id or bit32.band(g.NavMoveFlags, 16 --[[ImGuiNavMoveFlags.AllowCurrentNavId]]) ~= 0 then local result = (window == g.NavWindow) and g.NavMoveResultLocal or g.NavMoveResultOther if ImGui.NavScoreItem(result, nav_bb) then ImGui.NavApplyItemToResult(result) @@ -17441,7 +17475,7 @@ function ImGui.NavProcessItem() -- Features like PageUp/PageDown need to maintain a separate score for the visible set of items. local VISIBLE_RATIO = 0.70 - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.AlsoScoreVisibleSet) ~= 0 then + if bit32.band(g.NavMoveFlags, 32 --[[ImGuiNavMoveFlags.AlsoScoreVisibleSet]]) ~= 0 then local r = window.InnerRect -- window.ClipRect if r:Overlaps(nav_bb) then if ImClamp(nav_bb.Max.y, r.Min.y, r.Max.y) - ImClamp(nav_bb.Min.y, r.Min.y, r.Max.y) >= (nav_bb.Max.y - nav_bb.Min.y) * VISIBLE_RATIO then @@ -17465,8 +17499,8 @@ function ImGui.NavProcessItem() g.NavFocusScopeId = g.CurrentFocusScopeId g.NavIdIsAlive = true g.NavIdItemFlags = item_flags - if bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.HasSelectionUserData) ~= 0 then - IM_ASSERT(g.NextItemData.SelectionUserData ~= ImGuiSelectionUserData_Invalid) + if bit32.band(g.LastItemData.ItemFlags, 2097152 --[[ImGuiItemFlags.HasSelectionUserData]]) ~= 0 then + assert(g.NextItemData.SelectionUserData ~= (-1) --[[ImGuiSelectionUserData_Invalid]]) g.NavLastValidSelectionUserData = g.NextItemData.SelectionUserData -- INTENTIONAL: At this point this field is not cleared in NextItemData. Avoid unnecessary copy to LastItemData. end window.NavRectRel[window.DC.NavLayerCurrent] = ImGui.WindowRectAbsToRel(window, nav_bb) -- Store item bounding box (relative to window position) @@ -17487,7 +17521,7 @@ function ImGui.NavInitRequestApplyResult() g.NavJustMovedToFocusScopeId = result.FocusScopeId g.NavJustMovedToKeyMods = 0 g.NavJustMovedToIsTabbing = false - g.NavJustMovedToHasSelectionData = bit32.band(result.ItemFlags, ImGuiItemFlags.HasSelectionUserData) ~= 0 + g.NavJustMovedToHasSelectionData = bit32.band(result.ItemFlags, 2097152 --[[ImGuiItemFlags.HasSelectionUserData]]) ~= 0 end -- Apply result from previous navigation init request (will typically select the first item, unless SetItemDefaultFocus() has been called) @@ -17495,7 +17529,7 @@ function ImGui.NavInitRequestApplyResult() -- IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: ApplyResult: NavID 0x%08X in Layer %d Window \"%s\"\n", result->ID, g.NavLayer, g.NavWindow->Name) ImGui.SetNavID(result.ID, g.NavLayer, result.FocusScopeId, result.RectRel) g.NavIdIsAlive = true -- Mark as alive from previous frame as we got a result - if result.SelectionUserData ~= ImGuiSelectionUserData_Invalid then + if result.SelectionUserData ~= (-1) --[[ImGuiSelectionUserData_Invalid]] then g.NavLastValidSelectionUserData = result.SelectionUserData end if g.NavInitRequestFromMove then @@ -17518,19 +17552,19 @@ function ImGui.NavMoveRequestApplyResult() end -- Tabbing forward wrap - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.IsTabbing) ~= 0 and result == nil then + if bit32.band(g.NavMoveFlags, 1024 --[[ImGuiNavMoveFlags.IsTabbing]]) ~= 0 and result == nil then if (g.NavTabbingCounter == 1 or g.NavTabbingDir == 0) and g.NavTabbingResultFirst.ID ~= 0 then result = g.NavTabbingResultFirst end end -- In a situation when there are no results but NavId != 0, re-enable the Navigation highlight (because g.NavId is not considered as a possible result) - local axis = (g.NavMoveDir == ImGuiDir.Up or g.NavMoveDir == ImGuiDir.Down) and ImGuiAxis.Y or ImGuiAxis.X + local axis = (g.NavMoveDir == 2 --[[ImGuiDir.Up]] or g.NavMoveDir == 3 --[[ImGuiDir.Down]]) and 2 --[[ImGuiAxis.Y]] or 1 --[[ImGuiAxis.X]] if result == nil then - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.IsTabbing) ~= 0 then - g.NavMoveFlags = bit32.bor(g.NavMoveFlags, ImGuiNavMoveFlags.NoSetNavCursorVisible) + if bit32.band(g.NavMoveFlags, 1024 --[[ImGuiNavMoveFlags.IsTabbing]]) ~= 0 then + g.NavMoveFlags = bit32.bor(g.NavMoveFlags, 16384 --[[ImGuiNavMoveFlags.NoSetNavCursorVisible]]) end - if g.NavId ~= 0 and bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.NoSetNavCursorVisible) == 0 then + if g.NavId ~= 0 and bit32.band(g.NavMoveFlags, 16384 --[[ImGuiNavMoveFlags.NoSetNavCursorVisible]]) == 0 then ImGui.SetNavCursorVisibleAfterMove() end ImGui.NavClearPreferredPosForAxis(axis) -- On a failed move, clear preferred pos for this axis. @@ -17539,7 +17573,7 @@ function ImGui.NavMoveRequestApplyResult() end -- PageUp/PageDown behavior first jumps to the bottom/top mostly visible item, _otherwise_ use the result from the previous/next page. - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.AlsoScoreVisibleSet) ~= 0 + if bit32.band(g.NavMoveFlags, 32 --[[ImGuiNavMoveFlags.AlsoScoreVisibleSet]]) ~= 0 and g.NavMoveResultLocalVisible.ID ~= 0 and g.NavMoveResultLocalVisible.ID ~= g.NavId then result = g.NavMoveResultLocalVisible end @@ -17551,16 +17585,16 @@ function ImGui.NavMoveRequestApplyResult() result = g.NavMoveResultOther end end - IM_ASSERT(g.NavWindow and result.Window) + assert(g.NavWindow and result.Window) -- Scroll to keep newly navigated item fully into view. - if g.NavLayer == ImGuiNavLayer.Main then + if g.NavLayer == 0 --[[ImGuiNavLayer.Main]] then local rect_abs = ImGui.WindowRectRelToAbs(result.Window, result.RectRel) ImGui.ScrollToRectEx(result.Window, rect_abs, g.NavMoveScrollFlags) - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.ScrollToEdgeY) ~= 0 then + if bit32.band(g.NavMoveFlags, 64 --[[ImGuiNavMoveFlags.ScrollToEdgeY]]) ~= 0 then -- FIXME: Should remove this? Or make more precise: use ScrollToRectEx() with edge? - local scroll_target = (g.NavMoveDir == ImGuiDir.Up) and result.Window.ScrollMax.y or 0.0 + local scroll_target = (g.NavMoveDir == 2 --[[ImGuiDir.Up]]) and result.Window.ScrollMax.y or 0.0 ImGui.SetScrollY(result.Window, scroll_target) end end @@ -17568,26 +17602,26 @@ function ImGui.NavMoveRequestApplyResult() if g.NavWindow ~= result.Window then -- IMGUI_DEBUG_LOG_FOCUS("[focus] NavMoveRequest: SetNavWindow(\"%s\")\n", result->Window->Name) g.NavWindow = result.Window - g.NavLastValidSelectionUserData = ImGuiSelectionUserData_Invalid + g.NavLastValidSelectionUserData = (-1) --[[ImGuiSelectionUserData_Invalid]] end -- Clear active id unless requested not to -- FIXME: ImGuiNavMoveFlags.NoClearActiveId is currently unused as we don't have a clear strategy to preserve active id after interaction, -- so this is mostly provided as a gateway for further experiments (see #1418, #2890) - if g.ActiveId ~= result.ID and bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.NoClearActiveId) == 0 then + if g.ActiveId ~= result.ID and bit32.band(g.NavMoveFlags, 32768 --[[ImGuiNavMoveFlags.NoClearActiveId]]) == 0 then ImGui.ClearActiveID() end -- Don't set NavJustMovedToId if just landed on the same spot (which may happen with ImGuiNavMoveFlags.AllowCurrentNavId) -- PageUp/PageDown however sets always set NavJustMovedTo (vs Home/End which doesn't) mimicking Windows behavior. - if (g.NavId ~= result.ID or bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.IsPageMove) ~= 0) - and bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.NoSelect) == 0 then + if (g.NavId ~= result.ID or bit32.band(g.NavMoveFlags, 2048 --[[ImGuiNavMoveFlags.IsPageMove]]) ~= 0) + and bit32.band(g.NavMoveFlags, 8192 --[[ImGuiNavMoveFlags.NoSelect]]) == 0 then g.NavJustMovedFromFocusScopeId = g.NavFocusScopeId g.NavJustMovedToId = result.ID g.NavJustMovedToFocusScopeId = result.FocusScopeId g.NavJustMovedToKeyMods = g.NavMoveKeyMods - g.NavJustMovedToIsTabbing = bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.IsTabbing) ~= 0 - g.NavJustMovedToHasSelectionData = bit32.band(result.ItemFlags, ImGuiItemFlags.HasSelectionUserData) ~= 0 + g.NavJustMovedToIsTabbing = bit32.band(g.NavMoveFlags, 1024 --[[ImGuiNavMoveFlags.IsTabbing]]) ~= 0 + g.NavJustMovedToHasSelectionData = bit32.band(result.ItemFlags, 2097152 --[[ImGuiItemFlags.HasSelectionUserData]]) ~= 0 -- IMGUI_DEBUG_LOG_NAV("[nav] NavJustMovedFromFocusScopeId = 0x%08X, NavJustMovedToFocusScopeId = 0x%08X\n", g.NavJustMovedFromFocusScopeId, g.NavJustMovedToFocusScopeId) end @@ -17597,37 +17631,37 @@ function ImGui.NavMoveRequestApplyResult() local preferred_scoring_pos_rel = ImVec2() ImVec2_Copy(preferred_scoring_pos_rel, root_for_nav.NavPreferredScoringPosRel[g.NavLayer]) ImGui.SetNavID(result.ID, g.NavLayer, result.FocusScopeId, result.RectRel) - if result.SelectionUserData ~= ImGuiSelectionUserData_Invalid then + if result.SelectionUserData ~= (-1) --[[ImGuiSelectionUserData_Invalid]] then g.NavLastValidSelectionUserData = result.SelectionUserData end -- Restore last preferred position for current axis -- (storing in RootWindowForNav-> as the info is desirable at the beginning of a Move Request. In theory all storage should use RootWindowForNav..) - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.IsTabbing) == 0 then + if bit32.band(g.NavMoveFlags, 1024 --[[ImGuiNavMoveFlags.IsTabbing]]) == 0 then preferred_scoring_pos_rel[axis] = result.RectRel:GetCenter()[axis] ImVec2_Copy(root_for_nav.NavPreferredScoringPosRel[g.NavLayer], preferred_scoring_pos_rel) end -- Tabbing: Activates Inputable, otherwise only Focus - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.IsTabbing) ~= 0 - and bit32.band(result.ItemFlags, ImGuiItemFlags.Inputable) == 0 then - g.NavMoveFlags = bit32.band(g.NavMoveFlags, bit32.bnot(ImGuiNavMoveFlags.Activate)) + if bit32.band(g.NavMoveFlags, 1024 --[[ImGuiNavMoveFlags.IsTabbing]]) ~= 0 + and bit32.band(result.ItemFlags, 1048576 --[[ImGuiItemFlags.Inputable]]) == 0 then + g.NavMoveFlags = bit32.band(g.NavMoveFlags, bit32.bnot(4096 --[[ImGuiNavMoveFlags.Activate]])) end -- Activate - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.Activate) ~= 0 then + if bit32.band(g.NavMoveFlags, 4096 --[[ImGuiNavMoveFlags.Activate]]) ~= 0 then g.NavNextActivateId = result.ID - g.NavNextActivateFlags = ImGuiActivateFlags.None - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.FocusApi) ~= 0 then - g.NavNextActivateFlags = bit32.bor(g.NavNextActivateFlags, ImGuiActivateFlags.FromFocusApi) + g.NavNextActivateFlags = 0 --[[ImGuiActivateFlags.None]] + if bit32.band(g.NavMoveFlags, 512 --[[ImGuiNavMoveFlags.FocusApi]]) ~= 0 then + g.NavNextActivateFlags = bit32.bor(g.NavNextActivateFlags, 32 --[[ImGuiActivateFlags.FromFocusApi]]) end - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.IsTabbing) ~= 0 then - g.NavNextActivateFlags = bit32.bor(g.NavNextActivateFlags, ImGuiActivateFlags.PreferInput, ImGuiActivateFlags.TryToPreserveState, ImGuiActivateFlags.FromTabbing) + if bit32.band(g.NavMoveFlags, 1024 --[[ImGuiNavMoveFlags.IsTabbing]]) ~= 0 then + g.NavNextActivateFlags = bit32.bor(g.NavNextActivateFlags, 1 --[[ImGuiActivateFlags.PreferInput]], 4 --[[ImGuiActivateFlags.TryToPreserveState]], 8 --[[ImGuiActivateFlags.FromTabbing]]) end end -- Make nav cursor visible - if bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.NoSetNavCursorVisible) == 0 then + if bit32.band(g.NavMoveFlags, 16384 --[[ImGuiNavMoveFlags.NoSetNavCursorVisible]]) == 0 then ImGui.SetNavCursorVisibleAfterMove() end end @@ -17647,10 +17681,10 @@ function ImGui.NavMoveRequestResolveWithPastTreeNode(result, tree_node_data) local g = GImGui g.NavMoveScoringItems = false g.LastItemData.ID = tree_node_data.ID - g.LastItemData.ItemFlags = bit32.band(tree_node_data.ItemFlags, bit32.bnot(ImGuiItemFlags.HasSelectionUserData)) -- Losing SelectionUserData, recovered next-frame (cheaper). + g.LastItemData.ItemFlags = bit32.band(tree_node_data.ItemFlags, bit32.bnot(2097152 --[[ImGuiItemFlags.HasSelectionUserData]])) -- Losing SelectionUserData, recovered next-frame (cheaper). ImRect_Copy(g.LastItemData.NavRect, tree_node_data.NavRect) ImGui.NavApplyItemToResult(result) -- Result this instead of implementing a NavApplyPastTreeNodeToResult() - ImGui.NavClearPreferredPosForAxis(ImGuiAxis.Y) + ImGui.NavClearPreferredPosForAxis(2 --[[ImGuiAxis.Y]]) ImGui.NavUpdateAnyRequestFlag() end @@ -17668,12 +17702,12 @@ end --- @param scroll_flags ImGuiScrollFlags function ImGui.NavMoveRequestForward(move_dir, clip_dir, move_flags, scroll_flags) local g = GImGui - IM_ASSERT(g.NavMoveForwardToNextFrame == false) + assert(g.NavMoveForwardToNextFrame == false) ImGui.NavMoveRequestCancel() g.NavMoveForwardToNextFrame = true g.NavMoveDir = move_dir g.NavMoveClipDir = clip_dir - g.NavMoveFlags = bit32.bor(move_flags, ImGuiNavMoveFlags.Forwarded) + g.NavMoveFlags = bit32.bor(move_flags, 128 --[[ImGuiNavMoveFlags.Forwarded]]) g.NavMoveScrollFlags = scroll_flags end @@ -17683,12 +17717,12 @@ end --- @param wrap_flags ImGuiNavMoveFlags function ImGui.NavMoveRequestTryWrapping(window, wrap_flags) local g = GImGui - IM_ASSERT(bit32.band(wrap_flags, ImGuiNavMoveFlags.WrapMask_) ~= 0 and bit32.band(wrap_flags, bit32.bnot(ImGuiNavMoveFlags.WrapMask_)) == 0) -- Call with _WrapX, _WrapY, _LoopX, _LoopY + assert(bit32.band(wrap_flags, 15 --[[ImGuiNavMoveFlags.WrapMask_]]) ~= 0 and bit32.band(wrap_flags, bit32.bnot(15 --[[ImGuiNavMoveFlags.WrapMask_]])) == 0) -- Call with _WrapX, _WrapY, _LoopX, _LoopY -- In theory we should test for NavMoveRequestButNoResultYet() but there's no point doing it: -- as NavEndFrame() will do the same test. It will end up calling NavUpdateCreateWrappingRequest(). if g.NavWindow == window and g.NavMoveScoringItems and g.NavLayer == window.DC.NavLayerCurrent then - g.NavMoveFlags = bit32.bor(bit32.band(g.NavMoveFlags, bit32.bnot(ImGuiNavMoveFlags.WrapMask_)), wrap_flags) + g.NavMoveFlags = bit32.bor(bit32.band(g.NavMoveFlags, bit32.bnot(15 --[[ImGuiNavMoveFlags.WrapMask_]])), wrap_flags) end end @@ -17802,7 +17836,7 @@ function ImGui.SetCurrentViewport(current_window, viewport) g.CurrentDpiScale = viewport and viewport.DpiScale or 1.0 g.CurrentViewport = viewport - IM_ASSERT(g.CurrentDpiScale > 0.0 and g.CurrentDpiScale < 99.0) -- Typical correct values would be between 1.0f and 4.0f + assert(g.CurrentDpiScale > 0.0 and g.CurrentDpiScale < 99.0) -- Typical correct values would be between 1.0f and 4.0f -- IMGUI_DEBUG_LOG_VIEWPORT("[viewport] SetCurrentViewport changed '%s' 0x%08X", current_window and current_window.Name or "NULL", viewport and viewport.ID or 0) if g.IO.ConfigDpiScaleFonts then @@ -17834,11 +17868,11 @@ end function ImGui.GetWindowAlwaysWantOwnViewport(window) -- Tooltips and menus are not automatically forced into their own viewport when the NoMerge flag is set, however the multiplication of viewports makes them more likely to protrude and create their own. local g = GImGui - if g.IO.ConfigViewportsNoAutoMerge or (bit32.band(window.WindowClass.ViewportFlagsOverrideSet, ImGuiViewportFlags.NoAutoMerge) ~= 0) then - if bit32.band(g.ConfigFlagsCurrFrame, ImGuiConfigFlags.ViewportsEnable) ~= 0 then + if g.IO.ConfigViewportsNoAutoMerge or (bit32.band(window.WindowClass.ViewportFlagsOverrideSet, 512 --[[ImGuiViewportFlags.NoAutoMerge]]) ~= 0) then + if bit32.band(g.ConfigFlagsCurrFrame, 1024 --[[ImGuiConfigFlags.ViewportsEnable]]) ~= 0 then if not window.DockIsActive then - if bit32.band(window.Flags, bit32.bor(ImGuiWindowFlags.ChildWindow, ImGuiWindowFlags.ChildMenu, ImGuiWindowFlags.Tooltip)) == 0 then - if bit32.band(window.Flags, ImGuiWindowFlags.Popup) == 0 or bit32.band(window.Flags, ImGuiWindowFlags.Modal) ~= 0 then + if bit32.band(window.Flags, bit32.bor(16777216 --[[ImGuiWindowFlags.ChildWindow]], 268435456 --[[ImGuiWindowFlags.ChildMenu]], 33554432 --[[ImGuiWindowFlags.Tooltip]])) == 0 then + if bit32.band(window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) == 0 or bit32.band(window.Flags, 134217728 --[[ImGuiWindowFlags.Modal]]) ~= 0 then return true end end @@ -17856,7 +17890,7 @@ end function ImGui.IsViewportAbove(potential_above, potential_below) -- If ImGuiBackendFlags.HasParentViewport if set, ->ParentViewport chain should be accurate. local g = GImGui - if bit32.band(g.IO.BackendFlags, ImGuiBackendFlags.HasParentViewport) ~= 0 then + if bit32.band(g.IO.BackendFlags, 8192 --[[ImGuiBackendFlags.HasParentViewport]]) ~= 0 then local v = potential_above --[[@as ImGuiViewport]] while v ~= nil and v.ParentViewport do if v.ParentViewport == potential_below then @@ -17880,16 +17914,16 @@ end --- @param viewport_dst ImGuiViewportP function ImGui.UpdateTryMergeWindowIntoHostViewport(window, viewport_dst) local g = GImGui - IM_ASSERT(window == window.RootWindowDockTree) + assert(window == window.RootWindowDockTree) local viewport_src = window.Viewport -- Current viewport if viewport_src == viewport_dst then return false end - if bit32.band(viewport_dst.Flags, ImGuiViewportFlags.CanHostOtherWindows) == 0 then + if bit32.band(viewport_dst.Flags, 2048 --[[ImGuiViewportFlags.CanHostOtherWindows]]) == 0 then return false end - if bit32.band(viewport_dst.Flags, ImGuiViewportFlags.IsMinimized) ~= 0 then + if bit32.band(viewport_dst.Flags, 4096 --[[ImGuiViewportFlags.IsMinimized]]) ~= 0 then return false end if not viewport_dst:GetMainRect():Contains(window:Rect()) then @@ -17928,7 +17962,7 @@ function ImGui.UpdateTryMergeWindowIntoHostViewport(window, viewport_dst) ImGui.SetWindowViewport(window, viewport_dst) - if bit32.band(window.Flags, ImGuiWindowFlags.NoBringToFrontOnFocus) == 0 then + if bit32.band(window.Flags, 8192 --[[ImGuiWindowFlags.NoBringToFrontOnFocus]]) == 0 then ImGui.BringWindowToDisplayFront(window) end @@ -17953,14 +17987,14 @@ end function ImGui.TranslateWindowsInViewport(viewport, old_pos, new_pos, old_size, new_size) local g = GImGui -- IMGUI_DEBUG_LOG_VIEWPORT("[viewport] TranslateWindowsInViewport 0x%08X", viewport.ID) - IM_ASSERT(viewport.Window == nil and (bit32.band(viewport.Flags, ImGuiViewportFlags.CanHostOtherWindows) ~= 0)) + assert(viewport.Window == nil and (bit32.band(viewport.Flags, 2048 --[[ImGuiViewportFlags.CanHostOtherWindows]]) ~= 0)) -- 1) We test if ImGuiConfigFlags.ViewportsEnable was just toggled, which allows us to conveniently -- translate imgui windows from OS-window-local to absolute coordinates or vice-versa. -- 2) If it's not going to fit into the new size, keep it at same absolute position. -- One problem with this is that most Win32 applications doesn't update their render while dragging, -- and so the window will appear to teleport when releasing the mouse. - local translate_all_windows = (bit32.band(g.ConfigFlagsCurrFrame, ImGuiConfigFlags.ViewportsEnable) ~= bit32.band(g.ConfigFlagsLastFrame, ImGuiConfigFlags.ViewportsEnable)) + local translate_all_windows = (bit32.band(g.ConfigFlagsCurrFrame, 1024 --[[ImGuiConfigFlags.ViewportsEnable]]) ~= bit32.band(g.ConfigFlagsLastFrame, 1024 --[[ImGuiConfigFlags.ViewportsEnable]])) local test_still_fit_rect = ImRect(old_pos, old_pos + old_size) local delta_pos = new_pos - old_pos @@ -17980,7 +18014,7 @@ function ImGui.FindHoveredViewportFromPlatformWindowStack(mouse_platform_pos) local g = GImGui local best_candidate = nil for _, viewport in g.Viewports:iter() do - if bit32.band(viewport.Flags, bit32.bor(ImGuiViewportFlags.NoInputs, ImGuiViewportFlags.IsMinimized)) == 0 and viewport:GetMainRect():Contains(mouse_platform_pos) then + if bit32.band(viewport.Flags, bit32.bor(128 --[[ImGuiViewportFlags.NoInputs]], 4096 --[[ImGuiViewportFlags.IsMinimized]])) == 0 and viewport:GetMainRect():Contains(mouse_platform_pos) then if best_candidate == nil or best_candidate.LastFocusedStampCount < viewport.LastFocusedStampCount then if viewport.PlatformWindowCreated then best_candidate = viewport @@ -17995,11 +18029,11 @@ end -- Note that this is running even if 'ImGuiConfigFlags.ViewportsEnable' is not set, in order to clear unused viewports (if any) and update monitor info. function ImGui.UpdateViewportsNewFrame() local g = GImGui - IM_ASSERT(g.PlatformIO.Viewports.Size <= g.Viewports.Size) + assert(g.PlatformIO.Viewports.Size <= g.Viewports.Size) -- Update Minimized status (we need it first in order to decide if we'll apply Pos/Size of the main viewport) -- Update Focused status - local viewports_enabled = (bit32.band(g.ConfigFlagsCurrFrame, ImGuiConfigFlags.ViewportsEnable) ~= 0) + local viewports_enabled = (bit32.band(g.ConfigFlagsCurrFrame, 1024 --[[ImGuiConfigFlags.ViewportsEnable]]) ~= 0) if viewports_enabled then local focused_viewport = nil @@ -18010,9 +18044,9 @@ function ImGui.UpdateViewportsNewFrame() if g.PlatformIO.Platform_GetWindowMinimized and platform_funcs_available then local is_minimized = g.PlatformIO.Platform_GetWindowMinimized(viewport) if is_minimized then - viewport.Flags = bit32.bor(viewport.Flags, ImGuiViewportFlags.IsMinimized) + viewport.Flags = bit32.bor(viewport.Flags, 4096 --[[ImGuiViewportFlags.IsMinimized]]) else - viewport.Flags = bit32.band(viewport.Flags, bit32.bnot(ImGuiViewportFlags.IsMinimized)) + viewport.Flags = bit32.band(viewport.Flags, bit32.bnot(4096 --[[ImGuiViewportFlags.IsMinimized]])) end end @@ -18021,9 +18055,9 @@ function ImGui.UpdateViewportsNewFrame() if g.PlatformIO.Platform_GetWindowFocus and platform_funcs_available then local is_focused = g.PlatformIO.Platform_GetWindowFocus(viewport) if is_focused then - viewport.Flags = bit32.bor(viewport.Flags, ImGuiViewportFlags.IsFocused) + viewport.Flags = bit32.bor(viewport.Flags, 8192 --[[ImGuiViewportFlags.IsFocused]]) else - viewport.Flags = bit32.band(viewport.Flags, bit32.bnot(ImGuiViewportFlags.IsFocused)) + viewport.Flags = bit32.band(viewport.Flags, bit32.bnot(8192 --[[ImGuiViewportFlags.IsFocused]])) end if is_focused then focused_viewport = viewport @@ -18054,7 +18088,7 @@ function ImGui.UpdateViewportsNewFrame() if apply_imgui_focus_on_focused_viewport and g.IO.ConfigViewportsPlatformFocusSetsImGuiFocus then focused_viewport.LastFocusedHadNavWindow = focused_viewport.LastFocusedHadNavWindow or (g.NavWindow ~= nil and g.NavWindow.Viewport == focused_viewport) -- Update so a window changing viewport won't lose focus. - local focus_request_flags = bit32.bor(ImGuiFocusRequestFlags.UnlessBelowModal, ImGuiFocusRequestFlags.RestoreFocusedChild) + local focus_request_flags = bit32.bor(2 --[[ImGuiFocusRequestFlags.UnlessBelowModal]], 1 --[[ImGuiFocusRequestFlags.RestoreFocusedChild]]) if focused_viewport.Window ~= nil then ImGui.FocusWindow(focused_viewport.Window, focus_request_flags) elseif focused_viewport.LastFocusedHadNavWindow then @@ -18073,8 +18107,8 @@ function ImGui.UpdateViewportsNewFrame() -- Create/update main viewport with current platform position. -- FIXME-VIEWPORT: Size is driven by backend/user code for backward-compatibility but we should aim to make this more consistent. local main_viewport = g.Viewports.Data[1] - IM_ASSERT(main_viewport.ID == IMGUI_VIEWPORT_DEFAULT_ID) - IM_ASSERT(main_viewport.Window == nil) + assert(main_viewport.ID == IMGUI_VIEWPORT_DEFAULT_ID) + assert(main_viewport.Window == nil) local main_viewport_pos if viewports_enabled then @@ -18085,15 +18119,15 @@ function ImGui.UpdateViewportsNewFrame() local main_viewport_size = g.IO.DisplaySize local main_viewport_framebuffer_scale = g.IO.DisplayFramebufferScale - if viewports_enabled and (bit32.band(main_viewport.Flags, ImGuiViewportFlags.IsMinimized) ~= 0) then + if viewports_enabled and (bit32.band(main_viewport.Flags, 4096 --[[ImGuiViewportFlags.IsMinimized]]) ~= 0) then ImVec2_Copy(main_viewport_pos, main_viewport.Pos) -- Preserve last pos/size when minimized (FIXME: We don't do the same for Size outside of the viewport path) ImVec2_Copy(main_viewport_size, main_viewport.Size) main_viewport_framebuffer_scale = main_viewport.FramebufferScale end - ImGui.AddUpdateViewport(nil, IMGUI_VIEWPORT_DEFAULT_ID, main_viewport_pos, main_viewport_size, bit32.bor(ImGuiViewportFlags.OwnedByApp, ImGuiViewportFlags.CanHostOtherWindows)) + ImGui.AddUpdateViewport(nil, IMGUI_VIEWPORT_DEFAULT_ID, main_viewport_pos, main_viewport_size, bit32.bor(4 --[[ImGuiViewportFlags.OwnedByApp]], 2048 --[[ImGuiViewportFlags.CanHostOtherWindows]])) - local memory_compact_start_time = (g.GcCompactAll or g.IO.ConfigMemoryCompactTimer < 0.0) and FLT_MAX or (g.Time - g.IO.ConfigMemoryCompactTimer) + local memory_compact_start_time = (g.GcCompactAll or g.IO.ConfigMemoryCompactTimer < 0.0) and 3.4028234663853e+38 --[[FLT_MAX]] or (g.Time - g.IO.ConfigMemoryCompactTimer) g.CurrentDpiScale = 0.0 g.CurrentViewport = nil @@ -18114,7 +18148,7 @@ function ImGui.UpdateViewportsNewFrame() if viewports_enabled then -- Update Position and Size (from Platform Window to ImGui) if requested. -- We do it early in the frame instead of waiting for UpdatePlatformWindows() to avoid a frame of lag when moving/resizing using OS facilities. - if (bit32.band(viewport.Flags, ImGuiViewportFlags.IsMinimized) == 0) and platform_funcs_available then + if (bit32.band(viewport.Flags, 4096 --[[ImGuiViewportFlags.IsMinimized]]) == 0) and platform_funcs_available then -- Viewport->WorkPos and WorkSize will be updated below if viewport.PlatformRequestMove then ImVec2_Copy(viewport.Pos, g.PlatformIO.Platform_GetWindowPos(viewport)) @@ -18142,7 +18176,7 @@ function ImGui.UpdateViewportsNewFrame() if g.PlatformIO.Platform_GetWindowWorkAreaInsets ~= nil and platform_funcs_available then local insets = g.PlatformIO.Platform_GetWindowWorkAreaInsets(viewport) - IM_ASSERT(insets.x >= 0.0 and insets.y >= 0.0 and insets.z >= 0.0 and insets.w >= 0.0) + assert(insets.x >= 0.0 and insets.y >= 0.0 and insets.z >= 0.0 and insets.w >= 0.0) viewport.BuildWorkInsetMin = ImVec2(insets.x, insets.y) viewport.BuildWorkInsetMax = ImVec2(insets.z, insets.w) end @@ -18162,7 +18196,7 @@ function ImGui.UpdateViewportsNewFrame() -- Translate Dear ImGui windows when a Host Viewport has been moved -- (This additionally keeps windows at the same place when ImGuiConfigFlags.ViewportsEnable is toggled!) local viewport_delta_pos = viewport.Pos - viewport.LastPos - if (bit32.band(viewport.Flags, ImGuiViewportFlags.CanHostOtherWindows) ~= 0) and (viewport_delta_pos.x ~= 0.0 or viewport_delta_pos.y ~= 0.0) then + if (bit32.band(viewport.Flags, 2048 --[[ImGuiViewportFlags.CanHostOtherWindows]]) ~= 0) and (viewport_delta_pos.x ~= 0.0 or viewport_delta_pos.y ~= 0.0) then ImGui.TranslateWindowsInViewport(viewport, viewport.LastPos, viewport.Pos, viewport.LastSize, viewport.Size) end @@ -18176,7 +18210,7 @@ function ImGui.UpdateViewportsNewFrame() new_dpi_scale = (viewport.DpiScale ~= 0.0) and viewport.DpiScale or 1.0 end - IM_ASSERT(new_dpi_scale > 0.0 and new_dpi_scale < 99.0) -- Typical correct values would be between 1.0f and 4.0f + assert(new_dpi_scale > 0.0 and new_dpi_scale < 99.0) -- Typical correct values would be between 1.0f and 4.0f if viewport.DpiScale ~= 0.0 and new_dpi_scale ~= viewport.DpiScale then local scale_factor = new_dpi_scale / viewport.DpiScale @@ -18201,7 +18235,7 @@ function ImGui.UpdateViewportsNewFrame() end -- Update fallback monitor - g.PlatformMonitorsFullWorkRect = ImRect(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX) + g.PlatformMonitorsFullWorkRect = ImRect(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]]) if g.PlatformIO.Monitors.Size == 0 then local monitor = g.FallbackMonitor @@ -18232,9 +18266,9 @@ function ImGui.UpdateViewportsNewFrame() -- Note that 'viewport_hovered' should skip over any viewport that has the ImGuiViewportFlags.NoInputs flags set. local viewport_hovered = nil - if bit32.band(g.IO.BackendFlags, ImGuiBackendFlags.HasMouseHoveredViewport) ~= 0 then + if bit32.band(g.IO.BackendFlags, 4096 --[[ImGuiBackendFlags.HasMouseHoveredViewport]]) ~= 0 then viewport_hovered = g.IO.MouseHoveredViewport and ImGui.FindViewportByID(g.IO.MouseHoveredViewport) or nil - if viewport_hovered and (bit32.band(viewport_hovered.Flags, ImGuiViewportFlags.NoInputs) ~= 0) then + if viewport_hovered and (bit32.band(viewport_hovered.Flags, 128 --[[ImGuiViewportFlags.NoInputs]]) ~= 0) then viewport_hovered = ImGui.FindHoveredViewportFromPlatformWindowStack(g.IO.MousePos) -- Backend failed to handle _NoInputs viewport: revert to our fallback. end else @@ -18271,12 +18305,12 @@ function ImGui.UpdateViewportsNewFrame() end if is_mouse_dragging_with_an_expected_destination or g.ActiveId == 0 or not ImGui.IsAnyMouseDown() then - if viewport_hovered ~= nil and viewport_hovered ~= g.MouseViewport and (bit32.band(viewport_hovered.Flags, ImGuiViewportFlags.NoInputs) == 0) then + if viewport_hovered ~= nil and viewport_hovered ~= g.MouseViewport and (bit32.band(viewport_hovered.Flags, 128 --[[ImGuiViewportFlags.NoInputs]]) == 0) then g.MouseViewport = viewport_hovered end end - IM_ASSERT(g.MouseViewport ~= nil) + assert(g.MouseViewport ~= nil) end -- Update user-facing viewport list (g.Viewports -> g.PlatformIO.Viewports after filtering out some) @@ -18297,7 +18331,7 @@ function ImGui.UpdateViewportsEndFrame() break end if i > 1 then - IM_ASSERT(viewport.Window ~= nil) + assert(viewport.Window ~= nil) end g.PlatformIO.Viewports:push_back(viewport) @@ -18316,19 +18350,19 @@ end --- @return ImGuiViewportP function ImGui.AddUpdateViewport(window, id, pos, size, flags) local g = GImGui - IM_ASSERT(id ~= 0) + assert(id ~= 0) - flags = bit32.bor(flags, ImGuiViewportFlags.IsPlatformWindow) + flags = bit32.bor(flags, 1 --[[ImGuiViewportFlags.IsPlatformWindow]]) if window ~= nil then - local window_can_use_inputs = (bit32.band(window.Flags, bit32.bor(ImGuiWindowFlags.NoMouseInputs, ImGuiWindowFlags.NoNavInputs)) == 0) + local window_can_use_inputs = (bit32.band(window.Flags, bit32.bor(512 --[[ImGuiWindowFlags.NoMouseInputs]], 65536 --[[ImGuiWindowFlags.NoNavInputs]])) == 0) if g.MovingWindow and g.MovingWindow.RootWindowDockTree == window then - flags = bit32.bor(flags, ImGuiViewportFlags.NoInputs, ImGuiViewportFlags.NoFocusOnAppearing) + flags = bit32.bor(flags, 128 --[[ImGuiViewportFlags.NoInputs]], 32 --[[ImGuiViewportFlags.NoFocusOnAppearing]]) end if not window_can_use_inputs then - flags = bit32.bor(flags, ImGuiViewportFlags.NoInputs) + flags = bit32.bor(flags, 128 --[[ImGuiViewportFlags.NoInputs]]) end - if bit32.band(window.Flags, ImGuiWindowFlags.NoFocusOnAppearing) ~= 0 then - flags = bit32.bor(flags, ImGuiViewportFlags.NoFocusOnAppearing) + if bit32.band(window.Flags, 4096 --[[ImGuiWindowFlags.NoFocusOnAppearing]]) ~= 0 then + flags = bit32.bor(flags, 32 --[[ImGuiViewportFlags.NoFocusOnAppearing]]) end end @@ -18345,7 +18379,7 @@ function ImGui.AddUpdateViewport(window, id, pos, size, flags) if not viewport.PlatformRequestResize or viewport.ID == IMGUI_VIEWPORT_DEFAULT_ID then ImVec2_Copy(viewport.Size, size) end - viewport.Flags = bit32.bor(flags, bit32.band(viewport.Flags, bit32.bor(ImGuiViewportFlags.IsMinimized, ImGuiViewportFlags.IsFocused))) -- Preserve existing flags + viewport.Flags = bit32.bor(flags, bit32.band(viewport.Flags, bit32.bor(4096 --[[ImGuiViewportFlags.IsMinimized]], 8192 --[[ImGuiViewportFlags.IsFocused]]))) -- Preserve existing flags if prev_pos.x ~= viewport.Pos.x or prev_pos.y ~= viewport.Pos.y or prev_size.x ~= viewport.Size.x or prev_size.y ~= viewport.Size.y then ImGui.UpdateViewportPlatformMonitor(viewport) end @@ -18384,7 +18418,7 @@ function ImGui.AddUpdateViewport(window, id, pos, size, flags) viewport.Window = window viewport.LastFrameActive = g.FrameCount viewport:UpdateWorkRect() - IM_ASSERT(window == nil or viewport.ID == window.ID) + assert(window == nil or viewport.ID == window.ID) if window ~= nil then window.ViewportOwned = true @@ -18412,8 +18446,8 @@ function ImGui.DestroyViewport(viewport) -- Destroy IMGUI_DEBUG_LOG_VIEWPORT("[viewport] Delete Viewport %08X '%s'", viewport.ID, viewport.Window and viewport.Window.Name or "n/a") ImGui.DestroyPlatformWindow(viewport) -- In most circumstances the platform window will already be destroyed here. - IM_ASSERT(not g.PlatformIO.Viewports:contains(viewport)) - IM_ASSERT(g.Viewports.Data[viewport.Idx] == viewport) + assert(not g.PlatformIO.Viewports:contains(viewport)) + assert(g.Viewports.Data[viewport.Idx] == viewport) g.Viewports:erase(viewport.Idx) -- IM_DELETE(viewport) end @@ -18427,19 +18461,19 @@ function ImGui.WindowSelectViewport(window) -- Restore main viewport if multi-viewport is not supported by the backend local main_viewport = ImGui.GetMainViewport() --[[@as ImGuiViewportP]] - if bit32.band(g.ConfigFlagsCurrFrame, ImGuiConfigFlags.ViewportsEnable) == 0 then + if bit32.band(g.ConfigFlagsCurrFrame, 1024 --[[ImGuiConfigFlags.ViewportsEnable]]) == 0 then ImGui.SetWindowViewport(window, main_viewport) return end window.ViewportOwned = false -- Appearing popups reset their viewport so they can inherit again - if bit32.band(flags, bit32.bor(ImGuiWindowFlags.Popup, ImGuiWindowFlags.Tooltip)) ~= 0 and window.Appearing then + if bit32.band(flags, bit32.bor(67108864 --[[ImGuiWindowFlags.Popup]], 33554432 --[[ImGuiWindowFlags.Tooltip]])) ~= 0 and window.Appearing then window.Viewport = nil window.ViewportId = 0 end - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasViewport) == 0 then + if bit32.band(g.NextWindowData.HasFlags, 2048 --[[ImGuiNextWindowDataFlags.HasViewport]]) == 0 then -- By default inherit from parent window if window.Viewport == nil and window.ParentWindow and (not window.ParentWindow.IsFallbackWindow or window.ParentWindow.WasActive) then window.Viewport = window.ParentWindow.Viewport @@ -18448,39 +18482,39 @@ function ImGui.WindowSelectViewport(window) -- Attempt to restore saved viewport id (= window that hasn't been activated yet), try to restore the viewport based on saved 'window->ViewportPos' restored from .ini file if window.Viewport == nil and window.ViewportId ~= 0 then window.Viewport = ImGui.FindViewportByID(window.ViewportId) --[[@as ImGuiViewportP]] - if window.Viewport == nil and window.ViewportPos.x ~= FLT_MAX and window.ViewportPos.y ~= FLT_MAX then - window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.ViewportPos, window.Size, ImGuiViewportFlags.None) + if window.Viewport == nil and window.ViewportPos.x ~= 3.4028234663853e+38 --[[FLT_MAX]] and window.ViewportPos.y ~= 3.4028234663853e+38 --[[FLT_MAX]] then + window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.ViewportPos, window.Size, 0 --[[ImGuiViewportFlags.None]]) end end end local lock_viewport = false - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasViewport) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 2048 --[[ImGuiNextWindowDataFlags.HasViewport]]) ~= 0 then -- Code explicitly request a viewport window.Viewport = ImGui.FindViewportByID(g.NextWindowData.ViewportId) --[[@as ImGuiViewportP]] window.ViewportId = g.NextWindowData.ViewportId -- Store ID even if Viewport isn't resolved yet. - if window.Viewport and bit32.band(window.Flags, ImGuiWindowFlags.DockNodeHost) ~= 0 and window.Viewport.Window ~= nil then + if window.Viewport and bit32.band(window.Flags, 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) ~= 0 and window.Viewport.Window ~= nil then window.Viewport.Window = window window.Viewport.ID = window.ID window.ViewportId = window.ID -- Overwrite ID (always owned by node) end lock_viewport = true - elseif bit32.band(flags, ImGuiWindowFlags.ChildWindow) ~= 0 or bit32.band(flags, ImGuiWindowFlags.ChildMenu) ~= 0 then + elseif bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 or bit32.band(flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0 then -- Always inherit viewport from parent window if window.DockNode and window.DockNode.HostWindow then - IM_ASSERT(window.DockNode.HostWindow.Viewport == window.ParentWindow.Viewport) + assert(window.DockNode.HostWindow.Viewport == window.ParentWindow.Viewport) end window.Viewport = window.ParentWindow.Viewport elseif window.DockNode and window.DockNode.HostWindow then -- This covers the "always inherit viewport from parent window" case for when a window reattach to a node that was just created mid-frame window.Viewport = window.DockNode.HostWindow.Viewport - elseif bit32.band(flags, ImGuiWindowFlags.Tooltip) ~= 0 then + elseif bit32.band(flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0 then window.Viewport = g.MouseViewport elseif ImGui.GetWindowAlwaysWantOwnViewport(window) then - window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.Pos, window.Size, ImGuiViewportFlags.None) + window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.Pos, window.Size, 0 --[[ImGuiViewportFlags.None]]) elseif g.MovingWindow and g.MovingWindow.RootWindowDockTree == window and ImGui.IsMousePosValid() then if window.Viewport ~= nil and window.Viewport.Window == window then - window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.Pos, window.Size, ImGuiViewportFlags.None) + window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.Pos, window.Size, 0 --[[ImGuiViewportFlags.None]]) end else -- Merge into host viewport? @@ -18496,28 +18530,28 @@ function ImGui.WindowSelectViewport(window) if window.Viewport == nil then --- @cast main_viewport ImGuiViewportP if not ImGui.UpdateTryMergeWindowIntoHostViewport(window, main_viewport) then - window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.Pos, window.Size, ImGuiViewportFlags.None) + window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.Pos, window.Size, 0 --[[ImGuiViewportFlags.None]]) end end -- Mark window as allowed to protrude outside of its viewport and into the current monitor if not lock_viewport then - if bit32.band(flags, bit32.bor(ImGuiWindowFlags.Tooltip, ImGuiWindowFlags.Popup)) ~= 0 then + if bit32.band(flags, bit32.bor(33554432 --[[ImGuiWindowFlags.Tooltip]], 67108864 --[[ImGuiWindowFlags.Popup]])) ~= 0 then -- We need to take account of the possibility that mouse may become invalid. -- Popups/Tooltip always set ViewportAllowPlatformMonitorExtend so GetWindowAllowedExtentRect() will return full monitor bounds. - local mouse_ref = bit32.band(flags, ImGuiWindowFlags.Tooltip) ~= 0 and g.IO.MousePos or g.BeginPopupStack.Data[g.BeginPopupStack.Size].OpenMousePos + local mouse_ref = bit32.band(flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0 and g.IO.MousePos or g.BeginPopupStack.Data[g.BeginPopupStack.Size].OpenMousePos local use_mouse_ref = not g.NavCursorVisible or not g.NavHighlightItemUnderNav or not g.NavWindow local mouse_valid = ImGui.IsMousePosValid(mouse_ref) - if (window.Appearing or bit32.band(flags, bit32.bor(ImGuiWindowFlags.Tooltip, ImGuiWindowFlags.ChildMenu)) ~= 0) and (not use_mouse_ref or mouse_valid) then + if (window.Appearing or bit32.band(flags, bit32.bor(33554432 --[[ImGuiWindowFlags.Tooltip]], 268435456 --[[ImGuiWindowFlags.ChildMenu]])) ~= 0) and (not use_mouse_ref or mouse_valid) then local pos_to_use = (use_mouse_ref and mouse_valid) and mouse_ref or ImGui.NavCalcPreferredRefPos(window.Flags) window.ViewportAllowPlatformMonitorExtend = ImGui.FindPlatformMonitorForPos(pos_to_use) else window.ViewportAllowPlatformMonitorExtend = window.Viewport.PlatformMonitor end - elseif window.Viewport and window ~= window.Viewport.Window and window.Viewport.Window and bit32.band(flags, ImGuiWindowFlags.ChildWindow) == 0 and window.DockNode == nil then + elseif window.Viewport and window ~= window.Viewport.Window and window.Viewport.Window and bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0 and window.DockNode == nil then -- When called from Begin() we don't have access to a proper version of the Hidden flag yet, so we replicate this code. local will_be_visible = (window.DockIsActive and not window.DockTabIsVisible) and false or true - if bit32.band(window.Flags, ImGuiWindowFlags.DockNodeHost) ~= 0 and window.Viewport.LastFrameActive < g.FrameCount and will_be_visible then + if bit32.band(window.Flags, 8388608 --[[ImGuiWindowFlags.DockNodeHost]]) ~= 0 and window.Viewport.LastFrameActive < g.FrameCount and will_be_visible then -- Steal/transfer ownership IMGUI_DEBUG_LOG_VIEWPORT("[viewport] Window '%s' steal Viewport %08X from Window '%s'", window.Name, window.Viewport.ID, window.Viewport.Window.Name) window.Viewport.Window = window @@ -18525,9 +18559,9 @@ function ImGui.WindowSelectViewport(window) window.Viewport.LastNameHash = 0 elseif not ImGui.UpdateTryMergeWindowIntoHostViewports(window) then -- Merge? -- New viewport - window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.Pos, window.Size, ImGuiViewportFlags.NoFocusOnAppearing) + window.Viewport = ImGui.AddUpdateViewport(window, window.ID, window.Pos, window.Size, 32 --[[ImGuiViewportFlags.NoFocusOnAppearing]]) end - elseif window.ViewportAllowPlatformMonitorExtend < 0 and bit32.band(flags, ImGuiWindowFlags.ChildWindow) == 0 then + elseif window.ViewportAllowPlatformMonitorExtend < 0 and bit32.band(flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0 then -- Regular (non-child, non-popup) windows by default are also allowed to protrude -- Child windows are kept contained within their parent. window.ViewportAllowPlatformMonitorExtend = window.Viewport.PlatformMonitor @@ -18577,22 +18611,22 @@ function ImGui.WindowSyncOwnedViewport(window, parent_window_in_stack) end -- Update common viewport flags - local viewport_flags_to_clear = bit32.bor(ImGuiViewportFlags.TopMost, ImGuiViewportFlags.NoTaskBarIcon, ImGuiViewportFlags.NoDecoration, ImGuiViewportFlags.NoRendererClear) + local viewport_flags_to_clear = bit32.bor(1024 --[[ImGuiViewportFlags.TopMost]], 16 --[[ImGuiViewportFlags.NoTaskBarIcon]], 8 --[[ImGuiViewportFlags.NoDecoration]], 256 --[[ImGuiViewportFlags.NoRendererClear]]) local viewport_flags = bit32.band(window.Viewport.Flags, bit32.bnot(viewport_flags_to_clear)) local window_flags = window.Flags - local is_modal = bit32.band(window_flags, ImGuiWindowFlags.Modal) ~= 0 - local is_short_lived_floating_window = bit32.band(window_flags, bit32.bor(ImGuiWindowFlags.ChildMenu, ImGuiWindowFlags.Tooltip, ImGuiWindowFlags.Popup)) ~= 0 + local is_modal = bit32.band(window_flags, 134217728 --[[ImGuiWindowFlags.Modal]]) ~= 0 + local is_short_lived_floating_window = bit32.band(window_flags, bit32.bor(268435456 --[[ImGuiWindowFlags.ChildMenu]], 33554432 --[[ImGuiWindowFlags.Tooltip]], 67108864 --[[ImGuiWindowFlags.Popup]])) ~= 0 - if bit32.band(window_flags, ImGuiWindowFlags.Tooltip) ~= 0 then - viewport_flags = bit32.bor(viewport_flags, ImGuiViewportFlags.TopMost) + if bit32.band(window_flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0 then + viewport_flags = bit32.bor(viewport_flags, 1024 --[[ImGuiViewportFlags.TopMost]]) end if (g.IO.ConfigViewportsNoTaskBarIcon or is_short_lived_floating_window) and not is_modal then - viewport_flags = bit32.bor(viewport_flags, ImGuiViewportFlags.NoTaskBarIcon) + viewport_flags = bit32.bor(viewport_flags, 16 --[[ImGuiViewportFlags.NoTaskBarIcon]]) end if g.IO.ConfigViewportsNoDecoration or is_short_lived_floating_window then - viewport_flags = bit32.bor(viewport_flags, ImGuiViewportFlags.NoDecoration) + viewport_flags = bit32.bor(viewport_flags, 8 --[[ImGuiViewportFlags.NoDecoration]]) end -- Not correct to set modal as topmost because: @@ -18607,7 +18641,7 @@ function ImGui.WindowSyncOwnedViewport(window, parent_window_in_stack) -- Setting _NoFocusOnClick would technically prevent us from bringing back to front in case they are being covered by an OS window from a different app, -- but it shouldn't be much of a problem considering those are already popups that are closed when clicking elsewhere. if is_short_lived_floating_window and not is_modal then - viewport_flags = bit32.bor(viewport_flags, ImGuiViewportFlags.NoFocusOnAppearing, ImGuiViewportFlags.NoFocusOnClick) + viewport_flags = bit32.bor(viewport_flags, 32 --[[ImGuiViewportFlags.NoFocusOnAppearing]], 64 --[[ImGuiViewportFlags.NoFocusOnClick]]) end -- We can overwrite viewport flags using ImGuiWindowClass (advanced users) @@ -18621,8 +18655,8 @@ function ImGui.WindowSyncOwnedViewport(window, parent_window_in_stack) -- We can also tell the backend that clearing the platform window won't be necessary, -- as our window background is filling the viewport and we have disabled BgAlpha. -- FIXME: Work on support for per-viewport transparency (#2766) - if bit32.band(window_flags, ImGuiWindowFlags.NoBackground) == 0 then - viewport_flags = bit32.bor(viewport_flags, ImGuiViewportFlags.NoRendererClear) + if bit32.band(window_flags, 128 --[[ImGuiWindowFlags.NoBackground]]) == 0 then + viewport_flags = bit32.bor(viewport_flags, 256 --[[ImGuiViewportFlags.NoRendererClear]]) end window.Viewport.Flags = viewport_flags @@ -18635,7 +18669,7 @@ function ImGui.WindowSyncOwnedViewport(window, parent_window_in_stack) if window.Viewport.ParentViewportId ~= old_parent_viewport_id then window.Viewport.ParentViewport = ImGui.FindViewportByID(window.Viewport.ParentViewportId) --[[@as ImGuiViewport]] end - elseif bit32.band(window_flags, bit32.bor(ImGuiWindowFlags.Popup, ImGuiWindowFlags.Tooltip)) ~= 0 and parent_window_in_stack and (not parent_window_in_stack.IsFallbackWindow or parent_window_in_stack.WasActive) then + elseif bit32.band(window_flags, bit32.bor(67108864 --[[ImGuiWindowFlags.Popup]], 33554432 --[[ImGuiWindowFlags.Tooltip]])) ~= 0 and parent_window_in_stack and (not parent_window_in_stack.IsFallbackWindow or parent_window_in_stack.WasActive) then window.Viewport.ParentViewport = parent_window_in_stack.Viewport window.Viewport.ParentViewportId = parent_window_in_stack.Viewport.ID else @@ -18652,10 +18686,10 @@ end -- This will handle the creation/update of all OS windows via function defined in the ImGuiPlatformIO api. function ImGui.UpdatePlatformWindows() local g = GImGui - IM_ASSERT(g.FrameCountEnded == g.FrameCount, "Forgot to call Render() or EndFrame() before UpdatePlatformWindows()?") - IM_ASSERT(g.FrameCountPlatformEnded < g.FrameCount) + assert(g.FrameCountEnded == g.FrameCount, "Forgot to call Render() or EndFrame() before UpdatePlatformWindows()?") + assert(g.FrameCountPlatformEnded < g.FrameCount) g.FrameCountPlatformEnded = g.FrameCount - if bit32.band(g.ConfigFlagsCurrFrame, ImGuiConfigFlags.ViewportsEnable) == 0 then + if bit32.band(g.ConfigFlagsCurrFrame, 1024 --[[ImGuiConfigFlags.ViewportsEnable]]) == 0 then return end @@ -18690,8 +18724,8 @@ function ImGui.UpdatePlatformWindows() end g.PlatformWindowsCreatedCount = g.PlatformWindowsCreatedCount + 1 viewport.LastNameHash = 0 - ImVec2_CopyV(viewport.LastPlatformPos, FLT_MAX, FLT_MAX) - ImVec2_CopyV(viewport.LastPlatformSize, FLT_MAX, FLT_MAX) -- By clearing those we'll enforce a call to Platform_SetWindowPos/Size below, before Platform_ShowWindow (FIXME: Is that necessary?) + ImVec2_CopyV(viewport.LastPlatformPos, 3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]) + ImVec2_CopyV(viewport.LastPlatformSize, 3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]) -- By clearing those we'll enforce a call to Platform_SetWindowPos/Size below, before Platform_ShowWindow (FIXME: Is that necessary?) ImVec2_Copy(viewport.LastRendererSize, viewport.Size) -- We don't need to call Renderer_SetWindowSize() as it is expected Renderer_CreateWindow() already did it. viewport.PlatformWindowCreated = true end @@ -18738,7 +18772,7 @@ function ImGui.UpdatePlatformWindows() if is_new_platform_window then -- On startup ensure new platform window don't steal focus (give it a few frames, as nested contents may lead to viewport being created a few frames late) if g.FrameCount < 3 then - viewport.Flags = bit32.bor(viewport.Flags, ImGuiViewportFlags.NoFocusOnAppearing) + viewport.Flags = bit32.bor(viewport.Flags, 32 --[[ImGuiViewportFlags.NoFocusOnAppearing]]) end -- Show window @@ -18775,7 +18809,7 @@ function ImGui.RenderPlatformWindowsDefault(platform_render_arg, renderer_render -- First pass: render all windows for i = 2, platform_io.Viewports.Size do local viewport = platform_io.Viewports.Data[i] - if bit32.band(viewport.Flags, ImGuiViewportFlags.IsMinimized) == 0 then + if bit32.band(viewport.Flags, 4096 --[[ImGuiViewportFlags.IsMinimized]]) == 0 then if platform_io.Platform_RenderWindow then platform_io.Platform_RenderWindow(viewport, platform_render_arg) end @@ -18788,7 +18822,7 @@ function ImGui.RenderPlatformWindowsDefault(platform_render_arg, renderer_render -- Second pass: swap buffers for all windows for i = 2, platform_io.Viewports.Size do local viewport = platform_io.Viewports.Data[i] - if bit32.band(viewport.Flags, ImGuiViewportFlags.IsMinimized) == 0 then + if bit32.band(viewport.Flags, 4096 --[[ImGuiViewportFlags.IsMinimized]]) == 0 then if platform_io.Platform_SwapBuffers then platform_io.Platform_SwapBuffers(viewport, platform_render_arg) end @@ -18886,7 +18920,7 @@ function ImGui.DestroyPlatformWindow(viewport) if g.PlatformIO.Platform_DestroyWindow then g.PlatformIO.Platform_DestroyWindow(viewport) end - IM_ASSERT(viewport.RendererUserData == nil and viewport.PlatformUserData == nil) + assert(viewport.RendererUserData == nil and viewport.PlatformUserData == nil) -- Don't clear PlatformWindowCreated for the main viewport, as we initially set that up to true in Initialize() -- The righter way may be to leave it to the backend to set this flag all-together, and made the flag public. @@ -18894,7 +18928,7 @@ function ImGui.DestroyPlatformWindow(viewport) viewport.PlatformWindowCreated = false end else - IM_ASSERT(viewport.RendererUserData == nil and viewport.PlatformUserData == nil and viewport.PlatformHandle == nil) + assert(viewport.RendererUserData == nil and viewport.PlatformUserData == nil and viewport.PlatformHandle == nil) end viewport.RendererUserData = nil viewport.PlatformUserData = nil @@ -18931,12 +18965,12 @@ function ImGui.DebugRenderViewportThumbnail(draw_list, viewport, bb) local scale = bb:GetSize() / viewport.Size local off = bb.Min - viewport.Pos * scale - local alpha_mul = (bit32.band(viewport.Flags, ImGuiViewportFlags.IsMinimized) ~= 0) and 0.30 or 1.00 - window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(ImGuiCol.Border, alpha_mul * 0.40)) + local alpha_mul = (bit32.band(viewport.Flags, 4096 --[[ImGuiViewportFlags.IsMinimized]]) ~= 0) and 0.30 or 1.00 + window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(5 --[[ImGuiCol.Border]], alpha_mul * 0.40)) for _, thumb_window in g.Windows:iter() do repeat - if not thumb_window.WasActive or bit32.band(thumb_window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 then + if not thumb_window.WasActive or bit32.band(thumb_window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 then break end if thumb_window.Viewport ~= viewport then @@ -18950,15 +18984,15 @@ function ImGui.DebugRenderViewportThumbnail(draw_list, viewport, bb) thumb_r:ClipWithFull(bb) title_r:ClipWithFull(bb) local window_is_focused = g.NavWindow and thumb_window.RootWindowForTitleBarHighlight == g.NavWindow.RootWindowForTitleBarHighlight - window.DrawList:AddRectFilled(thumb_r.Min, thumb_r.Max, ImGui.GetColorU32(ImGuiCol.WindowBg, alpha_mul)) - window.DrawList:AddRectFilled(title_r.Min, title_r.Max, ImGui.GetColorU32(window_is_focused and ImGuiCol.TitleBgActive or ImGuiCol.TitleBg, alpha_mul)) - window.DrawList:AddRect(thumb_r.Min, thumb_r.Max, ImGui.GetColorU32(ImGuiCol.Border, alpha_mul)) - window.DrawList:AddText(g.Font, g.FontSize * 1.0, title_r.Min, ImGui.GetColorU32(ImGuiCol.Text, alpha_mul), thumb_window.Name, 1, ImGui.FindRenderedTextEnd(thumb_window.Name)) + window.DrawList:AddRectFilled(thumb_r.Min, thumb_r.Max, ImGui.GetColorU32(2 --[[ImGuiCol.WindowBg]], alpha_mul)) + window.DrawList:AddRectFilled(title_r.Min, title_r.Max, ImGui.GetColorU32(window_is_focused and 11 --[[ImGuiCol.TitleBgActive]] or 10 --[[ImGuiCol.TitleBg]], alpha_mul)) + window.DrawList:AddRect(thumb_r.Min, thumb_r.Max, ImGui.GetColorU32(5 --[[ImGuiCol.Border]], alpha_mul)) + window.DrawList:AddText(g.Font, g.FontSize * 1.0, title_r.Min, ImGui.GetColorU32(0 --[[ImGuiCol.Text]], alpha_mul), thumb_window.Name, 1, ImGui.FindRenderedTextEnd(thumb_window.Name)) until true end - draw_list:AddRect(bb.Min, bb.Max, ImGui.GetColorU32(ImGuiCol.Border, alpha_mul)) + draw_list:AddRect(bb.Min, bb.Max, ImGui.GetColorU32(5 --[[ImGuiCol.Border]], alpha_mul)) if viewport.ID == g.DebugMetricsConfig.HighlightViewportID then window.DrawList:AddRect(bb.Min, bb.Max, IM_COL32(255, 255, 0, 255)) end @@ -18970,7 +19004,7 @@ function ImGui.RenderViewportsThumbnails() -- Draw monitor and calculate their boundaries local SCALE = 1.0 / 8.0 - local bb_full = ImRect(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX) + local bb_full = ImRect(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]], -3.4028234663853e+38 --[[FLT_MAX]]) for _, monitor in g.PlatformIO.Monitors:iter() do bb_full:Add(ImRect(monitor.MainPos, monitor.MainPos + monitor.MainSize)) end @@ -18979,8 +19013,8 @@ function ImGui.RenderViewportsThumbnails() local off = p - bb_full.Min * SCALE for _, monitor in g.PlatformIO.Monitors:iter() do local monitor_draw_bb = ImRect(off + monitor.MainPos * SCALE, off + (monitor.MainPos + monitor.MainSize) * SCALE) - window.DrawList:AddRect(monitor_draw_bb.Min, monitor_draw_bb.Max, (g.DebugMetricsConfig.HighlightMonitorIdx == g.PlatformIO.Monitors:index_from_ptr(monitor)) and IM_COL32(255, 255, 0, 255) or ImGui.GetColorU32(ImGuiCol.Border), 4.0) - window.DrawList:AddRectFilled(monitor_draw_bb.Min, monitor_draw_bb.Max, ImGui.GetColorU32(ImGuiCol.Border, 0.10), 4.0) + window.DrawList:AddRect(monitor_draw_bb.Min, monitor_draw_bb.Max, (g.DebugMetricsConfig.HighlightMonitorIdx == g.PlatformIO.Monitors:index_from_ptr(monitor)) and IM_COL32(255, 255, 0, 255) or ImGui.GetColorU32(5 --[[ImGuiCol.Border]]), 4.0) + window.DrawList:AddRectFilled(monitor_draw_bb.Min, monitor_draw_bb.Max, ImGui.GetColorU32(5 --[[ImGuiCol.Border]], 0.10), 4.0) end -- Draw viewports @@ -19016,7 +19050,7 @@ end function ImGui.ErrorCheckUsingSetCursorPosToExtendParentBoundaries() local g = GImGui local window = g.CurrentWindow - IM_ASSERT(window.DC.IsSetPos) + assert(window.DC.IsSetPos) window.DC.IsSetPos = false if window.DC.CursorPos.x <= window.DC.CursorMaxPos.x and window.DC.CursorPos.y <= window.DC.CursorMaxPos.y then return end if window.SkipItems then return end @@ -19030,7 +19064,7 @@ end ------------------------------------------------------------------------------- local function GetWindowDisplayLayer(window) - return (bit32.band(window.Flags, ImGuiWindowFlags.Tooltip) ~= 0) and 1 or 0 + return (bit32.band(window.Flags, 33554432 --[[ImGuiWindowFlags.Tooltip]]) ~= 0) and 1 or 0 end --- @return int # 0-based display index (like upstream), -1 if not found @@ -19055,7 +19089,7 @@ function ImGui.FindBottomMostVisibleWindowWithinBeginStack(parent_window) local bottom_most_visible_window = parent_window for i = ImGui.FindWindowDisplayIndex(parent_window), 0, -1 do local window = g.Windows.Data[i + 1] - if bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) == 0 then + if bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0 then if not ImGui.IsWindowWithinBeginStackOf(window, parent_window) then break end if ImGui.IsWindowActiveAndVisible(window) and GetWindowDisplayLayer(window) <= GetWindowDisplayLayer(parent_window) then bottom_most_visible_window = window @@ -19070,7 +19104,7 @@ function ImGui.GetTopMostAndVisiblePopupModal() local g = GImGui for n = g.OpenPopupStack.Size, 1, -1 do local popup = g.OpenPopupStack.Data[n].Window - if popup and bit32.band(popup.Flags, ImGuiWindowFlags.Modal) ~= 0 and ImGui.IsWindowActiveAndVisible(popup) then + if popup and bit32.band(popup.Flags, 134217728 --[[ImGuiWindowFlags.Modal]]) ~= 0 and ImGui.IsWindowActiveAndVisible(popup) then return popup end end @@ -19078,7 +19112,7 @@ function ImGui.GetTopMostAndVisiblePopupModal() end function ImGui.RenderDimmedBackgroundBehindWindow(window, col) - if bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end local viewport = window.Viewport local viewport_rect = viewport:GetMainRect() -- Draw behind window by moving the draw command at the FRONT of the draw list @@ -19112,9 +19146,9 @@ function ImGui.RenderDimmedBackgrounds() ImGui.RenderDimmedBackgroundBehindWindow(dim_behind_window, ImGui.GetColorU32(modal_window.DC.ModalDimBgColor, g.DimBgRatio, true)) elseif dim_bg_for_window_list then -- Draw dimming behind Ctrl+Tab target window and behind Ctrl+Tab UI window - ImGui.RenderDimmedBackgroundBehindWindow(g.NavWindowingTargetAnim, ImGui.GetColorU32(ImGuiCol.NavWindowingDimBg, g.DimBgRatio)) + ImGui.RenderDimmedBackgroundBehindWindow(g.NavWindowingTargetAnim, ImGui.GetColorU32(61 --[[ImGuiCol.NavWindowingDimBg]], g.DimBgRatio)) if g.NavWindowingListWindow ~= nil and g.NavWindowingListWindow.Active and g.NavWindowingListWindow.Viewport and g.NavWindowingListWindow.Viewport ~= g.NavWindowingTargetAnim.Viewport then - ImGui.RenderDimmedBackgroundBehindWindow(g.NavWindowingListWindow, ImGui.GetColorU32(ImGuiCol.NavWindowingDimBg, g.DimBgRatio)) + ImGui.RenderDimmedBackgroundBehindWindow(g.NavWindowingListWindow, ImGui.GetColorU32(61 --[[ImGuiCol.NavWindowingDimBg]], g.DimBgRatio)) end -- Draw border around Ctrl+Tab target window @@ -19127,7 +19161,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(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, 0, 3.0) -- FIXME-DPI window.DrawList:PopClipRect() end end @@ -19137,7 +19171,7 @@ function ImGui.ClosePopupsExceptModals() local popup_count_to_keep = g.OpenPopupStack.Size while popup_count_to_keep > 0 do local window = g.OpenPopupStack.Data[popup_count_to_keep].Window - if not window or bit32.band(window.Flags, ImGuiWindowFlags.Modal) ~= 0 then break end + if not window or bit32.band(window.Flags, 134217728 --[[ImGuiWindowFlags.Modal]]) ~= 0 then break end popup_count_to_keep = popup_count_to_keep - 1 end if popup_count_to_keep < g.OpenPopupStack.Size then -- This test is not required but it allows to set a convenient breakpoint on the statement below @@ -19155,7 +19189,7 @@ function ImGui.BeginPopupModal(name, p_open, flags) local g = GImGui local window = g.CurrentWindow local id = window:GetID(name) - if not ImGui.IsPopupOpen(id, ImGuiPopupFlags.None) then + if not ImGui.IsPopupOpen(id, 0 --[[ImGuiPopupFlags.None]]) then g.NextWindowData:ClearFlags() -- We behave like Begin() and need to consume those values if p_open then p_open = false end return false, p_open @@ -19164,12 +19198,12 @@ function ImGui.BeginPopupModal(name, p_open, flags) -- Center modal windows by default for increased visibility -- (this won't really last as settings will kick in, and is mostly for backward compatibility. user may do the same themselves) -- FIXME: Should test for (PosCond & window.SetWindowPosAllowFlags) with the upcoming window. - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasPos) == 0 then + if bit32.band(g.NextWindowData.HasFlags, 1 --[[ImGuiNextWindowDataFlags.HasPos]]) == 0 then local viewport = window.WasActive and window.Viewport or ImGui.GetMainViewport() -- FIXME-VIEWPORT: What may be our reference viewport? - ImGui.SetNextWindowPos(viewport:GetCenter(), ImGuiCond.FirstUseEver, ImVec2(0.5, 0.5)) + ImGui.SetNextWindowPos(viewport:GetCenter(), 4 --[[ImGuiCond.FirstUseEver]], ImVec2(0.5, 0.5)) end - flags = bit32.bor(flags, ImGuiWindowFlags.Popup, ImGuiWindowFlags.Modal, ImGuiWindowFlags.NoCollapse, ImGuiWindowFlags.NoDocking) + flags = bit32.bor(flags, 67108864 --[[ImGuiWindowFlags.Popup]], 134217728 --[[ImGuiWindowFlags.Modal]], 32 --[[ImGuiWindowFlags.NoCollapse]], 524288 --[[ImGuiWindowFlags.NoDocking]]) local is_open p_open, is_open = ImGui.Begin(name, p_open, flags) if not is_open or (p_open ~= nil and not p_open) then -- NB: is_open can be 'false' when the popup is completely clipped (e.g. zero size display) @@ -19183,8 +19217,8 @@ end function ImGui.IsPopupOpenRequestForWindow(popup_flags) local g = GImGui local mouse_button = ImGui.GetMouseButtonFromPopupFlags(popup_flags) - if ImGui.IsMouseReleased(mouse_button, ImGuiKeyOwner_NoOwner) and ImGui.IsWindowHovered(ImGuiHoveredFlags.AllowWhenBlockedByPopup) then - if bit32.band(popup_flags, ImGuiPopupFlags.NoOpenOverItems) == 0 or not ImGui.IsAnyItemHovered() then + if ImGui.IsMouseReleased(mouse_button, 4294967295 --[[ImGuiKeyOwner_NoOwner]]) and ImGui.IsWindowHovered(32 --[[ImGuiHoveredFlags.AllowWhenBlockedByPopup]]) then + if bit32.band(popup_flags, 256 --[[ImGuiPopupFlags.NoOpenOverItems]]) == 0 or not ImGui.IsAnyItemHovered() then return true end end @@ -19201,7 +19235,7 @@ function ImGui.BeginPopupContextWindow(str_id, popup_flags) if not str_id then str_id = "window_context" end local id = window:GetID(str_id) if ImGui.IsPopupOpenRequestForWindow(popup_flags) then ImGui.OpenPopupEx(id, popup_flags) end - return ImGui.BeginPopupEx(id, bit32.bor(ImGuiWindowFlags.AlwaysAutoResize, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoSavedSettings)) + return ImGui.BeginPopupEx(id, bit32.bor(64 --[[ImGuiWindowFlags.AlwaysAutoResize]], 1 --[[ImGuiWindowFlags.NoTitleBar]], 256 --[[ImGuiWindowFlags.NoSavedSettings]])) end function ImGui.BeginPopupContextVoid(str_id, popup_flags) @@ -19211,16 +19245,16 @@ function ImGui.BeginPopupContextVoid(str_id, popup_flags) if not str_id then str_id = "void_context" end local id = window:GetID(str_id) -- FIXME: Use a global ID? local mouse_button = ImGui.GetMouseButtonFromPopupFlags(popup_flags) - if ImGui.IsMouseReleased(mouse_button, id) and not ImGui.IsWindowHovered(ImGuiHoveredFlags.AnyWindow) then + if ImGui.IsMouseReleased(mouse_button, id) and not ImGui.IsWindowHovered(4 --[[ImGuiHoveredFlags.AnyWindow]]) then if ImGui.GetTopMostPopupModal() == nil then ImGui.OpenPopupEx(id, popup_flags) end end - return ImGui.BeginPopupEx(id, bit32.bor(ImGuiWindowFlags.AlwaysAutoResize, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoSavedSettings)) + return ImGui.BeginPopupEx(id, bit32.bor(64 --[[ImGuiWindowFlags.AlwaysAutoResize]], 1 --[[ImGuiWindowFlags.NoTitleBar]], 256 --[[ImGuiWindowFlags.NoSavedSettings]])) end function ImGui.BeginTooltipHidden() local g = GImGui - local _, ret = ImGui.Begin("##Tooltip_Hidden", nil, bit32.bor(ImGuiWindowFlags.Tooltip, ImGuiWindowFlags.NoInputs, ImGuiWindowFlags.NoTitleBar, - ImGuiWindowFlags.NoMove, ImGuiWindowFlags.NoResize, ImGuiWindowFlags.NoSavedSettings, ImGuiWindowFlags.AlwaysAutoResize)) + local _, ret = ImGui.Begin("##Tooltip_Hidden", nil, bit32.bor(33554432 --[[ImGuiWindowFlags.Tooltip]], 197120 --[[ImGuiWindowFlags.NoInputs]], 1 --[[ImGuiWindowFlags.NoTitleBar]], + 4 --[[ImGuiWindowFlags.NoMove]], 2 --[[ImGuiWindowFlags.NoResize]], 256 --[[ImGuiWindowFlags.NoSavedSettings]], 64 --[[ImGuiWindowFlags.AlwaysAutoResize]])) ImGui.SetWindowHiddenAndSkipItemsForCurrentFrame(g.CurrentWindow) return ret end @@ -19242,7 +19276,7 @@ function ImGui.SetKeyboardFocusHere(offset) if offset == nil then offset = 0 end local g = GImGui local window = g.CurrentWindow - IM_ASSERT(offset >= -1) -- -1 is allowed but not below + assert(offset >= -1) -- -1 is allowed but not below -- It makes sense in the vast majority of cases to never interrupt a drag and drop. -- When we refactor this function into ActivateItem() we may want to make this an option. @@ -19254,9 +19288,9 @@ function ImGui.SetKeyboardFocusHere(offset) ImGui.SetNavWindow(window) - local move_flags = bit32.bor(ImGuiNavMoveFlags.IsTabbing, ImGuiNavMoveFlags.Activate, ImGuiNavMoveFlags.FocusApi, ImGuiNavMoveFlags.NoSetNavCursorVisible) - local scroll_flags = window.Appearing and bit32.bor(ImGuiScrollFlags.KeepVisibleEdgeX, ImGuiScrollFlags.AlwaysCenterY) or bit32.bor(ImGuiScrollFlags.KeepVisibleEdgeX, ImGuiScrollFlags.KeepVisibleEdgeY) - ImGui.NavMoveRequestSubmit(ImGuiDir.None, (offset < 0) and ImGuiDir.Up or ImGuiDir.Down, move_flags, scroll_flags) -- FIXME-NAV: Once we refactor tabbing, add LegacyApi flag to not activate non-inputable. + local move_flags = bit32.bor(1024 --[[ImGuiNavMoveFlags.IsTabbing]], 4096 --[[ImGuiNavMoveFlags.Activate]], 512 --[[ImGuiNavMoveFlags.FocusApi]], 16384 --[[ImGuiNavMoveFlags.NoSetNavCursorVisible]]) + local scroll_flags = window.Appearing and bit32.bor(1 --[[ImGuiScrollFlags.KeepVisibleEdgeX]], 32 --[[ImGuiScrollFlags.AlwaysCenterY]]) or bit32.bor(1 --[[ImGuiScrollFlags.KeepVisibleEdgeX]], 2 --[[ImGuiScrollFlags.KeepVisibleEdgeY]]) + ImGui.NavMoveRequestSubmit((-1) --[[ImGuiDir.None]], (offset < 0) and 2 --[[ImGuiDir.Up]] or 3 --[[ImGuiDir.Down]], move_flags, scroll_flags) -- FIXME-NAV: Once we refactor tabbing, add LegacyApi flag to not activate non-inputable. if offset == -1 then ImGui.NavMoveRequestResolveWithLastItem(g.NavMoveResultLocal) else @@ -19272,22 +19306,22 @@ function ImGui.FocusItem() if g.DragDropActive or g.MovingWindow ~= nil then -- FIXME: Opt-in flags for this? return end - local move_flags = bit32.bor(ImGuiNavMoveFlags.IsTabbing, ImGuiNavMoveFlags.FocusApi, ImGuiNavMoveFlags.NoSetNavCursorVisible, ImGuiNavMoveFlags.NoSelect) - local scroll_flags = window.Appearing and bit32.bor(ImGuiScrollFlags.KeepVisibleEdgeX, ImGuiScrollFlags.AlwaysCenterY) or bit32.bor(ImGuiScrollFlags.KeepVisibleEdgeX, ImGuiScrollFlags.KeepVisibleEdgeY) + local move_flags = bit32.bor(1024 --[[ImGuiNavMoveFlags.IsTabbing]], 512 --[[ImGuiNavMoveFlags.FocusApi]], 16384 --[[ImGuiNavMoveFlags.NoSetNavCursorVisible]], 8192 --[[ImGuiNavMoveFlags.NoSelect]]) + local scroll_flags = window.Appearing and bit32.bor(1 --[[ImGuiScrollFlags.KeepVisibleEdgeX]], 32 --[[ImGuiScrollFlags.AlwaysCenterY]]) or bit32.bor(1 --[[ImGuiScrollFlags.KeepVisibleEdgeX]], 2 --[[ImGuiScrollFlags.KeepVisibleEdgeY]]) ImGui.SetNavWindow(window) - ImGui.NavMoveRequestSubmit(ImGuiDir.None, ImGuiDir.Up, move_flags, scroll_flags) + ImGui.NavMoveRequestSubmit((-1) --[[ImGuiDir.None]], 2 --[[ImGuiDir.Up]], move_flags, scroll_flags) ImGui.NavMoveRequestResolveWithLastItem(g.NavMoveResultLocal) end function ImGui.ActivateItemByID(id) local g = GImGui g.NavNextActivateId = id - g.NavNextActivateFlags = ImGuiActivateFlags.None + g.NavNextActivateFlags = 0 --[[ImGuiActivateFlags.None]] end function ImGui.SetNavCursorVisible(visible) local g = GImGui - if g.NavWindow and bit32.band(g.NavWindow.Flags, ImGuiWindowFlags.NoNavInputs) ~= 0 then + if g.NavWindow and bit32.band(g.NavWindow.Flags, 65536 --[[ImGuiWindowFlags.NoNavInputs]]) ~= 0 then visible = false elseif g.IO.ConfigNavCursorVisibleAlways then visible = true @@ -19322,10 +19356,10 @@ local NAV_WINDOWING_LIST_APPEAR_DELAY = 0.15 -- Window has already passed the IsWindowNavFocusable() local function GetFallbackWindowNameForWindowingList(window) - if bit32.band(window.Flags, ImGuiWindowFlags.Popup) ~= 0 then + if bit32.band(window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 then return "(Popup)" end - if bit32.band(window.Flags, ImGuiWindowFlags.MenuBar) ~= 0 and window.Name == "##MainMenuBar" then + if bit32.band(window.Flags, 1024 --[[ImGuiWindowFlags.MenuBar]]) ~= 0 and window.Name == "##MainMenuBar" then return "(Main menu bar)" end if window.DockNodeAsHost then @@ -19337,21 +19371,21 @@ end -- Overlay displayed when using Ctrl+Tab. Called by EndFrame(). function ImGui.NavUpdateWindowingOverlay() local g = GImGui - IM_ASSERT(g.NavWindowingTarget ~= nil) + assert(g.NavWindowingTarget ~= nil) if g.NavWindowingTimer < NAV_WINDOWING_LIST_APPEAR_DELAY then return end local viewport = ImGui.GetMainViewport() - ImGui.SetNextWindowSizeConstraints(ImVec2(viewport.Size.x * 0.20, viewport.Size.y * 0.20), ImVec2(FLT_MAX, FLT_MAX)) - ImGui.SetNextWindowPos(viewport:GetCenter(), ImGuiCond.Always, ImVec2(0.5, 0.5)) - ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, g.Style.WindowPadding * 2.0) - ImGui.Begin("##NavWindowingOverlay", nil, bit32.bor(ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoFocusOnAppearing, ImGuiWindowFlags.NoResize, ImGuiWindowFlags.NoMove, ImGuiWindowFlags.NoInputs, ImGuiWindowFlags.AlwaysAutoResize, ImGuiWindowFlags.NoSavedSettings)) + ImGui.SetNextWindowSizeConstraints(ImVec2(viewport.Size.x * 0.20, viewport.Size.y * 0.20), ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]])) + ImGui.SetNextWindowPos(viewport:GetCenter(), 1 --[[ImGuiCond.Always]], ImVec2(0.5, 0.5)) + ImGui.PushStyleVar(2 --[[ImGuiStyleVar.WindowPadding]], g.Style.WindowPadding * 2.0) + ImGui.Begin("##NavWindowingOverlay", nil, bit32.bor(1 --[[ImGuiWindowFlags.NoTitleBar]], 4096 --[[ImGuiWindowFlags.NoFocusOnAppearing]], 2 --[[ImGuiWindowFlags.NoResize]], 4 --[[ImGuiWindowFlags.NoMove]], 197120 --[[ImGuiWindowFlags.NoInputs]], 64 --[[ImGuiWindowFlags.AlwaysAutoResize]], 256 --[[ImGuiWindowFlags.NoSavedSettings]])) g.NavWindowingListWindow = g.CurrentWindow for n = g.WindowsFocusOrder.Size, 1, -1 do local window = g.WindowsFocusOrder.Data[n] - IM_ASSERT(window ~= nil) -- Fix static analyzers + assert(window ~= nil) -- Fix static analyzers if ImGui.IsWindowNavFocusable(window) then local label = window.Name if ImGui.FindRenderedTextEnd(label) == 1 then @@ -19377,37 +19411,37 @@ local function NavUpdateCreateWrappingRequest() -- local move_axis = (g.NavMoveDir == ImGuiDir.Up or g.NavMoveDir == ImGuiDir.Down) and ImGuiAxis.Y or ImGuiAxis.X -- Menu layer does not maintain scrolling / content size (#9178) - local wrap_size = (g.NavLayer == ImGuiNavLayer.Menu) and window.Size or (window.ContentSize + window.WindowPadding) + local wrap_size = (g.NavLayer == 1 --[[ImGuiNavLayer.Menu]]) and window.Size or (window.ContentSize + window.WindowPadding) - if g.NavMoveDir == ImGuiDir.Left and bit32.band(move_flags, bit32.bor(ImGuiNavMoveFlags.WrapX, ImGuiNavMoveFlags.LoopX)) ~= 0 then + if g.NavMoveDir == 0 --[[ImGuiDir.Left]] and bit32.band(move_flags, bit32.bor(4 --[[ImGuiNavMoveFlags.WrapX]], 1 --[[ImGuiNavMoveFlags.LoopX]])) ~= 0 then bb_rel.Min.x = wrap_size.x; bb_rel.Max.x = wrap_size.x - if bit32.band(move_flags, ImGuiNavMoveFlags.WrapX) ~= 0 then + if bit32.band(move_flags, 4 --[[ImGuiNavMoveFlags.WrapX]]) ~= 0 then bb_rel:TranslateY(-bb_rel:GetHeight()) -- Previous row - clip_dir = ImGuiDir.Up + clip_dir = 2 --[[ImGuiDir.Up]] end do_forward = true end - if g.NavMoveDir == ImGuiDir.Right and bit32.band(move_flags, bit32.bor(ImGuiNavMoveFlags.WrapX, ImGuiNavMoveFlags.LoopX)) ~= 0 then + if g.NavMoveDir == 1 --[[ImGuiDir.Right]] and bit32.band(move_flags, bit32.bor(4 --[[ImGuiNavMoveFlags.WrapX]], 1 --[[ImGuiNavMoveFlags.LoopX]])) ~= 0 then bb_rel.Min.x = -window.WindowPadding.x; bb_rel.Max.x = -window.WindowPadding.x - if bit32.band(move_flags, ImGuiNavMoveFlags.WrapX) ~= 0 then + if bit32.band(move_flags, 4 --[[ImGuiNavMoveFlags.WrapX]]) ~= 0 then bb_rel:TranslateY(bb_rel:GetHeight()) -- Next row - clip_dir = ImGuiDir.Down + clip_dir = 3 --[[ImGuiDir.Down]] end do_forward = true end - if g.NavMoveDir == ImGuiDir.Up and bit32.band(move_flags, bit32.bor(ImGuiNavMoveFlags.WrapY, ImGuiNavMoveFlags.LoopY)) ~= 0 then + if g.NavMoveDir == 2 --[[ImGuiDir.Up]] and bit32.band(move_flags, bit32.bor(8 --[[ImGuiNavMoveFlags.WrapY]], 2 --[[ImGuiNavMoveFlags.LoopY]])) ~= 0 then bb_rel.Min.y = wrap_size.y; bb_rel.Max.y = wrap_size.y - if bit32.band(move_flags, ImGuiNavMoveFlags.WrapY) ~= 0 then + if bit32.band(move_flags, 8 --[[ImGuiNavMoveFlags.WrapY]]) ~= 0 then bb_rel:TranslateX(-bb_rel:GetWidth()) -- Previous column - clip_dir = ImGuiDir.Left + clip_dir = 0 --[[ImGuiDir.Left]] end do_forward = true end - if g.NavMoveDir == ImGuiDir.Down and bit32.band(move_flags, bit32.bor(ImGuiNavMoveFlags.WrapY, ImGuiNavMoveFlags.LoopY)) ~= 0 then + if g.NavMoveDir == 3 --[[ImGuiDir.Down]] and bit32.band(move_flags, bit32.bor(8 --[[ImGuiNavMoveFlags.WrapY]], 2 --[[ImGuiNavMoveFlags.LoopY]])) ~= 0 then bb_rel.Min.y = -window.WindowPadding.y; bb_rel.Max.y = -window.WindowPadding.y - if bit32.band(move_flags, ImGuiNavMoveFlags.WrapY) ~= 0 then + if bit32.band(move_flags, 8 --[[ImGuiNavMoveFlags.WrapY]]) ~= 0 then bb_rel:TranslateX(bb_rel:GetWidth()) -- Next column - clip_dir = ImGuiDir.Right + clip_dir = 1 --[[ImGuiDir.Right]] end do_forward = true end @@ -19415,8 +19449,8 @@ local function NavUpdateCreateWrappingRequest() return end window.NavRectRel[g.NavLayer] = bb_rel - ImGui.NavClearPreferredPosForAxis(ImGuiAxis.X) - ImGui.NavClearPreferredPosForAxis(ImGuiAxis.Y) + ImGui.NavClearPreferredPosForAxis(1 --[[ImGuiAxis.X]]) + ImGui.NavClearPreferredPosForAxis(2 --[[ImGuiAxis.Y]]) ImGui.NavMoveRequestForward(g.NavMoveDir, clip_dir, move_flags, g.NavMoveScrollFlags) end @@ -19431,7 +19465,7 @@ function ImGui.NavEndFrame() -- Perform wrap-around in menus -- FIXME-NAV: Wrap may need to apply a weight bias on the other axis. e.g. 4x4 grid with 2 last items missing on last item won't handle LoopY/WrapY correctly. -- FIXME-NAV: Wrap (not Loop) support could be handled by the scoring function and then WrapX would function without an extra frame. - if g.NavWindow and ImGui.NavMoveRequestButNoResultYet() and bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.WrapMask_) ~= 0 and bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.Forwarded) == 0 then + if g.NavWindow and ImGui.NavMoveRequestButNoResultYet() and bit32.band(g.NavMoveFlags, 15 --[[ImGuiNavMoveFlags.WrapMask_]]) ~= 0 and bit32.band(g.NavMoveFlags, 128 --[[ImGuiNavMoveFlags.Forwarded]]) == 0 then NavUpdateCreateWrappingRequest() end end @@ -19600,7 +19634,7 @@ local function ImGuiListClipper_SortAndFuseRanges(ranges, offset) -- Now fuse ranges together as much as possible. local i = 2 + offset while i <= ranges.Size do - IM_ASSERT(not d[i].PosToIndexConvert and not d[i - 1].PosToIndexConvert) + assert(not d[i].PosToIndexConvert and not d[i - 1].PosToIndexConvert) if d[i - 1].Max < d[i].Min then i = i + 1 else @@ -19632,7 +19666,7 @@ local function ImGuiListClipper_SeekCursorAndSetupPrevLine(clipper, pos_y, line_ ImGui.TableEndRow(tbl) end local row_increase = math.floor((off_y / line_height) + 0.5) - if row_increase > 0 and bit32.band(clipper.Flags, ImGuiListClipperFlags.NoSetTableRowCounters) == 0 then -- If your clipper item height is ~= from actual table row height, consider using ImGuiListClipperFlags.NoSetTableRowCounters. See #8886. + if row_increase > 0 and bit32.band(clipper.Flags, 1 --[[ImGuiListClipperFlags.NoSetTableRowCounters]]) == 0 then -- If your clipper item height is ~= from actual table row height, consider using ImGuiListClipperFlags.NoSetTableRowCounters. See #8886. tbl.CurrentRow = tbl.CurrentRow + row_increase tbl.RowBgColorCounter = tbl.RowBgColorCounter + row_increase end @@ -19685,12 +19719,12 @@ function MT.ImGuiListClipper:End() if data then -- In theory here we should assert that we are already at the right position, but it seems saner to just seek at the end and not assert/crash the user. local g = self.Ctx - if self.ItemsCount >= 0 and self.ItemsCount < INT_MAX and self.DisplayStart >= 0 then + if self.ItemsCount >= 0 and self.ItemsCount < 2147483647 --[[INT_MAX]] and self.DisplayStart >= 0 then self:SeekCursorForItem(self.ItemsCount) end -- Restore temporary buffer and fix back pointers which may be invalidated when nesting - IM_ASSERT(data.ListClipper == self) + assert(data.ListClipper == self) data.StepNo = data.Ranges.Size g.ClipperTempDataStacked = g.ClipperTempDataStacked - 1 if g.ClipperTempDataStacked > 0 then @@ -19708,8 +19742,8 @@ function MT.ImGuiListClipper:IncludeItemByIndex(item_index) self:IncludeItemsByI function MT.ImGuiListClipper:IncludeItemsByIndex(item_begin, item_end) local data = self.TempData - IM_ASSERT(self.DisplayStart < 0) -- Only allowed after Begin() and if there has not been a specified range yet. - IM_ASSERT(item_begin <= item_end) + assert(self.DisplayStart < 0) -- Only allowed after Begin() and if there has not been a specified range yet. + assert(item_begin <= item_end) if item_begin < item_end then data.Ranges:push_back(ClipperRangeFromIndices(item_begin, item_end)) end @@ -19728,7 +19762,7 @@ local function ImGuiListClipper_StepInternal(clipper) local g = clipper.Ctx local window = g.CurrentWindow local data = clipper.TempData - IM_ASSERT(data ~= nil, "Called ImGuiListClipper::Step() too many times, or before ImGuiListClipper::Begin() ?") + assert(data ~= nil, "Called ImGuiListClipper::Step() too many times, or before ImGuiListClipper::Begin() ?") local tbl = g.CurrentTable if tbl and tbl.IsInsideRow then @@ -19768,10 +19802,10 @@ local function ImGuiListClipper_StepInternal(clipper) -- Step 1: Let the clipper infer height from first range if clipper.ItemsHeight <= 0.0 then - IM_ASSERT(data.StepNo == 1) + assert(data.StepNo == 1) -- (no float precision mitigation needed: Luau numbers are doubles) clipper.ItemsHeight = (window.DC.CursorPos.y - clipper.StartPosY) / (clipper.DisplayEnd - clipper.DisplayStart) - if clipper.ItemsHeight == 0.0 and clipper.ItemsCount == INT_MAX then -- Accept that no item have been submitted if in indeterminate mode. + if clipper.ItemsHeight == 0.0 and clipper.ItemsCount == 2147483647 --[[INT_MAX]] then -- Accept that no item have been submitted if in indeterminate mode. return false end if clipper.ItemsHeight <= 0.0 then @@ -19793,15 +19827,15 @@ local function ImGuiListClipper_StepInternal(clipper) else -- Add range selected to be included for navigation local is_nav_request = (g.NavMoveScoringItems and g.NavWindow and g.NavWindow.RootWindowForNav == window.RootWindowForNav) and true or false - local nav_off_min = (is_nav_request and g.NavMoveClipDir == ImGuiDir.Up) and -1 or 0 - local nav_off_max = (is_nav_request and g.NavMoveClipDir == ImGuiDir.Down) and 1 or 0 + local nav_off_min = (is_nav_request and g.NavMoveClipDir == 2 --[[ImGuiDir.Up]]) and -1 or 0 + local nav_off_max = (is_nav_request and g.NavMoveClipDir == 3 --[[ImGuiDir.Down]]) and 1 or 0 if is_nav_request then data.Ranges:push_back(ClipperRangeFromPositions(g.NavScoringRect.Min.y, g.NavScoringRect.Max.y, nav_off_min, nav_off_max)) if not g.NavScoringNoClipRect:IsInverted() then data.Ranges:push_back(ClipperRangeFromPositions(g.NavScoringNoClipRect.Min.y, g.NavScoringNoClipRect.Max.y, nav_off_min, nav_off_max)) end end - if is_nav_request and bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.IsTabbing) ~= 0 and g.NavTabbingDir == -1 then + if is_nav_request and bit32.band(g.NavMoveFlags, 1024 --[[ImGuiNavMoveFlags.IsTabbing]]) ~= 0 and g.NavTabbingDir == -1 then data.Ranges:push_back(ClipperRangeFromIndices(clipper.ItemsCount - 1, clipper.ItemsCount)) end @@ -19867,7 +19901,7 @@ local function ImGuiListClipper_StepInternal(clipper) -- After the last step: Let the clipper validate that we have reached the expected Y position (corresponding to element DisplayEnd), -- Advance the cursor to the end of the list and then returns 'false' to end the loop. - if clipper.ItemsCount < INT_MAX then + if clipper.ItemsCount < 2147483647 --[[INT_MAX]] then clipper:SeekCursorForItem(clipper.ItemsCount) end return false @@ -19935,7 +19969,7 @@ function ImGui.ErrorRecoveryTryToRecoverState(state_in) -- - Begin/End and BeginChild/EndChild logic is KNOWN TO BE INCONSISTENT WITH ALL OTHER BEGIN/END FUNCTIONS. -- - We will fix that in a future major update. local window = g.CurrentWindow - if bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0 then + if bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0 then if g.CurrentTable ~= nil and g.CurrentTable.InnerWindow == g.CurrentWindow then IM_ASSERT_USER_ERROR(false, "Missing EndTable()") ImGui.EndTable() @@ -19986,21 +20020,21 @@ function ImGui.ErrorRecoveryTryToRecoverWindowState(state_in) IM_ASSERT_USER_ERROR(false, "Missing EndGroup()") ImGui.EndGroup() end - IM_ASSERT(g.GroupStack.Size == state_in.SizeOfGroupStack) + assert(g.GroupStack.Size == state_in.SizeOfGroupStack) while window.IDStack.Size > state_in.SizeOfIDStack do IM_ASSERT_USER_ERROR(false, "Missing PopID()") ImGui.PopID() end while g.DisabledStackSize > state_in.SizeOfDisabledStack do IM_ASSERT_USER_ERROR(false, "Missing EndDisabled()") - if bit32.band(g.CurrentItemFlags, ImGuiItemFlags.Disabled) ~= 0 then + if bit32.band(g.CurrentItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) ~= 0 then ImGui.EndDisabled() else ImGui.EndDisabledOverrideReenable() g.CurrentWindowStack:back().DisabledOverrideReenable = false end end - IM_ASSERT(g.DisabledStackSize == state_in.SizeOfDisabledStack) + assert(g.DisabledStackSize == state_in.SizeOfDisabledStack) while g.ColorStack.Size > state_in.SizeOfColorStack do IM_ASSERT_USER_ERROR(false, "Missing PopStyleColor()") ImGui.PopStyleColor() @@ -20038,7 +20072,7 @@ function ImGui.DebugLog(fmt, ...) if nl ~= "" then lines[#lines + 1] = "" end if part == "" and nl == "" then break end end - if bit32.band(g.DebugLogFlags, ImGuiDebugLogFlags.OutputToTTY) ~= 0 then + if bit32.band(g.DebugLogFlags, 1048576 --[[ImGuiDebugLogFlags.OutputToTTY]]) ~= 0 then print((string.gsub(str, "\n$", ""))) end end @@ -20130,12 +20164,12 @@ function ImGui.BeginErrorTooltip() local g = GImGui local window = ImGui.FindWindowByName("##Tooltip_Error") local use_locked_pos = g.IO.KeyCtrl and window ~= nil and window.WasActive - local c = g.Style.Colors[ImGuiCol.PopupBg] - ImGui.PushStyleColor(ImGuiCol.PopupBg, ImVec4(ImLerp(c.x, 1.0, 0.15), ImLerp(c.y, 0.0, 0.15), ImLerp(c.z, 0.0, 0.15), ImLerp(c.w, 1.0, 0.15))) + local c = g.Style.Colors[4 --[[ImGuiCol.PopupBg]]] + ImGui.PushStyleColor(4 --[[ImGuiCol.PopupBg]], ImVec4(ImLerp(c.x, 1.0, 0.15), ImLerp(c.y, 0.0, 0.15), ImLerp(c.z, 0.0, 0.15), ImLerp(c.w, 1.0, 0.15))) if use_locked_pos then ImGui.SetNextWindowPos(g.ErrorTooltipLockedPos) end - local _, is_visible = ImGui.Begin("##Tooltip_Error", nil, bit32.bor(ImGuiWindowFlags.Tooltip, ImGuiWindowFlags.NoDecoration, ImGuiWindowFlags.NoMove, ImGuiWindowFlags.NoResize, ImGuiWindowFlags.NoSavedSettings, ImGuiWindowFlags.AlwaysAutoResize)) + local _, is_visible = ImGui.Begin("##Tooltip_Error", nil, bit32.bor(33554432 --[[ImGuiWindowFlags.Tooltip]], 43 --[[ImGuiWindowFlags.NoDecoration]], 4 --[[ImGuiWindowFlags.NoMove]], 2 --[[ImGuiWindowFlags.NoResize]], 256 --[[ImGuiWindowFlags.NoSavedSettings]], 64 --[[ImGuiWindowFlags.AlwaysAutoResize]])) ImGui.PopStyleColor() if is_visible and g.CurrentWindow.BeginCount == 1 then ImGui.SeparatorText("MESSAGE FROM DEAR IMGUI") @@ -20196,7 +20230,7 @@ function ImGui.ShowFontSelector(label) if ImGui.BeginCombo(label, font_current:GetDebugName()) then for i, font in io.Fonts.Fonts:iter() do ImGui.PushID(i) - if ImGui.Selectable(font:GetDebugName(), font == font_current, ImGuiSelectableFlags.SelectOnNav) then io.FontDefault = font end + if ImGui.Selectable(font:GetDebugName(), font == font_current, 64 --[[ImGuiSelectableFlags.SelectOnNav]]) then io.FontDefault = font end if font == font_current then ImGui.SetItemDefaultFocus() end ImGui.PopID() end @@ -20222,7 +20256,7 @@ end function ImGui.DebugNodeFontGlyphsForSrcMask(font, baked, src_mask) local draw_list = ImGui.GetWindowDrawList() - local glyph_col = ImGui.GetColorU32(ImGuiCol.Text) + local glyph_col = ImGui.GetColorU32(0 --[[ImGuiCol.Text]]) local cell_size = baked.Size * 1 local cell_spacing = ImGui.GetStyle().ItemSpacing.y -- [port] only scans loaded codepoints (IndexLookup range) instead of the whole 0..0xFFFF range @@ -20358,9 +20392,9 @@ function ImGui.DebugNodeTexture(tex, int_id, highlight_rect) if ImGui.TreeNode("", "Texture #%03d (%dx%d pixels)", tex.UniqueID or 0, tex.Width, tex.Height) then local cfg = g.DebugMetricsConfig _, cfg.ShowTextureUsedRect = ImGui.Checkbox("Show used rect", cfg.ShowTextureUsedRect) - ImGui.PushStyleVar(ImGuiStyleVar.ImageBorderSize, math.max(1.0, g.Style.ImageBorderSize)) + ImGui.PushStyleVar(24 --[[ImGuiStyleVar.ImageBorderSize]], math.max(1.0, g.Style.ImageBorderSize)) local p = ImGui.GetCursorScreenPos() - if tex.Status == ImTextureStatus.WantDestroy or tex.Status == ImTextureStatus.Destroyed then + if tex.Status == 4 --[[ImTextureStatus.WantDestroy]] or tex.Status == 1 --[[ImTextureStatus.Destroyed]] then ImGui.Dummy(ImVec2(tex.Width, tex.Height)) else local ref = ImTextureRef(); ref._TexData = tex @@ -20390,7 +20424,7 @@ function ImGui.ShowFontAtlas(atlas) local io = g.IO local style = g.Style ImGui.BeginDisabled() - ImGui.CheckboxFlags("io.BackendFlags: RendererHasTextures", io.BackendFlags, ImGuiBackendFlags.RendererHasTextures) + ImGui.CheckboxFlags("io.BackendFlags: RendererHasTextures", io.BackendFlags, 16 --[[ImGuiBackendFlags.RendererHasTextures]]) ImGui.EndDisabled() ImGui.ShowFontSelector("Font") local changed @@ -20447,7 +20481,7 @@ function ImGui.ShowFontAtlas(atlas) -- Texture list -- (ensure the last texture always use the same ID, so we can keep it open neatly) for tex_n, tex in atlas.TexList:iter() do - if tex_n == atlas.TexList.Size then ImGui.SetNextItemOpen(true, ImGuiCond.Once) end + if tex_n == atlas.TexList.Size then ImGui.SetNextItemOpen(true, 2 --[[ImGuiCond.Once]]) end ImGui.DebugNodeTexture(tex, atlas.TexList.Size - tex_n, nil) end end @@ -20479,8 +20513,8 @@ end function ImGui.ShowDebugLogWindow(p_open) local g = ImGui.GetCurrentContext() - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasSize) == 0 then - ImGui.SetNextWindowSize(ImVec2(0.0, ImGui.GetFontSize() * 12.0), ImGuiCond.FirstUseEver) + if bit32.band(g.NextWindowData.HasFlags, 2 --[[ImGuiNextWindowDataFlags.HasSize]]) == 0 then + ImGui.SetNextWindowSize(ImVec2(0.0, ImGui.GetFontSize() * 12.0), 4 --[[ImGuiCond.FirstUseEver]]) end local visible p_open, visible = ImGui.Begin("Dear ImGui Debug Log", p_open) @@ -20514,7 +20548,7 @@ function ImGui.ShowDebugLogWindow(p_open) ImGui.EndPopup() end - ImGui.BeginChild("##log", ImVec2(0.0, 0.0), ImGuiChildFlags.Borders, bit32.bor(ImGuiWindowFlags.AlwaysVerticalScrollbar, ImGuiWindowFlags.AlwaysHorizontalScrollbar)) + ImGui.BeginChild("##log", ImVec2(0.0, 0.0), 1 --[[ImGuiChildFlags.Borders]], bit32.bor(16384 --[[ImGuiWindowFlags.AlwaysVerticalScrollbar]], 32768 --[[ImGuiWindowFlags.AlwaysHorizontalScrollbar]])) local backup_log_flags = g.DebugLogFlags g.DebugLogFlags = bit32.band(g.DebugLogFlags, bit32.bnot(L.EventClipper)) local lines = g.DebugLogLines or { "" } @@ -20541,7 +20575,7 @@ local function PathQuery(g) if q == nil then q = { MainID = 0, Active = false, Complete = false, Step = -1, Results = {} } g.DebugItemPathQuery = q - g.DebugIDStackTool = { LastActiveFrame = -1, OptHexEncodeNonAsciiChars = true, OptCopyToClipboardOnCtrlC = false, CopyToClipboardLastTime = -FLT_MAX } + g.DebugIDStackTool = { LastActiveFrame = -1, OptHexEncodeNonAsciiChars = true, OptCopyToClipboardOnCtrlC = false, CopyToClipboardLastTime = -3.4028234663853e+38 --[[FLT_MAX]] } end return q end @@ -20610,8 +20644,8 @@ function ImGui.DebugHookIdInfo(id, data_type, data_id) local info = query.Results[query.Step + 1] if info == nil or info.ID ~= id then return end if info.Desc == nil then - if data_type == ImGuiDataType.S32 then info.Desc = string.format("%d", data_id) - elseif data_type == ImGuiDataType.String then info.Desc = tostring(data_id) + if data_type == 4 --[[ImGuiDataType.S32]] then info.Desc = string.format("%d", data_id) + elseif data_type == 9 --[[ImGuiDataType.String]] then info.Desc = tostring(data_id) else info.Desc = string.format("0x%08X [override]", id) end -- PushOverrideID() is often used to avoid hashing twice, which would lead to 2 calls to DebugHookIdInfo(). We prioritize the first one. end info.QuerySuccess = true @@ -20628,7 +20662,7 @@ local function FormatLevelInfo(g, query, n, format_for_ui) local info = query.Results[n + 1] local window = (info.Desc == nil and n == 0) and ImGui.FindWindowByID(info.ID) or nil if window then return string.format(format_for_ui and "\"%s\" [window]" or "%s", SkipUncontributingPrefix(window.Name)) end -- Source: window name (because the root ID don't call GetID() and so doesn't get hooked) - if info.QuerySuccess then return string.format((format_for_ui and info.DataType == ImGuiDataType.String) and "\"%s\"" or "%s", SkipUncontributingPrefix(info.Desc)) end -- Source: GetID() hooks (prioritize over ItemInfo() because we frequently use patterns like: PushID(str), Button("") where they both have same id) + if info.QuerySuccess then return string.format((format_for_ui and info.DataType == 9 --[[ImGuiDataType.String]]) and "\"%s\"" or "%s", SkipUncontributingPrefix(info.Desc)) end -- Source: GetID() hooks (prioritize over ItemInfo() because we frequently use patterns like: PushID(str), Button("") where they both have same id) if query.Step < #query.Results then return "" end -- Only start using fallback below when all queries are done, so during queries we don't flickering ??? markers. return "???" end @@ -20650,8 +20684,8 @@ end -- ID Stack Tool: Display UI function ImGui.ShowIDStackToolWindow(p_open) local g = ImGui.GetCurrentContext() - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasSize) == 0 then - ImGui.SetNextWindowSize(ImVec2(0.0, ImGui.GetFontSize() * 8.0), ImGuiCond.FirstUseEver) + if bit32.band(g.NextWindowData.HasFlags, 2 --[[ImGuiNextWindowDataFlags.HasSize]]) == 0 then + ImGui.SetNextWindowSize(ImVec2(0.0, ImGui.GetFontSize() * 8.0), 4 --[[ImGuiCond.FirstUseEver]]) end local visible p_open, visible = ImGui.Begin("Dear ImGui ID Stack Tool", p_open) @@ -20669,14 +20703,14 @@ function ImGui.ShowIDStackToolWindow(p_open) -- Ctrl+C to copy path local time_since_copy = g.Time - tool.CopyToClipboardLastTime - ImGui.PushStyleVarY(ImGuiStyleVar.FramePadding, 0.0) + ImGui.PushStyleVarY(11 --[[ImGuiStyleVar.FramePadding]], 0.0) _, tool.OptHexEncodeNonAsciiChars = ImGui.Checkbox("Hex-encode non-ASCII", tool.OptHexEncodeNonAsciiChars) ImGui.SameLine() _, tool.OptCopyToClipboardOnCtrlC = ImGui.Checkbox("Ctrl+C: copy path", tool.OptCopyToClipboardOnCtrlC) ImGui.PopStyleVar() ImGui.SameLine() ImGui.TextColored((time_since_copy >= 0.0 and time_since_copy < 0.75 and math.fmod(time_since_copy, 0.25) < 0.25 * 0.5) and ImVec4(1.0, 1.0, 0.3, 1.0) or ImVec4(), "*COPIED*") - if tool.OptCopyToClipboardOnCtrlC and ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.C), bit32.bor(ImGuiInputFlags.RouteGlobal, ImGuiInputFlags.RouteOverFocused)) then + if tool.OptCopyToClipboardOnCtrlC and ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 548 --[[ImGuiKey.C]]), bit32.bor(4096 --[[ImGuiInputFlags.RouteGlobal]], 16384 --[[ImGuiInputFlags.RouteOverFocused]])) then tool.CopyToClipboardLastTime = g.Time ImGui.SetClipboardText(result_path) end @@ -20684,11 +20718,11 @@ function ImGui.ShowIDStackToolWindow(p_open) ImGui.Separator() -- Display decorated stack - if #query.Results > 0 and ImGui.BeginTable("##table", 3, ImGuiTableFlags.Borders) then + if #query.Results > 0 and ImGui.BeginTable("##table", 3, 1920 --[[ImGuiTableFlags.Borders]]) then local id_width = ImGui.CalcTextSize("0xDDDDDDDD").x - ImGui.TableSetupColumn("Seed", ImGuiTableColumnFlags.WidthFixed, id_width) - ImGui.TableSetupColumn("PushID", ImGuiTableColumnFlags.WidthStretch) - ImGui.TableSetupColumn("Result", ImGuiTableColumnFlags.WidthFixed, id_width) + ImGui.TableSetupColumn("Seed", 16 --[[ImGuiTableColumnFlags.WidthFixed]], id_width) + ImGui.TableSetupColumn("PushID", 8 --[[ImGuiTableColumnFlags.WidthStretch]]) + ImGui.TableSetupColumn("Result", 16 --[[ImGuiTableColumnFlags.WidthFixed]], id_width) ImGui.TableHeadersRow() for n = 0, #query.Results - 1 do local info = query.Results[n + 1] @@ -20698,7 +20732,7 @@ function ImGui.ShowIDStackToolWindow(p_open) ImGui.TextUnformatted(FormatLevelInfo(g, query, n, true)) ImGui.TableNextColumn() ImGui.Text("0x%08X", info.ID) - if n == #query.Results - 1 then ImGui.TableSetBgColor(ImGuiTableBgTarget.CellBg, ImGui.GetColorU32(ImGuiCol.Header)) end + if n == #query.Results - 1 then ImGui.TableSetBgColor(3 --[[ImGuiTableBgTarget.CellBg]], ImGui.GetColorU32(25 --[[ImGuiCol.Header]])) end end ImGui.EndTable() end @@ -20784,7 +20818,7 @@ function ImGui.DebugNodeDrawList(window, viewport, draw_list, label) local function ShowMesh(show_mesh, show_aabb) if not fg_draw_list then return end local clip_rect = ImRect(cr.x, cr.y, cr.z, cr.w) - local vtxs_rect = ImRect(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX) + 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 for i = base, base + pcmd.ElemCount - 1, 3 do local tri = {} @@ -20794,7 +20828,7 @@ function ImGui.DebugNodeDrawList(window, viewport, draw_list, label) tri[n + 1] = ImVec2(ImDrawVtx_Pos(vtx, vi)) vtxs_rect:Add(tri[n + 1]) end - if show_mesh then fg_draw_list:AddPolyline(tri, 3, IM_COL32(255, 255, 0, 255), 1.0, ImDrawFlags.Closed) end -- In yellow: mesh triangles + if show_mesh then fg_draw_list:AddPolyline(tri, 3, IM_COL32(255, 255, 0, 255), 1.0, 512 --[[ImDrawFlags.Closed]]) end -- In yellow: mesh triangles end if show_aabb then fg_draw_list:AddRect(ImTrunc(clip_rect.Min), ImTrunc(clip_rect.Max), IM_COL32(255, 0, 255, 255)) -- In pink: clipping rectangle submitted to GPU @@ -20823,7 +20857,7 @@ function ImGui.DebugNodeTabBar(tab_bar, label) names[#names + 1] = "'" .. (ImGui.TabBarGetTabName and ImGui.TabBarGetTabName(tab_bar, tab) or "?") .. "'" end local buf = string.format("%s 0x%08X (%d tabs)%s { %s%s", label, tab_bar.ID, tab_bar.Tabs.Size, is_active and "" or " *Inactive*", table.concat(names, ", "), (tab_bar.Tabs.Size > 3) and " ... }" or " } ") - if not is_active then ImGui.PushStyleColor(ImGuiCol.Text, g.Style.Colors[ImGuiCol.TextDisabled]) end + if not is_active then ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], g.Style.Colors[1 --[[ImGuiCol.TextDisabled]]]) end local open = ImGui.TreeNode(label, "%s", buf) if not is_active then ImGui.PopStyleColor() end if is_active and ImGui.IsItemHovered() then @@ -20863,9 +20897,9 @@ function ImGui.DebugNodeTableSettings(settings, tbl) ImGui.BulletText("ColumnsCount: %d (max %d)", settings.ColumnsCount, settings.ColumnsCountMax) for n = 0, settings.ColumnsCount - 1 do local c = settings.Columns[n] - local dir = (c.SortOrder ~= -1) and c.SortDirection or ImGuiSortDirection.None + local dir = (c.SortOrder ~= -1) and c.SortDirection or 0 --[[ImGuiSortDirection.None]] ImGui.BulletText("Column %d Order %d SortOrder %2d %s Vis %d %s %7.3f ID 0x%08X", n, c.DisplayOrder, c.SortOrder, - (dir == ImGuiSortDirection.Ascending) and "Asc" or ((dir == ImGuiSortDirection.Descending) and "Des" or "---"), c.IsEnabled, (c.IsStretch ~= 0) and "Weight" or "Width ", c.WidthOrWeight, c.ID) + (dir == 1 --[[ImGuiSortDirection.Ascending]]) and "Asc" or ((dir == 2 --[[ImGuiSortDirection.Descending]]) and "Des" or "---"), c.IsEnabled, (c.IsStretch ~= 0) and "Weight" or "Width ", c.WidthOrWeight, c.ID) end ImGui.TreePop() end @@ -20874,7 +20908,7 @@ end function ImGui.DebugNodeTable(tbl) local g = ImGui.GetCurrentContext() local is_active = (tbl.LastFrameActive >= g.FrameCount - 2) -- Note that fully clipped early out scrolling tables will appear as inactive here. - if not is_active then ImGui.PushStyleColor(ImGuiCol.Text, g.Style.Colors[ImGuiCol.TextDisabled]) end + if not is_active then ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], g.Style.Colors[1 --[[ImGuiCol.TextDisabled]]]) end local open = ImGui.TreeNode(tostring(tbl), "Table 0x%08X (%d columns, in '%s')%s", tbl.ID, tbl.ColumnsCount, tbl.OuterWindow and tbl.OuterWindow.Name or "?", is_active and "" or " *Inactive*") if not is_active then ImGui.PopStyleColor() end if ImGui.IsItemHovered() then YellowRect(tbl.OuterWindow, tbl.OuterRect.Min, tbl.OuterRect.Max) end @@ -20892,7 +20926,7 @@ function ImGui.DebugNodeTable(tbl) end local sum_weights = 0.0 for n = 0, tbl.ColumnsCount - 1 do - if bit32.band(tbl.Columns[n].Flags, ImGuiTableColumnFlags.WidthStretch) ~= 0 then sum_weights = sum_weights + tbl.Columns[n].StretchWeight end + if bit32.band(tbl.Columns[n].Flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0 then sum_weights = sum_weights + tbl.Columns[n].StretchWeight end end for n = 0, tbl.ColumnsCount - 1 do local c = tbl.Columns[n] @@ -20906,7 +20940,7 @@ function ImGui.DebugNodeTable(tbl) c.WidthGiven, c.WidthRequest, c.WidthAuto, c.StretchWeight, (c.StretchWeight > 0.0 and sum_weights > 0) and (c.StretchWeight / sum_weights) * 100.0 or 0.0, c.MinX, c.MaxX, c.MaxX - c.MinX, c.ClipRect.Min.x, c.ClipRect.Max.x, c.ClipRect.Max.x - c.ClipRect.Min.x, c.ContentMaxXFrozen - c.WorkMinX, c.ContentMaxXUnfrozen - c.WorkMinX, c.ContentMaxXHeadersUsed - c.WorkMinX, c.ContentMaxXHeadersIdeal - c.WorkMinX, - c.SortOrder, (c.SortDirection == ImGuiSortDirection.Ascending) and " (Asc)" or ((c.SortDirection == ImGuiSortDirection.Descending) and " (Des)" or ""), tonumber(c.UserData) or 0, c.Flags, + c.SortOrder, (c.SortDirection == 1 --[[ImGuiSortDirection.Ascending]]) and " (Asc)" or ((c.SortDirection == 2 --[[ImGuiSortDirection.Descending]]) and " (Des)" or ""), tonumber(c.UserData) or 0, c.Flags, (bit32.band(c.Flags, CF.WidthStretch) ~= 0) and "WidthStretch " or "", (bit32.band(c.Flags, CF.WidthFixed) ~= 0) and "WidthFixed " or "", (bit32.band(c.Flags, CF.NoResize) ~= 0) and "NoResize " or "") ImGui.Bullet() ImGui.Selectable(buf) @@ -20921,7 +20955,7 @@ end local function DebugNodeDockNodeFlags(flags, label, enabled) local D = ImGuiDockNodeFlags ImGui.PushID(label) - ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, ImVec2(0.0, 0.0)) + ImGui.PushStyleVar(11 --[[ImGuiStyleVar.FramePadding]], ImVec2(0.0, 0.0)) ImGui.Text("%s:", label) if not enabled then ImGui.BeginDisabled() end for _, n in ipairs({ "NoResize", "NoResizeX", "NoResizeY", "NoTabBar", "HiddenTabBar", "NoWindowMenuButton", "NoCloseButton", "DockedWindowsInFocusRoute", @@ -20939,13 +20973,13 @@ function ImGui.DebugNodeDockNode(node, label) local g = ImGui.GetCurrentContext() local is_alive = (g.FrameCount - node.LastFrameAlive < 2) -- Submitted with ImGuiDockNodeFlags.KeepAliveOnly local is_active = (g.FrameCount - node.LastFrameActive < 2) -- Submitted - if not is_alive then ImGui.PushStyleColor(ImGuiCol.Text, g.Style.Colors[ImGuiCol.TextDisabled]) end - local tree_node_flags = node.IsFocused and ImGuiTreeNodeFlags.Selected or ImGuiTreeNodeFlags.None + if not is_alive then ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], g.Style.Colors[1 --[[ImGuiCol.TextDisabled]]]) end + local tree_node_flags = node.IsFocused and 1 --[[ImGuiTreeNodeFlags.Selected]] or 0 --[[ImGuiTreeNodeFlags.None]] local open if node.Windows.Size > 0 then open = ImGui.TreeNodeEx(node.ID, tree_node_flags, "%s 0x%04X%s: %d windows (vis: '%s')", label, node.ID, node.IsVisible and "" or " (hidden)", node.Windows.Size, node.VisibleWindow and node.VisibleWindow.Name or "NULL") else - local kind = (node.SplitAxis == ImGuiAxis.X) and "horizontal split" or ((node.SplitAxis == ImGuiAxis.Y) and "vertical split" or "empty") + local kind = (node.SplitAxis == 1 --[[ImGuiAxis.X]]) and "horizontal split" or ((node.SplitAxis == 2 --[[ImGuiAxis.Y]]) and "vertical split" or "empty") open = ImGui.TreeNodeEx(node.ID, tree_node_flags, "%s 0x%04X%s: %s (vis: '%s')", label, node.ID, node.IsVisible and "" or " (hidden)", kind, node.VisibleWindow and node.VisibleWindow.Name or "NULL") end if not is_alive then ImGui.PopStyleColor() end @@ -20986,8 +21020,8 @@ function ImGui.DebugNodeWindow(window, label) end local g = ImGui.GetCurrentContext() local is_active = window.WasActive - local tree_node_flags = (window == g.NavWindow) and ImGuiTreeNodeFlags.Selected or ImGuiTreeNodeFlags.None - if not is_active then ImGui.PushStyleColor(ImGuiCol.Text, g.Style.Colors[ImGuiCol.TextDisabled]) end + local tree_node_flags = (window == g.NavWindow) and 1 --[[ImGuiTreeNodeFlags.Selected]] or 0 --[[ImGuiTreeNodeFlags.None]] + if not is_active then ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], g.Style.Colors[1 --[[ImGuiCol.TextDisabled]]]) end local open = ImGui.TreeNodeEx(label, tree_node_flags, "%s '%s'%s", label, window.Name, is_active and "" or " *Inactive*") if not is_active then ImGui.PopStyleColor() end if ImGui.IsItemHovered() and is_active then YellowRect(window, window.Pos, window.Pos + window.Size) end @@ -21070,7 +21104,7 @@ end function ImGui.DebugNodeViewport(viewport) local g = ImGui.GetCurrentContext() - ImGui.SetNextItemOpen(true, ImGuiCond.Once) + ImGui.SetNextItemOpen(true, 2 --[[ImGuiCond.Once]]) local open = ImGui.TreeNode(viewport.ID, "Viewport #%d, ID: 0x%08X, Parent: 0x%08X, Window: \"%s\"", viewport.Idx or 0, viewport.ID, viewport.ParentViewportId or 0, viewport.Window and viewport.Window.Name or "N/A") if ImGui.IsItemHovered() then g.DebugMetricsConfig.HighlightViewportID = viewport.ID end if open then @@ -21088,7 +21122,7 @@ end -- Helper tool to diagnose between text encoding issues and font loading issues. Pass your UTF-8 string and verify that there are correct. function ImGui.DebugTextEncoding(str) ImGui.Text("Text: \"%s\"", str) - if not ImGui.BeginTable("##DebugTextEncoding", 4, bit32.bor(ImGuiTableFlags.Borders, ImGuiTableFlags.RowBg, ImGuiTableFlags.SizingFixedFit, ImGuiTableFlags.Resizable)) then return end + if not ImGui.BeginTable("##DebugTextEncoding", 4, bit32.bor(1920 --[[ImGuiTableFlags.Borders]], 64 --[[ImGuiTableFlags.RowBg]], 8192 --[[ImGuiTableFlags.SizingFixedFit]], 1 --[[ImGuiTableFlags.Resizable]])) then return end ImGui.TableSetupColumn("Offset") ImGui.TableSetupColumn("UTF-8") ImGui.TableSetupColumn("Glyph") @@ -21166,7 +21200,7 @@ function ImGui.ShowMetricsWindow(p_open) end -- Basic info - ImGui.Text("Dear ImGui %s (%d)", IMGUI_VERSION, IMGUI_VERSION_NUM) + ImGui.Text("Dear ImGui %s (%d)", IMGUI_VERSION, 19298 --[[IMGUI_VERSION_NUM]]) ImGui.Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0 / math.max(io.Framerate, 0.0001), io.Framerate) ImGui.Text("%d vertices, %d indices (%d triangles)", io.MetricsRenderVertices, io.MetricsRenderIndices, math.floor(io.MetricsRenderIndices / 3)) ImGui.Text("%d visible windows, %d current allocations", io.MetricsRenderWindows, g.DebugAllocInfo.TotalAllocCount - g.DebugAllocInfo.TotalFreeCount) @@ -21212,7 +21246,7 @@ function ImGui.ShowMetricsWindow(p_open) ImGui.SameLine(); MetricsHelpMarker("You can also call ImGui::DebugTextEncoding() from your code with a given string to test that your UTF-8 encoding settings are correct.") if cfg.ShowTextEncodingViewer then MetricsEncodingBuf = MetricsEncodingBuf or DemoBuf("", 64) - ImGui.SetNextItemWidth(-FLT_MIN) + ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) ImGui.InputText("##DebugTextEncodingBuf", MetricsEncodingBuf, 64) local str = DemoBufStr(MetricsEncodingBuf) if str ~= "" then ImGui.DebugTextEncoding(str) end @@ -21257,7 +21291,7 @@ function ImGui.ShowMetricsWindow(p_open) -- Viewports if ImGui.TreeNode("Viewports", "Viewports (%d)", g.Viewports.Size) then - ImGui.SetNextItemOpen(true, ImGuiCond.Once) + ImGui.SetNextItemOpen(true, 2 --[[ImGuiCond.Once]]) if ImGui.TreeNode("Windows Minimap") then ImGui.RenderViewportsThumbnails() ImGui.TreePop() @@ -21364,7 +21398,7 @@ function ImGui.ShowMetricsWindow(p_open) end local ini = g.SettingsIniData or "" if ImGui.TreeNode("SettingsIniData", "Settings unpacked data (.ini): %d bytes", #ini) then - ImGui.InputTextMultiline("##Ini", DemoBuf(ini, #ini + 1), #ini + 1, ImVec2(-FLT_MIN, ImGui.GetTextLineHeight() * 20), ImGuiInputTextFlags.ReadOnly) + ImGui.InputTextMultiline("##Ini", DemoBuf(ini, #ini + 1), #ini + 1, ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], ImGui.GetTextLineHeight() * 20), 512 --[[ImGuiInputTextFlags.ReadOnly]]) ImGui.TreePop() end ImGui.TreePop() @@ -21376,15 +21410,15 @@ function ImGui.ShowMetricsWindow(p_open) -- User code should never have to go through such hoops! You can generally iterate between ImGuiKey.NamedKey_BEGIN and ImGuiKey.NamedKey_END. ImGui.Indent() ImGui.Text("Keys down:") - for key = ImGuiKey.NamedKey_BEGIN, ImGuiKey.NamedKey_END - 1 do + for key = 512 --[[ImGuiKey.NamedKey_BEGIN]], 667 --[[ImGuiKey.NamedKey_END]] - 1 do if ImGui.IsKeyDown(key) then ImGui.SameLine(); ImGui.Text("\"%s\"", ImGui.GetKeyName(key)) end end ImGui.Text("Keys pressed:") - for key = ImGuiKey.NamedKey_BEGIN, ImGuiKey.NamedKey_END - 1 do + for key = 512 --[[ImGuiKey.NamedKey_BEGIN]], 667 --[[ImGuiKey.NamedKey_END]] - 1 do if ImGui.IsKeyPressed(key) then ImGui.SameLine(); ImGui.Text("\"%s\"", ImGui.GetKeyName(key)) end end ImGui.Text("Keys released:") - for key = ImGuiKey.NamedKey_BEGIN, ImGuiKey.NamedKey_END - 1 do + for key = 512 --[[ImGuiKey.NamedKey_BEGIN]], 667 --[[ImGuiKey.NamedKey_END]] - 1 do if ImGui.IsKeyReleased(key) then ImGui.SameLine(); ImGui.Text("\"%s\"", ImGui.GetKeyName(key)) end end ImGui.Text("Keys mods: %s%s%s%s", io.KeyCtrl and "Ctrl " or "", io.KeyShift and "Shift " or "", io.KeyAlt and "Alt " or "", io.KeySuper and "Super " or "") @@ -21453,7 +21487,7 @@ function ImGui.ShowMetricsWindow(p_open) local r = GetWindowRect(window, cfg.ShowWindowsRectsType) draw_list:AddRect(r.Min, r.Max, IM_COL32(255, 0, 128, 255)) end - if cfg.ShowWindowsBeginOrder and bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) == 0 then + if cfg.ShowWindowsBeginOrder and bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) == 0 then local font_size = ImGui.GetFontSize() draw_list:AddRectFilled(window.Pos, window.Pos + ImVec2(font_size, font_size), IM_COL32(200, 100, 100, 255)) draw_list:AddText(window.Pos, IM_COL32(255, 255, 255, 255), tostring(window.BeginOrderWithinContext)) @@ -21629,7 +21663,7 @@ function ShowDockingDisabledMessage() ImGui.Text("Set io.ConfigFlags |= ImGuiConfigFlags_DockingEnable in your code, or ") ImGui.SameLine(0.0, 0.0) if ImGui.SmallButton("click here") then - io.ConfigFlags = bit32.bor(io.ConfigFlags, ImGuiConfigFlags.DockingEnable) + io.ConfigFlags = bit32.bor(io.ConfigFlags, 128 --[[ImGuiConfigFlags.DockingEnable]]) end end @@ -21795,7 +21829,7 @@ function ImGuiDemoWindowData() -- Other data DisableSections = false, LiveEditOverride = false, - LiveEditFlags = ImGuiItemFlags.LiveEditOnInputText or 0, + LiveEditFlags = 128 --[[ImGuiItemFlags.LiveEditOnInputText]] or 0, DemoTree = nil, } end @@ -21888,13 +21922,13 @@ function ExampleImageViewerData() end function ExampleImageViewer_DrawOptions(data) - ImGui.SetNextItemShortcut(ImGuiKey.G, ImGuiInputFlags.Tooltip) -- | ImGuiInputFlags.RouteGlobal + ImGui.SetNextItemShortcut(552 --[[ImGuiKey.G]], 262144 --[[ImGuiInputFlags.Tooltip]]) -- | ImGuiInputFlags.RouteGlobal _, data.GridEnabled = ImGui.Checkbox("Grid", data.GridEnabled) ImGui.SameLine() ImGui.SetNextItemWidth(ImGui.GetFontSize() * 10.0) local zoom_100 = data.Zoom * 100.0 local changed - zoom_100, changed = ImGui.DragFloat("##Zoom", zoom_100, 5.0, data.ZoomMin * 100.0, data.ZoomMax * 100.0, "%.0f%%", ImGuiSliderFlags.AlwaysClamp) + zoom_100, changed = ImGui.DragFloat("##Zoom", zoom_100, 5.0, data.ZoomMin * 100.0, data.ZoomMax * 100.0, "%.0f%%", 1536 --[[ImGuiSliderFlags.AlwaysClamp]]) if changed then data.Zoom = zoom_100 / 100.0 end @@ -21904,7 +21938,7 @@ function ExampleImageViewer_DrawCanvas(data, canvas_size, image_tex_ref, image_w local io = ImGui.GetIO() local platform_io = ImGui.GetPlatformIO() local draw_list = ImGui.GetWindowDrawList() - IM_ASSERT(canvas_size.x >= 0.0 and canvas_size.y >= 0.0) + assert(canvas_size.x >= 0.0 and canvas_size.y >= 0.0) -- Layout canvas ImGui.InvisibleButton("##Canvas", canvas_size) @@ -21917,7 +21951,7 @@ function ExampleImageViewer_DrawCanvas(data, canvas_size, image_tex_ref, image_w data.ViewReset = false -- Handle inputs - if ImGui.SetItemKeyOwner(ImGuiKey.MouseWheelY) then + if ImGui.SetItemKeyOwner(662 --[[ImGuiKey.MouseWheelY]]) then if io.MouseWheel ~= 0.0 then data.Zoom = DemoClamp(data.Zoom * (1.0 + io.MouseWheel * 0.10), data.ZoomMin, data.ZoomMax) end @@ -22084,7 +22118,7 @@ local function DemoWindowConfiguration(io) ImGui.Text("<>") end -- Prevent both being checked - if ImGui.IsKeyPressed(ImGuiKey.Space) or DemoHas(io.ConfigFlags, F.NoKeyboard) then + if ImGui.IsKeyPressed(524 --[[ImGuiKey.Space]]) or DemoHas(io.ConfigFlags, F.NoKeyboard) then io.ConfigFlags = bit32.band(io.ConfigFlags, bit32.bnot(F.NoMouse)) end end @@ -22286,7 +22320,7 @@ end function ImGui.ShowDemoWindow(p_open) -- Exceptionally add an extra assert here for people confused about initial Dear ImGui setup -- Most functions would normally just assert/crash if the context is missing. - IM_ASSERT(ImGui.GetCurrentContext() ~= nil, "Missing Dear ImGui context. Refer to examples app!") + assert(ImGui.GetCurrentContext() ~= nil, "Missing Dear ImGui context. Refer to examples app!") local data = demo_data @@ -22343,8 +22377,8 @@ function ImGui.ShowDemoWindow(p_open) -- We specify a default position/size in case there's no data in the .ini file. -- We only do it to make the demo applications a little more welcoming, but typically this isn't required. local main_viewport = ImGui.GetMainViewport() - ImGui.SetNextWindowPos(ImVec2(main_viewport.WorkPos.x + 650, main_viewport.WorkPos.y + 20), ImGuiCond.FirstUseEver) - ImGui.SetNextWindowSize(ImVec2(550, 680), ImGuiCond.FirstUseEver) + ImGui.SetNextWindowPos(ImVec2(main_viewport.WorkPos.x + 650, main_viewport.WorkPos.y + 20), 4 --[[ImGuiCond.FirstUseEver]]) + ImGui.SetNextWindowSize(ImVec2(550, 680), 4 --[[ImGuiCond.FirstUseEver]]) -- Main body of the Demo window starts here. local visible @@ -22373,7 +22407,7 @@ function ImGui.ShowDemoWindow(p_open) -- Menu Bar DemoWindowMenuBar(data) - ImGui.Text("Dear ImGui says hello! (%s) (%d)", IMGUI_VERSION or "WIP", IMGUI_VERSION_NUM or 0) + ImGui.Text("Dear ImGui says hello! (%s) (%d)", IMGUI_VERSION or "WIP", 19298 --[[IMGUI_VERSION_NUM]] or 0) ImGui.Spacing() if ImGui.CollapsingHeader("Help") then @@ -22461,8 +22495,8 @@ function DemoWindowWidgets(data) ImGui.BeginDisabled() end if override_liveedit then - ImGui.PushItemFlag(ImGuiItemFlags.LiveEditOnInputText, DemoHas(data.LiveEditFlags, ImGuiItemFlags.LiveEditOnInputText)) - ImGui.PushItemFlag(ImGuiItemFlags.LiveEditOnInputScalar, DemoHas(data.LiveEditFlags, ImGuiItemFlags.LiveEditOnInputScalar)) + ImGui.PushItemFlag(128 --[[ImGuiItemFlags.LiveEditOnInputText]], DemoHas(data.LiveEditFlags, 128 --[[ImGuiItemFlags.LiveEditOnInputText]])) + ImGui.PushItemFlag(256 --[[ImGuiItemFlags.LiveEditOnInputScalar]], DemoHas(data.LiveEditFlags, 256 --[[ImGuiItemFlags.LiveEditOnInputScalar]])) end Sub(DemoWindowWidgetsBasic, "Basic") @@ -22706,11 +22740,11 @@ local function DemoWindowLayout_ChildWindows() -- Child 1: no border, enable horizontal scrollbar do - local window_flags = ImGuiWindowFlags.HorizontalScrollbar + local window_flags = 2048 --[[ImGuiWindowFlags.HorizontalScrollbar]] if SL.disable_mouse_wheel then - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.NoScrollWithMouse) + window_flags = bit32.bor(window_flags, 16 --[[ImGuiWindowFlags.NoScrollWithMouse]]) end - BeginChild("ChildL", ImVec2(ImGui.GetContentRegionAvail().x * 0.5, 260), ImGuiChildFlags.None, window_flags) + BeginChild("ChildL", ImVec2(ImGui.GetContentRegionAvail().x * 0.5, 260), 0 --[[ImGuiChildFlags.None]], window_flags) for i = 0, 99 do ImGui.Text("%04d: scrollable region", i) end @@ -22721,15 +22755,15 @@ local function DemoWindowLayout_ChildWindows() -- Child 2: rounded border do - local window_flags = ImGuiWindowFlags.None + local window_flags = 0 --[[ImGuiWindowFlags.None]] if SL.disable_mouse_wheel then - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.NoScrollWithMouse) + window_flags = bit32.bor(window_flags, 16 --[[ImGuiWindowFlags.NoScrollWithMouse]]) end if not SL.disable_menu then - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.MenuBar) + window_flags = bit32.bor(window_flags, 1024 --[[ImGuiWindowFlags.MenuBar]]) end - ImGui.PushStyleVar(ImGuiStyleVar.ChildRounding, 5.0) - BeginChild("ChildR", ImVec2(0, 260), ImGuiChildFlags.Borders, window_flags) + ImGui.PushStyleVar(7 --[[ImGuiStyleVar.ChildRounding]], 5.0) + BeginChild("ChildR", ImVec2(0, 260), 1 --[[ImGuiChildFlags.Borders]], window_flags) if not SL.disable_menu and ImGui.BeginMenuBar() then if ImGui.BeginMenu("Menu") then DemoMenuFile() @@ -22737,11 +22771,11 @@ local function DemoWindowLayout_ChildWindows() end ImGui.EndMenuBar() end - if ImGui.BeginTable("split", 2, bit32.bor(ImGuiTableFlags.Resizable, ImGuiTableFlags.NoSavedSettings)) then + if ImGui.BeginTable("split", 2, bit32.bor(1 --[[ImGuiTableFlags.Resizable]], 16 --[[ImGuiTableFlags.NoSavedSettings]])) then for i = 0, 99 do local buf = string.format("%03d", i) ImGui.TableNextColumn() - ImGui.Button(buf, ImVec2(-FLT_MIN, 0.0)) + ImGui.Button(buf, ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], 0.0)) end ImGui.EndTable() end @@ -22757,8 +22791,8 @@ local function DemoWindowLayout_ChildWindows() -- ImGui.SetNextWindowSize(ImVec2(-FLT_MIN, 200.0)) -- end - ImGui.PushStyleColor(ImGuiCol.ChildBg, ImGui.GetStyleColorVec4(ImGuiCol.FrameBg)) - if BeginChild("ResizableChild", ImVec2(-FLT_MIN, ImGui.GetTextLineHeightWithSpacing() * 8), bit32.bor(ImGuiChildFlags.Borders, ImGuiChildFlags.ResizeY)) then + ImGui.PushStyleColor(3 --[[ImGuiCol.ChildBg]], ImGui.GetStyleColorVec4(7 --[[ImGuiCol.FrameBg]])) + if BeginChild("ResizableChild", ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], ImGui.GetTextLineHeightWithSpacing() * 8), bit32.bor(1 --[[ImGuiChildFlags.Borders]], 8 --[[ImGuiChildFlags.ResizeY]])) then for n = 0, 9 do ImGui.Text("Line %04d", n) end @@ -22775,8 +22809,8 @@ local function DemoWindowLayout_ChildWindows() ImGui.SetNextItemWidth(ImGui.GetFontSize() * 8) SL.max_height_in_lines = ImGui.DragInt("Max Height (in Lines)", SL.max_height_in_lines, 0.2) - ImGui.SetNextWindowSizeConstraints(ImVec2(0.0, ImGui.GetTextLineHeightWithSpacing() * 1), ImVec2(FLT_MAX, ImGui.GetTextLineHeightWithSpacing() * SL.max_height_in_lines)) - if BeginChild("ConstrainedChild", ImVec2(-FLT_MIN, 0.0), bit32.bor(ImGuiChildFlags.Borders, ImGuiChildFlags.AutoResizeY)) then + ImGui.SetNextWindowSizeConstraints(ImVec2(0.0, ImGui.GetTextLineHeightWithSpacing() * 1), ImVec2(3.4028234663853e+38 --[[FLT_MAX]], ImGui.GetTextLineHeightWithSpacing() * SL.max_height_in_lines)) + if BeginChild("ConstrainedChild", ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], 0.0), bit32.bor(1 --[[ImGuiChildFlags.Borders]], 32 --[[ImGuiChildFlags.AutoResizeY]])) then for n = 0, SL.draw_lines - 1 do ImGui.Text("Line %04d", n) end @@ -22794,25 +22828,25 @@ local function DemoWindowLayout_ChildWindows() -- - Using ImGui.GetItemRectMin/Max() to query the "item" state (because the child window is an item from -- the POV of the parent window). See 'Demo->Querying Status (Edited/Active/Hovered etc.)' for details. do - if SL.child_flags == nil then SL.child_flags = bit32.bor(ImGuiChildFlags.Borders, ImGuiChildFlags.ResizeX, ImGuiChildFlags.ResizeY) end + if SL.child_flags == nil then SL.child_flags = bit32.bor(1 --[[ImGuiChildFlags.Borders]], 4 --[[ImGuiChildFlags.ResizeX]], 8 --[[ImGuiChildFlags.ResizeY]]) end ImGui.SetNextItemWidth(ImGui.GetFontSize() * 8) SL.offset_x = ImGui.DragInt("Offset X", SL.offset_x, 1.0, -1000, 1000) _, SL.override_bg_color = ImGui.Checkbox("Override ChildBg color", SL.override_bg_color) - _, SL.child_flags = ImGui.CheckboxFlags("ImGuiChildFlags_Borders", SL.child_flags, ImGuiChildFlags.Borders) - _, SL.child_flags = ImGui.CheckboxFlags("ImGuiChildFlags_AlwaysUseWindowPadding", SL.child_flags, ImGuiChildFlags.AlwaysUseWindowPadding) - _, SL.child_flags = ImGui.CheckboxFlags("ImGuiChildFlags_ResizeX", SL.child_flags, ImGuiChildFlags.ResizeX) - _, SL.child_flags = ImGui.CheckboxFlags("ImGuiChildFlags_ResizeY", SL.child_flags, ImGuiChildFlags.ResizeY) - _, SL.child_flags = ImGui.CheckboxFlags("ImGuiChildFlags_FrameStyle", SL.child_flags, ImGuiChildFlags.FrameStyle) + _, SL.child_flags = ImGui.CheckboxFlags("ImGuiChildFlags_Borders", SL.child_flags, 1 --[[ImGuiChildFlags.Borders]]) + _, SL.child_flags = ImGui.CheckboxFlags("ImGuiChildFlags_AlwaysUseWindowPadding", SL.child_flags, 2 --[[ImGuiChildFlags.AlwaysUseWindowPadding]]) + _, SL.child_flags = ImGui.CheckboxFlags("ImGuiChildFlags_ResizeX", SL.child_flags, 4 --[[ImGuiChildFlags.ResizeX]]) + _, SL.child_flags = ImGui.CheckboxFlags("ImGuiChildFlags_ResizeY", SL.child_flags, 8 --[[ImGuiChildFlags.ResizeY]]) + _, SL.child_flags = ImGui.CheckboxFlags("ImGuiChildFlags_FrameStyle", SL.child_flags, 128 --[[ImGuiChildFlags.FrameStyle]]) ImGui.SameLine(); DemoHelpMarker("Style the child window like a framed item: use FrameBg, FrameRounding, FrameBorderSize, FramePadding instead of ChildBg, ChildRounding, ChildBorderSize, WindowPadding.") - if Has(SL.child_flags, ImGuiChildFlags.FrameStyle) then + if Has(SL.child_flags, 128 --[[ImGuiChildFlags.FrameStyle]]) then SL.override_bg_color = false end ImGui.SetCursorPosX(ImGui.GetCursorPosX() + SL.offset_x) if SL.override_bg_color then - ImGui.PushStyleColor(ImGuiCol.ChildBg, IM_COL32(255, 0, 0, 100)) + ImGui.PushStyleColor(3 --[[ImGuiCol.ChildBg]], IM_COL32(255, 0, 0, 100)) end - BeginChild("Red", ImVec2(200, 100), SL.child_flags, ImGuiWindowFlags.None) + BeginChild("Red", ImVec2(200, 100), SL.child_flags, 0 --[[ImGuiWindowFlags.None]]) if SL.override_bg_color then ImGui.PopStyleColor() end @@ -22857,7 +22891,7 @@ local function DemoWindowLayout_WidgetsWidth() block("SetNextItemWidth/PushItemWidth(-Min(GetContentRegionAvail().x * 0.40f, GetFontSize() * 12))", nil, -IM_MIN(ImGui.GetFontSize() * 12, ImGui.GetContentRegionAvail().x * 0.40), "float##5a", "float (indented)##5b") -- Demonstrate using PushItemWidth to surround three items. -- Calling SetNextItemWidth() before each of them would have the same effect. - block("SetNextItemWidth/PushItemWidth(-FLT_MIN)", "Align to right edge", -FLT_MIN, "##float6a", "float (indented)##6b") + block("SetNextItemWidth/PushItemWidth(-FLT_MIN)", "Align to right edge", -1.1754943508223e-38 --[[FLT_MIN]], "##float6a", "float (indented)##6b") end local function DemoWindowLayout_BasicHorizontal() @@ -23078,7 +23112,7 @@ local function DemoWindowLayout_TextBaseline() local spacing = ImGui.GetStyle().ItemInnerSpacing.x ImGui.Button("Button##1") -- Will make line higher ImGui.SameLine(0.0, spacing) - if ImGui.TreeNodeEx("Node##1", ImGuiTreeNodeFlags.DrawLinesNone) then + if ImGui.TreeNodeEx("Node##1", 262144 --[[ImGuiTreeNodeFlags.DrawLinesNone]]) then -- Placeholder tree data for i = 0, 5 do ImGui.BulletText("Item %d..", i) @@ -23087,11 +23121,11 @@ local function DemoWindowLayout_TextBaseline() end local padding = math.floor(ImGui.GetFontSize() * 1.20) -- Large padding - ImGui.PushStyleVarY(ImGuiStyleVar.FramePadding, padding) + ImGui.PushStyleVarY(11 --[[ImGuiStyleVar.FramePadding]], padding) ImGui.Button("Button##2") ImGui.PopStyleVar() ImGui.SameLine(0.0, spacing) - if ImGui.TreeNodeEx("Node##2", ImGuiTreeNodeFlags.DrawLinesNone) then + if ImGui.TreeNodeEx("Node##2", 262144 --[[ImGuiTreeNodeFlags.DrawLinesNone]]) then ImGui.TreePop() end @@ -23127,10 +23161,10 @@ local function DemoWindowLayout_HorizontalContentsSizeWindow() if SL.explicit_content_size then ImGui.SetNextWindowContentSize(ImVec2(SL.contents_size_x, 0.0)) end - SL.show_horizontal_contents_size_demo_window = ImGui.Begin("Horizontal contents size demo window", SL.show_horizontal_contents_size_demo_window, SL.show_h_scrollbar and ImGuiWindowFlags.HorizontalScrollbar or 0) + SL.show_horizontal_contents_size_demo_window = ImGui.Begin("Horizontal contents size demo window", SL.show_horizontal_contents_size_demo_window, SL.show_h_scrollbar and 2048 --[[ImGuiWindowFlags.HorizontalScrollbar]] or 0) IMGUI_DEMO_MARKER("Layout/Scrolling/Horizontal contents size demo window") - ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, ImVec2(2, 0)) - ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, ImVec2(2, 0)) + ImGui.PushStyleVar(14 --[[ImGuiStyleVar.ItemSpacing]], ImVec2(2, 0)) + ImGui.PushStyleVar(11 --[[ImGuiStyleVar.FramePadding]], ImVec2(2, 0)) DemoHelpMarker( "Test how different widgets react and impact the work rectangle growing when horizontal scrolling is enabled.\n\n" .. "Use 'Metrics->Tools->Show windows rectangles' to visualize rectangles.") @@ -23148,8 +23182,8 @@ local function DemoWindowLayout_HorizontalContentsSizeWindow() ImGui.SetNextItemWidth(ImGui.CalcTextSize("123456").x) SL.contents_size_x = ImGui.DragFloat("##csx", SL.contents_size_x) local p = ImGui.GetCursorScreenPos() - ImGui.GetWindowDrawList():AddRectFilled(p, ImVec2(p.x + 10, p.y + 10), IM_COL32_WHITE) - ImGui.GetWindowDrawList():AddRectFilled(ImVec2(p.x + SL.contents_size_x - 10, p.y), ImVec2(p.x + SL.contents_size_x, p.y + 10), IM_COL32_WHITE) + ImGui.GetWindowDrawList():AddRectFilled(p, ImVec2(p.x + 10, p.y + 10), 4294967295 --[[IM_COL32_WHITE]]) + ImGui.GetWindowDrawList():AddRectFilled(ImVec2(p.x + SL.contents_size_x - 10, p.y), ImVec2(p.x + SL.contents_size_x, p.y + 10), 4294967295 --[[IM_COL32_WHITE]]) ImGui.Dummy(ImVec2(0, 10)) end ImGui.PopStyleVar(2) @@ -23173,7 +23207,7 @@ local function DemoWindowLayout_HorizontalContentsSizeWindow() end if SL.show_columns then ImGui.Text("Tables:") - if ImGui.BeginTable("table", 4, ImGuiTableFlags.Borders) then + if ImGui.BeginTable("table", 4, 1920 --[[ImGuiTableFlags.Borders]]) then for n = 0, 3 do ImGui.TableNextColumn() ImGui.Text("Width %.2f", ImGui.GetContentRegionAvail().x) @@ -23200,7 +23234,7 @@ local function DemoWindowLayout_HorizontalContentsSizeWindow() ImGui.EndTabBar() end if SL.show_child then - BeginChild("child", ImVec2(0, 0), ImGuiChildFlags.Borders) + BeginChild("child", ImVec2(0, 0), 1 --[[ImGuiChildFlags.Borders]]) ImGui.EndChild() end ImGui.End() @@ -23221,12 +23255,12 @@ local function DemoWindowLayout_Scrolling() _, SL.enable_track = ImGui.Checkbox("Track", SL.enable_track) local scroll_to_off - SL.scroll_to_off_px, scroll_to_off = ImGui.DragFloat("##off", SL.scroll_to_off_px, 1.00, 0, FLT_MAX, "+%.0f px") + SL.scroll_to_off_px, scroll_to_off = ImGui.DragFloat("##off", SL.scroll_to_off_px, 1.00, 0, 3.4028234663853e+38 --[[FLT_MAX]], "+%.0f px") ImGui.SameLine() scroll_to_off = ImGui.Button("Scroll Offset") or scroll_to_off local scroll_to_pos - SL.scroll_to_pos_px, scroll_to_pos = ImGui.DragFloat("##pos", SL.scroll_to_pos_px, 1.00, -10, FLT_MAX, "X/Y = %.0f px") + SL.scroll_to_pos_px, scroll_to_pos = ImGui.DragFloat("##pos", SL.scroll_to_pos_px, 1.00, -10, 3.4028234663853e+38 --[[FLT_MAX]], "X/Y = %.0f px") ImGui.SameLine() scroll_to_pos = ImGui.Button("Scroll To Pos") or scroll_to_pos ImGui.PopItemWidth() @@ -23247,9 +23281,9 @@ local function DemoWindowLayout_Scrolling() ImGui.BeginGroup() ImGui.TextUnformatted(vnames[i + 1]) - local child_flags = SL.enable_extra_decorations and ImGuiWindowFlags.MenuBar or 0 + local child_flags = SL.enable_extra_decorations and 1024 --[[ImGuiWindowFlags.MenuBar]] or 0 local child_id = ImGui.GetID(i) - local child_is_visible = BeginChild(child_id, ImVec2(child_w, 200.0), ImGuiChildFlags.Borders, child_flags) + local child_is_visible = BeginChild(child_id, ImVec2(child_w, 200.0), 1 --[[ImGuiChildFlags.Borders]], child_flags) if ImGui.BeginMenuBar() then ImGui.TextUnformatted("abc") ImGui.EndMenuBar() @@ -23290,9 +23324,9 @@ local function DemoWindowLayout_Scrolling() local hnames = { "Left", "25%", "Center", "75%", "Right" } for i = 0, 4 do local child_height = ImGui.GetTextLineHeight() + style.ScrollbarSize + style.WindowPadding.y * 2.0 - local child_flags = bit32.bor(ImGuiWindowFlags.HorizontalScrollbar, SL.enable_extra_decorations and ImGuiWindowFlags.AlwaysVerticalScrollbar or 0) + local child_flags = bit32.bor(2048 --[[ImGuiWindowFlags.HorizontalScrollbar]], SL.enable_extra_decorations and 16384 --[[ImGuiWindowFlags.AlwaysVerticalScrollbar]] or 0) local child_id = ImGui.GetID(i) - local child_is_visible = BeginChild(child_id, ImVec2(-100, child_height), ImGuiChildFlags.Borders, child_flags) + local child_is_visible = BeginChild(child_id, ImVec2(-100, child_height), 1 --[[ImGuiChildFlags.Borders]], child_flags) if scroll_to_off then ImGui.SetScrollX(SL.scroll_to_off_px) end @@ -23327,10 +23361,10 @@ local function DemoWindowLayout_Scrolling() "Horizontal scrolling for a window is enabled via the ImGuiWindowFlags_HorizontalScrollbar flag.\n\n" .. "You may want to also explicitly specify content width by using SetNextWindowContentWidth() before Begin().") SL.lines = ImGui.SliderInt("Lines", SL.lines, 1, 15) - ImGui.PushStyleVar(ImGuiStyleVar.FrameRounding, 3.0) - ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, ImVec2(2.0, 1.0)) + ImGui.PushStyleVar(12 --[[ImGuiStyleVar.FrameRounding]], 3.0) + ImGui.PushStyleVar(11 --[[ImGuiStyleVar.FramePadding]], ImVec2(2.0, 1.0)) local scrolling_child_size = ImVec2(0, ImGui.GetFrameHeightWithSpacing() * 7 + 30) - BeginChild("scrolling", scrolling_child_size, ImGuiChildFlags.Borders, ImGuiWindowFlags.HorizontalScrollbar) + BeginChild("scrolling", scrolling_child_size, 1 --[[ImGuiChildFlags.Borders]], 2048 --[[ImGuiWindowFlags.HorizontalScrollbar]]) for line = 0, SL.lines - 1 do -- Display random stuff. For the sake of this trivial demo we are using basic Button() + SameLine() -- If you want to create your own time line for a real application you may be better off manipulating @@ -23343,9 +23377,9 @@ local function DemoWindowLayout_Scrolling() ImGui.PushID(n + line * 1000) local label = (n % 15 == 0) and "FizzBuzz" or (n % 3 == 0) and "Fizz" or (n % 5 == 0) and "Buzz" or tostring(n) local hue = n * 0.05 - ImGui.PushStyleColor(ImGuiCol.Button, HSV(hue, 0.6, 0.6)) - ImGui.PushStyleColor(ImGuiCol.ButtonHovered, HSV(hue, 0.7, 0.7)) - ImGui.PushStyleColor(ImGuiCol.ButtonActive, HSV(hue, 0.8, 0.8)) + ImGui.PushStyleColor(22 --[[ImGuiCol.Button]], HSV(hue, 0.6, 0.6)) + ImGui.PushStyleColor(23 --[[ImGuiCol.ButtonHovered]], HSV(hue, 0.7, 0.7)) + ImGui.PushStyleColor(24 --[[ImGuiCol.ButtonActive]], HSV(hue, 0.8, 0.8)) ImGui.Button(label, ImVec2(base_w + math.sin(line + n) * base_w * 0.5, 0.0)) ImGui.PopStyleColor(3) ImGui.PopID() @@ -23410,7 +23444,7 @@ local function DemoWindowLayout_TextClipping() ImGui.PushID(n) ImGui.InvisibleButton("##canvas", size) - if ImGui.IsItemActive() and ImGui.IsMouseDragging(ImGuiMouseButton.Left) then + if ImGui.IsItemActive() and ImGui.IsMouseDragging(0 --[[ImGuiMouseButton.Left]]) then offset.x = offset.x + ImGui.GetIO().MouseDelta.x offset.y = offset.y + ImGui.GetIO().MouseDelta.y end @@ -23427,17 +23461,17 @@ local function DemoWindowLayout_TextClipping() if n == 0 then ImGui.PushClipRect(p0, p1, true) draw_list:AddRectFilled(p0, p1, IM_COL32(90, 90, 120, 255)) - draw_list:AddText(text_pos, IM_COL32_WHITE, text_str) + draw_list:AddText(text_pos, 4294967295 --[[IM_COL32_WHITE]], text_str) ImGui.PopClipRect() elseif n == 1 then draw_list:PushClipRect(p0, p1, true) draw_list:AddRectFilled(p0, p1, IM_COL32(90, 90, 120, 255)) - draw_list:AddText(text_pos, IM_COL32_WHITE, text_str) + draw_list:AddText(text_pos, 4294967295 --[[IM_COL32_WHITE]], text_str) draw_list:PopClipRect() else local clip_rect = ImVec4(p0.x, p0.y, p1.x, p1.y) -- AddText() takes a ImVec4 here so let's convert. draw_list:AddRectFilled(p0, p1, IM_COL32(90, 90, 120, 255)) - draw_list:AddText(ImGui.GetFont(), ImGui.GetFontSize(), text_pos, IM_COL32_WHITE, text_str, 1, #text_str + 1, 0.0, clip_rect) + draw_list:AddText(ImGui.GetFont(), ImGui.GetFontSize(), text_pos, 4294967295 --[[IM_COL32_WHITE]], text_str, 1, #text_str + 1, 0.0, clip_rect) end until true end end @@ -23564,7 +23598,7 @@ local function DemoWindowPopups_Popups() if ImGui.Button("With a menu..") then ImGui.OpenPopup("my_file_popup") end - if ImGui.BeginPopup("my_file_popup", ImGuiWindowFlags.MenuBar) then + if ImGui.BeginPopup("my_file_popup", 1024 --[[ImGuiWindowFlags.MenuBar]]) then if ImGui.BeginMenuBar() then if ImGui.BeginMenu("File") then DemoMenuFile() @@ -23627,7 +23661,7 @@ local function DemoWindowPopups_ContextMenus() if ImGui.BeginPopupContextItem("my popup") then if ImGui.Selectable("Set to zero") then SP.value = 0.0 end if ImGui.Selectable("Set to PI") then SP.value = 3.1415 end - ImGui.SetNextItemWidth(-FLT_MIN) + ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) SP.value = ImGui.DragFloat("##Value", SP.value, 0.1, 0.0, 0.0) ImGui.EndPopup() end @@ -23636,7 +23670,7 @@ local function DemoWindowPopups_ContextMenus() -- Here we make it that right-clicking this other text element opens the same popup as above. -- The popup itself will be submitted by the code above. ImGui.Text("(2) Or right-click this text") - ImGui.OpenPopupOnItemClick("my popup", ImGuiPopupFlags.MouseButtonRight) + ImGui.OpenPopupOnItemClick("my popup", 8 --[[ImGuiPopupFlags.MouseButtonRight]]) -- Back to square one: manually open the same popup. if ImGui.Button("(3) Or click this button") then @@ -23675,16 +23709,16 @@ local function DemoWindowPopups_Modals() -- Always center this window when appearing local center = ImGui.GetMainViewport():GetCenter() - ImGui.SetNextWindowPos(center, ImGuiCond.Appearing, ImVec2(0.5, 0.5)) + ImGui.SetNextWindowPos(center, 8 --[[ImGuiCond.Appearing]], ImVec2(0.5, 0.5)) - if ImGui.BeginPopupModal("Delete?", nil, ImGuiWindowFlags.AlwaysAutoResize) then + if ImGui.BeginPopupModal("Delete?", nil, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) then ImGui.Text("All those beautiful files will be deleted.\nThis operation cannot be undone!") ImGui.Separator() -- local unused_i = 0 -- unused_i = ImGui.Combo("Combo", unused_i, "Delete\0Delete harder\0") - ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, ImVec2(0, 0)) + ImGui.PushStyleVar(11 --[[ImGuiStyleVar.FramePadding]], ImVec2(0, 0)) _, SP.dont_ask_me_next_time = ImGui.Checkbox("Don't ask me next time", SP.dont_ask_me_next_time) ImGui.PopStyleVar() @@ -23698,7 +23732,7 @@ local function DemoWindowPopups_Modals() if ImGui.Button("Stacked modals..") then ImGui.OpenPopup("Stacked 1") end - if ImGui.BeginPopupModal("Stacked 1", nil, ImGuiWindowFlags.MenuBar) then + if ImGui.BeginPopupModal("Stacked 1", nil, 1024 --[[ImGuiWindowFlags.MenuBar]]) then if ImGui.BeginMenuBar() then if ImGui.BeginMenu("File") then if ImGui.MenuItem("Some menu item") then end @@ -23818,12 +23852,12 @@ local function MyItem_SortWithSortSpecs(sort_specs, items, items_count) elseif uid == MyItemColumnID_Name then delta = (a.Name < b.Name) and -1 or (a.Name > b.Name) and 1 or 0 elseif uid == MyItemColumnID_Quantity then delta = a.Quantity - b.Quantity elseif uid == MyItemColumnID_Description then delta = (a.Name < b.Name) and -1 or (a.Name > b.Name) and 1 or 0 - else IM_ASSERT(false) end + else assert(false) end if delta > 0 then - return (sort_spec.SortDirection == ImGuiSortDirection.Ascending) and 1 or -1 + return (sort_spec.SortDirection == 1 --[[ImGuiSortDirection.Ascending]]) and 1 or -1 end if delta < 0 then - return (sort_spec.SortDirection == ImGuiSortDirection.Ascending) and -1 or 1 + return (sort_spec.SortDirection == 1 --[[ImGuiSortDirection.Ascending]]) and -1 or 1 end end @@ -23847,8 +23881,8 @@ end -- Make the UI compact because there are so many fields local function PushStyleCompact() local style = ImGui.GetStyle() - ImGui.PushStyleVarY(ImGuiStyleVar.FramePadding, math.floor(style.FramePadding.y * 0.60)) - ImGui.PushStyleVarY(ImGuiStyleVar.ItemSpacing, math.floor(style.ItemSpacing.y * 0.60)) + ImGui.PushStyleVarY(11 --[[ImGuiStyleVar.FramePadding]], math.floor(style.FramePadding.y * 0.60)) + ImGui.PushStyleVarY(14 --[[ImGuiStyleVar.ItemSpacing]], math.floor(style.ItemSpacing.y * 0.60)) end local function PopStyleCompact() @@ -23860,24 +23894,24 @@ local table_sizing_policies = nil local function EditTableSizingFlags(flags) if table_sizing_policies == nil then table_sizing_policies = { - { Value = ImGuiTableFlags.None, Name = "Default", Tooltip = "Use default sizing policy:\n- ImGuiTableFlags_SizingFixedFit if ScrollX is on or if host window has ImGuiWindowFlags_AlwaysAutoResize.\n- ImGuiTableFlags_SizingStretchSame otherwise." }, - { Value = ImGuiTableFlags.SizingFixedFit, Name = "ImGuiTableFlags_SizingFixedFit", Tooltip = "Columns default to _WidthFixed (if resizable) or _WidthAuto (if not resizable), matching contents width." }, - { Value = ImGuiTableFlags.SizingFixedSame, Name = "ImGuiTableFlags_SizingFixedSame", Tooltip = "Columns are all the same width, matching the maximum contents width.\nImplicitly disable ImGuiTableFlags_Resizable and enable ImGuiTableFlags_NoKeepColumnsVisible." }, - { Value = ImGuiTableFlags.SizingStretchProp, Name = "ImGuiTableFlags_SizingStretchProp", Tooltip = "Columns default to _WidthStretch with weights proportional to their widths." }, - { Value = ImGuiTableFlags.SizingStretchSame, Name = "ImGuiTableFlags_SizingStretchSame", Tooltip = "Columns default to _WidthStretch with same weights." }, + { Value = 0 --[[ImGuiTableFlags.None]], Name = "Default", Tooltip = "Use default sizing policy:\n- ImGuiTableFlags_SizingFixedFit if ScrollX is on or if host window has ImGuiWindowFlags_AlwaysAutoResize.\n- ImGuiTableFlags_SizingStretchSame otherwise." }, + { Value = 8192 --[[ImGuiTableFlags.SizingFixedFit]], Name = "ImGuiTableFlags_SizingFixedFit", Tooltip = "Columns default to _WidthFixed (if resizable) or _WidthAuto (if not resizable), matching contents width." }, + { Value = 16384 --[[ImGuiTableFlags.SizingFixedSame]], Name = "ImGuiTableFlags_SizingFixedSame", Tooltip = "Columns are all the same width, matching the maximum contents width.\nImplicitly disable ImGuiTableFlags_Resizable and enable ImGuiTableFlags_NoKeepColumnsVisible." }, + { Value = 24576 --[[ImGuiTableFlags.SizingStretchProp]], Name = "ImGuiTableFlags_SizingStretchProp", Tooltip = "Columns default to _WidthStretch with weights proportional to their widths." }, + { Value = 32768 --[[ImGuiTableFlags.SizingStretchSame]], Name = "ImGuiTableFlags_SizingStretchSame", Tooltip = "Columns default to _WidthStretch with same weights." }, } end local policies = table_sizing_policies local idx = 1 while idx <= #policies do - if policies[idx].Value == bit32.band(flags, ImGuiTableFlags.SizingMask_) then break end + if policies[idx].Value == bit32.band(flags, 57344 --[[ImGuiTableFlags.SizingMask_]]) then break end idx = idx + 1 end local preview_text = (idx <= #policies) and (idx > 1 and string.sub(policies[idx].Name, #"ImGuiTableFlags" + 1) or policies[idx].Name) or "" if ImGui.BeginCombo("Sizing Policy", preview_text) then for n = 1, #policies do if ImGui.Selectable(policies[n].Name, idx == n) then - flags = bit32.bor(bit32.band(flags, bit32.bnot(ImGuiTableFlags.SizingMask_)), policies[n].Value) + flags = bit32.bor(bit32.band(flags, bit32.bnot(57344 --[[ImGuiTableFlags.SizingMask_]])), policies[n].Value) end end ImGui.EndCombo() @@ -23927,10 +23961,10 @@ local function EditTableColumnsFlags(f) end local function ShowTableColumnsStatusFlags(flags) - ImGui.CheckboxFlags("_IsEnabled", flags, ImGuiTableColumnFlags.IsEnabled) - ImGui.CheckboxFlags("_IsVisible", flags, ImGuiTableColumnFlags.IsVisible) - ImGui.CheckboxFlags("_IsSorted", flags, ImGuiTableColumnFlags.IsSorted) - ImGui.CheckboxFlags("_IsHovered", flags, ImGuiTableColumnFlags.IsHovered) + ImGui.CheckboxFlags("_IsEnabled", flags, 16777216 --[[ImGuiTableColumnFlags.IsEnabled]]) + ImGui.CheckboxFlags("_IsVisible", flags, 33554432 --[[ImGuiTableColumnFlags.IsVisible]]) + ImGui.CheckboxFlags("_IsSorted", flags, 67108864 --[[ImGuiTableColumnFlags.IsSorted]]) + ImGui.CheckboxFlags("_IsHovered", flags, 134217728 --[[ImGuiTableColumnFlags.IsHovered]]) end local function bor(...) return bit32.bor(...) end @@ -24045,7 +24079,7 @@ local function Tables_BordersBackground() if s.contents_type == CT_Text then ImGui.TextUnformatted(buf) elseif s.contents_type == CT_FillButton then - ImGui.Button(buf, ImVec2(-FLT_MIN, 0.0)) + ImGui.Button(buf, ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], 0.0)) end end end @@ -24242,7 +24276,7 @@ local function Tables_Padding() ImGui.Text("Avail %.2f", ImGui.GetContentRegionAvail().x) else local buf = string.format("Hello %d,%d", column, row) - ImGui.Button(buf, ImVec2(-FLT_MIN, 0.0)) + ImGui.Button(buf, ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], 0.0)) end -- if bit32.band(ImGui.TableGetColumnFlags(), ImGuiTableColumnFlags.IsHovered) ~= 0 then -- ImGui.TableSetBgColor(ImGuiTableBgTarget.CellBg, IM_COL32(0, 100, 0, 255)) @@ -24268,17 +24302,17 @@ local function Tables_Padding() ImGui.SliderFloat2("CellPadding", s.cell_padding, 0.0, 10.0, "%.0f") PopStyleCompact() - ImGui.PushStyleVar(ImGuiStyleVar.CellPadding, s.cell_padding) + ImGui.PushStyleVar(17 --[[ImGuiStyleVar.CellPadding]], s.cell_padding) if ImGui.BeginTable("table_padding_2", 3, s.flags2) then if not s.show_widget_frame_bg then - ImGui.PushStyleColor(ImGuiCol.FrameBg, 0) + ImGui.PushStyleColor(7 --[[ImGuiCol.FrameBg]], 0) end for cell = 0, 3 * 5 - 1 do ImGui.TableNextColumn() if s.init then s.text_bufs[cell + 1] = Buf("edit me", 16) end - ImGui.SetNextItemWidth(-FLT_MIN) + ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) ImGui.PushID(cell) ImGui.InputText("##cell", s.text_bufs[cell + 1], 16) ImGui.PopID() @@ -24359,7 +24393,7 @@ local function Tables_SizingPolicies() "Be mindful that using right-alignment (e.g. size.x = -FLT_MIN) creates a feedback loop " .. "where contents width can feed into auto-column width can feed into contents width.") end - s.column_count = ImGui.DragInt("Columns", s.column_count, 0.1, 1, 64, "%d", ImGuiSliderFlags.AlwaysClamp) + s.column_count = ImGui.DragInt("Columns", s.column_count, 0.1, 1, 64, "%d", 1536 --[[ImGuiSliderFlags.AlwaysClamp]]) _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_Resizable", s.flags, TF.Resizable) _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_PreciseWidths", s.flags, TF.PreciseWidths) ImGui.SameLine(); DemoHelpMarker("Disable distributing remainder width to stretched columns (width allocation on a 100-wide table with 3 columns: Without this flag: 33,33,34. With this flag: 33,33,33). With larger number of columns, resizing will appear to be less smooth.") @@ -24383,8 +24417,8 @@ local function Tables_SizingPolicies() elseif ct == CT_LongText then ImGui.Text("Some %s text %d,%d\nOver two lines..", column == 0 and "long" or "longeeer", column, row) elseif ct == CT_ShowWidth then ImGui.Text("W: %.1f", ImGui.GetContentRegionAvail().x) elseif ct == CT_Button then ImGui.Button(label) - elseif ct == CT_FillButton then ImGui.Button(label, ImVec2(-FLT_MIN, 0.0)) - elseif ct == CT_InputText then ImGui.SetNextItemWidth(-FLT_MIN); ImGui.InputText("##", s.text_buf, 32) + elseif ct == CT_FillButton then ImGui.Button(label, ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], 0.0)) + elseif ct == CT_InputText then ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]); ImGui.InputText("##", s.text_buf, 32) end ImGui.PopID() end @@ -24409,9 +24443,9 @@ local function Tables_VerticalScrolling() local outer_size = ImVec2(0.0, TEXT_BASE_HEIGHT * 8) if ImGui.BeginTable("table_scrolly", 3, s.flags, outer_size) then ImGui.TableSetupScrollFreeze(0, 1) -- Make top row always visible - ImGui.TableSetupColumn("One", ImGuiTableColumnFlags.None) - ImGui.TableSetupColumn("Two", ImGuiTableColumnFlags.None) - ImGui.TableSetupColumn("Three", ImGuiTableColumnFlags.None) + ImGui.TableSetupColumn("One", 0 --[[ImGuiTableColumnFlags.None]]) + ImGui.TableSetupColumn("Two", 0 --[[ImGuiTableColumnFlags.None]]) + ImGui.TableSetupColumn("Three", 0 --[[ImGuiTableColumnFlags.None]]) ImGui.TableHeadersRow() -- Demonstrate using clipper for large vertical lists @@ -24451,9 +24485,9 @@ local function Tables_HorizontalScrolling() _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_ScrollX", s.flags, TF.ScrollX) _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_ScrollY", s.flags, TF.ScrollY) ImGui.SetNextItemWidth(ImGui.GetFrameHeight()) - s.freeze_cols = ImGui.DragInt("freeze_cols", s.freeze_cols, 0.2, 0, 9, nil, ImGuiSliderFlags.NoInput) + s.freeze_cols = ImGui.DragInt("freeze_cols", s.freeze_cols, 0.2, 0, 9, nil, 128 --[[ImGuiSliderFlags.NoInput]]) ImGui.SetNextItemWidth(ImGui.GetFrameHeight()) - s.freeze_rows = ImGui.DragInt("freeze_rows", s.freeze_rows, 0.2, 0, 9, nil, ImGuiSliderFlags.NoInput) + s.freeze_rows = ImGui.DragInt("freeze_rows", s.freeze_rows, 0.2, 0, 9, nil, 128 --[[ImGuiSliderFlags.NoInput]]) PopStyleCompact() -- When using ScrollX or ScrollY we need to specify a size for our table container! @@ -24461,7 +24495,7 @@ local function Tables_HorizontalScrolling() local outer_size = ImVec2(0.0, TEXT_BASE_HEIGHT * 8) if ImGui.BeginTable("table_scrollx", 7, s.flags, outer_size) then ImGui.TableSetupScrollFreeze(s.freeze_cols, s.freeze_rows) - ImGui.TableSetupColumn("Line #", ImGuiTableColumnFlags.NoHide) -- Make the first column not hideable to match our use of TableSetupScrollFreeze() + ImGui.TableSetupColumn("Line #", 128 --[[ImGuiTableColumnFlags.NoHide]]) -- Make the first column not hideable to match our use of TableSetupScrollFreeze() ImGui.TableSetupColumn("One") ImGui.TableSetupColumn("Two") ImGui.TableSetupColumn("Three") @@ -24503,7 +24537,7 @@ local function Tables_HorizontalScrolling() ImGui.PushID("flags3") ImGui.PushItemWidth(TEXT_BASE_WIDTH * 30) _, s.flags2 = ImGui.CheckboxFlags("ImGuiTableFlags_ScrollX", s.flags2, TF.ScrollX) - s.inner_width = ImGui.DragFloat("inner_width", s.inner_width, 1.0, 0.0, FLT_MAX, "%.1f") + s.inner_width = ImGui.DragFloat("inner_width", s.inner_width, 1.0, 0.0, 3.4028234663853e+38 --[[FLT_MAX]], "%.1f") ImGui.PopItemWidth() ImGui.PopID() PopStyleCompact() @@ -24523,11 +24557,11 @@ local function Tables_ColumnsFlags() local column_names = { "One", "Two", "Three" } local s = ST.colflags if s == nil then - s = { column_flags = { ImGuiTableColumnFlags.DefaultSort, ImGuiTableColumnFlags.None, ImGuiTableColumnFlags.DefaultHide }, column_flags_out = { 0, 0, 0 } } -- column_flags_out: Output from TableGetColumnFlags() + s = { column_flags = { 4 --[[ImGuiTableColumnFlags.DefaultSort]], 0 --[[ImGuiTableColumnFlags.None]], 2 --[[ImGuiTableColumnFlags.DefaultHide]] }, column_flags_out = { 0, 0, 0 } } -- column_flags_out: Output from TableGetColumnFlags() ST.colflags = s end - if ImGui.BeginTable("table_columns_flags_checkboxes", column_count, ImGuiTableFlags.None) then + if ImGui.BeginTable("table_columns_flags_checkboxes", column_count, 0 --[[ImGuiTableFlags.None]]) then PushStyleCompact() for column = 1, column_count do ImGui.TableNextColumn() @@ -24557,7 +24591,7 @@ local function Tables_ColumnsFlags() if ImGui.BeginTable("table_columns_flags", column_count, flags, outer_size) then local has_angled_header = false for column = 1, column_count do - has_angled_header = has_angled_header or Has(s.column_flags[column], ImGuiTableColumnFlags.AngledHeader) + has_angled_header = has_angled_header or Has(s.column_flags[column], 262144 --[[ImGuiTableColumnFlags.AngledHeader]]) ImGui.TableSetupColumn(column_names[column], s.column_flags[column]) end if has_angled_header then @@ -24663,12 +24697,12 @@ local function Tables_Nested() ImGui.TableSetupColumn("B1") ImGui.TableHeadersRow() - ImGui.TableNextRow(ImGuiTableRowFlags.None, rows_height) + ImGui.TableNextRow(0 --[[ImGuiTableRowFlags.None]], rows_height) ImGui.TableNextColumn() ImGui.Text("B0 Row 0") ImGui.TableNextColumn() ImGui.Text("B1 Row 0") - ImGui.TableNextRow(ImGuiTableRowFlags.None, rows_height) + ImGui.TableNextRow(0 --[[ImGuiTableRowFlags.None]], rows_height) ImGui.TableNextColumn() ImGui.Text("B0 Row 1") ImGui.TableNextColumn() @@ -24693,7 +24727,7 @@ local function Tables_RowHeight() if ImGui.BeginTable("table_row_height", 1, TF.Borders) then for row = 0, 7 do local min_row_height = math.floor(TEXT_BASE_HEIGHT * 0.30 * row + ImGui.GetStyle().CellPadding.y * 2.0) - ImGui.TableNextRow(ImGuiTableRowFlags.None, min_row_height) + ImGui.TableNextRow(0 --[[ImGuiTableRowFlags.None]], min_row_height) ImGui.TableNextColumn() ImGui.Text("min_row_height = %.2f", min_row_height) end @@ -24707,14 +24741,14 @@ local function Tables_RowHeight() if ImGui.BeginTable("table_share_lineheight", 2, TF.Borders) then ImGui.TableNextRow() ImGui.TableNextColumn() - ImGui.ColorButton("##1", ImVec4(0.13, 0.26, 0.40, 1.0), ImGuiColorEditFlags.None, ImVec2(40, 40)) + ImGui.ColorButton("##1", ImVec4(0.13, 0.26, 0.40, 1.0), 0 --[[ImGuiColorEditFlags.None]], ImVec2(40, 40)) ImGui.TableNextColumn() ImGui.Text("Line 1") ImGui.Text("Line 2") ImGui.TableNextRow() ImGui.TableNextColumn() - ImGui.ColorButton("##2", ImVec4(0.13, 0.26, 0.40, 1.0), ImGuiColorEditFlags.None, ImVec2(40, 40)) + ImGui.ColorButton("##2", ImVec4(0.13, 0.26, 0.40, 1.0), 0 --[[ImGuiColorEditFlags.None]], ImVec2(40, 40)) ImGui.TableNextColumn() ImGui.SameLine(0.0, 0.0) -- Reuse line height from previous column ImGui.Text("Line 1, with SameLine(0,0)") @@ -24728,9 +24762,9 @@ local function Tables_RowHeight() local style = ImGui.GetStyle() for row = 0, 7 do if (row % 3) == 2 then - ImGui.PushStyleVarY(ImGuiStyleVar.CellPadding, 20.0) + ImGui.PushStyleVarY(17 --[[ImGuiStyleVar.CellPadding]], 20.0) end - ImGui.TableNextRow(ImGuiTableRowFlags.None) + ImGui.TableNextRow(0 --[[ImGuiTableRowFlags.None]]) ImGui.TableNextColumn() ImGui.Text("CellPadding.y = %.2f", style.CellPadding.y) if (row % 3) == 2 then @@ -24812,9 +24846,9 @@ local function Tables_BackgroundColor() else NotPorted("Combo") end - IM_ASSERT(s.row_bg_type >= 0 and s.row_bg_type <= 2) - IM_ASSERT(s.row_bg_target >= 0 and s.row_bg_target <= 1) - IM_ASSERT(s.cell_bg_type >= 0 and s.cell_bg_type <= 1) + assert(s.row_bg_type >= 0 and s.row_bg_type <= 2) + assert(s.row_bg_target >= 0 and s.row_bg_target <= 1) + assert(s.cell_bg_type >= 0 and s.cell_bg_type <= 1) PopStyleCompact() if ImGui.BeginTable("table1", 5, s.flags) then @@ -24825,7 +24859,7 @@ local function Tables_BackgroundColor() -- We use a transparent color so we can see the one behind in case our target is RowBg1 and RowBg0 was already targeted by the ImGuiTableFlags_RowBg flag. if s.row_bg_type ~= 0 then local row_bg_color = ImGui.GetColorU32(s.row_bg_type == 1 and ImVec4(0.7, 0.3, 0.3, 0.65) or ImVec4(0.2 + row * 0.1, 0.2, 0.2, 0.65)) -- Flat or Gradient? - ImGui.TableSetBgColor(ImGuiTableBgTarget.RowBg0 + s.row_bg_target, row_bg_color) + ImGui.TableSetBgColor(1 --[[ImGuiTableBgTarget.RowBg0]] + s.row_bg_target, row_bg_color) end -- Fill cells @@ -24839,7 +24873,7 @@ local function Tables_BackgroundColor() -- We can also pass a column number as a third parameter to TableSetBgColor() and do this outside the column loop. if row >= 1 and row <= 2 and column >= 1 and column <= 2 and s.cell_bg_type == 1 then local cell_bg_color = ImGui.GetColorU32(ImVec4(0.3, 0.3, 0.7, 0.65)) - ImGui.TableSetBgColor(ImGuiTableBgTarget.CellBg, cell_bg_color) + ImGui.TableSetBgColor(3 --[[ImGuiTableBgTarget.CellBg]], cell_bg_color) end end end @@ -24867,12 +24901,12 @@ local function MyTreeNode_DisplayNode(node, all_nodes, tree_node_flags_base) local node_flags = tree_node_flags_base if node ~= all_nodes[1] then - node_flags = bit32.band(node_flags, bit32.bnot(ImGuiTreeNodeFlags.LabelSpanAllColumns)) -- Only demonstrate this on the root node. + node_flags = bit32.band(node_flags, bit32.bnot(32768 --[[ImGuiTreeNodeFlags.LabelSpanAllColumns]])) -- Only demonstrate this on the root node. end if is_folder then local open = ImGui.TreeNodeEx(node.Name, node_flags) - if bit32.band(node_flags, ImGuiTreeNodeFlags.LabelSpanAllColumns) == 0 then + if bit32.band(node_flags, 32768 --[[ImGuiTreeNodeFlags.LabelSpanAllColumns]]) == 0 then ImGui.TableNextColumn() ImGui.TextDisabled("--") ImGui.TableNextColumn() @@ -24885,7 +24919,7 @@ local function MyTreeNode_DisplayNode(node, all_nodes, tree_node_flags_base) ImGui.TreePop() end else - ImGui.TreeNodeEx(node.Name, bor(node_flags, ImGuiTreeNodeFlags.Leaf, ImGuiTreeNodeFlags.Bullet, ImGuiTreeNodeFlags.NoTreePushOnOpen)) + ImGui.TreeNodeEx(node.Name, bor(node_flags, 256 --[[ImGuiTreeNodeFlags.Leaf]], 512 --[[ImGuiTreeNodeFlags.Bullet]], 8 --[[ImGuiTreeNodeFlags.NoTreePushOnOpen]])) ImGui.TableNextColumn() ImGui.Text("%d", node.Size) ImGui.TableNextColumn() @@ -24898,21 +24932,21 @@ local function Tables_TreeView() local s = ST.treeview if s == nil then s = { table_flags = bor(TF.BordersV, TF.BordersOuterH, TF.Resizable, TF.RowBg, TF.NoBordersInBody), - tree_node_flags_base = bor(ImGuiTreeNodeFlags.SpanAllColumns, ImGuiTreeNodeFlags.DefaultOpen, ImGuiTreeNodeFlags.DrawLinesFull) } + tree_node_flags_base = bor(16384 --[[ImGuiTreeNodeFlags.SpanAllColumns]], 32 --[[ImGuiTreeNodeFlags.DefaultOpen]], 524288 --[[ImGuiTreeNodeFlags.DrawLinesFull]]) } ST.treeview = s end - _, s.tree_node_flags_base = ImGui.CheckboxFlags("ImGuiTreeNodeFlags_SpanFullWidth", s.tree_node_flags_base, ImGuiTreeNodeFlags.SpanFullWidth) - _, s.tree_node_flags_base = ImGui.CheckboxFlags("ImGuiTreeNodeFlags_SpanLabelWidth", s.tree_node_flags_base, ImGuiTreeNodeFlags.SpanLabelWidth) - _, s.tree_node_flags_base = ImGui.CheckboxFlags("ImGuiTreeNodeFlags_SpanAllColumns", s.tree_node_flags_base, ImGuiTreeNodeFlags.SpanAllColumns) - _, s.tree_node_flags_base = ImGui.CheckboxFlags("ImGuiTreeNodeFlags_LabelSpanAllColumns", s.tree_node_flags_base, ImGuiTreeNodeFlags.LabelSpanAllColumns) + _, s.tree_node_flags_base = ImGui.CheckboxFlags("ImGuiTreeNodeFlags_SpanFullWidth", s.tree_node_flags_base, 4096 --[[ImGuiTreeNodeFlags.SpanFullWidth]]) + _, s.tree_node_flags_base = ImGui.CheckboxFlags("ImGuiTreeNodeFlags_SpanLabelWidth", s.tree_node_flags_base, 8192 --[[ImGuiTreeNodeFlags.SpanLabelWidth]]) + _, s.tree_node_flags_base = ImGui.CheckboxFlags("ImGuiTreeNodeFlags_SpanAllColumns", s.tree_node_flags_base, 16384 --[[ImGuiTreeNodeFlags.SpanAllColumns]]) + _, s.tree_node_flags_base = ImGui.CheckboxFlags("ImGuiTreeNodeFlags_LabelSpanAllColumns", s.tree_node_flags_base, 32768 --[[ImGuiTreeNodeFlags.LabelSpanAllColumns]]) ImGui.SameLine(); DemoHelpMarker("Useful if you know that you aren't displaying contents in other columns") DemoHelpMarker("See \"Columns flags\" section to configure how indentation is applied to individual columns.") if ImGui.BeginTable("3ways", 3, s.table_flags) then -- The first column will use the default _WidthStretch when ScrollX is Off and _WidthFixed when ScrollX is On - ImGui.TableSetupColumn("Name", ImGuiTableColumnFlags.NoHide) - ImGui.TableSetupColumn("Size", ImGuiTableColumnFlags.WidthFixed, TEXT_BASE_WIDTH * 12.0) - ImGui.TableSetupColumn("Type", ImGuiTableColumnFlags.WidthFixed, TEXT_BASE_WIDTH * 18.0) + ImGui.TableSetupColumn("Name", 128 --[[ImGuiTableColumnFlags.NoHide]]) + ImGui.TableSetupColumn("Size", 16 --[[ImGuiTableColumnFlags.WidthFixed]], TEXT_BASE_WIDTH * 12.0) + ImGui.TableSetupColumn("Type", 16 --[[ImGuiTableColumnFlags.WidthFixed]], TEXT_BASE_WIDTH * 18.0) ImGui.TableHeadersRow() MyTreeNode_DisplayNode(tree_view_nodes[1], tree_view_nodes, s.tree_node_flags_base) @@ -24942,7 +24976,7 @@ local function Tables_ItemWidth() ImGui.TableSetColumnIndex(1) ImGui.PushItemWidth(-ImGui.GetContentRegionAvail().x * 0.5) ImGui.TableSetColumnIndex(2) - ImGui.PushItemWidth(-FLT_MIN) -- Right-aligned + ImGui.PushItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) -- Right-aligned end -- Draw our contents @@ -24978,12 +25012,12 @@ local function Tables_CustomHeaders() -- - Specify ImGuiTableColumnFlags_NoHeaderLabel in some TableSetupColumn() call. -- - Call TableHeadersRow() normally. This will submit TableHeader() with no name. -- - Then call TableSetColumnIndex() to position yourself in the column and submit your stuff e.g. Checkbox().) - ImGui.TableNextRow(ImGuiTableRowFlags.Headers) + ImGui.TableNextRow(1 --[[ImGuiTableRowFlags.Headers]]) for column = 0, COLUMNS_COUNT - 1 do ImGui.TableSetColumnIndex(column) local column_name = ImGui.TableGetColumnName(column) -- Retrieve name passed to TableSetupColumn() ImGui.PushID(column) - ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, ImVec2(0, 0)) + ImGui.PushStyleVar(11 --[[ImGuiStyleVar.FramePadding]], ImVec2(0, 0)) _, column_selected[column + 1] = ImGui.Checkbox("##checkall", column_selected[column + 1]) ImGui.PopStyleVar() ImGui.SameLine(0.0, ImGui.GetStyle().ItemInnerSpacing.x) @@ -25014,7 +25048,7 @@ local function Tables_AngledHeaders() local s = ST.angled if s == nil then s = { table_flags = bor(TF.SizingFixedFit, TF.ScrollX, TF.ScrollY, TF.BordersOuter, TF.BordersInnerH, TF.Hideable, TF.Resizable, TF.Reorderable, TF.HighlightHoveredColumn), - column_flags = bor(ImGuiTableColumnFlags.AngledHeader, ImGuiTableColumnFlags.WidthFixed), + column_flags = bor(262144 --[[ImGuiTableColumnFlags.AngledHeader]], 16 --[[ImGuiTableColumnFlags.WidthFixed]]), bools = {}, frozen_cols = 1, frozen_rows = 2 } -- bools: Dummy storage selection storage for i = 1, columns_count * rows_count do s.bools[i] = false end ST.angled = s @@ -25029,7 +25063,7 @@ local function Tables_AngledHeaders() s.frozen_cols = ImGui.SliderInt("Frozen columns", s.frozen_cols, 0, 2) ImGui.SetNextItemWidth(ImGui.GetFontSize() * 8) s.frozen_rows = ImGui.SliderInt("Frozen rows", s.frozen_rows, 0, 2) - _, s.column_flags = ImGui.CheckboxFlags("Disable header contributing to column width", s.column_flags, ImGuiTableColumnFlags.NoHeaderWidth) + _, s.column_flags = ImGui.CheckboxFlags("Disable header contributing to column width", s.column_flags, 8192 --[[ImGuiTableColumnFlags.NoHeaderWidth]]) if ImGui.TreeNode("Style settings") then ImGui.SameLine() @@ -25043,7 +25077,7 @@ local function Tables_AngledHeaders() end if ImGui.BeginTable("table_angled_headers", columns_count, s.table_flags, ImVec2(0.0, TEXT_BASE_HEIGHT * 12)) then - ImGui.TableSetupColumn(column_names[1], bor(ImGuiTableColumnFlags.NoHide, ImGuiTableColumnFlags.NoReorder)) + ImGui.TableSetupColumn(column_names[1], bor(128 --[[ImGuiTableColumnFlags.NoHide]], 64 --[[ImGuiTableColumnFlags.NoReorder]])) for n = 2, columns_count do ImGui.TableSetupColumn(column_names[n], s.column_flags) end @@ -25151,7 +25185,7 @@ local function Tables_ContextMenus() local hovered_column = -1 for column = 0, COLUMNS_COUNT do ImGui.PushID(column) - if Has(ImGui.TableGetColumnFlags(column), ImGuiTableColumnFlags.IsHovered) then + if Has(ImGui.TableGetColumnFlags(column), 134217728 --[[ImGuiTableColumnFlags.IsHovered]]) then hovered_column = column end if hovered_column == column and not ImGui.IsAnyItemHovered() and ImGui.IsMouseReleased(1) then @@ -25189,7 +25223,7 @@ local function Tables_SyncedInstances() _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_HighlightHoveredColumn", s.flags, TF.HighlightHoveredColumn) for n = 0, 2 do local buf = string.format("Synced Table %d", n) - local open = ImGui.CollapsingHeader(buf, ImGuiTreeNodeFlags.DefaultOpen) + local open = ImGui.CollapsingHeader(buf, 32 --[[ImGuiTreeNodeFlags.DefaultOpen]]) if open and ImGui.BeginTable("Table", 3, s.flags, ImVec2(0.0, ImGui.GetTextLineHeightWithSpacing() * 5)) then ImGui.TableSetupColumn("One") ImGui.TableSetupColumn("Two") @@ -25288,7 +25322,7 @@ local function Tables_AdvancedOptions(s) PushStyleCompact() ImGui.PushItemWidth(TEXT_BASE_WIDTH * 28.0) - if ImGui.TreeNodeEx("Features:", ImGuiTreeNodeFlags.DefaultOpen) then + if ImGui.TreeNodeEx("Features:", 32 --[[ImGuiTreeNodeFlags.DefaultOpen]]) then _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_Resizable", s.flags, TF.Resizable) _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_Reorderable", s.flags, TF.Reorderable) _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_Hideable", s.flags, TF.Hideable) @@ -25298,7 +25332,7 @@ local function Tables_AdvancedOptions(s) ImGui.TreePop() end - if ImGui.TreeNodeEx("Decorations:", ImGuiTreeNodeFlags.DefaultOpen) then + if ImGui.TreeNodeEx("Decorations:", 32 --[[ImGuiTreeNodeFlags.DefaultOpen]]) then _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_RowBg", s.flags, TF.RowBg) _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_BordersV", s.flags, TF.BordersV) _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_BordersOuterV", s.flags, TF.BordersOuterV) @@ -25311,7 +25345,7 @@ local function Tables_AdvancedOptions(s) ImGui.TreePop() end - if ImGui.TreeNodeEx("Sizing:", ImGuiTreeNodeFlags.DefaultOpen) then + if ImGui.TreeNodeEx("Sizing:", 32 --[[ImGuiTreeNodeFlags.DefaultOpen]]) then s.flags = EditTableSizingFlags(s.flags) ImGui.SameLine(); DemoHelpMarker("In the Advanced demo we override the policy of each column so those table-wide settings have less effect that typical.") _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_NoHostExtendX", s.flags, TF.NoHostExtendX) @@ -25327,26 +25361,26 @@ local function Tables_AdvancedOptions(s) ImGui.TreePop() end - if ImGui.TreeNodeEx("Padding:", ImGuiTreeNodeFlags.DefaultOpen) then + if ImGui.TreeNodeEx("Padding:", 32 --[[ImGuiTreeNodeFlags.DefaultOpen]]) then _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_PadOuterX", s.flags, TF.PadOuterX) _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_NoPadOuterX", s.flags, TF.NoPadOuterX) _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_NoPadInnerX", s.flags, TF.NoPadInnerX) ImGui.TreePop() end - if ImGui.TreeNodeEx("Scrolling:", ImGuiTreeNodeFlags.DefaultOpen) then + if ImGui.TreeNodeEx("Scrolling:", 32 --[[ImGuiTreeNodeFlags.DefaultOpen]]) then _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_ScrollX", s.flags, TF.ScrollX) ImGui.SameLine() ImGui.SetNextItemWidth(ImGui.GetFrameHeight()) - s.freeze_cols = ImGui.DragInt("freeze_cols", s.freeze_cols, 0.2, 0, 9, nil, ImGuiSliderFlags.NoInput) + s.freeze_cols = ImGui.DragInt("freeze_cols", s.freeze_cols, 0.2, 0, 9, nil, 128 --[[ImGuiSliderFlags.NoInput]]) _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_ScrollY", s.flags, TF.ScrollY) ImGui.SameLine() ImGui.SetNextItemWidth(ImGui.GetFrameHeight()) - s.freeze_rows = ImGui.DragInt("freeze_rows", s.freeze_rows, 0.2, 0, 9, nil, ImGuiSliderFlags.NoInput) + s.freeze_rows = ImGui.DragInt("freeze_rows", s.freeze_rows, 0.2, 0, 9, nil, 128 --[[ImGuiSliderFlags.NoInput]]) ImGui.TreePop() end - if ImGui.TreeNodeEx("Sorting:", ImGuiTreeNodeFlags.DefaultOpen) then + if ImGui.TreeNodeEx("Sorting:", 32 --[[ImGuiTreeNodeFlags.DefaultOpen]]) then _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_SortMulti", s.flags, TF.SortMulti) ImGui.SameLine(); DemoHelpMarker("When sorting is enabled: hold shift when clicking headers to sort on multiple column. TableGetSortSpecs() may return specs where (SpecsCount > 1).") _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_SortTristate", s.flags, TF.SortTristate) @@ -25354,15 +25388,15 @@ local function Tables_AdvancedOptions(s) ImGui.TreePop() end - if ImGui.TreeNodeEx("Headers:", ImGuiTreeNodeFlags.DefaultOpen) then + if ImGui.TreeNodeEx("Headers:", 32 --[[ImGuiTreeNodeFlags.DefaultOpen]]) then _, s.show_headers = ImGui.Checkbox("show_headers", s.show_headers) _, s.flags = ImGui.CheckboxFlags("ImGuiTableFlags_HighlightHoveredColumn", s.flags, TF.HighlightHoveredColumn) - _, s.columns_base_flags = ImGui.CheckboxFlags("ImGuiTableColumnFlags_AngledHeader", s.columns_base_flags, ImGuiTableColumnFlags.AngledHeader) + _, s.columns_base_flags = ImGui.CheckboxFlags("ImGuiTableColumnFlags_AngledHeader", s.columns_base_flags, 262144 --[[ImGuiTableColumnFlags.AngledHeader]]) ImGui.SameLine(); DemoHelpMarker("Enable AngledHeader on all columns. Best enabled on selected narrow columns (see \"Angled headers\" section of the demo).") ImGui.TreePop() end - if ImGui.TreeNodeEx("Other:", ImGuiTreeNodeFlags.DefaultOpen) then + if ImGui.TreeNodeEx("Other:", 32 --[[ImGuiTreeNodeFlags.DefaultOpen]]) then _, s.show_wrapped_text = ImGui.Checkbox("show_wrapped_text", s.show_wrapped_text) ImGui.DragFloat2("##OuterSize", s.outer_size_value) @@ -25377,9 +25411,9 @@ local function Tables_AdvancedOptions(s) -- From a user point of view we will tend to use 'inner_width' differently depending on whether our table is embedding scrolling. -- To facilitate toying with this demo we will actually pass 0.0f to the BeginTable() when ScrollX is disabled. - s.inner_width_with_scroll = ImGui.DragFloat("inner_width (when ScrollX active)", s.inner_width_with_scroll, 1.0, 0.0, FLT_MAX) + s.inner_width_with_scroll = ImGui.DragFloat("inner_width (when ScrollX active)", s.inner_width_with_scroll, 1.0, 0.0, 3.4028234663853e+38 --[[FLT_MAX]]) - s.row_min_height = ImGui.DragFloat("row_min_height", s.row_min_height, 1.0, 0.0, FLT_MAX) + s.row_min_height = ImGui.DragFloat("row_min_height", s.row_min_height, 1.0, 0.0, 3.4028234663853e+38 --[[FLT_MAX]]) ImGui.SameLine(); DemoHelpMarker("Specify height of the Selectable item.") s.items_count = ImGui.DragInt("items_count", s.items_count, 0.1, 0, 9999) @@ -25406,7 +25440,7 @@ local function Tables_Advanced() local s = ST.advanced if s == nil then s = { flags = bor(TF.Resizable, TF.Reorderable, TF.Hideable, TF.Sortable, TF.SortMulti, TF.RowBg, TF.Borders, TF.NoBordersInBody, TF.ScrollX, TF.ScrollY, TF.SizingFixedFit), - columns_base_flags = ImGuiTableColumnFlags.None, contents_type = CT_SelectableSpanRow, + columns_base_flags = 0 --[[ImGuiTableColumnFlags.None]], contents_type = CT_SelectableSpanRow, freeze_cols = 1, freeze_rows = 1, items_count = #template_items_names * 2, outer_size_value = ImVec2(0.0, TEXT_BASE_HEIGHT * 12), row_min_height = 0.0, inner_width_with_scroll = 0.0, outer_size_enabled = true, show_headers = true, show_wrapped_text = false, @@ -25486,7 +25520,7 @@ local function Tables_Advanced() local item_is_selected = table.find(selection, item.ID) ~= nil ImGui.PushID(item.ID) - ImGui.TableNextRow(ImGuiTableRowFlags.None, s.row_min_height) + ImGui.TableNextRow(0 --[[ImGuiTableRowFlags.None]], s.row_min_height) -- For the demo purpose we can select among different type of items submitted in the first column ImGui.TableSetColumnIndex(0) @@ -25499,9 +25533,9 @@ local function Tables_Advanced() elseif ct == CT_SmallButton then ImGui.SmallButton(label) elseif ct == CT_FillButton then - ImGui.Button(label, ImVec2(-FLT_MIN, 0.0)) + ImGui.Button(label, ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], 0.0)) elseif ct == CT_Selectable or ct == CT_SelectableSpanRow then - local selectable_flags = (ct == CT_SelectableSpanRow) and bor(ImGuiSelectableFlags.SpanAllColumns, ImGuiSelectableFlags.AllowOverlap) or ImGuiSelectableFlags.None + local selectable_flags = (ct == CT_SelectableSpanRow) and bor(2 --[[ImGuiSelectableFlags.SpanAllColumns]], 16 --[[ImGuiSelectableFlags.AllowOverlap]]) or 0 --[[ImGuiSelectableFlags.None]] if ImGui.Selectable(label, item_is_selected, selectable_flags, ImVec2(0, s.row_min_height)) then if ImGui.GetIO().KeyCtrl then if item_is_selected then @@ -25610,7 +25644,7 @@ local function DemoWindowColumns() local paths = { "/path/one", "/path/two", "/path/three" } for i = 0, 2 do local label = string.format("%04d", i) - if ImGui.Selectable(label, DCS.selected == i, ImGuiSelectableFlags.SpanAllColumns) then + if ImGui.Selectable(label, DCS.selected == i, 2 --[[ImGuiSelectableFlags.SpanAllColumns]]) then DCS.selected = i end local hovered = ImGui.IsItemHovered() @@ -25649,7 +25683,7 @@ local function DemoWindowColumns() ImGui.Text("Avail %.2f", ImGui.GetContentRegionAvail().x) ImGui.Text("Offset %.2f", ImGui.GetColumnOffset()) ImGui.Text("Long text that is likely to clip") - ImGui.Button("Button", ImVec2(-FLT_MIN, 0.0)) + ImGui.Button("Button", ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], 0.0)) ImGui.PopID() ImGui.NextColumn() end @@ -25708,7 +25742,7 @@ local function DemoWindowColumns() IMGUI_DEMO_MARKER("Columns (legacy API)/Horizontal Scrolling") ImGui.SetNextWindowContentSize(ImVec2(1500.0, 0.0)) local child_size = ImVec2(0, ImGui.GetFontSize() * 20.0) - ImGui.BeginChild("##ScrollingRegion", child_size, ImGuiChildFlags.None, ImGuiWindowFlags.HorizontalScrollbar) + ImGui.BeginChild("##ScrollingRegion", child_size, 0 --[[ImGuiChildFlags.None]], 2048 --[[ImGuiWindowFlags.HorizontalScrollbar]]) ImGui.Columns(10) -- Also demonstrate using clipper for large vertical lists @@ -25819,7 +25853,7 @@ function DemoWindowTables() ImGui.Separator() local disable_indent = ST.disable_indent if disable_indent then - ImGui.PushStyleVar(ImGuiStyleVar.IndentSpacing, 0.0) + ImGui.PushStyleVar(16 --[[ImGuiStyleVar.IndentSpacing]], 0.0) end -- About Styling of tables @@ -25911,7 +25945,7 @@ local function ConsoleNew() end function c:TextEditCallback(data) --self:AddLog("cursor: %d, selection: %d-%d", data.CursorPos, data.SelectionStart, data.SelectionEnd) - if data.EventFlag == ImGuiInputTextFlags.CallbackCompletion then + if data.EventFlag == 262144 --[[ImGuiInputTextFlags.CallbackCompletion]] then -- Example of TEXT COMPLETION -- Locate beginning of current word (positions are 0-based offsets into data.Buf) @@ -25960,13 +25994,13 @@ local function ConsoleNew() self:AddLog("Possible matches:\n") for i = 1, #candidates do self:AddLog("- %s\n", candidates[i]) end end - elseif data.EventFlag == ImGuiInputTextFlags.CallbackHistory then + elseif data.EventFlag == 524288 --[[ImGuiInputTextFlags.CallbackHistory]] then -- Example of HISTORY local prev_history_pos = self.HistoryPos - if data.EventKey == ImGuiKey.UpArrow then + if data.EventKey == 515 --[[ImGuiKey.UpArrow]] then if self.HistoryPos == -1 then self.HistoryPos = #self.History - 1 elseif self.HistoryPos > 0 then self.HistoryPos = self.HistoryPos - 1 end - elseif data.EventKey == ImGuiKey.DownArrow then + elseif data.EventKey == 516 --[[ImGuiKey.DownArrow]] then if self.HistoryPos ~= -1 then self.HistoryPos = self.HistoryPos + 1 if self.HistoryPos >= #self.History then self.HistoryPos = -1 end @@ -25983,7 +26017,7 @@ local function ConsoleNew() return 0 end function c:Draw(title, p_open) - ImGui.SetNextWindowSize(ImVec2(520, 600), ImGuiCond.FirstUseEver) + ImGui.SetNextWindowSize(ImVec2(520, 600), 4 --[[ImGuiCond.FirstUseEver]]) local visible p_open, visible = ImGui.Begin(title, p_open) if not visible then ImGui.End(); return p_open end @@ -26018,18 +26052,18 @@ local function ConsoleNew() end -- Options, Filter - ImGui.SetNextItemShortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.O), ImGuiInputFlags.Tooltip) + ImGui.SetNextItemShortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 560 --[[ImGuiKey.O]]), 262144 --[[ImGuiInputFlags.Tooltip]]) if ImGui.Button("Options") then ImGui.OpenPopup("Options") end ImGui.SameLine() - ImGui.SetNextItemShortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.F), ImGuiInputFlags.Tooltip) - ImGui.SetNextItemWidth(-FLT_MIN) + ImGui.SetNextItemShortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 551 --[[ImGuiKey.F]]), 262144 --[[ImGuiInputFlags.Tooltip]]) + ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) self.Filter:DrawWithHint("##Filter", "Filter (incl -excl)") ImGui.Separator() -- Reserve enough left-over height for 1 separator + 1 input text local style = ImGui.GetStyle() local footer_height_to_reserve = (style.SeparatorSize or 1.0) + style.ItemSpacing.y + ImGui.GetFrameHeightWithSpacing() - if ImGui.BeginChild("ScrollingRegion", ImVec2(0, -footer_height_to_reserve), ImGuiChildFlags.NavFlattened, ImGuiWindowFlags.HorizontalScrollbar) then + if ImGui.BeginChild("ScrollingRegion", ImVec2(0, -footer_height_to_reserve), 256 --[[ImGuiChildFlags.NavFlattened]], 2048 --[[ImGuiWindowFlags.HorizontalScrollbar]]) then if ImGui.BeginPopupContextWindow() then if ImGui.Selectable("Clear") then self:ClearLog() end ImGui.EndPopup() @@ -26059,7 +26093,7 @@ local function ConsoleNew() -- If your items are of variable height: -- - Split them into same height items would be simpler and facilitate random-seeking into your list. -- - Consider using manual call to IsRectVisible() and skipping extraneous decoration from your items. - ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, ImVec2(4, 1)) -- Tighten spacing + ImGui.PushStyleVar(14 --[[ImGuiStyleVar.ItemSpacing]], ImVec2(4, 1)) -- Tighten spacing if copy_to_clipboard then ImGui.LogToClipboard() end for _, item in ipairs(self.Items) do if self.Filter:PassFilter(item) then @@ -26068,7 +26102,7 @@ local function ConsoleNew() local color if string.find(item, "[error]", 1, true) then color = ImVec4(1.0, 0.4, 0.4, 1.0) elseif string.sub(item, 1, 2) == "# " then color = ImVec4(1.0, 0.8, 0.6, 1.0) end - if color then ImGui.PushStyleColor(ImGuiCol.Text, color) end + if color then ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], color) end ImGui.TextUnformatted(item) if color then ImGui.PopStyleColor() end end @@ -26149,13 +26183,13 @@ local function ExampleAppLog() ImGui.SameLine() local copy = ImGui.Button("Copy") ImGui.SameLine() - ImGui.SetNextItemWidth(-FLT_MIN) + ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) self.Filter:DrawWithHint("##Filter", "Filter (incl -excl)") ImGui.Separator() - if ImGui.BeginChild("scrolling", ImVec2(0, 0), ImGuiChildFlags.None, ImGuiWindowFlags.HorizontalScrollbar) then + if ImGui.BeginChild("scrolling", ImVec2(0, 0), 0 --[[ImGuiChildFlags.None]], 2048 --[[ImGuiWindowFlags.HorizontalScrollbar]]) then if clear then self:Clear() end if copy then ImGui.LogToClipboard() end - ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, ImVec2(0, 0)) + ImGui.PushStyleVar(14 --[[ImGuiStyleVar.ItemSpacing]], ImVec2(0, 0)) local lines = self.Lines if self.Filter:IsActive() then -- In this example we don't use the clipper when Filter is enabled. @@ -26208,7 +26242,7 @@ function ShowExampleAppLog(p_open) -- For the demo: add a debug button _BEFORE_ the normal log window contents -- We take advantage of a rarely used feature: multiple calls to Begin()/End() are appending to the _same_ window. -- Most of the contents of the window will be added by the log:Draw() call. - ImGui.SetNextWindowSize(ImVec2(500, 400), ImGuiCond.FirstUseEver) + ImGui.SetNextWindowSize(ImVec2(500, 400), 4 --[[ImGuiCond.FirstUseEver]]) p_open = ImGui.Begin("Example: Log", p_open) if ImGui.SmallButton("[Debug] Add 5 entries") then local categories = { "info", "warn", "error" } @@ -26233,9 +26267,9 @@ end -- Demonstrate create a window with multiple child windows. local LayoutSelected = 0 function ShowExampleAppLayout(p_open) - ImGui.SetNextWindowSize(ImVec2(500, 440), ImGuiCond.FirstUseEver) + ImGui.SetNextWindowSize(ImVec2(500, 440), 4 --[[ImGuiCond.FirstUseEver]]) local visible - p_open, visible = ImGui.Begin("Example: Simple layout", p_open, ImGuiWindowFlags.MenuBar) + p_open, visible = ImGui.Begin("Example: Simple layout", p_open, 1024 --[[ImGuiWindowFlags.MenuBar]]) if visible then if ImGui.BeginMenuBar() then if ImGui.BeginMenu("File") then @@ -26246,9 +26280,9 @@ function ShowExampleAppLayout(p_open) end -- Left - ImGui.BeginChild("left pane", ImVec2(150, 0), bit32.bor(ImGuiChildFlags.Borders, ImGuiChildFlags.ResizeX)) + ImGui.BeginChild("left pane", ImVec2(150, 0), bit32.bor(1 --[[ImGuiChildFlags.Borders]], 4 --[[ImGuiChildFlags.ResizeX]])) for i = 0, 99 do - if ImGui.Selectable(string.format("MyObject %d", i), LayoutSelected == i, ImGuiSelectableFlags.SelectOnNav) then LayoutSelected = i end + if ImGui.Selectable(string.format("MyObject %d", i), LayoutSelected == i, 64 --[[ImGuiSelectableFlags.SelectOnNav]]) then LayoutSelected = i end end ImGui.EndChild() ImGui.SameLine() @@ -26258,7 +26292,7 @@ function ShowExampleAppLayout(p_open) ImGui.BeginChild("item view", ImVec2(0, -ImGui.GetFrameHeightWithSpacing())) -- Leave room for 1 line below us ImGui.Text("MyObject: %d", LayoutSelected) ImGui.Separator() - if ImGui.BeginTabBar("##Tabs", ImGuiTabBarFlags.None) then + if ImGui.BeginTabBar("##Tabs", 0 --[[ImGuiTabBarFlags.None]]) then if ImGui.BeginTabItem("Description") then ImGui.TextWrapped("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ") ImGui.EndTabItem() @@ -26320,7 +26354,7 @@ function PropEd:DrawTreeNode(node) local tree_flags = bit32.bor(TN.OpenOnArrow, TN.OpenOnDoubleClick, TN.NavLeftJumpsToParent, TN.SpanFullWidth, TN.DrawLinesToNodes) if node == self.SelectedNode then tree_flags = bit32.bor(tree_flags, TN.Selected) end -- Draw selection highlight if #node.Childs == 0 then tree_flags = bit32.bor(tree_flags, TN.Leaf, TN.Bullet, TN.NoTreePushOnOpen) end -- Use _NoTreePushOnOpen + set is_open=false to avoid unnecessarily push/pop on leaves. - if node.DataMyBool == false then ImGui.PushStyleColor(ImGuiCol.Text, ImGui.GetStyle().Colors[ImGuiCol.TextDisabled]) end + if node.DataMyBool == false then ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], ImGui.GetStyle().Colors[1 --[[ImGuiCol.TextDisabled]]]) end ImGui.SetNextItemStorageID(node.UID) -- Use node.UID as storage id local is_open = ImGui.TreeNodeEx(node.UID, tree_flags, "%s", node.Name) if #node.Childs == 0 then is_open = false end @@ -26383,7 +26417,7 @@ end function PropEd:DrawClippedTree(root_node) local node = root_node.Childs[1] -- First node local clipper = ImGuiListClipper() - clipper:Begin(INT_MAX) + clipper:Begin(2147483647 --[[INT_MAX]]) while clipper:Step() do while clipper.UserIndex < clipper.DisplayEnd and node ~= nil do node = self:DrawClippedTreeNodeAndAdvanceToNext(clipper, node) @@ -26406,18 +26440,18 @@ function PropEd:Draw(root_node) -- Left side: draw tree -- - Currently using a table to benefit from RowBg feature -- - Our tree node are all of equal height, facilitating the use of a clipper. - if ImGui.BeginChild("##tree", ImVec2(300, 0), bit32.bor(ImGuiChildFlags.ResizeX, ImGuiChildFlags.Borders, ImGuiChildFlags.NavFlattened)) then - ImGui.PushItemFlag(ImGuiItemFlags.NoNavDefaultFocus, true) + if ImGui.BeginChild("##tree", ImVec2(300, 0), bit32.bor(4 --[[ImGuiChildFlags.ResizeX]], 1 --[[ImGuiChildFlags.Borders]], 256 --[[ImGuiChildFlags.NavFlattened]])) then + ImGui.PushItemFlag(4 --[[ImGuiItemFlags.NoNavDefaultFocus]], true) _, self.UseClipper = ImGui.Checkbox("Use Clipper", self.UseClipper) ImGui.SameLine() ImGui.Text("(%d root nodes)", #root_node.Childs) - ImGui.SetNextItemWidth(-FLT_MIN) - ImGui.SetNextItemShortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.F), ImGuiInputFlags.Tooltip) - if ImGui.InputTextWithHint("##Filter", "incl -excl", self.Filter.InputBuf, 256, ImGuiInputTextFlags.EscapeClearsAll) then + ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) + ImGui.SetNextItemShortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 551 --[[ImGuiKey.F]]), 262144 --[[ImGuiInputFlags.Tooltip]]) + if ImGui.InputTextWithHint("##Filter", "incl -excl", self.Filter.InputBuf, 256, 128 --[[ImGuiInputTextFlags.EscapeClearsAll]]) then self.Filter:Build() end ImGui.PopItemFlag() - if ImGui.BeginTable("##list", 1, ImGuiTableFlags.RowBg) then + if ImGui.BeginTable("##list", 1, 64 --[[ImGuiTableFlags.RowBg]]) then if self.UseClipper then self:DrawClippedTree(root_node) else self:DrawTree(root_node) end ImGui.EndTable() end @@ -26433,11 +26467,11 @@ function PropEd:Draw(root_node) ImGui.Text("%s", node.Name) ImGui.TextDisabled("UID: 0x%08X", node.UID) ImGui.Separator() - if ImGui.BeginTable("##properties", 2, bit32.bor(ImGuiTableFlags.Resizable, ImGuiTableFlags.ScrollY)) then + if ImGui.BeginTable("##properties", 2, bit32.bor(1 --[[ImGuiTableFlags.Resizable]], 33554432 --[[ImGuiTableFlags.ScrollY]])) then -- Push object ID after we entered the table, so table is shared for all objects ImGui.PushID(node.UID) - ImGui.TableSetupColumn("", ImGuiTableColumnFlags.WidthFixed) - ImGui.TableSetupColumn("", ImGuiTableColumnFlags.WidthStretch, 2.0) -- Default twice larger + ImGui.TableSetupColumn("", 16 --[[ImGuiTableColumnFlags.WidthFixed]]) + ImGui.TableSetupColumn("", 8 --[[ImGuiTableColumnFlags.WidthStretch]], 2.0) -- Default twice larger if node.HasData then -- In a typical application, the structure description would be derived from a data-driven system. -- - We try to mimic this with our ExampleMemberInfo structure and the ExampleTreeNodeMemberInfos[] array. @@ -26453,10 +26487,10 @@ function PropEd:Draw(root_node) if field_desc.DataType == DT.Bool then _, node[field_desc.Field] = ImGui.Checkbox("##Editor", node[field_desc.Field]) elseif field_desc.DataType == DT.S32 then - ImGui.SetNextItemWidth(-FLT_MIN) - node[field_desc.Field] = ImGui.DragScalar("##Editor", DT.S32, node[field_desc.Field], 1.0, INT_MIN or -2147483648, INT_MAX) + ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) + node[field_desc.Field] = ImGui.DragScalar("##Editor", DT.S32, node[field_desc.Field], 1.0, (-2147483648) --[[INT_MIN]] or -2147483648, 2147483647 --[[INT_MAX]]) elseif field_desc.DataType == DT.Float then - ImGui.SetNextItemWidth(-FLT_MIN) + ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) ImGui.SliderScalarN("##Editor", DT.Float, node[field_desc.Field], field_desc.DataCount, 0.0, 1.0) elseif field_desc.DataType == DT.String then local b = self.NameBufs[node] @@ -26476,7 +26510,7 @@ end -- Demonstrate creating a simple property editor. local DemoTree = nil function ShowExampleAppPropertyEditor(p_open, demo_data) - ImGui.SetNextWindowSize(ImVec2(430, 450), ImGuiCond.FirstUseEver) + ImGui.SetNextWindowSize(ImVec2(430, 450), 4 --[[ImGuiCond.FirstUseEver]]) local visible p_open, visible = ImGui.Begin("Example: Property editor", p_open) if not visible then ImGui.End(); return p_open end @@ -26494,7 +26528,7 @@ end -- Demonstrate/test rendering huge amount of text, and the incidence of clipping. local LT = { test_type = 0, log = {}, lines = 0, bytes = 0 } function ShowExampleAppLongText(p_open) - ImGui.SetNextWindowSize(ImVec2(520, 600), ImGuiCond.FirstUseEver) + ImGui.SetNextWindowSize(ImVec2(520, 600), 4 --[[ImGuiCond.FirstUseEver]]) local visible p_open, visible = ImGui.Begin("Example: Long text display", p_open) if not visible then ImGui.End(); return p_open end @@ -26519,7 +26553,7 @@ function ShowExampleAppLongText(p_open) ImGui.TextUnformatted(LT.text) elseif LT.test_type == 1 then -- Multiple calls to Text(), manually coarsely clipped - demonstrate how to use the ImGuiListClipper helper. - ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, ImVec2(0, 0)) + ImGui.PushStyleVar(14 --[[ImGuiStyleVar.ItemSpacing]], ImVec2(0, 0)) local clipper = ImGuiListClipper() clipper:Begin(LT.lines) while clipper:Step() do @@ -26528,7 +26562,7 @@ function ShowExampleAppLongText(p_open) ImGui.PopStyleVar() else -- Multiple calls to Text(), not clipped (slow) - ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, ImVec2(0, 0)) + ImGui.PushStyleVar(14 --[[ImGuiStyleVar.ItemSpacing]], ImVec2(0, 0)) for i = 0, LT.lines - 1 do ImGui.Text("%i The quick brown fox jumps over the lazy dog", i) end ImGui.PopStyleVar() end @@ -26545,7 +26579,7 @@ end local AutoResizeLines = 10 function ShowExampleAppAutoResize(p_open) local visible - p_open, visible = ImGui.Begin("Example: Auto-resizing window", p_open, ImGuiWindowFlags.AlwaysAutoResize) + p_open, visible = ImGui.Begin("Example: Auto-resizing window", p_open, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) if not visible then ImGui.End(); return p_open end ImGui.TextUnformatted("Window will resize every-frame to the size of its content.\nNote that you probably don't want to query the window size to\noutput your content because that would create a feedback loop.") AutoResizeLines = ImGui.SliderInt("Number of lines", AutoResizeLines, 1, 20) @@ -26577,18 +26611,18 @@ function ShowExampleAppConstrainedResize(p_open) -- Submit constraint local t = CR.type if t == 0 then ImGui.SetNextWindowSizeConstraints(ImVec2(100, 100), ImVec2(500, 500)) end -- Between 100x100 and 500x500 - if t == 1 then ImGui.SetNextWindowSizeConstraints(ImVec2(100, 100), ImVec2(FLT_MAX, FLT_MAX)) end -- Width > 100, Height > 100 - if t == 2 then ImGui.SetNextWindowSizeConstraints(ImVec2(-1, 0), ImVec2(-1, FLT_MAX)) end -- Resize vertical + lock current width - if t == 3 then ImGui.SetNextWindowSizeConstraints(ImVec2(0, -1), ImVec2(FLT_MAX, -1)) end -- Resize horizontal + lock current height + if t == 1 then ImGui.SetNextWindowSizeConstraints(ImVec2(100, 100), ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]])) end -- Width > 100, Height > 100 + if t == 2 then ImGui.SetNextWindowSizeConstraints(ImVec2(-1, 0), ImVec2(-1, 3.4028234663853e+38 --[[FLT_MAX]])) end -- Resize vertical + lock current width + if t == 3 then ImGui.SetNextWindowSizeConstraints(ImVec2(0, -1), ImVec2(3.4028234663853e+38 --[[FLT_MAX]], -1)) end -- Resize horizontal + lock current height if t == 4 then ImGui.SetNextWindowSizeConstraints(ImVec2(400, -1), ImVec2(500, -1)) end -- Width Between and 400 and 500 - if t == 5 then ImGui.SetNextWindowSizeConstraints(ImVec2(-1, 400), ImVec2(-1, FLT_MAX)) end -- Height at least 400 - if t == 6 then ImGui.SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), AspectRatio, 16.0 / 9.0) end -- Aspect ratio - if t == 7 then ImGui.SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), Square) end -- Always Square - if t == 8 then ImGui.SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), Step, 100.0) end -- Fixed Step + if t == 5 then ImGui.SetNextWindowSizeConstraints(ImVec2(-1, 400), ImVec2(-1, 3.4028234663853e+38 --[[FLT_MAX]])) end -- Height at least 400 + if t == 6 then ImGui.SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]), AspectRatio, 16.0 / 9.0) end -- Aspect ratio + if t == 7 then ImGui.SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]), Square) end -- Always Square + if t == 8 then ImGui.SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]), Step, 100.0) end -- Fixed Step -- Submit window - if not CR.window_padding then ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, ImVec2(0.0, 0.0)) end - local window_flags = CR.auto_resize and ImGuiWindowFlags.AlwaysAutoResize or 0 + if not CR.window_padding then ImGui.PushStyleVar(2 --[[ImGuiStyleVar.WindowPadding]], ImVec2(0.0, 0.0)) end + local window_flags = CR.auto_resize and 64 --[[ImGuiWindowFlags.AlwaysAutoResize]] or 0 local window_open p_open, window_open = ImGui.Begin("Example: Constrained Resize", p_open, window_flags) if not CR.window_padding then ImGui.PopStyleVar() end @@ -26597,7 +26631,7 @@ function ShowExampleAppConstrainedResize(p_open) -- Display a dummy viewport (in your real app you would likely use ImageButton() to display a texture) local avail_size = ImGui.GetContentRegionAvail() local pos = ImGui.GetCursorScreenPos() - ImGui.ColorButton("viewport", ImVec4(0.5, 0.2, 0.5, 1.0), bit32.bor(ImGuiColorEditFlags.NoTooltip, ImGuiColorEditFlags.NoDragDrop), avail_size) + ImGui.ColorButton("viewport", ImVec4(0.5, 0.2, 0.5, 1.0), bit32.bor(64 --[[ImGuiColorEditFlags.NoTooltip]], 512 --[[ImGuiColorEditFlags.NoDragDrop]]), avail_size) ImGui.SetCursorScreenPos(ImVec2(pos.x + 10, pos.y + 10)) ImGui.Text("%.2f x %.2f", avail_size.x, avail_size.y) else @@ -26637,12 +26671,12 @@ function ShowExampleAppSimpleOverlay(p_open) local right, bottom = OverlayLocation % 2 == 1, OverlayLocation >= 2 local window_pos = ImVec2(right and (work_pos.x + work_size.x - PAD) or (work_pos.x + PAD), bottom and (work_pos.y + work_size.y - PAD) or (work_pos.y + PAD)) local window_pos_pivot = ImVec2(right and 1.0 or 0.0, bottom and 1.0 or 0.0) - ImGui.SetNextWindowPos(window_pos, ImGuiCond.Always, window_pos_pivot) + ImGui.SetNextWindowPos(window_pos, 1 --[[ImGuiCond.Always]], window_pos_pivot) ImGui.SetNextWindowViewport(viewport.ID) window_flags = bit32.bor(window_flags, W.NoMove) elseif OverlayLocation == -2 then -- Center window - ImGui.SetNextWindowPos(ImGui.GetMainViewport():GetCenter(), ImGuiCond.Always, ImVec2(0.5, 0.5)) + ImGui.SetNextWindowPos(ImGui.GetMainViewport():GetCenter(), 1 --[[ImGuiCond.Always]], ImVec2(0.5, 0.5)) window_flags = bit32.bor(window_flags, W.NoMove) end ImGui.SetNextWindowBgAlpha(0.35) -- Transparent background @@ -26714,11 +26748,11 @@ function ShowExampleAppWindowTitles(p_open) -- You can use the "##" and "###" markers to manipulate the display/ID. -- Using "##" to display same title but have unique identifier. - ImGui.SetNextWindowPos(ImVec2(base_pos.x + 100, base_pos.y + 100), ImGuiCond.FirstUseEver) + ImGui.SetNextWindowPos(ImVec2(base_pos.x + 100, base_pos.y + 100), 4 --[[ImGuiCond.FirstUseEver]]) ImGui.Begin("Same title as another window##1") ImGui.Text("This is window 1.\nMy title is the same as window 2, but my identifier is unique.") ImGui.End() - ImGui.SetNextWindowPos(ImVec2(base_pos.x + 100, base_pos.y + 200), ImGuiCond.FirstUseEver) + ImGui.SetNextWindowPos(ImVec2(base_pos.x + 100, base_pos.y + 200), 4 --[[ImGuiCond.FirstUseEver]]) ImGui.Begin("Same title as another window##2") ImGui.Text("This is window 2.\nMy title is the same as window 1, but my identifier is unique.") ImGui.End() @@ -26727,7 +26761,7 @@ function ShowExampleAppWindowTitles(p_open) local spin = "|/-\\" local k = math.floor(ImGui.GetTime() / 0.25) % 4 + 1 local buf = string.format("Animated title %s %d###AnimatedTitle", string.sub(spin, k, k), ImGui.GetFrameCount()) - ImGui.SetNextWindowPos(ImVec2(base_pos.x + 100, base_pos.y + 300), ImGuiCond.FirstUseEver) + ImGui.SetNextWindowPos(ImVec2(base_pos.x + 100, base_pos.y + 300), 4 --[[ImGuiCond.FirstUseEver]]) ImGui.Begin(buf) ImGui.Text("This window has a changing title.") ImGui.End() @@ -26752,7 +26786,7 @@ local CRS = { sz = 42.0, base_rounding = 8.0, base_thickness = 3.0, animate_roun local function CustomRenderingPrimitives() local s = CRS ImGui.PushItemWidth(-ImGui.GetFontSize() * 15) - ImGui.PushItemFlag(ImGuiItemFlags.LiveEditOnInput, true) + ImGui.PushItemFlag(384 --[[ImGuiItemFlags.LiveEditOnInput]], true) local draw_list = ImGui.GetWindowDrawList() -- Draw gradients @@ -26801,7 +26835,7 @@ local function CustomRenderingPrimitives() local start_pos = ImGui.GetCursorScreenPos() local pi = 3.141592 local step = sz + 10.0 - local corners_tl_br = bit32.bor(ImDrawFlags.RoundCornersTopLeft, ImDrawFlags.RoundCornersBottomRight) + local corners_tl_br = bit32.bor(16 --[[ImDrawFlags.RoundCornersTopLeft]], 128 --[[ImDrawFlags.RoundCornersBottomRight]]) local half_sz = sz * 0.5 local circle_segments = s.circle_override and s.circle_override_v or 0 local curve_segments = s.curve_override and s.curve_override_v or 0 @@ -26888,10 +26922,10 @@ local function CustomRenderingPrimitives() draw_list:AddTriangle(ImVec2(x + sz * 0.2, y), ImVec2(x + sz * 0.4, y + sz), ImVec2(x, y + sz), col, th); x = x + step - math.floor(sz * 0.6) -- Thin triangle -- Concave shape: U - Shape(concave_shape, x, y); draw_list:PathStroke(col, th, ImDrawFlags.Closed); x = x + step + Shape(concave_shape, x, y); draw_list:PathStroke(col, th, 512 --[[ImDrawFlags.Closed]]); x = x + step -- Concave shape: Zig-Zag with sharp angles - Shape(zigzag_shape, x, y); draw_list:PathStroke(col, th, ImDrawFlags.Closed); x = x + step + Shape(zigzag_shape, x, y); draw_list:PathStroke(col, th, 512 --[[ImDrawFlags.Closed]]); x = x + step -- Horizontal/Vertical/Diagonal lines local off = math.floor(sz * 0.4) @@ -26907,7 +26941,7 @@ local function CustomRenderingPrimitives() -- Rotating square for n = 1, 4 do draw_list:PathLineTo(ImVec2(x + half_sz + rotating_square[n].x, y + half_sz + rotating_square[n].y)) end - draw_list:PathStroke(col, th, ImDrawFlags.Closed); x = x + step + draw_list:PathStroke(col, th, 512 --[[ImDrawFlags.Closed]]); x = x + step -- Path draw_list:PathArcTo(ImVec2(x + half_sz, y + half_sz), half_sz, pi * -0.5, pi * 1.1) @@ -26962,7 +26996,7 @@ local function CustomRenderingCanvas() draw_list:AddRect(canvas_p0, canvas_p1, IM_COL32(255, 255, 255, 255)) -- This will catch our interactions - ImGui.InvisibleButton("canvas", canvas_sz, bit32.bor(ImGuiButtonFlags.MouseButtonLeft, ImGuiButtonFlags.MouseButtonRight)) + ImGui.InvisibleButton("canvas", canvas_sz, bit32.bor(1 --[[ImGuiButtonFlags.MouseButtonLeft]], 2 --[[ImGuiButtonFlags.MouseButtonRight]])) local is_hovered = ImGui.IsItemHovered() -- Hovered local is_active = ImGui.IsItemActive() -- Held local origin = ImVec2(canvas_p0.x + s.scrolling.x, canvas_p0.y + s.scrolling.y) -- Lock scrolled origin @@ -26970,28 +27004,28 @@ local function CustomRenderingCanvas() local points = s.points -- Add first and second point - if is_hovered and not s.adding_line and ImGui.IsMouseClicked(ImGuiMouseButton.Left) then + if is_hovered and not s.adding_line and ImGui.IsMouseClicked(0 --[[ImGuiMouseButton.Left]]) then points[#points + 1] = ImVec2(mouse_pos_in_canvas.x, mouse_pos_in_canvas.y) points[#points + 1] = ImVec2(mouse_pos_in_canvas.x, mouse_pos_in_canvas.y) s.adding_line = true end if s.adding_line then points[#points] = ImVec2(mouse_pos_in_canvas.x, mouse_pos_in_canvas.y) - if not ImGui.IsMouseDown(ImGuiMouseButton.Left) then s.adding_line = false end + if not ImGui.IsMouseDown(0 --[[ImGuiMouseButton.Left]]) then s.adding_line = false end end -- Pan (we use a zero mouse threshold when there's no context menu) -- You may decide to make that threshold dynamic based on whether the mouse is hovering something etc. local mouse_threshold_for_pan = s.opt_enable_context_menu and -1.0 or 0.0 - if is_active and ImGui.IsMouseDragging(ImGuiMouseButton.Right, mouse_threshold_for_pan) then + if is_active and ImGui.IsMouseDragging(1 --[[ImGuiMouseButton.Right]], mouse_threshold_for_pan) then s.scrolling.x = s.scrolling.x + io.MouseDelta.x s.scrolling.y = s.scrolling.y + io.MouseDelta.y end -- Context menu (under default mouse threshold) - local drag_delta = ImGui.GetMouseDragDelta(ImGuiMouseButton.Right) + local drag_delta = ImGui.GetMouseDragDelta(1 --[[ImGuiMouseButton.Right]]) if s.opt_enable_context_menu and drag_delta.x == 0.0 and drag_delta.y == 0.0 then - ImGui.OpenPopupOnItemClick("context", ImGuiPopupFlags.MouseButtonRight) + ImGui.OpenPopupOnItemClick("context", 8 --[[ImGuiPopupFlags.MouseButtonRight]]) end if ImGui.BeginPopup("context") then if s.adding_line then points[#points] = nil; points[#points] = nil end @@ -27107,12 +27141,12 @@ local function ShowExampleAppDockSpaceAdvanced(args, p_open) ImGui.SetNextWindowPos(viewport.WorkPos) ImGui.SetNextWindowSize(viewport.WorkSize) ImGui.SetNextWindowViewport(viewport.ID) - ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 0.0) - ImGui.PushStyleVar(ImGuiStyleVar.WindowBorderSize, 0.0) + ImGui.PushStyleVar(3 --[[ImGuiStyleVar.WindowRounding]], 0.0) + ImGui.PushStyleVar(4 --[[ImGuiStyleVar.WindowBorderSize]], 0.0) window_flags = bit32.bor(window_flags, W.NoTitleBar, W.NoCollapse, W.NoResize, W.NoMove, W.NoBringToFrontOnFocus, W.NoNavFocus, W.NoBackground) else -- Floating dockspace - dockspace_flags = bit32.band(dockspace_flags, bit32.bnot(ImGuiDockNodeFlags.PassthruCentralNode)) + dockspace_flags = bit32.band(dockspace_flags, bit32.bnot(8 --[[ImGuiDockNodeFlags.PassthruCentralNode]])) end -- Important: note that we proceed even if Begin() returns false (aka window is collapsed). @@ -27120,7 +27154,7 @@ local function ShowExampleAppDockSpaceAdvanced(args, p_open) -- all active windows docked into it will lose their parent and become undocked. -- We cannot preserve the docking relationship between an active window and an inactive docking, otherwise -- any change of dockspace/settings would lead to windows being stuck in limbo and never being visible. - if not args.KeepWindowPadding then ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, ImVec2(0.0, 0.0)) end + if not args.KeepWindowPadding then ImGui.PushStyleVar(2 --[[ImGuiStyleVar.WindowPadding]], ImVec2(0.0, 0.0)) end p_open = ImGui.Begin("Window with a DockSpace", p_open, window_flags) if not args.KeepWindowPadding then ImGui.PopStyleVar() end @@ -27153,14 +27187,14 @@ function ShowExampleAppDockSpace(p_open) -- Refocus our window to minimize perceived loss of focus when changing mode (caused by the fact that each use a different window, which would not happen in a real app) if args.opt_demo_mode_changed then ImGui.SetNextWindowFocus() end - p_open = ImGui.Begin("Examples: Dockspace", p_open, ImGuiWindowFlags.MenuBar) + p_open = ImGui.Begin("Examples: Dockspace", p_open, 1024 --[[ImGuiWindowFlags.MenuBar]]) local c1, c2 c1, args.opt_demo_mode = ImGui.RadioButton("Basic demo mode", args.opt_demo_mode, 0) c2, args.opt_demo_mode = ImGui.RadioButton("Advanced demo mode", args.opt_demo_mode, 1) args.opt_demo_mode_changed = c1 or c2 ImGui.SeparatorText("Options") local D = ImGuiDockNodeFlags - if bit32.band(ImGui.GetIO().ConfigFlags, ImGuiConfigFlags.DockingEnable) == 0 then + if bit32.band(ImGui.GetIO().ConfigFlags, 128 --[[ImGuiConfigFlags.DockingEnable]]) == 0 then ShowDockingDisabledMessage() elseif args.opt_demo_mode == 0 then args.DockSpaceFlags = bit32.band(args.DockSpaceFlags, D.PassthruCentralNode) -- Allowed flags @@ -27226,7 +27260,7 @@ local function DocsInit() MyDocument(4, "A Rather Long Title", false, ImVec4(0.4, 0.8, 0.8, 1.0)), MyDocument(5, "Some Document", false, ImVec4(0.8, 0.8, 1.0, 1.0)), }, CloseQueue = {}, RenamingDoc = nil, RenamingStarted = false, - opt_target = 1, opt_reorderable = true, opt_fitting_flags = ImGuiTabBarFlags.FittingPolicyDefault_ } + opt_target = 1, opt_reorderable = true, opt_fitting_flags = 128 --[[ImGuiTabBarFlags.FittingPolicyDefault_]] } function app:QueueClose(doc) for _, d in ipairs(self.CloseQueue) do if d == doc then return end end self.CloseQueue[#self.CloseQueue + 1] = doc @@ -27237,20 +27271,20 @@ local function DocsInit() function app:DisplayDocContents(doc) ImGui.PushID("doc" .. doc.UID) ImGui.Text("Document \"%s\"", doc:Name()) - ImGui.PushStyleColor(ImGuiCol.Text, doc.Color) + ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], doc.Color) ImGui.TextWrapped("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.") ImGui.PopStyleColor() - ImGui.SetNextItemShortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.R), ImGuiInputFlags.Tooltip) + ImGui.SetNextItemShortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 563 --[[ImGuiKey.R]]), 262144 --[[ImGuiInputFlags.Tooltip]]) if ImGui.Button("Rename..") then self.RenamingDoc = doc; self.RenamingStarted = true end ImGui.SameLine() - ImGui.SetNextItemShortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.M), ImGuiInputFlags.Tooltip) + ImGui.SetNextItemShortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 558 --[[ImGuiKey.M]]), 262144 --[[ImGuiInputFlags.Tooltip]]) if ImGui.Button("Modify") then doc.Dirty = true end ImGui.SameLine() - ImGui.SetNextItemShortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.S), ImGuiInputFlags.Tooltip) + ImGui.SetNextItemShortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 564 --[[ImGuiKey.S]]), 262144 --[[ImGuiInputFlags.Tooltip]]) if ImGui.Button("Save") then doc:DoSave() end ImGui.SameLine() - ImGui.SetNextItemShortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.W), ImGuiInputFlags.Tooltip) + ImGui.SetNextItemShortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 568 --[[ImGuiKey.W]]), 262144 --[[ImGuiInputFlags.Tooltip]]) if ImGui.Button("Close") then self:QueueClose(doc) end ImGui.ColorEdit3("color", doc.Color) -- Useful to test drag and drop and hold-dragged-to-open-tab behavior. ImGui.PopID() @@ -27296,7 +27330,7 @@ function ShowExampleAppDocuments(p_open) -- Another solution may be to make the "Example: Documents" window use the ImGuiWindowFlags.NoDocking. local window_contents_visible - p_open, window_contents_visible = ImGui.Begin("Example: Documents", p_open, ImGuiWindowFlags.MenuBar) + p_open, window_contents_visible = ImGui.Begin("Example: Documents", p_open, 1024 --[[ImGuiWindowFlags.MenuBar]]) if not window_contents_visible and app.opt_target ~= Target_DockSpaceAndWindow then ImGui.End() return p_open @@ -27351,7 +27385,7 @@ function ShowExampleAppDocuments(p_open) -- Tabs if app.opt_target == Target_Tab then - local tab_bar_flags = bit32.bor(app.opt_fitting_flags, app.opt_reorderable and ImGuiTabBarFlags.Reorderable or 0, ImGuiTabBarFlags.DrawSelectedOverline) + local tab_bar_flags = bit32.bor(app.opt_fitting_flags, app.opt_reorderable and 1 --[[ImGuiTabBarFlags.Reorderable]] or 0, 64 --[[ImGuiTabBarFlags.DrawSelectedOverline]]) if ImGui.BeginTabBar("##tabs", tab_bar_flags) then if app.opt_reorderable then app:NotifyOfDocumentsClosedElsewhere() end @@ -27359,7 +27393,7 @@ function ShowExampleAppDocuments(p_open) for _, doc in ipairs(app.Documents) do if doc.Open then -- As we allow to change document name, we append a never-changing document id so tabs are stable - local tab_flags = doc.Dirty and ImGuiTabItemFlags.UnsavedDocument or 0 + local tab_flags = doc.Dirty and 1 --[[ImGuiTabItemFlags.UnsavedDocument]] or 0 local visible visible, doc.Open = ImGui.BeginTabItem(app:GetTabName(doc), doc.Open, tab_flags) @@ -27378,7 +27412,7 @@ function ShowExampleAppDocuments(p_open) ImGui.EndTabBar() end elseif app.opt_target == Target_DockSpaceAndWindow then - if bit32.band(ImGui.GetIO().ConfigFlags, ImGuiConfigFlags.DockingEnable) ~= 0 then + if bit32.band(ImGui.GetIO().ConfigFlags, 128 --[[ImGuiConfigFlags.DockingEnable]]) ~= 0 then app:NotifyOfDocumentsClosedElsewhere() -- Create a DockSpace node where any window can be docked @@ -27388,8 +27422,8 @@ function ShowExampleAppDocuments(p_open) -- Create Windows for _, doc in ipairs(app.Documents) do if doc.Open then - ImGui.SetNextWindowDockID(dockspace_id, redock_all and ImGuiCond.Always or ImGuiCond.FirstUseEver) - local window_flags = doc.Dirty and ImGuiWindowFlags.UnsavedDocument or 0 + ImGui.SetNextWindowDockID(dockspace_id, redock_all and 1 --[[ImGuiCond.Always]] or 4 --[[ImGuiCond.FirstUseEver]]) + local window_flags = doc.Dirty and 262144 --[[ImGuiWindowFlags.UnsavedDocument]] or 0 local visible doc.Open, visible = ImGui.Begin(doc:Name(), doc.Open, window_flags) @@ -27419,7 +27453,7 @@ function ShowExampleAppDocuments(p_open) if app.RenamingStarted then ImGui.OpenPopup("Rename") end if ImGui.BeginPopup("Rename") then ImGui.SetNextItemWidth(ImGui.GetFontSize() * 30) - if ImGui.InputText("###Name", app.RenamingDoc.NameBuf, 32, ImGuiInputTextFlags.EnterReturnsTrue) then + if ImGui.InputText("###Name", app.RenamingDoc.NameBuf, 32, 64 --[[ImGuiInputTextFlags.EnterReturnsTrue]]) then ImGui.CloseCurrentPopup() app.RenamingDoc = nil end @@ -27441,10 +27475,10 @@ function ShowExampleAppDocuments(p_open) app.CloseQueue = {} else if not ImGui.IsPopupOpen("Save?") then ImGui.OpenPopup("Save?") end - if ImGui.BeginPopupModal("Save?", nil, ImGuiWindowFlags.AlwaysAutoResize) then + if ImGui.BeginPopupModal("Save?", nil, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) then ImGui.Text("Save change to the following items?") local item_height = ImGui.GetTextLineHeightWithSpacing() - if ImGui.BeginChild(ImGui.GetID("frame"), ImVec2(-FLT_MIN, 6.25 * item_height), ImGuiChildFlags.FrameStyle) then + if ImGui.BeginChild(ImGui.GetID("frame"), ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], 6.25 * item_height), 128 --[[ImGuiChildFlags.FrameStyle]]) then for _, doc in ipairs(app.CloseQueue) do if doc.Dirty then ImGui.Text("%s", doc:Name()) end end end ImGui.EndChild() @@ -27515,9 +27549,9 @@ function DemoWindowWidgetsBasic() for i = 0, 6 do if i > 0 then ImGui.SameLine() end ImGui.PushID(i) - ImGui.PushStyleColor(ImGuiCol.Button, HSV(i / 7.0, 0.6, 0.6)) - ImGui.PushStyleColor(ImGuiCol.ButtonHovered, HSV(i / 7.0, 0.7, 0.7)) - ImGui.PushStyleColor(ImGuiCol.ButtonActive, HSV(i / 7.0, 0.8, 0.8)) + ImGui.PushStyleColor(22 --[[ImGuiCol.Button]], HSV(i / 7.0, 0.6, 0.6)) + ImGui.PushStyleColor(23 --[[ImGuiCol.ButtonHovered]], HSV(i / 7.0, 0.7, 0.7)) + ImGui.PushStyleColor(24 --[[ImGuiCol.ButtonActive]], HSV(i / 7.0, 0.8, 0.8)) ImGui.Button("Click") ImGui.PopStyleColor(3) ImGui.PopID() @@ -27532,10 +27566,10 @@ function DemoWindowWidgetsBasic() -- Arrow buttons with Repeater local spacing = ImGui.GetStyle().ItemInnerSpacing.x - ImGui.PushItemFlag(ImGuiItemFlags.ButtonRepeat, true) - if ImGui.ArrowButton("##left", ImGuiDir.Left) then s.counter = s.counter - 1 end + ImGui.PushItemFlag(8 --[[ImGuiItemFlags.ButtonRepeat]], true) + if ImGui.ArrowButton("##left", 0 --[[ImGuiDir.Left]]) then s.counter = s.counter - 1 end ImGui.SameLine(0.0, spacing) - if ImGui.ArrowButton("##right", ImGuiDir.Right) then s.counter = s.counter + 1 end + if ImGui.ArrowButton("##right", 1 --[[ImGuiDir.Right]]) then s.counter = s.counter + 1 end ImGui.PopItemFlag() ImGui.SameLine() ImGui.Text("%d", s.counter) @@ -27557,8 +27591,8 @@ function DemoWindowWidgetsBasic() ImGui.SeparatorText("Drags") s.di1 = ImGui.DragInt("drag int", s.di1, 1) ImGui.SameLine(); HelpMarker("Click and drag to edit value.\nHold Shift/Alt for faster/slower edit.\nDouble-Click or Ctrl+Click to input value.") - s.di2 = ImGui.DragInt("drag int 0..100", s.di2, 1, 0, 100, "%d%%", ImGuiSliderFlags.AlwaysClamp) - s.di3 = ImGui.DragInt("drag int wrap 100..200", s.di3, 1, 100, 200, "%d", ImGuiSliderFlags.WrapAround) + s.di2 = ImGui.DragInt("drag int 0..100", s.di2, 1, 0, 100, "%d%%", 1536 --[[ImGuiSliderFlags.AlwaysClamp]]) + s.di3 = ImGui.DragInt("drag int wrap 100..200", s.di3, 1, 100, 200, "%d", 256 --[[ImGuiSliderFlags.WrapAround]]) s.df1 = ImGui.DragFloat("drag float", s.df1, 0.005) s.df2 = ImGui.DragFloat("drag small float", s.df2, 0.0001, 0.0, 0.0, "%.06f ns") -- ImGui.DragFloat("drag wrap -1..1", f3, 0.005, -1.0, 1.0, nil, ImGuiSliderFlags.WrapAround) @@ -27567,7 +27601,7 @@ function DemoWindowWidgetsBasic() s.si1 = ImGui.SliderInt("slider int", s.si1, -1, 3) ImGui.SameLine(); HelpMarker("Ctrl+Click to input value.") s.sf1 = ImGui.SliderFloat("slider float", s.sf1, 0.0, 1.0, "ratio = %.3f") - s.sf2 = ImGui.SliderFloat("slider float (log)", s.sf2, -10.0, 10.0, "%.4f", ImGuiSliderFlags.Logarithmic) + s.sf2 = ImGui.SliderFloat("slider float (log)", s.sf2, -10.0, 10.0, "%.4f", 32 --[[ImGuiSliderFlags.Logarithmic]]) s.angle = ImGui.SliderAngle("slider angle", s.angle) -- Using the format string to display a name instead of an integer. @@ -27619,7 +27653,7 @@ function DemoWindowWidgetsCollapsingHeaders() if not ImGui.TreeNode("Collapsing Headers") then return end local s = S.chdr _, s.closable_group = ImGui.Checkbox("Show 2nd header", s.closable_group) - if ImGui.CollapsingHeader("Header", ImGuiTreeNodeFlags.None) then + if ImGui.CollapsingHeader("Header", 0 --[[ImGuiTreeNodeFlags.None]]) then ImGui.Text("IsItemHovered: %d", ImGui.IsItemHovered() and 1 or 0) for i = 0, 4 do ImGui.Text("Some content %d", i) end end @@ -27842,8 +27876,8 @@ function DemoWindowWidgetsComboBoxes() ImGui.SetKeyboardFocusHere() s.filter:Clear() end - ImGui.SetNextItemShortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.F)) - ImGui.SetNextItemWidth(-FLT_MIN) + ImGui.SetNextItemShortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 551 --[[ImGuiKey.F]])) + ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) s.filter:DrawWithHint("##Filter", "Filter (incl -excl)") for n = 0, #items - 1 do local is_selected = (s.sel == n) @@ -27912,9 +27946,9 @@ function DemoWindowWidgetsDataTypes() s.s32 = ImGui.DragScalar("drag s32 hex", DT.S32, s.s32, drag_speed, lo, hi, "0x%08X") s.u32 = ImGui.DragScalar("drag u32", DT.U32, s.u32, drag_speed, lo, hi, "%u ms") s.f32 = ImGui.DragScalar("drag float", DT.Float, s.f32, 0.005, 0.0, 1.0, "%f") - s.f32 = ImGui.DragScalar("drag float log", DT.Float, s.f32, 0.005, 0.0, 1.0, "%f", ImGuiSliderFlags.Logarithmic) + s.f32 = ImGui.DragScalar("drag float log", DT.Float, s.f32, 0.005, 0.0, 1.0, "%f", 32 --[[ImGuiSliderFlags.Logarithmic]]) s.f64 = ImGui.DragScalar("drag double", DT.Double, s.f64, 0.0005, 0.0, nil, "%.10f grams") - s.f64 = ImGui.DragScalar("drag double log",DT.Double, s.f64, 0.0005, 0.0, 1.0, "0 < %.10f < 1", ImGuiSliderFlags.Logarithmic) + s.f64 = ImGui.DragScalar("drag double log",DT.Double, s.f64, 0.0005, 0.0, 1.0, "0 < %.10f < 1", 32 --[[ImGuiSliderFlags.Logarithmic]]) ImGui.SeparatorText("Sliders") s.s8 = ImGui.SliderScalar("slider s8 full", DT.S8, s.s8, -128, 127, "%d") @@ -27929,10 +27963,10 @@ function DemoWindowWidgetsDataTypes() s.u32 = ImGui.SliderScalar("slider u32 high", DT.U32, s.u32, u32_max - 100, u32_max, "%u") s.u32 = ImGui.SliderScalar("slider u32 full", DT.U32, s.u32, 0, u32_max, "%u") s.f32 = ImGui.SliderScalar("slider float low", DT.Float, s.f32, 0.0, 1.0) - s.f32 = ImGui.SliderScalar("slider float low log", DT.Float, s.f32, 0.0, 1.0, "%.10f", ImGuiSliderFlags.Logarithmic) + s.f32 = ImGui.SliderScalar("slider float low log", DT.Float, s.f32, 0.0, 1.0, "%.10f", 32 --[[ImGuiSliderFlags.Logarithmic]]) s.f32 = ImGui.SliderScalar("slider float high", DT.Float, s.f32, -10000000000.0, 10000000000.0, "%e") s.f64 = ImGui.SliderScalar("slider double low", DT.Double, s.f64, 0.0, 1.0, "%.10f grams") - s.f64 = ImGui.SliderScalar("slider double low log", DT.Double, s.f64, 0.0, 1.0, "%.10f", ImGuiSliderFlags.Logarithmic) + s.f64 = ImGui.SliderScalar("slider double low log", DT.Double, s.f64, 0.0, 1.0, "%.10f", 32 --[[ImGuiSliderFlags.Logarithmic]]) s.f64 = ImGui.SliderScalar("slider double high", DT.Double, s.f64, -1000000000000000.0, 1000000000000000.0, "%e grams") ImGui.SeparatorText("Sliders (reverse)") @@ -27943,9 +27977,9 @@ function DemoWindowWidgetsDataTypes() ImGui.SeparatorText("Inputs") _, s.inputs_step = ImGui.Checkbox("Show step buttons", s.inputs_step) - _, s.flags = ImGui.CheckboxFlags("ImGuiInputTextFlags_ReadOnly", s.flags, ImGuiInputTextFlags.ReadOnly) - if ImGuiInputTextFlags.ParseEmptyRefVal then _, s.flags = ImGui.CheckboxFlags("ImGuiInputTextFlags_ParseEmptyRefVal", s.flags, ImGuiInputTextFlags.ParseEmptyRefVal) end - if ImGuiInputTextFlags.DisplayEmptyRefVal then _, s.flags = ImGui.CheckboxFlags("ImGuiInputTextFlags_DisplayEmptyRefVal", s.flags, ImGuiInputTextFlags.DisplayEmptyRefVal) end + _, s.flags = ImGui.CheckboxFlags("ImGuiInputTextFlags_ReadOnly", s.flags, 512 --[[ImGuiInputTextFlags.ReadOnly]]) + if 8192 --[[ImGuiInputTextFlags.ParseEmptyRefVal]] then _, s.flags = ImGui.CheckboxFlags("ImGuiInputTextFlags_ParseEmptyRefVal", s.flags, 8192 --[[ImGuiInputTextFlags.ParseEmptyRefVal]]) end + if 16384 --[[ImGuiInputTextFlags.DisplayEmptyRefVal]] then _, s.flags = ImGui.CheckboxFlags("ImGuiInputTextFlags_DisplayEmptyRefVal", s.flags, 16384 --[[ImGuiInputTextFlags.DisplayEmptyRefVal]]) end local one = s.inputs_step and 1 or nil s.s8 = ImGui.InputScalar("input s8", DT.S8, s.s8, one, nil, "%d", s.flags) s.u8 = ImGui.InputScalar("input u8", DT.U8, s.u8, one, nil, "%u", s.flags) @@ -28004,7 +28038,7 @@ function DemoWindowWidgetsDragAndDrop() ImGui.Button(names[n + 1], ImVec2(60, 60)) -- Our buttons are both drag sources and drag targets here! - if ImGui.BeginDragDropSource(ImGuiDragDropFlags.None) then + if ImGui.BeginDragDropSource(0 --[[ImGuiDragDropFlags.None]]) then -- Set payload to carry the index of our item (could be anything) ImGui.SetDragDropPayload("DND_DEMO_CELL", n, 4) @@ -28034,7 +28068,7 @@ function DemoWindowWidgetsDragAndDrop() -- FIXME: there is temporary (usually single-frame) ID Conflict during reordering as a same item may be submitting twice. -- This code was always slightly faulty but in a way which was not easily noticeable. -- Until we fix this, enable ImGuiItemFlags.AllowDuplicateId to disable detecting the issue. - ImGui.PushItemFlag(ImGuiItemFlags.AllowDuplicateId, true) + ImGui.PushItemFlag(32 --[[ImGuiItemFlags.AllowDuplicateId]], true) -- Simple reordering HelpMarker("We don't use the drag and drop api at all here! Instead we query when the item is held but not hovered, and order items accordingly.") @@ -28060,9 +28094,9 @@ function DemoWindowWidgetsDragAndDrop() -- Drop targets ImGui.Button((n == 1) and "drop here##1" or "drop here##0") if ImGui.BeginDragDropTarget() then - local drop_target_flags = bit32.bor(ImGuiDragDropFlags.AcceptBeforeDelivery, ImGuiDragDropFlags.AcceptNoPreviewTooltip) + local drop_target_flags = bit32.bor(1024 --[[ImGuiDragDropFlags.AcceptBeforeDelivery]], 4096 --[[ImGuiDragDropFlags.AcceptNoPreviewTooltip]]) if ImGui.AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_4F, drop_target_flags) then - ImGui.SetMouseCursor(ImGuiMouseCursor.NotAllowed) + ImGui.SetMouseCursor(10 --[[ImGuiMouseCursor.NotAllowed]]) ImGui.SetTooltip("Cannot drop here!") end ImGui.EndDragDropTarget() @@ -28105,9 +28139,9 @@ function DemoWindowWidgetsDragsAndSliders() -- Drags ImGui.Text("Underlying float value: %f", s.drag_f) s.drag_f = ImGui.DragFloat("DragFloat (0 -> 1)", s.drag_f, 0.005, 0.0, 1.0, "%.3f", flags) - s.drag_f = ImGui.DragFloat("DragFloat (0 -> +inf)", s.drag_f, 0.005, 0.0, FLT_MAX, "%.3f", flags) - s.drag_f = ImGui.DragFloat("DragFloat (-inf -> 1)", s.drag_f, 0.005, -FLT_MAX, 1.0, "%.3f", flags) - s.drag_f = ImGui.DragFloat("DragFloat (-inf -> +inf)", s.drag_f, 0.005, -FLT_MAX, FLT_MAX, "%.3f", flags) + s.drag_f = ImGui.DragFloat("DragFloat (0 -> +inf)", s.drag_f, 0.005, 0.0, 3.4028234663853e+38 --[[FLT_MAX]], "%.3f", flags) + s.drag_f = ImGui.DragFloat("DragFloat (-inf -> 1)", s.drag_f, 0.005, -3.4028234663853e+38 --[[FLT_MAX]], 1.0, "%.3f", flags) + s.drag_f = ImGui.DragFloat("DragFloat (-inf -> +inf)", s.drag_f, 0.005, -3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]], "%.3f", flags) -- ImGui.DragFloat("DragFloat (0 -> 0)", drag_f, 0.005, 0.0, 0.0, "%.3f", flags) -- To test ClampZeroRange -- ImGui.DragFloat("DragFloat (100 -> 100)", drag_f, 0.005, 100.0, 100.0, "%.3f", flags) s.drag_i = ImGui.DragInt("DragInt (0 -> 100)", s.drag_i, 0.5, 0, 100, "%d", flags) @@ -28161,7 +28195,7 @@ function DemoWindowWidgetsImages() -- Basic drawing ImGui.SeparatorText("Image()/ImageWithBg() function") - ImGui.PushStyleVar(ImGuiStyleVar.ImageBorderSize, math.max(1.0, ImGui.GetStyle().ImageBorderSize)) + ImGui.PushStyleVar(24 --[[ImGuiStyleVar.ImageBorderSize]], math.max(1.0, ImGui.GetStyle().ImageBorderSize)) ImGui.ImageWithBg(my_tex_id, ImVec2(my_tex_w, my_tex_h), ImVec2(0.0, 0.0), ImVec2(1.0, 1.0), ImVec4(0.0, 0.0, 0.0, 1.0)) -- uv_min: Top-left, uv_max: Lower-right ImGui.PopStyleVar() @@ -28179,7 +28213,7 @@ function DemoWindowWidgetsImages() -- Here are trying to display only a 32x32 pixels area of the texture, hence the UV computation. -- Read about UV coordinates here: https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples ImGui.PushID(i) - if i > 0 then ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, ImVec2(i - 1.0, i - 1.0)) end + if i > 0 then ImGui.PushStyleVar(11 --[[ImGuiStyleVar.FramePadding]], ImVec2(i - 1.0, i - 1.0)) end local size = ImVec2(32.0, 32.0) -- Size of the image we want to make visible local uv0 = ImVec2(0.0, 0.0) -- UV coordinates for lower-left local uv1 = ImVec2(32.0 / my_tex_w, 32.0 / my_tex_h) -- UV coordinates for (32,32) in our texture @@ -28229,10 +28263,10 @@ function DemoWindowWidgetsListBoxes() -- Custom size: use all width, 5 items tall ImGui.Text("Full-width:") - if ImGui.BeginListBox("##listbox 2", ImVec2(-FLT_MIN, 5 * ImGui.GetTextLineHeightWithSpacing())) then + if ImGui.BeginListBox("##listbox 2", ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], 5 * ImGui.GetTextLineHeightWithSpacing())) then for n = 0, #items - 1 do local is_selected = (s.sel == n) - local flags = (item_highlighted_idx == n) and ImGuiSelectableFlags.Highlight or 0 + local flags = (item_highlighted_idx == n) and 32 --[[ImGuiSelectableFlags.Highlight]] or 0 if ImGui.Selectable(items[n + 1], is_selected, flags) then s.sel = n end -- Set the initial focus when opening the combo (scrolling + keyboard navigation focus) if is_selected then ImGui.SetItemDefaultFocus() end @@ -28255,8 +28289,8 @@ function DemoWindowWidgetsLiveEdit(demo_data) if not demo_data.LiveEditOverride then demo_data.LiveEditFlags = ImGui.GetItemFlags() end ImGui.BeginDisabled(demo_data.LiveEditOverride == false) ImGui.Indent() - _, demo_data.LiveEditFlags = ImGui.CheckboxFlags("ImGuiItemFlags_LiveEditOnInputText", demo_data.LiveEditFlags, ImGuiItemFlags.LiveEditOnInputText) - _, demo_data.LiveEditFlags = ImGui.CheckboxFlags("ImGuiItemFlags_LiveEditOnInputScalar", demo_data.LiveEditFlags, ImGuiItemFlags.LiveEditOnInputScalar) + _, demo_data.LiveEditFlags = ImGui.CheckboxFlags("ImGuiItemFlags_LiveEditOnInputText", demo_data.LiveEditFlags, 128 --[[ImGuiItemFlags.LiveEditOnInputText]]) + _, demo_data.LiveEditFlags = ImGui.CheckboxFlags("ImGuiItemFlags_LiveEditOnInputScalar", demo_data.LiveEditFlags, 256 --[[ImGuiItemFlags.LiveEditOnInputScalar]]) ImGui.Unindent() ImGui.EndDisabled() ImGui.Text("Try typing '123' and seeing effect on backing value:") @@ -28285,8 +28319,8 @@ function DemoWindowWidgetsMixedValues() local is_mixed = items[1] ~= items[2] or items[1] ~= items[3] -- Demonstrate Drags, Sliders, Inputs - ImGui.PushItemFlag(ImGuiItemFlags.LiveEditOnInput, s.use_liveedit) - ImGui.PushItemFlag(ImGuiItemFlags.MixedValue, is_mixed) + ImGui.PushItemFlag(384 --[[ImGuiItemFlags.LiveEditOnInput]], s.use_liveedit) + ImGui.PushItemFlag(4096 --[[ImGuiItemFlags.MixedValue]], is_mixed) local edited, e = false, false items[1], e = ImGui.DragFloat("DragFloat", items[1]); edited = edited or e items[1], e = ImGui.SliderFloat("SliderFloat", items[1], 0.0, 100.0); edited = edited or e @@ -28304,7 +28338,7 @@ function DemoWindowWidgetsMixedValues() ImGui.Text("(note: edits are not applied in this demo)") -- <-- Would need more state tracking. ImGui.Checkbox("Checkbox On", true) ImGui.Checkbox("Checkbox Off", false) - ImGui.PushItemFlag(ImGuiItemFlags.MixedValue, true) + ImGui.PushItemFlag(4096 --[[ImGuiItemFlags.MixedValue]], true) ImGui.Checkbox("Checkbox Mixed", false) ImGui.RadioButtonEx("RadioButton Mixed", true) ImGui.SameLine() @@ -28324,7 +28358,7 @@ function DemoWindowWidgetsMultiComponents() if not ImGui.TreeNode("Multi-component Widgets") then return end local s = S.mc local f, i = s.vec4f, s.vec4i - if ImGuiSliderFlags.ColorMarkers then _, s.flags = ImGui.CheckboxFlags("ImGuiSliderFlags_ColorMarkers", s.flags, ImGuiSliderFlags.ColorMarkers) end -- Only passing this to Drag/Sliders + if 4096 --[[ImGuiSliderFlags.ColorMarkers]] then _, s.flags = ImGui.CheckboxFlags("ImGuiSliderFlags_ColorMarkers", s.flags, 4096 --[[ImGuiSliderFlags.ColorMarkers]]) end -- Only passing this to Drag/Sliders local flags = s.flags for _, n in ipairs({ 2, 3, 4 }) do ImGui.SeparatorText(n .. "-wide") @@ -28336,7 +28370,7 @@ function DemoWindowWidgetsMultiComponents() ImGui["SliderInt" .. n]("slider int" .. n, i, 0, 255, nil, flags) end ImGui.SeparatorText("Ranges") - s.b, s.e = ImGui.DragFloatRange2("range float", s.b, s.e, 0.25, 0.0, 100.0, "Min: %.1f %%", "Max: %.1f %%", ImGuiSliderFlags.AlwaysClamp) + s.b, s.e = ImGui.DragFloatRange2("range float", s.b, s.e, 0.25, 0.0, 100.0, "Min: %.1f %%", "Max: %.1f %%", 1536 --[[ImGuiSliderFlags.AlwaysClamp]]) s.bi, s.ei = ImGui.DragIntRange2("range int", s.bi, s.ei, 5, 0, 1000, "Min: %d units", "Max: %d units") s.bi, s.ei = ImGui.DragIntRange2("range int (no bounds)", s.bi, s.ei, 5, 0, 0, "Min: %d units", "Max: %d units") ImGui.TreePop() @@ -28459,25 +28493,25 @@ function DemoWindowWidgetsQueryingStatuses() ImGui.SameLine() if not s.liveedit_override then s.liveedit_flags = ImGui.GetItemFlags() end ImGui.BeginDisabled(s.liveedit_override == false) - _, s.liveedit_flags = ImGui.CheckboxFlags("_LiveEditOnInput", s.liveedit_flags, ImGuiItemFlags.LiveEditOnInput) + _, s.liveedit_flags = ImGui.CheckboxFlags("_LiveEditOnInput", s.liveedit_flags, 384 --[[ImGuiItemFlags.LiveEditOnInput]]) ImGui.SameLine() - _, s.liveedit_flags = ImGui.CheckboxFlags("_LiveEditOnInputText", s.liveedit_flags, ImGuiItemFlags.LiveEditOnInputText) + _, s.liveedit_flags = ImGui.CheckboxFlags("_LiveEditOnInputText", s.liveedit_flags, 128 --[[ImGuiItemFlags.LiveEditOnInputText]]) ImGui.SameLine() - _, s.liveedit_flags = ImGui.CheckboxFlags("_LiveEditOnInputScalar", s.liveedit_flags, ImGuiItemFlags.LiveEditOnInputScalar) + _, s.liveedit_flags = ImGui.CheckboxFlags("_LiveEditOnInputScalar", s.liveedit_flags, 256 --[[ImGuiItemFlags.LiveEditOnInputScalar]]) ImGui.EndDisabled() if s.liveedit_override then - ImGui.PushItemFlag(ImGuiItemFlags.LiveEditOnInputText, bit32.band(s.liveedit_flags, ImGuiItemFlags.LiveEditOnInputText) ~= 0) - ImGui.PushItemFlag(ImGuiItemFlags.LiveEditOnInputScalar, bit32.band(s.liveedit_flags, ImGuiItemFlags.LiveEditOnInputScalar) ~= 0) + ImGui.PushItemFlag(128 --[[ImGuiItemFlags.LiveEditOnInputText]], bit32.band(s.liveedit_flags, 128 --[[ImGuiItemFlags.LiveEditOnInputText]]) ~= 0) + ImGui.PushItemFlag(256 --[[ImGuiItemFlags.LiveEditOnInputScalar]], bit32.band(s.liveedit_flags, 256 --[[ImGuiItemFlags.LiveEditOnInputScalar]]) ~= 0) end -- Submit selected items so we can query their status in the code following it. local ret = false local t = s.item_type if s.item_disabled then ImGui.BeginDisabled(true) end - if s.item_mixedvalue then ImGui.PushItemFlag(ImGuiItemFlags.MixedValue, true) end + if s.item_mixedvalue then ImGui.PushItemFlag(4096 --[[ImGuiItemFlags.MixedValue]], true) end if t == 0 then ImGui.Text("ITEM: Text") end -- Testing text items with no identifier/interaction if t == 1 then ret = ImGui.Button("ITEM: Button") end -- Testing button - if t == 2 then ImGui.PushItemFlag(ImGuiItemFlags.ButtonRepeat, true); ret = ImGui.Button("ITEM: Button"); ImGui.PopItemFlag() end -- Testing button (with repeater) + if t == 2 then ImGui.PushItemFlag(8 --[[ImGuiItemFlags.ButtonRepeat]], true); ret = ImGui.Button("ITEM: Button"); ImGui.PopItemFlag() end -- Testing button (with repeater) if t == 3 then ret, s.b = ImGui.Checkbox("ITEM: Checkbox", s.b) end -- Testing checkbox if t == 4 then s.col4f[1], ret = ImGui.SliderFloat("ITEM: SliderFloat", s.col4f[1], 0.0, 1.0) end -- Testing basic item if t == 5 then ret = ImGui.InputText("ITEM: InputText", s.str, 16) end -- Testing input text (which handles tabbing) @@ -28488,7 +28522,7 @@ function DemoWindowWidgetsQueryingStatuses() if t == 10 then ret = ImGui.Selectable("ITEM: Selectable") end -- Testing selectable item if t == 11 then ret = ImGui.MenuItem("ITEM: MenuItem") end -- Testing menu item (they use ImGuiButtonFlags.PressedOnRelease button policy) if t == 12 then ret = ImGui.TreeNode("ITEM: TreeNode"); if ret then ImGui.TreePop() end end -- Testing tree node - if t == 13 then ret = ImGui.TreeNodeEx("ITEM: TreeNode w/ ImGuiTreeNodeFlags_OpenOnDoubleClick", bit32.bor(ImGuiTreeNodeFlags.OpenOnDoubleClick, ImGuiTreeNodeFlags.NoTreePushOnOpen)) end -- Testing tree node with ImGuiButtonFlags.PressedOnDoubleClick button policy. + if t == 13 then ret = ImGui.TreeNodeEx("ITEM: TreeNode w/ ImGuiTreeNodeFlags_OpenOnDoubleClick", bit32.bor(64 --[[ImGuiTreeNodeFlags.OpenOnDoubleClick]], 8 --[[ImGuiTreeNodeFlags.NoTreePushOnOpen]])) end -- Testing tree node with ImGuiButtonFlags.PressedOnDoubleClick button policy. if t == 14 then s.combo, ret = ImGui.Combo("ITEM: Combo", s.combo, { "Apple", "Banana", "Cherry", "Kiwi" }) end if t == 15 then s.listbox, ret = ImGui.ListBox("ITEM: ListBox", s.listbox, { "Apple", "Banana", "Cherry", "Kiwi" }, 4, 4) end @@ -28525,7 +28559,7 @@ function DemoWindowWidgetsQueryingStatuses() if s.item_mixedvalue then ImGui.PopItemFlag() end if s.item_disabled then ImGui.EndDisabled() end - ImGui.InputText("unused", s.unused, 1, ImGuiInputTextFlags.ReadOnly) + ImGui.InputText("unused", s.unused, 1, 512 --[[ImGuiInputTextFlags.ReadOnly]]) ImGui.SameLine() HelpMarker("This widget is only here to be able to tab-out of the widgets above and see e.g. Deactivated() status.") ImGui.TreePop() @@ -28533,7 +28567,7 @@ function DemoWindowWidgetsQueryingStatuses() if ImGui.TreeNode("Querying Window Status (Focused/Hovered etc.)") then _, s.embed = ImGui.Checkbox("Embed everything inside a child window for testing _RootWindow flag.", s.embed) - if s.embed then ImGui.BeginChild("outer_child", ImVec2(0, ImGui.GetFontSize() * 20.0), ImGuiChildFlags.Borders) end + if s.embed then ImGui.BeginChild("outer_child", ImVec2(0, ImGui.GetFontSize() * 20.0), 1 --[[ImGuiChildFlags.Borders]]) end local FF, HF = ImGuiFocusedFlags, ImGuiHoveredFlags local bor = bit32.bor -- Testing IsWindowFocused() function with its various flags. @@ -28563,7 +28597,7 @@ function DemoWindowWidgetsQueryingStatuses() B(ImGui.IsWindowHovered(bor(HF.ChildWindows, HF.RootWindow, HF.DockHierarchy))), B(ImGui.IsWindowHovered(HF.RootWindow)), B(ImGui.IsWindowHovered(bor(HF.RootWindow, HF.NoPopupHierarchy))), B(ImGui.IsWindowHovered(bor(HF.RootWindow, HF.DockHierarchy))), B(ImGui.IsWindowHovered(bor(HF.ChildWindows, HF.AllowWhenBlockedByPopup))), B(ImGui.IsWindowHovered(HF.AnyWindow)), B(ImGui.IsWindowHovered(HF.Stationary))) - ImGui.BeginChild("child", ImVec2(0, 50), ImGuiChildFlags.Borders) + ImGui.BeginChild("child", ImVec2(0, 50), 1 --[[ImGuiChildFlags.Borders]]) ImGui.Text("This is another child window for testing the _ChildWindows flag.") ImGui.EndChild() if s.embed then ImGui.EndChild() end @@ -28612,7 +28646,7 @@ function DemoWindowWidgetsSelectables() _, b[1] = SelectableP("1. I am selectable", b[1]) _, b[2] = SelectableP("2. I am selectable", b[2]) _, b[3] = SelectableP("3. I am selectable", b[3]) - if ImGui.Selectable("4. I am double clickable", b[4], ImGuiSelectableFlags.AllowDoubleClick) then + if ImGui.Selectable("4. I am double clickable", b[4], 4 --[[ImGuiSelectableFlags.AllowDoubleClick]]) then if ImGui.IsMouseDoubleClicked(0) then b[4] = not b[4] end end ImGui.TreePop() @@ -28635,12 +28669,12 @@ function DemoWindowWidgetsSelectables() for n = 0, 4 do ImGui.PushID(n) ImGui.AlignTextToFramePadding() - if ImGui.Selectable("##selectable", s.selected_n == n, ImGuiSelectableFlags.AllowOverlap) then s.selected_n = n end + if ImGui.Selectable("##selectable", s.selected_n == n, 16 --[[ImGuiSelectableFlags.AllowOverlap]]) then s.selected_n = n end ImGui.SameLine(0, 0) _, s.checked[n + 1] = ImGui.Checkbox("##check", s.checked[n + 1]) ImGui.SameLine() local color = ImVec4((n % 2 == 1) and 1.0 or 0.2, (math.floor(n / 2) % 2 == 1) and 1.0 or 0.2, 0.2, 1.0) - ImGui.ColorButton("##color", color, ImGuiColorEditFlags.NoTooltip, ImVec2(color_marker_w, 0)) + ImGui.ColorButton("##color", color, 64 --[[ImGuiColorEditFlags.NoTooltip]], ImVec2(color_marker_w, 0)) ImGui.SameLine() ImGui.Text("Some label") ImGui.PopID() @@ -28663,7 +28697,7 @@ function DemoWindowWidgetsSelectables() for i = 0, 9 do ImGui.TableNextRow() ImGui.TableNextColumn() - _, sel[i + 1] = SelectableP(string.format("Item %d", i), sel[i + 1], ImGuiSelectableFlags.SpanAllColumns) + _, sel[i + 1] = SelectableP(string.format("Item %d", i), sel[i + 1], 2 --[[ImGuiSelectableFlags.SpanAllColumns]]) ImGui.TableNextColumn() ImGui.Text("Some other contents") ImGui.TableNextColumn() @@ -28682,7 +28716,7 @@ function DemoWindowWidgetsSelectables() local winning_state = true for y = 1, 4 do for x = 1, 4 do if g[y][x] == 0 then winning_state = false end end end -- If all cells are selected... if winning_state then - ImGui.PushStyleVar(ImGuiStyleVar.SelectableTextAlign, ImVec2(0.5 + 0.5 * math.cos(time * 2.0), 0.5 + 0.5 * math.sin(time * 3.0))) + ImGui.PushStyleVar(39 --[[ImGuiStyleVar.SelectableTextAlign]], ImVec2(0.5 + 0.5 * math.cos(time * 2.0), 0.5 + 0.5 * math.sin(time * 3.0))) end local size = ImGui.CalcTextSize("Sailor").x for y = 1, 4 do @@ -28712,8 +28746,8 @@ function DemoWindowWidgetsSelectables() local alignment = ImVec2(x / 2.0, y / 2.0) local name = string.format("(%.1f,%.1f)", alignment.x, alignment.y) if x > 0 then ImGui.SameLine() end - ImGui.PushStyleVar(ImGuiStyleVar.SelectableTextAlign, alignment) - _, s.align[3 * y + x + 1] = SelectableP(name, s.align[3 * y + x + 1], ImGuiSelectableFlags.None, ImVec2(size, size)) + ImGui.PushStyleVar(39 --[[ImGuiStyleVar.SelectableTextAlign]], alignment) + _, s.align[3 * y + x + 1] = SelectableP(name, s.align[3 * y + x + 1], 0 --[[ImGuiSelectableFlags.None]], ImVec2(size, size)) ImGui.PopStyleVar() end end @@ -28953,9 +28987,9 @@ function DemoWindowWidgetsTextFilter() local filter = S.tf.filter HelpMarker("Not a widget per-se, but ImGuiTextFilter is a helper to perform simple filtering on text strings.") ImGui.Text("Filter usage:\n \"\" display all lines\n xxx display lines containing \"xxx\"\n xxx yyy display lines containing \"xxx\" and \"yyy\"\n \"xxx yyy\" display lines containing \"xxx yyy\"\n xxx,yyy display lines containing \"xxx\" or \"yyy\"\n -xxx hide lines containing \"xxx\"") - ImGui.SetNextItemWidth(-FLT_MIN) + ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) filter:DrawWithHint("##Filter", "Filter (incl -excl)") - if ImGui.BeginChild("##items", ImVec2(-FLT_MIN, ImGui.GetTextLineHeightWithSpacing() * 15), ImGuiChildFlags.FrameStyle) then + if ImGui.BeginChild("##items", ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], ImGui.GetTextLineHeightWithSpacing() * 15), 128 --[[ImGuiChildFlags.FrameStyle]]) then for _, item in ipairs({ "aaa1.c", "bbb1.c", "ccc1.c", "aaa2.cpp", "bbb2.cpp", "ccc2.cpp", "abc.h", "hello, world" }) do if filter:PassFilter(item) then ImGui.TextUnformatted(item) end end @@ -28995,7 +29029,7 @@ function DemoWindowWidgetsTextInput() FlagBox("ml_flags", "AllowTabInput") ImGui.SameLine(); HelpMarker("When _AllowTabInput is set, passing through the widget with Tabbing doesn't automatically activate it, in order to also cycling through subsequent widgets.") FlagBox("ml_flags", "CtrlEnterForNewLine") - ImGui.InputTextMultiline("##source", s.text, 1024 * 16, ImVec2(-FLT_MIN, ImGui.GetTextLineHeight() * 16), s.ml_flags) + ImGui.InputTextMultiline("##source", s.text, 1024 * 16, ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], ImGui.GetTextLineHeight() * 16), s.ml_flags) ImGui.TreePop() end @@ -29038,11 +29072,11 @@ function DemoWindowWidgetsTextInput() if data.EventFlag == IT.CallbackCompletion then data:InsertChars(data.CursorPos, "..") elseif data.EventFlag == IT.CallbackHistory then - if data.EventKey == ImGuiKey.UpArrow then + if data.EventKey == 515 --[[ImGuiKey.UpArrow]] then data:DeleteChars(0, data.BufTextLen) data:InsertChars(0, "Pressed Up!") data:SelectAll() - elseif data.EventKey == ImGuiKey.DownArrow then + elseif data.EventKey == 516 --[[ImGuiKey.DownArrow]] then data:DeleteChars(0, data.BufTextLen) data:InsertChars(0, "Pressed Down!") data:SelectAll() @@ -29072,7 +29106,7 @@ function DemoWindowWidgetsTextInput() if ImGui.TreeNode("Resize Callback") then HelpMarker("Using ImGuiInputTextFlags_CallbackResize to wire your custom string type to InputText().\n\n(Lua port: fixed 1024 byte buffer, CallbackResize growth not supported)") FlagBox("rs_flags", "WordWrap") - ImGui.InputTextMultiline("##MyStr", s.rs, 1024, ImVec2(-FLT_MIN, ImGui.GetTextLineHeight() * 16), s.rs_flags) + ImGui.InputTextMultiline("##MyStr", s.rs, 1024, ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], ImGui.GetTextLineHeight() * 16), s.rs_flags) ImGui.Text("Size: %d\nCapacity: %d", #BufStr(s.rs) + 1, 1024) ImGui.TreePop() end @@ -29113,7 +29147,7 @@ function DemoWindowWidgetsTooltips() -- - Full-form (any contents): if IsItemHovered(...) and BeginTooltip() then Text("Hello"); EndTooltip() end HelpMarker("Tooltip are typically created by using a IsItemHovered() + SetTooltip() sequence.\n\nWe provide a helper SetItemTooltip() function to perform the two with standards flags.") - local sz = ImVec2(-FLT_MIN, 0.0) + local sz = ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], 0.0) ImGui.Button("Basic", sz) ImGui.SetItemTooltip("I am a tooltip") ImGui.Button("Fancy", sz) @@ -29183,7 +29217,7 @@ function DemoWindowWidgetsTreeNodes() for i = 0, 4 do -- Use SetNextItemOpen() so set the default state of a node to be open. We could -- also use TreeNodeEx() with the ImGuiTreeNodeFlags.DefaultOpen flag to achieve the same thing! - if i == 0 then ImGui.SetNextItemOpen(true, ImGuiCond.Once) end + if i == 0 then ImGui.SetNextItemOpen(true, 2 --[[ImGuiCond.Once]]) end -- Here we use PushID() to generate a unique base ID, and then the "" used as TreeNode id won't conflict. -- An alternative to using 'PushID() + TreeNode("", ...)' to generate a unique ID is to use 'TreeNode(i, ...)', @@ -29322,7 +29356,7 @@ function DemoWindowWidgetsVerticalSliders() if not ImGui.TreeNode("Vertical Sliders") then return end local s = S.vs local spacing = 4 - ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, ImVec2(spacing, spacing)) + ImGui.PushStyleVar(14 --[[ImGuiStyleVar.ItemSpacing]], ImVec2(spacing, spacing)) s.int_value = ImGui.VSliderInt("##int", ImVec2(18, 160), s.int_value, 0, 5) ImGui.SameLine() local values = s.values @@ -29330,10 +29364,10 @@ function DemoWindowWidgetsVerticalSliders() for i = 0, 6 do if i > 0 then ImGui.SameLine() end ImGui.PushID(i) - ImGui.PushStyleColor(ImGuiCol.FrameBg, HSV(i / 7.0, 0.5, 0.5)) - ImGui.PushStyleColor(ImGuiCol.FrameBgHovered, HSV(i / 7.0, 0.6, 0.5)) - ImGui.PushStyleColor(ImGuiCol.FrameBgActive, HSV(i / 7.0, 0.7, 0.5)) - ImGui.PushStyleColor(ImGuiCol.SliderGrab, HSV(i / 7.0, 0.9, 0.9)) + ImGui.PushStyleColor(7 --[[ImGuiCol.FrameBg]], HSV(i / 7.0, 0.5, 0.5)) + ImGui.PushStyleColor(8 --[[ImGuiCol.FrameBgHovered]], HSV(i / 7.0, 0.6, 0.5)) + ImGui.PushStyleColor(9 --[[ImGuiCol.FrameBgActive]], HSV(i / 7.0, 0.7, 0.5)) + ImGui.PushStyleColor(20 --[[ImGuiCol.SliderGrab]], HSV(i / 7.0, 0.9, 0.9)) values[i + 1] = ImGui.VSliderFloat("##v", ImVec2(18, 160), values[i + 1], 0.0, 1.0, "") if ImGui.IsItemActive() or ImGui.IsItemHovered() then ImGui.SetTooltip("%.3f", values[i + 1]) end ImGui.PopStyleColor(4) @@ -29363,7 +29397,7 @@ function DemoWindowWidgetsVerticalSliders() for i = 0, 3 do if i > 0 then ImGui.SameLine() end ImGui.PushID(i) - ImGui.PushStyleVar(ImGuiStyleVar.GrabMinSize, 40) + ImGui.PushStyleVar(21 --[[ImGuiStyleVar.GrabMinSize]], 40) values[i + 1] = ImGui.VSliderFloat("##v", ImVec2(40, 160), values[i + 1], 0.0, 1.0, "%.2f\nsec") ImGui.PopStyleVar() ImGui.PopID() @@ -29409,7 +29443,7 @@ function ShowExampleMenuFile() ImGui.Separator() if ImGui.BeginMenu("Options") then _, s.enabled = ImGui.MenuItem("Enabled", "", s.enabled) - ImGui.BeginChild("child", ImVec2(0, ImGui.GetTextLineHeightWithSpacing() * 5.0), ImGuiChildFlags.Borders) + ImGui.BeginChild("child", ImVec2(0, ImGui.GetTextLineHeightWithSpacing() * 5.0), 1 --[[ImGuiChildFlags.Borders]]) for i = 0, 9 do ImGui.Text("Scrolling Text %d", i) end ImGui.EndChild() s.f = ImGui.SliderFloat("Value", s.f, 0.0, 1.0) @@ -29420,7 +29454,7 @@ function ShowExampleMenuFile() if ImGui.BeginMenu("Colors") then local sz = ImGui.GetTextLineHeight() - for i = 0, ImGuiCol.COUNT - 1 do + for i = 0, 63 --[[ImGuiCol.COUNT]] - 1 do local name = ImGui.GetStyleColorName(i) local p = ImGui.GetCursorScreenPos() ImGui.GetWindowDrawList():AddRectFilled(p, ImVec2(p.x + sz, p.y + sz), ImGui.GetColorU32(i)) @@ -29440,7 +29474,7 @@ function ShowExampleMenuFile() end if ImGui.BeginMenu("Disabled", false) then -- Disabled - IM_ASSERT(false) + assert(false) end if ImGui.MenuItem("Checked", nil, true) then end ImGui.Separator() @@ -29509,7 +29543,7 @@ function ImGui.ShowStyleSelector(label) local ret = false if ImGui.BeginCombo(label, style_names[s.style_idx + 1] or "") then for n = 0, 2 do - if ImGui.Selectable(style_names[n + 1], s.style_idx == n, ImGuiSelectableFlags.SelectOnNav) then + if ImGui.Selectable(style_names[n + 1], s.style_idx == n, 64 --[[ImGuiSelectableFlags.SelectOnNav]]) then s.style_idx = n ret = true if n == 0 then ImGui.StyleColorsDark() elseif n == 1 then ImGui.StyleColorsLight() else ImGui.StyleColorsClassic() end @@ -29555,7 +29589,7 @@ function ImGui.ShowStyleEditor(ref) -- General ImGui.SeparatorText("General") - if bit32.band(ImGui.GetIO().BackendFlags, ImGuiBackendFlags.RendererHasTextures) == 0 then + if bit32.band(ImGui.GetIO().BackendFlags, 16 --[[ImGuiBackendFlags.RendererHasTextures]]) == 0 then ImGui.BulletText("Warning: Font scaling will NOT be smooth, because\nImGuiBackendFlags_RendererHasTextures is not set!") ImGui.BulletText("For instructions, see:") ImGui.SameLine() @@ -29591,7 +29625,7 @@ function ImGui.ShowStyleEditor(ref) HelpMarker("Save/Revert in local non-persistent storage. Default Colors definition are not affected. Use \"Export\" below to save them somewhere.") ImGui.SeparatorText("Details") - if ImGui.BeginTabBar("##tabs", ImGuiTabBarFlags.None) then + if ImGui.BeginTabBar("##tabs", 0 --[[ImGuiTabBarFlags.None]]) then if ImGui.BeginTabItem("Sizes") then ImGui.SeparatorText("Main") SF2("WindowPadding", 0.0, 20.0); SF2("FramePadding", 0.0, 20.0); SF2("ItemSpacing", 0.0, 20.0) @@ -29682,7 +29716,7 @@ function ImGui.ShowStyleEditor(ref) if ImGui.Button("Export") then if se.output_dest == 0 then ImGui.LogToClipboard() else ImGui.LogToTTY() end ImGui.LogText("ImVec4* colors = GetStyle().Colors;\n") - for i = 0, ImGuiCol.COUNT - 1 do + for i = 0, 63 --[[ImGuiCol.COUNT]] - 1 do local col = style.Colors[i] local name = ImGui.GetStyleColorName(i) if not se.output_only_modified or not ColorsEqual(col, ref.Colors[i]) then @@ -29702,15 +29736,15 @@ function ImGui.ShowStyleEditor(ref) HelpMarker("In the color list:\nLeft-click on color square to open color picker,\nRight-click to open edit options menu.") se.filter = se.filter or ImGuiTextFilter() - ImGui.SetNextItemWidth(-FLT_MIN) + ImGui.SetNextItemWidth(-1.1754943508223e-38 --[[FLT_MIN]]) se.filter:DrawWithHint("##FilterColors", "Filter Colors (incl -excl)") - ImGui.SetNextWindowSizeConstraints(ImVec2(0.0, ImGui.GetTextLineHeightWithSpacing() * 10), ImVec2(FLT_MAX, FLT_MAX)) - ImGui.BeginChild("##colors", ImVec2(0, 0), bit32.bor(ImGuiChildFlags.Borders, ImGuiChildFlags.NavFlattened), bit32.bor(ImGuiWindowFlags.AlwaysVerticalScrollbar, ImGuiWindowFlags.AlwaysHorizontalScrollbar)) + ImGui.SetNextWindowSizeConstraints(ImVec2(0.0, ImGui.GetTextLineHeightWithSpacing() * 10), ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]])) + ImGui.BeginChild("##colors", ImVec2(0, 0), bit32.bor(1 --[[ImGuiChildFlags.Borders]], 256 --[[ImGuiChildFlags.NavFlattened]]), bit32.bor(16384 --[[ImGuiWindowFlags.AlwaysVerticalScrollbar]], 32768 --[[ImGuiWindowFlags.AlwaysHorizontalScrollbar]])) ImGui.PushItemWidth(ImGui.GetFontSize() * -12) -- [Luau] clipped: only visible rows are submitted (upstream submits every color) local visible_cols = {} - for i = 0, ImGuiCol.COUNT - 1 do + for i = 0, 63 --[[ImGuiCol.COUNT]] - 1 do if se.filter:PassFilter(ImGui.GetStyleColorName(i)) then visible_cols[#visible_cols + 1] = i end end local clipper = ImGuiListClipper() @@ -29767,7 +29801,7 @@ function ImGui.ShowStyleEditor(ref) style.CurveTessellationTol = curve_err * curve_err -- When editing the "Circle Segment Max Error" value, draw a preview of its effect on auto-tessellated circles. - style.CircleTessellationMaxError = ImGui.DragFloat("Circle Tessellation Max Error", style.CircleTessellationMaxError, 0.005, 0.10, 5.0, "%.2f", ImGuiSliderFlags.AlwaysClamp) + style.CircleTessellationMaxError = ImGui.DragFloat("Circle Tessellation Max Error", style.CircleTessellationMaxError, 0.005, 0.10, 5.0, "%.2f", 1536 --[[ImGuiSliderFlags.AlwaysClamp]]) local show_samples = ImGui.IsItemActive() if show_samples then ImGui.SetNextWindowPos(ImGui.GetCursorScreenPos()) end if show_samples and ImGui.BeginTooltip() then @@ -29786,7 +29820,7 @@ function ImGui.ShowStyleEditor(ref) local offset_x = math.floor(canvas_width * 0.5) local offset_y = math.floor(RAD_MAX) local p1 = ImGui.GetCursorScreenPos() - draw_list:AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad, ImGui.GetColorU32(ImGuiCol.Text)) + draw_list:AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad, ImGui.GetColorU32(0 --[[ImGuiCol.Text]])) ImGui.Dummy(ImVec2(canvas_width, RAD_MAX * 2)) -- local p2 = ImGui.GetCursorScreenPos() @@ -29824,9 +29858,9 @@ local _ local show_config_info = false function ImGui.ShowAboutWindow(p_open) local visible - p_open, visible = ImGui.Begin("About Dear ImGui", p_open, ImGuiWindowFlags.AlwaysAutoResize) + p_open, visible = ImGui.Begin("About Dear ImGui", p_open, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) if not visible then ImGui.End(); return p_open end - ImGui.Text("Dear ImGui %s (%d)", IMGUI_VERSION, IMGUI_VERSION_NUM) + ImGui.Text("Dear ImGui %s (%d)", IMGUI_VERSION, 19298 --[[IMGUI_VERSION_NUM]]) ImGui.TextLinkOpenURL("Homepage", "https://github.com/ocornut/imgui"); ImGui.SameLine() ImGui.TextLinkOpenURL("FAQ", "https://github.com/ocornut/imgui/blob/master/docs/FAQ.md"); ImGui.SameLine() ImGui.TextLinkOpenURL("Wiki", "https://github.com/ocornut/imgui/wiki"); ImGui.SameLine() @@ -29846,13 +29880,13 @@ function ImGui.ShowAboutWindow(p_open) local style = ImGui.GetStyle() local copy_to_clipboard = ImGui.Button("Copy to clipboard") local child_size = ImVec2(0, ImGui.GetTextLineHeightWithSpacing() * 18) - ImGui.BeginChild(ImGui.GetID("cfg_infos"), child_size, ImGuiChildFlags.FrameStyle) + ImGui.BeginChild(ImGui.GetID("cfg_infos"), child_size, 128 --[[ImGuiChildFlags.FrameStyle]]) if copy_to_clipboard then ImGui.LogToClipboard() ImGui.LogText("// (Copy from the next line. Keep the ``` markers for formatting.)\n") ImGui.LogText("```cpp\n") -- Back quotes will make text appears without formatting when pasting on GitHub end - ImGui.Text("Dear ImGui %s (%d)", IMGUI_VERSION, IMGUI_VERSION_NUM) + ImGui.Text("Dear ImGui %s (%d)", IMGUI_VERSION, 19298 --[[IMGUI_VERSION_NUM]]) ImGui.Separator() ImGui.Text("define: IMGUI_HAS_VIEWPORT") ImGui.Text("define: IMGUI_HAS_DOCK") @@ -30040,69 +30074,69 @@ function ImGui.StyleColorsDark(dst) local style = dst and dst or ImGui.GetStyle() local colors = style.Colors - colors[ImGuiCol.Text] = ImVec4(1.00, 1.00, 1.00, 1.00) - colors[ImGuiCol.TextDisabled] = ImVec4(0.50, 0.50, 0.50, 1.00) - colors[ImGuiCol.WindowBg] = ImVec4(0.06, 0.06, 0.06, 0.94) - colors[ImGuiCol.ChildBg] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.PopupBg] = ImVec4(0.08, 0.08, 0.08, 0.94) - colors[ImGuiCol.Border] = ImVec4(0.43, 0.43, 0.50, 0.50) - colors[ImGuiCol.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.FrameBg] = ImVec4(0.16, 0.29, 0.48, 0.54) - colors[ImGuiCol.FrameBgHovered] = ImVec4(0.26, 0.59, 0.98, 0.40) - colors[ImGuiCol.FrameBgActive] = ImVec4(0.26, 0.59, 0.98, 0.67) - colors[ImGuiCol.TitleBg] = ImVec4(0.04, 0.04, 0.04, 1.00) - colors[ImGuiCol.TitleBgActive] = ImVec4(0.16, 0.29, 0.48, 1.00) - colors[ImGuiCol.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.51) - colors[ImGuiCol.MenuBarBg] = ImVec4(0.14, 0.14, 0.14, 1.00) - colors[ImGuiCol.ScrollbarBg] = ImVec4(0.02, 0.02, 0.02, 0.53) - colors[ImGuiCol.ScrollbarGrab] = ImVec4(0.31, 0.31, 0.31, 1.00) - colors[ImGuiCol.ScrollbarGrabHovered] = ImVec4(0.41, 0.41, 0.41, 1.00) - colors[ImGuiCol.ScrollbarGrabActive] = ImVec4(0.51, 0.51, 0.51, 1.00) - colors[ImGuiCol.CheckMark] = ImVec4(0.26, 0.59, 0.98, 1.00) - colors[ImGuiCol.CheckboxSelectedBg] = ImLerpV4V4F(colors[ImGuiCol.FrameBg], colors[ImGuiCol.FrameBgHovered], 0.65) - colors[ImGuiCol.SliderGrab] = ImVec4(0.24, 0.52, 0.88, 1.00) - colors[ImGuiCol.SliderGrabActive] = ImVec4(0.26, 0.59, 0.98, 1.00) - colors[ImGuiCol.Button] = ImVec4(0.26, 0.59, 0.98, 0.40) - colors[ImGuiCol.ButtonHovered] = ImVec4(0.26, 0.59, 0.98, 1.00) - colors[ImGuiCol.ButtonActive] = ImVec4(0.06, 0.53, 0.98, 1.00) - colors[ImGuiCol.Header] = ImVec4(0.26, 0.59, 0.98, 0.31) - colors[ImGuiCol.HeaderHovered] = ImVec4(0.26, 0.59, 0.98, 0.80) - colors[ImGuiCol.HeaderActive] = ImVec4(0.26, 0.59, 0.98, 1.00) - colors[ImGuiCol.Separator] = colors[ImGuiCol.Border] - colors[ImGuiCol.SeparatorHovered] = ImVec4(0.10, 0.40, 0.75, 0.78) - colors[ImGuiCol.SeparatorActive] = ImVec4(0.10, 0.40, 0.75, 1.00) - colors[ImGuiCol.ResizeGrip] = ImVec4(0.26, 0.59, 0.98, 0.20) - colors[ImGuiCol.ResizeGripHovered] = ImVec4(0.26, 0.59, 0.98, 0.67) - colors[ImGuiCol.ResizeGripActive] = ImVec4(0.26, 0.59, 0.98, 0.95) - colors[ImGuiCol.InputTextCursor] = colors[ImGuiCol.Text] - colors[ImGuiCol.TabHovered] = colors[ImGuiCol.HeaderHovered] - colors[ImGuiCol.Tab] = ImLerpV4V4F(colors[ImGuiCol.Header], colors[ImGuiCol.TitleBgActive], 0.80) - colors[ImGuiCol.TabSelected] = ImLerpV4V4F(colors[ImGuiCol.HeaderActive], colors[ImGuiCol.TitleBgActive], 0.60) - colors[ImGuiCol.TabSelectedOverline] = colors[ImGuiCol.HeaderActive] - colors[ImGuiCol.TabDimmed] = ImLerpV4V4F(colors[ImGuiCol.Tab], colors[ImGuiCol.TitleBg], 0.80) - colors[ImGuiCol.TabDimmedSelected] = ImLerpV4V4F(colors[ImGuiCol.TabSelected], colors[ImGuiCol.TitleBg], 0.40) - colors[ImGuiCol.TabDimmedSelectedOverline] = ImVec4(0.50, 0.50, 0.50, 0.00) - colors[ImGuiCol.DockingPreview] = ImVec4(colors[ImGuiCol.HeaderActive].x, colors[ImGuiCol.HeaderActive].y, colors[ImGuiCol.HeaderActive].z, colors[ImGuiCol.HeaderActive].w * 0.7) - colors[ImGuiCol.DockingEmptyBg] = ImVec4(0.20, 0.20, 0.20, 1.00) - colors[ImGuiCol.PlotLines] = ImVec4(0.61, 0.61, 0.61, 1.00) - colors[ImGuiCol.PlotLinesHovered] = ImVec4(1.00, 0.43, 0.35, 1.00) - colors[ImGuiCol.PlotHistogram] = ImVec4(0.90, 0.70, 0.00, 1.00) - colors[ImGuiCol.PlotHistogramHovered] = ImVec4(1.00, 0.60, 0.00, 1.00) - colors[ImGuiCol.TableHeaderBg] = ImVec4(0.19, 0.19, 0.20, 1.00) - colors[ImGuiCol.TableBorderStrong] = ImVec4(0.31, 0.31, 0.35, 1.00) -- Prefer using Alpha=1.0 here - colors[ImGuiCol.TableBorderLight] = ImVec4(0.23, 0.23, 0.25, 1.00) -- Prefer using Alpha=1.0 here - colors[ImGuiCol.TableRowBg] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.TableRowBgAlt] = ImVec4(1.00, 1.00, 1.00, 0.06) - colors[ImGuiCol.TextLink] = colors[ImGuiCol.HeaderActive] - colors[ImGuiCol.TextSelectedBg] = ImVec4(0.26, 0.59, 0.98, 0.35) - colors[ImGuiCol.TreeLines] = colors[ImGuiCol.Border] - colors[ImGuiCol.DragDropTarget] = ImVec4(1.00, 1.00, 0.00, 0.90) - colors[ImGuiCol.DragDropTargetBg] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.UnsavedMarker] = ImVec4(1.00, 1.00, 1.00, 1.00) - colors[ImGuiCol.NavCursor] = ImVec4(0.26, 0.59, 0.98, 1.00) - colors[ImGuiCol.NavWindowingHighlight] = ImVec4(1.00, 1.00, 1.00, 0.70) - colors[ImGuiCol.NavWindowingDimBg] = ImVec4(0.80, 0.80, 0.80, 0.20) - colors[ImGuiCol.ModalWindowDimBg] = ImVec4(0.80, 0.80, 0.80, 0.35) + colors[0 --[[ImGuiCol.Text]]] = ImVec4(1.00, 1.00, 1.00, 1.00) + colors[1 --[[ImGuiCol.TextDisabled]]] = ImVec4(0.50, 0.50, 0.50, 1.00) + colors[2 --[[ImGuiCol.WindowBg]]] = ImVec4(0.06, 0.06, 0.06, 0.94) + colors[3 --[[ImGuiCol.ChildBg]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[4 --[[ImGuiCol.PopupBg]]] = ImVec4(0.08, 0.08, 0.08, 0.94) + colors[5 --[[ImGuiCol.Border]]] = ImVec4(0.43, 0.43, 0.50, 0.50) + colors[6 --[[ImGuiCol.BorderShadow]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[7 --[[ImGuiCol.FrameBg]]] = ImVec4(0.16, 0.29, 0.48, 0.54) + colors[8 --[[ImGuiCol.FrameBgHovered]]] = ImVec4(0.26, 0.59, 0.98, 0.40) + colors[9 --[[ImGuiCol.FrameBgActive]]] = ImVec4(0.26, 0.59, 0.98, 0.67) + colors[10 --[[ImGuiCol.TitleBg]]] = ImVec4(0.04, 0.04, 0.04, 1.00) + colors[11 --[[ImGuiCol.TitleBgActive]]] = ImVec4(0.16, 0.29, 0.48, 1.00) + colors[12 --[[ImGuiCol.TitleBgCollapsed]]] = ImVec4(0.00, 0.00, 0.00, 0.51) + colors[13 --[[ImGuiCol.MenuBarBg]]] = ImVec4(0.14, 0.14, 0.14, 1.00) + colors[14 --[[ImGuiCol.ScrollbarBg]]] = ImVec4(0.02, 0.02, 0.02, 0.53) + colors[15 --[[ImGuiCol.ScrollbarGrab]]] = ImVec4(0.31, 0.31, 0.31, 1.00) + colors[16 --[[ImGuiCol.ScrollbarGrabHovered]]] = ImVec4(0.41, 0.41, 0.41, 1.00) + colors[17 --[[ImGuiCol.ScrollbarGrabActive]]] = ImVec4(0.51, 0.51, 0.51, 1.00) + colors[18 --[[ImGuiCol.CheckMark]]] = ImVec4(0.26, 0.59, 0.98, 1.00) + colors[19 --[[ImGuiCol.CheckboxSelectedBg]]] = ImLerpV4V4F(colors[7 --[[ImGuiCol.FrameBg]]], colors[8 --[[ImGuiCol.FrameBgHovered]]], 0.65) + colors[20 --[[ImGuiCol.SliderGrab]]] = ImVec4(0.24, 0.52, 0.88, 1.00) + colors[21 --[[ImGuiCol.SliderGrabActive]]] = ImVec4(0.26, 0.59, 0.98, 1.00) + colors[22 --[[ImGuiCol.Button]]] = ImVec4(0.26, 0.59, 0.98, 0.40) + colors[23 --[[ImGuiCol.ButtonHovered]]] = ImVec4(0.26, 0.59, 0.98, 1.00) + colors[24 --[[ImGuiCol.ButtonActive]]] = ImVec4(0.06, 0.53, 0.98, 1.00) + colors[25 --[[ImGuiCol.Header]]] = ImVec4(0.26, 0.59, 0.98, 0.31) + colors[26 --[[ImGuiCol.HeaderHovered]]] = ImVec4(0.26, 0.59, 0.98, 0.80) + colors[27 --[[ImGuiCol.HeaderActive]]] = ImVec4(0.26, 0.59, 0.98, 1.00) + colors[28 --[[ImGuiCol.Separator]]] = colors[5 --[[ImGuiCol.Border]]] + colors[29 --[[ImGuiCol.SeparatorHovered]]] = ImVec4(0.10, 0.40, 0.75, 0.78) + colors[30 --[[ImGuiCol.SeparatorActive]]] = ImVec4(0.10, 0.40, 0.75, 1.00) + colors[31 --[[ImGuiCol.ResizeGrip]]] = ImVec4(0.26, 0.59, 0.98, 0.20) + colors[32 --[[ImGuiCol.ResizeGripHovered]]] = ImVec4(0.26, 0.59, 0.98, 0.67) + colors[33 --[[ImGuiCol.ResizeGripActive]]] = ImVec4(0.26, 0.59, 0.98, 0.95) + colors[34 --[[ImGuiCol.InputTextCursor]]] = colors[0 --[[ImGuiCol.Text]]] + colors[35 --[[ImGuiCol.TabHovered]]] = colors[26 --[[ImGuiCol.HeaderHovered]]] + colors[36 --[[ImGuiCol.Tab]]] = ImLerpV4V4F(colors[25 --[[ImGuiCol.Header]]], colors[11 --[[ImGuiCol.TitleBgActive]]], 0.80) + colors[37 --[[ImGuiCol.TabSelected]]] = ImLerpV4V4F(colors[27 --[[ImGuiCol.HeaderActive]]], colors[11 --[[ImGuiCol.TitleBgActive]]], 0.60) + colors[38 --[[ImGuiCol.TabSelectedOverline]]] = colors[27 --[[ImGuiCol.HeaderActive]]] + colors[39 --[[ImGuiCol.TabDimmed]]] = ImLerpV4V4F(colors[36 --[[ImGuiCol.Tab]]], colors[10 --[[ImGuiCol.TitleBg]]], 0.80) + colors[40 --[[ImGuiCol.TabDimmedSelected]]] = ImLerpV4V4F(colors[37 --[[ImGuiCol.TabSelected]]], colors[10 --[[ImGuiCol.TitleBg]]], 0.40) + colors[41 --[[ImGuiCol.TabDimmedSelectedOverline]]] = ImVec4(0.50, 0.50, 0.50, 0.00) + colors[42 --[[ImGuiCol.DockingPreview]]] = ImVec4(colors[27 --[[ImGuiCol.HeaderActive]]].x, colors[27 --[[ImGuiCol.HeaderActive]]].y, colors[27 --[[ImGuiCol.HeaderActive]]].z, colors[27 --[[ImGuiCol.HeaderActive]]].w * 0.7) + colors[43 --[[ImGuiCol.DockingEmptyBg]]] = ImVec4(0.20, 0.20, 0.20, 1.00) + colors[44 --[[ImGuiCol.PlotLines]]] = ImVec4(0.61, 0.61, 0.61, 1.00) + colors[45 --[[ImGuiCol.PlotLinesHovered]]] = ImVec4(1.00, 0.43, 0.35, 1.00) + colors[46 --[[ImGuiCol.PlotHistogram]]] = ImVec4(0.90, 0.70, 0.00, 1.00) + colors[47 --[[ImGuiCol.PlotHistogramHovered]]] = ImVec4(1.00, 0.60, 0.00, 1.00) + colors[48 --[[ImGuiCol.TableHeaderBg]]] = ImVec4(0.19, 0.19, 0.20, 1.00) + colors[49 --[[ImGuiCol.TableBorderStrong]]] = ImVec4(0.31, 0.31, 0.35, 1.00) -- Prefer using Alpha=1.0 here + colors[50 --[[ImGuiCol.TableBorderLight]]] = ImVec4(0.23, 0.23, 0.25, 1.00) -- Prefer using Alpha=1.0 here + colors[51 --[[ImGuiCol.TableRowBg]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[52 --[[ImGuiCol.TableRowBgAlt]]] = ImVec4(1.00, 1.00, 1.00, 0.06) + colors[53 --[[ImGuiCol.TextLink]]] = colors[27 --[[ImGuiCol.HeaderActive]]] + colors[54 --[[ImGuiCol.TextSelectedBg]]] = ImVec4(0.26, 0.59, 0.98, 0.35) + colors[55 --[[ImGuiCol.TreeLines]]] = colors[5 --[[ImGuiCol.Border]]] + colors[56 --[[ImGuiCol.DragDropTarget]]] = ImVec4(1.00, 1.00, 0.00, 0.90) + colors[57 --[[ImGuiCol.DragDropTargetBg]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[58 --[[ImGuiCol.UnsavedMarker]]] = ImVec4(1.00, 1.00, 1.00, 1.00) + colors[59 --[[ImGuiCol.NavCursor]]] = ImVec4(0.26, 0.59, 0.98, 1.00) + colors[60 --[[ImGuiCol.NavWindowingHighlight]]] = ImVec4(1.00, 1.00, 1.00, 0.70) + colors[61 --[[ImGuiCol.NavWindowingDimBg]]] = ImVec4(0.80, 0.80, 0.80, 0.20) + colors[62 --[[ImGuiCol.ModalWindowDimBg]]] = ImVec4(0.80, 0.80, 0.80, 0.35) end --- @param dst? ImGuiStyle @@ -30110,69 +30144,69 @@ function ImGui.StyleColorsClassic(dst) local style = dst and dst or ImGui.GetStyle() local colors = style.Colors - colors[ImGuiCol.Text] = ImVec4(0.90, 0.90, 0.90, 1.00) - colors[ImGuiCol.TextDisabled] = ImVec4(0.60, 0.60, 0.60, 1.00) - colors[ImGuiCol.WindowBg] = ImVec4(0.00, 0.00, 0.00, 0.85) - colors[ImGuiCol.ChildBg] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.PopupBg] = ImVec4(0.11, 0.11, 0.14, 0.92) - colors[ImGuiCol.Border] = ImVec4(0.50, 0.50, 0.50, 0.50) - colors[ImGuiCol.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.FrameBg] = ImVec4(0.43, 0.43, 0.43, 0.39) - colors[ImGuiCol.FrameBgHovered] = ImVec4(0.47, 0.47, 0.69, 0.40) - colors[ImGuiCol.FrameBgActive] = ImVec4(0.42, 0.41, 0.64, 0.69) - colors[ImGuiCol.TitleBg] = ImVec4(0.27, 0.27, 0.54, 0.83) - colors[ImGuiCol.TitleBgActive] = ImVec4(0.32, 0.32, 0.63, 0.87) - colors[ImGuiCol.TitleBgCollapsed] = ImVec4(0.40, 0.40, 0.80, 0.20) - colors[ImGuiCol.MenuBarBg] = ImVec4(0.40, 0.40, 0.55, 0.80) - colors[ImGuiCol.ScrollbarBg] = ImVec4(0.20, 0.25, 0.30, 0.60) - colors[ImGuiCol.ScrollbarGrab] = ImVec4(0.40, 0.40, 0.80, 0.30) - colors[ImGuiCol.ScrollbarGrabHovered] = ImVec4(0.40, 0.40, 0.80, 0.40) - colors[ImGuiCol.ScrollbarGrabActive] = ImVec4(0.41, 0.39, 0.80, 0.60) - colors[ImGuiCol.CheckMark] = ImVec4(0.90, 0.90, 0.90, 0.50) - colors[ImGuiCol.CheckboxSelectedBg] = ImLerpV4V4F(colors[ImGuiCol.FrameBg], colors[ImGuiCol.FrameBgActive], 0.65) - colors[ImGuiCol.SliderGrab] = ImVec4(1.00, 1.00, 1.00, 0.30) - colors[ImGuiCol.SliderGrabActive] = ImVec4(0.41, 0.39, 0.80, 0.60) - colors[ImGuiCol.Button] = ImVec4(0.35, 0.40, 0.61, 0.62) - colors[ImGuiCol.ButtonHovered] = ImVec4(0.40, 0.48, 0.71, 0.79) - colors[ImGuiCol.ButtonActive] = ImVec4(0.46, 0.54, 0.80, 1.00) - colors[ImGuiCol.Header] = ImVec4(0.40, 0.40, 0.90, 0.45) - colors[ImGuiCol.HeaderHovered] = ImVec4(0.45, 0.45, 0.90, 0.80) - colors[ImGuiCol.HeaderActive] = ImVec4(0.53, 0.53, 0.87, 0.80) - colors[ImGuiCol.Separator] = ImVec4(0.50, 0.50, 0.50, 0.60) - colors[ImGuiCol.SeparatorHovered] = ImVec4(0.60, 0.60, 0.70, 1.00) - colors[ImGuiCol.SeparatorActive] = ImVec4(0.70, 0.70, 0.90, 1.00) - colors[ImGuiCol.ResizeGrip] = ImVec4(1.00, 1.00, 1.00, 0.10) - colors[ImGuiCol.ResizeGripHovered] = ImVec4(0.78, 0.82, 1.00, 0.60) - colors[ImGuiCol.ResizeGripActive] = ImVec4(0.78, 0.82, 1.00, 0.90) - colors[ImGuiCol.InputTextCursor] = colors[ImGuiCol.Text] - colors[ImGuiCol.TabHovered] = colors[ImGuiCol.HeaderHovered] - colors[ImGuiCol.Tab] = ImLerpV4V4F(colors[ImGuiCol.Header], colors[ImGuiCol.TitleBgActive], 0.80) - colors[ImGuiCol.TabSelected] = ImLerpV4V4F(colors[ImGuiCol.HeaderActive], colors[ImGuiCol.TitleBgActive], 0.60) - colors[ImGuiCol.TabSelectedOverline] = colors[ImGuiCol.HeaderActive] - colors[ImGuiCol.TabDimmed] = ImLerpV4V4F(colors[ImGuiCol.Tab], colors[ImGuiCol.TitleBg], 0.80) - colors[ImGuiCol.TabDimmedSelected] = ImLerpV4V4F(colors[ImGuiCol.TabSelected], colors[ImGuiCol.TitleBg], 0.40) - colors[ImGuiCol.TabDimmedSelectedOverline] = ImVec4(0.53, 0.53, 0.87, 0.00) - colors[ImGuiCol.DockingPreview] = ImVec4(colors[ImGuiCol.Header].x, colors[ImGuiCol.Header].y, colors[ImGuiCol.Header].z, colors[ImGuiCol.Header].w * 0.7) - colors[ImGuiCol.DockingEmptyBg] = ImVec4(0.20, 0.20, 0.20, 1.00) - colors[ImGuiCol.PlotLines] = ImVec4(1.00, 1.00, 1.00, 1.00) - colors[ImGuiCol.PlotLinesHovered] = ImVec4(0.90, 0.70, 0.00, 1.00) - colors[ImGuiCol.PlotHistogram] = ImVec4(0.90, 0.70, 0.00, 1.00) - colors[ImGuiCol.PlotHistogramHovered] = ImVec4(1.00, 0.60, 0.00, 1.00) - colors[ImGuiCol.TableHeaderBg] = ImVec4(0.27, 0.27, 0.38, 1.00) - colors[ImGuiCol.TableBorderStrong] = ImVec4(0.31, 0.31, 0.45, 1.00) -- Prefer using Alpha=1.0 here - colors[ImGuiCol.TableBorderLight] = ImVec4(0.26, 0.26, 0.28, 1.00) -- Prefer using Alpha=1.0 here - colors[ImGuiCol.TableRowBg] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.TableRowBgAlt] = ImVec4(1.00, 1.00, 1.00, 0.07) - colors[ImGuiCol.TextLink] = colors[ImGuiCol.HeaderActive] - colors[ImGuiCol.TextSelectedBg] = ImVec4(0.00, 0.00, 1.00, 0.35) - colors[ImGuiCol.TreeLines] = colors[ImGuiCol.Border] - colors[ImGuiCol.DragDropTarget] = ImVec4(1.00, 1.00, 0.00, 0.90) - colors[ImGuiCol.DragDropTargetBg] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.UnsavedMarker] = ImVec4(0.90, 0.90, 0.90, 1.00) - colors[ImGuiCol.NavCursor] = colors[ImGuiCol.HeaderHovered] - colors[ImGuiCol.NavWindowingHighlight] = ImVec4(1.00, 1.00, 1.00, 0.70) - colors[ImGuiCol.NavWindowingDimBg] = ImVec4(0.80, 0.80, 0.80, 0.20) - colors[ImGuiCol.ModalWindowDimBg] = ImVec4(0.20, 0.20, 0.20, 0.35) + colors[0 --[[ImGuiCol.Text]]] = ImVec4(0.90, 0.90, 0.90, 1.00) + colors[1 --[[ImGuiCol.TextDisabled]]] = ImVec4(0.60, 0.60, 0.60, 1.00) + colors[2 --[[ImGuiCol.WindowBg]]] = ImVec4(0.00, 0.00, 0.00, 0.85) + colors[3 --[[ImGuiCol.ChildBg]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[4 --[[ImGuiCol.PopupBg]]] = ImVec4(0.11, 0.11, 0.14, 0.92) + colors[5 --[[ImGuiCol.Border]]] = ImVec4(0.50, 0.50, 0.50, 0.50) + colors[6 --[[ImGuiCol.BorderShadow]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[7 --[[ImGuiCol.FrameBg]]] = ImVec4(0.43, 0.43, 0.43, 0.39) + colors[8 --[[ImGuiCol.FrameBgHovered]]] = ImVec4(0.47, 0.47, 0.69, 0.40) + colors[9 --[[ImGuiCol.FrameBgActive]]] = ImVec4(0.42, 0.41, 0.64, 0.69) + colors[10 --[[ImGuiCol.TitleBg]]] = ImVec4(0.27, 0.27, 0.54, 0.83) + colors[11 --[[ImGuiCol.TitleBgActive]]] = ImVec4(0.32, 0.32, 0.63, 0.87) + colors[12 --[[ImGuiCol.TitleBgCollapsed]]] = ImVec4(0.40, 0.40, 0.80, 0.20) + colors[13 --[[ImGuiCol.MenuBarBg]]] = ImVec4(0.40, 0.40, 0.55, 0.80) + colors[14 --[[ImGuiCol.ScrollbarBg]]] = ImVec4(0.20, 0.25, 0.30, 0.60) + colors[15 --[[ImGuiCol.ScrollbarGrab]]] = ImVec4(0.40, 0.40, 0.80, 0.30) + colors[16 --[[ImGuiCol.ScrollbarGrabHovered]]] = ImVec4(0.40, 0.40, 0.80, 0.40) + colors[17 --[[ImGuiCol.ScrollbarGrabActive]]] = ImVec4(0.41, 0.39, 0.80, 0.60) + colors[18 --[[ImGuiCol.CheckMark]]] = ImVec4(0.90, 0.90, 0.90, 0.50) + colors[19 --[[ImGuiCol.CheckboxSelectedBg]]] = ImLerpV4V4F(colors[7 --[[ImGuiCol.FrameBg]]], colors[9 --[[ImGuiCol.FrameBgActive]]], 0.65) + colors[20 --[[ImGuiCol.SliderGrab]]] = ImVec4(1.00, 1.00, 1.00, 0.30) + colors[21 --[[ImGuiCol.SliderGrabActive]]] = ImVec4(0.41, 0.39, 0.80, 0.60) + colors[22 --[[ImGuiCol.Button]]] = ImVec4(0.35, 0.40, 0.61, 0.62) + colors[23 --[[ImGuiCol.ButtonHovered]]] = ImVec4(0.40, 0.48, 0.71, 0.79) + colors[24 --[[ImGuiCol.ButtonActive]]] = ImVec4(0.46, 0.54, 0.80, 1.00) + colors[25 --[[ImGuiCol.Header]]] = ImVec4(0.40, 0.40, 0.90, 0.45) + colors[26 --[[ImGuiCol.HeaderHovered]]] = ImVec4(0.45, 0.45, 0.90, 0.80) + colors[27 --[[ImGuiCol.HeaderActive]]] = ImVec4(0.53, 0.53, 0.87, 0.80) + colors[28 --[[ImGuiCol.Separator]]] = ImVec4(0.50, 0.50, 0.50, 0.60) + colors[29 --[[ImGuiCol.SeparatorHovered]]] = ImVec4(0.60, 0.60, 0.70, 1.00) + colors[30 --[[ImGuiCol.SeparatorActive]]] = ImVec4(0.70, 0.70, 0.90, 1.00) + colors[31 --[[ImGuiCol.ResizeGrip]]] = ImVec4(1.00, 1.00, 1.00, 0.10) + colors[32 --[[ImGuiCol.ResizeGripHovered]]] = ImVec4(0.78, 0.82, 1.00, 0.60) + colors[33 --[[ImGuiCol.ResizeGripActive]]] = ImVec4(0.78, 0.82, 1.00, 0.90) + colors[34 --[[ImGuiCol.InputTextCursor]]] = colors[0 --[[ImGuiCol.Text]]] + colors[35 --[[ImGuiCol.TabHovered]]] = colors[26 --[[ImGuiCol.HeaderHovered]]] + colors[36 --[[ImGuiCol.Tab]]] = ImLerpV4V4F(colors[25 --[[ImGuiCol.Header]]], colors[11 --[[ImGuiCol.TitleBgActive]]], 0.80) + colors[37 --[[ImGuiCol.TabSelected]]] = ImLerpV4V4F(colors[27 --[[ImGuiCol.HeaderActive]]], colors[11 --[[ImGuiCol.TitleBgActive]]], 0.60) + colors[38 --[[ImGuiCol.TabSelectedOverline]]] = colors[27 --[[ImGuiCol.HeaderActive]]] + colors[39 --[[ImGuiCol.TabDimmed]]] = ImLerpV4V4F(colors[36 --[[ImGuiCol.Tab]]], colors[10 --[[ImGuiCol.TitleBg]]], 0.80) + colors[40 --[[ImGuiCol.TabDimmedSelected]]] = ImLerpV4V4F(colors[37 --[[ImGuiCol.TabSelected]]], colors[10 --[[ImGuiCol.TitleBg]]], 0.40) + colors[41 --[[ImGuiCol.TabDimmedSelectedOverline]]] = ImVec4(0.53, 0.53, 0.87, 0.00) + colors[42 --[[ImGuiCol.DockingPreview]]] = ImVec4(colors[25 --[[ImGuiCol.Header]]].x, colors[25 --[[ImGuiCol.Header]]].y, colors[25 --[[ImGuiCol.Header]]].z, colors[25 --[[ImGuiCol.Header]]].w * 0.7) + colors[43 --[[ImGuiCol.DockingEmptyBg]]] = ImVec4(0.20, 0.20, 0.20, 1.00) + colors[44 --[[ImGuiCol.PlotLines]]] = ImVec4(1.00, 1.00, 1.00, 1.00) + colors[45 --[[ImGuiCol.PlotLinesHovered]]] = ImVec4(0.90, 0.70, 0.00, 1.00) + colors[46 --[[ImGuiCol.PlotHistogram]]] = ImVec4(0.90, 0.70, 0.00, 1.00) + colors[47 --[[ImGuiCol.PlotHistogramHovered]]] = ImVec4(1.00, 0.60, 0.00, 1.00) + colors[48 --[[ImGuiCol.TableHeaderBg]]] = ImVec4(0.27, 0.27, 0.38, 1.00) + colors[49 --[[ImGuiCol.TableBorderStrong]]] = ImVec4(0.31, 0.31, 0.45, 1.00) -- Prefer using Alpha=1.0 here + colors[50 --[[ImGuiCol.TableBorderLight]]] = ImVec4(0.26, 0.26, 0.28, 1.00) -- Prefer using Alpha=1.0 here + colors[51 --[[ImGuiCol.TableRowBg]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[52 --[[ImGuiCol.TableRowBgAlt]]] = ImVec4(1.00, 1.00, 1.00, 0.07) + colors[53 --[[ImGuiCol.TextLink]]] = colors[27 --[[ImGuiCol.HeaderActive]]] + colors[54 --[[ImGuiCol.TextSelectedBg]]] = ImVec4(0.00, 0.00, 1.00, 0.35) + colors[55 --[[ImGuiCol.TreeLines]]] = colors[5 --[[ImGuiCol.Border]]] + colors[56 --[[ImGuiCol.DragDropTarget]]] = ImVec4(1.00, 1.00, 0.00, 0.90) + colors[57 --[[ImGuiCol.DragDropTargetBg]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[58 --[[ImGuiCol.UnsavedMarker]]] = ImVec4(0.90, 0.90, 0.90, 1.00) + colors[59 --[[ImGuiCol.NavCursor]]] = colors[26 --[[ImGuiCol.HeaderHovered]]] + colors[60 --[[ImGuiCol.NavWindowingHighlight]]] = ImVec4(1.00, 1.00, 1.00, 0.70) + colors[61 --[[ImGuiCol.NavWindowingDimBg]]] = ImVec4(0.80, 0.80, 0.80, 0.20) + colors[62 --[[ImGuiCol.ModalWindowDimBg]]] = ImVec4(0.20, 0.20, 0.20, 0.35) end -- Those light colors are better suited with a thicker font than the default one + FrameBorder @@ -30181,69 +30215,69 @@ function ImGui.StyleColorsLight(dst) local style = dst and dst or ImGui.GetStyle() local colors = style.Colors - colors[ImGuiCol.Text] = ImVec4(0.00, 0.00, 0.00, 1.00) - colors[ImGuiCol.TextDisabled] = ImVec4(0.60, 0.60, 0.60, 1.00) - colors[ImGuiCol.WindowBg] = ImVec4(0.94, 0.94, 0.94, 1.00) - colors[ImGuiCol.ChildBg] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.PopupBg] = ImVec4(1.00, 1.00, 1.00, 0.98) - colors[ImGuiCol.Border] = ImVec4(0.00, 0.00, 0.00, 0.30) - colors[ImGuiCol.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.FrameBg] = ImVec4(1.00, 1.00, 1.00, 1.00) - colors[ImGuiCol.FrameBgHovered] = ImVec4(0.26, 0.59, 0.98, 0.40) - colors[ImGuiCol.FrameBgActive] = ImVec4(0.26, 0.59, 0.98, 0.67) - colors[ImGuiCol.TitleBg] = ImVec4(0.96, 0.96, 0.96, 1.00) - colors[ImGuiCol.TitleBgActive] = ImVec4(0.82, 0.82, 0.82, 1.00) - colors[ImGuiCol.TitleBgCollapsed] = ImVec4(1.00, 1.00, 1.00, 0.51) - colors[ImGuiCol.MenuBarBg] = ImVec4(0.86, 0.86, 0.86, 1.00) - colors[ImGuiCol.ScrollbarBg] = ImVec4(0.98, 0.98, 0.98, 0.53) - colors[ImGuiCol.ScrollbarGrab] = ImVec4(0.69, 0.69, 0.69, 0.80) - colors[ImGuiCol.ScrollbarGrabHovered] = ImVec4(0.49, 0.49, 0.49, 0.80) - colors[ImGuiCol.ScrollbarGrabActive] = ImVec4(0.49, 0.49, 0.49, 1.00) - colors[ImGuiCol.CheckMark] = ImVec4(0.26, 0.59, 0.98, 1.00) - colors[ImGuiCol.CheckboxSelectedBg] = ImVec4(0.95, 0.97, 1.00, 1.00) - colors[ImGuiCol.SliderGrab] = ImVec4(0.26, 0.59, 0.98, 0.78) - colors[ImGuiCol.SliderGrabActive] = ImVec4(0.46, 0.54, 0.80, 0.60) - colors[ImGuiCol.Button] = ImVec4(0.26, 0.59, 0.98, 0.40) - colors[ImGuiCol.ButtonHovered] = ImVec4(0.26, 0.59, 0.98, 1.00) - colors[ImGuiCol.ButtonActive] = ImVec4(0.06, 0.53, 0.98, 1.00) - colors[ImGuiCol.Header] = ImVec4(0.26, 0.59, 0.98, 0.31) - colors[ImGuiCol.HeaderHovered] = ImVec4(0.26, 0.59, 0.98, 0.80) - colors[ImGuiCol.HeaderActive] = ImVec4(0.26, 0.59, 0.98, 1.00) - colors[ImGuiCol.Separator] = ImVec4(0.39, 0.39, 0.39, 0.62) - colors[ImGuiCol.SeparatorHovered] = ImVec4(0.14, 0.44, 0.80, 0.78) - colors[ImGuiCol.SeparatorActive] = ImVec4(0.14, 0.44, 0.80, 1.00) - colors[ImGuiCol.ResizeGrip] = ImVec4(0.35, 0.35, 0.35, 0.17) - colors[ImGuiCol.ResizeGripHovered] = ImVec4(0.26, 0.59, 0.98, 0.67) - colors[ImGuiCol.ResizeGripActive] = ImVec4(0.26, 0.59, 0.98, 0.95) - colors[ImGuiCol.InputTextCursor] = colors[ImGuiCol.Text] - colors[ImGuiCol.TabHovered] = colors[ImGuiCol.HeaderHovered] - colors[ImGuiCol.Tab] = ImLerpV4V4F(colors[ImGuiCol.Header], colors[ImGuiCol.TitleBgActive], 0.90) - colors[ImGuiCol.TabSelected] = ImLerpV4V4F(colors[ImGuiCol.HeaderActive], colors[ImGuiCol.TitleBgActive], 0.60) - colors[ImGuiCol.TabSelectedOverline] = colors[ImGuiCol.HeaderActive] - colors[ImGuiCol.TabDimmed] = ImLerpV4V4F(colors[ImGuiCol.Tab], colors[ImGuiCol.TitleBg], 0.80) - colors[ImGuiCol.TabDimmedSelected] = ImLerpV4V4F(colors[ImGuiCol.TabSelected], colors[ImGuiCol.TitleBg], 0.40) - colors[ImGuiCol.TabDimmedSelectedOverline] = ImVec4(0.26, 0.59, 1.00, 0.00) - colors[ImGuiCol.DockingPreview] = ImVec4(colors[ImGuiCol.Header].x, colors[ImGuiCol.Header].y, colors[ImGuiCol.Header].z, colors[ImGuiCol.Header].w * 0.7) - colors[ImGuiCol.DockingEmptyBg] = ImVec4(0.68, 0.69, 0.73, 1.00) - colors[ImGuiCol.PlotLines] = ImVec4(0.39, 0.39, 0.39, 1.00) - colors[ImGuiCol.PlotLinesHovered] = ImVec4(1.00, 0.43, 0.35, 1.00) - colors[ImGuiCol.PlotHistogram] = ImVec4(0.90, 0.70, 0.00, 1.00) - colors[ImGuiCol.PlotHistogramHovered] = ImVec4(1.00, 0.45, 0.00, 1.00) - colors[ImGuiCol.TableHeaderBg] = ImVec4(0.78, 0.87, 0.98, 1.00) - colors[ImGuiCol.TableBorderStrong] = ImVec4(0.57, 0.57, 0.64, 1.00) -- Prefer using Alpha=1.0 here - colors[ImGuiCol.TableBorderLight] = ImVec4(0.68, 0.68, 0.74, 1.00) -- Prefer using Alpha=1.0 here - colors[ImGuiCol.TableRowBg] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.TableRowBgAlt] = ImVec4(0.30, 0.30, 0.30, 0.09) - colors[ImGuiCol.TextLink] = colors[ImGuiCol.HeaderActive] - colors[ImGuiCol.TextSelectedBg] = ImVec4(0.26, 0.59, 0.98, 0.35) - colors[ImGuiCol.TreeLines] = colors[ImGuiCol.Border] - colors[ImGuiCol.DragDropTarget] = ImVec4(0.26, 0.59, 0.98, 0.95) - colors[ImGuiCol.DragDropTargetBg] = ImVec4(0.00, 0.00, 0.00, 0.00) - colors[ImGuiCol.UnsavedMarker] = ImVec4(0.00, 0.00, 0.00, 1.00) - colors[ImGuiCol.NavCursor] = colors[ImGuiCol.HeaderHovered] - colors[ImGuiCol.NavWindowingHighlight] = ImVec4(0.70, 0.70, 0.70, 0.70) - colors[ImGuiCol.NavWindowingDimBg] = ImVec4(0.20, 0.20, 0.20, 0.20) - colors[ImGuiCol.ModalWindowDimBg] = ImVec4(0.20, 0.20, 0.20, 0.35) + colors[0 --[[ImGuiCol.Text]]] = ImVec4(0.00, 0.00, 0.00, 1.00) + colors[1 --[[ImGuiCol.TextDisabled]]] = ImVec4(0.60, 0.60, 0.60, 1.00) + colors[2 --[[ImGuiCol.WindowBg]]] = ImVec4(0.94, 0.94, 0.94, 1.00) + colors[3 --[[ImGuiCol.ChildBg]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[4 --[[ImGuiCol.PopupBg]]] = ImVec4(1.00, 1.00, 1.00, 0.98) + colors[5 --[[ImGuiCol.Border]]] = ImVec4(0.00, 0.00, 0.00, 0.30) + colors[6 --[[ImGuiCol.BorderShadow]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[7 --[[ImGuiCol.FrameBg]]] = ImVec4(1.00, 1.00, 1.00, 1.00) + colors[8 --[[ImGuiCol.FrameBgHovered]]] = ImVec4(0.26, 0.59, 0.98, 0.40) + colors[9 --[[ImGuiCol.FrameBgActive]]] = ImVec4(0.26, 0.59, 0.98, 0.67) + colors[10 --[[ImGuiCol.TitleBg]]] = ImVec4(0.96, 0.96, 0.96, 1.00) + colors[11 --[[ImGuiCol.TitleBgActive]]] = ImVec4(0.82, 0.82, 0.82, 1.00) + colors[12 --[[ImGuiCol.TitleBgCollapsed]]] = ImVec4(1.00, 1.00, 1.00, 0.51) + colors[13 --[[ImGuiCol.MenuBarBg]]] = ImVec4(0.86, 0.86, 0.86, 1.00) + colors[14 --[[ImGuiCol.ScrollbarBg]]] = ImVec4(0.98, 0.98, 0.98, 0.53) + colors[15 --[[ImGuiCol.ScrollbarGrab]]] = ImVec4(0.69, 0.69, 0.69, 0.80) + colors[16 --[[ImGuiCol.ScrollbarGrabHovered]]] = ImVec4(0.49, 0.49, 0.49, 0.80) + colors[17 --[[ImGuiCol.ScrollbarGrabActive]]] = ImVec4(0.49, 0.49, 0.49, 1.00) + colors[18 --[[ImGuiCol.CheckMark]]] = ImVec4(0.26, 0.59, 0.98, 1.00) + colors[19 --[[ImGuiCol.CheckboxSelectedBg]]] = ImVec4(0.95, 0.97, 1.00, 1.00) + colors[20 --[[ImGuiCol.SliderGrab]]] = ImVec4(0.26, 0.59, 0.98, 0.78) + colors[21 --[[ImGuiCol.SliderGrabActive]]] = ImVec4(0.46, 0.54, 0.80, 0.60) + colors[22 --[[ImGuiCol.Button]]] = ImVec4(0.26, 0.59, 0.98, 0.40) + colors[23 --[[ImGuiCol.ButtonHovered]]] = ImVec4(0.26, 0.59, 0.98, 1.00) + colors[24 --[[ImGuiCol.ButtonActive]]] = ImVec4(0.06, 0.53, 0.98, 1.00) + colors[25 --[[ImGuiCol.Header]]] = ImVec4(0.26, 0.59, 0.98, 0.31) + colors[26 --[[ImGuiCol.HeaderHovered]]] = ImVec4(0.26, 0.59, 0.98, 0.80) + colors[27 --[[ImGuiCol.HeaderActive]]] = ImVec4(0.26, 0.59, 0.98, 1.00) + colors[28 --[[ImGuiCol.Separator]]] = ImVec4(0.39, 0.39, 0.39, 0.62) + colors[29 --[[ImGuiCol.SeparatorHovered]]] = ImVec4(0.14, 0.44, 0.80, 0.78) + colors[30 --[[ImGuiCol.SeparatorActive]]] = ImVec4(0.14, 0.44, 0.80, 1.00) + colors[31 --[[ImGuiCol.ResizeGrip]]] = ImVec4(0.35, 0.35, 0.35, 0.17) + colors[32 --[[ImGuiCol.ResizeGripHovered]]] = ImVec4(0.26, 0.59, 0.98, 0.67) + colors[33 --[[ImGuiCol.ResizeGripActive]]] = ImVec4(0.26, 0.59, 0.98, 0.95) + colors[34 --[[ImGuiCol.InputTextCursor]]] = colors[0 --[[ImGuiCol.Text]]] + colors[35 --[[ImGuiCol.TabHovered]]] = colors[26 --[[ImGuiCol.HeaderHovered]]] + colors[36 --[[ImGuiCol.Tab]]] = ImLerpV4V4F(colors[25 --[[ImGuiCol.Header]]], colors[11 --[[ImGuiCol.TitleBgActive]]], 0.90) + colors[37 --[[ImGuiCol.TabSelected]]] = ImLerpV4V4F(colors[27 --[[ImGuiCol.HeaderActive]]], colors[11 --[[ImGuiCol.TitleBgActive]]], 0.60) + colors[38 --[[ImGuiCol.TabSelectedOverline]]] = colors[27 --[[ImGuiCol.HeaderActive]]] + colors[39 --[[ImGuiCol.TabDimmed]]] = ImLerpV4V4F(colors[36 --[[ImGuiCol.Tab]]], colors[10 --[[ImGuiCol.TitleBg]]], 0.80) + colors[40 --[[ImGuiCol.TabDimmedSelected]]] = ImLerpV4V4F(colors[37 --[[ImGuiCol.TabSelected]]], colors[10 --[[ImGuiCol.TitleBg]]], 0.40) + colors[41 --[[ImGuiCol.TabDimmedSelectedOverline]]] = ImVec4(0.26, 0.59, 1.00, 0.00) + colors[42 --[[ImGuiCol.DockingPreview]]] = ImVec4(colors[25 --[[ImGuiCol.Header]]].x, colors[25 --[[ImGuiCol.Header]]].y, colors[25 --[[ImGuiCol.Header]]].z, colors[25 --[[ImGuiCol.Header]]].w * 0.7) + colors[43 --[[ImGuiCol.DockingEmptyBg]]] = ImVec4(0.68, 0.69, 0.73, 1.00) + colors[44 --[[ImGuiCol.PlotLines]]] = ImVec4(0.39, 0.39, 0.39, 1.00) + colors[45 --[[ImGuiCol.PlotLinesHovered]]] = ImVec4(1.00, 0.43, 0.35, 1.00) + colors[46 --[[ImGuiCol.PlotHistogram]]] = ImVec4(0.90, 0.70, 0.00, 1.00) + colors[47 --[[ImGuiCol.PlotHistogramHovered]]] = ImVec4(1.00, 0.45, 0.00, 1.00) + colors[48 --[[ImGuiCol.TableHeaderBg]]] = ImVec4(0.78, 0.87, 0.98, 1.00) + colors[49 --[[ImGuiCol.TableBorderStrong]]] = ImVec4(0.57, 0.57, 0.64, 1.00) -- Prefer using Alpha=1.0 here + colors[50 --[[ImGuiCol.TableBorderLight]]] = ImVec4(0.68, 0.68, 0.74, 1.00) -- Prefer using Alpha=1.0 here + colors[51 --[[ImGuiCol.TableRowBg]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[52 --[[ImGuiCol.TableRowBgAlt]]] = ImVec4(0.30, 0.30, 0.30, 0.09) + colors[53 --[[ImGuiCol.TextLink]]] = colors[27 --[[ImGuiCol.HeaderActive]]] + colors[54 --[[ImGuiCol.TextSelectedBg]]] = ImVec4(0.26, 0.59, 0.98, 0.35) + colors[55 --[[ImGuiCol.TreeLines]]] = colors[5 --[[ImGuiCol.Border]]] + colors[56 --[[ImGuiCol.DragDropTarget]]] = ImVec4(0.26, 0.59, 0.98, 0.95) + colors[57 --[[ImGuiCol.DragDropTargetBg]]] = ImVec4(0.00, 0.00, 0.00, 0.00) + colors[58 --[[ImGuiCol.UnsavedMarker]]] = ImVec4(0.00, 0.00, 0.00, 1.00) + colors[59 --[[ImGuiCol.NavCursor]]] = colors[26 --[[ImGuiCol.HeaderHovered]]] + colors[60 --[[ImGuiCol.NavWindowingHighlight]]] = ImVec4(0.70, 0.70, 0.70, 0.70) + colors[61 --[[ImGuiCol.NavWindowingDimBg]]] = ImVec4(0.20, 0.20, 0.20, 0.20) + colors[62 --[[ImGuiCol.ModalWindowDimBg]]] = ImVec4(0.20, 0.20, 0.20, 0.35) end ------------------------------------------------------------------------------- @@ -30262,13 +30296,13 @@ function ImGui.ShadeVertsLinearColorGradientKeepAlpha(draw_list, vert_start_idx, local gradient_extent = gradient_p1 - gradient_p0 local gradient_inv_length2 = 1.0 / ImLengthSqr(gradient_extent) - local col0_r = bit32.band(bit32.rshift(col0, IM_COL32_R_SHIFT), 0xFF) - local col0_g = bit32.band(bit32.rshift(col0, IM_COL32_G_SHIFT), 0xFF) - local col0_b = bit32.band(bit32.rshift(col0, IM_COL32_B_SHIFT), 0xFF) + local col0_r = bit32.band(bit32.rshift(col0, 0 --[[IM_COL32_R_SHIFT]]), 0xFF) + local col0_g = bit32.band(bit32.rshift(col0, 8 --[[IM_COL32_G_SHIFT]]), 0xFF) + local col0_b = bit32.band(bit32.rshift(col0, 16 --[[IM_COL32_B_SHIFT]]), 0xFF) - local col_delta_r = bit32.band(bit32.rshift(col1, IM_COL32_R_SHIFT), 0xFF) - col0_r - local col_delta_g = bit32.band(bit32.rshift(col1, IM_COL32_G_SHIFT), 0xFF) - col0_g - local col_delta_b = bit32.band(bit32.rshift(col1, IM_COL32_B_SHIFT), 0xFF) - col0_b + local col_delta_r = bit32.band(bit32.rshift(col1, 0 --[[IM_COL32_R_SHIFT]]), 0xFF) - col0_r + local col_delta_g = bit32.band(bit32.rshift(col1, 8 --[[IM_COL32_G_SHIFT]]), 0xFF) - col0_g + local col_delta_b = bit32.band(bit32.rshift(col1, 16 --[[IM_COL32_B_SHIFT]]), 0xFF) - col0_b for vert_idx = vert_start_idx, vert_end_idx - 1 do local vb = draw_list.VtxBuffer.Buf @@ -30280,7 +30314,7 @@ function ImGui.ShadeVertsLinearColorGradientKeepAlpha(draw_list, vert_start_idx, local g = math.floor(col0_g + col_delta_g * t) local b = math.floor(col0_b + col_delta_b * t) - writeu32(vb, o + 32, bit32.bor(bit32.lshift(r, IM_COL32_R_SHIFT), bit32.lshift(g, IM_COL32_G_SHIFT), bit32.lshift(b, IM_COL32_B_SHIFT), bit32.band(readu32(vb, o + 32), IM_COL32_A_MASK))) + writeu32(vb, o + 32, bit32.bor(bit32.lshift(r, 0 --[[IM_COL32_R_SHIFT]]), bit32.lshift(g, 8 --[[IM_COL32_G_SHIFT]]), bit32.lshift(b, 16 --[[IM_COL32_B_SHIFT]]), bit32.band(readu32(vb, o + 32), 4278190080 --[[IM_COL32_A_MASK]]))) end end @@ -30489,7 +30523,7 @@ function MT.ImFontAtlas:SetFontLoader(font_loader) end function MT.ImFontAtlas:ClearInputData() - IM_ASSERT(not self.Locked, "Cannot modify a locked ImFontAtlas!") + assert(not self.Locked, "Cannot modify a locked ImFontAtlas!") for _, font in self.Fonts:iter() do ImFontAtlasFontDestroyOutput(self, font) @@ -30500,15 +30534,15 @@ function MT.ImFontAtlas:ClearInputData() for _, font in self.Fonts:iter() do -- When clearing this we lose access to the font name and other information used to build the font. font.Sources:clear() - font.Flags = bit32.bor(font.Flags, ImFontFlags.NoLoadGlyphs) + font.Flags = bit32.bor(font.Flags, 4 --[[ImFontFlags.NoLoadGlyphs]]) end self.Sources:clear() end -- Clear CPU-side copy of the texture data. function MT.ImFontAtlas:ClearTexData() - IM_ASSERT(not self.Locked, "Cannot modify a locked ImFontAtlas!") - IM_ASSERT(self.RendererHasTextures == false, "Not supported for dynamic atlases, but you may call Clear().") + assert(not self.Locked, "Cannot modify a locked ImFontAtlas!") + assert(self.RendererHasTextures == false, "Not supported for dynamic atlases, but you may call Clear().") for _, tex in self.TexList:iter() do tex:DestroyPixels() @@ -30523,7 +30557,7 @@ end function MT.ImFontAtlas:ClearFonts() -- FIXME-NEWATLAS: Illegal to remove currently bound font. IMGUI_DEBUG_LOG_FONT("[font] ImFontAtlas:ClearFonts()") - IM_ASSERT(not self.Locked, "Cannot modify a locked ImFontAtlas!") + assert(not self.Locked, "Cannot modify a locked ImFontAtlas!") for _, font in self.Fonts:iter() do ImFontAtlasBuildNotifySetFont(self, font, nil) @@ -30546,7 +30580,7 @@ end --- @param tex ImTextureData function ImTextureDataUpdateNewFrame(tex) local remove_from_list = false - if tex.Status == ImTextureStatus.OK then + if tex.Status == 0 --[[ImTextureStatus.OK]] then tex.Updates:resize(0) tex.UpdateRect.x = 65535 tex.UpdateRect.y = 65535 tex.UpdateRect.w = 0 tex.UpdateRect.h = 0 @@ -30555,32 +30589,32 @@ function ImTextureDataUpdateNewFrame(tex) -- Request destroy -- - Keep bool to true in order to differentiate a planned destroy vs a destroy decided by the backend. -- - We don't destroy pixels right away, as backend may have an in-flight copy from RAM. - if (tex.WantDestroyNextFrame and tex.Status ~= ImTextureStatus.Destroyed and tex.Status ~= ImTextureStatus.WantDestroy) then - IM_ASSERT(tex.Status == ImTextureStatus.OK or tex.Status == ImTextureStatus.WantCreate or tex.Status == ImTextureStatus.WantUpdates) - tex.Status = ImTextureStatus.WantDestroy + if (tex.WantDestroyNextFrame and tex.Status ~= 1 --[[ImTextureStatus.Destroyed]] and tex.Status ~= 4 --[[ImTextureStatus.WantDestroy]]) then + assert(tex.Status == 0 --[[ImTextureStatus.OK]] or tex.Status == 2 --[[ImTextureStatus.WantCreate]] or tex.Status == 3 --[[ImTextureStatus.WantUpdates]]) + tex.Status = 4 --[[ImTextureStatus.WantDestroy]] end -- If a texture has never reached the backend, they don't need to know about it. -- (note: backends between 1.92.0 and 1.92.4 could set an already destroyed texture to ImTextureStatus.WantDestroy -- when invalidating graphics objects twice, which would previously remove it from the list and crash.) - if (tex.Status == ImTextureStatus.WantDestroy and tex.TexID == ImTextureID_Invalid and tex.BackendUserData == nil and tex.QueueUserData == nil) then - tex.Status = ImTextureStatus.Destroyed + if (tex.Status == 4 --[[ImTextureStatus.WantDestroy]] and tex.TexID == (-1) --[[ImTextureID_Invalid]] and tex.BackendUserData == nil and tex.QueueUserData == nil) then + tex.Status = 1 --[[ImTextureStatus.Destroyed]] end -- Process texture being destroyed - if (tex.Status == ImTextureStatus.Destroyed) then - IM_ASSERT(tex.TexID == ImTextureID_Invalid and tex.BackendUserData == nil, "Backend set texture Status to Destroyed but did not clear TexID/BackendUserData!") - IM_ASSERT(tex.QueueUserData == nil, "Texture queue set Status to Destroyed but did not clear QueueUserData!") + if (tex.Status == 1 --[[ImTextureStatus.Destroyed]]) then + assert(tex.TexID == (-1) --[[ImTextureID_Invalid]] and tex.BackendUserData == nil, "Backend set texture Status to Destroyed but did not clear TexID/BackendUserData!") + assert(tex.QueueUserData == nil, "Texture queue set Status to Destroyed but did not clear QueueUserData!") if (tex.WantDestroyNextFrame) then remove_from_list = true -- Destroy was scheduled by us else - tex.Status = ImTextureStatus.WantCreate -- Destroy was done was backend: recreate it (e.g. freed resources mid-run) + tex.Status = 2 --[[ImTextureStatus.WantCreate]] -- Destroy was done was backend: recreate it (e.g. freed resources mid-run) end end -- The backend may need defer destroying by a few frames, to handle texture used by previous in-flight rendering. -- We allow the texture staying in _WantDestroy state and increment a counter which the backend can use to take its decision. - if (tex.Status == ImTextureStatus.WantDestroy) then + if (tex.Status == 4 --[[ImTextureStatus.WantDestroy]]) then tex.UnusedFrames = tex.UnusedFrames + 1 end @@ -30595,7 +30629,7 @@ end --- @param frame_count int --- @param renderer_has_textures any function ImFontAtlasUpdateNewFrame(atlas, frame_count, renderer_has_textures) - IM_ASSERT(atlas.Builder == nil or atlas.Builder.FrameCount < frame_count) -- Protection against being called twice. + assert(atlas.Builder == nil or atlas.Builder.FrameCount < frame_count) -- Protection against being called twice. atlas.RendererHasTextures = renderer_has_textures -- Update texture status and discard old textures. @@ -30607,14 +30641,14 @@ function ImFontAtlasUpdateNewFrame(atlas, frame_count, renderer_has_textures) -- Update and remove if requested local tex = atlas.TexList.Data[tex_n] - if (tex.Status == ImTextureStatus.WantCreate and atlas.RendererHasTextures) then - IM_ASSERT(tex.TexID == ImTextureID_Invalid and tex.BackendUserData == nil, "Backend set texture's TexID/BackendUserData but did not update Status to OK.") + if (tex.Status == 2 --[[ImTextureStatus.WantCreate]] and atlas.RendererHasTextures) then + assert(tex.TexID == (-1) --[[ImTextureID_Invalid]] and tex.BackendUserData == nil, "Backend set texture's TexID/BackendUserData but did not update Status to OK.") end local remove_from_list = ImTextureDataUpdateNewFrame(tex) if remove_from_list then - IM_ASSERT(atlas.TexData ~= tex) + assert(atlas.TexData ~= tex) tex:DestroyPixels() atlas.TexList:erase(tex_n) tex_n = tex_n - 1 @@ -30669,7 +30703,7 @@ function ImFontAtlasUpdateNewFrame(atlas, frame_count, renderer_has_textures) until true end - IM_ASSERT(dst_n - 1 + builder.BakedDiscardedCount == builder.BakedPool.Size) + assert(dst_n - 1 + builder.BakedDiscardedCount == builder.BakedPool.Size) builder.BakedPool.Size = builder.BakedPool.Size - builder.BakedDiscardedCount builder.BakedDiscardedCount = 0 @@ -30686,7 +30720,7 @@ end --- @param w int --- @param h int function ImFontAtlasTextureBlockConvert(src_pixels, src_fmt, src_pitch, dst_pixels, dst_pixels_base, dst_fmt, dst_pitch, w, h) - IM_ASSERT(src_pixels ~= nil and dst_pixels ~= nil) + assert(src_pixels ~= nil and dst_pixels ~= nil) local src_pixels_base = 1 if src_fmt == dst_fmt then local line_sz = w * ImTextureDataGetFormatBytesPerPixel(src_fmt) @@ -30696,7 +30730,7 @@ function ImFontAtlasTextureBlockConvert(src_pixels, src_fmt, src_pitch, dst_pixe src_pixels_base = src_pixels_base + src_pitch dst_pixels_base = dst_pixels_base + dst_pitch end - elseif src_fmt == ImTextureFormat.Alpha8 and dst_fmt == ImTextureFormat.RGBA32 then + elseif src_fmt == 1 --[[ImTextureFormat.Alpha8]] and dst_fmt == 0 --[[ImTextureFormat.RGBA32]] then for ny = h, 1, -1 do for nx = w, 1, -1 do local alpha = src_pixels[src_pixels_base + 0] @@ -30709,7 +30743,7 @@ function ImFontAtlasTextureBlockConvert(src_pixels, src_fmt, src_pitch, dst_pixe src_pixels_base = src_pixels_base + (src_pitch - w) dst_pixels_base = dst_pixels_base + (dst_pitch - w * 4) end - elseif src_fmt == ImTextureFormat.RGBA32 and dst_fmt == ImTextureFormat.Alpha8 then + elseif src_fmt == 0 --[[ImTextureFormat.RGBA32]] and dst_fmt == 1 --[[ImTextureFormat.Alpha8]] then for ny = h, 1, -1 do for nx = w, 1, -1 do local alpha = src_pixels[src_pixels_base + 3] @@ -30723,7 +30757,7 @@ function ImFontAtlasTextureBlockConvert(src_pixels, src_fmt, src_pitch, dst_pixe dst_pixels_base = dst_pixels_base + (dst_pitch - w) end else - IM_ASSERT(false) + assert(false) end end @@ -30742,7 +30776,7 @@ end function ImFontAtlasTextureBlockPostProcessMultiply(data, multiply_factor) local pixels, pixels_base = data.Pixels, data._PixelsBase local pitch = data.Pitch - if data.Format == ImTextureFormat.Alpha8 then + if data.Format == 1 --[[ImTextureFormat.Alpha8]] then for ny = data.Height, 1, -1 do local p = pixels_base for nx = data.Width, 1, -1 do @@ -30754,7 +30788,7 @@ function ImFontAtlasTextureBlockPostProcessMultiply(data, multiply_factor) pixels_base = pixels_base + pitch end - elseif data.Format == ImTextureFormat.RGBA32 then + elseif data.Format == 0 --[[ImTextureFormat.RGBA32]] then for ny = data.Height, 1, -1 do local p = pixels_base for nx = data.Width, 1, -1 do @@ -30768,7 +30802,7 @@ function ImFontAtlasTextureBlockPostProcessMultiply(data, multiply_factor) pixels_base = pixels_base + pitch end else - IM_ASSERT(false) + assert(false) end end @@ -30782,12 +30816,12 @@ end --- @param w int --- @param h int function ImFontAtlasTextureBlockCopy(src_tex, src_x, src_y, dst_tex, dst_x, dst_y, w, h) - IM_ASSERT(src_tex.Pixels ~= nil and dst_tex.Pixels ~= nil) - IM_ASSERT(src_tex.Format == dst_tex.Format) - IM_ASSERT(src_x >= 0 and src_x + w <= src_tex.Width) - IM_ASSERT(src_y >= 0 and src_y + h <= src_tex.Height) - IM_ASSERT(dst_x >= 0 and dst_x + w <= dst_tex.Width) - IM_ASSERT(dst_y >= 0 and dst_y + h <= dst_tex.Height) + assert(src_tex.Pixels ~= nil and dst_tex.Pixels ~= nil) + assert(src_tex.Format == dst_tex.Format) + assert(src_x >= 0 and src_x + w <= src_tex.Width) + assert(src_y >= 0 and src_y + h <= src_tex.Height) + assert(dst_x >= 0 and dst_x + w <= dst_tex.Width) + assert(dst_y >= 0 and dst_y + h <= dst_tex.Height) for y = 0, h - 1 do local dst, dst_base = dst_tex:GetPixelsAt(dst_x, dst_y + y) local src, src_base = src_tex:GetPixelsAt(src_x, src_y + y) @@ -30802,8 +30836,8 @@ end --- @param w int --- @param h int local function ImTextureDataQueueUpload(tex, x, y, w, h) - IM_ASSERT(tex.Status ~= ImTextureStatus.WantDestroy and tex.Status ~= ImTextureStatus.Destroyed) - IM_ASSERT(x >= 0 and x <= 0xFFFF and y >= 0 and y <= 0xFFFF and w >= 0 and x + w <= 0x10000 and h >= 0 and y + h <= 0x10000) + assert(tex.Status ~= 4 --[[ImTextureStatus.WantDestroy]] and tex.Status ~= 1 --[[ImTextureStatus.Destroyed]]) + assert(x >= 0 and x <= 0xFFFF and y >= 0 and y <= 0xFFFF and w >= 0 and x + w <= 0x10000 and h >= 0 and y + h <= 0x10000) local req = ImTextureRect(x, y, w, h) -- (unsigned short) local new_x1 = ImMax(tex.UpdateRect.w == 0 and 0 or tex.UpdateRect.x + tex.UpdateRect.w, req.x + req.w) @@ -30818,8 +30852,8 @@ local function ImTextureDataQueueUpload(tex, x, y, w, h) tex.UsedRect.h = (ImMax(tex.UsedRect.y + tex.UsedRect.h, req.y + req.h) - tex.UsedRect.y) -- (unsigned short) -- No need to queue if status is == ImTextureStatus.WantCreate - if (tex.Status == ImTextureStatus.OK or tex.Status == ImTextureStatus.WantUpdates) then - tex.Status = ImTextureStatus.WantUpdates + if (tex.Status == 0 --[[ImTextureStatus.OK]] or tex.Status == 3 --[[ImTextureStatus.WantUpdates]]) then + tex.Status = 3 --[[ImTextureStatus.WantUpdates]] tex.Updates:push_back(req) end end @@ -30846,9 +30880,9 @@ end --- @param src_pitch int local function ImFontAtlasBakedSetFontGlyphBitmap(atlas, baked, src, glyph, r, src_pixels, src_fmt, src_pitch) local tex = atlas.TexData - IM_ASSERT(r.x + r.w <= tex.Width and r.y + r.h <= tex.Height) + assert(r.x + r.w <= tex.Width and r.y + r.h <= tex.Height) local out_p, out_p_base = tex:GetPixelsAt(r.x, r.y) - IM_ASSERT(out_p ~= nil) + assert(out_p ~= nil) ImFontAtlasTextureBlockConvert(src_pixels, src_fmt, src_pitch, out_p, out_p_base, tex.Format, tex:GetPitch(), r.w, r.h) local pp_data = ImFontAtlasPostProcessData(atlas, baked.OwnerFont, src, baked, glyph, out_p, out_p_base, tex.Format, tex:GetPitch(), r.w, r.h) ImFontAtlasTextureBlockPostProcess(pp_data) @@ -30882,7 +30916,7 @@ local function ImFontAtlasBuildDiscardBakes(atlas, unused_frames) break end - if (baked.WantDestroy or (bit32.band(baked.OwnerFont.Flags, ImFontFlags.LockBakedSizes) ~= 0)) then + if (baked.WantDestroy or (bit32.band(baked.OwnerFont.Flags, 8 --[[ImFontFlags.LockBakedSizes]]) ~= 0)) then break end @@ -30896,14 +30930,14 @@ end --- @param atlas ImFontAtlas --- @param data ImDrawListSharedData function ImFontAtlasAddDrawListSharedData(atlas, data) - IM_ASSERT(not atlas.DrawListSharedDatas:contains(data)) + assert(not atlas.DrawListSharedDatas:contains(data)) atlas.DrawListSharedDatas:push_back(data) end --- @param atlas ImFontAtlas --- @param data ImDrawListSharedData function ImFontAtlasRemoveDrawListSharedData(atlas, data) - IM_ASSERT(atlas.DrawListSharedDatas:contains(data)) + assert(atlas.DrawListSharedDatas:contains(data)) atlas.DrawListSharedDatas:find_erase(data) end @@ -30946,7 +30980,7 @@ local function ImFontAtlasTextureRepack(atlas, w, h) end local new_r_id = ImFontAtlasPackAddRect(atlas, old_r.w, old_r.h, index_entry) - if new_r_id == ImFontAtlasRectId_Invalid then + if new_r_id == (-1) --[[ImFontAtlasRectId_Invalid]] then -- Undo, grow texture and try repacking again. -- FIXME-NEWATLAS-TESTS: This is a very rarely exercised path! It needs to be automatically tested properly. IMGUI_DEBUG_LOG_FONT("[font] Texture #%03d: resize failed. Will grow.", new_tex.UniqueID) @@ -30960,21 +30994,21 @@ local function ImFontAtlasTextureRepack(atlas, w, h) return end - IM_ASSERT(ImFontAtlasRectId_GetIndex(new_r_id) == builder.RectsIndex:index_from_ptr(index_entry)) + assert(ImFontAtlasRectId_GetIndex(new_r_id) == builder.RectsIndex:index_from_ptr(index_entry)) local new_r = ImFontAtlasPackGetRect(atlas, new_r_id) ImFontAtlasTextureBlockCopy(old_tex, old_r.x, old_r.y, new_tex, new_r.x, new_r.y, new_r.w, new_r.h) until true end - IM_ASSERT(old_rects.Size == builder.Rects.Size + builder.RectsDiscardedCount) + assert(old_rects.Size == builder.Rects.Size + builder.RectsDiscardedCount) builder.RectsDiscardedCount = 0 builder.RectsDiscardedSurface = 0 -- Patch glyphs UV for baked_n = 1, builder.BakedPool.Size do for _, glyph in builder.BakedPool[baked_n].Glyphs:iter() do - if (glyph.PackId ~= ImFontAtlasRectId_Invalid) then + if (glyph.PackId ~= (-1) --[[ImFontAtlasRectId_Invalid]]) then local r = ImFontAtlasPackGetRect(atlas, glyph.PackId) glyph.U0 = (r.x) * atlas.TexUvScale.x glyph.V0 = (r.y) * atlas.TexUvScale.y @@ -31008,8 +31042,8 @@ function ImFontAtlasTextureGrow(atlas, old_tex_w, old_tex_h) -- FIXME-NEWATLAS-V2: What to do when reaching limits exposed by backend? -- FIXME-NEWATLAS-V2: Does ImFontAtlasFlags.NoPowerOfTwoHeight makes sense now? Allow 'lock' and 'compact' operations? - IM_ASSERT(ImIsPowerOfTwo(old_tex_w) and ImIsPowerOfTwo(old_tex_h)) - IM_ASSERT(ImIsPowerOfTwo(atlas.TexMinWidth) and ImIsPowerOfTwo(atlas.TexMaxWidth) and ImIsPowerOfTwo(atlas.TexMinHeight) and ImIsPowerOfTwo(atlas.TexMaxHeight)) + assert(ImIsPowerOfTwo(old_tex_w) and ImIsPowerOfTwo(old_tex_h)) + assert(ImIsPowerOfTwo(atlas.TexMinWidth) and ImIsPowerOfTwo(atlas.TexMaxWidth) and ImIsPowerOfTwo(atlas.TexMinHeight) and ImIsPowerOfTwo(atlas.TexMaxHeight)) -- Grow texture so it follows roughly a square. -- - Grow height before width, as width imply more packing nodes. @@ -31059,7 +31093,7 @@ local function ImFontAtlasPackAllocRectEntry(atlas, rect_idx) else index_idx = builder.RectsIndexFreeListStart index_entry = builder.RectsIndex[index_idx + 1] - IM_ASSERT(index_entry.IsUsed == false and index_entry.Generation > 0) -- Generation is incremented during DiscardRect + assert(index_entry.IsUsed == false and index_entry.Generation > 0) -- Generation is incremented during DiscardRect builder.RectsIndexFreeListStart = index_entry.TargetIndex end @@ -31073,7 +31107,7 @@ end --- @param atlas ImFontAtlas --- @param index_entry ImFontAtlasRectEntry local function ImFontAtlasPackReuseRectEntry(atlas, index_entry) - IM_ASSERT(index_entry.IsUsed) + assert(index_entry.IsUsed) index_entry.TargetIndex = atlas.Builder.Rects.Size - 1 local index_idx = atlas.Builder.RectsIndex:index_from_ptr(index_entry) return ImFontAtlasRectId_Make(index_idx, index_entry.Generation) @@ -31083,7 +31117,7 @@ end --- @param atlas ImFontAtlas --- @param id ImFontAtlasRectId function ImFontAtlasPackDiscardRect(atlas, id) - IM_ASSERT(id ~= ImFontAtlasRectId_Invalid) + assert(id ~= (-1) --[[ImFontAtlasRectId_Invalid]]) local rect = ImFontAtlasPackGetRect(atlas, id) if (rect == nil) then @@ -31093,7 +31127,7 @@ function ImFontAtlasPackDiscardRect(atlas, id) local builder = atlas.Builder local index_idx = ImFontAtlasRectId_GetIndex(id) local index_entry = builder.RectsIndex.Data[index_idx + 1] - IM_ASSERT(index_entry.IsUsed and index_entry.TargetIndex >= 0) + assert(index_entry.IsUsed and index_entry.TargetIndex >= 0) index_entry.IsUsed = false index_entry.TargetIndex = builder.RectsIndexFreeListStart index_entry.Generation = index_entry.Generation + 1 @@ -31111,8 +31145,8 @@ end -- Important: Calling this may recreate a new texture and therefore change atlas.TexData -- FIXME-NEWFONTS: Expose other glyph padding settings for custom alteration (e.g. drop shadows). See #7962 function ImFontAtlasPackAddRect(atlas, w, h, overwrite_entry) - IM_ASSERT(w > 0 and w <= 0xFFFF) - IM_ASSERT(h > 0 and h <= 0xFFFF) + assert(w > 0 and w <= 0xFFFF) + assert(h > 0 and h <= 0xFFFF) local builder = atlas.Builder local pack_padding = atlas.TexGlyphPadding @@ -31137,7 +31171,7 @@ function ImFontAtlasPackAddRect(atlas, w, h, overwrite_entry) if (attempts_remaining == 0 or builder.LockDisableResize) then IMGUI_DEBUG_LOG_FONT("[font] Failed packing %dx%d rectangle. Returning fallback.", w, h) - return ImFontAtlasRectId_Invalid + return (-1) --[[ImFontAtlasRectId_Invalid]] end -- Resize or repack atlas! (this should be a rare event) @@ -31162,12 +31196,12 @@ end --- @param id ImFontAtlasRectId --- @return ImTextureRect function ImFontAtlasPackGetRect(atlas, id) - IM_ASSERT(id ~= ImFontAtlasRectId_Invalid) + assert(id ~= (-1) --[[ImFontAtlasRectId_Invalid]]) local index_idx = ImFontAtlasRectId_GetIndex(id) local builder = atlas.Builder local index_entry = builder.RectsIndex.Data[index_idx + 1] - IM_ASSERT(index_entry.Generation == ImFontAtlasRectId_GetGeneration(id)) - IM_ASSERT(index_entry.IsUsed) + assert(index_entry.Generation == ImFontAtlasRectId_GetGeneration(id)) + assert(index_entry.IsUsed) --- @type ImTextureRect return builder.Rects.Data[index_entry.TargetIndex + 1] end @@ -31177,7 +31211,7 @@ end --- @param atlas ImFontAtlas --- @param id ImFontAtlasRectId function ImFontAtlasPackGetRectSafe(atlas, id) - if id == ImFontAtlasRectId_Invalid then + if id == (-1) --[[ImFontAtlasRectId_Invalid]] then return nil end @@ -31220,7 +31254,7 @@ end --- @param baked ImFontBaked --- @param new_size int function ImFontBaked_BuildGrowIndex(baked, new_size) - IM_ASSERT(baked.IndexAdvanceX.Size == baked.IndexLookup.Size) + assert(baked.IndexAdvanceX.Size == baked.IndexLookup.Size) if (new_size <= baked.IndexLookup.Size) then return end @@ -31260,7 +31294,7 @@ local function ImGui_ImplStbTrueType_FontSrcInit(atlas, src) --- @type ImGui_ImplStbTrueType_FontSrcData? local bd_font_data = ImGui_ImplStbTrueType_FontSrcData() - IM_ASSERT(src.FontLoaderData == nil) + assert(src.FontLoaderData == nil) -- Initialize helper structure for font loading and verify that the TTF/OTF data is correct local font_offset = stbtt.GetFontOffsetForIndex(src.FontData, src.FontNo) @@ -31298,7 +31332,7 @@ end local function ImGui_ImplStbTrueType_FontSrcContainsGlyph(atlas, src, codepoint) -- IM_UNUSED(atlas) local bd_font_data = src.FontLoaderData - IM_ASSERT(bd_font_data ~= nil) + assert(bd_font_data ~= nil) local glyph_index = stbtt.FindGlyphIndex(bd_font_data.FontInfo, codepoint) return (glyph_index ~= 0) @@ -31334,7 +31368,7 @@ end local function ImGui_ImplStbTrueType_FontBakedLoadGlyph(atlas, src, baked, _, codepoint, out_glyph, advance_x) -- Search for first font which has the glyph local bd_font_data = src.FontLoaderData - IM_ASSERT(bd_font_data ~= nil) + assert(bd_font_data ~= nil) local glyph_index = stbtt.FindGlyphIndex(bd_font_data.FontInfo, codepoint) if (glyph_index == 0) then return false, advance_x @@ -31353,7 +31387,7 @@ local function ImGui_ImplStbTrueType_FontBakedLoadGlyph(atlas, src, baked, _, co -- Load metrics only mode if (advance_x ~= nil) then - IM_ASSERT(out_glyph == nil) + assert(out_glyph == nil) advance_x = advance * scale_for_layout return true, advance_x @@ -31370,9 +31404,9 @@ local function ImGui_ImplStbTrueType_FontBakedLoadGlyph(atlas, src, baked, _, co local w = (x1 - x0 + oversample_h - 1) local h = (y1 - y0 + oversample_v - 1) local pack_id = ImFontAtlasPackAddRect(atlas, w, h) - if (pack_id == ImFontAtlasRectId_Invalid) then + if (pack_id == (-1) --[[ImFontAtlasRectId_Invalid]]) then -- Pathological out of memory case (TexMaxWidth/TexMaxHeight set too small?) - IM_ASSERT(pack_id ~= ImFontAtlasRectId_Invalid, "Out of texture memory.") + assert(pack_id ~= (-1) --[[ImFontAtlasRectId_Invalid]], "Out of texture memory.") return false, advance_x end @@ -31409,7 +31443,7 @@ local function ImGui_ImplStbTrueType_FontBakedLoadGlyph(atlas, src, baked, _, co out_glyph.Visible = true out_glyph.PackId = pack_id - ImFontAtlasBakedSetFontGlyphBitmap(atlas, baked, src, out_glyph, r, bitmap_pixels, ImTextureFormat.Alpha8, w) + ImFontAtlasBakedSetFontGlyphBitmap(atlas, baked, src, out_glyph, r, bitmap_pixels, 1 --[[ImTextureFormat.Alpha8]], w) end return true, advance_x @@ -31444,7 +31478,7 @@ function ImFontAtlasBuildSetupFontBakedBlanks(atlas, baked) if baked:FindGlyphNoFallback(9) == nil and space_glyph ~= nil then local tab_glyph = ImFontGlyph() tab_glyph.Codepoint = 9 - tab_glyph.AdvanceX = space_glyph.AdvanceX * IM_TABSIZE + tab_glyph.AdvanceX = space_glyph.AdvanceX * 4 --[[IM_TABSIZE]] ImFontAtlasBakedAddFontGlyph(atlas, baked, nil, tab_glyph) end end @@ -31538,7 +31572,7 @@ function ImFontAtlasBakedDiscard(atlas, font, baked) local builder = atlas.Builder for _, glyph in baked.Glyphs:iter() do - if glyph.PackId ~= ImFontAtlasRectId_Invalid then + if glyph.PackId ~= (-1) --[[ImFontAtlasRectId_Invalid]] then ImFontAtlasPackDiscardRect(atlas, glyph.PackId) end end @@ -31592,7 +31626,7 @@ function ImFontAtlasFontInitOutput(atlas, font) ret = false end end - IM_ASSERT(ret) -- Unclear how to react to this meaningfully. Assume that result will be same as initial AddFont() call. + assert(ret) -- Unclear how to react to this meaningfully. Assume that result will be same as initial AddFont() call. return ret end @@ -31626,7 +31660,7 @@ function ImFontAtlasFontSourceAddToFont(atlas, font, src) font:ClearOutputData() --font.FontSize = src.SizePixels font.OwnerAtlas = atlas - IM_ASSERT(font.Sources[1] == src) + assert(font.Sources[1] == src) end atlas.TexIsBuilt = false -- For legacy backends ImFontAtlasBuildSetupFontSpecialGlyphs(atlas, font, src) @@ -31654,11 +31688,11 @@ end --- @param src ImFontConfig function ImFontAtlasBuildSetupFontSpecialGlyphs(atlas, font, src) -- IM_UNUSED(atlas) - IM_ASSERT(font.Sources:contains(src)) + assert(font.Sources:contains(src)) -- Find Fallback character. Actual glyph loaded in GetFontBaked(). --- @type ImWchar[] - local fallback_chars = {font.FallbackChar, IM_UNICODE_CODEPOINT_INVALID, 63, 32} + local fallback_chars = {font.FallbackChar, 65533 --[[IM_UNICODE_CODEPOINT_INVALID]], 63, 32} if font.FallbackChar == 0 then for _, candidate_char in ipairs(fallback_chars) do if candidate_char ~= 0 and font:IsGlyphInFont(candidate_char) then @@ -31698,7 +31732,7 @@ end --- @return ImFontGlyph? function ImFontAtlasBuildSetupFontBakedEllipsis(atlas, baked) local font = baked.OwnerFont - IM_ASSERT(font.EllipsisChar ~= 0) + assert(font.EllipsisChar ~= 0) local dot_glyph = baked:FindGlyphNoFallback(46) -- '.' if (dot_glyph == nil) then @@ -31741,8 +31775,8 @@ end -- (this is called from in hot-path so we avoid extraneous parameters to minimize impact on code size) --- @param baked ImFontBaked function ImFontAtlasBuildSetupFontBakedFallback(baked) - IM_ASSERT(baked.FallbackGlyphIndex == -1) - IM_ASSERT(baked.FallbackAdvanceX == 0.0) + assert(baked.FallbackGlyphIndex == -1) + assert(baked.FallbackAdvanceX == 0.0) local font = baked.OwnerFont local fallback_glyph if (font.FallbackChar ~= 0) then @@ -31765,7 +31799,7 @@ function ImFontAtlasBuildSetupFontLoader(atlas, font_loader) if atlas.FontLoader == font_loader then return end - IM_ASSERT(not atlas.Locked, "Cannot modify a locked ImFontAtlas!") + assert(not atlas.Locked, "Cannot modify a locked ImFontAtlas!") for _, font in atlas.Fonts:iter() do ImFontAtlasFontDestroyOutput(atlas, font) @@ -31776,7 +31810,7 @@ function ImFontAtlasBuildSetupFontLoader(atlas, font_loader) atlas.FontLoader = font_loader atlas.FontLoaderName = font_loader and font_loader.Name or "NULL" - IM_ASSERT(atlas.FontLoaderData == nil) + assert(atlas.FontLoaderData == nil) if atlas.Builder and atlas.FontLoader and atlas.FontLoader.LoaderInit then atlas.FontLoader.LoaderInit(atlas) @@ -31800,7 +31834,7 @@ local function ImFontAtlasBuildUpdateRendererHasTexturesFromContext(atlas) for _, shared_data in atlas.DrawListSharedDatas:iter() do local imgui_ctx = shared_data.Context if (imgui_ctx) then - atlas.RendererHasTextures = bit32.band(imgui_ctx.IO.BackendFlags, ImGuiBackendFlags.RendererHasTextures) ~= 0 + atlas.RendererHasTextures = bit32.band(imgui_ctx.IO.BackendFlags, 16 --[[ImGuiBackendFlags.RendererHasTextures]]) ~= 0 break end @@ -31887,7 +31921,7 @@ function ImFontAtlasTextureAdd(atlas, w, h) if old_tex ~= nil then -- Queue old as to destroy next frame old_tex.WantDestroyNextFrame = true - IM_ASSERT(old_tex.Status == ImTextureStatus.OK or old_tex.Status == ImTextureStatus.WantCreate or old_tex.Status == ImTextureStatus.WantUpdates) + assert(old_tex.Status == 0 --[[ImTextureStatus.OK]] or old_tex.Status == 2 --[[ImTextureStatus.WantCreate]] or old_tex.Status == 3 --[[ImTextureStatus.WantUpdates]]) end new_tex:Create(atlas.TexDesiredFormat, w, h) @@ -31903,7 +31937,7 @@ end function ImFontAtlasTextureGetSizeEstimate(atlas) local min_w = ImUpperPowerOfTwo(atlas.TexMinWidth) local min_h = ImUpperPowerOfTwo(atlas.TexMinHeight) - if (atlas.Builder == nil or atlas.TexData == nil or atlas.TexData.Status == ImTextureStatus.WantDestroy) then + if (atlas.Builder == nil or atlas.TexData == nil or atlas.TexData.Status == 4 --[[ImTextureStatus.WantDestroy]]) then return ImVec2(min_w, min_h) -- ImVec2i end @@ -31918,18 +31952,18 @@ function ImFontAtlasTextureGetSizeEstimate(atlas) if (min_w >= min_h) then new_tex_w = ImMax(min_w, ImUpperPowerOfTwo(surface_sqrt)) new_tex_h = ImMax(min_h, ImFloor((surface_approx + new_tex_w - 1) / new_tex_w)) - if (bit32.band(atlas.Flags, ImFontAtlasFlags.NoPowerOfTwoHeight) == 0) then + if (bit32.band(atlas.Flags, 1 --[[ImFontAtlasFlags.NoPowerOfTwoHeight]]) == 0) then new_tex_h = ImUpperPowerOfTwo(new_tex_h) end else new_tex_h = ImMax(min_h, ImUpperPowerOfTwo(surface_sqrt)) - if (bit32.band(atlas.Flags, ImFontAtlasFlags.NoPowerOfTwoHeight) == 0) then + if (bit32.band(atlas.Flags, 1 --[[ImFontAtlasFlags.NoPowerOfTwoHeight]]) == 0) then new_tex_h = ImUpperPowerOfTwo(new_tex_h) end new_tex_w = ImMax(min_w, ImFloor((surface_approx + new_tex_h - 1) / new_tex_h)) end - IM_ASSERT(ImIsPowerOfTwo(new_tex_w) and ImIsPowerOfTwo(new_tex_h)) + assert(ImIsPowerOfTwo(new_tex_w) and ImIsPowerOfTwo(new_tex_h)) return ImVec2(new_tex_w, new_tex_h) -- ImVec2i end @@ -31986,7 +32020,7 @@ end --- @param atlas ImFontAtlas function ImFontAtlasBuildUpdateTexDataLines(atlas) - if bit32.band(atlas.Flags, ImFontAtlasFlags.NoBakedLines) ~= 0 then + if bit32.band(atlas.Flags, 4 --[[ImFontAtlasFlags.NoBakedLines]]) ~= 0 then return end @@ -32001,7 +32035,7 @@ function ImFontAtlasBuildUpdateTexDataLines(atlas) -- The +2 here is to give space for the end caps, whilst height +1 is to accommodate the fact we have a zero-width row local pack_size = ImVec2(IM_DRAWLIST_TEX_LINES_WIDTH_MAX + 2, IM_DRAWLIST_TEX_LINES_WIDTH_MAX + 1) -- ImVec2i builder.PackIdLinesTexData = atlas:AddCustomRect(pack_size.x, pack_size.y, r) - IM_ASSERT(builder.PackIdLinesTexData ~= ImFontAtlasRectId_Invalid) + assert(builder.PackIdLinesTexData ~= (-1) --[[ImFontAtlasRectId_Invalid]]) end for n = 0, IM_DRAWLIST_TEX_LINES_WIDTH_MAX do -- +1 because of the zero-width row @@ -32014,10 +32048,10 @@ function ImFontAtlasBuildUpdateTexDataLines(atlas) --- @type int local pad_right = r.w - (pad_left + line_width) - IM_ASSERT(pad_left + line_width + pad_right == r.w and y < r.h) -- Make sure we're inside the texture bounds before we start writing pixels + assert(pad_left + line_width + pad_right == r.w and y < r.h) -- Make sure we're inside the texture bounds before we start writing pixels -- Write each slice - if (add_and_draw and tex.Format == ImTextureFormat.Alpha8) then + if (add_and_draw and tex.Format == 1 --[[ImTextureFormat.Alpha8]]) then local write_ptr, write_ptr_base = tex:GetPixelsAt(r.x, r.y + y) for i = 0, pad_left - 1 do @@ -32031,7 +32065,7 @@ function ImFontAtlasBuildUpdateTexDataLines(atlas) for i = 0, pad_right - 1 do write_ptr[write_ptr_base + pad_left + line_width + i] = 0x00 end - elseif (add_and_draw and tex.Format == ImTextureFormat.RGBA32) then + elseif (add_and_draw and tex.Format == 0 --[[ImTextureFormat.RGBA32]]) then local write_ptr, write_ptr_base = tex:GetPixelsAt(r.x, r.y + y) for i = 0, pad_left - 1 do @@ -32039,7 +32073,7 @@ function ImFontAtlasBuildUpdateTexDataLines(atlas) end for i = 0, line_width - 1 do - write_u32(write_ptr, write_ptr_base + (pad_left + i) * 4, IM_COL32_WHITE) + write_u32(write_ptr, write_ptr_base + (pad_left + i) * 4, 4294967295 --[[IM_COL32_WHITE]]) end for i = 0, pad_right - 1 do @@ -32065,10 +32099,10 @@ end --- @param in_marker_char string function ImFontAtlasBuildRenderBitmapFromString(atlas, x, y, w, h, in_str, in_marker_char) local tex = atlas.TexData - IM_ASSERT(x >= 0 and x + w <= tex.Width) - IM_ASSERT(y >= 0 and y + h <= tex.Height) + assert(x >= 0 and x + w <= tex.Width) + assert(y >= 0 and y + h <= tex.Height) - if tex.Format == ImTextureFormat.Alpha8 then + if tex.Format == 1 --[[ImTextureFormat.Alpha8]] then local out_p, out_p_base = tex:GetPixelsAt(x, y) local str_base = 1 for off_y = 0, h - 1 do @@ -32079,12 +32113,12 @@ function ImFontAtlasBuildRenderBitmapFromString(atlas, x, y, w, h, in_str, in_ma out_p_base = out_p_base + tex.Width str_base = str_base + w end - elseif tex.Format == ImTextureFormat.RGBA32 then + elseif tex.Format == 0 --[[ImTextureFormat.RGBA32]] then local out_p, out_p_base = tex:GetPixelsAt(x, y) local str_base = 1 for off_y = 0, h - 1 do for off_x = 0, w - 1 do - write_u32(out_p, out_p_base + off_x * 4, (in_str[str_base + off_x] == in_marker_char) and IM_COL32_WHITE or IM_COL32_BLACK_TRANS) + write_u32(out_p, out_p_base + off_x * 4, (in_str[str_base + off_x] == in_marker_char) and 4294967295 --[[IM_COL32_WHITE]] or 0 --[[IM_COL32_BLACK_TRANS]]) end out_p_base = out_p_base + tex.Width * 4 @@ -32098,24 +32132,24 @@ function ImFontAtlasBuildUpdateTexDataBasic(atlas) -- Pack and store identifier so we can refresh UV coordinates on texture resize. -- FIXME-NEWATLAS: User/custom rects where user code wants to store UV coordinates will need to do the same thing. local builder = atlas.Builder - local pack_size = (bit32.band(atlas.Flags, ImFontAtlasFlags.NoMouseCursors) ~= 0) and ImVec2(2, 2) or ImVec2(FONT_ATLAS_DEFAULT_TEX_DATA_W * 2 + 1, FONT_ATLAS_DEFAULT_TEX_DATA_H) + local pack_size = (bit32.band(atlas.Flags, 2 --[[ImFontAtlasFlags.NoMouseCursors]]) ~= 0) and ImVec2(2, 2) or ImVec2(122 --[[FONT_ATLAS_DEFAULT_TEX_DATA_W]] * 2 + 1, 27 --[[FONT_ATLAS_DEFAULT_TEX_DATA_H]]) local r = ImFontAtlasRect() local add_and_draw = (atlas:GetCustomRect(builder.PackIdMouseCursors, r) == false) if (add_and_draw) then builder.PackIdMouseCursors = atlas:AddCustomRect(pack_size.x, pack_size.y, r) - IM_ASSERT(builder.PackIdMouseCursors ~= ImFontAtlasRectId_Invalid) + assert(builder.PackIdMouseCursors ~= (-1) --[[ImFontAtlasRectId_Invalid]]) -- Draw to texture - if bit32.band(atlas.Flags, ImFontAtlasFlags.NoMouseCursors) ~= 0 then + if bit32.band(atlas.Flags, 2 --[[ImFontAtlasFlags.NoMouseCursors]]) ~= 0 then -- 2x2 white pixels ImFontAtlasBuildRenderBitmapFromString(atlas, r.x, r.y, 2, 2, {"X", "X", "X", "X"}, "X") else -- 2x2 white pixels + mouse cursors local x_for_white = r.x - local x_for_black = r.x + FONT_ATLAS_DEFAULT_TEX_DATA_W + 1 - ImFontAtlasBuildRenderBitmapFromString(atlas, x_for_white, r.y, FONT_ATLAS_DEFAULT_TEX_DATA_W, FONT_ATLAS_DEFAULT_TEX_DATA_H, FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS, ".") - ImFontAtlasBuildRenderBitmapFromString(atlas, x_for_black, r.y, FONT_ATLAS_DEFAULT_TEX_DATA_W, FONT_ATLAS_DEFAULT_TEX_DATA_H, FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS, "X") + local x_for_black = r.x + 122 --[[FONT_ATLAS_DEFAULT_TEX_DATA_W]] + 1 + ImFontAtlasBuildRenderBitmapFromString(atlas, x_for_white, r.y, 122 --[[FONT_ATLAS_DEFAULT_TEX_DATA_W]], 27 --[[FONT_ATLAS_DEFAULT_TEX_DATA_H]], FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS, ".") + ImFontAtlasBuildRenderBitmapFromString(atlas, x_for_black, r.y, 122 --[[FONT_ATLAS_DEFAULT_TEX_DATA_W]], 27 --[[FONT_ATLAS_DEFAULT_TEX_DATA_H]], FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS, "X") end end @@ -32183,7 +32217,7 @@ function ImFontAtlasBuildDestroy(atlas) end if atlas.Builder and atlas.FontLoader and atlas.FontLoader.LoaderShutdown then atlas.FontLoader.LoaderShutdown(atlas) - IM_ASSERT(atlas.FontLoaderData == nil) + assert(atlas.FontLoaderData == nil) end atlas.Builder = nil end @@ -32236,7 +32270,7 @@ end -- When atlas.RendererHasTextures = true, this is only called if no font were loaded. --- @param atlas ImFontAtlas function ImFontAtlasBuildMain(atlas) - IM_ASSERT(not atlas.Locked, "Cannot modify a locked ImFontAtlas!") + assert(not atlas.Locked, "Cannot modify a locked ImFontAtlas!") if (atlas.TexData and atlas.TexData.Format ~= atlas.TexDesiredFormat) then ImFontAtlasBuildClear(atlas) end @@ -32272,20 +32306,20 @@ function MT.ImTextureData:DestroyPixels() end function ImTextureDataGetFormatBytesPerPixel(format) - if format == ImTextureFormat.Alpha8 then + if format == 1 --[[ImTextureFormat.Alpha8]] then return 1 - elseif format == ImTextureFormat.RGBA32 then + elseif format == 0 --[[ImTextureFormat.RGBA32]] then return 4 end - IM_ASSERT(false) + assert(false) return 0 end function MT.ImTextureData:Create(format, w, h) - IM_ASSERT(self.Status == ImTextureStatus.Destroyed) + assert(self.Status == 1 --[[ImTextureStatus.Destroyed]]) self:DestroyPixels() self.Format = format - self.Status = ImTextureStatus.WantCreate + self.Status = 2 --[[ImTextureStatus.WantCreate]] self.Width = w self.Height = h self.BytesPerPixel = ImTextureDataGetFormatBytesPerPixel(format) @@ -32367,7 +32401,7 @@ function MT.ImFont:ClearOutputData() end --self.FallbackChar = 0 self.EllipsisChar = 0 - for i = 1, (IM_UNICODE_CODEPOINT_MAX + 1) / 8192 / 8 do self.Used8kPagesMap[i] = 0 end + for i = 1, (65535 --[[IM_UNICODE_CODEPOINT_MAX]] + 1) / 8192 / 8 do self.Used8kPagesMap[i] = 0 end self.LastBaked = nil end @@ -32388,25 +32422,25 @@ end function ImFontAtlasBakedGetOrAdd(atlas, font, font_size, font_rasterizer_density) -- FIXME-NEWATLAS: Design for picking a nearest size based on some criteria? -- FIXME-NEWATLAS: Altering font density won't work right away. - IM_ASSERT(font_size > 0.0 and font_rasterizer_density > 0.0) + assert(font_size > 0.0 and font_rasterizer_density > 0.0) local baked_id = ImFontAtlasBakedGetId(font.FontId, font_size, font_rasterizer_density) local builder = atlas.Builder local baked = builder.BakedMap[baked_id] if baked ~= nil then - IM_ASSERT(baked.Size == font_size and baked.OwnerFont == font and baked.BakedId == baked_id) + assert(baked.Size == font_size and baked.OwnerFont == font and baked.BakedId == baked_id) return baked end -- If atlas is locked, find closest match -- FIXME-OPT: This is not an optimal query. - if (bit32.band(font.Flags, ImFontFlags.LockBakedSizes) ~= 0 or atlas.Locked) then + if (bit32.band(font.Flags, 8 --[[ImFontFlags.LockBakedSizes]]) ~= 0 or atlas.Locked) then baked = ImFontAtlasBakedGetClosestMatch(atlas, font, font_size, font_rasterizer_density) if baked ~= nil then return baked end if atlas.Locked then - IM_ASSERT(not atlas.Locked, "Cannot use dynamic font size with a locked ImFontAtlas!") -- Locked because rendering backend does not support ImGuiBackendFlags.RendererHasTextures! + assert(not atlas.Locked, "Cannot use dynamic font size with a locked ImFontAtlas!") -- Locked because rendering backend does not support ImGuiBackendFlags.RendererHasTextures! return nil end end @@ -32430,12 +32464,12 @@ function ImFontAtlasBakedAddFontGlyph(atlas, baked, src, in_glyph) local glyph_idx = baked.Glyphs.Size + 1 baked.Glyphs:push_back(in_glyph) local glyph = baked.Glyphs.Data[glyph_idx] - IM_ASSERT(baked.Glyphs.Size < 0xFFFE) -- IndexLookup[] hold 16-bit values and -1/-2 are reserved. + assert(baked.Glyphs.Size < 0xFFFE) -- IndexLookup[] hold 16-bit values and -1/-2 are reserved. -- Set UV from packed rectangle - if (glyph.PackId ~= ImFontAtlasRectId_Invalid) then + if (glyph.PackId ~= (-1) --[[ImFontAtlasRectId_Invalid]]) then local r = ImFontAtlasPackGetRect(atlas, glyph.PackId) - IM_ASSERT(glyph.U0 == 0.0 and glyph.V0 == 0.0 and glyph.U1 == 0.0 and glyph.V1 == 0.0) + assert(glyph.U0 == 0.0 and glyph.V0 == 0.0 and glyph.U1 == 0.0 and glyph.V1 == 0.0) glyph.U0 = (r.x) * atlas.TexUvScale.x glyph.V0 = (r.y) * atlas.TexUvScale.y glyph.U1 = (r.x + r.w) * atlas.TexUvScale.x @@ -32561,7 +32595,7 @@ end function ImFontBaked_BuildLoadGlyph(baked, codepoint, only_load_advance_x) local font = baked.OwnerFont local atlas = font.OwnerAtlas - if atlas.Locked or bit32.band(font.Flags, ImFontFlags.NoLoadGlyphs) ~= 0 then + if atlas.Locked or bit32.band(font.Flags, 4 --[[ImFontFlags.NoLoadGlyphs]]) ~= 0 then -- Lazily load fallback glyph if baked.FallbackGlyphIndex == -1 and baked.LoadNoFallback == false then ImFontAtlasBuildSetupFontBakedFallback(baked) @@ -32639,7 +32673,7 @@ end --- @param codepoint ImWchar --- @return float function ImFontBaked_BuildLoadGlyphAdvanceX(baked, codepoint) - if (baked.Size >= IMGUI_FONT_SIZE_THRESHOLD_FOR_LOADADVANCEXONLYMODE) or baked.LoadNoRenderOnLayout then + if (baked.Size >= 128 --[[IMGUI_FONT_SIZE_THRESHOLD_FOR_LOADADVANCEXONLYMODE]]) or baked.LoadNoRenderOnLayout then -- First load AdvanceX value used by CalcTextSize() API then load the rest when loaded by drawing API. local only_advance_x local glyph @@ -32696,7 +32730,7 @@ end local function ImTextCalcWordWrapNextLineStart(text, text_begin, text_end, flags) local pos = text_begin - if bit32.band(flags, ImDrawTextFlags.WrapKeepBlanks) == 0 then + if bit32.band(flags, 2 --[[ImDrawTextFlags.WrapKeepBlanks]]) == 0 then while pos < text_end and ImCharIsBlankA(ImStrByte(text, pos)) do pos = pos + 1 end @@ -32725,7 +32759,7 @@ end --- @param char_class ImWcharClass --- @param c unsigned_int function ImTextClassifierSetCharClass(bits, codepoint_min, codepoint_end, char_class, c) - IM_ASSERT(c >= codepoint_min and c < codepoint_end) + assert(c >= codepoint_min and c < codepoint_end) -- IM_UNUSED(codepoint_end) c = c - codepoint_min local shift = bit32.lshift(bit32.band(c, 15), 1) @@ -32757,14 +32791,14 @@ function ImTextInitClassifiers() -- List of hardcoded separators: .,;!?'" -- Making this dynamic given known ranges is trivial BUT requires us to standardize where you pass them as parameters. (#3002, #8503) - ImTextClassifierClear(g_CharClassifierIsSeparator_0000_007f, 0, 128, ImWcharClass.Other) - ImTextClassifierSetCharClassFromStr(g_CharClassifierIsSeparator_0000_007f, 0, 128, ImWcharClass.Blank, " \t") - ImTextClassifierSetCharClassFromStr(g_CharClassifierIsSeparator_0000_007f, 0, 128, ImWcharClass.Punct, ".,;!?\"") + ImTextClassifierClear(g_CharClassifierIsSeparator_0000_007f, 0, 128, 2 --[[ImWcharClass.Other]]) + ImTextClassifierSetCharClassFromStr(g_CharClassifierIsSeparator_0000_007f, 0, 128, 0 --[[ImWcharClass.Blank]], " \t") + ImTextClassifierSetCharClassFromStr(g_CharClassifierIsSeparator_0000_007f, 0, 128, 1 --[[ImWcharClass.Punct]], ".,;!?\"") - ImTextClassifierClear(g_CharClassifierIsSeparator_3000_300f, 0x3000, 0x300F, ImWcharClass.Other) - ImTextClassifierSetCharClass(g_CharClassifierIsSeparator_3000_300f, 0x3000, 0x300F, ImWcharClass.Blank, 0x3000) - ImTextClassifierSetCharClass(g_CharClassifierIsSeparator_3000_300f, 0x3000, 0x300F, ImWcharClass.Punct, 0x3001) - ImTextClassifierSetCharClass(g_CharClassifierIsSeparator_3000_300f, 0x3000, 0x300F, ImWcharClass.Punct, 0x3002) + ImTextClassifierClear(g_CharClassifierIsSeparator_3000_300f, 0x3000, 0x300F, 2 --[[ImWcharClass.Other]]) + ImTextClassifierSetCharClass(g_CharClassifierIsSeparator_3000_300f, 0x3000, 0x300F, 0 --[[ImWcharClass.Blank]], 0x3000) + ImTextClassifierSetCharClass(g_CharClassifierIsSeparator_3000_300f, 0x3000, 0x300F, 1 --[[ImWcharClass.Punct]], 0x3001) + ImTextClassifierSetCharClass(g_CharClassifierIsSeparator_3000_300f, 0x3000, 0x300F, 1 --[[ImWcharClass.Punct]], 0x3002) end -- Simple word-wrapping for English, not full-featured. Please submit failing cases! @@ -32827,10 +32861,10 @@ function ImFontCalcWordWrapPositionEx_Uncached(baked, size, text, pos, text_end, wrap_width = wrap_width / scale -- We work with unscaled widths to avoid scaling every characters local s = pos - IM_ASSERT(text_end ~= nil) + assert(text_end ~= nil) - local prev_type = ImWcharClass.Other - local keep_blanks = bit32.band(flags, ImDrawTextFlags.WrapKeepBlanks) ~= 0 + local prev_type = 2 --[[ImWcharClass.Other]] + local keep_blanks = bit32.band(flags, 2 --[[ImDrawTextFlags.WrapKeepBlanks]]) ~= 0 -- Find next wrapping point --local span_begin = s @@ -32840,7 +32874,7 @@ function ImFontCalcWordWrapPositionEx_Uncached(baked, size, text, pos, text_end, local stop = false local text_is_str = type(text) == "string" -- [Luau] ImStrByte() inlined (once per character) local adv_data, adv_n = baked.IndexAdvanceX.Data, baked.IndexAdvanceX.Size -- [Luau] hoisted, refreshed after a glyph load - local CLASS_BLANK, CLASS_PUNCT, CLASS_OTHER = ImWcharClass.Blank, ImWcharClass.Punct, ImWcharClass.Other + local CLASS_BLANK, CLASS_PUNCT, CLASS_OTHER = 0 --[[ImWcharClass.Blank]], 1 --[[ImWcharClass.Punct]], 2 --[[ImWcharClass.Other]] local classifier_0000_007f = g_CharClassifierIsSeparator_0000_007f while s < text_end do repeat @@ -32962,8 +32996,8 @@ function ImFontCalcTextSizeEx(font, size, max_width, wrap_width, text, text_begi local cache_key = nil local wrap_cache = nil local text_len1 = text_is_str and #text + 1 or -1 - local cacheable = text_is_str and text_begin == 1 and out_offset == nil and max_width >= FLT_MAX - and (text_end == nil or text_end == text_len1) and (text_end_display == nil or text_end_display == text_len1) and (flags == nil or bit32.band(flags, ImDrawTextFlags.StopOnNewLine) == 0) + local cacheable = text_is_str and text_begin == 1 and out_offset == nil and max_width >= 3.4028234663853e+38 --[[FLT_MAX]] + and (text_end == nil or text_end == text_len1) and (text_end_display == nil or text_end_display == text_len1) and (flags == nil or bit32.band(flags, 4 --[[ImDrawTextFlags.StopOnNewLine]]) == 0) if cacheable and wrap_width <= 0.0 then local baked = font:GetFontBaked(size) local cache = baked._TextSizeCache @@ -33029,7 +33063,7 @@ function ImFontCalcTextSizeEx(font, size, max_width, wrap_width, text, text_begi text_size.y = text_size.y + line_height line_width = 0.0 s = ImTextCalcWordWrapNextLineStart(text, s, text_end, flags) -- Wrapping skips upcoming blanks - if bit32.band(flags, ImDrawTextFlags.StopOnNewLine) ~= 0 then + if bit32.band(flags, 4 --[[ImDrawTextFlags.StopOnNewLine]]) ~= 0 then stop = true; break end word_wrap_eol = nil @@ -33054,7 +33088,7 @@ function ImFontCalcTextSizeEx(font, size, max_width, wrap_width, text, text_begi text_size.x = ImMax(text_size.x, line_width) text_size.y = text_size.y + line_height line_width = 0.0 - if bit32.band(flags, ImDrawTextFlags.StopOnNewLine) ~= 0 then + if bit32.band(flags, 4 --[[ImDrawTextFlags.StopOnNewLine]]) ~= 0 then stop = true; break end @@ -33117,7 +33151,7 @@ end --- @param text_begin int --- @param text_end? int function MT.ImFont:CalcTextSizeA(size, max_width, wrap_width, text, text_begin, text_end) - return ImFontCalcTextSizeEx(self, size, max_width, wrap_width, text, text_begin, text_end, text_end, nil, ImDrawTextFlags.None) + return ImFontCalcTextSizeEx(self, size, max_width, wrap_width, text, text_begin, text_end, text_end, nil, 0 --[[ImDrawTextFlags.None]]) end --- Note: as with every ImDrawList drawing function, this expects that the font atlas texture is bound. @@ -33136,7 +33170,7 @@ function MT.ImFont:RenderChar(draw_list, size, pos, col, c, cpu_fine_clip) return end if glyph.Colored then - col = bit32.bor(col, bit32.bnot(IM_COL32_A_MASK)) + col = bit32.bor(col, bit32.bnot(4278190080 --[[IM_COL32_A_MASK]])) end local scale @@ -33148,7 +33182,7 @@ function MT.ImFont:RenderChar(draw_list, size, pos, col, c, cpu_fine_clip) local x = pos.x local y = pos.y - if bit32.band(draw_list.Flags, ImDrawListFlags.TextNoPixelSnap) == 0 then + if bit32.band(draw_list.Flags, 16 --[[ImDrawListFlags.TextNoPixelSnap]]) == 0 then x = IM_TRUNC(x) y = IM_TRUNC(y) end @@ -33184,14 +33218,14 @@ end function MT.ImFontAtlas:AddFont(font_cfg_in) -- Sanity Checks - IM_ASSERT(not self.Locked, "Cannot modify a locked ImFontAtlas!") - IM_ASSERT((font_cfg_in.FontData ~= nil and font_cfg_in.FontDataSize > 0) or (font_cfg_in.FontLoader ~= nil)) - IM_ASSERT(font_cfg_in.SizePixels > 0.0, "Is ImFontConfig struct correctly initialized?") - IM_ASSERT(font_cfg_in.RasterizerDensity > 0.0, "Is ImFontConfig struct correctly initialized?") + assert(not self.Locked, "Cannot modify a locked ImFontAtlas!") + assert((font_cfg_in.FontData ~= nil and font_cfg_in.FontDataSize > 0) or (font_cfg_in.FontLoader ~= nil)) + assert(font_cfg_in.SizePixels > 0.0, "Is ImFontConfig struct correctly initialized?") + assert(font_cfg_in.RasterizerDensity > 0.0, "Is ImFontConfig struct correctly initialized?") if font_cfg_in.GlyphOffset.x ~= 0.0 or font_cfg_in.GlyphOffset.y ~= 0.0 or - font_cfg_in.GlyphMinAdvanceX ~= 0.0 or font_cfg_in.GlyphMaxAdvanceX ~= FLT_MAX then - IM_ASSERT(font_cfg_in.SizePixels ~= 0.0, + font_cfg_in.GlyphMinAdvanceX ~= 0.0 or font_cfg_in.GlyphMaxAdvanceX ~= 3.4028234663853e+38 --[[FLT_MAX]] then + assert(font_cfg_in.SizePixels ~= 0.0, "Specifying glyph offset/advances requires a reference size to base it on.") end @@ -33212,7 +33246,7 @@ function MT.ImFontAtlas:AddFont(font_cfg_in) font.CurrentRasterizerDensity = font_cfg_in.RasterizerDensity self.Fonts:push_back(font) else - IM_ASSERT(self.Fonts.Size > 0, "Cannot use MergeMode for the first font!") -- When using MergeMode make sure that a font has already been added before. + assert(self.Fonts.Size > 0, "Cannot use MergeMode for the first font!") -- When using MergeMode make sure that a font has already been added before. font = (font_cfg_in.DstFont ~= nil) and font_cfg_in.DstFont or self.Fonts:back() ImFontAtlasFontDiscardBakes(self, font, 0) -- Need to discard bakes if the font was already used, because baked->FontLoaderDatas[] will change size. (#9162) end @@ -33231,21 +33265,21 @@ function MT.ImFontAtlas:AddFont(font_cfg_in) if font_cfg.GlyphExcludeRanges ~= nil then local size = 0 for _, v in ipairs(font_cfg.GlyphExcludeRanges) do if v == 0 then break end size = size + 1 end - IM_ASSERT(bit32.band(size, 1) == 0, "GlyphExcludeRanges[] size must be multiple of two!") - IM_ASSERT(size <= 64, "GlyphExcludeRanges[] size must be small!") + assert(bit32.band(size, 1) == 0, "GlyphExcludeRanges[] size must be multiple of two!") + assert(size <= 64, "GlyphExcludeRanges[] size must be small!") end if font_cfg.FontLoader ~= nil then - IM_ASSERT(font_cfg.FontLoader.FontBakedLoadGlyph ~= nil) - IM_ASSERT(font_cfg.FontLoader.LoaderInit == nil and font_cfg.FontLoader.LoaderShutdown == nil) -- FIXME-NEWATLAS: Unsupported yet. + assert(font_cfg.FontLoader.FontBakedLoadGlyph ~= nil) + assert(font_cfg.FontLoader.LoaderInit == nil and font_cfg.FontLoader.LoaderShutdown == nil) -- FIXME-NEWATLAS: Unsupported yet. end -- | Target w/ Implicit RefSize | Target w/ Explicit RefSize | -- Adding w/ Implicit RefSize: | OK (same scale) | OK (same scale) | -- Adding w/ Explicit RefSize: | KO | OK (custom scale) | if font_cfg_in.MergeMode and font_cfg_in.SizePixels > 0 then - IM_ASSERT(bit32.band(font.Flags, ImFontFlags.ImplicitRefSize) == 0, "Cannot use MergeMode with an explicit reference size when the destination font used an implicit reference size!") + assert(bit32.band(font.Flags, 16 --[[ImFontFlags.ImplicitRefSize]]) == 0, "Cannot use MergeMode with an explicit reference size when the destination font used an implicit reference size!") end - IM_ASSERT(font_cfg.FontLoaderData == nil) + assert(font_cfg.FontLoaderData == nil) if not ImFontAtlasFontSourceInit(self, font_cfg) then -- Rollback (this is a fragile/rarely exercised code-path. TestSuite's "misc_atlas_add_invalid_font" aim to test this) @@ -33287,10 +33321,10 @@ function MT.ImFontAtlas:AddFontDefault(font_cfg) end function MT.ImFontAtlas:AddFontFromMemoryTTF(font_data, font_data_size, size_pixels, font_cfg_template, glyph_ranges) - IM_ASSERT(not self.Locked, "Cannot modify a locked ImFontAtlas!") + assert(not self.Locked, "Cannot modify a locked ImFontAtlas!") local font_cfg = font_cfg_template and font_cfg_template or ImFontConfig() - IM_ASSERT(font_cfg.FontData == nil) - IM_ASSERT(font_data_size > 100, "Incorrect value for font_data_size!") -- Heuristic to prevent accidentally passing a wrong value to font_data_size. + assert(font_cfg.FontData == nil) + assert(font_data_size > 100, "Incorrect value for font_data_size!") -- Heuristic to prevent accidentally passing a wrong value to font_data_size. font_cfg.FontData = font_data font_cfg.FontDataSize = font_data_size font_cfg.SizePixels = (size_pixels > 0.0) and size_pixels or font_cfg.SizePixels @@ -33306,11 +33340,11 @@ function MT.ImFontAtlas:AddFontFromMemoryCompressedTTF() end function MT.ImFontAtlas:AddFontFromFileTTF(filename, size_pixels, font_cfg_template, glyph_ranges) - IM_ASSERT(not self.Locked, "Cannot modify a locked ImFontAtlas!") + assert(not self.Locked, "Cannot modify a locked ImFontAtlas!") local data, data_size = ImStd.ImFileLoadToMemory(filename, "rb") if not data then - if (font_cfg_template == nil or (bit32.band(font_cfg_template.Flags, ImFontFlags.NoLoadError) == 0)) then + if (font_cfg_template == nil or (bit32.band(font_cfg_template.Flags, 2 --[[ImFontFlags.NoLoadError]]) == 0)) then -- IMGUI_DEBUG_LOG("While loading '%s'\n", filename) IM_ASSERT_USER_ERROR(0, "Could not load font file!") end @@ -33352,7 +33386,7 @@ function MT.ImFontAtlas:AddFontDefaultBitmap(font_cfg_template) end if font_cfg.SizePixels <= 0.0 then font_cfg.SizePixels = 13.0 -- This only serves (1) as a reference for GlyphOffset.y setting and (2) as a default for pre-1.92 backend. - font_cfg.Flags = bit32.bor(font_cfg.Flags, ImFontFlags.ImplicitRefSize) + font_cfg.Flags = bit32.bor(font_cfg.Flags, 16 --[[ImFontFlags.ImplicitRefSize]]) end if not font_cfg.Name or font_cfg.Name == "" then font_cfg.Name = "ProggyClean.ttf" @@ -33374,7 +33408,7 @@ function MT.ImFontAtlas:AddFontDefaultVector(font_cfg_template) end if font_cfg.SizePixels <= 0.0 then font_cfg.SizePixels = 13.0 - font_cfg.Flags = bit32.bor(font_cfg.Flags, ImFontFlags.ImplicitRefSize) + font_cfg.Flags = bit32.bor(font_cfg.Flags, 16 --[[ImFontFlags.ImplicitRefSize]]) end if not font_cfg.Name or font_cfg.Name == "" then font_cfg.Name = "ProggyForever.ttf" @@ -33391,7 +33425,7 @@ function MT.ImFontAtlas:GetCustomRect(id, out_r) if r == nil then return false end - IM_ASSERT(self.TexData.Width > 0 and self.TexData.Height > 0) -- Font atlas needs to be built before we can calculate UV coordinates + assert(self.TexData.Width > 0 and self.TexData.Height > 0) -- Font atlas needs to be built before we can calculate UV coordinates if out_r == nil then return true end @@ -33412,10 +33446,10 @@ end --- @param out_uv_border ImVec2[] --- @param out_uv_fill ImVec2[] function ImFontAtlasGetMouseCursorTexData(atlas, cursor_type, out_offset, out_size, out_uv_border, out_uv_fill) - if cursor_type <= ImGuiMouseCursor.None or cursor_type >= ImGuiMouseCursor.COUNT then + if cursor_type <= (-1) --[[ImGuiMouseCursor.None]] or cursor_type >= 11 --[[ImGuiMouseCursor.COUNT]] then return false end - if bit32.band(atlas.Flags, ImFontAtlasFlags.NoMouseCursors) ~= 0 then + if bit32.band(atlas.Flags, 2 --[[ImFontAtlasFlags.NoMouseCursors]]) ~= 0 then return false end @@ -33426,7 +33460,7 @@ function ImFontAtlasGetMouseCursorTexData(atlas, cursor_type, out_offset, out_si ImVec2_Copy(out_offset, FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[cursor_type + 1][3]) ImVec2_Copy(out_uv_border[1], (pos) * atlas.TexUvScale) ImVec2_Copy(out_uv_border[2], (pos + size) * atlas.TexUvScale) - pos.x = pos.x + (FONT_ATLAS_DEFAULT_TEX_DATA_W + 1) + pos.x = pos.x + (122 --[[FONT_ATLAS_DEFAULT_TEX_DATA_W]] + 1) ImVec2_Copy(out_uv_fill[1], (pos) * atlas.TexUvScale) ImVec2_Copy(out_uv_fill[2], (pos + size) * atlas.TexUvScale) @@ -33435,16 +33469,16 @@ end -- At it is common to do an AddCustomRect() followed by a GetCustomRect(), we provide an optional 'out_r' argument to retrieve the info straight away. function MT.ImFontAtlas:AddCustomRect(width, height, out_r) - IM_ASSERT(width > 0 and width <= 0xFFFF) - IM_ASSERT(height > 0 and height <= 0xFFFF) + assert(width > 0 and width <= 0xFFFF) + assert(height > 0 and height <= 0xFFFF) if (self.Builder == nil) then ImFontAtlasBuildInit(self) end local r_id = ImFontAtlasPackAddRect(self, width, height) - if (r_id == ImFontAtlasRectId_Invalid) then - return ImFontAtlasRectId_Invalid + if (r_id == (-1) --[[ImFontAtlasRectId_Invalid]]) then + return (-1) --[[ImFontAtlasRectId_Invalid]] end if (out_r ~= nil) then self:GetCustomRect(r_id, out_r) @@ -33510,10 +33544,10 @@ function ImGui.AddDrawListToDrawDataEx(draw_data, out_list, draw_list) -- Draw list sanity check. Detect mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc. -- May trigger for you if you are using PrimXXX functions incorrectly. - IM_ASSERT(draw_list.VtxBuffer.Size == 0 or draw_list._VtxWritePtr == draw_list.VtxBuffer.Size + 1) - IM_ASSERT(draw_list.IdxBuffer.Size == 0 or draw_list._IdxWritePtr == draw_list.IdxBuffer.Size + 1) - if (bit32.band(draw_list.Flags, ImDrawListFlags.AllowVtxOffset) == 0) then - IM_ASSERT(draw_list._VtxCurrentIdx == draw_list.VtxBuffer.Size + 1) + assert(draw_list.VtxBuffer.Size == 0 or draw_list._VtxWritePtr == draw_list.VtxBuffer.Size + 1) + assert(draw_list.IdxBuffer.Size == 0 or draw_list._IdxWritePtr == draw_list.IdxBuffer.Size + 1) + if (bit32.band(draw_list.Flags, 8 --[[ImDrawListFlags.AllowVtxOffset]]) == 0) then + assert(draw_list._VtxCurrentIdx == draw_list.VtxBuffer.Size + 1) end -- Add to output list + records state in ImDrawData @@ -33530,9 +33564,9 @@ end local IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN = 4 local IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX = 512 -local function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(_RAD, _MAXERROR) return ImClamp(IM_ROUNDUP_TO_EVEN(ImCeil(IM_PI / ImAcos(1 - ImMin(_MAXERROR, _RAD) / _RAD))), IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX) end -local function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_R(_N, _MAXERROR) return (_MAXERROR / (1 - ImCos(IM_PI / ImMax(_N, IM_PI)))) end -local function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_ERROR(_N, _RAD) return ((1 - ImCos(IM_PI / ImMax(_N, IM_PI))) / _RAD) end +local function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(_RAD, _MAXERROR) return ImClamp(IM_ROUNDUP_TO_EVEN(ImCeil(3.141592653589793 --[[IM_PI]] / ImAcos(1 - ImMin(_MAXERROR, _RAD) / _RAD))), IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX) end +local function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_R(_N, _MAXERROR) return (_MAXERROR / (1 - ImCos(3.141592653589793 --[[IM_PI]] / ImMax(_N, 3.141592653589793 --[[IM_PI]])))) end +local function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_ERROR(_N, _RAD) return ((1 - ImCos(3.141592653589793 --[[IM_PI]] / ImMax(_N, 3.141592653589793 --[[IM_PI]]))) / _RAD) end ------------------------------------------------------------------------------- -- [SECTION] ImDrawList @@ -33543,15 +33577,15 @@ function MT.ImDrawListSharedData:SetCircleTessellationMaxError(max_error) return end - IM_ASSERT(max_error > 0) + assert(max_error > 0) self.CircleTessellationMaxError = max_error for i = 1, 64 do -- IM_COUNTOF(CircleSegmentCounts) local radius = (i - 1) - self.CircleSegmentCounts[i] = (i > 1) and IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(radius, self.CircleTessellationMaxError) or IM_DRAWLIST_ARCFAST_SAMPLE_MAX + self.CircleSegmentCounts[i] = (i > 1) and IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(radius, self.CircleTessellationMaxError) or 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] end - self.ArcFastRadiusCutoff = IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_R(IM_DRAWLIST_ARCFAST_SAMPLE_MAX, self.CircleTessellationMaxError) + self.ArcFastRadiusCutoff = IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_R(48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]], self.CircleTessellationMaxError) end --- @param data ImDrawListSharedData @@ -33600,7 +33634,7 @@ function MT.ImDrawList:_ClearFreeMemory() self.IdxBuffer:clear() self.VtxBuffer:clear() - self.Flags = ImDrawListFlags.None + self.Flags = 0 --[[ImDrawListFlags.None]] self._VtxCurrentIdx = 1 self._VtxWritePtr = 1 @@ -33621,7 +33655,7 @@ function MT.ImDrawList:AddDrawCmd() draw_cmd.VtxOffset = self._CmdHeader.VtxOffset draw_cmd.IdxOffset = self.IdxBuffer.Size - IM_ASSERT(draw_cmd.ClipRect.x <= draw_cmd.ClipRect.z and draw_cmd.ClipRect.y <= draw_cmd.ClipRect.w) + assert(draw_cmd.ClipRect.x <= draw_cmd.ClipRect.z and draw_cmd.ClipRect.y <= draw_cmd.ClipRect.w) -- [Luau] inline self.CmdBuffer:push_back(draw_cmd) local cmd_buffer = self.CmdBuffer local n = cmd_buffer.Size + 1 @@ -33647,11 +33681,11 @@ end function MT.ImDrawList:AddCallback(callback, userdata, userdata_size) if userdata_size == nil then userdata_size = 0 end - IM_ASSERT(callback ~= nil) + assert(callback ~= nil) IM_ASSERT_PARANOID(self.CmdBuffer.Size > 0) local curr_cmd = self.CmdBuffer.Data[self.CmdBuffer.Size] - IM_ASSERT(curr_cmd.UserCallback == nil) + assert(curr_cmd.UserCallback == nil) if curr_cmd.ElemCount ~= 0 then self:AddDrawCmd() curr_cmd = self.CmdBuffer.Data[self.CmdBuffer.Size] @@ -33663,8 +33697,8 @@ function MT.ImDrawList:AddCallback(callback, userdata, userdata_size) curr_cmd.UserCallbackData = userdata else - IM_ASSERT(userdata ~= nil) - IM_ASSERT(userdata_size < bit32.lshift(1, 31)) + assert(userdata ~= nil) + assert(userdata_size < bit32.lshift(1, 31)) end @@ -33745,7 +33779,7 @@ function MT.ImDrawList:_OnChangedClipRect() end end - IM_ASSERT(curr_cmd.UserCallback == nil) + assert(curr_cmd.UserCallback == nil) -- Try to merge with previous command if it matches, else use current command local prev_cmd = self.CmdBuffer.Data[self.CmdBuffer.Size - 1] @@ -33795,7 +33829,7 @@ function MT.ImDrawList:_OnChangedVtxOffset() self:AddDrawCmd() return end - IM_ASSERT(curr_cmd.UserCallback == nil) + assert(curr_cmd.UserCallback == nil) curr_cmd.VtxOffset = self._CmdHeader.VtxOffset end @@ -33838,7 +33872,7 @@ end --- @param draw_list ImDrawList --- @param channels_count int function MT.ImDrawListSplitter:Split(draw_list, channels_count) - IM_ASSERT(self._Current == 0 and self._Count <= 1, "Nested channel splitting is not supported. Please use separate instances of ImDrawListSplitter.") + assert(self._Current == 0 and self._Count <= 1, "Nested channel splitting is not supported. Please use separate instances of ImDrawListSplitter.") local old_channels_count = self._Channels.Size if old_channels_count < channels_count then self._Channels:reserve(channels_count) -- Avoid over reserving since this is likely to stay stable @@ -33955,7 +33989,7 @@ end --- @param idx int # 0-based channel index function MT.ImDrawListSplitter:SetCurrentChannel(draw_list, idx) - IM_ASSERT(idx >= 0 and idx < self._Count) + assert(idx >= 0 and idx < self._Count) if self._Current == idx then return end @@ -34007,15 +34041,15 @@ function MT.ImDrawList:ChannelsSetCurrent(n) self._Splitter:SetCurrentChannel(se --- @param col ImU32 function MT.ImDrawList:AddConvexPolyFilled(points, points_count, col) - if points_count < 3 or bit32.band(col, IM_COL32_A_MASK) == 0 then + if points_count < 3 or bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end local uv = self._Data.TexUvWhitePixel - if bit32.band(self.Flags, ImDrawListFlags.AntiAliasedFill) ~= 0 then + if bit32.band(self.Flags, 4 --[[ImDrawListFlags.AntiAliasedFill]]) ~= 0 then local AA_SIZE = self._FringeScale - local col_trans = bit32.band(col, bit32.bnot(IM_COL32_A_MASK)) + local col_trans = bit32.band(col, bit32.bnot(4278190080 --[[IM_COL32_A_MASK]])) local idx_count = (points_count - 2) * 3 + points_count * 6 local vtx_count = points_count * 2 self:PrimReserve(idx_count, vtx_count) @@ -34099,7 +34133,7 @@ function MT.ImDrawList:PushTexture(tex_ref) self._TextureStack:push_back(tex_ref) self._CmdHeader.TexRef = tex_ref if (tex_ref._TexData ~= nil) then - IM_ASSERT(tex_ref._TexData.WantDestroyNextFrame == false) + assert(tex_ref._TexData.WantDestroyNextFrame == false) end self:_OnChangedTexture() end @@ -34129,7 +34163,7 @@ local function PrimReserve(self, idx_count, vtx_count) -- Large mesh support (when enabled) IM_ASSERT_PARANOID(idx_count >= 0 and vtx_count >= 0) - if (self._VtxCurrentIdx + vtx_count >= bit32.lshift(1, 16)) and (bit32.band(self.Flags, ImDrawListFlags.AllowVtxOffset) ~= 0) then + if (self._VtxCurrentIdx + vtx_count >= bit32.lshift(1, 16)) and (bit32.band(self.Flags, 8 --[[ImDrawListFlags.AllowVtxOffset]]) ~= 0) then -- FIXME: In theory we should be testing that vtx_count <64k here. -- In practice, RenderText() relies on reserving ahead for a worst case scenario so it is currently useful for us -- to not make that check until we rework the text functions to handle clipping and large horizontal lines better. @@ -34245,11 +34279,11 @@ end function MT.ImDrawList:AddPolyline(points, points_count, col, thickness, flags) if flags == nil then flags = 0 end - if points_count < 2 or bit32.band(col, IM_COL32_A_MASK) == 0 then + if points_count < 2 or bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end - local closed = bit32.band(flags, ImDrawFlags.Closed) ~= 0 + local closed = bit32.band(flags, 512 --[[ImDrawFlags.Closed]]) ~= 0 local opaque_uv = self._Data.TexUvWhitePixel local count = closed and points_count or points_count - 1 -- Number of line segments local thick_line = thickness > self._FringeScale @@ -34257,12 +34291,12 @@ function MT.ImDrawList:AddPolyline(points, points_count, col, thickness, flags) -- - 1.92.8 (2025/05): swapped two last parameters order: flags, thickness --> thickness, flags. This should normally be caught by compile-time type-checking. -- - 1.92.8 (2025/05): changed value of ImDrawList_Closed which was previously guaranteed to be == 1. Hardcoded use of 1 or true should be replaced. -- Read more details near AddRect() + see "API BREAKING CHANGES" section for 1.82, 1.90 and 1.92.8. - IM_ASSERT_USER_ERROR_RET(bit32.band(flags, ImDrawFlags.InvalidMask_) == 0, "Incorrect parameter. Did you swap 'thickness' and 'flags'?") + IM_ASSERT_USER_ERROR_RET(bit32.band(flags, 2147483663 --[[ImDrawFlags.InvalidMask_]]) == 0, "Incorrect parameter. Did you swap 'thickness' and 'flags'?") - if bit32.band(self.Flags, ImDrawListFlags.AntiAliasedLines) ~= 0 then + if bit32.band(self.Flags, 1 --[[ImDrawListFlags.AntiAliasedLines]]) ~= 0 then -- Anti-aliased stroke local AA_SIZE = self._FringeScale - local col_trans = bit32.band(col, bit32.bnot(IM_COL32_A_MASK)) + local col_trans = bit32.band(col, bit32.bnot(4278190080 --[[IM_COL32_A_MASK]])) -- Thicknesses <1.0 should behave like thickness 1.0 thickness = ImMax(thickness, 1.0) @@ -34270,9 +34304,9 @@ function MT.ImDrawList:AddPolyline(points, points_count, col, thickness, flags) local fractional_thickness = thickness - integer_thickness -- Do we want to draw this line using a texture? - local use_texture = bit32.band(self.Flags, ImDrawListFlags.AntiAliasedLinesUseTex) ~= 0 and integer_thickness < IM_DRAWLIST_TEX_LINES_WIDTH_MAX and fractional_thickness <= 0.00001 and AA_SIZE == 1.0 + local use_texture = bit32.band(self.Flags, 2 --[[ImDrawListFlags.AntiAliasedLinesUseTex]]) ~= 0 and integer_thickness < IM_DRAWLIST_TEX_LINES_WIDTH_MAX and fractional_thickness <= 0.00001 and AA_SIZE == 1.0 - IM_ASSERT_PARANOID((not use_texture) or bit32.band(self._Data.Font.OwnerAtlas.Flags, ImFontAtlasFlags.NoBakedLines) == 0) + IM_ASSERT_PARANOID((not use_texture) or bit32.band(self._Data.Font.OwnerAtlas.Flags, 4 --[[ImFontAtlasFlags.NoBakedLines]]) == 0) local idx_count = use_texture and (count * 6) or (thick_line and count * 18 or count * 12) local vtx_count = use_texture and (points_count * 2) or (thick_line and points_count * 4 or points_count * 3) @@ -34498,28 +34532,28 @@ local function PathRectXY(self, ax, ay, bx, by, rounding, flags) if not flags then flags = 0 end if rounding >= 0.5 then - IM_ASSERT(bit32.band(flags, 0x0F) == 0, "Misuse of legacy hardcoded ImDrawCornerFlags values!") - if bit32.band(flags, ImDrawFlags.RoundCornersMask_) == 0 then - flags = bit32.bor(flags, ImDrawFlags.RoundCornersAll) + assert(bit32.band(flags, 0x0F) == 0, "Misuse of legacy hardcoded ImDrawCornerFlags values!") + if bit32.band(flags, 496 --[[ImDrawFlags.RoundCornersMask_]]) == 0 then + flags = bit32.bor(flags, 240 --[[ImDrawFlags.RoundCornersAll]]) end - rounding = ImMin(rounding, ImAbs(bx - ax) * (((bit32.band(flags, ImDrawFlags.RoundCornersTop) == ImDrawFlags.RoundCornersTop) or (bit32.band(flags, ImDrawFlags.RoundCornersBottom) == ImDrawFlags.RoundCornersBottom)) and 0.5 or 1.0) - 1.0) - rounding = ImMin(rounding, ImAbs(by - ay) * (((bit32.band(flags, ImDrawFlags.RoundCornersLeft) == ImDrawFlags.RoundCornersLeft) or (bit32.band(flags, ImDrawFlags.RoundCornersRight) == ImDrawFlags.RoundCornersRight)) and 0.5 or 1.0) - 1.0) + rounding = ImMin(rounding, ImAbs(bx - ax) * (((bit32.band(flags, 48 --[[ImDrawFlags.RoundCornersTop]]) == 48 --[[ImDrawFlags.RoundCornersTop]]) or (bit32.band(flags, 192 --[[ImDrawFlags.RoundCornersBottom]]) == 192 --[[ImDrawFlags.RoundCornersBottom]])) and 0.5 or 1.0) - 1.0) + rounding = ImMin(rounding, ImAbs(by - ay) * (((bit32.band(flags, 80 --[[ImDrawFlags.RoundCornersLeft]]) == 80 --[[ImDrawFlags.RoundCornersLeft]]) or (bit32.band(flags, 160 --[[ImDrawFlags.RoundCornersRight]]) == 160 --[[ImDrawFlags.RoundCornersRight]])) and 0.5 or 1.0) - 1.0) end - if rounding < 0.5 or (bit32.band(flags, ImDrawFlags.RoundCornersMask_) == ImDrawFlags.RoundCornersNone) then + if rounding < 0.5 or (bit32.band(flags, 496 --[[ImDrawFlags.RoundCornersMask_]]) == 256 --[[ImDrawFlags.RoundCornersNone]]) then PathLineToXY(self, ax, ay) PathLineToXY(self, bx, ay) PathLineToXY(self, bx, by) PathLineToXY(self, ax, by) else - local rounding_tl = (bit32.band(flags, ImDrawFlags.RoundCornersTopLeft) ~= 0) and rounding or 0.0 - local rounding_tr = (bit32.band(flags, ImDrawFlags.RoundCornersTopRight) ~= 0) and rounding or 0.0 - local rounding_br = (bit32.band(flags, ImDrawFlags.RoundCornersBottomRight) ~= 0) and rounding or 0.0 - local rounding_bl = (bit32.band(flags, ImDrawFlags.RoundCornersBottomLeft) ~= 0) and rounding or 0.0 + local rounding_tl = (bit32.band(flags, 16 --[[ImDrawFlags.RoundCornersTopLeft]]) ~= 0) and rounding or 0.0 + local rounding_tr = (bit32.band(flags, 32 --[[ImDrawFlags.RoundCornersTopRight]]) ~= 0) and rounding or 0.0 + local rounding_br = (bit32.band(flags, 128 --[[ImDrawFlags.RoundCornersBottomRight]]) ~= 0) and rounding or 0.0 + local rounding_bl = (bit32.band(flags, 64 --[[ImDrawFlags.RoundCornersBottomLeft]]) ~= 0) and rounding or 0.0 -- [Luau] inline PathArcToFast() (radius < 0.5 handled by _PathArcToFastExXY()) - _PathArcToFastExXY(self, ax + rounding_tl, ay + rounding_tl, rounding_tl, 6 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, 9 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, 0) - _PathArcToFastExXY(self, bx - rounding_tr, ay + rounding_tr, rounding_tr, 9 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, 12 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, 0) - _PathArcToFastExXY(self, bx - rounding_br, by - rounding_br, rounding_br, 0 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, 3 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, 0) - _PathArcToFastExXY(self, ax + rounding_bl, by - rounding_bl, rounding_bl, 3 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, 6 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, 0) + _PathArcToFastExXY(self, ax + rounding_tl, ay + rounding_tl, rounding_tl, 6 * 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / 12, 9 * 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / 12, 0) + _PathArcToFastExXY(self, bx - rounding_tr, ay + rounding_tr, rounding_tr, 9 * 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / 12, 12 * 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / 12, 0) + _PathArcToFastExXY(self, bx - rounding_br, by - rounding_br, rounding_br, 0 * 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / 12, 3 * 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / 12, 0) + _PathArcToFastExXY(self, ax + rounding_bl, by - rounding_bl, rounding_bl, 3 * 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / 12, 6 * 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / 12, 0) end end @@ -34532,9 +34566,9 @@ function MT.ImDrawList:AddRectFilled(p_min, p_max, col, rounding, flags) if not rounding then rounding = 0.0 end if not flags then flags = 0 end - if bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end - if rounding < 0.5 or (bit32.band(flags, ImDrawFlags.RoundCornersMask_) == ImDrawFlags.RoundCornersNone) then + if rounding < 0.5 or (bit32.band(flags, 496 --[[ImDrawFlags.RoundCornersMask_]]) == 256 --[[ImDrawFlags.RoundCornersNone]]) then PrimReserve(self, 6, 4) -- [Luau] local calls PrimRectXY(self, p_min.x, p_min.y, p_max.x, p_max.y, col) else @@ -34552,7 +34586,7 @@ end --- @param col_bot_right ImU32 --- @param col_bot_left ImU32 function MT.ImDrawList:AddRectFilledMultiColor(p_min, p_max, col_upr_left, col_upr_right, col_bot_right, col_bot_left) - if bit32.band(bit32.bor(col_upr_left, col_upr_right, col_bot_right, col_bot_left), IM_COL32_A_MASK) == 0 then + if bit32.band(bit32.bor(col_upr_left, col_upr_right, col_bot_right, col_bot_left), 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end @@ -34593,13 +34627,13 @@ function MT.ImDrawList:AddRect(p_min, p_max, col, rounding, thickness, flags) -- - Hard coded support for values 0x01 to 0x0F (matching 15 out of 16 old flags combinations) --> see FixRectCornerFlags() in <1.90 code. -- - Hard coded 0x00 with 'float rounding > 0.0f' --> replace with ImDrawFlags_RoundNone or use 'float rounding = 0.0f'. -- See "API BREAKING CHANGES" section for 1.82, 1.90 and 1.92.8. - IM_ASSERT_USER_ERROR_RET(bit32.band(flags, ImDrawFlags.InvalidMask_) == 0, "Incorrect parameter. Did you swap 'thickness' and 'flags'?") -- Or misuse of legacy hard-coded ImDrawCornerFlags values + IM_ASSERT_USER_ERROR_RET(bit32.band(flags, 2147483663 --[[ImDrawFlags.InvalidMask_]]) == 0, "Incorrect parameter. Did you swap 'thickness' and 'flags'?") -- Or misuse of legacy hard-coded ImDrawCornerFlags values - if bit32.band(col, IM_COL32_A_MASK) == 0 then + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end -- [Luau] square corners + whole-pixel thickness: 4 filled rects instead of a stroked path (same pixels, far cheaper here) - if (rounding == nil or rounding < 0.5 or bit32.band(flags, ImDrawFlags.RoundCornersMask_) == ImDrawFlags.RoundCornersNone) + if (rounding == nil or rounding < 0.5 or bit32.band(flags, 496 --[[ImDrawFlags.RoundCornersMask_]]) == 256 --[[ImDrawFlags.RoundCornersNone]]) and thickness >= 1.0 and thickness % 1 == 0 and p_max.x - p_min.x > 2 * thickness and p_max.y - p_min.y > 2 * thickness then local x0, y0, x1, y1, t = p_min.x, p_min.y, p_max.x, p_max.y, thickness PrimReserve(self, 24, 16) @@ -34609,17 +34643,17 @@ function MT.ImDrawList:AddRect(p_min, p_max, col, rounding, thickness, flags) PrimRectXY(self, x1 - t, y0 + t, x1, y1 - t, col) return end - if bit32.band(self.Flags, ImDrawListFlags.AntiAliasedLines) ~= 0 then + if bit32.band(self.Flags, 1 --[[ImDrawListFlags.AntiAliasedLines]]) ~= 0 then PathRectXY(self, p_min.x + 0.50, p_min.y + 0.50, p_max.x - 0.50, p_max.y - 0.50, rounding, flags) -- [Luau] scalar math, no temporary ImVec2 else PathRectXY(self, p_min.x + 0.50, p_min.y + 0.50, p_max.x - 0.49, p_max.y - 0.49, rounding, flags) -- Better looking lower-right corner and rounded non-AA shapes. end - self:PathStroke(col, thickness, ImDrawFlags.Closed) + self:PathStroke(col, thickness, 512 --[[ImDrawFlags.Closed]]) end function MT.ImDrawList:AddLine(p1, p2, col, thickness) - if bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end PathLineToXY(self, p1.x + 0.5, p1.y + 0.5) -- [Luau] scalar math, no temporary ImVec2 PathLineToXY(self, p2.x + 0.5, p2.y + 0.5) @@ -34634,7 +34668,7 @@ end function MT.ImDrawList:AddLineH(min_x, max_x, y, col, thickness) if thickness == nil then thickness = 1.0 end - if bit32.band(col, IM_COL32_A_MASK) == 0 then + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end PathLineToXY(self, min_x + 0.5, y + 0.5) @@ -34650,7 +34684,7 @@ end function MT.ImDrawList:AddLineV(x, min_y, max_y, col, thickness) if thickness == nil then thickness = 1.0 end - if bit32.band(col, IM_COL32_A_MASK) == 0 then + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end PathLineToXY(self, x + 0.5, min_y + 0.5) @@ -34659,29 +34693,29 @@ function MT.ImDrawList:AddLineV(x, min_y, max_y, col, thickness) end function MT.ImDrawList:AddTriangle(p1, p2, p3, col, thickness) - if bit32.band(col, IM_COL32_A_MASK) == 0 then + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end self:PathLineTo(p1) self:PathLineTo(p2) self:PathLineTo(p3) - self:PathStroke(col, thickness, ImDrawFlags.Closed) + self:PathStroke(col, thickness, 512 --[[ImDrawFlags.Closed]]) end function MT.ImDrawList:AddQuad(p1, p2, p3, p4, col, thickness) if thickness == nil then thickness = 1.0 end - if bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end self:PathLineTo(p1) self:PathLineTo(p2) self:PathLineTo(p3) self:PathLineTo(p4) - self:PathStroke(col, thickness, ImDrawFlags.Closed) + self:PathStroke(col, thickness, 512 --[[ImDrawFlags.Closed]]) end function MT.ImDrawList:AddQuadFilled(p1, p2, p3, p4, col) - if bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end self:PathLineTo(p1) self:PathLineTo(p2) @@ -34691,7 +34725,7 @@ function MT.ImDrawList:AddQuadFilled(p1, p2, p3, p4, col) end function MT.ImDrawList:AddTriangleFilled(p1, p2, p3, col) - if bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end self:PathLineTo(p1) self:PathLineTo(p2) @@ -34708,24 +34742,24 @@ function MT.ImDrawList:AddCircle(center, radius, col, num_segments, thickness) if num_segments == nil then num_segments = 0 end if thickness == nil then thickness = 1.0 end - if bit32.band(col, IM_COL32_A_MASK) == 0 or radius < 0.5 then + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 or radius < 0.5 then return end if num_segments <= 0 then -- Use arc with automatic segment count - _PathArcToFastExXY(self, center.x, center.y, radius - 0.5, 0, IM_DRAWLIST_ARCFAST_SAMPLE_MAX, 0) + _PathArcToFastExXY(self, center.x, center.y, radius - 0.5, 0, 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]], 0) self._Path.Size = self._Path.Size - 1 else -- Explicit segment count (still clamp to avoid drawing insanely tessellated shapes) num_segments = ImClamp(num_segments, 3, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX) -- Because we are filling a closed shape we remove 1 from the count of segments/points - local a_max = (IM_PI * 2.0) * (num_segments - 1) / num_segments + local a_max = (3.141592653589793 --[[IM_PI]] * 2.0) * (num_segments - 1) / num_segments self:PathArcTo(center, radius - 0.5, 0.0, a_max, num_segments - 1) end - self:PathStroke(col, thickness, ImDrawFlags.Closed) + self:PathStroke(col, thickness, 512 --[[ImDrawFlags.Closed]]) end --- @param center ImVec2 @@ -34735,20 +34769,20 @@ end function MT.ImDrawList:AddCircleFilled(center, radius, col, num_segments) if num_segments == nil then num_segments = 0 end - if bit32.band(col, IM_COL32_A_MASK) == 0 or radius < 0.5 then + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 or radius < 0.5 then return end if num_segments <= 0 then -- Use arc with automatic segment count - _PathArcToFastExXY(self, center.x, center.y, radius, 0, IM_DRAWLIST_ARCFAST_SAMPLE_MAX, 0) + _PathArcToFastExXY(self, center.x, center.y, radius, 0, 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]], 0) self._Path.Size = self._Path.Size - 1 else -- Explicit segment count (still clamp to avoid drawing insanely tessellated shapes) num_segments = ImClamp(num_segments, 3, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX) -- Because we are filling a closed shape we remove 1 from the count of segments/points - local a_max = (IM_PI * 2.0) * (num_segments - 1) / num_segments + local a_max = (3.141592653589793 --[[IM_PI]] * 2.0) * (num_segments - 1) / num_segments self:PathArcTo(center, radius, 0.0, a_max, num_segments - 1) end @@ -34775,7 +34809,7 @@ function MT.ImDrawList:AddText(font, font_size, pos, col, text, text_begin, text end if text_begin == nil then text_begin = 1 end - if bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end -- Accept null ranges if text_begin == text_end then @@ -34801,7 +34835,7 @@ function MT.ImDrawList:AddText(font, font_size, pos, col, text, text_begin, text clip_rect.w = math.min(clip_rect.w, cpu_fine_clip_rect.w) end - font:RenderText(self, font_size, pos, col, clip_rect, text, text_begin, text_end, wrap_width, (cpu_fine_clip_rect ~= nil) and ImDrawTextFlags.CpuFineClip or ImDrawTextFlags.None) + font:RenderText(self, font_size, pos, col, clip_rect, text, text_begin, text_end, wrap_width, (cpu_fine_clip_rect ~= nil) and 1 --[[ImDrawTextFlags.CpuFineClip]] or 0 --[[ImDrawTextFlags.None]]) end --- @param tex_ref ImTextureRef @@ -34813,9 +34847,9 @@ end function MT.ImDrawList:AddImage(tex_ref, p_min, p_max, uv_min, uv_max, col) if uv_min == nil then uv_min = ImVec2(0, 0) end if uv_max == nil then uv_max = ImVec2(1, 1) end - if col == nil then col = IM_COL32_WHITE end + if col == nil then col = 4294967295 --[[IM_COL32_WHITE]] end - if bit32.band(col, IM_COL32_A_MASK) == 0 then + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end @@ -34841,16 +34875,16 @@ end --- @param rounding float --- @param flags ImDrawFlags function MT.ImDrawList:AddImageRounded(tex_ref, p_min, p_max, uv_min, uv_max, col, rounding, flags) - if bit32.band(col, IM_COL32_A_MASK) == 0 then + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end - IM_ASSERT(bit32.band(flags, 0x0F) == 0, "Misuse of legacy hardcoded ImDrawCornerFlags values!") -- If this assert triggers on legacy code: see comments in ImDrawList:PathRect(). - if bit32.band(flags, ImDrawFlags.RoundCornersMask_) == 0 then - flags = bit32.bor(flags, ImDrawFlags.RoundCornersAll) + assert(bit32.band(flags, 0x0F) == 0, "Misuse of legacy hardcoded ImDrawCornerFlags values!") -- If this assert triggers on legacy code: see comments in ImDrawList:PathRect(). + if bit32.band(flags, 496 --[[ImDrawFlags.RoundCornersMask_]]) == 0 then + flags = bit32.bor(flags, 240 --[[ImDrawFlags.RoundCornersAll]]) end - if rounding < 0.5 or bit32.band(flags, ImDrawFlags.RoundCornersMask_) == ImDrawFlags.RoundCornersNone then + if rounding < 0.5 or bit32.band(flags, 496 --[[ImDrawFlags.RoundCornersMask_]]) == 256 --[[ImDrawFlags.RoundCornersNone]] then self:AddImage(tex_ref, p_min, p_max, uv_min, uv_max, col) return end @@ -34909,7 +34943,7 @@ end function MT.ImDrawList:PopClipRect() local stack = self._ClipRectStack - IM_ASSERT(stack.Size > 0) + assert(stack.Size > 0) stack.Size = stack.Size - 1 -- [Luau] inline pop_back() if (stack.Size == 0) then -- LUA: No "Ternary Operator" ImVec4_Copy(self._CmdHeader.ClipRect, self._Data.ClipRectFullscreen) @@ -34934,11 +34968,11 @@ function _PathArcToFastExXY(self, cx, cy, radius, a_min_sample, a_max_sample, a_ -- Calculate arc auto segment step size if a_step <= 0 then - a_step = math.floor(IM_DRAWLIST_ARCFAST_SAMPLE_MAX / self:_CalcCircleAutoSegmentCount(radius)) + a_step = math.floor(48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / self:_CalcCircleAutoSegmentCount(radius)) end -- Make sure we never do steps larger than one quarter of the circle - a_step = ImClamp(a_step, 1, math.floor(IM_DRAWLIST_ARCFAST_TABLE_SIZE / 4)) + a_step = ImClamp(a_step, 1, math.floor(48 --[[IM_DRAWLIST_ARCFAST_TABLE_SIZE]] / 4)) local sample_range = ImAbs(a_max_sample - a_min_sample) local a_next_step = a_step @@ -34966,10 +35000,10 @@ function _PathArcToFastExXY(self, cx, cy, radius, a_min_sample, a_max_sample, a_ local path_data, arc_fast_vtx = self._Path.Data, self._Data.ArcFastVtx -- [Luau] cache local sample_index = a_min_sample - if sample_index < 0 or sample_index >= IM_DRAWLIST_ARCFAST_SAMPLE_MAX then - sample_index = sample_index % IM_DRAWLIST_ARCFAST_SAMPLE_MAX + if sample_index < 0 or sample_index >= 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] then + sample_index = sample_index % 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] if sample_index < 0 then - sample_index = sample_index + IM_DRAWLIST_ARCFAST_SAMPLE_MAX + sample_index = sample_index + 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] end end @@ -34977,8 +35011,8 @@ function _PathArcToFastExXY(self, cx, cy, radius, a_min_sample, a_max_sample, a_ local a = a_min_sample while a <= a_max_sample do -- a_step is clamped to IM_DRAWLIST_ARCFAST_SAMPLE_MAX, so we have guaranteed that it will not wrap over range twice or more - if sample_index >= IM_DRAWLIST_ARCFAST_SAMPLE_MAX then - sample_index = sample_index - IM_DRAWLIST_ARCFAST_SAMPLE_MAX + if sample_index >= 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] then + sample_index = sample_index - 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] end local s = arc_fast_vtx[sample_index + 1] @@ -34995,7 +35029,7 @@ function _PathArcToFastExXY(self, cx, cy, radius, a_min_sample, a_max_sample, a_ while a >= a_max_sample do -- a_step is clamped to IM_DRAWLIST_ARCFAST_SAMPLE_MAX, so we have guaranteed that it will not wrap over range twice or more if sample_index < 0 then - sample_index = sample_index + IM_DRAWLIST_ARCFAST_SAMPLE_MAX + sample_index = sample_index + 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] end local s = arc_fast_vtx[sample_index + 1] @@ -35010,9 +35044,9 @@ function _PathArcToFastExXY(self, cx, cy, radius, a_min_sample, a_max_sample, a_ end if extra_max_sample then - local normalized_max_sample = a_max_sample % IM_DRAWLIST_ARCFAST_SAMPLE_MAX + local normalized_max_sample = a_max_sample % 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] if normalized_max_sample < 0 then - normalized_max_sample = normalized_max_sample + IM_DRAWLIST_ARCFAST_SAMPLE_MAX + normalized_max_sample = normalized_max_sample + 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] end local s = arc_fast_vtx[normalized_max_sample + 1] @@ -35036,7 +35070,7 @@ function MT.ImDrawList:PathArcToFast(center, radius, a_min_of_12, a_max_of_12) return end - _PathArcToFastExXY(self, center.x, center.y, radius, a_min_of_12 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, a_max_of_12 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, 0) + _PathArcToFastExXY(self, center.x, center.y, radius, a_min_of_12 * 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / 12, a_max_of_12 * 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / 12, 0) end --- @param center ImVec2 @@ -35089,15 +35123,15 @@ function MT.ImDrawList:PathArcTo(center, radius, a_min, a_max, num_segments) -- We are going to use precomputed values for mid samples. -- Determine first and last sample in lookup table that belong to the arc. - local a_min_sample_f = IM_DRAWLIST_ARCFAST_SAMPLE_MAX * a_min / (IM_PI * 2.0) - local a_max_sample_f = IM_DRAWLIST_ARCFAST_SAMPLE_MAX * a_max / (IM_PI * 2.0) + local a_min_sample_f = 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] * a_min / (3.141592653589793 --[[IM_PI]] * 2.0) + local a_max_sample_f = 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] * a_max / (3.141592653589793 --[[IM_PI]] * 2.0) local a_min_sample = a_is_reverse and ImFloor(a_min_sample_f) or ImCeil(a_min_sample_f) local a_max_sample = a_is_reverse and ImCeil(a_max_sample_f) or ImFloor(a_max_sample_f) local a_mid_samples = a_is_reverse and ImMax(a_min_sample - a_max_sample, 0) or ImMax(a_max_sample - a_min_sample, 0) - local a_min_segment_angle = a_min_sample * IM_PI * 2.0 / IM_DRAWLIST_ARCFAST_SAMPLE_MAX - local a_max_segment_angle = a_max_sample * IM_PI * 2.0 / IM_DRAWLIST_ARCFAST_SAMPLE_MAX + local a_min_segment_angle = a_min_sample * 3.141592653589793 --[[IM_PI]] * 2.0 / 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] + local a_max_segment_angle = a_max_sample * 3.141592653589793 --[[IM_PI]] * 2.0 / 48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] local a_emit_start = ImAbs(a_min_segment_angle - a_min) >= 1e-5 local a_emit_end = ImAbs(a_max - a_max_segment_angle) >= 1e-5 @@ -35109,7 +35143,7 @@ function MT.ImDrawList:PathArcTo(center, radius, a_min, a_max, num_segments) else local arc_length = ImAbs(a_max - a_min) local circle_segment_count = self:_CalcCircleAutoSegmentCount(radius) - local arc_segment_count = ImMax(ImCeil(circle_segment_count * arc_length / (IM_PI * 2.0)), 1) + local arc_segment_count = ImMax(ImCeil(circle_segment_count * arc_length / (3.141592653589793 --[[IM_PI]] * 2.0)), 1) self:_PathArcToN(center, radius, a_min, a_max, arc_segment_count) end @@ -35138,7 +35172,7 @@ function MT.ImFont:RenderText(draw_list, size, pos, col, clip_rect, text, text_b if y > clip_rect.w then return end - if bit32.band(draw_list.Flags, ImDrawListFlags.TextNoPixelSnap) == 0 then + if bit32.band(draw_list.Flags, 16 --[[ImDrawListFlags.TextNoPixelSnap]]) == 0 then x = IM_TRUNC(x) y = IM_TRUNC(y) end @@ -35199,11 +35233,11 @@ function MT.ImFont:RenderText(draw_list, size, pos, col, clip_rect, text, text_b local idx_write = draw_list._IdxWritePtr local vtx_index = draw_list._VtxCurrentIdx local cmd_count = draw_list.CmdBuffer.Size - local cpu_fine_clip = bit32.band(flags, ImDrawTextFlags.CpuFineClip) ~= 0 + local cpu_fine_clip = bit32.band(flags, 1 --[[ImDrawTextFlags.CpuFineClip]]) ~= 0 local idx_data = draw_list.IdxBuffer.Data; local vtx_data = draw_list.VtxBuffer.Buf - local color_untinted = bit32.bor(col, bit32.bnot(IM_COL32_A_MASK)) + local color_untinted = bit32.bor(col, bit32.bnot(4278190080 --[[IM_COL32_A_MASK]])) local word_wrap_eol local stop = false @@ -35334,7 +35368,7 @@ function MT.ImFont:RenderText(draw_list, size, pos, col, clip_rect, text, text_b -- Edge case: calling RenderText() with unloaded glyphs triggering texture change. It doesn't happen via ImGui.* calls because CalcTextSize() is always used. if cmd_count ~= draw_list.CmdBuffer.Size then - IM_ASSERT(draw_list.CmdBuffer.Data[draw_list.CmdBuffer.Size].ElemCount == 0) + assert(draw_list.CmdBuffer.Data[draw_list.CmdBuffer.Size].ElemCount == 0) draw_list.CmdBuffer:pop_back() draw_list:PrimUnreserve(idx_count_max, vtx_count_max) draw_list:AddDrawCmd() @@ -35383,18 +35417,18 @@ function ImGui.RenderArrow(draw_list, pos, color, dir, scale) local cx, cy = pos.x + h * 0.50, pos.y + h * 0.50 * scale local ax, ay, bx, by, qx, qy - if dir == ImGuiDir.Up or dir == ImGuiDir.Down then - if dir == ImGuiDir.Up then r = -r end + if dir == 2 --[[ImGuiDir.Up]] or dir == 3 --[[ImGuiDir.Down]] then + if dir == 2 --[[ImGuiDir.Up]] then r = -r end ax, ay = 0.000 * r, 0.750 * r bx, by = -0.866 * r, -0.750 * r qx, qy = 0.866 * r, -0.750 * r - elseif dir == ImGuiDir.Left or dir == ImGuiDir.Right then - if dir == ImGuiDir.Left then r = -r end + elseif dir == 0 --[[ImGuiDir.Left]] or dir == 1 --[[ImGuiDir.Right]] then + if dir == 0 --[[ImGuiDir.Left]] then r = -r end ax, ay = 0.750 * r, 0.000 * r bx, by = -0.750 * r, 0.866 * r qx, qy = -0.750 * r, -0.866 * r else - IM_ASSERT(false) + assert(false) end arrow_a.x, arrow_a.y = cx + ax, cy + ay @@ -35444,20 +35478,20 @@ end --- @param direction ImGuiDir --- @param col ImU32 function ImGui.RenderArrowPointingAt(draw_list, pos, half_sz, direction, col) - if direction == ImGuiDir.Left then + if direction == 0 --[[ImGuiDir.Left]] then draw_list:AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), pos, col) - elseif direction == ImGuiDir.Right then + elseif direction == 1 --[[ImGuiDir.Right]] then draw_list:AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), pos, col) - elseif direction == ImGuiDir.Up then + elseif direction == 2 --[[ImGuiDir.Up]] then draw_list:AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), pos, col) - elseif direction == ImGuiDir.Down then + elseif direction == 3 --[[ImGuiDir.Down]] then draw_list:AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), pos, col) - elseif direction == ImGuiDir.None or direction == ImGuiDir.COUNT then -- Fix warnings + elseif direction == (-1) --[[ImGuiDir.None]] or direction == 4 --[[ImGuiDir.COUNT]] then -- Fix warnings end end local function ImAcos01(x) - if x <= 0.0 then return IM_PI * 0.5 end + if x <= 0.0 then return 3.141592653589793 --[[IM_PI]] * 0.5 end if x >= 1.0 then return 0.0 end return ImAcos(x) --return (-0.69813170079773212 * x * x - 0.87266462599716477) * x + 1.5707963267948966 -- Cheap approximation, may be enough for what we do. @@ -35489,7 +35523,7 @@ function ImGui.RenderRectFilledInRangeH(draw_list, rect, col, fill_x0, fill_x1, local inv_rounding = 1.0 / rounding local arc0_b = ImAcos01(1.0 - (p0.x - rect.Min.x) * inv_rounding) local arc0_e = ImAcos01(1.0 - (p1.x - rect.Min.x) * inv_rounding) - local half_pi = IM_PI * 0.5 -- We will == compare to this because we know this is the exact value ImAcos01 can return. + local half_pi = 3.141592653589793 --[[IM_PI]] * 0.5 -- We will == compare to this because we know this is the exact value ImAcos01 can return. local x0 = ImMax(p0.x, rect.Min.x + rounding) if arc0_b == arc0_e then @@ -35533,19 +35567,19 @@ function ImGui.CalcRoundingFlagsForRectInRect(r_in, r_outer, threshold) local round_t = r_in.Min.y <= r_outer.Min.y + threshold local round_b = r_in.Max.y >= r_outer.Max.y - threshold - local flags = ImDrawFlags.RoundCornersNone + local flags = 256 --[[ImDrawFlags.RoundCornersNone]] if round_t and round_l then - flags = bit32.bor(flags, ImDrawFlags.RoundCornersTopLeft) + flags = bit32.bor(flags, 16 --[[ImDrawFlags.RoundCornersTopLeft]]) end if round_t and round_r then - flags = bit32.bor(flags, ImDrawFlags.RoundCornersTopRight) + flags = bit32.bor(flags, 32 --[[ImDrawFlags.RoundCornersTopRight]]) end if round_b and round_l then - flags = bit32.bor(flags, ImDrawFlags.RoundCornersBottomLeft) + flags = bit32.bor(flags, 64 --[[ImDrawFlags.RoundCornersBottomLeft]]) end if round_b and round_r then - flags = bit32.bor(flags, ImDrawFlags.RoundCornersBottomRight) + flags = bit32.bor(flags, 128 --[[ImDrawFlags.RoundCornersBottomRight]]) end return flags @@ -35567,11 +35601,11 @@ function ImGui.RenderColorRectWithAlphaCheckerboard(draw_list, p_min, p_max, col if rounding == nil then rounding = 0.0 end if flags == nil then flags = 0 end - if bit32.band(flags, ImDrawFlags.RoundCornersMask_) == 0 then - flags = ImDrawFlags.RoundCornersDefault_ + if bit32.band(flags, 496 --[[ImDrawFlags.RoundCornersMask_]]) == 0 then + flags = 240 --[[ImDrawFlags.RoundCornersDefault_]] end - if bit32.rshift(bit32.band(col, IM_COL32_A_MASK), IM_COL32_A_SHIFT) < 0xFF then + 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) @@ -35601,19 +35635,19 @@ function ImGui.RenderColorRectWithAlphaCheckerboard(draw_list, p_min, p_max, col break end - cell_flags = ImDrawFlags.RoundCornersNone -- FIXME: Could use CalcRoundingFlagsForRectInRect() + cell_flags = 256 --[[ImDrawFlags.RoundCornersNone]] -- FIXME: Could use CalcRoundingFlagsForRectInRect() if y1 <= p_min.y then - if x1 <= p_min.x then cell_flags = bit32.bor(cell_flags, ImDrawFlags.RoundCornersTopLeft) end - if x2 >= p_max.x then cell_flags = bit32.bor(cell_flags, ImDrawFlags.RoundCornersTopRight) end + if x1 <= p_min.x then cell_flags = bit32.bor(cell_flags, 16 --[[ImDrawFlags.RoundCornersTopLeft]]) end + if x2 >= p_max.x then cell_flags = bit32.bor(cell_flags, 32 --[[ImDrawFlags.RoundCornersTopRight]]) end end if y2 >= p_max.y then - if x1 <= p_min.x then cell_flags = bit32.bor(cell_flags, ImDrawFlags.RoundCornersBottomLeft) end - if x2 >= p_max.x then cell_flags = bit32.bor(cell_flags, ImDrawFlags.RoundCornersBottomRight) end + if x1 <= p_min.x then cell_flags = bit32.bor(cell_flags, 64 --[[ImDrawFlags.RoundCornersBottomLeft]]) end + if x2 >= p_max.x then cell_flags = bit32.bor(cell_flags, 128 --[[ImDrawFlags.RoundCornersBottomRight]]) end end -- Combine flags - if flags == ImDrawFlags.RoundCornersNone or cell_flags == ImDrawFlags.RoundCornersNone then - cell_flags = ImDrawFlags.RoundCornersNone + if flags == 256 --[[ImDrawFlags.RoundCornersNone]] or cell_flags == 256 --[[ImDrawFlags.RoundCornersNone]] then + cell_flags = 256 --[[ImDrawFlags.RoundCornersNone]] else cell_flags = bit32.band(cell_flags, flags) end @@ -35739,18 +35773,18 @@ end -- Guaranteed to honor 'num_segments' function MT.ImDrawList:AddNgon(center, radius, col, num_segments, thickness) if thickness == nil then thickness = 1.0 end - if bit32.band(col, IM_COL32_A_MASK) == 0 or num_segments <= 2 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 or num_segments <= 2 then return end -- Because we are filling a closed shape we remove 1 from the count of segments/points - local a_max = (IM_PI * 2.0) * (num_segments - 1.0) / num_segments + local a_max = (3.141592653589793 --[[IM_PI]] * 2.0) * (num_segments - 1.0) / num_segments self:PathArcTo(center, radius - 0.5, 0.0, a_max, num_segments - 1) - self:PathStroke(col, thickness, ImDrawFlags.Closed) + self:PathStroke(col, thickness, 512 --[[ImDrawFlags.Closed]]) end -- Guaranteed to honor 'num_segments' function MT.ImDrawList:AddNgonFilled(center, radius, col, num_segments) - if bit32.band(col, IM_COL32_A_MASK) == 0 or num_segments <= 2 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 or num_segments <= 2 then return end -- Because we are filling a closed shape we remove 1 from the count of segments/points - local a_max = (IM_PI * 2.0) * (num_segments - 1.0) / num_segments + local a_max = (3.141592653589793 --[[IM_PI]] * 2.0) * (num_segments - 1.0) / num_segments self:PathArcTo(center, radius, 0.0, a_max, num_segments - 1) self:PathFillConvex(col) end @@ -35759,27 +35793,27 @@ end function MT.ImDrawList:AddEllipse(center, radius, col, rot, num_segments, thickness) if rot == nil then rot = 0.0 end if thickness == nil then thickness = 1.0 end - if bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end if num_segments == nil or num_segments <= 0 then num_segments = self:_CalcCircleAutoSegmentCount(ImMax(radius.x, radius.y)) end -- A bit pessimistic, maybe there's a better computation to do here. -- Because we are filling a closed shape we remove 1 from the count of segments/points - local a_max = IM_PI * 2.0 * (num_segments - 1.0) / num_segments + local a_max = 3.141592653589793 --[[IM_PI]] * 2.0 * (num_segments - 1.0) / num_segments self:PathEllipticalArcTo(center, radius, rot, 0.0, a_max, num_segments - 1) - self:PathStroke(col, thickness, ImDrawFlags.Closed) + self:PathStroke(col, thickness, 512 --[[ImDrawFlags.Closed]]) end function MT.ImDrawList:AddEllipseFilled(center, radius, col, rot, num_segments) if rot == nil then rot = 0.0 end - if bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end if num_segments == nil or num_segments <= 0 then num_segments = self:_CalcCircleAutoSegmentCount(ImMax(radius.x, radius.y)) end -- A bit pessimistic, maybe there's a better computation to do here. -- Because we are filling a closed shape we remove 1 from the count of segments/points - local a_max = IM_PI * 2.0 * (num_segments - 1.0) / num_segments + local a_max = 3.141592653589793 --[[IM_PI]] * 2.0 * (num_segments - 1.0) / num_segments self:PathEllipticalArcTo(center, radius, rot, 0.0, a_max, num_segments - 1) self:PathFillConvex(col) end -- Cubic Bezier takes 4 controls points function MT.ImDrawList:AddBezierCubic(p1, p2, p3, p4, col, thickness, num_segments) - if bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end self:PathLineTo(p1) self:PathBezierCubicCurveTo(p2, p3, p4, num_segments or 0) self:PathStroke(col, thickness or 1.0) @@ -35787,7 +35821,7 @@ end -- Quadratic Bezier takes 3 controls points function MT.ImDrawList:AddBezierQuadratic(p1, p2, p3, col, thickness, num_segments) - if bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end self:PathLineTo(p1) self:PathBezierQuadraticCurveTo(p2, p3, num_segments or 0) self:PathStroke(col, thickness or 1.0) @@ -35796,7 +35830,7 @@ end -- ponytail: ear-clipping, no anti-aliased fringe (upstream's AA triangulator not ported). O(n^2) is fine for UI polygons. --- @param points ImVec2[] # 1-based function MT.ImDrawList:AddConcavePolyFilled(points, points_count, col) - if points_count < 3 or bit32.band(col, IM_COL32_A_MASK) == 0 then return end + if points_count < 3 or bit32.band(col, 4278190080 --[[IM_COL32_A_MASK]]) == 0 then return end local idx = {} local area = 0.0 for i = 1, points_count do @@ -35877,7 +35911,7 @@ __FILES['imgui_h.lua'] = function() --- @meta -local type = ImGui._GetTypeFunc() +local type = type -- [Luau] builtin (FASTCALL); ImGui._GetTypeFunc() kept for compatibility local rawget = rawget; local rawset = rawset -- [LuaBitOp](https://bitop.luajit.org/semantics.html) @@ -36125,7 +36159,7 @@ end IM_VEC2.__newindex = function(t, k, v) local n = VEC2_KEYS[k] - IM_ASSERT(n ~= nil) + assert(n ~= nil) rawset(t, n, v) end @@ -36193,7 +36227,7 @@ end IM_VEC4.__newindex = function(t, k, v) local n = VEC4_KEYS[k] - IM_ASSERT(n ~= nil) + assert(n ~= nil) rawset(t, n, v) end @@ -36243,7 +36277,7 @@ end --- @param v any IM_VECTOR.__newindex = function(t, k, v) if k == "Data" then rawset(t, "Data", v); return; end -- set new Data. old Data is already discarded - IM_ASSERT(k >= 1 and k <= t.Size) + assert(k >= 1 and k <= t.Size) t.Data[k] = v end @@ -36259,17 +36293,17 @@ local function _grow_capacity(v, sz) local new_capacity = (v.Capacity ~= 0) and function ImVector(T, COPY_FUNC) return setmetatable({Data = nil, Size = 0, Capacity = 0, _Constructor = T or _default_constructor, _CopyFunc = COPY_FUNC or _default_copyfunc}, IM_VECTOR) end function IM_VECTOR:push_back(value) if self.Size == self.Capacity then self:reserve(_grow_capacity(self, self.Size + 1)) end; self._CopyFunc(self.Data, self.Size + 1, value); self.Size = self.Size + 1; return value end -function IM_VECTOR:pop_back() IM_ASSERT(self.Size > 0); self.Size = self.Size - 1; end +function IM_VECTOR:pop_back() assert(self.Size > 0); self.Size = self.Size - 1; end function IM_VECTOR:push_front(value) if self.Size == 0 then self:push_back(value) else self:insert(1, value) end end function IM_VECTOR:clear() if self.Data then self.Size = 0; self.Capacity = 0; IM_FREE(self, "Data"); self.Data = nil end end function IM_VECTOR:clear_delete() for i = 1, self.Size do self.Data[i] = nil end self.Size = 0 end function IM_VECTOR:empty() return self.Size == 0 end -function IM_VECTOR:back() IM_ASSERT(self.Size > 0) return self.Data[self.Size] end -function IM_VECTOR:erase(i) IM_ASSERT(i >= 1 and i <= self.Size) local removed = (table.remove(self.Data, i)) ~= nil self.Size = self.Size - 1 return removed end +function IM_VECTOR:back() assert(self.Size > 0) return self.Data[self.Size] end +function IM_VECTOR:erase(i) assert(i >= 1 and i <= self.Size) local removed = (table.remove(self.Data, i)) ~= nil self.Size = self.Size - 1 return removed end local function _iter(v, i) i = i + 1 if i <= v.Size then return i, v.Data[i] end end function IM_VECTOR:iter() return _iter, self, 0 end function IM_VECTOR:find_index(value) for i = 1, self.Size do if self.Data[i] == value then return i end end return nil end -function IM_VECTOR:erase_unsorted(index) IM_ASSERT(index >= 1 and index <= self.Size) local last_idx = self.Size if index ~= last_idx then self.Data[index] = self.Data[last_idx] end self.Data[last_idx] = nil self.Size = self.Size - 1 return true end +function IM_VECTOR:erase_unsorted(index) assert(index >= 1 and index <= self.Size) local last_idx = self.Size if index ~= last_idx then self.Data[index] = self.Data[last_idx] end self.Data[last_idx] = nil self.Size = self.Size - 1 return true end function IM_VECTOR:find_erase(value) local idx = self:find_index(value) if idx then return self:erase(idx) end return false end function IM_VECTOR:find_erase_unsorted(value) local idx = self:find_index(value) if idx then return self:erase_unsorted(idx) end return false end @@ -36291,7 +36325,7 @@ function IM_VECTOR:reserve_discard(new_capacity) self.Capacity = new_capacity end -function IM_VECTOR:shrink(new_size) IM_ASSERT(new_size <= self.Size) self.Size = new_size end +function IM_VECTOR:shrink(new_size) assert(new_size <= self.Size) self.Size = new_size end function IM_VECTOR:resize(new_size, v) if new_size > self.Capacity then self:reserve(_grow_capacity(self, new_size)) end @@ -36306,7 +36340,7 @@ function IM_VECTOR:swap(other) self.Size, other.Size = other.Size, self.Size; se function IM_VECTOR:contains(v) for i = 1, self.Size do if self.Data[i] == v then return true end end return false end -- NOTE: This currently does not use type-aware copy! -function IM_VECTOR:insert(pos, value) IM_ASSERT(pos >= 1 and pos <= self.Size + 1); if self.Size == self.Capacity then self:reserve(_grow_capacity(self, self.Size + 1)) end; for i = self.Size, pos, -1 do self.Data[i + 1] = self.Data[i] end self.Data[pos] = value self.Size = self.Size + 1 return value end +function IM_VECTOR:insert(pos, value) assert(pos >= 1 and pos <= self.Size + 1); if self.Size == self.Capacity then self:reserve(_grow_capacity(self, self.Size + 1)) end; for i = self.Size, pos, -1 do self.Data[i + 1] = self.Data[i] end self.Data[pos] = value self.Size = self.Size + 1 return value end -- NOTE: This currently does not copy type related info! --- @nodiscard @@ -36322,7 +36356,7 @@ end function IM_VECTOR:index_from_ptr(p) local data = self.Data; for i = 1, self.Size do if p == data[i] then return i - 1 end end --- @diagnostic disable-next-line - IM_ASSERT(false, "index_from_ptr failed!") + assert(false, "index_from_ptr failed!") end ------------------------------------------------------------------------------- @@ -36368,7 +36402,7 @@ end function IM_DRAWCMD:GetTexID() local tex_id = (self.TexRef._TexData) and self.TexRef._TexData.TexID or self.TexRef._TexID if self.TexRef._TexData ~= nil then - IM_ASSERT(tex_id ~= ImTextureID_Invalid, "ImDrawCmd is referring to ImTextureData that wasn't uploaded to graphics system. Backend must call ImTextureData::SetTexID() after handling ImTextureStatus_WantCreate request!") + assert(tex_id ~= (-1) --[[ImTextureID_Invalid]], "ImDrawCmd is referring to ImTextureData that wasn't uploaded to graphics system. Backend must call ImTextureData::SetTexID() after handling ImTextureStatus_WantCreate request!") end return tex_id end @@ -36392,8 +36426,8 @@ IM_VTXBUF.__index = IM_VTXBUF function ImDrawVtxBuffer() return setmetatable({ Size = 0, Capacity = 0, Buf = buffer.create(0) }, IM_VTXBUF) end function IM_VTXBUF:reserve(n) if n <= self.Capacity then return end - local nb = buffer.create(n * VTX_STRIDE) - buffer.copy(nb, 0, self.Buf, 0, self.Size * VTX_STRIDE) + local nb = buffer.create(n * 36 --[[VTX_STRIDE]]) + buffer.copy(nb, 0, self.Buf, 0, self.Size * 36 --[[VTX_STRIDE]]) self.Buf = nb self.Capacity = n end @@ -36404,8 +36438,8 @@ end function IM_VTXBUF:shrink(n) self.Size = n end function IM_VTXBUF:clear() self.Size = 0; self.Capacity = 0; self.Buf = buffer.create(0) end -function ImDrawVtx_Pos(b, i) local o = (i - 1) * VTX_STRIDE; return buffer.readf64(b, o), buffer.readf64(b, o + 8) end -function ImDrawVtx_Col(b, i) return buffer.readu32(b, (i - 1) * VTX_STRIDE + 32) end +function ImDrawVtx_Pos(b, i) local o = (i - 1) * 36 --[[VTX_STRIDE]]; return buffer.readf64(b, o), buffer.readf64(b, o + 8) end +function ImDrawVtx_Col(b, i) return buffer.readu32(b, (i - 1) * 36 --[[VTX_STRIDE]] + 32) end -- [Internal] For use by ImDrawList --- @class ImDrawCmdHeader @@ -36472,7 +36506,7 @@ MT.ImDrawList.__index = MT.ImDrawList --- @param uv ImVec2 --- @param col ImU32 function MT.ImDrawList:PrimWriteVtx(pos, uv, col) - local b, o = self.VtxBuffer.Buf, (self._VtxWritePtr - 1) * VTX_STRIDE + local b, o = self.VtxBuffer.Buf, (self._VtxWritePtr - 1) * 36 --[[VTX_STRIDE]] buffer.writef64(b, o, pos.x); buffer.writef64(b, o + 8, pos.y) buffer.writef64(b, o + 16, uv.x); buffer.writef64(b, o + 24, uv.y) buffer.writeu32(b, o + 32, col) @@ -36595,9 +36629,9 @@ function ImTextureData() -------------------------------------------- core / backend --------------------------------------- this.UniqueID = 0 -- w - -- [DEBUG] Sequential index to facilitate identifying a texture when debugging/printing. Unique per atlas. - this.Status = ImTextureStatus.Destroyed -- rw rw -- ImTextureStatus.OK/_WantCreate/_WantUpdates/_WantDestroy. Always use SetStatus() to modify! + this.Status = 1 --[[ImTextureStatus.Destroyed]] -- rw rw -- ImTextureStatus.OK/_WantCreate/_WantUpdates/_WantDestroy. Always use SetStatus() to modify! this.BackendUserData = nil -- - rw -- Convenience storage for backend. Some backends may have enough with TexID. - this.TexID = ImTextureID_Invalid -- r w -- Backend-specific texture identifier. Always use SetTexID() to modify! The identifier will stored in ImDrawCmd::GetTexID() and passed to backend's RenderDrawData function. + this.TexID = (-1) --[[ImTextureID_Invalid]] -- r w -- Backend-specific texture identifier. Always use SetTexID() to modify! The identifier will stored in ImDrawCmd::GetTexID() and passed to backend's RenderDrawData function. this.Format = 0 -- w r -- ImTextureFormat.RGBA32 (default) or ImTextureFormat.Alpha8 this.Width = 0 -- w r -- Texture width this.Height = 0 -- w r -- Texture height @@ -36627,7 +36661,7 @@ function MT.ImTextureData:GetTexID() return self.TexID end function MT.ImTextureData:SetTexID(tex_id) self.TexID = tex_id end --- @param status ImTextureStatus -function MT.ImTextureData:SetStatus(status) self.Status = status if (status == ImTextureStatus.Destroyed and not self.WantDestroyNextFrame and self.Pixels ~= nil) then self.Status = ImTextureStatus.WantCreate end end +function MT.ImTextureData:SetStatus(status) self.Status = status if (status == 1 --[[ImTextureStatus.Destroyed]] and not self.WantDestroyNextFrame and self.Pixels ~= nil) then self.Status = 2 --[[ImTextureStatus.WantCreate]] end end ------------------------------------------------------------------------------- -- [SECTION] Texture identifiers (ImTextureID, ImTextureRef) @@ -36649,7 +36683,7 @@ function ImTextureRef(tex_id) return setmetatable({ -- Members (either are set, never both!) _TexData = nil, -- A texture, generally owned by a ImFontAtlas. Will convert to ImTextureID during render loop, after texture has been uploaded. - _TexID = tex_id or ImTextureID_Invalid -- _OR_ Low-level backend texture identifier, if already uploaded or created by user/app. Generally provided to e.g. ImGui.Image() calls. + _TexID = tex_id or (-1) --[[ImTextureID_Invalid]] -- _OR_ Low-level backend texture identifier, if already uploaded or created by user/app. Generally provided to e.g. ImGui.Image() calls. }, IM_TEXTURE_REF) end @@ -36816,7 +36850,7 @@ function ImFontConfig() this.GlyphExcludeRanges = nil -- nil -- Pointer to a small user-provided list of Unicode ranges (2 value per range, values are inclusive, zero-terminated list). This is very close to GlyphRanges[] but designed to exclude ranges from a font source, when merging fonts with overlapping glyphs. Use "Input Glyphs Overlap Detection Tool" to find about your overlapping ranges. this.GlyphOffset = ImVec2() -- 0, 0 -- Offset (in pixels) all glyphs from this font input. Absolute value for default size, other sizes will scale this value. this.GlyphMinAdvanceX = 0 -- 0 -- Minimum AdvanceX for glyphs, set Min to align font icons, set both Min/Max to enforce mono-space font. Absolute value for default size, other sizes will scale this value. - this.GlyphMaxAdvanceX = FLT_MAX -- FLT_MAX -- Maximum AdvanceX for glyphs + this.GlyphMaxAdvanceX = 3.4028234663853e+38 --[[FLT_MAX]] -- FLT_MAX -- Maximum AdvanceX for glyphs this.GlyphExtraAdvanceX = 0 -- 0 -- Extra spacing (in pixels) between glyphs. Please contact us if you are using this. -- FIXME-NEWATLAS: Intentionally unscaled this.FontNo = 0 -- 0 -- Index of font within TTF/OTF file this.FontLoaderFlags = 0 -- 0 -- Settings for custom font builder. THIS IS BUILDER IMPLEMENTATION DEPENDENT. Leave as zero if unsure. @@ -36882,7 +36916,7 @@ function ImFontAtlas() -- Input this.Flags = 0 -- Build flags (see ImFontAtlasFlags_) - this.TexDesiredFormat = ImTextureFormat.RGBA32 -- Desired texture format (default to ImTextureFormat.RGBA32 but may be changed to ImTextureFormat.Alpha8). + this.TexDesiredFormat = 0 --[[ImTextureFormat.RGBA32]] -- Desired texture format (default to ImTextureFormat.RGBA32 but may be changed to ImTextureFormat.Alpha8). this.TexGlyphPadding = 1 -- FIXME: Should be called "TexPackPadding". Padding between glyphs within texture in pixels. Defaults to 1. If your rendering method never relies on bilinear filtering you may set this to 0. this.TexMinWidth = 512 -- Minimum desired texture width. Must be a power of two. Default to 512. this.TexMinHeight = 128 -- Minimum desired texture height. Must be a power of two. Default to 128. @@ -37037,8 +37071,8 @@ function ImGuiIO() -- Other state maintained from data above + IO function calls KeyMods = nil, -- Key mods flags (any of ImGuiMod_Ctrl/ImGuiMod_Shift/ImGuiMod_Alt/ImGuiMod_Super flags, same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags). Read-only, updated by NewFrame() - BackendFlags = ImGuiBackendFlags.None, -- = 0 -- See ImGuiBackendFlags_ enum. Set by backend (imgui_impl_xxx files or custom backend) to communicate features supported by the backend. - ConfigFlags = ImGuiConfigFlags.None, -- = 0 -- See ImGuiConfigFlags_ enum. Set by user/application. Keyboard/Gamepad navigation options, etc. + BackendFlags = 0 --[[ImGuiBackendFlags.None]], -- = 0 -- See ImGuiBackendFlags_ enum. Set by backend (imgui_impl_xxx files or custom backend) to communicate features supported by the backend. + ConfigFlags = 0 --[[ImGuiConfigFlags.None]], -- = 0 -- See ImGuiConfigFlags_ enum. Set by user/application. Keyboard/Gamepad navigation options, etc. DisplaySize = ImVec2(-1.0, -1.0), -- -- Main display size, in pixels (== GetMainViewport()->Size). May change every frame. DeltaTime = 1.0 / 60.0, -- = 1.0f/60.0f -- Time elapsed since last frame, in seconds. May change every frame. @@ -37064,7 +37098,7 @@ function ImGuiIO() MouseWheelRequestAxisSwap = false, -- On a non-Mac system, holding Shift requests WheelY to perform the equivalent of a WheelX event. On a Mac system this is already enforced by the system. - ConfigColorEditFlags = ImGuiColorEditFlags.DefaultOptions_, -- = -- Current settings for ColorEdit/ColorPicker widgets. Must have one bit of ImGuiColorEditFlags.DisplayMask_, one bit of ImGuiColorEditFlags.DataTypeMask_, one bit of ImGuiColorEditFlags.PickerMask_, one bit of ImGuiColorEditFlags.InputMask_. Defaults to ImGuiColorEditFlags.DefaultOptions_. May be further edited by users, unless you also set ImGuiColorEditFlags.NoOptions. + ConfigColorEditFlags = 311427072 --[[ImGuiColorEditFlags.DefaultOptions_]], -- = -- Current settings for ColorEdit/ColorPicker widgets. Must have one bit of ImGuiColorEditFlags.DisplayMask_, one bit of ImGuiColorEditFlags.DataTypeMask_, one bit of ImGuiColorEditFlags.PickerMask_, one bit of ImGuiColorEditFlags.InputMask_. Defaults to ImGuiColorEditFlags.DefaultOptions_. May be further edited by users, unless you also set ImGuiColorEditFlags.NoOptions. -- Widget options ConfigMacOSXBehaviors = false, -- Swap Cmd<>Ctrl keys + OS X style text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl. @@ -37180,7 +37214,7 @@ function ImGuiIO() InputQueueSurrogate = 0 -- For AddInputCharacterUTF16() } - for i = 0, ImGuiKey.NamedKey_COUNT - 1 do + for i = 0, 155 --[[ImGuiKey.NamedKey_COUNT]] - 1 do this.KeysData[i] = ImGuiKeyData() end @@ -37977,7 +38011,8 @@ IM_COL32_A_MASK = 0xFF000000 --- @param G ImU32 --- @param B ImU32 --- @param A ImU32 -IM_COL32 = function(R, G, B, A) return (bitOr(bitLShift(A, IM_COL32_A_SHIFT), bitLShift(B, IM_COL32_B_SHIFT), bitLShift(G, IM_COL32_G_SHIFT), bitLShift(R, IM_COL32_R_SHIFT))) end + + IM_COL32_WHITE = IM_COL32(255, 255, 255, 255) IM_COL32_BLACK = IM_COL32(0, 0, 0, 255) IM_COL32_BLACK_TRANS = IM_COL32(0, 0, 0, 0) @@ -38219,7 +38254,7 @@ function ImGuiInputTextCallbackData() end function MT.ImGuiInputTextCallbackData:DeleteChars(pos, bytes_count) - IM_ASSERT(pos + bytes_count <= self.BufTextLen) + assert(pos + bytes_count <= self.BufTextLen) local buf = self.Buf local n = self.BufTextLen - bytes_count - pos + 1 -- includes zero terminator for i = 1, n do buf[pos + i] = buf[pos + bytes_count + i] end @@ -38238,7 +38273,7 @@ end function MT.ImGuiInputTextCallbackData:InsertChars(pos, new_text) local new_text_len = #new_text if new_text_len == 0 then return end - local is_resizable = bit32.band(self.Flags, ImGuiInputTextFlags.CallbackResize) ~= 0 + local is_resizable = bit32.band(self.Flags, 4194304 --[[ImGuiInputTextFlags.CallbackResize]]) ~= 0 -- We support partial insertion local avail = self.BufSize - 1 - self.BufTextLen if not is_resizable and new_text_len > avail then @@ -38701,10 +38736,10 @@ for c in ("abcdefghijklmnopqrstuvwxyz"):gmatch(".") do KEY_MAP[c] = ImGuiKey[c:u local function UpdateKeyModifiers() local io = ImGui.GetIO() - io:AddKeyEvent(ImGuiMod_Ctrl, love.keyboard.isDown("lctrl", "rctrl")) - io:AddKeyEvent(ImGuiMod_Shift, love.keyboard.isDown("lshift", "rshift")) - io:AddKeyEvent(ImGuiMod_Alt, love.keyboard.isDown("lalt", "ralt")) - io:AddKeyEvent(ImGuiMod_Super, love.keyboard.isDown("lgui", "rgui")) + io:AddKeyEvent(4096 --[[ImGuiMod_Ctrl]], love.keyboard.isDown("lctrl", "rctrl")) + io:AddKeyEvent(8192 --[[ImGuiMod_Shift]], love.keyboard.isDown("lshift", "rshift")) + io:AddKeyEvent(16384 --[[ImGuiMod_Alt]], love.keyboard.isDown("lalt", "ralt")) + io:AddKeyEvent(32768 --[[ImGuiMod_Super]], love.keyboard.isDown("lgui", "rgui")) end function ImGui_ImplLOVE_GetBackendData() @@ -38796,7 +38831,7 @@ end function ImGui_ImplLOVE_UpdateTexture(tex) local bd = ImGui_ImplLOVE_GetBackendData() - if tex.Status == ImTextureStatus.WantCreate then + if tex.Status == 2 --[[ImTextureStatus.WantCreate]] then local data = CopyToImageData(tex, 0, 0, tex.Width, tex.Height) local image = love.graphics.newImage(data) image:setFilter("nearest", "nearest") @@ -38804,21 +38839,21 @@ function ImGui_ImplLOVE_UpdateTexture(tex) bd.Textures[bd.TextureCount] = image tex.BackendUserData = bd.TextureCount tex:SetTexID(bd.TextureCount) - tex:SetStatus(ImTextureStatus.OK) - elseif tex.Status == ImTextureStatus.WantUpdates then + tex:SetStatus(0 --[[ImTextureStatus.OK]]) + elseif tex.Status == 3 --[[ImTextureStatus.WantUpdates]] then local image = bd.Textures[tex.BackendUserData] for _, r in tex.Updates:iter() do local data = CopyToImageData(tex, r.x, r.y, r.w, r.h) image:replacePixels(data, nil, 1, r.x, r.y, false) data:release() end - tex:SetStatus(ImTextureStatus.OK) - elseif tex.Status == ImTextureStatus.WantDestroy then + tex:SetStatus(0 --[[ImTextureStatus.OK]]) + elseif tex.Status == 4 --[[ImTextureStatus.WantDestroy]] then local image = tex.BackendUserData and bd.Textures[tex.BackendUserData] if image then image:release(); bd.Textures[tex.BackendUserData] = nil end tex.BackendUserData = nil - tex:SetTexID(ImTextureID_Invalid) - tex:SetStatus(ImTextureStatus.Destroyed) + tex:SetTexID((-1) --[[ImTextureID_Invalid]]) + tex:SetStatus(1 --[[ImTextureStatus.Destroyed]]) end end @@ -38871,7 +38906,7 @@ function ImGui_ImplLOVE_RenderDrawData(draw_data) local bd = ImGui_ImplLOVE_GetBackendData() if draw_data.Textures ~= nil then for _, tex in draw_data.Textures:iter() do - if tex.Status ~= ImTextureStatus.OK then ImGui_ImplLOVE_UpdateTexture(tex) end + if tex.Status ~= 0 --[[ImTextureStatus.OK]] then ImGui_ImplLOVE_UpdateTexture(tex) end end end local fb_w, fb_h = draw_data.DisplaySize.x, draw_data.DisplaySize.y @@ -38944,7 +38979,7 @@ function ImGui_ImplLOVE_Init(opts) local io = ImGui.GetIO() local bd = { Time = love.timer.getTime(), Root = opts.root or "", Textures = {}, TextureCount = 0, Meshes = {}, FrameNo = 0 } io.BackendPlatformUserData = bd - io.BackendFlags = bit32.bor(io.BackendFlags, ImGuiBackendFlags.RendererHasTextures, ImGuiBackendFlags.RendererHasVtxOffset, ImGuiBackendFlags.HasMouseCursors) + io.BackendFlags = bit32.bor(io.BackendFlags, 16 --[[ImGuiBackendFlags.RendererHasTextures]], 8 --[[ImGuiBackendFlags.RendererHasVtxOffset]], 2 --[[ImGuiBackendFlags.HasMouseCursors]]) local platform_io = ImGui.GetPlatformIO() platform_io.Platform_SetImeDataFn = PlatformSetImeData @@ -38962,7 +38997,7 @@ function ImGui_ImplLOVE_Shutdown() for _, m in pairs(bd.Meshes) do m.Mesh:release() end for _, t in pairs(bd.Textures) do t:release() end io.BackendPlatformUserData = nil - io.BackendFlags = bit32.band(io.BackendFlags, bit32.bnot(bit32.bor(ImGuiBackendFlags.RendererHasTextures, ImGuiBackendFlags.RendererHasVtxOffset, ImGuiBackendFlags.HasMouseCursors))) + io.BackendFlags = bit32.band(io.BackendFlags, bit32.bnot(bit32.bor(16 --[[ImGuiBackendFlags.RendererHasTextures]], 8 --[[ImGuiBackendFlags.RendererHasVtxOffset]], 2 --[[ImGuiBackendFlags.HasMouseCursors]]))) end function ImGui_ImplLOVE_NewFrame() @@ -38977,12 +39012,12 @@ function ImGui_ImplLOVE_NewFrame() io.DeltaTime = (now > bd.Time) and (now - bd.Time) or (1.0 / 60.0) bd.Time = now - if bit32.band(io.ConfigFlags, ImGuiConfigFlags.NoMouseCursorChange) == 0 then + if bit32.band(io.ConfigFlags, 32 --[[ImGuiConfigFlags.NoMouseCursorChange]]) == 0 then local cursor = ImGui.GetMouseCursor() if cursor ~= bd.LastCursor then bd.LastCursor = cursor local name = CURSOR_MAP[cursor] - love.mouse.setVisible(cursor ~= ImGuiMouseCursor.None and not io.MouseDrawCursor) + love.mouse.setVisible(cursor ~= (-1) --[[ImGuiMouseCursor.None]] and not io.MouseDrawCursor) love.mouse.setCursor(name and love.mouse.getSystemCursor(name) or nil) end end @@ -38996,12 +39031,12 @@ local MOUSE_BUTTONS = { [1] = 0, [2] = 1, [3] = 2, [4] = 3, [5] = 4 } -- LÖVE: local function MouseMoved(x, y) local io = ImGui.GetIO() - io:AddMouseSourceEvent(ImGuiMouseSource.Mouse) + io:AddMouseSourceEvent(0 --[[ImGuiMouseSource.Mouse]]) io:AddMousePosEvent(x, y) end local function MousePressed(x, y, button) local b = MOUSE_BUTTONS[button] - if b then local io = ImGui.GetIO(); io:AddMouseSourceEvent(ImGuiMouseSource.Mouse); io:AddMouseButtonEvent(b, true) end + if b then local io = ImGui.GetIO(); io:AddMouseSourceEvent(0 --[[ImGuiMouseSource.Mouse]]); io:AddMouseButtonEvent(b, true) end end local function MouseReleased(x, y, button) local b = MOUSE_BUTTONS[button] @@ -39083,7 +39118,7 @@ __FILES['imgui_internal.lua'] = function() --- @meta -local type = ImGui._GetTypeFunc() +local type = type -- [Luau] builtin (FASTCALL); ImGui._GetTypeFunc() kept for compatibility local rawget = rawget local mathMin = math.min; local mathMax = math.max @@ -39243,18 +39278,20 @@ end --- @overload fun(lhs: number, rhs: number): number --- @overload fun(lhs: ImVec2, rhs: ImVec2): ImVec2 -function ImMin(lhs, rhs) - if type(lhs) == "number" then return mathMin(lhs, rhs) end - return ImVec2(mathMin(lhs.x, rhs.x), mathMin(lhs.y, rhs.y)) -end + + + + + --- @overload fun(lhs: number, rhs: number): number --- @overload fun(lhs: ImVec2, rhs: ImVec2): ImVec2 -function ImMax(lhs, rhs) - if type(lhs) == "number" then return mathMax(lhs, rhs) end - return ImVec2(mathMax(lhs.x, rhs.x), mathMax(lhs.y, rhs.y)) -end + + + + + -- Helpers: Sorting --- @param base table @@ -39265,32 +39302,36 @@ ImStd.ImQsort = function(base, count, cmp_func) if count > 0 then t_sort(base, c --- @overload fun(v: number, mn: number, mx: number): number --- @overload fun(v: ImVec2, mn: ImVec2, mx: ImVec2): ImVec2 -function ImClamp(v, mn, mx) - if type(v) == "number" and type(mn) == "number" and type(mx) == "number" then return mathMin(mathMax(v, mn), mx) - elseif type(v) == "table" and type(mn) == "table" and type(mx) == "table" then return ImVec2(mathMax(mn.x, mathMin(v.x, mx.x)), mathMax(mn.y, mathMin(v.y, mx.y))) - end -end + + + + + + --- @overload fun(a: number, b: number, t: number): number --- @overload fun(a: ImVec2, b: ImVec2, t: number): ImVec2 --- @overload fun(a: ImVec2, b: ImVec2, t: ImVec2): ImVec2 -function ImLerp(a, b, t) - if type(a) == "number" and type(b) == "number" and type(t) == "number" then return ((a) + ((b) - (a)) * (t)) - elseif type(a) == "table" and type(b) == "table" and type(t) == "number" then return ImVec2(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t) - elseif type(a) == "table" and type(b) == "table" and type(t) == "table" then return ImVec2(a.x + (b.x - a.x) * t.x, a.y + (b.y - a.y) * t.y) - end -end -local function _Trunc(val) if val >= 0 then return mathFloor(val) else return mathCeil(val) end end + + + + + + + + + --- @overload fun(v: float): float --- @overload fun(v: ImVec2): ImVec2 -function ImTrunc(v) - if type(v) == "number" then return _Trunc(v) - elseif type(v) == "table" then return ImVec2(_Trunc(v.x), _Trunc(v.y)) - end -end + + + + + + ImTrunc64 = _Trunc @@ -39309,7 +39350,8 @@ function ImRsqrt(x) return (1 / ImSqrt(x)) end function IM_TRUNC(VAL) return math.floor(VAL) end -- Positive values only! function IM_ROUND(VAL) return math.floor(VAL + 0.5) end -- Positive values only! -function ImFloor(f) if f >= 0 or math.floor(f) == f then return math.floor(f) else return math.floor(f) - 1 end end -- Decent replacement for floorf() + + -- Decent replacement for floorf() -- Helpers: Bit manipulation --- @param v int @@ -39429,7 +39471,8 @@ function ImStd.strncmp(str1, str2, max_count) return 0 end -function ImSaturate(f) return ((f < 0.0 and 0.0) or (f > 1.0 and 1.0) or f) end + + IM_F32_TO_INT8_UNBOUND = function(val) return math.floor(val * 255.0 + (val >= 0 and 0.5 or -0.5)) end -- Unsaturated, for display purpose IM_F32_TO_INT8_SAT = function(val) return math.floor(ImSaturate(val) * 255.0 + 0.5) end -- Saturated, always output 0..255 @@ -39503,7 +39546,7 @@ function ImStd.ImStrlen(str, begin) end end - IM_ASSERT(false) + assert(false) end -- FIXME: should also accept count? @@ -39558,19 +39601,19 @@ local function DebugLogIf(flag, fmt, ...) local g = GImGui if g and bitAnd(g.DebugLogFlags, flag) ~= 0 then ImGui.DebugLog(fmt, ...) end end -function IMGUI_DEBUG_LOG_ACTIVEID(...) DebugLogIf(ImGuiDebugLogFlags.EventActiveId, ...) end -function IMGUI_DEBUG_LOG_POPUP(...) DebugLogIf(ImGuiDebugLogFlags.EventPopup, ...) end -function IMGUI_DEBUG_LOG_FONT(...) DebugLogIf(ImGuiDebugLogFlags.EventFont, ...) end -- Called from ImFontAtlas function which may operate without a context. -function IMGUI_DEBUG_LOG_VIEWPORT(...) DebugLogIf(ImGuiDebugLogFlags.EventViewport, ...) end -function IMGUI_DEBUG_LOG_FOCUS(...) DebugLogIf(ImGuiDebugLogFlags.EventFocus, ...) end -function IMGUI_DEBUG_LOG_NAV(...) DebugLogIf(ImGuiDebugLogFlags.EventNav, ...) end -function IMGUI_DEBUG_LOG_IO(...) DebugLogIf(ImGuiDebugLogFlags.EventIO, ...) end -function IMGUI_DEBUG_LOG_INPUTROUTING(...) DebugLogIf(ImGuiDebugLogFlags.EventInputRouting, ...) end -function IMGUI_DEBUG_LOG_TABLE(...) DebugLogIf(ImGuiDebugLogFlags.EventTable, ...) end -function IMGUI_DEBUG_LOG_DOCKING(...) DebugLogIf(ImGuiDebugLogFlags.EventDocking, ...) end -function IMGUI_DEBUG_LOG_SELECTION(...) DebugLogIf(ImGuiDebugLogFlags.EventSelection, ...) end -function IMGUI_DEBUG_LOG_CLIPPER(...) DebugLogIf(ImGuiDebugLogFlags.EventClipper, ...) end -function IMGUI_DEBUG_LOG_ERROR(...) DebugLogIf(ImGuiDebugLogFlags.EventError, ...) end +function IMGUI_DEBUG_LOG_ACTIVEID(...) DebugLogIf(2 --[[ImGuiDebugLogFlags.EventActiveId]], ...) end +function IMGUI_DEBUG_LOG_POPUP(...) DebugLogIf(8 --[[ImGuiDebugLogFlags.EventPopup]], ...) end +function IMGUI_DEBUG_LOG_FONT(...) DebugLogIf(256 --[[ImGuiDebugLogFlags.EventFont]], ...) end -- Called from ImFontAtlas function which may operate without a context. +function IMGUI_DEBUG_LOG_VIEWPORT(...) DebugLogIf(2048 --[[ImGuiDebugLogFlags.EventViewport]], ...) end +function IMGUI_DEBUG_LOG_FOCUS(...) DebugLogIf(4 --[[ImGuiDebugLogFlags.EventFocus]], ...) end +function IMGUI_DEBUG_LOG_NAV(...) DebugLogIf(16 --[[ImGuiDebugLogFlags.EventNav]], ...) end +function IMGUI_DEBUG_LOG_IO(...) DebugLogIf(128 --[[ImGuiDebugLogFlags.EventIO]], ...) end +function IMGUI_DEBUG_LOG_INPUTROUTING(...) DebugLogIf(512 --[[ImGuiDebugLogFlags.EventInputRouting]], ...) end +function IMGUI_DEBUG_LOG_TABLE(...) DebugLogIf(4096 --[[ImGuiDebugLogFlags.EventTable]], ...) end +function IMGUI_DEBUG_LOG_DOCKING(...) DebugLogIf(1024 --[[ImGuiDebugLogFlags.EventDocking]], ...) end +function IMGUI_DEBUG_LOG_SELECTION(...) DebugLogIf(64 --[[ImGuiDebugLogFlags.EventSelection]], ...) end +function IMGUI_DEBUG_LOG_CLIPPER(...) DebugLogIf(32 --[[ImGuiDebugLogFlags.EventClipper]], ...) end +function IMGUI_DEBUG_LOG_ERROR(...) DebugLogIf(1 --[[ImGuiDebugLogFlags.EventError]], ...) end --- @alias ImGuiSelectionUserData any ImGuiSelectionUserData_Invalid = -1 @@ -39588,55 +39631,55 @@ ImGuiKeyOwner_NoOwner = 4294967295 -- Require key to have no owner. -- FIXME: Eventually we should aim to move e.g. IsActiveIdUsingKey() into IsKeyXXX functions. --- @param button ImGuiMouseButton --- @return ImGuiKey -function ImGui.MouseButtonToKey(button) IM_ASSERT(button >= 0 and button < ImGuiMouseButton.COUNT) return ImGuiKey.MouseLeft + button end +function ImGui.MouseButtonToKey(button) assert(button >= 0 and button < 5 --[[ImGuiMouseButton.COUNT]]) return 656 --[[ImGuiKey.MouseLeft]] + button end --- @param key ImGuiKey function ImGui.IsNamedKey(key) - return key >= ImGuiKey.NamedKey_BEGIN and key < ImGuiKey.NamedKey_END + return key >= 512 --[[ImGuiKey.NamedKey_BEGIN]] and key < 667 --[[ImGuiKey.NamedKey_END]] end --- @param key ImGuiKey function ImGui.IsKeyboardKey(key) - return key >= ImGuiKey_Keyboard_BEGIN and key < ImGuiKey_Keyboard_END + return key >= 512 --[[ImGuiKey_Keyboard_BEGIN]] and key < 632 --[[ImGuiKey_Keyboard_END]] end --- @param key ImGuiKey function ImGui.IsGamepadKey(key) - return key >= ImGuiKey_Gamepad_BEGIN and key < ImGuiKey_Gamepad_END + return key >= 632 --[[ImGuiKey_Gamepad_BEGIN]] and key < 656 --[[ImGuiKey_Gamepad_END]] end --- @param key ImGuiKey function ImGui.IsMouseKey(key) - return key >= ImGuiKey_Mouse_BEGIN and key < ImGuiKey_Mouse_END + return key >= 656 --[[ImGuiKey_Mouse_BEGIN]] and key < 663 --[[ImGuiKey_Mouse_END]] end --- @param key ImGuiKey function ImGui.IsAliasKey(key) - return key >= ImGuiKey_Aliases_BEGIN and key < ImGuiKey_Aliases_END + return key >= 656 --[[ImGuiKey_Aliases_BEGIN]] and key < 663 --[[ImGuiKey_Aliases_END]] end --- @param key ImGuiKey function ImGui.IsLRModKey(key) - return key >= ImGuiKey.LeftCtrl and key <= ImGuiKey.RightSuper + return key >= 527 --[[ImGuiKey.LeftCtrl]] and key <= 534 --[[ImGuiKey.RightSuper]] end --- @param key ImGuiKey --- @return bool function ImGui.IsNamedKeyOrMod(key) - return (key >= ImGuiKey.NamedKey_BEGIN and key < ImGuiKey.NamedKey_END) or key == ImGuiMod_Ctrl or key == ImGuiMod_Shift or key == ImGuiMod_Alt or key == ImGuiMod_Super + return (key >= 512 --[[ImGuiKey.NamedKey_BEGIN]] and key < 667 --[[ImGuiKey.NamedKey_END]]) or key == 4096 --[[ImGuiMod_Ctrl]] or key == 8192 --[[ImGuiMod_Shift]] or key == 16384 --[[ImGuiMod_Alt]] or key == 32768 --[[ImGuiMod_Super]] end --- @param key ImGuiKey --- @return ImGuiKey function ImGui.ConvertSingleModFlagToKey(key) - if key == ImGuiMod_Ctrl then - return ImGuiKey.ReservedForModCtrl - elseif key == ImGuiMod_Shift then - return ImGuiKey.ReservedForModShift - elseif key == ImGuiMod_Alt then - return ImGuiKey.ReservedForModAlt - elseif key == ImGuiMod_Super then - return ImGuiKey.ReservedForModSuper + if key == 4096 --[[ImGuiMod_Ctrl]] then + return 663 --[[ImGuiKey.ReservedForModCtrl]] + elseif key == 8192 --[[ImGuiMod_Shift]] then + return 664 --[[ImGuiKey.ReservedForModShift]] + elseif key == 16384 --[[ImGuiMod_Alt]] then + return 665 --[[ImGuiKey.ReservedForModAlt]] + elseif key == 32768 --[[ImGuiMod_Super]] then + return 666 --[[ImGuiKey.ReservedForModSuper]] end return key end @@ -39655,9 +39698,9 @@ end --- @param ctx ImGuiContext --- @param key ImGuiKey function ImGui.GetKeyOwnerData(ctx, key) - if bitAnd(key, ImGuiMod_Mask_) ~= 0 then key = ImGui.ConvertSingleModFlagToKey(key) end - IM_ASSERT(ImGui.IsNamedKey(key)) - return ctx.KeysOwnerData[key - ImGuiKey.NamedKey_BEGIN] + if bitAnd(key, 61440 --[[ImGuiMod_Mask_]]) ~= 0 then key = ImGui.ConvertSingleModFlagToKey(key) end + assert(ImGui.IsNamedKey(key)) + return ctx.KeysOwnerData[key - 512 --[[ImGuiKey.NamedKey_BEGIN]]] end -- This extends ImGuiKeyData but only for named keys (legacy keys don't support the new features) @@ -39668,8 +39711,8 @@ end --- @nodiscard function ImGuiKeyOwnerData() return { - OwnerCurr = ImGuiKeyOwner_NoOwner, - OwnerNext = ImGuiKeyOwner_NoOwner, + OwnerCurr = 4294967295 --[[ImGuiKeyOwner_NoOwner]], + OwnerNext = 4294967295 --[[ImGuiKeyOwner_NoOwner]], LockThisFrame = false, -- Reading this key requires explicit owner id (until end of frame). Set by ImGuiInputFlags.LockThisFrame. LockUntilRelease = false -- Reading this key requires explicit owner id (until key is released). Set by ImGuiInputFlags.LockUntilRelease. When this is true LockThisFrame is always true as well. } @@ -39835,7 +39878,7 @@ setmetatable(IM_RECT, { __index = function(_, k) if k ~= "Min" and k ~= "Max" th IM_RECT.__index = IM_RECT -- [Luau] plain table: fast method lookup. Use r.Min / r.Max (numeric r[1]/r[2] are not supported) -- [Luau] Min/Max are named fields, so `r.Min = v` assigns the reference: use ImVec2_Copy(r.Min, v) to keep copy semantics -IM_RECT.__newindex = function(t, k, v) IM_ASSERT(false, "ImRect: unknown field " .. tostring(k)) end +IM_RECT.__newindex = function(t, k, v) assert(false, "ImRect: unknown field " .. tostring(k)) end --- @return ImRect --- @nodiscard @@ -40027,9 +40070,9 @@ function ImBitArray(BITCOUNT, OFFSET) this.SetAllBits = function(self) local data = self.Data; for i = 1, size do data[i] = 0xFFFFFFFF end end --- @param n int # 1-based --- @return boolean - this.TestBit = function(self, n) n = n + OFFSET; IM_ASSERT(n >= 1 and n <= BITCOUNT); return IM_BITARRAY_TESTBIT(self.Data, n); end + this.TestBit = function(self, n) n = n + OFFSET; assert(n >= 1 and n <= BITCOUNT); return IM_BITARRAY_TESTBIT(self.Data, n); end --- @param n int # 1-based - this.SetBit = function(self, n) n = n + OFFSET; IM_ASSERT(n >= 1 and n <= BITCOUNT); ImBitArraySetBit(self.Data, n); end + this.SetBit = function(self, n) n = n + OFFSET; assert(n >= 1 and n <= BITCOUNT); ImBitArraySetBit(self.Data, n); end this:ClearAllBits() @@ -40080,7 +40123,7 @@ end --- @param col ImU32 function ImGui.SetNextItemColorMarker(col) local g = GImGui - g.NextItemData.HasFlags = bitOr(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasColorMarker) + g.NextItemData.HasFlags = bitOr(g.NextItemData.HasFlags, 32 --[[ImGuiNextItemDataFlags.HasColorMarker]]) g.NextItemData.ColorMarker = col end @@ -40142,8 +40185,8 @@ function ImDrawListSharedData() Context = nil -- [OPTIONAL] Link to Dear ImGui context. 99% of ImDrawList/ImFontAtlas can function without an ImGui context, but this facilitate handling one legacy edge case. }, MT.ImDrawListSharedData) - for i = 1, IM_DRAWLIST_ARCFAST_TABLE_SIZE do - local a = ((i - 1) * 2 * IM_PI) / IM_DRAWLIST_ARCFAST_TABLE_SIZE + for i = 1, 48 --[[IM_DRAWLIST_ARCFAST_TABLE_SIZE]] do + local a = ((i - 1) * 2 * 3.141592653589793 --[[IM_PI]]) / 48 --[[IM_DRAWLIST_ARCFAST_TABLE_SIZE]] this.ArcFastVtx[i] = ImVec2(ImCos(a), ImSin(a)) end @@ -40363,8 +40406,8 @@ IMGUI_NEXT_ITEM_DATA.__index = IMGUI_NEXT_ITEM_DATA -- Also cleared manually by ItemAdd()! function IMGUI_NEXT_ITEM_DATA:ClearFlags() - self.HasFlags = ImGuiNextItemDataFlags.None - self.ItemFlagsSet = ImGuiItemFlags.None + self.HasFlags = 0 --[[ImGuiNextItemDataFlags.None]] + self.ItemFlagsSet = 0 --[[ImGuiItemFlags.None]] end --- @return ImGuiNextItemData @@ -40412,7 +40455,7 @@ local IMGUI_NEXT_WINDOW_DATA = {} IMGUI_NEXT_WINDOW_DATA.__index = IMGUI_NEXT_WINDOW_DATA function IMGUI_NEXT_WINDOW_DATA:ClearFlags() - self.HasFlags = ImGuiNextWindowDataFlags.None + self.HasFlags = 0 --[[ImGuiNextWindowDataFlags.None]] end --- @return ImGuiNextWindowData @@ -40533,14 +40576,14 @@ function ImGuiStyle() WindowBorderHoverPadding = 4.0, -- Hit-testing extent outside/inside resizing border. Also extend determination of hovered window. Generally meaningfully larger than WindowBorderSize to make it easy to reach borders. - TreeLinesFlags = ImGuiTreeNodeFlags.DrawLinesNone, + TreeLinesFlags = 262144 --[[ImGuiTreeNodeFlags.DrawLinesNone]], TreeLinesSize = 1.0, -- Thickness of outlines when using ImGuiTreeNodeFlags.DrawLines. TreeLinesRounding = 0.0, -- Radius of lines connecting child nodes to the vertical line. MenuItemRounding = 0.0, -- Radius of MenuItem, BeginMenu rounding. SelectableRounding = 0.0, -- Radius of selectable rounding. MODIFYING THIS IS DISCOURAGED. CONTIGUOUS SELECTIONS WILL NOT LOOK RIGHT. (#7589) ColorMarkerSize = 3.0, -- Size of R/G/B/A color markers for ColorEdit4() and for Drags/Sliders when using ImGuiSliderFlags.ColorMarkers. - ColorButtonPosition = ImGuiDir.Right, -- Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir.Right. + ColorButtonPosition = 1 --[[ImGuiDir.Right]], -- Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir.Right. InputTextCursorSize = 1.0, -- Thickness of cursor/caret in InputText(). SeparatorSize = 1.0, -- Thickness of border in Separator(). @@ -40571,7 +40614,7 @@ function ImGuiStyle() WindowMinSize = ImVec2(32, 32), -- Minimum window size WindowTitleAlign = ImVec2(0.0, 0.5), -- Alignment for title bar text - WindowMenuButtonPosition = ImGuiDir.Left, -- Position of the collapsing/docking button in the title bar (left/right). Defaults to ImGuiDir.Left. + WindowMenuButtonPosition = 0 --[[ImGuiDir.Left]], -- Position of the collapsing/docking button in the title bar (left/right). Defaults to ImGuiDir.Left. ChildRounding = 0.0, -- Radius of child window corners rounding. Set to 0.0 to have rectangular child windows ChildBorderSize = 1.0, -- Thickness of border around child windows. Generally set to 0.0 or 1.0. Other values not well tested. PopupRounding = 0.0, -- Radius of popup window corners rounding. Set to 0.0 to have rectangular child windows @@ -40597,15 +40640,15 @@ function ImGuiStyle() TabCloseButtonMinWidthUnselected = 0.0, -- -1: always visible. 0.0: visible when hovered. >0.0: visible when hovered if minimum width. FLT_MAX: never show close button when unselected. TabBarBorderSize = 1.0, -- Thickness of tab-bar separator, which takes on the tab active color to denote focus. TabBarOverlineSize = 1.0, -- Thickness of tab-bar overline, which highlights the selected tab-bar. - TableAngledHeadersAngle = 35.0 * (IM_PI / 180.0), -- Angle of angled headers (supported values range from -50 degrees to +50 degrees). + TableAngledHeadersAngle = 35.0 * (3.141592653589793 --[[IM_PI]] / 180.0), -- Angle of angled headers (supported values range from -50 degrees to +50 degrees). TableAngledHeadersTextAlign = ImVec2(0.5, 0.0), -- Alignment of angled headers within the cell DragDropTargetRounding = 0.0, -- Radius of the drag and drop target frame. DragDropTargetBorderSize = 2.0, -- Thickness of the drag and drop target border. DragDropTargetPadding = 3.0, -- Size to expand the drag and drop target from actual target item size. - HoverFlagsForTooltipMouse = bitOr(ImGuiHoveredFlags.Stationary, ImGuiHoveredFlags.DelayShort, ImGuiHoveredFlags.AllowWhenDisabled), -- Default flags when using IsItemHovered(ImGuiHoveredFlags.ForTooltip) or BeginItemTooltip()/SetItemTooltip() while using mouse. - HoverFlagsForTooltipNav = bitOr(ImGuiHoveredFlags.NoSharedDelay, ImGuiHoveredFlags.DelayNormal, ImGuiHoveredFlags.AllowWhenDisabled), -- Default flags when using IsItemHovered(ImGuiHoveredFlags.ForTooltip) or BeginItemTooltip()/SetItemTooltip() while using keyboard/gamepad. + HoverFlagsForTooltipMouse = bitOr(8192 --[[ImGuiHoveredFlags.Stationary]], 32768 --[[ImGuiHoveredFlags.DelayShort]], 1024 --[[ImGuiHoveredFlags.AllowWhenDisabled]]), -- Default flags when using IsItemHovered(ImGuiHoveredFlags.ForTooltip) or BeginItemTooltip()/SetItemTooltip() while using mouse. + HoverFlagsForTooltipNav = bitOr(131072 --[[ImGuiHoveredFlags.NoSharedDelay]], 65536 --[[ImGuiHoveredFlags.DelayNormal]], 1024 --[[ImGuiHoveredFlags.AllowWhenDisabled]]), -- Default flags when using IsItemHovered(ImGuiHoveredFlags.ForTooltip) or BeginItemTooltip()/SetItemTooltip() while using keyboard/gamepad. -- [Internal] _MainScale = 1.0, @@ -40759,8 +40802,8 @@ function ImGuiKeyRoutingData() Mods = 0, -- Technically we'd only need 4-bits but for simplify we store ImGuiMod_ values which need 16-bits. RoutingCurrScore = 0, -- [DEBUG] For debug display RoutingNextScore = 0, -- Lower is better (0: perfect score) - RoutingCurr = ImGuiKeyOwner_NoOwner, - RoutingNext = ImGuiKeyOwner_NoOwner + RoutingCurr = 4294967295 --[[ImGuiKeyOwner_NoOwner]], + RoutingNext = 4294967295 --[[ImGuiKeyOwner_NoOwner]] } end @@ -40774,7 +40817,7 @@ local _ImGuiKeyRoutingTable = {} _ImGuiKeyRoutingTable.__index = _ImGuiKeyRoutingTable function _ImGuiKeyRoutingTable:Clear() - for n = 1, ImGuiKey.NamedKey_COUNT do self.Index[n] = -1 end + for n = 1, 155 --[[ImGuiKey.NamedKey_COUNT]] do self.Index[n] = -1 end self.Entries:clear() self.EntriesNext:clear() end @@ -40877,10 +40920,10 @@ function IMGUI_NAV_ITEM_DATA:Clear() self.ID = 0 self.FocusScopeId = 0 self.ItemFlags = 0 - self.SelectionUserData = ImGuiSelectionUserData_Invalid - self.DistBox = FLT_MAX - self.DistCenter = FLT_MAX - self.DistAxial = FLT_MAX + self.SelectionUserData = (-1) --[[ImGuiSelectionUserData_Invalid]] + self.DistBox = 3.4028234663853e+38 --[[FLT_MAX]] + self.DistCenter = 3.4028234663853e+38 --[[FLT_MAX]] + self.DistAxial = 3.4028234663853e+38 --[[FLT_MAX]] end --- @return ImGuiNavItemData @@ -41087,18 +41130,18 @@ function ImGuiContext(shared_font_atlas) -- TODO: tidy up / complete this struct IO = ImGuiIO(), PlatformIO = ImGuiPlatformIO(), - ConfigFlagsCurrFrame = ImGuiConfigFlags.None, -- = g.IO.ConfigFlags at the time of NewFrame() - ConfigFlagsLastFrame = ImGuiConfigFlags.None, + ConfigFlagsCurrFrame = 0 --[[ImGuiConfigFlags.None]], -- = g.IO.ConfigFlags at the time of NewFrame() + ConfigFlagsLastFrame = 0 --[[ImGuiConfigFlags.None]], MouseLastValidPos = ImVec2(), - KeysMayBeCharInput = ImBitArray(ImGuiKey.NamedKey_COUNT, -ImGuiKey.NamedKey_BEGIN), -- Lookup to tell if a key can emit char input, see IsKeyChordPotentiallyCharInput(). + KeysMayBeCharInput = ImBitArray(155 --[[ImGuiKey.NamedKey_COUNT]], -512 --[[ImGuiKey.NamedKey_BEGIN]]), -- Lookup to tell if a key can emit char input, see IsKeyChordPotentiallyCharInput(). KeysOwnerData = {}, -- size = ImGuiKey.NamedKey_COUNT KeysRoutingTable = ImGuiKeyRoutingTable(), InputEventsQueue = ImVector(), -- Input events which will be trickled/written into IO structure. - InputEventsNextMouseSource = ImGuiMouseSource.Mouse, + InputEventsNextMouseSource = 0 --[[ImGuiMouseSource.Mouse]], InputEventsNextEventId = 1, MovingWindow = nil, -- Track the window we clicked on (in order to preserve focus). The actual window that is moved is generally MovingWindow.RootWindowDockTree. @@ -41161,7 +41204,7 @@ function ImGuiContext(shared_font_atlas) -- TODO: tidy up / complete this struct ActiveIdAllowOverlap = false, -- Active widget allows another widget to steal active id (generally for overlapping widgets, but not always) - NavLayer = ImGuiNavLayer.Main, -- Focused layer (main scrolling layer, or menu/title bar layer) + NavLayer = 0 --[[ImGuiNavLayer.Main]], -- Focused layer (main scrolling layer, or menu/title bar layer) NavId = 0, -- Focused item for navigation NavOpenContextMenuItemId = 0, NavOpenContextMenuWindowId = 0, NavWindow = nil, -- Focused window for navigation. Could be called 'FocusedWindow' @@ -41171,17 +41214,17 @@ function ImGuiContext(shared_font_atlas) -- TODO: tidy up / complete this struct NavCursorHideFrames = 0, NavHighlightItemUnderNav = false, -- Disable mouse hovering highlight. Highlight navigation focused item instead of mouse hovered item. NavIdIsAlive = false, -- Nav widget has been seen this frame ~~ NavRectRel is valid - NavInputSource = ImGuiInputSource.Keyboard, -- Keyboard or Gamepad mode? THIS CAN ONLY BE ImGuiInputSource.Keyboard or ImGuiInputSource.Gamepad + NavInputSource = 2 --[[ImGuiInputSource.Keyboard]], -- Keyboard or Gamepad mode? THIS CAN ONLY BE ImGuiInputSource.Keyboard or ImGuiInputSource.Gamepad NavWindowingTarget = nil, NavWindowingTargetAnim = nil, NavWindowingListWindow = nil, -- Target window when doing Ctrl+Tab (or Pad Menu + FocusPrev/Next), this window is temporarily displayed top-most! NavWindowingTimer = 0.0, NavWindowingHighlightAlpha = 0.0, NavWindowingToggleLayer = false, -- Set while Alt or GamepadMenu is held, may be cleared by other operations, and processed when releasing the key. - NavWindowingToggleKey = ImGuiKey.None, -- Keyboard/gamepad key used when toggling to menu layer. - NavWindowingInputSource = ImGuiInputSource.None, + NavWindowingToggleKey = 0 --[[ImGuiKey.None]], -- Keyboard/gamepad key used when toggling to menu layer. + NavWindowingInputSource = 0 --[[ImGuiInputSource.None]], NavWindowingAccumDeltaPos = ImVec2(0.0, 0.0), NavWindowingAccumDeltaSize = ImVec2(0.0, 0.0), DimBgRatio = 0.0, -- 0.0..1.0 animation when fading in a dimming background (for modal window and Ctrl+Tab list) LastKeyboardKeyPressTime = -1.0, LastKeyModsChangeTime = -1.0, LastKeyModsChangeFromNoneTime = -1.0, -- Record the last time a keyboard key (ignore mouse/gamepad ones) was pressed. - ConfigNavWindowingKeyNext = bit32.bor(ImGuiMod_Ctrl, ImGuiKey.Tab), -- = ImGuiMod_Ctrl | ImGuiKey.Tab (or ImGuiMod_Super | ImGuiKey.Tab on OS X). Set to 0 to disable. For reconfiguration (see #4828) - ConfigNavWindowingKeyPrev = bit32.bor(ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey.Tab), -- = ImGuiMod_Ctrl | ImGuiMod_Shift | ImGuiKey.Tab (or ImGuiMod_Super | ImGuiMod_Shift | ImGuiKey.Tab on OS X) + ConfigNavWindowingKeyNext = bit32.bor(4096 --[[ImGuiMod_Ctrl]], 512 --[[ImGuiKey.Tab]]), -- = ImGuiMod_Ctrl | ImGuiKey.Tab (or ImGuiMod_Super | ImGuiKey.Tab on OS X). Set to 0 to disable. For reconfiguration (see #4828) + ConfigNavWindowingKeyPrev = bit32.bor(4096 --[[ImGuiMod_Ctrl]], 8192 --[[ImGuiMod_Shift]], 512 --[[ImGuiKey.Tab]]), -- = ImGuiMod_Ctrl | ImGuiMod_Shift | ImGuiKey.Tab (or ImGuiMod_Super | ImGuiMod_Shift | ImGuiKey.Tab on OS X) ConfigNavWindowingWithGamepad = true, -- = true. Enable Ctrl+Tab by holding ImGuiKey.GamepadFaceLeft (== ImGuiKey.NavGamepadMenu). When false, the button may still be used to toggle Menu layer. NavFocusRoute = ImVector(), -- Reversed copy focus scope stack for NavId (should contains NavFocusScopeId). This essentially follow the window.ParentWindowForFocusRoute chain. @@ -41193,10 +41236,10 @@ function ImGuiContext(shared_font_atlas) -- TODO: tidy up / complete this struct NavMoveSubmitted = false, -- Move request submitted, will process result on next NewFrame() NavMoveScoringItems = false, -- Move request submitted, still scoring incoming items NavMoveForwardToNextFrame = false, - NavMoveFlags = ImGuiNavMoveFlags.None, - NavMoveScrollFlags = ImGuiScrollFlags.None, - NavMoveKeyMods = ImGuiMod_None, - NavMoveDir = ImGuiDir.None, NavMoveDirForDebug = ImGuiDir.None, NavMoveClipDir = ImGuiDir.None, -- Direction of the move request (left/right/up/down) + NavMoveFlags = 0 --[[ImGuiNavMoveFlags.None]], + NavMoveScrollFlags = 0 --[[ImGuiScrollFlags.None]], + NavMoveKeyMods = 0 --[[ImGuiMod_None]], + NavMoveDir = (-1) --[[ImGuiDir.None]], NavMoveDirForDebug = (-1) --[[ImGuiDir.None]], NavMoveClipDir = (-1) --[[ImGuiDir.None]], -- Direction of the move request (left/right/up/down) NavMoveResultLocal = ImGuiNavItemData(), -- Best move request candidate within NavWindow NavMoveResultOther = ImGuiNavItemData(), -- Best move request candidate within NavWindow's flattened hierarchy (when using ImGuiWindowFlags.NavFlattened flag) NavMoveResultLocalVisible = ImGuiNavItemData(), -- Best move request candidate within NavWindow that are mostly visible (when using ImGuiNavMoveFlags.AlsoScoreVisibleSet flag) @@ -41207,9 +41250,9 @@ function ImGuiContext(shared_font_atlas) -- TODO: tidy up / complete this struct NavTabbingCounter = 0, -- >0 when counting items for tabbing NavTabbingDir = 0, -- Generally -1 or +1, 0 when tabbing without a nav id NavNextActivateId = 0, -- Set by ActivateItemByID(), queued until next frame. - NavNextActivateFlags = ImGuiActivateFlags.None, + NavNextActivateFlags = 0 --[[ImGuiActivateFlags.None]], NavActivateId = 0, NavActivateDownId = 0, NavActivatePressedId = 0, -- ~~ (g.ActiveId == 0) && (IsKeyPressed(ImGuiKey.Space) || IsKeyDown(ImGuiKey.Enter) || IsKeyPressed(ImGuiKey.NavGamepadActivate)) ? NavId : 0, also set when calling ActivateItemByID() - NavActivateFlags = ImGuiActivateFlags.None, + NavActivateFlags = 0 --[[ImGuiActivateFlags.None]], FrameCount = -1, @@ -41268,7 +41311,7 @@ function ImGuiContext(shared_font_atlas) -- TODO: tidy up / complete this struct StackSizesInBeginForCurrentWindow = nil, - MouseCursor = ImGuiMouseCursor.Arrow, + MouseCursor = 0 --[[ImGuiMouseCursor.Arrow]], MouseStationaryTimer = 0.0, -- Time the mouse has been stationary (with some loose heuristic) InputTextState = ImGuiInputTextState(), @@ -41310,7 +41353,7 @@ function ImGuiContext(shared_font_atlas) -- TODO: tidy up / complete this struct FocusScopeStack = ImVector(), -- Stack for PushFocusScope()/PopFocusScope() - inherited by BeginChild(), pushed into by Begin() CurrentFocusScopeId = 0, -- Value for currently appending items == g.FocusScopeStack.back(). Not to be mistaken with g.NavFocusScopeId. - CurrentItemFlags = ImGuiItemFlags.None, -- Value for currently appending items == g.ItemFlagsStack.back() + CurrentItemFlags = 0 --[[ImGuiItemFlags.None]], -- Value for currently appending items == g.ItemFlagsStack.back() DisabledAlphaBackup = 0.0, -- Backup for style.Alpha for BeginDisabled() DisabledStackSize = 0, @@ -41367,7 +41410,7 @@ function ImGuiContext(shared_font_atlas) -- TODO: tidy up / complete this struct LogFile = nil, -- If ~= nil log to stdout/ file LogBuffer = ImGuiTextBuffer(), -- Accumulation buffer when log to clipboard. LogNextPrefix = nil, LogNextSuffix = nil, -- See comment in LogSetNextTextDecoration(): doesn't copy underlying data, use carefully! - LogLinePosY = FLT_MAX, + LogLinePosY = 3.4028234663853e+38 --[[FLT_MAX]], LogDepthRef = 0, LogDepthToExpand = 2, LogDepthToExpandDefault = 2, @@ -41382,7 +41425,7 @@ function ImGuiContext(shared_font_atlas) -- TODO: tidy up / complete this struct LocalizationTable = {}, - DebugLogFlags = bitOr(ImGuiDebugLogFlags.EventError, ImGuiDebugLogFlags.OutputToTTY), + DebugLogFlags = bitOr(1 --[[ImGuiDebugLogFlags.EventError]], 1048576 --[[ImGuiDebugLogFlags.OutputToTTY]]), DebugFlashStyleColorIdx = nil, DebugMetricsConfig = ImGuiMetricsConfig(), @@ -41418,7 +41461,7 @@ function ImGuiContext(shared_font_atlas) -- TODO: tidy up / complete this struct this.IO.Fonts.OwnerContext = this end - for i = 0, ImGuiKey.NamedKey_COUNT - 1 do + for i = 0, 155 --[[ImGuiKey.NamedKey_COUNT]] - 1 do this.KeysOwnerData[i] = ImGuiKeyOwnerData() end @@ -41717,8 +41760,8 @@ function ImGuiWindow(ctx, name) BgClickFlags = 0, -- Configure behavior of click+dragging on window bg/void or over items. Default sets by io.ConfigWindowsMoveFromTitleBarOnly. If you use this please report in #3379. SetWindowPosAllowFlags = 0, SetWindowSizeAllowFlags = 0, SetWindowCollapsedAllowFlags = 0, -- store acceptable condition flags for SetNextWindowPos() use. - SetWindowPosVal = ImVec2(FLT_MAX, FLT_MAX), -- store window position when using a non-zero Pivot (position set needs to be processed when we know the window size) - SetWindowPosPivot = ImVec2(FLT_MAX, FLT_MAX), -- store window pivot for positioning. ImVec2(0, 0) when positioning from top-left corner; ImVec2(0.5, 0.5) for centering; ImVec2(1, 1) for bottom right. + SetWindowPosVal = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]), -- store window position when using a non-zero Pivot (position set needs to be processed when we know the window size) + SetWindowPosPivot = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]), -- store window pivot for positioning. ImVec2(0, 0) when positioning from top-left corner; ImVec2(0.5, 0.5) for centering; ImVec2(1, 1) for bottom right. SettingsOffset = -1, -- Offset into SettingsWindows[] (offsets are always valid as we only grow the array from the back) @@ -41728,7 +41771,7 @@ function ImGuiWindow(ctx, name) ScrollbarX = false, ScrollbarY = false, -- Are scrollbars visible? ScrollMax = ImVec2(), - ScrollTarget = ImVec2(FLT_MAX, FLT_MAX), -- target scroll position. stored as cursor position with scrolling canceled out, so the highest point is always 0.0. (FLT_MAX for no change) + ScrollTarget = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]), -- target scroll position. stored as cursor position with scrolling canceled out, so the highest point is always 0.0. (FLT_MAX for no change) ScrollTargetCenterRatio = ImVec2(0.5, 0.5), -- 0.0 = scroll so that target position is at top, 0.5 = scroll so that target position is centered ScrollTargetEdgeSnapDist = ImVec2(), -- 0.0 = no snapping, >0.0 snapping threshold @@ -41749,7 +41792,7 @@ function ImGuiWindow(ctx, name) ViewportAllowPlatformMonitorExtend = -1, -- Reset to -1 every frame (index is guaranteed to be valid between NewFrame..EndFrame), only used in the Appearing frame of a tooltip/popup to enforce clamping to a given monitor Viewport = nil, -- Always set in Begin(). Inactive windows may have a nil value here if their viewport was discarded. ViewportId = 0, -- We backup the viewport id (since the viewport may disappear or never be created if the window is inactive) - ViewportPos = ImVec2(FLT_MAX, FLT_MAX), -- We backup the viewport position (since the viewport may disappear or never be created if the window is inactive) + ViewportPos = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]), -- We backup the viewport position (since the viewport may disappear or never be created if the window is inactive) ViewportOwned = nil, DC = ImGuiWindowTempData(), -- Temporary per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the "DC" variable name. @@ -41927,9 +41970,9 @@ function ImGuiViewportP() this.DrawDataP = ImDrawData() this.DrawDataBuilder = ImDrawDataBuilder() -- Temporary data while building final ImDrawData - this.LastPlatformPos = ImVec2(FLT_MAX, FLT_MAX) - this.LastPlatformSize = ImVec2(FLT_MAX, FLT_MAX) - this.LastRendererSize = ImVec2(FLT_MAX, FLT_MAX) + this.LastPlatformPos = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]) + this.LastPlatformSize = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]) + this.LastRendererSize = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]) -- Per-viewport work area -- - Insets are >= 0.0 values, distance from viewport corners to work area. @@ -42028,7 +42071,7 @@ function ImFontAtlasRectId_GetGeneration(id) return bitRShift(bitAnd(id, ImFontA --- @param gen_idx int --- @return ImFontAtlasRectId # 0-based! function ImFontAtlasRectId_Make(index_idx, gen_idx) - IM_ASSERT(index_idx >= 0 and index_idx <= ImFontAtlasRectId_IndexMask_ and gen_idx <= bitRShift(ImFontAtlasRectId_GenerationMask_, ImFontAtlasRectId_GenerationShift_)) + assert(index_idx >= 0 and index_idx <= ImFontAtlasRectId_IndexMask_ and gen_idx <= bitRShift(ImFontAtlasRectId_GenerationMask_, ImFontAtlasRectId_GenerationShift_)) return bitOr(index_idx, bitLShift(gen_idx, ImFontAtlasRectId_GenerationShift_)) end @@ -42098,7 +42141,7 @@ ImGuiInputSource = { --- @return ImGuiInputEventMousePos --- @nodiscard function ImGuiInputEventMousePos() - return { PosX = 0, PosY = 0, MouseSource = ImGuiMouseSource.Mouse } + return { PosX = 0, PosY = 0, MouseSource = 0 --[[ImGuiMouseSource.Mouse]] } end --- @class ImGuiInputEventMouseButton @@ -42109,7 +42152,7 @@ end --- @return ImGuiInputEventMouseButton --- @nodiscard function ImGuiInputEventMouseButton() - return { Button = 0, Down = false, MouseSource = ImGuiMouseSource.Mouse } + return { Button = 0, Down = false, MouseSource = 0 --[[ImGuiMouseSource.Mouse]] } end --- @class ImGuiInputEventMouseWheel @@ -42120,7 +42163,7 @@ end --- @return ImGuiInputEventMouseWheel --- @nodiscard function ImGuiInputEventMouseWheel() - return { WheelX = 0, WheelY = 0, MouseSource = ImGuiMouseSource.Mouse } + return { WheelX = 0, WheelY = 0, MouseSource = 0 --[[ImGuiMouseSource.Mouse]] } end --- @class ImGuiInputEventKey @@ -42721,7 +42764,7 @@ IMGUI_TABLE_MAX_COLUMNS = 512 -- Arbitrary "safety" maximum, may be lifted in th local function IMGUI_DEBUG_LOG_TABLE(fmt, ...) local g = GImGui - if band(g.DebugLogFlags, ImGuiDebugLogFlags.EventTable) ~= 0 then ImGui.DebugLog(fmt, ...) end + if band(g.DebugLogFlags, 4096 --[[ImGuiDebugLogFlags.EventTable]]) ~= 0 then ImGui.DebugLog(fmt, ...) end end ------------------------------------------------------------------------------- @@ -42735,7 +42778,7 @@ local function BitTest(arr, n) return arr[n] == true end -- Sorting specification for one column of a table --- @class ImGuiTableColumnSortSpecs function ImGuiTableColumnSortSpecs() - return { ColumnUserID = 0, ColumnIndex = 0, SortOrder = 0, SortDirection = ImGuiSortDirection.None } + return { ColumnUserID = 0, ColumnIndex = 0, SortOrder = 0, SortDirection = 0 --[[ImGuiSortDirection.None]] } end -- Sorting specifications for a table (often handling sort specs for a single column, occasionally more) @@ -42762,7 +42805,7 @@ function ImGuiTableColumn() IsEnabled = false, IsUserEnabled = false, IsUserEnabledNextFrame = false, IsVisibleX = false, IsVisibleY = false, IsRequestOutput = false, IsSkipItems = false, IsPreserveWidthAuto = false, IsJustCreated = true, IsLoadedSettings = false, IsNeedReconcileSrc = false, IsNeedReconcileDst = false, - NavLayerCurrent = 0, AutoFitQueue = 0, CannotSkipItemsQueue = 0, SortDirection = ImGuiSortDirection.None, + NavLayerCurrent = 0, AutoFitQueue = 0, CannotSkipItemsQueue = 0, SortDirection = 0 --[[ImGuiSortDirection.None]], SortDirectionsAvailCount = 0, SortDirectionsAvailMask = 0, SortDirectionsAvailList = 0, } end @@ -42839,7 +42882,7 @@ end --- @class ImGuiTableColumnSettings function ImGuiTableColumnSettings() - return { WidthOrWeight = 0.0, ID = 0, Index = -1, DisplayOrder = -1, SortOrder = -1, SortDirection = ImGuiSortDirection.None, + return { WidthOrWeight = 0.0, ID = 0, Index = -1, DisplayOrder = -1, SortOrder = -1, SortDirection = 0 --[[ImGuiSortDirection.None]], IsEnabled = -1, IsStretch = 0, IsLoaded = false } end @@ -42905,38 +42948,38 @@ local TABLE_RESIZE_SEPARATOR_FEEDBACK_TIMER = 0.06 -- Delay/timer before mak -- Helper local function TableFixFlags(flags, outer_window) -- Adjust flags: set default sizing policy - if band(flags, ImGuiTableFlags.SizingMask_) == 0 then - flags = bor(flags, (band(flags, ImGuiTableFlags.ScrollX) ~= 0 or band(outer_window.Flags, ImGuiWindowFlags.AlwaysAutoResize) ~= 0) and ImGuiTableFlags.SizingFixedFit or ImGuiTableFlags.SizingStretchSame) + if band(flags, 57344 --[[ImGuiTableFlags.SizingMask_]]) == 0 then + flags = bor(flags, (band(flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) ~= 0 or band(outer_window.Flags, 64 --[[ImGuiWindowFlags.AlwaysAutoResize]]) ~= 0) and 8192 --[[ImGuiTableFlags.SizingFixedFit]] or 32768 --[[ImGuiTableFlags.SizingStretchSame]]) end -- Adjust flags: enable NoKeepColumnsVisible when using ImGuiTableFlags.SizingFixedSame - if band(flags, ImGuiTableFlags.SizingMask_) == ImGuiTableFlags.SizingFixedSame then - flags = bor(flags, ImGuiTableFlags.NoKeepColumnsVisible) + if band(flags, 57344 --[[ImGuiTableFlags.SizingMask_]]) == 16384 --[[ImGuiTableFlags.SizingFixedSame]] then + flags = bor(flags, 262144 --[[ImGuiTableFlags.NoKeepColumnsVisible]]) end -- Adjust flags: enforce borders when resizable - if band(flags, ImGuiTableFlags.Resizable) ~= 0 then - flags = bor(flags, ImGuiTableFlags.BordersInnerV) + if band(flags, 1 --[[ImGuiTableFlags.Resizable]]) ~= 0 then + flags = bor(flags, 512 --[[ImGuiTableFlags.BordersInnerV]]) end -- Adjust flags: disable NoHostExtendX/NoHostExtendY if we have any scrolling going on - if band(flags, bor(ImGuiTableFlags.ScrollX, ImGuiTableFlags.ScrollY)) ~= 0 then - flags = band(flags, bnot(bor(ImGuiTableFlags.NoHostExtendX, ImGuiTableFlags.NoHostExtendY))) + if band(flags, bor(16777216 --[[ImGuiTableFlags.ScrollX]], 33554432 --[[ImGuiTableFlags.ScrollY]])) ~= 0 then + flags = band(flags, bnot(bor(65536 --[[ImGuiTableFlags.NoHostExtendX]], 131072 --[[ImGuiTableFlags.NoHostExtendY]]))) end -- Adjust flags: NoBordersInBodyUntilResize takes priority over NoBordersInBody - if band(flags, ImGuiTableFlags.NoBordersInBodyUntilResize) ~= 0 then - flags = band(flags, bnot(ImGuiTableFlags.NoBordersInBody)) + if band(flags, 4096 --[[ImGuiTableFlags.NoBordersInBodyUntilResize]]) ~= 0 then + flags = band(flags, bnot(2048 --[[ImGuiTableFlags.NoBordersInBody]])) end -- Adjust flags: disable saved settings if there's nothing to save - if band(flags, bor(ImGuiTableFlags.Resizable, ImGuiTableFlags.Hideable, ImGuiTableFlags.Reorderable, ImGuiTableFlags.Sortable)) == 0 then - flags = bor(flags, ImGuiTableFlags.NoSavedSettings) + if band(flags, bor(1 --[[ImGuiTableFlags.Resizable]], 4 --[[ImGuiTableFlags.Hideable]], 2 --[[ImGuiTableFlags.Reorderable]], 8 --[[ImGuiTableFlags.Sortable]])) == 0 then + flags = bor(flags, 16 --[[ImGuiTableFlags.NoSavedSettings]]) end -- Inherit _NoSavedSettings from top-level window (child windows always have _NoSavedSettings set) - if band(outer_window.RootWindow.Flags, ImGuiWindowFlags.NoSavedSettings) ~= 0 then - flags = bor(flags, ImGuiTableFlags.NoSavedSettings) + if band(outer_window.RootWindow.Flags, 256 --[[ImGuiWindowFlags.NoSavedSettings]]) ~= 0 then + flags = bor(flags, 16 --[[ImGuiTableFlags.NoSavedSettings]]) end return flags @@ -42983,9 +43026,9 @@ function ImGui.BeginTableEx(name, id, columns_count, flags, outer_size, inner_wi end -- Sanity checks - IM_ASSERT(columns_count > 0 and columns_count < IMGUI_TABLE_MAX_COLUMNS) - if band(flags, ImGuiTableFlags.ScrollX) ~= 0 then - IM_ASSERT(inner_width >= 0.0) + assert(columns_count > 0 and columns_count < 512 --[[IMGUI_TABLE_MAX_COLUMNS]]) + if band(flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) ~= 0 then + assert(inner_width >= 0.0) end -- If an outer size is specified ahead we will be able to early out when not visible. Exact clipping criteria may evolve. @@ -42995,9 +43038,9 @@ function ImGui.BeginTableEx(name, id, columns_count, flags, outer_size, inner_wi -- The side-effects of accessing table data on coarse clip would be: -- - always reserving the pooled ImGuiTable data ahead for a fully clipped table (minor IMHO). Also the 'outer_window_is_measuring_size' criteria may already be defeating this in some situations. -- - always performing the GetOrAddByKey() O(log N) query in g.Tables.Map[]. - local use_child_window = band(flags, bor(ImGuiTableFlags.ScrollX, ImGuiTableFlags.ScrollY)) ~= 0 + local use_child_window = band(flags, bor(16777216 --[[ImGuiTableFlags.ScrollX]], 33554432 --[[ImGuiTableFlags.ScrollY]])) ~= 0 local avail_size = ImGui.GetContentRegionAvail() - local actual_outer_size = ImTrunc(ImGui.CalcItemSize(outer_size, mathMax(avail_size.x, IMGUI_WINDOW_HARD_MIN_SIZE), use_child_window and mathMax(avail_size.y, IMGUI_WINDOW_HARD_MIN_SIZE) or 0.0)) + local actual_outer_size = ImTrunc(ImGui.CalcItemSize(outer_size, mathMax(avail_size.x, 4 --[[IMGUI_WINDOW_HARD_MIN_SIZE]]), use_child_window and mathMax(avail_size.y, 4 --[[IMGUI_WINDOW_HARD_MIN_SIZE]]) or 0.0)) local outer_rect = ImRect(outer_window.DC.CursorPos, outer_window.DC.CursorPos + actual_outer_size) local outer_window_is_measuring_size = (outer_window.AutoFitFramesX > 0) or (outer_window.AutoFitFramesY > 0) -- Doesn't apply to AlwaysAutoResize windows! if use_child_window and ImGui.IsClippedEx(outer_rect, 0) and not outer_window_is_measuring_size then @@ -43027,7 +43070,7 @@ function ImGui.BeginTableEx(name, id, columns_count, flags, outer_size, inner_wi table_.DrawSplitter:Clear() -- Fix flags - table_.IsDefaultSizingPolicy = band(flags, ImGuiTableFlags.SizingMask_) == 0 + table_.IsDefaultSizingPolicy = band(flags, 57344 --[[ImGuiTableFlags.SizingMask_]]) == 0 flags = TableFixFlags(flags, outer_window) -- Initialize @@ -43050,7 +43093,7 @@ function ImGui.BeginTableEx(name, id, columns_count, flags, outer_size, inner_wi local instance_id table_.InstanceCurrent = instance_no if instance_no > 0 then - IM_ASSERT(table_.ColumnsCount == columns_count, "BeginTable(): Cannot change columns count mid-frame while preserving same ID") + assert(table_.ColumnsCount == columns_count, "BeginTable(): Cannot change columns count mid-frame while preserving same ID") if table_.InstanceDataExtra.Size < instance_no then table_.InstanceDataExtra:push_back(ImGuiTableInstanceData()) end @@ -43065,38 +43108,38 @@ function ImGui.BeginTableEx(name, id, columns_count, flags, outer_size, inner_wi if use_child_window then -- Ensure no vertical scrollbar appears if we only want horizontal one, to make flag consistent -- (we have no other way to disable vertical scrollbar of a window while keeping the horizontal one showing) - local override_content_size = ImVec2(FLT_MAX, FLT_MAX) - if band(flags, ImGuiTableFlags.ScrollX) ~= 0 and band(flags, ImGuiTableFlags.ScrollY) == 0 then - override_content_size.y = FLT_MIN + local override_content_size = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]) + if band(flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) ~= 0 and band(flags, 33554432 --[[ImGuiTableFlags.ScrollY]]) == 0 then + override_content_size.y = 1.1754943508223e-38 --[[FLT_MIN]] end -- Ensure specified width (when not specified, Stretched columns will act as if the width == OuterWidth and -- never lead to any scrolling). We don't handle inner_width < 0.0, we could potentially use it to right-align -- based on the right side of the child window work rect, which would require knowing ahead if we are going to -- have decoration taking horizontal spaces (typically a vertical scrollbar). - if band(flags, ImGuiTableFlags.ScrollX) ~= 0 and inner_width > 0.0 then + if band(flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) ~= 0 and inner_width > 0.0 then override_content_size.x = inner_width end - if override_content_size.x ~= FLT_MAX or override_content_size.y ~= FLT_MAX then - ImGui.SetNextWindowContentSize(ImVec2((override_content_size.x ~= FLT_MAX) and override_content_size.x or 0.0, (override_content_size.y ~= FLT_MAX) and override_content_size.y or 0.0)) + if override_content_size.x ~= 3.4028234663853e+38 --[[FLT_MAX]] or override_content_size.y ~= 3.4028234663853e+38 --[[FLT_MAX]] then + ImGui.SetNextWindowContentSize(ImVec2((override_content_size.x ~= 3.4028234663853e+38 --[[FLT_MAX]]) and override_content_size.x or 0.0, (override_content_size.y ~= 3.4028234663853e+38 --[[FLT_MAX]]) and override_content_size.y or 0.0)) end -- Reset scroll if we are reactivating it - if band(previous_flags, bor(ImGuiTableFlags.ScrollX, ImGuiTableFlags.ScrollY)) == 0 then - if band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasScroll) == 0 then + if band(previous_flags, bor(16777216 --[[ImGuiTableFlags.ScrollX]], 33554432 --[[ImGuiTableFlags.ScrollY]])) == 0 then + if band(g.NextWindowData.HasFlags, 128 --[[ImGuiNextWindowDataFlags.HasScroll]]) == 0 then ImGui.SetNextWindowScroll(ImVec2(0.0, 0.0)) end end -- Create scrolling region (without border and zero window padding) - local child_window_flags = (band(flags, ImGuiTableFlags.ScrollX) ~= 0) and ImGuiWindowFlags.HorizontalScrollbar or ImGuiWindowFlags.None - ImGui.BeginChildEx(name, instance_id, outer_rect:GetSize(), ImGuiChildFlags.None, child_window_flags) + local child_window_flags = (band(flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) ~= 0) and 2048 --[[ImGuiWindowFlags.HorizontalScrollbar]] or 0 --[[ImGuiWindowFlags.None]] + ImGui.BeginChildEx(name, instance_id, outer_rect:GetSize(), 0 --[[ImGuiChildFlags.None]], child_window_flags) table_.InnerWindow = g.CurrentWindow ImRect_Copy(table_.WorkRect, table_.InnerWindow.WorkRect) ImRect_Copy(table_.OuterRect, table_.InnerWindow:Rect()) ImRect_Copy(table_.InnerRect, table_.InnerWindow.InnerRect) - IM_ASSERT(table_.InnerWindow.WindowPadding.x == 0.0 and table_.InnerWindow.WindowPadding.y == 0.0 and table_.InnerWindow.WindowBorderSize == 0.0) + assert(table_.InnerWindow.WindowPadding.x == 0.0 and table_.InnerWindow.WindowPadding.y == 0.0 and table_.InnerWindow.WindowBorderSize == 0.0) -- Allow submitting when host is measuring if table_.InnerWindow.SkipItems and outer_window_is_measuring_size then @@ -43152,13 +43195,13 @@ function ImGui.BeginTableEx(name, id, columns_count, flags, outer_size, inner_wi -- it already overlaps it and doesn't need an extra offset. Ideally we should be able to pass custom border size with -- different x/y values to BeginChild(). local border_size = TABLE_BORDER_SIZE - if band(flags, ImGuiTableFlags.BordersOuterV) ~= 0 then + if band(flags, 1024 --[[ImGuiTableFlags.BordersOuterV]]) ~= 0 then table_.HostClipRect.Min.x = mathMin(table_.HostClipRect.Min.x + border_size, table_.HostClipRect.Max.x) if inner_window.DecoOuterSizeX2 == 0.0 then table_.HostClipRect.Max.x = mathMax(table_.HostClipRect.Max.x - border_size, table_.HostClipRect.Min.x) end end - if band(flags, ImGuiTableFlags.BordersOuterH) ~= 0 then + if band(flags, 256 --[[ImGuiTableFlags.BordersOuterH]]) ~= 0 then table_.HostClipRect.Min.y = mathMin(table_.HostClipRect.Min.y + border_size, table_.HostClipRect.Max.y) if inner_window.DecoOuterSizeY2 == 0.0 then table_.HostClipRect.Max.y = mathMax(table_.HostClipRect.Max.y - border_size, table_.HostClipRect.Min.y) @@ -43172,29 +43215,29 @@ function ImGui.BeginTableEx(name, id, columns_count, flags, outer_size, inner_wi -- - PadInner ........Content.. Pad | Pad ..Content........ -- - PadOuter+PadInner | Pad ..Content.. Pad | Pad ..Content.. Pad | local pad_outer_x - if band(flags, ImGuiTableFlags.NoPadOuterX) ~= 0 then pad_outer_x = false - elseif band(flags, ImGuiTableFlags.PadOuterX) ~= 0 then pad_outer_x = true - else pad_outer_x = band(flags, ImGuiTableFlags.BordersOuterV) ~= 0 end - local pad_inner_x = band(flags, ImGuiTableFlags.NoPadInnerX) == 0 - local inner_spacing_for_border = (band(flags, ImGuiTableFlags.BordersInnerV) ~= 0) and TABLE_BORDER_SIZE or 0.0 - local inner_spacing_explicit = (pad_inner_x and band(flags, ImGuiTableFlags.BordersInnerV) == 0) and g.Style.CellPadding.x or 0.0 - local inner_padding_explicit = (pad_inner_x and band(flags, ImGuiTableFlags.BordersInnerV) ~= 0) and g.Style.CellPadding.x or 0.0 + if band(flags, 4194304 --[[ImGuiTableFlags.NoPadOuterX]]) ~= 0 then pad_outer_x = false + elseif band(flags, 2097152 --[[ImGuiTableFlags.PadOuterX]]) ~= 0 then pad_outer_x = true + else pad_outer_x = band(flags, 1024 --[[ImGuiTableFlags.BordersOuterV]]) ~= 0 end + local pad_inner_x = band(flags, 8388608 --[[ImGuiTableFlags.NoPadInnerX]]) == 0 + local inner_spacing_for_border = (band(flags, 512 --[[ImGuiTableFlags.BordersInnerV]]) ~= 0) and TABLE_BORDER_SIZE or 0.0 + local inner_spacing_explicit = (pad_inner_x and band(flags, 512 --[[ImGuiTableFlags.BordersInnerV]]) == 0) and g.Style.CellPadding.x or 0.0 + local inner_padding_explicit = (pad_inner_x and band(flags, 512 --[[ImGuiTableFlags.BordersInnerV]]) ~= 0) and g.Style.CellPadding.x or 0.0 table_.CellSpacingX1 = inner_spacing_explicit + inner_spacing_for_border table_.CellSpacingX2 = inner_spacing_explicit table_.CellPaddingX = inner_padding_explicit - local outer_padding_for_border = (band(flags, ImGuiTableFlags.BordersOuterV) ~= 0) and TABLE_BORDER_SIZE or 0.0 + local outer_padding_for_border = (band(flags, 1024 --[[ImGuiTableFlags.BordersOuterV]]) ~= 0) and TABLE_BORDER_SIZE or 0.0 local outer_padding_explicit = pad_outer_x and g.Style.CellPadding.x or 0.0 table_.OuterPaddingX = (outer_padding_for_border + outer_padding_explicit) - table_.CellPaddingX table_.CurrentColumn = -1 table_.CurrentRow = -1 table_.RowBgColorCounter = 0 - table_.LastRowFlags = ImGuiTableRowFlags.None + table_.LastRowFlags = 0 --[[ImGuiTableRowFlags.None]] ImRect_Copy(table_.InnerClipRect, (inner_window == outer_window) and table_.WorkRect or inner_window.ClipRect) table_.InnerClipRect:ClipWith(table_.WorkRect) -- We need this to honor inner_width table_.InnerClipRect:ClipWithFull(table_.HostClipRect) - table_.InnerClipRect.Max.y = (band(flags, ImGuiTableFlags.NoHostExtendY) ~= 0) and mathMin(table_.InnerClipRect.Max.y, inner_window.WorkRect.Max.y) or table_.HostClipRect.Max.y + table_.InnerClipRect.Max.y = (band(flags, 131072 --[[ImGuiTableFlags.NoHostExtendY]]) ~= 0) and mathMin(table_.InnerClipRect.Max.y, inner_window.WorkRect.Max.y) or table_.HostClipRect.Max.y table_.RowPosY1 = table_.WorkRect.Min.y -- This is needed somehow table_.RowPosY2 = table_.WorkRect.Min.y @@ -43211,8 +43254,8 @@ function ImGui.BeginTableEx(name, id, columns_count, flags, outer_size, inner_wi temp_data.AngledHeadersExtraWidth = 0.0 -- Using opaque colors facilitate overlapping lines of the grid, otherwise we'd need to improve TableDrawBorders() - table_.BorderColorStrong = ImGui.GetColorU32(ImGuiCol.TableBorderStrong) - table_.BorderColorLight = ImGui.GetColorU32(ImGuiCol.TableBorderLight) + table_.BorderColorStrong = ImGui.GetColorU32(49 --[[ImGuiCol.TableBorderStrong]]) + table_.BorderColorLight = ImGui.GetColorU32(50 --[[ImGuiCol.TableBorderLight]]) -- Make table current g.CurrentTable = table_ @@ -43222,7 +43265,7 @@ function ImGui.BeginTableEx(name, id, columns_count, flags, outer_size, inner_wi inner_window.DC.CurrentTableIdx = table_idx end - if band(previous_flags, ImGuiTableFlags.Reorderable) ~= 0 and band(flags, ImGuiTableFlags.Reorderable) == 0 then + if band(previous_flags, 2 --[[ImGuiTableFlags.Reorderable]]) ~= 0 and band(flags, 2 --[[ImGuiTableFlags.Reorderable]]) == 0 then table_.IsResetDisplayOrderRequest = true end @@ -43239,7 +43282,7 @@ function ImGui.BeginTableEx(name, id, columns_count, flags, outer_size, inner_wi if old_columns_count ~= 0 and old_columns_count ~= columns_count then -- Attempt to preserve width and other settings on column count/specs change (#4046, #9108) IMGUI_DEBUG_LOG_TABLE("[table] Table 0x%08X column count %d -> %d, recreating storage.\n", table_.ID, old_columns_count, columns_count) - IM_ASSERT(temp_data.OldColumnsRawData == nil) + assert(temp_data.OldColumnsRawData == nil) temp_data.OldColumnsRawData = table_.RawData -- Freed during layout temp_data.OldColumnsData = table_.Columns temp_data.OldColumnsDataSize = table_.ColumnsSize @@ -43327,11 +43370,11 @@ function ImGui.TableApplyQueuedRequests(table_) -- (We process this in the TableBegin() of the first instance of each table) -- FIXME-TABLE: Contains columns if our work area doesn't allow for scrolling? if table_.InstanceCurrent == 0 then - if table_.ResizedColumn ~= -1 and table_.ResizedColumnNextWidth ~= FLT_MAX then + if table_.ResizedColumn ~= -1 and table_.ResizedColumnNextWidth ~= 3.4028234663853e+38 --[[FLT_MAX]] then ImGui.TableSetColumnWidth(table_.ResizedColumn, table_.ResizedColumnNextWidth) end table_.LastResizedColumn = table_.ResizedColumn - table_.ResizedColumnNextWidth = FLT_MAX + table_.ResizedColumnNextWidth = 3.4028234663853e+38 --[[FLT_MAX]] table_.ResizedColumn = -1 -- Process auto-fit for single column, which is a special case for stretch columns and fixed columns with FixedSame policy. @@ -43373,7 +43416,7 @@ function ImGui.TableApplyQueuedRequests(table_) if table_.IsResetVisibilityRequest then for n = 0, table_.ColumnsSize - 1 do local column = table_.Columns[n] - local v = band(column.Flags, ImGuiTableColumnFlags.DefaultHide) == 0 + local v = band(column.Flags, 2 --[[ImGuiTableColumnFlags.DefaultHide]]) == 0 column.IsUserEnabled = v; column.IsUserEnabledNextFrame = v end table_.IsResetVisibilityRequest = false @@ -43383,8 +43426,8 @@ end -- Apply immediately. See TableQueueSetColumnDisplayOrder() for additional checks/constraints. function ImGui.TableSetColumnDisplayOrder(table_, column_n, dst_order) - IM_ASSERT(column_n >= 0 and column_n < table_.ColumnsCount) - IM_ASSERT(dst_order >= 0 and dst_order < table_.ColumnsCount) + assert(column_n >= 0 and column_n < table_.ColumnsCount) + assert(dst_order >= 0 and dst_order < table_.ColumnsCount) local src_column = table_.Columns[column_n] local src_order = src_column.DisplayOrder @@ -43426,7 +43469,7 @@ local function TableGetMaxDisplayOrderAllowed(table_, src_order, dst_order) local reorder_dir = (src_order < dst_order) and 1 or -1 local order_n = src_order while (src_order < dst_order and order_n <= dst_order) or (dst_order < src_order and order_n >= dst_order) do - if band(table_.Columns[table_.DisplayOrderToIndex[order_n]].Flags, ImGuiTableColumnFlags.NoReorder) ~= 0 then + if band(table_.Columns[table_.DisplayOrderToIndex[order_n]].Flags, 64 --[[ImGuiTableColumnFlags.NoReorder]]) ~= 0 then dst_order = (order_n == src_order) and src_order or (order_n - reorder_dir) break end @@ -43452,30 +43495,30 @@ local function TableSetupColumnFlags(table_, column, column_n, flags_in) local flags = flags_in -- Sizing Policy - if band(flags, ImGuiTableColumnFlags.WidthMask_) == 0 then - local table_sizing_policy = band(table_.Flags, ImGuiTableFlags.SizingMask_) - if table_sizing_policy == ImGuiTableFlags.SizingFixedFit or table_sizing_policy == ImGuiTableFlags.SizingFixedSame then - flags = bor(flags, ImGuiTableColumnFlags.WidthFixed) + if band(flags, 24 --[[ImGuiTableColumnFlags.WidthMask_]]) == 0 then + local table_sizing_policy = band(table_.Flags, 57344 --[[ImGuiTableFlags.SizingMask_]]) + if table_sizing_policy == 8192 --[[ImGuiTableFlags.SizingFixedFit]] or table_sizing_policy == 16384 --[[ImGuiTableFlags.SizingFixedSame]] then + flags = bor(flags, 16 --[[ImGuiTableColumnFlags.WidthFixed]]) else - flags = bor(flags, ImGuiTableColumnFlags.WidthStretch) + flags = bor(flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) end else - IM_ASSERT(ImIsPowerOfTwo(band(flags, ImGuiTableColumnFlags.WidthMask_))) -- Check that only 1 of each set is used. + assert(ImIsPowerOfTwo(band(flags, 24 --[[ImGuiTableColumnFlags.WidthMask_]]))) -- Check that only 1 of each set is used. end -- Resize - if band(table_.Flags, ImGuiTableFlags.Resizable) == 0 then - flags = bor(flags, ImGuiTableColumnFlags.NoResize) + if band(table_.Flags, 1 --[[ImGuiTableFlags.Resizable]]) == 0 then + flags = bor(flags, 32 --[[ImGuiTableColumnFlags.NoResize]]) end -- Sorting - if band(flags, ImGuiTableColumnFlags.NoSortAscending) ~= 0 and band(flags, ImGuiTableColumnFlags.NoSortDescending) ~= 0 then - flags = bor(flags, ImGuiTableColumnFlags.NoSort) + if band(flags, 1024 --[[ImGuiTableColumnFlags.NoSortAscending]]) ~= 0 and band(flags, 2048 --[[ImGuiTableColumnFlags.NoSortDescending]]) ~= 0 then + flags = bor(flags, 512 --[[ImGuiTableColumnFlags.NoSort]]) end -- Indentation - if band(flags, ImGuiTableColumnFlags.IndentMask_) == 0 then - flags = bor(flags, (column_n == 0) and ImGuiTableColumnFlags.IndentEnable or ImGuiTableColumnFlags.IndentDisable) + if band(flags, 196608 --[[ImGuiTableColumnFlags.IndentMask_]]) == 0 then + flags = bor(flags, (column_n == 0) and 65536 --[[ImGuiTableColumnFlags.IndentEnable]] or 131072 --[[ImGuiTableColumnFlags.IndentDisable]]) end -- Alignment @@ -43484,18 +43527,18 @@ local function TableSetupColumnFlags(table_, column, column_n, flags_in) --IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiTableColumnFlags.AlignMask_)) -- Check that only 1 of each set is used. -- Preserve status flags - column.Flags = bor(flags, band(column.Flags, ImGuiTableColumnFlags.StatusMask_)) + column.Flags = bor(flags, band(column.Flags, 251658240 --[[ImGuiTableColumnFlags.StatusMask_]])) -- Build an ordered list of available sort directions column.SortDirectionsAvailCount = 0; column.SortDirectionsAvailMask = 0; column.SortDirectionsAvailList = 0 - if band(table_.Flags, ImGuiTableFlags.Sortable) ~= 0 then + if band(table_.Flags, 8 --[[ImGuiTableFlags.Sortable]]) ~= 0 then local count, mask, list = 0, 0, 0 - local Asc, Desc = ImGuiSortDirection.Ascending, ImGuiSortDirection.Descending - if band(flags, ImGuiTableColumnFlags.PreferSortAscending) ~= 0 and band(flags, ImGuiTableColumnFlags.NoSortAscending) == 0 then mask = bor(mask, lshift(1, Asc)); list = bor(list, lshift(Asc, lshift(count, 1))); count = count + 1 end - if band(flags, ImGuiTableColumnFlags.PreferSortDescending) ~= 0 and band(flags, ImGuiTableColumnFlags.NoSortDescending) == 0 then mask = bor(mask, lshift(1, Desc)); list = bor(list, lshift(Desc, lshift(count, 1))); count = count + 1 end - if band(flags, ImGuiTableColumnFlags.PreferSortAscending) == 0 and band(flags, ImGuiTableColumnFlags.NoSortAscending) == 0 then mask = bor(mask, lshift(1, Asc)); list = bor(list, lshift(Asc, lshift(count, 1))); count = count + 1 end - if band(flags, ImGuiTableColumnFlags.PreferSortDescending) == 0 and band(flags, ImGuiTableColumnFlags.NoSortDescending) == 0 then mask = bor(mask, lshift(1, Desc)); list = bor(list, lshift(Desc, lshift(count, 1))); count = count + 1 end - if band(table_.Flags, ImGuiTableFlags.SortTristate) ~= 0 or count == 0 then mask = bor(mask, lshift(1, ImGuiSortDirection.None)); count = count + 1 end + local Asc, Desc = 1 --[[ImGuiSortDirection.Ascending]], 2 --[[ImGuiSortDirection.Descending]] + if band(flags, 16384 --[[ImGuiTableColumnFlags.PreferSortAscending]]) ~= 0 and band(flags, 1024 --[[ImGuiTableColumnFlags.NoSortAscending]]) == 0 then mask = bor(mask, lshift(1, Asc)); list = bor(list, lshift(Asc, lshift(count, 1))); count = count + 1 end + if band(flags, 32768 --[[ImGuiTableColumnFlags.PreferSortDescending]]) ~= 0 and band(flags, 2048 --[[ImGuiTableColumnFlags.NoSortDescending]]) == 0 then mask = bor(mask, lshift(1, Desc)); list = bor(list, lshift(Desc, lshift(count, 1))); count = count + 1 end + if band(flags, 16384 --[[ImGuiTableColumnFlags.PreferSortAscending]]) == 0 and band(flags, 1024 --[[ImGuiTableColumnFlags.NoSortAscending]]) == 0 then mask = bor(mask, lshift(1, Asc)); list = bor(list, lshift(Asc, lshift(count, 1))); count = count + 1 end + if band(flags, 32768 --[[ImGuiTableColumnFlags.PreferSortDescending]]) == 0 and band(flags, 2048 --[[ImGuiTableColumnFlags.NoSortDescending]]) == 0 then mask = bor(mask, lshift(1, Desc)); list = bor(list, lshift(Desc, lshift(count, 1))); count = count + 1 end + if band(table_.Flags, 134217728 --[[ImGuiTableFlags.SortTristate]]) ~= 0 or count == 0 then mask = bor(mask, lshift(1, 0 --[[ImGuiSortDirection.None]])); count = count + 1 end column.SortDirectionsAvailList = band(list, 0xFF) column.SortDirectionsAvailMask = band(mask, 0xFF) column.SortDirectionsAvailCount = count @@ -43510,7 +43553,7 @@ end function ImGui.TableUpdateLayout(table_) local g = GImGui local temp_data = table_.TempData - IM_ASSERT(table_.IsLayoutLocked == false) + assert(table_.IsLayoutLocked == false) local columns_count = table_.ColumnsCount -- Reconcile moved columns @@ -43559,7 +43602,7 @@ function ImGui.TableUpdateLayout(table_) end table_.RefScale = new_ref_scale_unit - local table_sizing_policy = band(table_.Flags, ImGuiTableFlags.SizingMask_) + local table_sizing_policy = band(table_.Flags, 57344 --[[ImGuiTableFlags.SizingMask_]]) table_.IsDefaultDisplayOrder = true; table_.IsDefaultVisibility = true table_.ColumnsEnabledCount = 0 BitArrayClearAll(table_.EnabledMaskByIndex) @@ -43584,24 +43627,24 @@ function ImGui.TableUpdateLayout(table_) -- It would easily work without but we're not ready to guarantee it since e.g. names need resubmission anyway. -- We take a slight shortcut but in theory we could be calling TableSetupColumn() here with dummy values, it should yield the same effect. if table_.DeclColumnsCount <= column_n then - TableSetupColumnFlags(table_, column, column_n, ImGuiTableColumnFlags.None) + TableSetupColumnFlags(table_, column, column_n, 0 --[[ImGuiTableColumnFlags.None]]) column.NameOffset = -1 column.ID = 0; column.UserData = 0 column.InitStretchWeightOrWidth = -1.0 end -- Update Enabled state, mark settings and sort specs dirty - if band(table_.Flags, ImGuiTableFlags.Hideable) == 0 or band(column.Flags, ImGuiTableColumnFlags.NoHide) ~= 0 then + if band(table_.Flags, 4 --[[ImGuiTableFlags.Hideable]]) == 0 or band(column.Flags, 128 --[[ImGuiTableColumnFlags.NoHide]]) ~= 0 then column.IsUserEnabledNextFrame = true end if column.IsUserEnabled ~= column.IsUserEnabledNextFrame then column.IsUserEnabled = column.IsUserEnabledNextFrame table_.IsSettingsDirty = true end - column.IsEnabled = column.IsUserEnabled and band(column.Flags, ImGuiTableColumnFlags.Disabled) == 0 + column.IsEnabled = column.IsUserEnabled and band(column.Flags, 1 --[[ImGuiTableColumnFlags.Disabled]]) == 0 column.IsJustCreated = false - if column.IsEnabled ~= (band(column.Flags, ImGuiTableColumnFlags.DefaultHide) == 0) then + if column.IsEnabled ~= (band(column.Flags, 2 --[[ImGuiTableColumnFlags.DefaultHide]]) == 0) then table_.IsDefaultVisibility = false end if column_n ~= order_n then @@ -43611,13 +43654,13 @@ function ImGui.TableUpdateLayout(table_) if column.SortOrder ~= -1 and not column.IsEnabled then table_.IsSortSpecsDirty = true end - if column.SortOrder > 0 and band(table_.Flags, ImGuiTableFlags.SortMulti) == 0 then + if column.SortOrder > 0 and band(table_.Flags, 67108864 --[[ImGuiTableFlags.SortMulti]]) == 0 then table_.IsSortSpecsDirty = true end -- Auto-fit unsized columns local start_auto_fit - if band(column.Flags, ImGuiTableColumnFlags.WidthFixed) ~= 0 then + if band(column.Flags, 16 --[[ImGuiTableColumnFlags.WidthFixed]]) ~= 0 then start_auto_fit = column.WidthRequest < 0.0 else start_auto_fit = column.StretchWeight < 0.0 @@ -43643,7 +43686,7 @@ function ImGui.TableUpdateLayout(table_) BitArraySet(table_.EnabledMaskByIndex, column_n) BitArraySet(table_.EnabledMaskByDisplayOrder, column.DisplayOrder) prev_visible_column_idx = column_n - IM_ASSERT(column.IndexWithinEnabledSet <= column.DisplayOrder) + assert(column.IndexWithinEnabledSet <= column.DisplayOrder) -- Calculate ideal/auto column width (that's the width required for all contents to be visible without clipping) -- Combine width from regular rows + width from headers unless requested not to. @@ -43652,18 +43695,18 @@ function ImGui.TableUpdateLayout(table_) end -- Non-resizable columns keep their requested width (apply user value regardless of IsPreserveWidthAuto) - local column_is_resizable = band(column.Flags, ImGuiTableColumnFlags.NoResize) == 0 + local column_is_resizable = band(column.Flags, 32 --[[ImGuiTableColumnFlags.NoResize]]) == 0 if column_is_resizable then has_resizable = true end - if band(column.Flags, ImGuiTableColumnFlags.WidthFixed) ~= 0 and column.InitStretchWeightOrWidth > 0.0 and not column_is_resizable then + if band(column.Flags, 16 --[[ImGuiTableColumnFlags.WidthFixed]]) ~= 0 and column.InitStretchWeightOrWidth > 0.0 and not column_is_resizable then column.WidthAuto = column.InitStretchWeightOrWidth end if column.AutoFitQueue ~= 0x00 then has_auto_fit_request = true end - if band(column.Flags, ImGuiTableColumnFlags.WidthStretch) ~= 0 then + if band(column.Flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0 then stretch_sum_width_auto = stretch_sum_width_auto + column.WidthAuto count_stretch = count_stretch + 1 else @@ -43672,11 +43715,11 @@ function ImGui.TableUpdateLayout(table_) end end end - if band(table_.Flags, ImGuiTableFlags.Sortable) ~= 0 and table_.SortSpecsCount == 0 and band(table_.Flags, ImGuiTableFlags.SortTristate) == 0 then + if band(table_.Flags, 8 --[[ImGuiTableFlags.Sortable]]) ~= 0 and table_.SortSpecsCount == 0 and band(table_.Flags, 134217728 --[[ImGuiTableFlags.SortTristate]]) == 0 then table_.IsSortSpecsDirty = true end table_.RightMostEnabledColumn = prev_visible_column_idx - IM_ASSERT(table_.LeftMostEnabledColumn >= 0 and table_.RightMostEnabledColumn >= 0) + assert(table_.LeftMostEnabledColumn >= 0 and table_.RightMostEnabledColumn >= 0) -- [Part 2] Disable child window clipping while fitting columns. This is not strictly necessary but makes it possible to avoid -- the column fitting having to wait until the first visible frame of the child container (may or not be a good thing). Also see #6510. @@ -43696,11 +43739,11 @@ function ImGui.TableUpdateLayout(table_) if BitTest(table_.EnabledMaskByIndex, column_n) then local column = table_.Columns[column_n] - local column_is_resizable = band(column.Flags, ImGuiTableColumnFlags.NoResize) == 0 - if band(column.Flags, ImGuiTableColumnFlags.WidthFixed) ~= 0 then + local column_is_resizable = band(column.Flags, 32 --[[ImGuiTableColumnFlags.NoResize]]) == 0 + if band(column.Flags, 16 --[[ImGuiTableColumnFlags.WidthFixed]]) ~= 0 then -- Apply same widths policy local width_auto = column.WidthAuto - if table_sizing_policy == ImGuiTableFlags.SizingFixedSame and (column.AutoFitQueue ~= 0x00 or not column_is_resizable) then + if table_sizing_policy == 16384 --[[ImGuiTableFlags.SizingFixedSame]] and (column.AutoFitQueue ~= 0x00 or not column_is_resizable) then width_auto = fixed_max_width_auto end @@ -43708,7 +43751,7 @@ function ImGui.TableUpdateLayout(table_) -- Latch initial size for fixed columns and update it constantly for auto-resizing column (unless clipped!) if column.AutoFitQueue ~= 0x00 then column.WidthRequest = width_auto - elseif band(column.Flags, ImGuiTableColumnFlags.WidthFixed) ~= 0 and not column_is_resizable and column.IsRequestOutput then + elseif band(column.Flags, 16 --[[ImGuiTableColumnFlags.WidthFixed]]) ~= 0 and not column_is_resizable and column.IsRequestOutput then column.WidthRequest = width_auto end @@ -43727,7 +43770,7 @@ function ImGui.TableUpdateLayout(table_) if column.AutoFitQueue ~= 0x00 or column.StretchWeight < 0.0 or not column_is_resizable then if column.InitStretchWeightOrWidth > 0.0 then column.StretchWeight = column.InitStretchWeightOrWidth - elseif table_sizing_policy == ImGuiTableFlags.SizingStretchProp then + elseif table_sizing_policy == 24576 --[[ImGuiTableFlags.SizingStretchProp]] then column.StretchWeight = (column.WidthAuto / stretch_sum_width_auto) * count_stretch else column.StretchWeight = 1.0 @@ -43753,7 +43796,7 @@ function ImGui.TableUpdateLayout(table_) local work_rect = Rect(table_.WorkRect) local width_spacings = (table_.OuterPaddingX * 2.0) + (table_.CellSpacingX1 + table_.CellSpacingX2) * (table_.ColumnsEnabledCount - 1) local width_removed = (table_.HasScrollbarYPrev and not table_.InnerWindow.ScrollbarY) and g.Style.ScrollbarSize or 0.0 -- To synchronize decoration width of synced tables with mismatching scrollbar state (#5920) - local width_avail = mathMax(1.0, ((band(table_.Flags, ImGuiTableFlags.ScrollX) ~= 0 and table_.InnerWidth == 0.0) and table_.InnerClipRect:GetWidth() or work_rect:GetWidth()) - width_removed) + local width_avail = mathMax(1.0, ((band(table_.Flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) ~= 0 and table_.InnerWidth == 0.0) and table_.InnerClipRect:GetWidth() or work_rect:GetWidth()) - width_removed) local width_avail_for_stretched_columns = width_avail - width_spacings - sum_width_requests local width_remaining_for_stretched_columns = width_avail_for_stretched_columns table_.ColumnsGivenWidth = width_spacings + (table_.CellPaddingX * 2.0) * table_.ColumnsEnabledCount @@ -43762,7 +43805,7 @@ function ImGui.TableUpdateLayout(table_) local column = table_.Columns[column_n] -- Allocate width for stretched/weighted columns (StretchWeight gets converted into WidthRequest) - if band(column.Flags, ImGuiTableColumnFlags.WidthStretch) ~= 0 then + if band(column.Flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0 then local weight_ratio = column.StretchWeight / stretch_sum_weights column.WidthRequest = IM_TRUNC(mathMax(width_avail_for_stretched_columns * weight_ratio, table_.MinColumnWidth) + 0.01) width_remaining_for_stretched_columns = width_remaining_for_stretched_columns - column.WidthRequest @@ -43771,7 +43814,7 @@ function ImGui.TableUpdateLayout(table_) -- [Resize Rule 1] The right-most Visible column is not resizable if there is at least one Stretch column -- See additional comments in TableSetColumnWidth(). if column.NextEnabledColumn == -1 and table_.LeftMostStretchedColumn ~= -1 then - column.Flags = bor(column.Flags, ImGuiTableColumnFlags.NoDirectResize_) + column.Flags = bor(column.Flags, 1073741824 --[[ImGuiTableColumnFlags.NoDirectResize_]]) end -- Assign final width, record width in case we will need to shrink @@ -43782,12 +43825,12 @@ function ImGui.TableUpdateLayout(table_) -- [Part 5] Redistribute stretch remainder width due to rounding (remainder width is < 1.0 * number of Stretch column). -- Using right-to-left distribution (more likely to match resizing cursor). - if width_remaining_for_stretched_columns >= 1.0 and band(table_.Flags, ImGuiTableFlags.PreciseWidths) == 0 then + if width_remaining_for_stretched_columns >= 1.0 and band(table_.Flags, 524288 --[[ImGuiTableFlags.PreciseWidths]]) == 0 then local order_n = columns_count - 1 while stretch_sum_weights > 0.0 and width_remaining_for_stretched_columns >= 1.0 and order_n >= 0 do if BitTest(table_.EnabledMaskByDisplayOrder, order_n) then local column = table_.Columns[table_.DisplayOrderToIndex[order_n]] - if band(column.Flags, ImGuiTableColumnFlags.WidthStretch) ~= 0 then + if band(column.Flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0 then column.WidthRequest = column.WidthRequest + 1.0 column.WidthGiven = column.WidthGiven + 1.0 width_remaining_for_stretched_columns = width_remaining_for_stretched_columns - 1.0 @@ -43809,7 +43852,7 @@ function ImGui.TableUpdateLayout(table_) local mouse_hit_rect = ImRect(table_.OuterRect.Min.x, table_.OuterRect.Min.y, table_.OuterRect.Max.x, mathMax(table_.OuterRect.Max.y, table_.OuterRect.Min.y + table_instance.LastOuterHeight)) local backup_active_id = g.ActiveId g.ActiveId = 0 - local is_hovering_table = ImGui.ItemHoverable(mouse_hit_rect, 0, ImGuiItemFlags.None) + local is_hovering_table = ImGui.ItemHoverable(mouse_hit_rect, 0, 0 --[[ImGuiItemFlags.None]]) g.ActiveId = backup_active_id -- Determine skewed MousePos.x to support angled headers. @@ -43833,7 +43876,7 @@ function ImGui.TableUpdateLayout(table_) local column = table_.Columns[column_n] -- Initial nav layer: using FreezeRowsCount, NOT FreezeRowsRequest, so Header line changes layer when frozen - column.NavLayerCurrent = (table_.FreezeRowsCount > 0) and ImGuiNavLayer.Menu or table_.NavLayer + column.NavLayerCurrent = (table_.FreezeRowsCount > 0) and 1 --[[ImGuiNavLayer.Menu]] or table_.NavLayer if offset_x_frozen and table_.FreezeColumnsCount == order_n then offset_x = offset_x + work_rect.Min.x - table_.OuterRect.Min.x @@ -43841,7 +43884,7 @@ function ImGui.TableUpdateLayout(table_) end -- Clear status flags - column.Flags = band(column.Flags, bnot(ImGuiTableColumnFlags.StatusMask_)) + column.Flags = band(column.Flags, bnot(251658240 --[[ImGuiTableColumnFlags.StatusMask_]])) if not BitTest(table_.EnabledMaskByDisplayOrder, order_n) then -- Hidden column: clear a few fields and we are done with it for the remainder of the function. @@ -43850,7 +43893,7 @@ function ImGui.TableUpdateLayout(table_) column.ClipRect.Min.x = offset_x; column.ClipRect.Max.x = offset_x column.WidthGiven = 0.0 column.ClipRect.Min.y = work_rect.Min.y - column.ClipRect.Max.y = FLT_MAX + column.ClipRect.Max.y = 3.4028234663853e+38 --[[FLT_MAX]] column.ClipRect:ClipWithFull(host_clip_rect) column.IsVisibleX = false; column.IsVisibleY = false; column.IsRequestOutput = false column.IsSkipItems = true @@ -43877,7 +43920,7 @@ function ImGui.TableUpdateLayout(table_) column.ClipRect.Min.x = column.MinX column.ClipRect.Min.y = work_rect.Min.y column.ClipRect.Max.x = column.MaxX --column.WorkMaxX - column.ClipRect.Max.y = FLT_MAX + column.ClipRect.Max.y = 3.4028234663853e+38 --[[FLT_MAX]] column.ClipRect:ClipWithFull(host_clip_rect) -- Mark column as Clipped (not in sight) @@ -43901,24 +43944,24 @@ function ImGui.TableUpdateLayout(table_) -- (table.HostSkipItems is a copy of inner_window.SkipItems before we cleared it above in Part 2) column.IsSkipItems = not column.IsEnabled or table_.HostSkipItems if column.IsSkipItems then - IM_ASSERT(not is_visible) + assert(not is_visible) end if column.IsRequestOutput and not column.IsSkipItems then has_at_least_one_column_requesting_output = true end -- Update status flags - column.Flags = bor(column.Flags, ImGuiTableColumnFlags.IsEnabled) + column.Flags = bor(column.Flags, 16777216 --[[ImGuiTableColumnFlags.IsEnabled]]) if is_visible then - column.Flags = bor(column.Flags, ImGuiTableColumnFlags.IsVisible) + column.Flags = bor(column.Flags, 33554432 --[[ImGuiTableColumnFlags.IsVisible]]) end if column.SortOrder ~= -1 then - column.Flags = bor(column.Flags, ImGuiTableColumnFlags.IsSorted) + column.Flags = bor(column.Flags, 67108864 --[[ImGuiTableColumnFlags.IsSorted]]) end -- Detect hovered column if is_hovering_table and mouse_skewed_x >= column.ClipRect.Min.x and mouse_skewed_x < column.ClipRect.Max.x then - column.Flags = bor(column.Flags, ImGuiTableColumnFlags.IsHovered) + column.Flags = bor(column.Flags, 134217728 --[[ImGuiTableColumnFlags.IsHovered]]) table_.HoveredColumnBody = column_n end @@ -43976,8 +44019,8 @@ function ImGui.TableUpdateLayout(table_) table_.HoveredColumnBody = columns_count end end - if has_resizable == false and band(table_.Flags, ImGuiTableFlags.Resizable) ~= 0 then - table_.Flags = band(table_.Flags, bnot(ImGuiTableFlags.Resizable)) + if has_resizable == false and band(table_.Flags, 1 --[[ImGuiTableFlags.Resizable]]) ~= 0 then + table_.Flags = band(table_.Flags, bnot(1 --[[ImGuiTableFlags.Resizable]])) end table_.IsActiveIdAliveBeforeTable = (g.ActiveIdIsAlive ~= 0) @@ -43986,9 +44029,9 @@ function ImGui.TableUpdateLayout(table_) -- This is done late to handle the case of fixed-columns tables not claiming more widths that they need. -- Because of this we are careful with uses of WorkRect and InnerClipRect before this point. if table_.RightMostStretchedColumn ~= -1 then - table_.Flags = band(table_.Flags, bnot(ImGuiTableFlags.NoHostExtendX)) + table_.Flags = band(table_.Flags, bnot(65536 --[[ImGuiTableFlags.NoHostExtendX]])) end - if band(table_.Flags, ImGuiTableFlags.NoHostExtendX) ~= 0 then + if band(table_.Flags, 65536 --[[ImGuiTableFlags.NoHostExtendX]]) ~= 0 then table_.OuterRect.Max.x = unused_x1; table_.WorkRect.Max.x = unused_x1 table_.InnerClipRect.Max.x = mathMin(table_.InnerClipRect.Max.x, unused_x1) end @@ -43998,10 +44041,10 @@ function ImGui.TableUpdateLayout(table_) -- Setup window's WorkRect.Max.y for GetContentRegionAvail(). Other values will be updated in each TableBeginCell() call. local window_content_max_y - if band(table_.Flags, ImGuiTableFlags.NoHostExtendY) ~= 0 then + if band(table_.Flags, 131072 --[[ImGuiTableFlags.NoHostExtendY]]) ~= 0 then window_content_max_y = table_.OuterRect.Max.y else - window_content_max_y = mathMax(table_.InnerWindow.ContentRegionRect.Max.y, (band(table_.Flags, ImGuiTableFlags.ScrollY) ~= 0) and 0.0 or table_.OuterRect.Max.y) + window_content_max_y = mathMax(table_.InnerWindow.ContentRegionRect.Max.y, (band(table_.Flags, 33554432 --[[ImGuiTableFlags.ScrollY]]) ~= 0) and 0.0 or table_.OuterRect.Max.y) end table_.InnerWindow.WorkRect.Max.y = ImClamp(window_content_max_y - g.Style.CellPadding.y, table_.InnerWindow.WorkRect.Min.y, table_.InnerWindow.WorkRect.Max.y) @@ -44009,7 +44052,7 @@ function ImGui.TableUpdateLayout(table_) ImGui.TableSetupDrawChannels(table_) -- [Part 10] Hit testing on borders - if band(table_.Flags, ImGuiTableFlags.Resizable) ~= 0 then + if band(table_.Flags, 1 --[[ImGuiTableFlags.Resizable]]) ~= 0 then ImGui.TableUpdateBorders(table_) end table_instance.LastTopHeadersRowHeight = 0.0 @@ -44020,7 +44063,7 @@ function ImGui.TableUpdateLayout(table_) table_.HighlightColumnHeader = -1 if table_.IsContextPopupOpen and table_.ContextPopupColumn ~= -1 and table_.InstanceInteracted == table_.InstanceCurrent then table_.HighlightColumnHeader = table_.ContextPopupColumn - elseif band(table_.Flags, ImGuiTableFlags.HighlightHoveredColumn) ~= 0 and table_.HoveredColumnBody ~= -1 and table_.HoveredColumnBody ~= columns_count and table_.HoveredColumnBorder == -1 then + elseif band(table_.Flags, 268435456 --[[ImGuiTableFlags.HighlightHoveredColumn]]) ~= 0 and table_.HoveredColumnBody ~= -1 and table_.HoveredColumnBody ~= columns_count and table_.HoveredColumnBorder == -1 then if g.ActiveId == 0 or (table_.IsActiveIdInTable or g.DragDropActive) then table_.HighlightColumnHeader = table_.HoveredColumnBody end @@ -44038,7 +44081,7 @@ function ImGui.TableUpdateLayout(table_) -- [Part 12] Sanitize and build sort specs before we have a chance to use them for display. -- This path will only be exercised when sort specs are modified before header rows (e.g. init or visibility change) - if table_.IsSortSpecsDirty and band(table_.Flags, ImGuiTableFlags.Sortable) ~= 0 then + if table_.IsSortSpecsDirty and band(table_.Flags, 8 --[[ImGuiTableFlags.Sortable]]) ~= 0 then ImGui.TableSortSpecsBuild(table_) end @@ -44058,7 +44101,7 @@ function ImGui.TableUpdateLayout(table_) end -- Initial state - if band(table_.Flags, ImGuiTableFlags.NoClip) ~= 0 then + if band(table_.Flags, 1048576 --[[ImGuiTableFlags.NoClip]]) ~= 0 then table_.DrawSplitter:SetCurrentChannel(inner_window.DrawList, TABLE_DRAW_CHANNEL_NOCLIP) else inner_window.DrawList:PushClipRect(inner_window.InnerClipRect.Min, inner_window.InnerClipRect.Max, false) -- FIXME: use table.InnerClipRect? @@ -44073,7 +44116,7 @@ function ImGui.TableApplyExternalUnclipRect(table_, rect) for column_n = 0, table_.ColumnsCount - 1 do local column = table_.Columns[column_n] if not column.IsRequestOutput then - if rect:Overlaps(ImRect(column.MinX, table_.WorkRect.Min.y, column.MaxX, FLT_MAX)) then + if rect:Overlaps(ImRect(column.MinX, table_.WorkRect.Min.y, column.MaxX, 3.4028234663853e+38 --[[FLT_MAX]])) then column.IsRequestOutput = true end end @@ -44084,7 +44127,7 @@ end -- - Set table.HoveredColumnBorder with a short delay/timer to reduce visual feedback noise. function ImGui.TableUpdateBorders(table_) local g = GImGui - IM_ASSERT(band(table_.Flags, ImGuiTableFlags.Resizable) ~= 0) + assert(band(table_.Flags, 1 --[[ImGuiTableFlags.Resizable]]) ~= 0) -- At this point OuterRect height may be zero or under actual final height, so we rely on temporal coherency and -- use the final height from last frame. Because this is only affecting _interaction_ with columns, it is not @@ -44104,13 +44147,13 @@ function ImGui.TableUpdateBorders(table_) local column_n = table_.DisplayOrderToIndex[order_n] local column = table_.Columns[column_n] - if band(column.Flags, bor(ImGuiTableColumnFlags.NoResize, ImGuiTableColumnFlags.NoDirectResize_)) ~= 0 then + if band(column.Flags, bor(32 --[[ImGuiTableColumnFlags.NoResize]], 1073741824 --[[ImGuiTableColumnFlags.NoDirectResize_]])) ~= 0 then break end -- ImGuiTableFlags.NoBordersInBodyUntilResize will be honored in TableDrawBorders() - local border_y2_hit = (band(table_.Flags, ImGuiTableFlags.NoBordersInBody) ~= 0) and hit_y2_head or hit_y2_body - if band(table_.Flags, ImGuiTableFlags.NoBordersInBody) ~= 0 and table_.IsUsingHeaders == false then + local border_y2_hit = (band(table_.Flags, 2048 --[[ImGuiTableFlags.NoBordersInBody]]) ~= 0) and hit_y2_head or hit_y2_body + if band(table_.Flags, 2048 --[[ImGuiTableFlags.NoBordersInBody]]) ~= 0 and table_.IsUsingHeaders == false then break end @@ -44120,10 +44163,10 @@ function ImGui.TableUpdateBorders(table_) local column_id = ImGui.TableGetColumnResizeID(table_, column_n, table_.InstanceCurrent) local hit_rect = ImRect(column.MaxX - hit_half_width, hit_y1, column.MaxX + hit_half_width, border_y2_hit) - ImGui.ItemAdd(hit_rect, column_id, nil, ImGuiItemFlags.NoNav) + ImGui.ItemAdd(hit_rect, column_id, nil, 2 --[[ImGuiItemFlags.NoNav]]) --ImGui.GetForegroundDrawList():AddRect(hit_rect.Min, hit_rect.Max, IM_COL32(255, 0, 0, 100)) - local pressed, hovered, held = ImGui.ButtonBehavior(hit_rect, column_id, bor(ImGuiButtonFlags.FlattenChildren, ImGuiButtonFlags.PressedOnClick, ImGuiButtonFlags.PressedOnDoubleClick, ImGuiButtonFlags.NoNavFocus)) + local pressed, hovered, held = ImGui.ButtonBehavior(hit_rect, column_id, bor(2048 --[[ImGuiButtonFlags.FlattenChildren]], 16 --[[ImGuiButtonFlags.PressedOnClick]], 256 --[[ImGuiButtonFlags.PressedOnDoubleClick]], 262144 --[[ImGuiButtonFlags.NoNavFocus]])) if pressed and ImGui.IsMouseDoubleClicked(0) then ImGui.TableSetColumnWidthAutoSingle(table_, column_n) ImGui.ClearActiveID() @@ -44131,14 +44174,14 @@ function ImGui.TableUpdateBorders(table_) end if held then if table_.LastResizedColumn == -1 then - table_.ResizeLockMinContentsX2 = (table_.RightMostEnabledColumn ~= -1) and table_.Columns[table_.RightMostEnabledColumn].MaxX or -FLT_MAX + table_.ResizeLockMinContentsX2 = (table_.RightMostEnabledColumn ~= -1) and table_.Columns[table_.RightMostEnabledColumn].MaxX or -3.4028234663853e+38 --[[FLT_MAX]] end table_.ResizedColumn = column_n table_.InstanceInteracted = table_.InstanceCurrent end if (hovered and g.HoveredIdTimer > TABLE_RESIZE_SEPARATOR_FEEDBACK_TIMER) or held then table_.HoveredColumnBorder = column_n - ImGui.SetMouseCursor(ImGuiMouseCursor.ResizeEW) + ImGui.SetMouseCursor(4 --[[ImGuiMouseCursor.ResizeEW]]) end until true end @@ -44163,16 +44206,16 @@ function ImGui.EndTable() local inner_window = table_.InnerWindow local outer_window = table_.OuterWindow local temp_data = table_.TempData - IM_ASSERT(inner_window == g.CurrentWindow and inner_window.ID == temp_data.WindowID) - IM_ASSERT(outer_window == inner_window or outer_window == inner_window.ParentWindow) + assert(inner_window == g.CurrentWindow and inner_window.ID == temp_data.WindowID) + assert(outer_window == inner_window or outer_window == inner_window.ParentWindow) if table_.IsInsideRow then ImGui.TableEndRow(table_) end -- Context menu in columns body - if band(flags, ImGuiTableFlags.ContextMenuInBody) ~= 0 then - if table_.HoveredColumnBody ~= -1 and not ImGui.IsAnyItemHovered() and ImGui.IsMouseReleased(ImGuiMouseButton.Right) then + if band(flags, 32 --[[ImGuiTableFlags.ContextMenuInBody]]) ~= 0 then + if table_.HoveredColumnBody ~= -1 and not ImGui.IsAnyItemHovered() and ImGui.IsMouseReleased(1 --[[ImGuiMouseButton.Right]]) then ImGui.TableOpenContextMenu(table_.HoveredColumnBody) end end @@ -44183,10 +44226,10 @@ function ImGui.EndTable() ImVec2_Copy(inner_window.DC.CurrLineSize, temp_data.HostBackupCurrLineSize) ImVec2_Copy(inner_window.DC.CursorMaxPos, temp_data.HostBackupCursorMaxPos) local inner_content_max_y = ImCeil(table_.RowPosY2) -- Rounding final position is important as we currently don't round row height ('Demo->Tables->Outer Size' demo uses non-integer heights) - IM_ASSERT(table_.RowPosY2 == inner_window.DC.CursorPos.y) + assert(table_.RowPosY2 == inner_window.DC.CursorPos.y) if inner_window ~= outer_window then inner_window.DC.CursorMaxPos.y = inner_content_max_y - elseif band(flags, ImGuiTableFlags.NoHostExtendY) == 0 then + elseif band(flags, 131072 --[[ImGuiTableFlags.NoHostExtendY]]) == 0 then local v = mathMax(table_.OuterRect.Max.y, inner_content_max_y) -- Patch OuterRect/InnerRect height table_.OuterRect.Max.y = v; table_.InnerRect.Max.y = v end @@ -44196,8 +44239,8 @@ function ImGui.EndTable() -- Setup inner scrolling range -- FIXME: This ideally should be done earlier, in BeginTable() SetNextWindowContentSize call, just like writing to inner_window.DC.CursorMaxPos.y, -- but since the later is likely to be impossible to do we'd rather update both axes together. - if band(table_.Flags, ImGuiTableFlags.ScrollX) ~= 0 then - local outer_padding_for_border = (band(table_.Flags, ImGuiTableFlags.BordersOuterV) ~= 0) and TABLE_BORDER_SIZE or 0.0 + if band(table_.Flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) ~= 0 then + local outer_padding_for_border = (band(table_.Flags, 1024 --[[ImGuiTableFlags.BordersOuterV]]) ~= 0) and TABLE_BORDER_SIZE or 0.0 local max_pos_x = inner_window.DC.CursorMaxPos.x if table_.RightMostEnabledColumn ~= -1 then max_pos_x = mathMax(max_pos_x, table_.Columns[table_.RightMostEnabledColumn].WorkMaxX + table_.CellPaddingX + table_.OuterPaddingX - outer_padding_for_border) @@ -44209,20 +44252,20 @@ function ImGui.EndTable() end -- Pop clipping rect - if band(flags, ImGuiTableFlags.NoClip) == 0 then + if band(flags, 1048576 --[[ImGuiTableFlags.NoClip]]) == 0 then inner_window.DrawList:PopClipRect() end ImRect_CopyFromV4(inner_window.ClipRect, inner_window.DrawList._ClipRectStack:back()) -- Draw borders - if band(flags, ImGuiTableFlags.Borders) ~= 0 then + if band(flags, 1920 --[[ImGuiTableFlags.Borders]]) ~= 0 then ImGui.TableDrawBorders(table_) end -- Flatten channels and merge draw calls local splitter = table_.DrawSplitter splitter:SetCurrentChannel(inner_window.DrawList, 0) - if band(table_.Flags, ImGuiTableFlags.NoClip) == 0 then + if band(table_.Flags, 1048576 --[[ImGuiTableFlags.NoClip]]) == 0 then ImGui.TableMergeDrawChannels(table_) end splitter:Merge(inner_window.DrawList) @@ -44235,17 +44278,17 @@ function ImGui.EndTable() if BitTest(table_.EnabledMaskByIndex, column_n) then local column = table_.Columns[column_n] local column_width_request - if band(column.Flags, ImGuiTableColumnFlags.WidthFixed) ~= 0 and band(column.Flags, ImGuiTableColumnFlags.NoResize) == 0 then + if band(column.Flags, 16 --[[ImGuiTableColumnFlags.WidthFixed]]) ~= 0 and band(column.Flags, 32 --[[ImGuiTableColumnFlags.NoResize]]) == 0 then column_width_request = column.WidthRequest else column_width_request = ImGui.TableGetColumnWidthAuto(table_, column) end - if band(column.Flags, ImGuiTableColumnFlags.WidthFixed) ~= 0 then + if band(column.Flags, 16 --[[ImGuiTableColumnFlags.WidthFixed]]) ~= 0 then auto_fit_width_for_fixed = auto_fit_width_for_fixed + column_width_request else auto_fit_width_for_stretched = auto_fit_width_for_stretched + column_width_request end - if band(column.Flags, ImGuiTableColumnFlags.WidthStretch) ~= 0 and band(column.Flags, ImGuiTableColumnFlags.NoResize) ~= 0 then + if band(column.Flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0 and band(column.Flags, 32 --[[ImGuiTableColumnFlags.NoResize]]) ~= 0 then auto_fit_width_for_stretched_min = mathMax(auto_fit_width_for_stretched_min, column_width_request / (column.StretchWeight / table_.ColumnsStretchSumWeights)) end end @@ -44254,7 +44297,7 @@ function ImGui.EndTable() table_.ColumnsAutoFitWidth = width_spacings + (table_.CellPaddingX * 2.0) * table_.ColumnsEnabledCount + auto_fit_width_for_fixed + mathMax(auto_fit_width_for_stretched, auto_fit_width_for_stretched_min) -- Update scroll - if band(table_.Flags, ImGuiTableFlags.ScrollX) == 0 and inner_window ~= outer_window then + if band(table_.Flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) == 0 and inner_window ~= outer_window then inner_window.Scroll.x = 0.0 elseif table_.LastResizedColumn ~= -1 and table_.ResizedColumn == -1 and inner_window.ScrollbarX and table_.InstanceInteracted == table_.InstanceCurrent then -- When releasing a column being resized, scroll to keep the resulting column in sight @@ -44312,10 +44355,10 @@ function ImGui.EndTable() end -- Override declared contents width/height to enable auto-resize while not needlessly adding a scrollbar - if band(table_.Flags, ImGuiTableFlags.NoHostExtendX) ~= 0 then + if band(table_.Flags, 65536 --[[ImGuiTableFlags.NoHostExtendX]]) ~= 0 then -- FIXME-TABLE: Could we remove this section? -- ColumnsAutoFitWidth may be one frame ahead here since for Fixed+NoResize is calculated from latest contents - IM_ASSERT(band(table_.Flags, ImGuiTableFlags.ScrollX) == 0) + assert(band(table_.Flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) == 0) outer_window.DC.CursorMaxPos.x = mathMax(backup_outer_max_pos.x, table_.OuterRect.Min.x + table_.ColumnsAutoFitWidth) elseif temp_data.UserOuterSize.x <= 0.0 then -- Some references for this: #7651 + tests "table_reported_size", "table_reported_size_outer" equivalent Y block, #9352 @@ -44346,8 +44389,8 @@ function ImGui.EndTable() table_.IsInitializing = false -- Clear or restore current table, if any - IM_ASSERT(g.CurrentWindow == outer_window and g.CurrentTable == table_) - IM_ASSERT(g.TablesTempDataStacked > 0) + assert(g.CurrentWindow == outer_window and g.CurrentTable == table_) + assert(g.TablesTempDataStacked > 0) g.TablesTempDataStacked = g.TablesTempDataStacked - 1 temp_data = (g.TablesTempDataStacked > 0) and g.TablesTempData.Data[g.TablesTempDataStacked] or nil g.CurrentTable = (temp_data and (temp_data.WindowID == outer_window.ID)) and g.Tables:GetByIndex(temp_data.TableIndex) or nil @@ -44364,28 +44407,28 @@ end --- @param column_n int # index of `column` (C++: Columns.index_from_ptr(column)) function ImGui.TableInitColumnDefaults(table_, column, column_n, init_mask) local flags = column.Flags - if band(init_mask, ImGuiTableFlags.Resizable) ~= 0 then + if band(init_mask, 1 --[[ImGuiTableFlags.Resizable]]) ~= 0 then local init_width_or_weight = column.InitStretchWeightOrWidth - column.WidthRequest = (band(flags, ImGuiTableColumnFlags.WidthFixed) ~= 0 and init_width_or_weight > 0.0) and init_width_or_weight or -1.0 - column.StretchWeight = (init_width_or_weight > 0.0 and band(flags, ImGuiTableColumnFlags.WidthStretch) ~= 0) and init_width_or_weight or -1.0 + column.WidthRequest = (band(flags, 16 --[[ImGuiTableColumnFlags.WidthFixed]]) ~= 0 and init_width_or_weight > 0.0) and init_width_or_weight or -1.0 + column.StretchWeight = (init_width_or_weight > 0.0 and band(flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0) and init_width_or_weight or -1.0 if init_width_or_weight > 0.0 then -- Disable auto-fit if an explicit width/weight has been specified column.AutoFitQueue = 0x00 end end - if band(init_mask, ImGuiTableFlags.Reorderable) ~= 0 then - column.DisplayOrder = (band(table_.Flags, ImGuiTableFlags.Reorderable) ~= 0) and -1 or column_n + if band(init_mask, 2 --[[ImGuiTableFlags.Reorderable]]) ~= 0 then + column.DisplayOrder = (band(table_.Flags, 2 --[[ImGuiTableFlags.Reorderable]]) ~= 0) and -1 or column_n end - if band(init_mask, ImGuiTableFlags.Hideable) ~= 0 then - local v = band(flags, ImGuiTableColumnFlags.DefaultHide) == 0 + if band(init_mask, 4 --[[ImGuiTableFlags.Hideable]]) ~= 0 then + local v = band(flags, 2 --[[ImGuiTableColumnFlags.DefaultHide]]) == 0 column.IsUserEnabled = v; column.IsUserEnabledNextFrame = v end - if band(init_mask, ImGuiTableFlags.Sortable) ~= 0 then + if band(init_mask, 8 --[[ImGuiTableFlags.Sortable]]) ~= 0 then -- Multiple columns using _DefaultSort will be reassigned unique SortOrder values when building the sort specs. - column.SortOrder = (band(flags, ImGuiTableColumnFlags.DefaultSort) ~= 0) and 0 or -1 - if band(flags, ImGuiTableColumnFlags.DefaultSort) ~= 0 then - column.SortDirection = (band(flags, ImGuiTableColumnFlags.PreferSortDescending) ~= 0) and ImGuiSortDirection.Descending or ImGuiSortDirection.Ascending + column.SortOrder = (band(flags, 4 --[[ImGuiTableColumnFlags.DefaultSort]]) ~= 0) and 0 or -1 + if band(flags, 4 --[[ImGuiTableColumnFlags.DefaultSort]]) ~= 0 then + column.SortDirection = (band(flags, 32768 --[[ImGuiTableColumnFlags.PreferSortDescending]]) ~= 0) and 2 --[[ImGuiSortDirection.Descending]] or 1 --[[ImGuiSortDirection.Ascending]] else - column.SortDirection = ImGuiSortDirection.None + column.SortDirection = 0 --[[ImGuiSortDirection.None]] end end end @@ -44397,19 +44440,19 @@ local function TableSetupColumnApply(table_, idx, id, name_offset, flags, init_w -- Assert when passing a width or weight if policy is entirely left to default, to avoid storing width into weight and vice-versa. -- Give a grace to users of ImGuiTableFlags.ScrollX. - if table_.IsDefaultSizingPolicy and band(flags, ImGuiTableColumnFlags.WidthMask_) == 0 and band(flags, ImGuiTableFlags.ScrollX) == 0 then + if table_.IsDefaultSizingPolicy and band(flags, 24 --[[ImGuiTableColumnFlags.WidthMask_]]) == 0 and band(flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) == 0 then IM_ASSERT_USER_ERROR_RET(init_width_or_weight <= 0.0, "TableSetupColumn(): can only specify width/weight if sizing policy is set explicitly in either Table or Column.") end -- When passing a width automatically enforce WidthFixed policy -- (whereas TableSetupColumnFlags would default to WidthAuto if table is not resizable) - if band(flags, ImGuiTableColumnFlags.WidthMask_) == 0 and init_width_or_weight > 0.0 then - if band(table_.Flags, ImGuiTableFlags.SizingMask_) == ImGuiTableFlags.SizingFixedFit or band(table_.Flags, ImGuiTableFlags.SizingMask_) == ImGuiTableFlags.SizingFixedSame then - flags = bor(flags, ImGuiTableColumnFlags.WidthFixed) + if band(flags, 24 --[[ImGuiTableColumnFlags.WidthMask_]]) == 0 and init_width_or_weight > 0.0 then + if band(table_.Flags, 57344 --[[ImGuiTableFlags.SizingMask_]]) == 8192 --[[ImGuiTableFlags.SizingFixedFit]] or band(table_.Flags, 57344 --[[ImGuiTableFlags.SizingMask_]]) == 16384 --[[ImGuiTableFlags.SizingFixedSame]] then + flags = bor(flags, 16 --[[ImGuiTableColumnFlags.WidthFixed]]) end end - if band(flags, ImGuiTableColumnFlags.AngledHeader) ~= 0 then - flags = bor(flags, ImGuiTableColumnFlags.NoHeaderLabel) + if band(flags, 262144 --[[ImGuiTableColumnFlags.AngledHeader]]) ~= 0 then + flags = bor(flags, 4096 --[[ImGuiTableColumnFlags.NoHeaderLabel]]) table_.AngledHeadersCount = table_.AngledHeadersCount + 1 end @@ -44434,7 +44477,7 @@ function ImGui.TableSetupColumn(label, flags, init_width_or_weight, user_data) IM_ASSERT_USER_ERROR_RET(table_ ~= nil, "Call should only be done while in BeginTable() scope!") IM_ASSERT_USER_ERROR_RET(table_.DeclColumnsCount < table_.ColumnsCount, "TableSetupColumn(): called too many times!") IM_ASSERT_USER_ERROR_RET(table_.IsLayoutLocked == false, "TableSetupColumn(): need to call before first row!") -- Table layout is locked when submitting a row or when calling BeginMultiSelect() with box-select. - IM_ASSERT(band(flags, ImGuiTableColumnFlags.StatusMask_) == 0, "Illegal to pass StatusMask values to TableSetupColumn()") + assert(band(flags, 251658240 --[[ImGuiTableColumnFlags.StatusMask_]]) == 0, "Illegal to pass StatusMask values to TableSetupColumn()") -- Store name -- FIXME: If we recorded the number of \n in names we could compute header row height @@ -44501,7 +44544,7 @@ function ImGui.TableReconcileColumns(table_) local src_column = src_columns[src_n] if src_column.ID == reconcile_data.ID and src_column.IsNeedReconcileSrc then local dst_column = dst_columns[reconcile_data.ColumnNewIdx] - IM_ASSERT(src_column.IsNeedReconcileSrc and dst_column.IsNeedReconcileDst) + assert(src_column.IsNeedReconcileSrc and dst_column.IsNeedReconcileDst) src_column.IsNeedReconcileSrc = false; dst_column.IsNeedReconcileDst = false reconcile_data.ColumnOldIdx = src_n reconcile_data.ColumnOldData = TableColumnClone(src_column) @@ -44526,7 +44569,7 @@ function ImGui.TableReconcileColumns(table_) end local reconcile_data = reconcile_requests.Data[dst_idx] local dst_column = dst_columns[reconcile_data.ColumnNewIdx] - IM_ASSERT(src_column.IsNeedReconcileSrc and dst_column.IsNeedReconcileDst) + assert(src_column.IsNeedReconcileSrc and dst_column.IsNeedReconcileDst) src_column.IsNeedReconcileSrc = false; dst_column.IsNeedReconcileDst = false reconcile_data.ColumnOldIdx = src_n reconcile_data.ColumnOldData = TableColumnClone(src_column) @@ -44550,13 +44593,13 @@ function ImGui.TableSetupScrollFreeze(columns, rows) local g = GImGui local table_ = g.CurrentTable IM_ASSERT_USER_ERROR_RET(table_ ~= nil, "Call should only be done while in BeginTable() scope!") - IM_ASSERT(table_.IsLayoutLocked == false, "TableSetupColumn(): need to call before first row!") - IM_ASSERT(columns >= 0 and columns < IMGUI_TABLE_MAX_COLUMNS) - IM_ASSERT(rows >= 0 and rows < 128) -- Arbitrary limit + assert(table_.IsLayoutLocked == false, "TableSetupColumn(): need to call before first row!") + assert(columns >= 0 and columns < 512 --[[IMGUI_TABLE_MAX_COLUMNS]]) + assert(rows >= 0 and rows < 128) -- Arbitrary limit - table_.FreezeColumnsRequest = (band(table_.Flags, ImGuiTableFlags.ScrollX) ~= 0) and mathMin(columns, table_.ColumnsCount) or 0 + table_.FreezeColumnsRequest = (band(table_.Flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) ~= 0) and mathMin(columns, table_.ColumnsCount) or 0 table_.FreezeColumnsCount = (table_.InnerWindow.Scroll.x ~= 0.0) and table_.FreezeColumnsRequest or 0 - table_.FreezeRowsRequest = (band(table_.Flags, ImGuiTableFlags.ScrollY) ~= 0) and rows or 0 + table_.FreezeRowsRequest = (band(table_.Flags, 33554432 --[[ImGuiTableFlags.ScrollY]]) ~= 0) and rows or 0 table_.FreezeRowsCount = (table_.InnerWindow.Scroll.y ~= 0.0) and table_.FreezeRowsRequest or 0 table_.IsUnfrozenRows = (table_.FreezeRowsCount == 0) -- Make sure this is set before TableUpdateLayout() so ImGuiListClipper can benefit from it. end @@ -44641,11 +44684,11 @@ function ImGui.TableSetColumnEnabled(column_n, enabled) local g = GImGui local table_ = g.CurrentTable IM_ASSERT_USER_ERROR_RET(table_ ~= nil, "Call should only be done while in BeginTable() scope!") - IM_ASSERT(band(table_.Flags, ImGuiTableFlags.Hideable) ~= 0) -- See comments above + assert(band(table_.Flags, 4 --[[ImGuiTableFlags.Hideable]]) ~= 0) -- See comments above if column_n < 0 then column_n = table_.CurrentColumn end - IM_ASSERT(column_n >= 0 and column_n < table_.ColumnsCount) + assert(column_n >= 0 and column_n < table_.ColumnsCount) local column = table_.Columns[column_n] column.IsUserEnabledNextFrame = enabled end @@ -44656,13 +44699,13 @@ function ImGui.TableGetColumnFlags(column_n) local g = GImGui local table_ = g.CurrentTable if not table_ then - return ImGuiTableColumnFlags.None + return 0 --[[ImGuiTableColumnFlags.None]] end if column_n < 0 then column_n = table_.CurrentColumn end if column_n == table_.ColumnsCount then - return (table_.HoveredColumnBody == column_n) and ImGuiTableColumnFlags.IsHovered or ImGuiTableColumnFlags.None + return (table_.HoveredColumnBody == column_n) and 134217728 --[[ImGuiTableColumnFlags.IsHovered]] or 0 --[[ImGuiTableColumnFlags.None]] end return table_.Columns[column_n].Flags end @@ -44689,7 +44732,7 @@ end -- Return the resizing ID for the right-side of the given column. function ImGui.TableGetColumnResizeID(table_, column_n, instance_no) if instance_no == nil then instance_no = 0 end - IM_ASSERT(column_n >= 0 and column_n < table_.ColumnsCount) + assert(column_n >= 0 and column_n < table_.ColumnsCount) local instance_id = ImGui.TableGetInstanceID(table_, instance_no) return band(instance_id + 1 + column_n, 0xFFFFFFFF) -- FIXME: #6140: still not ideal end @@ -44722,14 +44765,14 @@ function ImGui.TableSetBgColor(target, color, column_n) local g = GImGui local table_ = g.CurrentTable IM_ASSERT_USER_ERROR_RET(table_ ~= nil, "Call should only be done while in BeginTable() scope!") - IM_ASSERT(target ~= ImGuiTableBgTarget.None) + assert(target ~= 0 --[[ImGuiTableBgTarget.None]]) - if color == IM_COL32_DISABLE then + if color == 16777216 --[[IM_COL32_DISABLE]] then color = 0 end -- We cannot draw neither the cell or row background immediately as we don't know the row height at this point in time. - if target == ImGuiTableBgTarget.CellBg then + if target == 3 --[[ImGuiTableBgTarget.CellBg]] then if table_.RowPosY1 > table_.InnerClipRect.Max.y then -- Discard return end @@ -44745,15 +44788,15 @@ function ImGui.TableSetBgColor(target, color, column_n) local cell_data = table_.RowCellData[table_.RowCellDataCurrent] cell_data.BgColor = color cell_data.Column = column_n - elseif target == ImGuiTableBgTarget.RowBg0 or target == ImGuiTableBgTarget.RowBg1 then + elseif target == 1 --[[ImGuiTableBgTarget.RowBg0]] or target == 2 --[[ImGuiTableBgTarget.RowBg1]] then if table_.RowPosY1 > table_.InnerClipRect.Max.y then -- Discard return end - IM_ASSERT(column_n == -1) - local bg_idx = (target == ImGuiTableBgTarget.RowBg1) and 1 or 0 + assert(column_n == -1) + local bg_idx = (target == 2 --[[ImGuiTableBgTarget.RowBg1]]) and 1 or 0 table_.RowBgColor[bg_idx] = color else - IM_ASSERT(false) + assert(false) end end @@ -44810,12 +44853,12 @@ end -- [Internal] Only called by TableNextRow() function ImGui.TableBeginRow(table_) local window = table_.InnerWindow - IM_ASSERT(not table_.IsInsideRow) + assert(not table_.IsInsideRow) -- New row table_.CurrentRow = table_.CurrentRow + 1 table_.CurrentColumn = -1 - table_.RowBgColor[0] = IM_COL32_DISABLE; table_.RowBgColor[1] = IM_COL32_DISABLE + table_.RowBgColor[0] = 16777216 --[[IM_COL32_DISABLE]]; table_.RowBgColor[1] = 16777216 --[[IM_COL32_DISABLE]] table_.RowCellDataCurrent = -1 table_.IsInsideRow = true @@ -44840,8 +44883,8 @@ function ImGui.TableBeginRow(table_) dc.CursorMaxPos.y = next_y1 -- Making the header BG color non-transparent will allow us to overlay it multiple times when handling smooth dragging. - if band(table_.RowFlags, ImGuiTableRowFlags.Headers) ~= 0 then - ImGui.TableSetBgColor(ImGuiTableBgTarget.RowBg0, ImGui.GetColorU32(ImGuiCol.TableHeaderBg)) + if band(table_.RowFlags, 1 --[[ImGuiTableRowFlags.Headers]]) ~= 0 then + ImGui.TableSetBgColor(1 --[[ImGuiTableBgTarget.RowBg0]], ImGui.GetColorU32(48 --[[ImGuiCol.TableHeaderBg]])) if table_.CurrentRow == 0 then table_.IsUsingHeaders = true end @@ -44855,8 +44898,8 @@ local TableEndRow_RowMin, TableEndRow_RowMax = ImVec2(), ImVec2() function ImGui.TableEndRow(table_) local g = GImGui local window = g.CurrentWindow - IM_ASSERT(window == table_.InnerWindow) - IM_ASSERT(table_.IsInsideRow) + assert(window == table_.InnerWindow) + assert(table_.IsInsideRow) if table_.CurrentColumn ~= -1 then ImGui.TableEndCell(table_) @@ -44878,7 +44921,7 @@ function ImGui.TableEndRow(table_) local unfreeze_rows_actual = (table_.CurrentRow + 1 == table_.FreezeRowsCount) local unfreeze_rows_request = (table_.CurrentRow + 1 == table_.FreezeRowsRequest) local table_instance = (table_.InstanceCurrent == 0) and table_.InstanceDataFirst or ImGui.TableGetInstanceData(table_, table_.InstanceCurrent) -- [Luau] inline common case - if band(table_.RowFlags, ImGuiTableRowFlags.Headers) ~= 0 and (table_.CurrentRow == 0 or band(table_.LastRowFlags, ImGuiTableRowFlags.Headers) ~= 0) then + if band(table_.RowFlags, 1 --[[ImGuiTableRowFlags.Headers]]) ~= 0 and (table_.CurrentRow == 0 or band(table_.LastRowFlags, 1 --[[ImGuiTableRowFlags.Headers]]) ~= 0) then table_instance.LastTopHeadersRowHeight = table_instance.LastTopHeadersRowHeight + bg_y2 - bg_y1 end @@ -44892,20 +44935,20 @@ function ImGui.TableEndRow(table_) -- Decide of background color for the row local bg_col0 = 0 local bg_col1 = 0 - if table_.RowBgColor[0] ~= IM_COL32_DISABLE then + if table_.RowBgColor[0] ~= 16777216 --[[IM_COL32_DISABLE]] then bg_col0 = table_.RowBgColor[0] - elseif band(table_.Flags, ImGuiTableFlags.RowBg) ~= 0 then - bg_col0 = ImGui.GetColorU32((band(table_.RowBgColorCounter, 1) ~= 0) and ImGuiCol.TableRowBgAlt or ImGuiCol.TableRowBg) + elseif band(table_.Flags, 64 --[[ImGuiTableFlags.RowBg]]) ~= 0 then + bg_col0 = ImGui.GetColorU32((band(table_.RowBgColorCounter, 1) ~= 0) and 52 --[[ImGuiCol.TableRowBgAlt]] or 51 --[[ImGuiCol.TableRowBg]]) end - if table_.RowBgColor[1] ~= IM_COL32_DISABLE then + if table_.RowBgColor[1] ~= 16777216 --[[IM_COL32_DISABLE]] then bg_col1 = table_.RowBgColor[1] end -- Decide of top border color local top_border_col = 0 local border_size = TABLE_BORDER_SIZE - if table_.CurrentRow > 0 and band(table_.Flags, ImGuiTableFlags.BordersInnerH) ~= 0 then - top_border_col = (band(table_.LastRowFlags, ImGuiTableRowFlags.Headers) ~= 0) and table_.BorderColorStrong or table_.BorderColorLight + if table_.CurrentRow > 0 and band(table_.Flags, 128 --[[ImGuiTableFlags.BordersInnerH]]) ~= 0 then + top_border_col = (band(table_.LastRowFlags, 1 --[[ImGuiTableRowFlags.Headers]]) ~= 0) and table_.BorderColorStrong or table_.BorderColorLight end local draw_cell_bg_color = table_.RowCellDataCurrent >= 0 @@ -44913,7 +44956,7 @@ function ImGui.TableEndRow(table_) if bor(bg_col0, bg_col1, top_border_col) ~= 0 or draw_strong_bottom_border or draw_cell_bg_color then -- In theory we could call SetWindowClipRectBeforeSetChannel() but since we know TableEndRow() is -- always followed by a change of clipping rectangle we perform the smallest overwrite possible here. - if band(table_.Flags, ImGuiTableFlags.NoClip) == 0 then + if band(table_.Flags, 1048576 --[[ImGuiTableFlags.NoClip]]) == 0 then -- [Luau] scalar copy, no temporary ImVec4 local src, dst = table_.Bg0ClipRectForDrawCmd, window.DrawList._CmdHeader.ClipRect dst.x = src.Min.x; dst.y = src.Min.y; dst.z = src.Max.x; dst.w = src.Max.y @@ -44969,7 +45012,7 @@ function ImGui.TableEndRow(table_) -- - We need to do that in TableEndRow() instead of TableBeginRow() so the list clipper can mark -- end of row and get the new cursor position. if unfreeze_rows_request then - IM_ASSERT(table_.FreezeRowsRequest > 0) + assert(table_.FreezeRowsRequest > 0) for column_n = 0, table_.ColumnsCount - 1 do table_.Columns[column_n].NavLayerCurrent = table_.NavLayer end @@ -44977,7 +45020,7 @@ function ImGui.TableEndRow(table_) table_instance.LastFrozenHeight = y0 - table_.OuterRect.Min.y if unfreeze_rows_actual then - IM_ASSERT(table_.IsUnfrozenRows == false) + assert(table_.IsUnfrozenRows == false) table_.IsUnfrozenRows = true -- BgClipRect starts as table.InnerClipRect, reduce it now and make BgClipRectForDrawCmd == BgClipRect @@ -44985,7 +45028,7 @@ function ImGui.TableEndRow(table_) table_.BgClipRect.Min.y = min_y; table_.Bg2ClipRectForDrawCmd.Min.y = min_y table_.BgClipRect.Max.y = table_.InnerClipRect.Max.y; table_.Bg2ClipRectForDrawCmd.Max.y = table_.InnerClipRect.Max.y table_.Bg2DrawChannelCurrent = table_.Bg2DrawChannelUnfrozen - IM_ASSERT(table_.Bg2ClipRectForDrawCmd.Min.y <= table_.Bg2ClipRectForDrawCmd.Max.y) + assert(table_.Bg2ClipRectForDrawCmd.Min.y <= table_.Bg2ClipRectForDrawCmd.Max.y) local row_height = table_.RowPosY2 - table_.RowPosY1 table_.RowPosY2 = table_.WorkRect.Min.y + table_.RowPosY2 - table_.OuterRect.Min.y @@ -45003,7 +45046,7 @@ function ImGui.TableEndRow(table_) end end - if band(table_.RowFlags, ImGuiTableRowFlags.Headers) == 0 then + if band(table_.RowFlags, 1 --[[ImGuiTableRowFlags.Headers]]) == 0 then table_.RowBgColorCounter = table_.RowBgColorCounter + 1 end table_.IsInsideRow = false @@ -45092,7 +45135,7 @@ function ImGui.TableBeginCell(table_, column_n) -- Start position is roughly ~~ CellRect.Min + CellPadding + Indent local start_x = column.WorkMinX - if band(column.Flags, ImGuiTableColumnFlags.IndentEnable) ~= 0 then + if band(column.Flags, 65536 --[[ImGuiTableColumnFlags.IndentEnable]]) ~= 0 then start_x = start_x + table_.RowIndentOffsetX -- ~~ += window.DC.Indent.x - table.HostIndentX, except we locked it for the row. end @@ -45122,7 +45165,7 @@ function ImGui.TableBeginCell(table_, column_n) -- Also see TablePushColumnChannel() -- [Luau] inline the SetCurrentChannel() early-out (same channel) to skip the method call local splitter = table_.DrawSplitter - if band(table_.Flags, ImGuiTableFlags.NoClip) ~= 0 then + if band(table_.Flags, 1048576 --[[ImGuiTableFlags.NoClip]]) ~= 0 then -- FIXME: if we end up drawing all borders/bg in EndTable, could remove this and just assert that channel hasn't changed. if splitter._Current ~= TABLE_DRAW_CHANNEL_NOCLIP then splitter:SetCurrentChannel(window.DrawList, TABLE_DRAW_CHANNEL_NOCLIP) @@ -45140,7 +45183,7 @@ function ImGui.TableBeginCell(table_, column_n) -- Logging if g.LogEnabled and not column.IsSkipItems then ImGui.LogRenderedText(window.DC.CursorPos, "|") - g.LogLinePosY = FLT_MAX + g.LogLinePosY = 3.4028234663853e+38 --[[FLT_MAX]] end end @@ -45158,7 +45201,7 @@ function ImGui.TableEndCell(table_) -- Report maximum position so we can infer content size per column. local cursor_max_pos = dc.CursorMaxPos local x = cursor_max_pos.x - if band(table_.RowFlags, ImGuiTableRowFlags.Headers) ~= 0 then + if band(table_.RowFlags, 1 --[[ImGuiTableRowFlags.Headers]]) ~= 0 then column.ContentMaxXHeadersUsed = mathMax(column.ContentMaxXHeadersUsed, x) -- Useful in case user submit contents in header row that is not a TableHeader() call elseif table_.IsUnfrozenRows then column.ContentMaxXUnfrozen = mathMax(column.ContentMaxXUnfrozen, x) @@ -45191,16 +45234,16 @@ end -- Maximum column content width given current layout. Use column.MinX so this value differs on a per-column basis. function ImGui.TableCalcMaxColumnWidth(table_, column_n) local column = table_.Columns[column_n] - local max_width = FLT_MAX + local max_width = 3.4028234663853e+38 --[[FLT_MAX]] local min_column_distance = table_.MinColumnWidth + table_.CellPaddingX * 2.0 + table_.CellSpacingX1 + table_.CellSpacingX2 - if band(table_.Flags, ImGuiTableFlags.ScrollX) ~= 0 then + if band(table_.Flags, 16777216 --[[ImGuiTableFlags.ScrollX]]) ~= 0 then -- Frozen columns can't reach beyond visible width else scrolling will naturally break. -- (we use DisplayOrder as within a set of multiple frozen column reordering is possible) if column.DisplayOrder < table_.FreezeColumnsRequest then max_width = (table_.InnerClipRect.Max.x - (table_.FreezeColumnsRequest - column.DisplayOrder) * min_column_distance) - column.MinX max_width = max_width - table_.OuterPaddingX - table_.CellPaddingX - table_.CellSpacingX2 end - elseif band(table_.Flags, ImGuiTableFlags.NoKeepColumnsVisible) == 0 then + elseif band(table_.Flags, 262144 --[[ImGuiTableFlags.NoKeepColumnsVisible]]) == 0 then -- If horizontal scrolling if disabled, we apply a final lossless shrinking of columns in order to make -- sure they are all visible. Because of this we also know that all of the columns will always fit in -- table.WorkRect and therefore in table.InnerRect (because ScrollX is off) @@ -45220,13 +45263,13 @@ function ImGui.TableGetColumnWidthAuto(table_, column) local content_width_body = mathMax(column.ContentMaxXFrozen, column.ContentMaxXUnfrozen) - column.WorkMinX local content_width_headers = column.ContentMaxXHeadersIdeal - column.WorkMinX local width_auto = content_width_body - if band(column.Flags, ImGuiTableColumnFlags.NoHeaderWidth) == 0 then + if band(column.Flags, 8192 --[[ImGuiTableColumnFlags.NoHeaderWidth]]) == 0 then width_auto = mathMax(width_auto, content_width_headers) end -- Non-resizable fixed columns preserve their requested width - if band(column.Flags, ImGuiTableColumnFlags.WidthFixed) ~= 0 and column.InitStretchWeightOrWidth > 0.0 then - if band(table_.Flags, ImGuiTableFlags.Resizable) == 0 or band(column.Flags, ImGuiTableColumnFlags.NoResize) ~= 0 then + if band(column.Flags, 16 --[[ImGuiTableColumnFlags.WidthFixed]]) ~= 0 and column.InitStretchWeightOrWidth > 0.0 then + if band(table_.Flags, 1 --[[ImGuiTableFlags.Resizable]]) == 0 or band(column.Flags, 32 --[[ImGuiTableColumnFlags.NoResize]]) ~= 0 then width_auto = column.InitStretchWeightOrWidth end end @@ -45238,14 +45281,14 @@ end function ImGui.TableSetColumnWidth(column_n, width) local g = GImGui local table_ = g.CurrentTable - IM_ASSERT(table_ ~= nil and table_.IsLayoutLocked == false) - IM_ASSERT(column_n >= 0 and column_n < table_.ColumnsCount) + assert(table_ ~= nil and table_.IsLayoutLocked == false) + assert(column_n >= 0 and column_n < table_.ColumnsCount) local column_0 = table_.Columns[column_n] local column_0_width = width -- Apply constraints early -- Compare both requested and actual given width to avoid overwriting requested width when column is stuck (minimum size, bounded) - IM_ASSERT(table_.MinColumnWidth > 0.0) + assert(table_.MinColumnWidth > 0.0) local min_width = table_.MinColumnWidth local max_width = mathMax(min_width, column_0.WidthMax) -- Don't use TableCalcMaxColumnWidth() here as it would rely on MinX from last instance (#7933) column_0_width = ImClamp(column_0_width, min_width, max_width) @@ -45290,7 +45333,7 @@ function ImGui.TableSetColumnWidth(column_n, width) -- If we have all Fixed columns OR resizing a Fixed column that doesn't come after a Stretch one, we can do an offsetting resize. -- This is the preferred resize path - if band(column_0.Flags, ImGuiTableColumnFlags.WidthFixed) ~= 0 then + if band(column_0.Flags, 16 --[[ImGuiTableColumnFlags.WidthFixed]]) ~= 0 then if not column_1 or table_.LeftMostStretchedColumn == -1 or table_.Columns[table_.LeftMostStretchedColumn].DisplayOrder >= column_0.DisplayOrder then column_0.WidthRequest = column_0_width table_.IsSettingsDirty = true @@ -45310,10 +45353,10 @@ function ImGui.TableSetColumnWidth(column_n, width) -- (old_a + old_b == new_a + new_b) --> (new_a == old_a + old_b - new_b) local column_1_width = mathMax(column_1.WidthRequest - (column_0_width - column_0.WidthRequest), min_width) column_0_width = column_0.WidthRequest + column_1.WidthRequest - column_1_width - IM_ASSERT(column_0_width > 0.0 and column_1_width > 0.0) + assert(column_0_width > 0.0 and column_1_width > 0.0) column_0.WidthRequest = column_0_width column_1.WidthRequest = column_1_width - if band(bor(column_0.Flags, column_1.Flags), ImGuiTableColumnFlags.WidthStretch) ~= 0 then + if band(bor(column_0.Flags, column_1.Flags), 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0 then ImGui.TableUpdateColumnsWeightFromWidth(table_) end table_.IsSettingsDirty = true @@ -45334,7 +45377,7 @@ end function ImGui.TableSetColumnWidthAutoAll(table_) for column_n = 0, table_.ColumnsCount - 1 do local column = table_.Columns[column_n] - if column.IsEnabled or band(column.Flags, ImGuiTableColumnFlags.WidthStretch) ~= 0 then -- Cannot reset weight of hidden stretch column + if column.IsEnabled or band(column.Flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0 then -- Cannot reset weight of hidden stretch column column.CannotSkipItemsQueue = lshift(1, 0) column.AutoFitQueue = lshift(1, 1) end @@ -45342,27 +45385,27 @@ function ImGui.TableSetColumnWidthAutoAll(table_) end function ImGui.TableUpdateColumnsWeightFromWidth(table_) - IM_ASSERT(table_.LeftMostStretchedColumn ~= -1 and table_.RightMostStretchedColumn ~= -1) + assert(table_.LeftMostStretchedColumn ~= -1 and table_.RightMostStretchedColumn ~= -1) -- Measure existing quantities local visible_weight = 0.0 local visible_width = 0.0 for column_n = 0, table_.ColumnsCount - 1 do local column = table_.Columns[column_n] - if column.IsEnabled and band(column.Flags, ImGuiTableColumnFlags.WidthStretch) ~= 0 then - IM_ASSERT(column.StretchWeight > 0.0) + if column.IsEnabled and band(column.Flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0 then + assert(column.StretchWeight > 0.0) visible_weight = visible_weight + column.StretchWeight visible_width = visible_width + column.WidthRequest end end - IM_ASSERT(visible_weight > 0.0 and visible_width > 0.0) + assert(visible_weight > 0.0 and visible_width > 0.0) -- Apply new weights for column_n = 0, table_.ColumnsCount - 1 do local column = table_.Columns[column_n] - if column.IsEnabled and band(column.Flags, ImGuiTableColumnFlags.WidthStretch) ~= 0 then + if column.IsEnabled and band(column.Flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0 then column.StretchWeight = (column.WidthRequest / visible_width) * visible_weight - IM_ASSERT(column.StretchWeight > 0.0) + assert(column.StretchWeight > 0.0) end end end @@ -45412,7 +45455,7 @@ function ImGui.TablePushColumnChannel(column_n) local table_ = g.CurrentTable -- Optimization: avoid SetCurrentChannel() + PushClipRect() - if band(table_.Flags, ImGuiTableFlags.NoClip) ~= 0 then + if band(table_.Flags, 1048576 --[[ImGuiTableFlags.NoClip]]) ~= 0 then return end local window = g.CurrentWindow @@ -45426,7 +45469,7 @@ function ImGui.TablePopColumnChannel() local table_ = g.CurrentTable -- Optimization: avoid PopClipRect() + SetCurrentChannel() - if band(table_.Flags, ImGuiTableFlags.NoClip) ~= 0 or (table_.CurrentColumn == -1) then -- Calling TreePop() after TableNextRow() is supported. + if band(table_.Flags, 1048576 --[[ImGuiTableFlags.NoClip]]) ~= 0 or (table_.CurrentColumn == -1) then -- Calling TreePop() after TableNextRow() is supported. return end local window = g.CurrentWindow @@ -45453,7 +45496,7 @@ end -- Where D is 1 if any column is clipped or hidden (dummy channel) otherwise 0. function ImGui.TableSetupDrawChannels(table_) local freeze_row_multiplier = (table_.FreezeRowsCount > 0) and 2 or 1 - local channels_for_row = (band(table_.Flags, ImGuiTableFlags.NoClip) ~= 0) and 1 or table_.ColumnsEnabledCount + local channels_for_row = (band(table_.Flags, 1048576 --[[ImGuiTableFlags.NoClip]]) ~= 0) and 1 or table_.ColumnsEnabledCount local channels_for_bg = 1 + 1 * freeze_row_multiplier local masks_differ = false for n = 0, table_.ColumnsCount - 1 do @@ -45475,7 +45518,7 @@ function ImGui.TableSetupDrawChannels(table_) if column.IsVisibleX and column.IsVisibleY then column.DrawChannelFrozen = draw_channel_current column.DrawChannelUnfrozen = draw_channel_current + ((table_.FreezeRowsCount > 0) and (channels_for_row + 1) or 0) - if band(table_.Flags, ImGuiTableFlags.NoClip) == 0 then + if band(table_.Flags, 1048576 --[[ImGuiTableFlags.NoClip]]) == 0 then draw_channel_current = draw_channel_current + 1 end else @@ -45491,7 +45534,7 @@ function ImGui.TableSetupDrawChannels(table_) ImRect_Copy(table_.BgClipRect, table_.InnerClipRect) ImRect_Copy(table_.Bg0ClipRectForDrawCmd, table_.OuterWindow.ClipRect) ImRect_Copy(table_.Bg2ClipRectForDrawCmd, table_.HostClipRect) - IM_ASSERT(table_.BgClipRect.Min.y <= table_.BgClipRect.Max.y) + assert(table_.BgClipRect.Min.y <= table_.BgClipRect.Max.y) end -- This function reorder draw channels based on matching clip rectangle, to facilitate merging them. Called by EndTable(). @@ -45535,7 +45578,7 @@ function ImGui.TableMergeDrawChannels(table_) local channels = splitter._Channels.Data local has_freeze_v = (table_.FreezeRowsCount > 0) local has_freeze_h = (table_.FreezeColumnsCount > 0) - IM_ASSERT(splitter._Current == 0) + assert(splitter._Current == 0) -- Track which groups we are going to attempt to merge, and which channels goes into each group. local merge_group_mask = 0x00 @@ -45574,7 +45617,7 @@ function ImGui.TableMergeDrawChannels(table_) -- Find out the width of this merge group and check if it will fit in our column -- (note that we assume that rendering didn't stray on the left direction. we should need a CursorMinPos to detect it) - if band(column.Flags, ImGuiTableColumnFlags.NoClip) == 0 then + if band(column.Flags, 256 --[[ImGuiTableColumnFlags.NoClip]]) == 0 then local content_max_x if not has_freeze_v then content_max_x = mathMax(column.ContentMaxXUnfrozen, column.ContentMaxXHeadersUsed) -- No row freeze @@ -45589,11 +45632,11 @@ function ImGui.TableMergeDrawChannels(table_) end local merge_group_n = ((has_freeze_h and column_n < table_.FreezeColumnsCount) and 0 or 1) + ((has_freeze_v and merge_group_sub_n == 0) and 0 or 2) - IM_ASSERT(channel_no < max_draw_channels) + assert(channel_no < max_draw_channels) local merge_group = merge_groups[merge_group_n] if merge_group.ChannelsCount == 0 then local gcr = merge_group.ClipRect -- [Luau] in place (merge_groups are local to this call) - gcr.Min.x = FLT_MAX; gcr.Min.y = FLT_MAX; gcr.Max.x = -FLT_MAX; gcr.Max.y = -FLT_MAX + gcr.Min.x = 3.4028234663853e+38 --[[FLT_MAX]]; gcr.Min.y = 3.4028234663853e+38 --[[FLT_MAX]]; gcr.Max.x = -3.4028234663853e+38 --[[FLT_MAX]]; gcr.Max.y = -3.4028234663853e+38 --[[FLT_MAX]] end merge_group.ChannelsMask[channel_no] = true merge_group.ChannelsCount = merge_group.ChannelsCount + 1 @@ -45624,7 +45667,7 @@ function ImGui.TableMergeDrawChannels(table_) remaining_mask[n] = true end remaining_mask[table_.Bg2DrawChannelUnfrozen] = nil - IM_ASSERT(has_freeze_v == false or table_.Bg2DrawChannelUnfrozen ~= TABLE_DRAW_CHANNEL_BG2_FROZEN) + assert(has_freeze_v == false or table_.Bg2DrawChannelUnfrozen ~= TABLE_DRAW_CHANNEL_BG2_FROZEN) local remaining_count = splitter._Count - (has_freeze_v and (LEADING_DRAW_CHANNELS + 1) or LEADING_DRAW_CHANNELS) --local host_rect = (table.InnerWindow == table.OuterWindow) and table.InnerClipRect or table.HostClipRect local host_rect = table_.HostClipRect @@ -45650,7 +45693,7 @@ function ImGui.TableMergeDrawChannels(table_) if band(merge_group_n, 1) ~= 0 then merge_clip_rect.Max.x = mathMax(merge_clip_rect.Max.x, host_rect.Max.x) end - if band(merge_group_n, 2) ~= 0 and band(table_.Flags, ImGuiTableFlags.NoHostExtendY) == 0 then + if band(merge_group_n, 2) ~= 0 and band(table_.Flags, 131072 --[[ImGuiTableFlags.NoHostExtendY]]) == 0 then merge_clip_rect.Max.y = mathMax(merge_clip_rect.Max.y, host_rect.Max.y) end --ImGui.GetForegroundDrawList():AddRect(merge_group.ClipRect.Min, merge_group.ClipRect.Max, IM_COL32(255, 0, 0, 200), 0.0, 0, 1.0) -- [DEBUG] @@ -45668,7 +45711,7 @@ function ImGui.TableMergeDrawChannels(table_) merge_channels_count = merge_channels_count - 1 local channel = channels[n + 1] - IM_ASSERT(channel._CmdBuffer.Size == 1) + assert(channel._CmdBuffer.Size == 1) local dst = channel._CmdBuffer.Data[1].ClipRect -- [Luau] scalar copy, no temporary ImVec4 dst.x = merge_clip_rect.Min.x; dst.y = merge_clip_rect.Min.y; dst.z = merge_clip_rect.Max.x; dst.w = merge_clip_rect.Max.y dst_tmp[#dst_tmp + 1] = channel @@ -45692,7 +45735,7 @@ function ImGui.TableMergeDrawChannels(table_) end n = n + 1 end - IM_ASSERT(#dst_tmp == splitter._Count - LEADING_DRAW_CHANNELS) + assert(#dst_tmp == splitter._Count - LEADING_DRAW_CHANNELS) for i = 1, #dst_tmp do channels[LEADING_DRAW_CHANNELS + i] = dst_tmp[i] end @@ -45705,9 +45748,9 @@ local function TableGetColumnBorderCol(table_, order_n, column_n) local is_resized = (table_.ResizedColumn == column_n) and (table_.InstanceInteracted == table_.InstanceCurrent) local is_frozen_separator = (table_.FreezeColumnsCount == order_n + 1) if is_resized or is_hovered then - return ImGui.GetColorU32(is_resized and ImGuiCol.SeparatorActive or ImGuiCol.SeparatorHovered) + return ImGui.GetColorU32(is_resized and 30 --[[ImGuiCol.SeparatorActive]] or 29 --[[ImGuiCol.SeparatorHovered]]) end - if is_frozen_separator or band(table_.Flags, bor(ImGuiTableFlags.NoBordersInBody, ImGuiTableFlags.NoBordersInBodyUntilResize)) ~= 0 then + if is_frozen_separator or band(table_.Flags, bor(2048 --[[ImGuiTableFlags.NoBordersInBody]], 4096 --[[ImGuiTableFlags.NoBordersInBodyUntilResize]])) ~= 0 then return table_.BorderColorStrong end return table_.BorderColorLight @@ -45727,10 +45770,10 @@ function ImGui.TableDrawBorders(table_) -- Draw inner border and resizing feedback local table_instance = ImGui.TableGetInstanceData(table_, table_.InstanceCurrent) local border_size = TABLE_BORDER_SIZE - local draw_y1 = mathMax(table_.InnerRect.Min.y, ((table_.FreezeRowsCount >= 1) and table_.InnerRect.Min.y or table_.WorkRect.Min.y) + table_.AngledHeadersHeight) + ((band(table_.Flags, ImGuiTableFlags.BordersOuterH) ~= 0) and border_size or 0.0) + local draw_y1 = mathMax(table_.InnerRect.Min.y, ((table_.FreezeRowsCount >= 1) and table_.InnerRect.Min.y or table_.WorkRect.Min.y) + table_.AngledHeadersHeight) + ((band(table_.Flags, 256 --[[ImGuiTableFlags.BordersOuterH]]) ~= 0) and border_size or 0.0) local draw_y2_body = table_.InnerRect.Max.y local draw_y2_head = table_.IsUsingHeaders and mathMin(table_.InnerRect.Max.y, ((table_.FreezeRowsCount >= 1) and table_.InnerRect.Min.y or table_.WorkRect.Min.y) + table_instance.LastTopHeadersRowHeight) or draw_y1 - if band(table_.Flags, ImGuiTableFlags.BordersInnerV) ~= 0 then + if band(table_.Flags, 512 --[[ImGuiTableFlags.BordersInnerV]]) ~= 0 then for order_n = 0, table_.ColumnsCount - 1 do repeat if not BitTest(table_.EnabledMaskByDisplayOrder, order_n) then @@ -45741,7 +45784,7 @@ function ImGui.TableDrawBorders(table_) local column = table_.Columns[column_n] local is_hovered = (table_.HoveredColumnBorder == column_n) local is_resized = (table_.ResizedColumn == column_n) and (table_.InstanceInteracted == table_.InstanceCurrent) - local is_resizable = band(column.Flags, bor(ImGuiTableColumnFlags.NoResize, ImGuiTableColumnFlags.NoDirectResize_)) == 0 + local is_resizable = band(column.Flags, bor(32 --[[ImGuiTableColumnFlags.NoResize]], 1073741824 --[[ImGuiTableColumnFlags.NoDirectResize_]])) == 0 local is_frozen_separator = (table_.FreezeColumnsCount == order_n + 1) if column.MaxX > table_.InnerClipRect.Max.x and not is_resized then break @@ -45749,7 +45792,7 @@ function ImGui.TableDrawBorders(table_) -- Decide whether right-most column is visible if column.NextEnabledColumn == -1 and not is_resizable then - if band(table_.Flags, ImGuiTableFlags.SizingMask_) ~= ImGuiTableFlags.SizingFixedSame or band(table_.Flags, ImGuiTableFlags.NoHostExtendX) ~= 0 then + if band(table_.Flags, 57344 --[[ImGuiTableFlags.SizingMask_]]) ~= 16384 --[[ImGuiTableFlags.SizingFixedSame]] or band(table_.Flags, 65536 --[[ImGuiTableFlags.NoHostExtendX]]) ~= 0 then break end end @@ -45761,9 +45804,9 @@ function ImGui.TableDrawBorders(table_) local draw_y2 = draw_y2_head if is_frozen_separator then draw_y2 = draw_y2_body - elseif band(table_.Flags, ImGuiTableFlags.NoBordersInBodyUntilResize) ~= 0 and (is_hovered or is_resized) then + elseif band(table_.Flags, 4096 --[[ImGuiTableFlags.NoBordersInBodyUntilResize]]) ~= 0 and (is_hovered or is_resized) then draw_y2 = draw_y2_body - elseif band(table_.Flags, bor(ImGuiTableFlags.NoBordersInBodyUntilResize, ImGuiTableFlags.NoBordersInBody)) == 0 then + elseif band(table_.Flags, bor(4096 --[[ImGuiTableFlags.NoBordersInBodyUntilResize]], 2048 --[[ImGuiTableFlags.NoBordersInBody]])) == 0 then draw_y2 = draw_y2_body end if draw_y2 > draw_y1 then @@ -45775,7 +45818,7 @@ function ImGui.TableDrawBorders(table_) -- Draw outer border -- FIXME: could use AddRect or explicit VLine/HLine helper? - if band(table_.Flags, ImGuiTableFlags.BordersOuter) ~= 0 then + if band(table_.Flags, 1280 --[[ImGuiTableFlags.BordersOuter]]) ~= 0 then -- Display outer border offset by 1 which is a simple way to display it without adding an extra draw call -- (Without the offset, in outer_window it would be rendered behind cells, because child windows are above their -- parent. In inner_window, it won't reach out over scrollbars. Another weird solution would be to display part @@ -45783,19 +45826,19 @@ function ImGui.TableDrawBorders(table_) -- Either solution currently won't allow us to use a larger border size: the border would clipped. local outer_border = table_.OuterRect local outer_col = table_.BorderColorStrong - if band(table_.Flags, ImGuiTableFlags.BordersOuter) == ImGuiTableFlags.BordersOuter then + if band(table_.Flags, 1280 --[[ImGuiTableFlags.BordersOuter]]) == 1280 --[[ImGuiTableFlags.BordersOuter]] then inner_drawlist:AddRect(outer_border.Min, outer_border.Max, outer_col, 0.0, border_size) - elseif band(table_.Flags, ImGuiTableFlags.BordersOuterV) ~= 0 then + elseif band(table_.Flags, 1024 --[[ImGuiTableFlags.BordersOuterV]]) ~= 0 then inner_drawlist:AddLineV(outer_border.Min.x, outer_border.Min.y, outer_border.Max.y, outer_col, border_size) inner_drawlist:AddLineV(outer_border.Max.x - border_size, outer_border.Min.y, outer_border.Max.y, outer_col, border_size) - elseif band(table_.Flags, ImGuiTableFlags.BordersOuterH) ~= 0 then + elseif band(table_.Flags, 256 --[[ImGuiTableFlags.BordersOuterH]]) ~= 0 then inner_drawlist:AddLineH(outer_border.Min.x, outer_border.Max.x, outer_border.Min.y, outer_col, border_size) inner_drawlist:AddLineH(outer_border.Min.x, outer_border.Max.x, outer_border.Max.y - border_size, outer_col, border_size) end end - if band(table_.Flags, ImGuiTableFlags.BordersInnerH) ~= 0 and table_.RowPosY2 < table_.OuterRect.Max.y then + if band(table_.Flags, 128 --[[ImGuiTableFlags.BordersInnerH]]) ~= 0 and table_.RowPosY2 < table_.OuterRect.Max.y then -- Draw bottom-most row border between it is above outer border. - local h_inset = (band(table_.Flags, ImGuiTableFlags.BordersOuterV) ~= 0) and border_size or 0.0 + local h_inset = (band(table_.Flags, 1024 --[[ImGuiTableFlags.BordersOuterV]]) ~= 0) and border_size or 0.0 local border_y = table_.RowPosY2 if border_y >= table_.BgClipRect.Min.y and border_y < table_.BgClipRect.Max.y then inner_drawlist:AddLineH(table_.BorderX1 + h_inset, table_.BorderX2 - h_inset, border_y, table_.BorderColorLight, border_size) @@ -45825,7 +45868,7 @@ end function ImGui.TableGetSortSpecs() local g = GImGui local table_ = g.CurrentTable - if table_ == nil or band(table_.Flags, ImGuiTableFlags.Sortable) == 0 then + if table_ == nil or band(table_.Flags, 8 --[[ImGuiTableFlags.Sortable]]) == 0 then return nil end @@ -45839,7 +45882,7 @@ function ImGui.TableGetSortSpecs() end local function TableGetColumnAvailSortDirection(column, n) - IM_ASSERT(n < column.SortDirectionsAvailCount) + assert(n < column.SortDirectionsAvailCount) return band(rshift(column.SortDirectionsAvailList, lshift(n, 1)), 0x03) end @@ -45856,7 +45899,7 @@ end -- - If the PreferSortDescending flag is set, we will default to a Descending direction on the first click. -- - Note that the PreferSortAscending flag is never checked, it is essentially the default and therefore a no-op. function ImGui.TableGetColumnNextSortDirection(column) - IM_ASSERT(column.SortDirectionsAvailCount > 0) + assert(column.SortDirectionsAvailCount > 0) if column.SortOrder == -1 then return TableGetColumnAvailSortDirection(column, 0) end @@ -45865,8 +45908,8 @@ function ImGui.TableGetColumnNextSortDirection(column) return TableGetColumnAvailSortDirection(column, (n + 1) % column.SortDirectionsAvailCount) end end - IM_ASSERT(false) - return ImGuiSortDirection.None + assert(false) + return 0 --[[ImGuiSortDirection.None]] end -- Note that the NoSortAscending/NoSortDescending flags are processed in TableSortSpecsSanitize(), and they may change/revert @@ -45875,11 +45918,11 @@ function ImGui.TableSetColumnSortDirection(column_n, sort_direction, append_to_s local g = GImGui local table_ = g.CurrentTable - if band(table_.Flags, ImGuiTableFlags.SortMulti) == 0 then + if band(table_.Flags, 67108864 --[[ImGuiTableFlags.SortMulti]]) == 0 then append_to_sort_specs = false end - if band(table_.Flags, ImGuiTableFlags.SortTristate) == 0 then - IM_ASSERT(sort_direction ~= ImGuiSortDirection.None) + if band(table_.Flags, 134217728 --[[ImGuiTableFlags.SortTristate]]) == 0 then + assert(sort_direction ~= 0 --[[ImGuiSortDirection.None]]) end local sort_order_max = 0 @@ -45891,7 +45934,7 @@ function ImGui.TableSetColumnSortDirection(column_n, sort_direction, append_to_s local column = table_.Columns[column_n] column.SortDirection = sort_direction - if column.SortDirection == ImGuiSortDirection.None then + if column.SortDirection == 0 --[[ImGuiSortDirection.None]] then column.SortOrder = -1 elseif column.SortOrder == -1 or not append_to_sort_specs then column.SortOrder = append_to_sort_specs and (sort_order_max + 1) or 0 @@ -45909,7 +45952,7 @@ function ImGui.TableSetColumnSortDirection(column_n, sort_direction, append_to_s end function ImGui.TableSortSpecsSanitize(table_) - IM_ASSERT(band(table_.Flags, ImGuiTableFlags.Sortable) ~= 0) + assert(band(table_.Flags, 8 --[[ImGuiTableFlags.Sortable]]) ~= 0) -- Clear SortOrder from hidden column and verify that there's no gap or duplicate. local sort_order_count = 0 @@ -45924,7 +45967,7 @@ function ImGui.TableSortSpecsSanitize(table_) sort_order_count = sort_order_count + 1 if sort_order_set[column.SortOrder] then sort_order_dup = true end sort_order_set[column.SortOrder] = true - IM_ASSERT(sort_order_count < 64) + assert(sort_order_count < 64) end end @@ -45933,7 +45976,7 @@ function ImGui.TableSortSpecsSanitize(table_) for n = 0, sort_order_count - 1 do if not sort_order_set[n] then need_fix_linearize = true end end - local need_fix_single_sort_order = (sort_order_count > 1) and band(table_.Flags, ImGuiTableFlags.SortMulti) == 0 + local need_fix_single_sort_order = (sort_order_count > 1) and band(table_.Flags, 67108864 --[[ImGuiTableFlags.SortMulti]]) == 0 if need_fix_linearize or need_fix_single_sort_order then local fixed_mask = {} for sort_n = 0, sort_order_count - 1 do @@ -45947,7 +45990,7 @@ function ImGui.TableSortSpecsSanitize(table_) end end end - IM_ASSERT(column_with_smallest_sort_order ~= -1) + assert(column_with_smallest_sort_order ~= -1) fixed_mask[column_with_smallest_sort_order] = true table_.Columns[column_with_smallest_sort_order].SortOrder = sort_n @@ -45965,10 +46008,10 @@ function ImGui.TableSortSpecsSanitize(table_) end -- Fallback default sort order (if no column with the ImGuiTableColumnFlags.DefaultSort flag) - if sort_order_count == 0 and band(table_.Flags, ImGuiTableFlags.SortTristate) == 0 then + if sort_order_count == 0 and band(table_.Flags, 134217728 --[[ImGuiTableFlags.SortTristate]]) == 0 then for column_n = 0, table_.ColumnsCount - 1 do local column = table_.Columns[column_n] - if column.IsEnabled and band(column.Flags, ImGuiTableColumnFlags.NoSort) == 0 then + if column.IsEnabled and band(column.Flags, 512 --[[ImGuiTableColumnFlags.NoSort]]) == 0 then sort_order_count = 1 column.SortOrder = 0 column.SortDirection = TableGetColumnAvailSortDirection(column, 0) @@ -46007,7 +46050,7 @@ function ImGui.TableSortSpecsBuild(table_) for column_n = 0, table_.ColumnsCount - 1 do local column = table_.Columns[column_n] if column.SortOrder ~= -1 then - IM_ASSERT(column.SortOrder < table_.SortSpecsCount) + assert(column.SortOrder < table_.SortSpecsCount) local sort_spec = sort_specs[column.SortOrder + 1] sort_spec.ColumnUserID = column.UserData sort_spec.ColumnIndex = column_n @@ -46042,7 +46085,7 @@ function ImGui.TableGetHeaderRowHeight() local row_height = g.FontSize for column_n = 0, table_.ColumnsCount - 1 do if BitTest(table_.EnabledMaskByIndex, column_n) then - if band(table_.Columns[column_n].Flags, ImGuiTableColumnFlags.NoHeaderLabel) == 0 then + if band(table_.Columns[column_n].Flags, 4096 --[[ImGuiTableColumnFlags.NoHeaderLabel]]) == 0 then row_height = mathMax(row_height, ImGui.CalcTextSize(ImGui.TableGetColumnName(table_, column_n)).y) end end @@ -46056,7 +46099,7 @@ function ImGui.TableGetHeaderAngledMaxLabelWidth() local width = 0.0 for column_n = 0, table_.ColumnsCount - 1 do if BitTest(table_.EnabledMaskByIndex, column_n) then - if band(table_.Columns[column_n].Flags, ImGuiTableColumnFlags.AngledHeader) ~= 0 then + if band(table_.Columns[column_n].Flags, 262144 --[[ImGuiTableColumnFlags.AngledHeader]]) ~= 0 then width = mathMax(width, ImGui.CalcTextSize(ImGui.TableGetColumnName(table_, column_n), nil, true).x) end end @@ -46084,7 +46127,7 @@ function ImGui.TableHeadersRow() -- Open row local row_height = ImGui.TableGetHeaderRowHeight() - ImGui.TableNextRow(ImGuiTableRowFlags.Headers, row_height) + ImGui.TableNextRow(1 --[[ImGuiTableRowFlags.Headers]], row_height) local row_y1 = ImGui.GetCursorScreenPos().y if table_.HostSkipItems then -- Merely an optimization, you may skip in your own code. return @@ -46094,7 +46137,7 @@ function ImGui.TableHeadersRow() for column_n = 0, columns_count - 1 do if ImGui.TableSetColumnIndex(column_n) or table_.LastHeldHeaderColumn == column_n then -- Push an id to allow empty/unnamed headers. This is also idiomatic as it ensure there is a consistent ID path to access columns (for e.g. automation) - local name = (band(ImGui.TableGetColumnFlags(column_n), ImGuiTableColumnFlags.NoHeaderLabel) ~= 0) and "" or ImGui.TableGetColumnName(column_n) + local name = (band(ImGui.TableGetColumnFlags(column_n), 4096 --[[ImGuiTableColumnFlags.NoHeaderLabel]]) ~= 0) and "" or ImGui.TableGetColumnName(column_n) ImGui.PushID(column_n) ImGui.TableHeader(name) ImGui.PopID() @@ -46122,7 +46165,7 @@ function ImGui.TableHeader(label) local table_ = g.CurrentTable IM_ASSERT_USER_ERROR_RET(table_ ~= nil, "Call should only be done while in BeginTable() scope!") - IM_ASSERT(table_.CurrentColumn ~= -1) + assert(table_.CurrentColumn ~= -1) local column_n = table_.CurrentColumn local column = table_.Columns[column_n] @@ -46148,7 +46191,7 @@ function ImGui.TableHeader(label) local sort_arrow = false local sort_order_suf = "" local ARROW_SCALE = 0.65 - if band(table_.Flags, ImGuiTableFlags.Sortable) ~= 0 and band(column.Flags, ImGuiTableColumnFlags.NoSort) == 0 then + if band(table_.Flags, 8 --[[ImGuiTableFlags.Sortable]]) ~= 0 and band(column.Flags, 512 --[[ImGuiTableColumnFlags.NoSort]]) == 0 then w_arrow = ImTrunc(g.FontSize * ARROW_SCALE + g.Style.FramePadding.x) if column.SortOrder ~= -1 then sort_arrow = true @@ -46177,18 +46220,18 @@ function ImGui.TableHeader(label) -- Using AllowOverlap mode because we cover the whole cell, and we want user to be able to submit subsequent items. local highlight = (table_.HighlightColumnHeader == column_n) - local pressed, hovered, held = ImGui.ButtonBehavior(bb, id, ImGuiButtonFlags.AllowOverlap) + local pressed, hovered, held = ImGui.ButtonBehavior(bb, id, 4096 --[[ImGuiButtonFlags.AllowOverlap]]) if held or hovered or highlight then - local col = ImGui.GetColorU32(held and ImGuiCol.HeaderActive or (hovered and ImGuiCol.HeaderHovered or ImGuiCol.Header)) + local col = ImGui.GetColorU32(held and 27 --[[ImGuiCol.HeaderActive]] or (hovered and 26 --[[ImGuiCol.HeaderHovered]] or 25 --[[ImGuiCol.Header]])) --RenderFrame(bb.Min, bb.Max, col, false, 0.0) - ImGui.TableSetBgColor(ImGuiTableBgTarget.CellBg, col, table_.CurrentColumn) + ImGui.TableSetBgColor(3 --[[ImGuiTableBgTarget.CellBg]], col, table_.CurrentColumn) else -- Submit single cell bg color in the case we didn't submit a full header row - if band(table_.RowFlags, ImGuiTableRowFlags.Headers) == 0 then - ImGui.TableSetBgColor(ImGuiTableBgTarget.CellBg, ImGui.GetColorU32(ImGuiCol.TableHeaderBg), table_.CurrentColumn) + if band(table_.RowFlags, 1 --[[ImGuiTableRowFlags.Headers]]) == 0 then + ImGui.TableSetBgColor(3 --[[ImGuiTableBgTarget.CellBg]], ImGui.GetColorU32(48 --[[ImGuiCol.TableHeaderBg]]), table_.CurrentColumn) end end - ImGui.RenderNavCursor(bb, id, ImGuiNavRenderCursorFlags.Compact, 0.0) + ImGui.RenderNavCursor(bb, id, 2 --[[ImGuiNavRenderCursorFlags.Compact]], 0.0) if held then table_.HeldHeaderColumn = column_n end @@ -46196,7 +46239,7 @@ function ImGui.TableHeader(label) -- Drag and drop to re-order columns. -- FIXME-TABLE: Scroll request while reordering a column and it lands out of the scrolling zone. - if held and band(table_.Flags, ImGuiTableFlags.Reorderable) ~= 0 and ImGui.IsMouseDragging(0) and not g.DragDropActive then + if held and band(table_.Flags, 2 --[[ImGuiTableFlags.Reorderable]]) ~= 0 and ImGui.IsMouseDragging(0) and not g.DragDropActive then -- - While moving a column it will jump on the other side of the mouse, so we also test for MouseDelta.x -- - We need to handle reordering across hidden columns. -- In the configuration below, moving C to the right of E will lead to: @@ -46222,17 +46265,17 @@ function ImGui.TableHeader(label) -- - Only clip label for a visible arrow. Auto-fit still accounts for a possible arrow, but when -- manually sized smaller we don't clip the label for the sake of an arrow that isn't displayed. local ellipsis_max = mathMax(cell_x2 - (sort_arrow and (w_arrow + w_sort_text) or 0.0), label_pos.x) - if band(table_.Flags, ImGuiTableFlags.Sortable) ~= 0 and band(column.Flags, ImGuiTableColumnFlags.NoSort) == 0 then + if band(table_.Flags, 8 --[[ImGuiTableFlags.Sortable]]) ~= 0 and band(column.Flags, 512 --[[ImGuiTableColumnFlags.NoSort]]) == 0 then if column.SortOrder ~= -1 then local x = mathMax(cell_x1, cell_x2 - w_arrow - w_sort_text) local y = label_pos.y if column.SortOrder > 0 then - ImGui.PushStyleColor(ImGuiCol.Text, ImGui.GetColorU32(ImGuiCol.Text, 0.70)) + ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], ImGui.GetColorU32(0 --[[ImGuiCol.Text]], 0.70)) ImGui.RenderText(ImVec2(x + g.Style.ItemInnerSpacing.x, y), sort_order_suf) ImGui.PopStyleColor() x = x + w_sort_text end - ImGui.RenderArrow(window.DrawList, ImVec2(x, y), ImGui.GetColorU32(ImGuiCol.Text), (column.SortDirection == ImGuiSortDirection.Ascending) and ImGuiDir.Up or ImGuiDir.Down, ARROW_SCALE) + ImGui.RenderArrow(window.DrawList, ImVec2(x, y), ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), (column.SortDirection == 1 --[[ImGuiSortDirection.Ascending]]) and 2 --[[ImGuiDir.Up]] or 3 --[[ImGuiDir.Down]], ARROW_SCALE) end -- Handle clicking on column header to adjust Sort Order @@ -46253,7 +46296,7 @@ function ImGui.TableHeader(label) end -- We don't use BeginPopupContextItem() because we want the popup to stay up even after the column is hidden - if ImGui.IsPopupOpenRequestForItem(ImGuiPopupFlags.None, id) then + if ImGui.IsPopupOpenRequestForItem(0 --[[ImGuiPopupFlags.None]], id) then ImGui.TableOpenContextMenu(column_n) end end @@ -46277,14 +46320,14 @@ function ImGui.TableAngledHeadersRow() end -- Build up request - local col_header_bg = ImGui.GetColorU32(ImGuiCol.TableHeaderBg) - local col_text = ImGui.GetColorU32(ImGuiCol.Text) + local col_header_bg = ImGui.GetColorU32(48 --[[ImGuiCol.TableHeaderBg]]) + local col_text = ImGui.GetColorU32(0 --[[ImGuiCol.Text]]) for order_n = 0, table_.ColumnsCount - 1 do if BitTest(table_.EnabledMaskByDisplayOrder, order_n) then local column_n = table_.DisplayOrderToIndex[order_n] local column = table_.Columns[column_n] - if band(column.Flags, ImGuiTableColumnFlags.AngledHeader) ~= 0 then -- Note: can't rely on ImGuiTableColumnFlags.IsVisible test here. - temp_data.AngledHeadersRequests:push_back({ Index = column_n, TextColor = col_text, BgColor0 = col_header_bg, BgColor1 = (column_n == highlight_column_n) and ImGui.GetColorU32(ImGuiCol.Header) or 0 }) + if band(column.Flags, 262144 --[[ImGuiTableColumnFlags.AngledHeader]]) ~= 0 then -- Note: can't rely on ImGuiTableColumnFlags.IsVisible test here. + temp_data.AngledHeadersRequests:push_back({ Index = column_n, TextColor = col_text, BgColor0 = col_header_bg, BgColor1 = (column_n == highlight_column_n) and ImGui.GetColorU32(25 --[[ImGuiCol.Header]]) or 0 }) end end end @@ -46313,7 +46356,7 @@ function ImGui.TableAngledHeadersRowEx(row_id, angle, max_label_width, data, dat local window = g.CurrentWindow local draw_list = window.DrawList IM_ASSERT_USER_ERROR_RET(table_ ~= nil, "Call should only be done while in BeginTable() scope!") - IM_ASSERT(table_.CurrentRow == -1, "Must be first row") + assert(table_.CurrentRow == -1, "Must be first row") if max_label_width == 0.0 then max_label_width = ImGui.TableGetHeaderAngledMaxLabelWidth() @@ -46321,11 +46364,11 @@ function ImGui.TableAngledHeadersRowEx(row_id, angle, max_label_width, data, dat -- Angle argument expressed in (-IM_PI/2 .. +IM_PI/2) as it is easier to think about for user. local flip_label = (angle < 0.0) - angle = angle - IM_PI * 0.5 + angle = angle - 3.141592653589793 --[[IM_PI]] * 0.5 local cos_a = ImCos(angle) local sin_a = ImSin(angle) - local label_cos_a = flip_label and ImCos(angle + IM_PI) or cos_a - local label_sin_a = flip_label and ImSin(angle + IM_PI) or sin_a + local label_cos_a = flip_label and ImCos(angle + 3.141592653589793 --[[IM_PI]]) or cos_a + local label_sin_a = flip_label and ImSin(angle + 3.141592653589793 --[[IM_PI]]) or sin_a local unit_right = ImVec2(cos_a, sin_a) -- Calculate our base metrics and set angled headers data _before_ the first call to TableNextRow() @@ -46338,7 +46381,7 @@ function ImGui.TableAngledHeadersRowEx(row_id, angle, max_label_width, data, dat -- Declare row, override and draw our own background -- FIXME-TABLE: Generally broken when overlapping frozen columns limit. - ImGui.TableNextRow(ImGuiTableRowFlags.Headers, row_height) + ImGui.TableNextRow(1 --[[ImGuiTableRowFlags.Headers]], row_height) ImGui.TableNextColumn() local row_r = ImRect(table_.WorkRect.Min.x, table_.BgClipRect.Min.y, table_.WorkRect.Max.x, table_.RowPosY2) table_.DrawSplitter:SetCurrentChannel(draw_list, TABLE_DRAW_CHANNEL_BG0) @@ -46346,9 +46389,9 @@ function ImGui.TableAngledHeadersRowEx(row_id, angle, max_label_width, data, dat if table_.FreezeColumnsCount > 0 then clip_rect_min_x = ImMax(clip_rect_min_x, table_.Columns[table_.DisplayOrderToIndex[table_.FreezeColumnsCount - 1]].MaxX) end - ImGui.TableSetBgColor(ImGuiTableBgTarget.RowBg0, 0) -- Cancel + ImGui.TableSetBgColor(1 --[[ImGuiTableBgTarget.RowBg0]], 0) -- Cancel ImGui.PushClipRect(table_.BgClipRect.Min, table_.BgClipRect.Max, false) -- Span all columns - draw_list:AddRectFilled(ImVec2(table_.BgClipRect.Min.x, row_r.Min.y), ImVec2(table_.BgClipRect.Max.x, row_r.Max.y), ImGui.GetColorU32(ImGuiCol.TableHeaderBg, 0.25)) -- FIXME-STYLE: Change row background with an arbitrary color. + draw_list:AddRectFilled(ImVec2(table_.BgClipRect.Min.x, row_r.Min.y), ImVec2(table_.BgClipRect.Max.x, row_r.Max.y), ImGui.GetColorU32(48 --[[ImGuiCol.TableHeaderBg]], 0.25)) -- FIXME-STYLE: Change row background with an arbitrary color. ImGui.PushClipRect(ImVec2(clip_rect_min_x, table_.BgClipRect.Min.y), table_.BgClipRect.Max, true) -- Span all columns ImGui.ButtonBehavior(row_r, row_id) @@ -46360,7 +46403,7 @@ function ImGui.TableAngledHeadersRowEx(row_id, angle, max_label_width, data, dat local align = g.Style.TableAngledHeadersTextAlign -- Draw background and labels in first pass, then all borders. - local max_x = -FLT_MAX + local max_x = -3.4028234663853e+38 --[[FLT_MAX]] for pass = 0, 1 do for order_n = 0, data_count - 1 do local request = data[order_n + 1] @@ -46409,7 +46452,7 @@ function ImGui.TableAngledHeadersRowEx(row_id, angle, max_label_width, data, dat local clip_height = ImMin(label_size.y, column.ClipRect.Max.x - column.WorkMinX - line_off_curr_x) local clip_r = ImRect(window.ClipRect.Min, window.ClipRect.Min + ImVec2(clip_width, clip_height)) local vtx_idx_begin = draw_list._VtxCurrentIdx - ImGui.PushStyleColor(ImGuiCol.Text, request.TextColor) + ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], request.TextColor) ImGui.RenderTextEllipsis(draw_list, clip_r.Min, clip_r.Max, clip_r.Max.x, line, #line + 1, label_size) ImGui.PopStyleColor() local vtx_idx_end = draw_list._VtxCurrentIdx @@ -46464,13 +46507,13 @@ function ImGui.TableOpenContextMenu(column_n) if column_n == table_.ColumnsCount then -- To facilitate using with TableGetHoveredColumn() column_n = -1 end - IM_ASSERT(column_n >= -1 and column_n < table_.ColumnsCount) - if band(table_.Flags, bor(ImGuiTableFlags.Resizable, ImGuiTableFlags.Reorderable, ImGuiTableFlags.Hideable)) ~= 0 then + assert(column_n >= -1 and column_n < table_.ColumnsCount) + if band(table_.Flags, bor(1 --[[ImGuiTableFlags.Resizable]], 2 --[[ImGuiTableFlags.Reorderable]], 4 --[[ImGuiTableFlags.Hideable]])) ~= 0 then table_.IsContextPopupOpen = true table_.ContextPopupColumn = column_n table_.InstanceInteracted = table_.InstanceCurrent local context_menu_id = ImHashStr("##ContextMenu", nil, table_.ID) - ImGui.OpenPopupEx(context_menu_id, ImGuiPopupFlags.None) + ImGui.OpenPopupEx(context_menu_id, 0 --[[ImGuiPopupFlags.None]]) end end @@ -46479,7 +46522,7 @@ function ImGui.TableBeginContextMenuPopup(table_) return false end local context_menu_id = ImHashStr("##ContextMenu", nil, table_.ID) - if ImGui.BeginPopupEx(context_menu_id, bor(ImGuiWindowFlags.AlwaysAutoResize, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoSavedSettings)) then + if ImGui.BeginPopupEx(context_menu_id, bor(64 --[[ImGuiWindowFlags.AlwaysAutoResize]], 1 --[[ImGuiWindowFlags.NoTitleBar]], 256 --[[ImGuiWindowFlags.NoSavedSettings]])) then return true end table_.IsContextPopupOpen = false @@ -46499,16 +46542,16 @@ local function MenuItemForColumnReorder(label, selected, enabled) local text_pos = ImVec2(window.DC.CursorPos.x, window.DC.CursorPos.y + window.DC.CurrLineTextBaseOffset) local id = ImGui.GetID(label) - local selectable_flags = bor(ImGuiSelectableFlags.SelectOnRelease, ImGuiSelectableFlags.SpanAvailWidth) + local selectable_flags = bor(8388608 --[[ImGuiSelectableFlags.SelectOnRelease]], 16777216 --[[ImGuiSelectableFlags.SpanAvailWidth]]) if g.ActiveId == id then - selectable_flags = bor(selectable_flags, ImGuiSelectableFlags.Highlight) -- Stays highlighted while dragging. + selectable_flags = bor(selectable_flags, 32 --[[ImGuiSelectableFlags.Highlight]]) -- Stays highlighted while dragging. end local has_been_moved = (g.ActiveId == id) and g.ActiveIdHasBeenEditedBefore -- But disable toggling once moved. ImGui.BeginDisabled(not enabled) -- Don't use ImGuiSelectableFlags.Disabled so that Check mark is also affected. local ret = ImGui.Selectable(label, false, selectable_flags, ImVec2(min_w, label_size.y)) and not has_been_moved -- Can't use IsMouseDragging(0) as button is released already. - if band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.Visible) ~= 0 and selected then - ImGui.RenderCheckMark(window.DrawList, text_pos + ImVec2(offsets.OffsetMark + stretch_w + g.FontSize * 0.40, g.FontSize * 0.134 * 0.5), ImGui.GetColorU32(ImGuiCol.Text), g.FontSize * 0.866) + if band(g.LastItemData.StatusFlags, 256 --[[ImGuiItemStatusFlags.Visible]]) ~= 0 and selected then + ImGui.RenderCheckMark(window.DrawList, text_pos + ImVec2(offsets.OffsetMark + stretch_w + g.FontSize * 0.40, g.FontSize * 0.134 * 0.5), ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), g.FontSize * 0.866) end ImGui.EndDisabled() @@ -46535,19 +46578,19 @@ function ImGui.TableDrawDefaultContextMenu(table_, flags_for_section_to_display) local context_column = (context_column_n ~= -1) and table_.Columns[context_column_n] or nil -- Sizing - if band(flags_for_section_to_display, ImGuiTableFlags.Resizable) ~= 0 then + if band(flags_for_section_to_display, 1 --[[ImGuiTableFlags.Resizable]]) ~= 0 then if context_column ~= nil then - local can_resize = band(context_column.Flags, ImGuiTableColumnFlags.NoResize) == 0 and context_column.IsEnabled - if ImGui.MenuItem(ImGui.LocalizeGetMsg(ImGuiLocKey.TableSizeOne), nil, false, can_resize) then -- "###SizeOne" + local can_resize = band(context_column.Flags, 32 --[[ImGuiTableColumnFlags.NoResize]]) == 0 and context_column.IsEnabled + if ImGui.MenuItem(ImGui.LocalizeGetMsg(2 --[[ImGuiLocKey.TableSizeOne]]), nil, false, can_resize) then -- "###SizeOne" ImGui.TableSetColumnWidthAutoSingle(table_, context_column_n) end end local size_all_desc - if table_.ColumnsEnabledFixedCount == table_.ColumnsEnabledCount and band(table_.Flags, ImGuiTableFlags.SizingMask_) ~= ImGuiTableFlags.SizingFixedSame then - size_all_desc = ImGui.LocalizeGetMsg(ImGuiLocKey.TableSizeAllFit) -- "###SizeAll" All fixed + if table_.ColumnsEnabledFixedCount == table_.ColumnsEnabledCount and band(table_.Flags, 57344 --[[ImGuiTableFlags.SizingMask_]]) ~= 16384 --[[ImGuiTableFlags.SizingFixedSame]] then + size_all_desc = ImGui.LocalizeGetMsg(3 --[[ImGuiLocKey.TableSizeAllFit]]) -- "###SizeAll" All fixed else - size_all_desc = ImGui.LocalizeGetMsg(ImGuiLocKey.TableSizeAllDefault) -- "###SizeAll" All stretch or mixed + size_all_desc = ImGui.LocalizeGetMsg(4 --[[ImGuiLocKey.TableSizeAllDefault]]) -- "###SizeAll" All stretch or mixed end if ImGui.MenuItem(size_all_desc, nil) then ImGui.TableSetColumnWidthAutoAll(table_) @@ -46556,18 +46599,18 @@ function ImGui.TableDrawDefaultContextMenu(table_, flags_for_section_to_display) end -- Reset Order/Visibility etc. - if band(flags_for_section_to_display, bor(ImGuiTableFlags.Reorderable, ImGuiTableFlags.Hideable)) ~= 0 then - if ImGui.BeginMenu(ImGui.LocalizeGetMsg(ImGuiLocKey.TableReset)) then + if band(flags_for_section_to_display, bor(2 --[[ImGuiTableFlags.Reorderable]], 4 --[[ImGuiTableFlags.Hideable]])) ~= 0 then + if ImGui.BeginMenu(ImGui.LocalizeGetMsg(5 --[[ImGuiLocKey.TableReset]])) then --if ImGui.MenuItem(ImGui.LocalizeGetMsg(ImGuiLocKey.TableResetAll)) then -- FIXME: Hiding because altering Sort Order + requesting auto-fit simultaneously has a tendency to exhibit a sizing glitch. -- table_.IsResetAllRequest = true --end - if band(flags_for_section_to_display, ImGuiTableFlags.Reorderable) ~= 0 then - if ImGui.MenuItem(ImGui.LocalizeGetMsg(ImGuiLocKey.TableResetOrder), nil, false, not table_.IsDefaultDisplayOrder) then -- PS: cannot be hidden because it would mess with drag reordering. + if band(flags_for_section_to_display, 2 --[[ImGuiTableFlags.Reorderable]]) ~= 0 then + if ImGui.MenuItem(ImGui.LocalizeGetMsg(6 --[[ImGuiLocKey.TableResetOrder]]), nil, false, not table_.IsDefaultDisplayOrder) then -- PS: cannot be hidden because it would mess with drag reordering. table_.IsResetDisplayOrderRequest = true end end - if band(flags_for_section_to_display, ImGuiTableFlags.Hideable) ~= 0 then - if ImGui.MenuItem(ImGui.LocalizeGetMsg(ImGuiLocKey.TableResetVisibility), nil, false, not table_.IsDefaultVisibility) then + if band(flags_for_section_to_display, 4 --[[ImGuiTableFlags.Hideable]]) ~= 0 then + if ImGui.MenuItem(ImGui.LocalizeGetMsg(7 --[[ImGuiLocKey.TableResetVisibility]]), nil, false, not table_.IsDefaultVisibility) then table_.IsResetVisibilityRequest = true end end @@ -46592,7 +46635,7 @@ function ImGui.TableDrawDefaultContextMenu(table_, flags_for_section_to_display) -- #endif -- Hiding / Visibility - if band(flags_for_section_to_display, ImGuiTableFlags.Hideable) ~= 0 then + if band(flags_for_section_to_display, 4 --[[ImGuiTableFlags.Hideable]]) ~= 0 then if want_separator then ImGui.Separator() end @@ -46604,18 +46647,18 @@ function ImGui.TableDrawDefaultContextMenu(table_, flags_for_section_to_display) local reorder_src_order = is_reordering and table_.Columns[table_.ReorderColumn].DisplayOrder or -1 local reorder_min_order = is_reordering and TableGetMaxDisplayOrderAllowed(table_, reorder_src_order, 0) or 0 local reorder_max_order = is_reordering and TableGetMaxDisplayOrderAllowed(table_, reorder_src_order, table_.ColumnsCount - 1) or (table_.ColumnsCount - 1) - ImGui.PushItemFlag(ImGuiItemFlags.AutoClosePopups, false) + ImGui.PushItemFlag(16 --[[ImGuiItemFlags.AutoClosePopups]], false) for order_n = 0, table_.ColumnsCount - 1 do local column_n = table_.DisplayOrderToIndex[order_n] local column = table_.Columns[column_n] - if band(column.Flags, ImGuiTableColumnFlags.Disabled) == 0 then + if band(column.Flags, 1 --[[ImGuiTableColumnFlags.Disabled]]) == 0 then local name = ImGui.TableGetColumnName(table_, column_n) if name == nil or name == "" then name = "" end -- Make sure we can't hide the last active column - local menu_item_enabled = band(column.Flags, ImGuiTableColumnFlags.NoHide) == 0 + local menu_item_enabled = band(column.Flags, 128 --[[ImGuiTableColumnFlags.NoHide]]) == 0 if column.IsUserEnabled and table_.ColumnsEnabledCount <= 1 then menu_item_enabled = false end @@ -46628,7 +46671,7 @@ function ImGui.TableDrawDefaultContextMenu(table_, flags_for_section_to_display) -- Drag to reorder -- FIXME: It is currently not possible to reorder columns marked with ImGuiTableColumnFlags.NoHide. - if ImGui.IsItemActive() and ImGui.IsMouseDragging(0) and g.ActiveIdSource == ImGuiInputSource.Mouse and band(table_.Flags, ImGuiTableFlags.Reorderable) ~= 0 then + if ImGui.IsItemActive() and ImGui.IsMouseDragging(0) and g.ActiveIdSource == 1 --[[ImGuiInputSource.Mouse]] and band(table_.Flags, 2 --[[ImGuiTableFlags.Reorderable]]) ~= 0 then g.ActiveIdHasBeenEditedBefore = true -- Disable toggle in MenuItemForColumnReorder() + start dimming to display allowed reorder targets. table_.ReorderColumn = column_n if not ImGui.IsItemHovered() then @@ -46722,7 +46765,7 @@ function ImGui.TableGetBoundSettings(table_) end local g = GImGui local settings = g.SettingsTables.Data[table_.SettingsOffset] - IM_ASSERT(settings.ID == table_.ID) + assert(settings.ID == table_.ID) return settings end @@ -46731,12 +46774,12 @@ function ImGui.TableResetSettings(table_) table_.IsInitializing = true; table_.IsSettingsDirty = true table_.IsResetAllRequest = false table_.IsSettingsRequestLoad = false -- Don't reload from ini - table_.SettingsLoadedFlags = ImGuiTableFlags.None -- Mark as nothing loaded so our initialized data becomes authoritative + table_.SettingsLoadedFlags = 0 --[[ImGuiTableFlags.None]] -- Mark as nothing loaded so our initialized data becomes authoritative end function ImGui.TableSaveSettings(table_) table_.IsSettingsDirty = false - if band(table_.Flags, ImGuiTableFlags.NoSavedSettings) ~= 0 then + if band(table_.Flags, 16 --[[ImGuiTableFlags.NoSavedSettings]]) ~= 0 then return end @@ -46753,15 +46796,15 @@ function ImGui.TableSaveSettings(table_) settings.ColumnsCount = table_.ColumnsCount -- Serialize ImGuiTable/ImGuiTableColumn into ImGuiTableSettings/ImGuiTableColumnSettings - IM_ASSERT(settings.ID == table_.ID) - IM_ASSERT(settings.ColumnsCount == table_.ColumnsCount and settings.ColumnsCountMax >= settings.ColumnsCount) + assert(settings.ID == table_.ID) + assert(settings.ColumnsCount == table_.ColumnsCount and settings.ColumnsCountMax >= settings.ColumnsCount) local save_ref_scale = false - settings.SaveFlags = ImGuiTableFlags.None + settings.SaveFlags = 0 --[[ImGuiTableFlags.None]] for n = 0, table_.ColumnsCount - 1 do local column = table_.Columns[n] local column_settings = settings.Columns[n] - local width_or_weight = (band(column.Flags, ImGuiTableColumnFlags.WidthStretch) ~= 0) and column.StretchWeight or column.WidthRequest + local width_or_weight = (band(column.Flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0) and column.StretchWeight or column.WidthRequest column_settings.ID = column.ID column_settings.WidthOrWeight = width_or_weight column_settings.Index = n @@ -46769,8 +46812,8 @@ function ImGui.TableSaveSettings(table_) column_settings.SortOrder = column.SortOrder column_settings.SortDirection = column.SortDirection column_settings.IsEnabled = column.IsUserEnabled and 1 or 0 - column_settings.IsStretch = (band(column.Flags, ImGuiTableColumnFlags.WidthStretch) ~= 0) and 1 or 0 - if band(column.Flags, ImGuiTableColumnFlags.WidthStretch) == 0 then + column_settings.IsStretch = (band(column.Flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) ~= 0) and 1 or 0 + if band(column.Flags, 8 --[[ImGuiTableColumnFlags.WidthStretch]]) == 0 then save_ref_scale = true end @@ -46778,16 +46821,16 @@ function ImGui.TableSaveSettings(table_) -- Note that fixed width where initial width was derived from auto-fit will always be saved as InitStretchWeightOrWidth will be 0.0f. -- FIXME-TABLE: We don't have logic to easily compare SortOrder to DefaultSortOrder yet so it's always saved when present. if width_or_weight ~= column.InitStretchWeightOrWidth then - settings.SaveFlags = bor(settings.SaveFlags, ImGuiTableFlags.Resizable) + settings.SaveFlags = bor(settings.SaveFlags, 1 --[[ImGuiTableFlags.Resizable]]) end if column.DisplayOrder ~= n then - settings.SaveFlags = bor(settings.SaveFlags, ImGuiTableFlags.Reorderable) + settings.SaveFlags = bor(settings.SaveFlags, 2 --[[ImGuiTableFlags.Reorderable]]) end if column.SortOrder ~= -1 then - settings.SaveFlags = bor(settings.SaveFlags, ImGuiTableFlags.Sortable, ImGuiTableFlags.Reorderable) -- Because SortOrder saving itself is gated, make sure every column is saved (#9519) + settings.SaveFlags = bor(settings.SaveFlags, 8 --[[ImGuiTableFlags.Sortable]], 2 --[[ImGuiTableFlags.Reorderable]]) -- Because SortOrder saving itself is gated, make sure every column is saved (#9519) end - if column.IsUserEnabled ~= (band(column.Flags, ImGuiTableColumnFlags.DefaultHide) == 0) then - settings.SaveFlags = bor(settings.SaveFlags, ImGuiTableFlags.Hideable) + if column.IsUserEnabled ~= (band(column.Flags, 2 --[[ImGuiTableColumnFlags.DefaultHide]]) == 0) then + settings.SaveFlags = bor(settings.SaveFlags, 4 --[[ImGuiTableFlags.Hideable]]) end end settings.SaveFlags = band(settings.SaveFlags, table_.Flags) @@ -46797,7 +46840,7 @@ function ImGui.TableSaveSettings(table_) end function ImGui.TableLoadSettings(table_) - if band(table_.Flags, ImGuiTableFlags.NoSavedSettings) ~= 0 then + if band(table_.Flags, 16 --[[ImGuiTableFlags.NoSavedSettings]]) ~= 0 then table_.IsSettingsRequestLoad = false -- Done return end @@ -46832,7 +46875,7 @@ function ImGui.TableLoadSettingsForColumns(table_) return end - table_.SettingsLoadedFlags = bor(table_.SettingsLoadedFlags, ImGuiTableFlags.Reorderable) -- We handle above in code above. + table_.SettingsLoadedFlags = bor(table_.SettingsLoadedFlags, 2 --[[ImGuiTableFlags.Reorderable]]) -- We handle above in code above. -- Serialize ImGuiTableSettings/ImGuiTableColumnSettings into ImGuiTable/ImGuiTableColumn local column_settings = settings.Columns @@ -46887,7 +46930,7 @@ end function ImGui.TableLoadSettingsForColumn(column, column_settings, load_flags) column.IsLoadedSettings = true column_settings.IsLoaded = true - if band(load_flags, ImGuiTableFlags.Resizable) ~= 0 then + if band(load_flags, 1 --[[ImGuiTableFlags.Resizable]]) ~= 0 then if column_settings.IsStretch ~= 0 then column.StretchWeight = column_settings.WidthOrWeight else @@ -46895,12 +46938,12 @@ function ImGui.TableLoadSettingsForColumn(column, column_settings, load_flags) end column.AutoFitQueue = 0x00 end - if band(load_flags, ImGuiTableFlags.Reorderable) ~= 0 then + if band(load_flags, 2 --[[ImGuiTableFlags.Reorderable]]) ~= 0 then column.DisplayOrder = column_settings.DisplayOrder else column.DisplayOrder = column_settings.Index -- Because default depends on previous Index, we need to set that up and cannot rely on TableInitColumnDefaults() end - if band(load_flags, ImGuiTableFlags.Hideable) ~= 0 and column_settings.IsEnabled ~= -1 then + if band(load_flags, 4 --[[ImGuiTableFlags.Hideable]]) ~= 0 and column_settings.IsEnabled ~= -1 then local v = (column_settings.IsEnabled == 1) column.IsUserEnabled = v; column.IsUserEnabledNextFrame = v end @@ -46910,7 +46953,7 @@ end -- Fix invalid display order data: compact values (0,1,3 -> 0,1,2); preserve relative order (0,3,1 -> 0,2,1); deduplicate (0,4,1,1 -> 0,3,1,2) function ImGui.TableFixDisplayOrder(table_) - if band(table_.Flags, ImGuiTableFlags.Reorderable) == 0 then + if band(table_.Flags, 2 --[[ImGuiTableFlags.Reorderable]]) == 0 then for n = 0, table_.ColumnsCount - 1 do table_.Columns[n].DisplayOrder = n table_.DisplayOrderToIndex[n] = n @@ -46972,7 +47015,7 @@ local function TableSettingsHandler_ReadOpen(ctx, handler, name) return nil end id = tonumber(id, 16); columns_count = tonumber(columns_count) - if columns_count <= 0 or columns_count >= IMGUI_TABLE_MAX_COLUMNS then + if columns_count <= 0 or columns_count >= 512 --[[IMGUI_TABLE_MAX_COLUMNS]] then return nil end return ImGui.TableSettingsCreate(id, columns_count) @@ -47003,16 +47046,16 @@ local function TableSettingsHandler_ReadLine(ctx, handler, settings, line) end take("UserID=0x(%x+)") -- FIXME-LEGACY: Removed 2025/11/12, was never properly set. local v = take("Width=(%-?%d+)") - if v then column.WidthOrWeight = tonumber(v); column.IsStretch = 0; settings.SaveFlags = bor(settings.SaveFlags, ImGuiTableFlags.Resizable) end + if v then column.WidthOrWeight = tonumber(v); column.IsStretch = 0; settings.SaveFlags = bor(settings.SaveFlags, 1 --[[ImGuiTableFlags.Resizable]]) end v = take("Weight=([%-%d%.eE+]+)") - if v then column.WidthOrWeight = tonumber(v); column.IsStretch = 1; settings.SaveFlags = bor(settings.SaveFlags, ImGuiTableFlags.Resizable) end + if v then column.WidthOrWeight = tonumber(v); column.IsStretch = 1; settings.SaveFlags = bor(settings.SaveFlags, 1 --[[ImGuiTableFlags.Resizable]]) end v = take("Visible=(%-?%d+)") - if v then column.IsEnabled = tonumber(v); settings.SaveFlags = bor(settings.SaveFlags, ImGuiTableFlags.Hideable) end + if v then column.IsEnabled = tonumber(v); settings.SaveFlags = bor(settings.SaveFlags, 4 --[[ImGuiTableFlags.Hideable]]) end v = take("Order=(%-?%d+)") - if v then column.DisplayOrder = tonumber(v); settings.SaveFlags = bor(settings.SaveFlags, ImGuiTableFlags.Reorderable) end + if v then column.DisplayOrder = tonumber(v); settings.SaveFlags = bor(settings.SaveFlags, 2 --[[ImGuiTableFlags.Reorderable]]) end local c v, c = take("Sort=(%-?%d+)(.)") - if v then column.SortOrder = tonumber(v); column.SortDirection = (c == "^") and ImGuiSortDirection.Descending or ImGuiSortDirection.Ascending; settings.SaveFlags = bor(settings.SaveFlags, ImGuiTableFlags.Sortable) end + if v then column.SortOrder = tonumber(v); column.SortDirection = (c == "^") and 2 --[[ImGuiSortDirection.Descending]] or 1 --[[ImGuiSortDirection.Ascending]]; settings.SaveFlags = bor(settings.SaveFlags, 8 --[[ImGuiTableFlags.Sortable]]) end v = take("ID=0x(%x+)") if v then column.ID = tonumber(v, 16) end end @@ -47024,10 +47067,10 @@ local function TableSettingsHandler_WriteAll(ctx, handler, buf) if settings.ID ~= 0 then -- Skip ditched settings -- TableSaveSettings() may clear some of those flags when we establish that the data can be stripped -- (e.g. Order was unchanged) - local save_size = band(settings.SaveFlags, ImGuiTableFlags.Resizable) ~= 0 - local save_visible = band(settings.SaveFlags, ImGuiTableFlags.Hideable) ~= 0 - local save_order = band(settings.SaveFlags, ImGuiTableFlags.Reorderable) ~= 0 - local save_sort = band(settings.SaveFlags, ImGuiTableFlags.Sortable) ~= 0 + local save_size = band(settings.SaveFlags, 1 --[[ImGuiTableFlags.Resizable]]) ~= 0 + local save_visible = band(settings.SaveFlags, 4 --[[ImGuiTableFlags.Hideable]]) ~= 0 + local save_order = band(settings.SaveFlags, 2 --[[ImGuiTableFlags.Reorderable]]) ~= 0 + local save_sort = band(settings.SaveFlags, 8 --[[ImGuiTableFlags.Sortable]]) ~= 0 -- We need to save the [Table] entry even if all the bools are false, since this records a table with "default settings". buf:appendf("[%s][0x%08X,%d]\n", handler.TypeName, settings.ID, settings.ColumnsCount) @@ -47044,7 +47087,7 @@ local function TableSettingsHandler_WriteAll(ctx, handler, buf) if save_size and column.IsStretch == 0 then buf:appendf(" Width=%d", ImTrunc(column.WidthOrWeight)) end if save_visible then buf:appendf(" Visible=%d", column.IsEnabled) end if save_order then buf:appendf(" Order=%d", column.DisplayOrder) end - if save_sort and column.SortOrder ~= -1 then buf:appendf(" Sort=%d%s", column.SortOrder, (column.SortDirection == ImGuiSortDirection.Ascending) and "v" or "^") end + if save_sort and column.SortOrder ~= -1 then buf:appendf(" Sort=%d%s", column.SortOrder, (column.SortDirection == 1 --[[ImGuiSortDirection.Ascending]]) and "v" or "^") end if column.ID ~= 0 then buf:appendf(" ID=0x%08X", column.ID) end buf:append("\n") end @@ -47099,7 +47142,7 @@ function ImGui.TableGcCompactTransientBuffers(t) --IMGUI_DEBUG_PRINT("TableGcCompactTransientBuffers() id=0x%08X\n", t.ID) local g = GImGui local table_ = t - IM_ASSERT(table_.MemoryCompacted == false) + assert(table_.MemoryCompacted == false) table_.SortSpecs.Specs = nil table.clear(table_.SortSpecsMulti) table_.IsSortSpecsDirty = true -- FIXME: In theory shouldn't have to leak into user performing a sort on resume. @@ -47178,12 +47221,12 @@ local function GetDraggedColumnOffset(columns, column_index) -- window creates a feedback loop because we store normalized positions. So while dragging we enforce absolute positioning. local g = GImGui local window = g.CurrentWindow - IM_ASSERT(column_index > 0) -- We are not supposed to drag column 0. - IM_ASSERT(g.ActiveId == band(columns.ID + column_index, 0xFFFFFFFF)) + assert(column_index > 0) -- We are not supposed to drag column 0. + assert(g.ActiveId == band(columns.ID + column_index, 0xFFFFFFFF)) local x = g.IO.MousePos.x - g.ActiveIdClickOffset.x + ImTrunc(COLUMNS_HIT_RECT_HALF_THICKNESS * g.CurrentDpiScale) - window.Pos.x x = ImMax(x, ImGui.GetColumnOffset(column_index - 1) + g.Style.ColumnsMinSpacing) - if band(columns.Flags, ImGuiOldColumnFlags.NoPreserveWidths) ~= 0 then + if band(columns.Flags, 4 --[[ImGuiOldColumnFlags.NoPreserveWidths]]) ~= 0 then x = ImMin(x, ImGui.GetColumnOffset(column_index + 1) - g.Style.ColumnsMinSpacing) end @@ -47201,7 +47244,7 @@ function ImGui.GetColumnOffset(column_index) if column_index < 0 then column_index = columns.Current end - IM_ASSERT(column_index < columns.Columns.Size) + assert(column_index < columns.Columns.Size) local t = columns.Columns.Data[column_index + 1].OffsetNorm local x_offset = ImLerp(columns.OffMinX, columns.OffMaxX, t) @@ -47243,17 +47286,17 @@ function ImGui.SetColumnOffset(column_index, offset) local g = GImGui local window = g.CurrentWindow local columns = window.DC.CurrentColumns - IM_ASSERT(columns ~= nil) + assert(columns ~= nil) if column_index < 0 then column_index = columns.Current end - IM_ASSERT(column_index < columns.Columns.Size) + assert(column_index < columns.Columns.Size) - local preserve_width = band(columns.Flags, ImGuiOldColumnFlags.NoPreserveWidths) == 0 and (column_index < columns.Count - 1) + local preserve_width = band(columns.Flags, 4 --[[ImGuiOldColumnFlags.NoPreserveWidths]]) == 0 and (column_index < columns.Count - 1) local width = preserve_width and GetColumnWidthEx(columns, column_index, columns.IsBeingResized) or 0.0 - if band(columns.Flags, ImGuiOldColumnFlags.NoForceWithinWindow) == 0 then + if band(columns.Flags, 8 --[[ImGuiOldColumnFlags.NoForceWithinWindow]]) == 0 then offset = ImMin(offset, columns.OffMaxX - g.Style.ColumnsMinSpacing * (columns.Count - column_index)) end columns.Columns.Data[column_index + 1].OffsetNorm = ImGui.GetColumnNormFromOffset(columns, offset - columns.OffMinX) @@ -47266,7 +47309,7 @@ end function ImGui.SetColumnWidth(column_index, width) local window = ImGui.GetCurrentWindowRead() local columns = window.DC.CurrentColumns - IM_ASSERT(columns ~= nil) + assert(columns ~= nil) if column_index < 0 then column_index = columns.Current @@ -47342,13 +47385,13 @@ function ImGui.BeginColumns(str_id, columns_count, flags) local g = GImGui local window = ImGui.GetCurrentWindow() - IM_ASSERT(columns_count >= 1) - IM_ASSERT(window.DC.CurrentColumns == nil) -- Nested columns are currently not supported + assert(columns_count >= 1) + assert(window.DC.CurrentColumns == nil) -- Nested columns are currently not supported -- Acquire storage for the columns set local id = ImGui.GetColumnsID(str_id, columns_count) local columns = ImGui.FindOrCreateColumns(window, id) - IM_ASSERT(columns.ID == id) + assert(columns.ID == id) columns.Current = 0 columns.Count = columns_count columns.Flags = flags @@ -47391,7 +47434,7 @@ function ImGui.BeginColumns(str_id, columns_count, flags) local column = columns.Columns.Data[n + 1] local clip_x1 = IM_ROUND(window.Pos.x + ImGui.GetColumnOffset(n)) local clip_x2 = IM_ROUND(window.Pos.x + ImGui.GetColumnOffset(n + 1) - 1.0) - column.ClipRect = ImRect(clip_x1, -FLT_MAX, clip_x2, FLT_MAX) + column.ClipRect = ImRect(clip_x1, -3.4028234663853e+38 --[[FLT_MAX]], clip_x2, 3.4028234663853e+38 --[[FLT_MAX]]) column.ClipRect:ClipWithFull(window.ClipRect) end @@ -47423,7 +47466,7 @@ function ImGui.NextColumn() if columns.Count == 1 then window.DC.CursorPos.x = IM_TRUNC(window.Pos.x + window.DC.Indent.x + window.DC.ColumnsOffset.x) - IM_ASSERT(columns.Current == 0) + assert(columns.Current == 0) return end @@ -47470,7 +47513,7 @@ function ImGui.EndColumns() local g = GImGui local window = ImGui.GetCurrentWindow() local columns = window.DC.CurrentColumns - IM_ASSERT(columns ~= nil) + assert(columns ~= nil) ImGui.PopItemWidth() if columns.Count > 1 then @@ -47481,14 +47524,14 @@ function ImGui.EndColumns() local flags = columns.Flags columns.LineMaxY = ImMax(columns.LineMaxY, window.DC.CursorPos.y) window.DC.CursorPos.y = columns.LineMaxY - if band(flags, ImGuiOldColumnFlags.GrowParentContentsSize) == 0 then + if band(flags, 16 --[[ImGuiOldColumnFlags.GrowParentContentsSize]]) == 0 then window.DC.CursorMaxPos.x = columns.HostCursorMaxPosX -- Restore cursor max pos, as columns don't grow parent end -- Draw columns borders and handle resize -- The IsBeingResized flag ensure we preserve pre-resize columns width so back-and-forth are not lossy local is_being_resized = false - if band(flags, ImGuiOldColumnFlags.NoBorder) == 0 and not window.SkipItems then + if band(flags, 1 --[[ImGuiOldColumnFlags.NoBorder]]) == 0 and not window.SkipItems then -- We clip Y boundaries CPU side because very long triangles are mishandled by some GPU drivers. local y1 = ImMax(columns.HostCursorPosY, window.ClipRect.Min.y) local y2 = ImMin(window.DC.CursorPos.y, window.ClipRect.Max.y) @@ -47499,21 +47542,21 @@ function ImGui.EndColumns() local column_id = band(columns.ID + n, 0xFFFFFFFF) local column_hit_hw = ImTrunc(COLUMNS_HIT_RECT_HALF_THICKNESS * g.CurrentDpiScale) local column_hit_rect = ImRect(ImVec2(x - column_hit_hw, y1), ImVec2(x + column_hit_hw, y2)) - if ImGui.ItemAdd(column_hit_rect, column_id, nil, ImGuiItemFlags.NoNav) then + if ImGui.ItemAdd(column_hit_rect, column_id, nil, 2 --[[ImGuiItemFlags.NoNav]]) then local hovered, held = false, false - if band(flags, ImGuiOldColumnFlags.NoResize) == 0 then + if band(flags, 2 --[[ImGuiOldColumnFlags.NoResize]]) == 0 then local _ _, hovered, held = ImGui.ButtonBehavior(column_hit_rect, column_id) if hovered or held then - ImGui.SetMouseCursor(ImGuiMouseCursor.ResizeEW) + ImGui.SetMouseCursor(4 --[[ImGuiMouseCursor.ResizeEW]]) end - if held and band(column.Flags, ImGuiOldColumnFlags.NoResize) == 0 then + if held and band(column.Flags, 2 --[[ImGuiOldColumnFlags.NoResize]]) == 0 then dragging_column = n end end -- Draw column - local col = ImGui.GetColorU32(held and ImGuiCol.SeparatorActive or (hovered and ImGuiCol.SeparatorHovered or ImGuiCol.Separator)) + local col = ImGui.GetColorU32(held and 30 --[[ImGuiCol.SeparatorActive]] or (hovered and 29 --[[ImGuiCol.SeparatorHovered]] or 28 --[[ImGuiCol.Separator]])) local xi = IM_TRUNC(x) window.DrawList:AddLineV(xi, y1 + 1.0, y2, col) end @@ -47549,9 +47592,9 @@ function ImGui.Columns(columns_count, id, borders) if columns_count == nil then columns_count = 1 end if borders == nil then borders = true end local window = ImGui.GetCurrentWindow() - IM_ASSERT(columns_count >= 1) + assert(columns_count >= 1) - local flags = borders and 0 or ImGuiOldColumnFlags.NoBorder + local flags = borders and 0 or 1 --[[ImGuiOldColumnFlags.NoBorder]] --flags = bor(flags, ImGuiOldColumnFlags.NoPreserveWidths) -- NB: Legacy behavior local columns = window.DC.CurrentColumns if columns ~= nil and columns.Count == columns_count and columns.Flags == flags then @@ -47711,7 +47754,7 @@ function ImGui.TextEx(text, text_end, flags) if not line_end then line_end = text_end end - if bit32.band(flags, ImGuiTextFlags.NoWidthForLargeClippedText) == 0 then + if bit32.band(flags, 1 --[[ImGuiTextFlags.NoWidthForLargeClippedText]]) == 0 then local line_size = ImGui.CalcTextSizeEx(text, line, line_end) text_size.x = ImMax(text_size.x, line_size.x) end @@ -47724,7 +47767,7 @@ function ImGui.TextEx(text, text_end, flags) -- Lines to render if line < text_end then - local line_rect = ImRect(pos, pos + ImVec2(FLT_MAX, line_height)) + local line_rect = ImRect(pos, pos + ImVec2(3.4028234663853e+38 --[[FLT_MAX]], line_height)) while line < text_end do if ImGui.IsClippedEx(line_rect, 0) then break @@ -47751,7 +47794,7 @@ function ImGui.TextEx(text, text_end, flags) if not line_end then line_end = text_end end - if bit32.band(flags, ImGuiTextFlags.NoWidthForLargeClippedText) == 0 then + if bit32.band(flags, 1 --[[ImGuiTextFlags.NoWidthForLargeClippedText]]) == 0 then local line_size = ImGui.CalcTextSizeEx(text, line, line_end) text_size.x = ImMax(text_size.x, line_size.x) end @@ -47771,7 +47814,7 @@ end --- @param text string --- @param text_end? int function ImGui.TextUnformatted(text, text_end) - ImGui.TextEx(text, text_end, ImGuiTextFlags.NoWidthForLargeClippedText) + ImGui.TextEx(text, text_end, 1 --[[ImGuiTextFlags.NoWidthForLargeClippedText]]) end --- @param fmt string @@ -47785,7 +47828,7 @@ function ImGui.TextV(fmt, ...) end local text = ImFormatString(fmt, ...) - ImGui.TextEx(text, nil, ImGuiTextFlags.NoWidthForLargeClippedText) + ImGui.TextEx(text, nil, 1 --[[ImGuiTextFlags.NoWidthForLargeClippedText]]) end --- @param fmt string @@ -47803,7 +47846,7 @@ end --- @param fmt string --- @param ... any function ImGui.TextColored(col, fmt, ...) - ImGui.PushStyleColor(ImGuiCol.Text, col) + ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], col) ImGui.TextV(fmt, ...) ImGui.PopStyleColor() end @@ -47812,7 +47855,7 @@ end --- @param ... any function ImGui.TextDisabled(fmt, ...) local g = GImGui - ImGui.PushStyleColor(ImGuiCol.Text, g.Style.Colors[ImGuiCol.TextDisabled]) + ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], g.Style.Colors[1 --[[ImGuiCol.TextDisabled]]]) ImGui.TextV(fmt, ...) ImGui.PopStyleColor() end @@ -47865,7 +47908,7 @@ function ImGui.TextAligned(align_x, size_x, fmt, ...) ImGui.ItemAdd(ImRect(pos, pos + size), 0) window.DC.CursorMaxPos.x = backup_max_pos.x -- Cancel out extending content to 'size' to use 'text_size' allowing auto-resize to function with align_x > 0.0f - if size_x < text_size.x and ImGui.IsItemHovered(bit32.bor(ImGuiHoveredFlags.NoNavOverride, ImGuiHoveredFlags.AllowWhenDisabled, ImGuiHoveredFlags.ForTooltip)) then + if size_x < text_size.x and ImGui.IsItemHovered(bit32.bor(2048 --[[ImGuiHoveredFlags.NoNavOverride]], 1024 --[[ImGuiHoveredFlags.AllowWhenDisabled]], 4096 --[[ImGuiHoveredFlags.ForTooltip]])) then ImGui.SetTooltip("%.*s", text_end - 1, text) end end @@ -47931,7 +47974,7 @@ function ImGui.BulletText(fmt, ...) end -- Render - local text_col = ImGui.GetColorU32(ImGuiCol.Text) + local text_col = ImGui.GetColorU32(0 --[[ImGuiCol.Text]]) ImGui.RenderBullet(window.DrawList, ImVec2(bb.Min.x + (style.FramePadding.x + g.FontSize * 0.5), bb.Min.y + g.FontSize * 0.5), text_col) ImGui.RenderText(ImVec2(bb.Min.x + (g.FontSize + style.FramePadding.x * 2), bb.Min.y + 0.0), text, 1, text_end, false) end @@ -48067,25 +48110,25 @@ function ImGui.ButtonBehavior(bb, id, flags) -- Default behavior inherited from item flags -- Note that _both_ ButtonFlags and ItemFlags are valid sources, so copy one into the item_flags and only check that. local item_flags = (g.LastItemData.ID == id) and g.LastItemData.ItemFlags or g.CurrentItemFlags - if bit32.band(flags, ImGuiButtonFlags.AllowOverlap) ~= 0 then - item_flags = bit32.bor(item_flags, ImGuiItemFlags.AllowOverlap) + if bit32.band(flags, 4096 --[[ImGuiButtonFlags.AllowOverlap]]) ~= 0 then + item_flags = bit32.bor(item_flags, 16384 --[[ImGuiItemFlags.AllowOverlap]]) end - if bit32.band(item_flags, ImGuiItemFlags.NoFocus) ~= 0 then - flags = bit32.bor(flags, ImGuiButtonFlags.NoFocus, ImGuiButtonFlags.NoNavFocus) + if bit32.band(item_flags, 131072 --[[ImGuiItemFlags.NoFocus]]) ~= 0 then + flags = bit32.bor(flags, 4194304 --[[ImGuiButtonFlags.NoFocus]], 262144 --[[ImGuiButtonFlags.NoNavFocus]]) end -- Default only reacts to left mouse button - if bit32.band(flags, ImGuiButtonFlags.MouseButtonMask_) == 0 then - flags = bit32.bor(flags, ImGuiButtonFlags.MouseButtonLeft) + if bit32.band(flags, 7 --[[ImGuiButtonFlags.MouseButtonMask_]]) == 0 then + flags = bit32.bor(flags, 1 --[[ImGuiButtonFlags.MouseButtonLeft]]) end -- Default behavior requires click + release inside bounding box - if bit32.band(flags, ImGuiButtonFlags.PressedOnMask_) == 0 then - flags = bit32.bor(flags, (bit32.band(item_flags, ImGuiItemFlags.ButtonRepeat) ~= 0) and ImGuiButtonFlags.PressedOnClick or ImGuiButtonFlags.PressedOnDefault_) + if bit32.band(flags, 1008 --[[ImGuiButtonFlags.PressedOnMask_]]) == 0 then + flags = bit32.bor(flags, (bit32.band(item_flags, 8 --[[ImGuiItemFlags.ButtonRepeat]]) ~= 0) and 16 --[[ImGuiButtonFlags.PressedOnClick]] or 32 --[[ImGuiButtonFlags.PressedOnDefault_]]) end local backup_hovered_window = g.HoveredWindow - local flatten_hovered_children = (bit32.band(flags, ImGuiButtonFlags.FlattenChildren) ~= 0) and g.HoveredWindow and g.HoveredWindow.RootWindowDockTree == window.RootWindowDockTree + local flatten_hovered_children = (bit32.band(flags, 2048 --[[ImGuiButtonFlags.FlattenChildren]]) ~= 0) and g.HoveredWindow and g.HoveredWindow.RootWindowDockTree == window.RootWindowDockTree if flatten_hovered_children then g.HoveredWindow = window end @@ -48096,7 +48139,7 @@ function ImGui.ButtonBehavior(bb, id, flags) -- Special mode for Drag and Drop used by openables (tree nodes, tabs etc.) -- where holding the button pressed for a long time while drag a payload item triggers the button. if g.DragDropActive then - if (bit32.band(flags, ImGuiButtonFlags.PressedOnDragDropHold) ~= 0) and (bit32.band(g.DragDropSourceFlags, ImGuiDragDropFlags.SourceNoHoldToOpenOthers) == 0) and ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenBlockedByActiveItem) then + if (bit32.band(flags, 512 --[[ImGuiButtonFlags.PressedOnDragDropHold]]) ~= 0) and (bit32.band(g.DragDropSourceFlags, 4 --[[ImGuiDragDropFlags.SourceNoHoldToOpenOthers]]) == 0) and ImGui.IsItemHovered(128 --[[ImGuiHoveredFlags.AllowWhenBlockedByActiveItem]]) then hovered = true ImGui.SetHoveredID(id) @@ -48107,7 +48150,7 @@ function ImGui.ButtonBehavior(bb, id, flags) end end - if (g.DragDropAcceptIdPrev == id) and (bit32.band(g.DragDropAcceptFlagsPrev, ImGuiDragDropFlags.AcceptDrawAsHovered) ~= 0) then + if (g.DragDropAcceptIdPrev == id) and (bit32.band(g.DragDropAcceptFlagsPrev, 8192 --[[ImGuiDragDropFlags.AcceptDrawAsHovered]]) ~= 0) then hovered = true end end @@ -48117,9 +48160,9 @@ function ImGui.ButtonBehavior(bb, id, flags) end -- Mouse handling - local test_owner_id = (bit32.band(flags, ImGuiButtonFlags.NoTestKeyOwner) ~= 0) and ImGuiKeyOwner_Any or id + local test_owner_id = (bit32.band(flags, 2097152 --[[ImGuiButtonFlags.NoTestKeyOwner]]) ~= 0) and 0 --[[ImGuiKeyOwner_Any]] or id if hovered then - IM_ASSERT(id ~= 0) -- Lazily check inside rare path. + assert(id ~= 0) -- Lazily check inside rare path. -- Poll mouse buttons -- - 'mouse_button_clicked' is generally carried into ActiveIdMouseButton when setting ActiveId. @@ -48127,38 +48170,38 @@ function ImGui.ButtonBehavior(bb, id, flags) local mouse_button_clicked = -1 local mouse_button_released = -1 for button = 0, 2 do - if bit32.band(flags, bit32.lshift(ImGuiButtonFlags.MouseButtonLeft, button)) ~= 0 then -- Handle ImGuiButtonFlags.MouseButtonRight and ImGuiButtonFlags.MouseButtonMiddle here. - if (ImGui.IsMouseClickedEx(button, ImGuiInputFlags.None, test_owner_id) and mouse_button_clicked == -1) then mouse_button_clicked = button end + if bit32.band(flags, bit32.lshift(1 --[[ImGuiButtonFlags.MouseButtonLeft]], button)) ~= 0 then -- Handle ImGuiButtonFlags.MouseButtonRight and ImGuiButtonFlags.MouseButtonMiddle here. + if (ImGui.IsMouseClickedEx(button, 0 --[[ImGuiInputFlags.None]], test_owner_id) and mouse_button_clicked == -1) then mouse_button_clicked = button end if (ImGui.IsMouseReleased(button, test_owner_id) and mouse_button_released == -1) then mouse_button_released = button end end end -- Process initial action - local mods_ok = (bit32.band(flags, ImGuiButtonFlags.NoKeyModsAllowed) == 0) or (not g.IO.KeyCtrl and not g.IO.KeyShift and not g.IO.KeyAlt) + local mods_ok = (bit32.band(flags, 65536 --[[ImGuiButtonFlags.NoKeyModsAllowed]]) == 0) or (not g.IO.KeyCtrl and not g.IO.KeyShift and not g.IO.KeyAlt) if mods_ok then if mouse_button_clicked ~= -1 and g.ActiveId ~= id then --- @cast mouse_button_clicked ImGuiMouseButton - if bit32.band(flags, ImGuiButtonFlags.NoSetKeyOwner) == 0 then + if bit32.band(flags, 1048576 --[[ImGuiButtonFlags.NoSetKeyOwner]]) == 0 then ImGui.SetKeyOwner(ImGui.MouseButtonToKey(mouse_button_clicked), id) end - if bit32.band(flags, bit32.bor(ImGuiButtonFlags.PressedOnClickRelease, ImGuiButtonFlags.PressedOnClickReleaseAnywhere)) ~= 0 then + if bit32.band(flags, bit32.bor(32 --[[ImGuiButtonFlags.PressedOnClickRelease]], 64 --[[ImGuiButtonFlags.PressedOnClickReleaseAnywhere]])) ~= 0 then ImGui.SetActiveID(id, window) g.ActiveIdMouseButton = mouse_button_clicked - if bit32.band(flags, ImGuiButtonFlags.NoNavFocus) == 0 then + if bit32.band(flags, 262144 --[[ImGuiButtonFlags.NoNavFocus]]) == 0 then ImGui.SetFocusID(id, window) ImGui.FocusWindow(window) - elseif bit32.band(flags, ImGuiButtonFlags.NoFocus) == 0 then - ImGui.FocusWindow(window, ImGuiFocusRequestFlags.RestoreFocusedChild) -- Still need to focus and bring to front, but try to avoid losing NavId when navigating a child + elseif bit32.band(flags, 4194304 --[[ImGuiButtonFlags.NoFocus]]) == 0 then + ImGui.FocusWindow(window, 1 --[[ImGuiFocusRequestFlags.RestoreFocusedChild]]) -- Still need to focus and bring to front, but try to avoid losing NavId when navigating a child end end - if (bit32.band(flags, ImGuiButtonFlags.PressedOnClick) ~= 0) or ((bit32.band(flags, ImGuiButtonFlags.PressedOnDoubleClick) ~= 0) and g.IO.MouseClickedCount[mouse_button_clicked] == 2) then + if (bit32.band(flags, 16 --[[ImGuiButtonFlags.PressedOnClick]]) ~= 0) or ((bit32.band(flags, 256 --[[ImGuiButtonFlags.PressedOnDoubleClick]]) ~= 0) and g.IO.MouseClickedCount[mouse_button_clicked] == 2) then pressed = true - if bit32.band(flags, ImGuiButtonFlags.NoHoldingActiveId) ~= 0 then + if bit32.band(flags, 131072 --[[ImGuiButtonFlags.NoHoldingActiveId]]) ~= 0 then ImGui.ClearActiveID() else ImGui.SetActiveID(id, window) -- Hold on ID @@ -48166,33 +48209,33 @@ function ImGui.ButtonBehavior(bb, id, flags) g.ActiveIdMouseButton = mouse_button_clicked - if bit32.band(flags, ImGuiButtonFlags.NoNavFocus) == 0 then + if bit32.band(flags, 262144 --[[ImGuiButtonFlags.NoNavFocus]]) == 0 then ImGui.SetFocusID(id, window) ImGui.FocusWindow(window) - elseif bit32.band(flags, ImGuiButtonFlags.NoFocus) == 0 then - ImGui.FocusWindow(window, ImGuiFocusRequestFlags.RestoreFocusedChild) -- Still need to focus and bring to front, but try to avoid losing NavId when navigating a child + elseif bit32.band(flags, 4194304 --[[ImGuiButtonFlags.NoFocus]]) == 0 then + ImGui.FocusWindow(window, 1 --[[ImGuiFocusRequestFlags.RestoreFocusedChild]]) -- Still need to focus and bring to front, but try to avoid losing NavId when navigating a child end end - if bit32.band(flags, ImGuiButtonFlags.PressedOnRelease) ~= 0 then + if bit32.band(flags, 128 --[[ImGuiButtonFlags.PressedOnRelease]]) ~= 0 then -- FIXME: Traditionally ImGuiButtonFlags.PressedOnRelease never took ActiveId. Adding it in 2026-03-20 since ImGuiButtonFlags.NoHoldingActiveId can always be added. -- We don't yet perform an explicit ClearActiveID() to reduce scope of change, but this possibility could be investigated. - if bit32.band(flags, ImGuiButtonFlags.NoHoldingActiveId) == 0 then + if bit32.band(flags, 131072 --[[ImGuiButtonFlags.NoHoldingActiveId]]) == 0 then ImGui.SetActiveID(id, window) -- Hold on ID end g.ActiveIdMouseButton = mouse_button_clicked end end - if bit32.band(flags, ImGuiButtonFlags.PressedOnRelease) ~= 0 then + if bit32.band(flags, 128 --[[ImGuiButtonFlags.PressedOnRelease]]) ~= 0 then if mouse_button_released ~= -1 then - local has_repeated_at_least_once = (bit32.band(item_flags, ImGuiItemFlags.ButtonRepeat) ~= 0) and g.IO.MouseDownDurationPrev[mouse_button_released] >= g.IO.KeyRepeatDelay -- Repeat mode trumps on release behavior + local has_repeated_at_least_once = (bit32.band(item_flags, 8 --[[ImGuiItemFlags.ButtonRepeat]]) ~= 0) and g.IO.MouseDownDurationPrev[mouse_button_released] >= g.IO.KeyRepeatDelay -- Repeat mode trumps on release behavior if not has_repeated_at_least_once then pressed = true end - if bit32.band(flags, ImGuiButtonFlags.NoNavFocus) == 0 then + if bit32.band(flags, 262144 --[[ImGuiButtonFlags.NoNavFocus]]) == 0 then ImGui.SetFocusID(id, window) -- FIXME: Lack of FocusWindow() call here is inconsistent with other paths. Research why. end @@ -48202,8 +48245,8 @@ function ImGui.ButtonBehavior(bb, id, flags) -- 'Repeat' mode acts when held regardless of _PressedOn flags (see table above). -- Relies on repeat logic of IsMouseClicked() but we may as well do it ourselves if we end up exposing finer RepeatDelay/RepeatRate settings. - if g.ActiveId == id and (bit32.band(item_flags, ImGuiItemFlags.ButtonRepeat) ~= 0) then - if g.IO.MouseDownDuration[g.ActiveIdMouseButton] > 0.0 and ImGui.IsMouseClickedEx(g.ActiveIdMouseButton, ImGuiInputFlags.Repeat, test_owner_id) then + if g.ActiveId == id and (bit32.band(item_flags, 8 --[[ImGuiItemFlags.ButtonRepeat]]) ~= 0) then + if g.IO.MouseDownDuration[g.ActiveIdMouseButton] > 0.0 and ImGui.IsMouseClickedEx(g.ActiveIdMouseButton, 1 --[[ImGuiInputFlags.Repeat]], test_owner_id) then pressed = true end end @@ -48216,19 +48259,19 @@ function ImGui.ButtonBehavior(bb, id, flags) -- Keyboard/Gamepad navigation handling -- We report navigated and navigation-activated items as hovered but we don't set g.HoveredId to not interfere with mouse. - if bit32.band(item_flags, ImGuiItemFlags.Disabled) == 0 then + if bit32.band(item_flags, 64 --[[ImGuiItemFlags.Disabled]]) == 0 then if g.NavId == id and g.NavCursorVisible and g.NavHighlightItemUnderNav then - if bit32.band(flags, ImGuiButtonFlags.NoHoveredOnFocus) == 0 then + if bit32.band(flags, 524288 --[[ImGuiButtonFlags.NoHoveredOnFocus]]) == 0 then hovered = true end end if g.NavActivateDownId == id then local nav_activated_by_code = (g.NavActivateId == id) local nav_activated_by_inputs = (g.NavActivatePressedId == id) - if not nav_activated_by_inputs and bit32.band(item_flags, ImGuiItemFlags.ButtonRepeat) ~= 0 then + if not nav_activated_by_inputs and bit32.band(item_flags, 8 --[[ImGuiItemFlags.ButtonRepeat]]) ~= 0 then -- Avoid pressing multiple keys from triggering excessive amount of repeat events - local key1 = ImGui.GetKeyData(g, ImGuiKey.Space) - local key2 = ImGui.GetKeyData(g, ImGuiKey.Enter) + local key1 = ImGui.GetKeyData(g, 524 --[[ImGuiKey.Space]]) + local key2 = ImGui.GetKeyData(g, 525 --[[ImGuiKey.Enter]]) local key3 = ImGui.GetKeyData(g, ImGuiKey.NavGamepadActivate) local t1 = ImMax(ImMax(key1.DownDuration, key2.DownDuration), key3.DownDuration) nav_activated_by_inputs = ImGui.CalcTypematicRepeatAmount(t1 - g.IO.DeltaTime, t1, g.IO.KeyRepeatDelay, g.IO.KeyRepeatRate) > 0 @@ -48238,10 +48281,10 @@ function ImGui.ButtonBehavior(bb, id, flags) pressed = true ImGui.SetActiveID(id, window) g.ActiveIdSource = g.NavInputSource - if bit32.band(flags, ImGuiButtonFlags.NoNavFocus) == 0 and bit32.band(g.NavActivateFlags, ImGuiActivateFlags.FromShortcut) == 0 then + if bit32.band(flags, 262144 --[[ImGuiButtonFlags.NoNavFocus]]) == 0 and bit32.band(g.NavActivateFlags, 16 --[[ImGuiActivateFlags.FromShortcut]]) == 0 then ImGui.SetFocusID(id, window) end - if bit32.band(g.NavActivateFlags, ImGuiActivateFlags.FromShortcut) ~= 0 then + if bit32.band(g.NavActivateFlags, 16 --[[ImGuiActivateFlags.FromShortcut]]) ~= 0 then g.ActiveIdFromShortcut = true end end @@ -48251,7 +48294,7 @@ function ImGui.ButtonBehavior(bb, id, flags) -- Process while held local held = false if g.ActiveId == id then - if g.ActiveIdSource == ImGuiInputSource.Mouse then + if g.ActiveIdSource == 1 --[[ImGuiInputSource.Mouse]] then if g.ActiveIdIsJustActivated then g.ActiveIdClickOffset = g.IO.MousePos - bb.Min end @@ -48263,14 +48306,14 @@ function ImGui.ButtonBehavior(bb, id, flags) elseif ImGui.IsMouseDown(mouse_button, test_owner_id) then held = true else - local release_in = hovered and (bit32.band(flags, ImGuiButtonFlags.PressedOnClickRelease) ~= 0) - local release_anywhere = (bit32.band(flags, ImGuiButtonFlags.PressedOnClickReleaseAnywhere) ~= 0) + local release_in = hovered and (bit32.band(flags, 32 --[[ImGuiButtonFlags.PressedOnClickRelease]]) ~= 0) + local release_anywhere = (bit32.band(flags, 64 --[[ImGuiButtonFlags.PressedOnClickReleaseAnywhere]]) ~= 0) if (release_in or release_anywhere) and not g.DragDropActive then -- Report as pressed when releasing the mouse (this is the most common path) - local is_double_click_release = (bit32.band(flags, ImGuiButtonFlags.PressedOnDoubleClick) ~= 0) and g.IO.MouseReleased[mouse_button] and g.IO.MouseClickedLastCount[mouse_button] == 2 + local is_double_click_release = (bit32.band(flags, 256 --[[ImGuiButtonFlags.PressedOnDoubleClick]]) ~= 0) and g.IO.MouseReleased[mouse_button] and g.IO.MouseClickedLastCount[mouse_button] == 2 - local is_repeating_already = (bit32.band(item_flags, ImGuiItemFlags.ButtonRepeat) ~= 0) and g.IO.MouseDownDurationPrev[mouse_button] >= g.IO.KeyRepeatDelay -- Repeat mode trumps + local is_repeating_already = (bit32.band(item_flags, 8 --[[ImGuiItemFlags.ButtonRepeat]]) ~= 0) and g.IO.MouseDownDurationPrev[mouse_button] >= g.IO.KeyRepeatDelay -- Repeat mode trumps local is_button_avail_or_owned = ImGui.TestKeyOwner(ImGui.MouseButtonToKey(mouse_button), test_owner_id) @@ -48282,10 +48325,10 @@ function ImGui.ButtonBehavior(bb, id, flags) ImGui.ClearActiveID() end - if bit32.band(flags, ImGuiButtonFlags.NoNavFocus) == 0 and g.IO.ConfigNavCursorVisibleAuto then + if bit32.band(flags, 262144 --[[ImGuiButtonFlags.NoNavFocus]]) == 0 and g.IO.ConfigNavCursorVisibleAuto then g.NavCursorVisible = false end - elseif g.ActiveIdSource == ImGuiInputSource.Keyboard or g.ActiveIdSource == ImGuiInputSource.Gamepad then + elseif g.ActiveIdSource == 2 --[[ImGuiInputSource.Keyboard]] or g.ActiveIdSource == 3 --[[ImGuiInputSource.Gamepad]] then -- When activated using Nav, we hold on the ActiveID until activation button is released if g.NavActivateDownId == id then held = true -- hovered == true not true as we are already likely hovered on direct activation. @@ -48300,7 +48343,7 @@ function ImGui.ButtonBehavior(bb, id, flags) end -- Activation highlight (this may be a remote activation) - if g.NavHighlightActivatedId == id and (bit32.band(item_flags, ImGuiItemFlags.Disabled) == 0) then + if g.NavHighlightActivatedId == id and (bit32.band(item_flags, 64 --[[ImGuiItemFlags.Disabled]]) == 0) then hovered = true end @@ -48332,7 +48375,7 @@ function ImGui.ButtonEx(label, size_arg, flags) -- [Luau] scalar pos, no temporary ImVec2 local pos_x, pos_y = window.DC.CursorPos.x, window.DC.CursorPos.y -- Don't modify the cursor! local frame_padding = style.FramePadding - if bit32.band(flags, ImGuiButtonFlags.AlignTextBaseLine) ~= 0 and frame_padding.y < window.DC.CurrLineTextBaseOffset then -- Try to vertically align buttons that are smaller/have no padding so that text baseline matches (bit hacky, since it shouldn't be a flag) + if bit32.band(flags, 32768 --[[ImGuiButtonFlags.AlignTextBaseLine]]) ~= 0 and frame_padding.y < window.DC.CurrLineTextBaseOffset then -- Try to vertically align buttons that are smaller/have no padding so that text baseline matches (bit hacky, since it shouldn't be a flag) pos_y = pos_y + window.DC.CurrLineTextBaseOffset - frame_padding.y end local size = ImGui.CalcItemSize(size_arg, label_size.x + frame_padding.x * 2.0, label_size.y + frame_padding.y * 2.0) @@ -48348,11 +48391,11 @@ function ImGui.ButtonEx(label, size_arg, flags) -- Render local col if held and hovered then - col = ImGui.GetColorU32(ImGuiCol.ButtonActive) + col = ImGui.GetColorU32(24 --[[ImGuiCol.ButtonActive]]) elseif hovered then - col = ImGui.GetColorU32(ImGuiCol.ButtonHovered) + col = ImGui.GetColorU32(23 --[[ImGuiCol.ButtonHovered]]) else - col = ImGui.GetColorU32(ImGuiCol.Button) + col = ImGui.GetColorU32(22 --[[ImGuiCol.Button]]) end ImGui.RenderNavCursor(bb, id) @@ -48377,7 +48420,7 @@ end --- @param size_arg? ImVec2 --- @return bool function ImGui.Button(label, size_arg) - return ImGui.ButtonEx(label, size_arg, ImGuiButtonFlags.None) + return ImGui.ButtonEx(label, size_arg, 0 --[[ImGuiButtonFlags.None]]) end -- Small buttons fits within text without additional vertical spacing. @@ -48387,7 +48430,7 @@ function ImGui.SmallButton(label) local g = GImGui local backup_padding_y = g.Style.FramePadding.y g.Style.FramePadding.y = 0.0 - local pressed = ImGui.ButtonEx(label, ImVec2(0, 0), ImGuiButtonFlags.AlignTextBaseLine) + local pressed = ImGui.ButtonEx(label, ImVec2(0, 0), 32768 --[[ImGuiButtonFlags.AlignTextBaseLine]]) g.Style.FramePadding.y = backup_padding_y return pressed end @@ -48406,13 +48449,13 @@ function ImGui.InvisibleButton(str_id, size_arg, flags) end -- Ensure zero-size fits to contents - local size = ImGui.CalcItemSize(ImVec2(size_arg.x ~= 0.0 and size_arg.x or -FLT_MIN, size_arg.y ~= 0.0 and size_arg.y or -FLT_MIN), 0.0, 0.0) + local size = ImGui.CalcItemSize(ImVec2(size_arg.x ~= 0.0 and size_arg.x or -1.1754943508223e-38 --[[FLT_MIN]], size_arg.y ~= 0.0 and size_arg.y or -1.1754943508223e-38 --[[FLT_MIN]]), 0.0, 0.0) local id = window:GetID(str_id) local bb = ImRect(window.DC.CursorPos, window.DC.CursorPos + size) ImGui.ItemSize(size) - local item_flags = (bit32.band(flags, ImGuiButtonFlags.EnableNav) ~= 0) and ImGuiItemFlags.None or ImGuiItemFlags.NoNav + local item_flags = (bit32.band(flags, 8 --[[ImGuiButtonFlags.EnableNav]]) ~= 0) and 0 --[[ImGuiItemFlags.None]] or 2 --[[ImGuiItemFlags.NoNav]] if not ImGui.ItemAdd(bb, id, nil, item_flags) then return false end @@ -48448,8 +48491,8 @@ function ImGui.ArrowButtonEx(str_id, dir, size, flags) local pressed, hovered, held = ImGui.ButtonBehavior(bb, id, flags) -- Render - local bg_col = ImGui.GetColorU32((held and hovered) and ImGuiCol.ButtonActive or hovered and ImGuiCol.ButtonHovered or ImGuiCol.Button) - local text_col = ImGui.GetColorU32(ImGuiCol.Text) + local bg_col = ImGui.GetColorU32((held and hovered) and 24 --[[ImGuiCol.ButtonActive]] or hovered and 23 --[[ImGuiCol.ButtonHovered]] or 22 --[[ImGuiCol.Button]]) + local text_col = ImGui.GetColorU32(0 --[[ImGuiCol.Text]]) ImGui.RenderNavCursor(bb, id) ImGui.RenderFrame(bb.Min, bb.Max, bg_col, true, g.Style.FrameRounding) ImGui.RenderArrow(window.DrawList, bb.Min + ImVec2(ImMax(0.0, (size.x - g.FontSize) * 0.5), ImMax(0.0, (size.y - g.FontSize) * 0.5)), text_col, dir) @@ -48462,7 +48505,7 @@ end --- @param dir ImGuiDir function ImGui.ArrowButton(str_id, dir) local sz = ImGui.GetFrameHeight() - return ImGui.ArrowButtonEx(str_id, dir, ImVec2(sz, sz), ImGuiButtonFlags.None) + return ImGui.ArrowButtonEx(str_id, dir, ImVec2(sz, sz), 0 --[[ImGuiButtonFlags.None]]) end -- Button to close a window @@ -48497,9 +48540,9 @@ function ImGui.CloseButton(id, pos) -- Render local bg_col if held then - bg_col = ImGui.GetColorU32(ImGuiCol.ButtonActive) + bg_col = ImGui.GetColorU32(24 --[[ImGuiCol.ButtonActive]]) else - bg_col = ImGui.GetColorU32(ImGuiCol.ButtonHovered) + bg_col = ImGui.GetColorU32(23 --[[ImGuiCol.ButtonHovered]]) end if hovered then @@ -48508,7 +48551,7 @@ function ImGui.CloseButton(id, pos) local cross_center = bb:GetCenter() - ImVec2(0.5, 0.5) local cross_extent = g.FontSize * 0.5 * 0.7071 - 1 - local cross_col = ImGui.GetColorU32(ImGuiCol.Text) + local cross_col = ImGui.GetColorU32(0 --[[ImGuiCol.Text]]) local cross_thickness = 1.0 -- FIXME-DPI window.DrawList:AddLine(cross_center + ImVec2(cross_extent, cross_extent), cross_center + ImVec2(-cross_extent, -cross_extent), cross_col, cross_thickness) window.DrawList:AddLine(cross_center + ImVec2(cross_extent, -cross_extent), cross_center + ImVec2(-cross_extent, cross_extent), cross_col, cross_thickness) @@ -48530,13 +48573,13 @@ function ImGui.CollapseButton(id, pos) -- Render if hovered then - window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(ImGuiCol.ButtonHovered)) + 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(ImGuiCol.Text), ImGuiDir.Right, 1) + ImGui.RenderArrow(window.DrawList, bb.Min, ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), 1 --[[ImGuiDir.Right]], 1) else - ImGui.RenderArrow(window.DrawList, bb.Min, ImGui.GetColorU32(ImGuiCol.Text), ImGuiDir.Down, 1) + ImGui.RenderArrow(window.DrawList, bb.Min, ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), 3 --[[ImGuiDir.Down]], 1) end return pressed @@ -48546,7 +48589,7 @@ end --- @param axis ImGuiAxis --- @return ImGuiID function ImGui.GetWindowScrollbarID(window, axis) - if axis == ImGuiAxis.X then + if axis == 1 --[[ImGuiAxis.X]] then return window:GetID("#SCROLLX") else return window:GetID("#SCROLLY") @@ -48564,13 +48607,13 @@ function ImGui.GetWindowScrollbarRect(window, axis) local inner_rect = window.InnerRect -- (ScrollbarSizes.x = width of Y scrollbar; ScrollbarSizes.y = height of X scrollbar) - local scrollbar_size = window.ScrollbarSizes[axis == ImGuiAxis.X and ImGuiAxis.Y or ImGuiAxis.X] - IM_ASSERT(scrollbar_size >= 0.0) + local scrollbar_size = window.ScrollbarSizes[axis == 1 --[[ImGuiAxis.X]] and 2 --[[ImGuiAxis.Y]] or 1 --[[ImGuiAxis.X]]] + assert(scrollbar_size >= 0.0) local border_size = IM_ROUND(window.WindowBorderSize * 0.5) - local border_top = (bit32.band(window.Flags, ImGuiWindowFlags.MenuBar) ~= 0) and IM_ROUND(g.Style.FrameBorderSize * 0.5) or (bit32.band(window.Flags, ImGuiWindowFlags.NoTitleBar) ~= 0 and border_size or 0) + local border_top = (bit32.band(window.Flags, 1024 --[[ImGuiWindowFlags.MenuBar]]) ~= 0) and IM_ROUND(g.Style.FrameBorderSize * 0.5) or (bit32.band(window.Flags, 1 --[[ImGuiWindowFlags.NoTitleBar]]) ~= 0 and border_size or 0) - if axis == ImGuiAxis.X then + if axis == 1 --[[ImGuiAxis.X]] then return ImRect(inner_rect.Min.x + border_size, ImMax(outer_rect.Min.y + border_size, outer_rect.Max.y - border_size - scrollbar_size), inner_rect.Max.x - border_size, outer_rect.Max.y - border_size) else return ImRect(ImMax(outer_rect.Min.x, outer_rect.Max.x - border_size - scrollbar_size), inner_rect.Min.y + border_top, outer_rect.Max.x - border_size, inner_rect.Max.y - border_size) @@ -48624,7 +48667,7 @@ function ImGui.ScrollbarEx(bb_frame, id, axis, p_scroll_v, size_visible_v, size_ -- When we are too small, start hiding and disabling the grab (this reduce visual noise on very small window and facilitate using the window resize grab) local alpha = 1.0 - if axis == ImGuiAxis.Y and bb_frame_height < bb_frame_width then + if axis == 2 --[[ImGuiAxis.Y]] and bb_frame_height < bb_frame_width then alpha = ImSaturate(bb_frame_height / ImMax(bb_frame_width * 2.0, 1.0)) end if alpha <= 0.0 then @@ -48642,7 +48685,7 @@ function ImGui.ScrollbarEx(bb_frame, id, axis, p_scroll_v, size_visible_v, size_ -- V denote the main, longer axis of the scrollbar (= height for a vertical scrollbar) local scrollbar_size_v - if axis == ImGuiAxis.X then + if axis == 1 --[[ImGuiAxis.X]] then scrollbar_size_v = bb:GetWidth() else scrollbar_size_v = bb:GetHeight() @@ -48654,7 +48697,7 @@ function ImGui.ScrollbarEx(bb_frame, id, axis, p_scroll_v, size_visible_v, size_ -- Calculate the height of our grabbable box. It generally represent the amount visible (vs the total scrollable amount) -- But we maintain a minimum size in pixel to allow for the user to still aim inside. - IM_ASSERT(ImMax(size_contents_v, size_visible_v) > 0.0) -- Adding this assert to check if the ImMax(XXX,1.0f) is still needed. PLEASE CONTACT ME if this triggers. + assert(ImMax(size_contents_v, size_visible_v) > 0.0) -- Adding this assert to check if the ImMax(XXX,1.0f) is still needed. PLEASE CONTACT ME if this triggers. local win_size_v = ImMax(ImMax(size_contents_v, size_visible_v), 1) local grab_h_minsize = ImMin(bb:GetSize()[axis], style.GrabMinSize) local grab_h_pixels = ImTrunc(ImClamp(scrollbar_size_v * (size_visible_v / win_size_v), grab_h_minsize, scrollbar_size_v)) @@ -48663,11 +48706,11 @@ function ImGui.ScrollbarEx(bb_frame, id, axis, p_scroll_v, size_visible_v, size_ -- As a special thing, we allow scrollbar near the edge of a screen/viewport to be reachable with mouse at the extreme edge (#9276) local bb_hit = ImRect() ImRect_Copy(bb_hit, bb_frame) - ImGui.ExtendHitBoxWhenNearViewportEdge(window, bb_hit, g.Style.WindowBorderSize, ImGuiAxis.X + ImGuiAxis.Y - axis) -- swap axis here + ImGui.ExtendHitBoxWhenNearViewportEdge(window, bb_hit, g.Style.WindowBorderSize, 1 --[[ImGuiAxis.X]] + 2 --[[ImGuiAxis.Y]] - axis) -- swap axis here -- Handle input right away. None of the code of Begin() is relying on scrolling position before calling Scrollbar(). - ImGui.ItemAdd(bb_frame, id, nil, ImGuiItemFlags.NoNav) - local pressed, hovered, held = ImGui.ButtonBehavior(bb_hit, id, ImGuiButtonFlags.NoNavFocus) + ImGui.ItemAdd(bb_frame, id, nil, 2 --[[ImGuiItemFlags.NoNav]]) + local pressed, hovered, held = ImGui.ButtonBehavior(bb_hit, id, 262144 --[[ImGuiButtonFlags.NoNavFocus]]) local scroll_max = ImMax(1, size_contents_v - size_visible_v) local scroll_ratio = ImSaturate(p_scroll_v / scroll_max) @@ -48712,7 +48755,7 @@ function ImGui.ScrollbarEx(bb_frame, id, axis, p_scroll_v, size_visible_v, size_ p_scroll_v = scroll_v_norm * scroll_max else -- Page by page - if ImGui.IsMouseClickedEx(ImGuiMouseButton.Left, ImGuiInputFlags.Repeat) and held_dir == g.ScrollbarSeekMode then + if ImGui.IsMouseClickedEx(0 --[[ImGuiMouseButton.Left]], 1 --[[ImGuiInputFlags.Repeat]]) and held_dir == g.ScrollbarSeekMode then local page_dir if g.ScrollbarSeekMode > 0.0 then page_dir = 1.0 @@ -48733,18 +48776,18 @@ function ImGui.ScrollbarEx(bb_frame, id, axis, p_scroll_v, size_visible_v, size_ end -- Render - local bg_col = ImGui.GetColorU32(ImGuiCol.ScrollbarBg) + local bg_col = ImGui.GetColorU32(14 --[[ImGuiCol.ScrollbarBg]]) local grab_col if held then - grab_col = ImGui.GetColorU32(ImGuiCol.ScrollbarGrabActive, alpha) + grab_col = ImGui.GetColorU32(17 --[[ImGuiCol.ScrollbarGrabActive]], alpha) elseif hovered then - grab_col = ImGui.GetColorU32(ImGuiCol.ScrollbarGrabHovered, alpha) + grab_col = ImGui.GetColorU32(16 --[[ImGuiCol.ScrollbarGrabHovered]], alpha) else - grab_col = ImGui.GetColorU32(ImGuiCol.ScrollbarGrab, alpha) + grab_col = ImGui.GetColorU32(15 --[[ImGuiCol.ScrollbarGrab]], alpha) end window.DrawList:AddRectFilled(bb_frame.Min, bb_frame.Max, bg_col, window.WindowRounding, draw_rounding_flags) local grab_rect - if axis == ImGuiAxis.X then + if axis == 1 --[[ImGuiAxis.X]] then local x1 = ImLerp(bb.Min.x, bb.Max.x, grab_v_norm) grab_rect = ImRect(x1, bb.Min.y, x1 + grab_h_pixels, bb.Max.y) else @@ -48766,7 +48809,7 @@ function ImGui.Scrollbar(axis) -- Calculate scrollbar bounding box local bb = ImGui.GetWindowScrollbarRect(window, axis) local rounding_corners = ImGui.CalcRoundingFlagsForRectInRect(bb, window:Rect(), g.Style.WindowBorderSize) - local k = (axis == ImGuiAxis.X) and "x" or "y" -- [Luau] named key: ImVec2[axis] goes through IM_VEC2.__index + local k = (axis == 1 --[[ImGuiAxis.X]]) and "x" or "y" -- [Luau] named key: ImVec2[axis] goes through IM_VEC2.__index local size_visible = window.InnerRect.Max[k] - window.InnerRect.Min[k] local size_contents = window.ContentSize[k] + window.WindowPadding[k] * 2.0 local scroll = window.Scroll[k] @@ -48813,7 +48856,7 @@ function ImGui.ImageWithBg(tex_ref, image_size, uv0, uv1, bg_col, tint_col) window.DrawList:AddImage(tex_ref, bb.Min + padding, bb.Max - padding, uv0, uv1, ImGui.GetColorU32(tint_col)) end if g.Style.ImageBorderSize > 0.0 then - window.DrawList:AddRect(bb.Min, bb.Max, ImGui.GetColorU32(ImGuiCol.Border), rounding, g.Style.ImageBorderSize, ImDrawFlags.None) + window.DrawList:AddRect(bb.Min, bb.Max, ImGui.GetColorU32(5 --[[ImGuiCol.Border]]), rounding, g.Style.ImageBorderSize, 0 --[[ImDrawFlags.None]]) end end @@ -48852,7 +48895,7 @@ function ImGui.ImageButtonEx(id, tex_ref, image_size, uv0, uv1, bg_col, tint_col local pressed, hovered, held = ImGui.ButtonBehavior(bb, id, flags) -- Render - local col = ImGui.GetColorU32((held and hovered) and ImGuiCol.ButtonActive or hovered and ImGuiCol.ButtonHovered or ImGuiCol.Button) + local col = ImGui.GetColorU32((held and hovered) and 24 --[[ImGuiCol.ButtonActive]] or hovered and 23 --[[ImGuiCol.ButtonHovered]] or 22 --[[ImGuiCol.Button]]) ImGui.RenderNavCursor(bb, id) ImGui.RenderFrame(bb.Min, bb.Max, col, true, g.Style.FrameRounding) if bg_col.w > 0.0 then @@ -48916,7 +48959,7 @@ function ImGui.Checkbox(label, v) local total_bb = ImRect(pos_x, pos_y, pos_x + total_width, pos_y + (label_size.y + style.FramePadding.y * 2.0)) ImGui.ItemSize(total_bb, style.FramePadding.y) local is_visible = ImGui.ItemAdd(total_bb, id) - local is_multi_select = (bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.IsMultiSelect) ~= 0) + local is_multi_select = (bit32.band(g.LastItemData.ItemFlags, 4194304 --[[ImGuiItemFlags.IsMultiSelect]]) ~= 0) if not is_visible then if not is_multi_select or not g.BoxSelectState.UnclipMode or not g.BoxSelectState.UnclipRect:Overlaps(total_bb) then -- Extra layer of "no logic clip" for box-select support -- IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0)) @@ -48946,12 +48989,12 @@ function ImGui.Checkbox(label, v) end local check_bb = ImRect(pos_x, pos_y, pos_x + square_sz, pos_y + square_sz) - local mixed_value = (bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.MixedValue) ~= 0) + local mixed_value = (bit32.band(g.LastItemData.ItemFlags, 4096 --[[ImGuiItemFlags.MixedValue]]) ~= 0) if is_visible then ImGui.RenderNavCursor(total_bb, id) - local bg_col = ImGui.GetColorU32((held and hovered) and ImGuiCol.FrameBgActive or (hovered and ImGuiCol.FrameBgHovered or ((mixed_value or checked) and ImGuiCol.CheckboxSelectedBg or ImGuiCol.FrameBg))) - local check_col = ImGui.GetColorU32(ImGuiCol.CheckMark) + local bg_col = ImGui.GetColorU32((held and hovered) and 9 --[[ImGuiCol.FrameBgActive]] or (hovered and 8 --[[ImGuiCol.FrameBgHovered]] or ((mixed_value or checked) and 19 --[[ImGuiCol.CheckboxSelectedBg]] or 7 --[[ImGuiCol.FrameBg]]))) + local check_col = ImGui.GetColorU32(18 --[[ImGuiCol.CheckMark]]) ImGui.RenderFrame(check_bb.Min, check_bb.Max, bg_col, true, style.FrameRounding) if mixed_value then @@ -48990,7 +49033,7 @@ function ImGui.CheckboxFlags(label, flags, flags_value) local pressed if not all_on and any_on then local g = GImGui - g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, ImGuiItemFlags.MixedValue) + g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, 4096 --[[ImGuiItemFlags.MixedValue]]) pressed, all_on = ImGui.Checkbox(label, all_on) else pressed, all_on = ImGui.Checkbox(label, all_on) @@ -49045,22 +49088,22 @@ function ImGui.RadioButtonEx(label, active) local num_segment = window.DrawList:_CalcCircleAutoSegmentCount(radius) local col if held and hovered then - col = ImGui.GetColorU32(ImGuiCol.FrameBgActive) + col = ImGui.GetColorU32(9 --[[ImGuiCol.FrameBgActive]]) else if hovered then - col = ImGui.GetColorU32(ImGuiCol.FrameBgHovered) + col = ImGui.GetColorU32(8 --[[ImGuiCol.FrameBgHovered]]) else - col = ImGui.GetColorU32(ImGuiCol.FrameBg) + col = ImGui.GetColorU32(7 --[[ImGuiCol.FrameBg]]) end end window.DrawList:AddCircleFilled(center, radius, col, num_segment) if active then local pad = ImMax(1.0, IM_TRUNC(square_sz / 6.0)) - window.DrawList:AddCircleFilled(center, radius - pad, ImGui.GetColorU32(ImGuiCol.CheckMark)) + window.DrawList:AddCircleFilled(center, radius - pad, ImGui.GetColorU32(18 --[[ImGuiCol.CheckMark]])) end if style.FrameBorderSize > 0.0 then - window.DrawList:AddCircle(center + ImVec2(1, 1), radius, ImGui.GetColorU32(ImGuiCol.BorderShadow), num_segment, style.FrameBorderSize) - window.DrawList:AddCircle(center, radius, ImGui.GetColorU32(ImGuiCol.Border), num_segment, style.FrameBorderSize) + window.DrawList:AddCircle(center + ImVec2(1, 1), radius, ImGui.GetColorU32(6 --[[ImGuiCol.BorderShadow]]), num_segment, style.FrameBorderSize) + window.DrawList:AddCircle(center, radius, ImGui.GetColorU32(5 --[[ImGuiCol.Border]]), num_segment, style.FrameBorderSize) end local label_pos = ImVec2(check_bb.Max.x + style.ItemInnerSpacing.x, check_bb.Min.y + style.FramePadding.y) if g.LogEnabled then @@ -49092,7 +49135,7 @@ end --- @param size_arg? ImVec2 --- @param overlay? string function ImGui.ProgressBar(fraction, size_arg, overlay) - if size_arg == nil then size_arg = ImVec2(-FLT_MIN, 0) end + if size_arg == nil then size_arg = ImVec2(-1.1754943508223e-38 --[[FLT_MIN]], 0) end local window = ImGui.GetCurrentWindow() if window.SkipItems then @@ -49130,13 +49173,13 @@ function ImGui.ProgressBar(fraction, size_arg, overlay) end -- Render - ImGui.RenderFrame(bb.Min, bb.Max, ImGui.GetColorU32(ImGuiCol.FrameBg), true, style.FrameRounding) + ImGui.RenderFrame(bb.Min, bb.Max, ImGui.GetColorU32(7 --[[ImGuiCol.FrameBg]]), true, style.FrameRounding) bb:Expand(ImVec2(-style.FrameBorderSize, -style.FrameBorderSize)) local fill_x0 = ImLerp(bb.Min.x, bb.Max.x, fill_n0) local fill_x1 = ImLerp(bb.Min.x, bb.Max.x, fill_n1) if fill_x0 < fill_x1 then - ImGui.RenderRectFilledInRangeH(window.DrawList, bb, ImGui.GetColorU32(ImGuiCol.PlotHistogram), fill_x0, fill_x1, style.FrameRounding) + ImGui.RenderRectFilledInRangeH(window.DrawList, bb, ImGui.GetColorU32(46 --[[ImGuiCol.PlotHistogram]]), fill_x0, fill_x1, style.FrameRounding) end -- Default displaying the fraction as percentage string, but user can override it @@ -49171,7 +49214,7 @@ function ImGui.Bullet() end -- Render and stay on same line - local text_col = ImGui.GetColorU32(ImGuiCol.Text) + local text_col = ImGui.GetColorU32(0 --[[ImGuiCol.Text]]) ImGui.RenderBullet(window.DrawList, bb.Min + ImVec2(style.FramePadding.x + g.FontSize * 0.5, line_height * 0.5), text_col) ImGui.SameLine(0, style.FramePadding.x * 2.0) end @@ -49203,11 +49246,11 @@ function ImGui.TextLink(label) ImGui.RenderNavCursor(bb, id) if hovered then - ImGui.SetMouseCursor(ImGuiMouseCursor.Hand) + ImGui.SetMouseCursor(7 --[[ImGuiMouseCursor.Hand]]) end local text_colf = ImVec4() - ImVec4_Copy(text_colf, g.Style.Colors[ImGuiCol.TextLink]) + ImVec4_Copy(text_colf, g.Style.Colors[53 --[[ImGuiCol.TextLink]]]) local line_colf = ImVec4() ImVec4_Copy(line_colf, text_colf) do @@ -49226,7 +49269,7 @@ function ImGui.TextLink(label) local line_y = bb.Max.y + ImFloor(g.FontBaked.Descent * g.FontBakedScale * 0.20) window.DrawList:AddLineH(bb.Min.x, bb.Max.x, line_y, ImGui.GetColorU32(line_colf), 1.0 * ImTrunc(g.Style._MainScale)) -- FIXME-TEXT: Underline mode -- FIXME-DPI - ImGui.PushStyleColor(ImGuiCol.Text, ImGui.GetColorU32(text_colf)) + ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], ImGui.GetColorU32(text_colf)) ImGui.RenderText(bb.Min, label, 1, label_end, false) ImGui.PopStyleColor() @@ -49246,10 +49289,10 @@ function ImGui.TextLinkOpenURL(label, url) g.PlatformIO.Platform_OpenInShellFn(g, url) end - ImGui.SetItemTooltip(ImGui.LocalizeGetMsg(ImGuiLocKey.OpenLink_s), url) -- It is more reassuring for user to _always_ display URL when it is the same as the label. + ImGui.SetItemTooltip(ImGui.LocalizeGetMsg(11 --[[ImGuiLocKey.OpenLink_s]]), url) -- It is more reassuring for user to _always_ display URL when it is the same as the label. if ImGui.BeginPopupContextItem() then - if ImGui.MenuItem(ImGui.LocalizeGetMsg(ImGuiLocKey.CopyLink)) then + if ImGui.MenuItem(ImGui.LocalizeGetMsg(12 --[[ImGuiLocKey.CopyLink]])) then ImGui.SetClipboardText(url) end ImGui.EndPopup() @@ -49301,7 +49344,7 @@ function ImGui.NewLine() local g = GImGui local backup_layout_type = window.DC.LayoutType - window.DC.LayoutType = ImGuiLayoutType.Vertical + window.DC.LayoutType = 1 --[[ImGuiLayoutType.Vertical]] window.DC.IsSameLine = false if window.DC.CurrLineSize.y > 0.0 then -- In the event that we are on a line with items that is smaller that FontSize high, we will preserve its height. @@ -49338,10 +49381,10 @@ function ImGui.SeparatorEx(flags, thickness) end local g = GImGui - IM_ASSERT(ImIsPowerOfTwo(bit32.band(flags, bit32.bor(ImGuiSeparatorFlags.Horizontal, ImGuiSeparatorFlags.Vertical)))) -- Check that only 1 option is selected - IM_ASSERT(thickness > 0.0) + assert(ImIsPowerOfTwo(bit32.band(flags, bit32.bor(1 --[[ImGuiSeparatorFlags.Horizontal]], 2 --[[ImGuiSeparatorFlags.Vertical]])))) -- Check that only 1 option is selected + assert(thickness > 0.0) - if bit32.band(flags, ImGuiSeparatorFlags.Vertical) ~= 0 then + if bit32.band(flags, 2 --[[ImGuiSeparatorFlags.Vertical]]) ~= 0 then -- Vertical separator, for menu bars (use current line height). local y1 = window.DC.CursorPos.y local y2 = window.DC.CursorPos.y + window.DC.CurrLineSize.y @@ -49353,11 +49396,11 @@ function ImGui.SeparatorEx(flags, thickness) end -- Draw - window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(ImGuiCol.Separator)) + window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(28 --[[ImGuiCol.Separator]])) if g.LogEnabled then ImGui.LogText(" |") end - elseif bit32.band(flags, ImGuiSeparatorFlags.Horizontal) ~= 0 then + elseif bit32.band(flags, 1 --[[ImGuiSeparatorFlags.Horizontal]]) ~= 0 then -- Horizontal Separator local x1 = window.DC.CursorPos.x local x2 = window.WorkRect.Max.x @@ -49365,7 +49408,7 @@ function ImGui.SeparatorEx(flags, thickness) -- Preserve legacy behavior inside Columns() -- Before Tables API happened, we relied on Separator() to span all columns of a Columns() set. -- We currently don't need to provide the same feature for tables because tables naturally have border features. - local columns = (bit32.band(flags, ImGuiSeparatorFlags.SpanAllColumns) ~= 0) and window.DC.CurrentColumns or nil + local columns = (bit32.band(flags, 4 --[[ImGuiSeparatorFlags.SpanAllColumns]]) ~= 0) and window.DC.CurrentColumns or nil if columns then x1 = window.Pos.x + window.DC.Indent.x -- Used to be Pos.x before 2023/10/03 x2 = window.Pos.x + window.Size.x @@ -49385,7 +49428,7 @@ function ImGui.SeparatorEx(flags, thickness) if ImGui.ItemAdd(bb, 0) then -- Draw - window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(ImGuiCol.Separator)) + window.DrawList:AddRectFilled(bb.Min, bb.Max, ImGui.GetColorU32(28 --[[ImGuiCol.Separator]])) if g.LogEnabled then ImGui.LogRenderedText(bb.Min, "--------------------------------") end @@ -49407,15 +49450,15 @@ function ImGui.Separator() -- Those flags should eventually be configurable by the user local flags - if window.DC.LayoutType == ImGuiLayoutType.Horizontal then - flags = ImGuiSeparatorFlags.Vertical + if window.DC.LayoutType == 0 --[[ImGuiLayoutType.Horizontal]] then + flags = 2 --[[ImGuiSeparatorFlags.Vertical]] else - flags = ImGuiSeparatorFlags.Horizontal + flags = 1 --[[ImGuiSeparatorFlags.Horizontal]] end -- Only applies to legacy Columns() api as they relied on Separator() a lot. if window.DC.CurrentColumns then - flags = bit32.bor(flags, ImGuiSeparatorFlags.SpanAllColumns) + flags = bit32.bor(flags, 4 --[[ImGuiSeparatorFlags.SpanAllColumns]]) end ImGui.SeparatorEx(flags, ImMax(g.Style.SeparatorSize, 1.0)) @@ -49455,7 +49498,7 @@ function ImGui.SeparatorTextEx(id, label, label_end, extra_w) -- This allows using SameLine() to position something in the 'extra_w' window.DC.CursorPosPrevLine.x = label_pos.x + label_size.x - local separator_col = ImGui.GetColorU32(ImGuiCol.Separator) + local separator_col = ImGui.GetColorU32(28 --[[ImGuiCol.Separator]]) if label_size.x > 0.0 then local sep1_x2 = label_pos.x - style.ItemSpacing.x @@ -49518,7 +49561,7 @@ end local function CalcMaxPopupHeightFromItemCount(items_count) local g = GImGui if items_count <= 0 then - return FLT_MAX + return 3.4028234663853e+38 --[[FLT_MAX]] end return (g.FontSize + g.Style.ItemSpacing.y) * items_count - g.Style.ItemSpacing.y + (g.Style.WindowPadding.y * 2) end @@ -49540,13 +49583,13 @@ function ImGui.BeginCombo(label, preview_value, flags) local style = g.Style local id = window:GetID(label) - IM_ASSERT(bit32.band(flags, bit32.bor(ImGuiComboFlags.NoArrowButton, ImGuiComboFlags.NoPreview)) ~= bit32.bor(ImGuiComboFlags.NoArrowButton, ImGuiComboFlags.NoPreview)) -- Can't use both flags together - if bit32.band(flags, ImGuiComboFlags.WidthFitPreview) ~= 0 then - IM_ASSERT(bit32.band(flags, bit32.bor(ImGuiComboFlags.NoPreview, ImGuiComboFlags.CustomPreview)) == 0) + assert(bit32.band(flags, bit32.bor(32 --[[ImGuiComboFlags.NoArrowButton]], 64 --[[ImGuiComboFlags.NoPreview]])) ~= bit32.bor(32 --[[ImGuiComboFlags.NoArrowButton]], 64 --[[ImGuiComboFlags.NoPreview]])) -- Can't use both flags together + if bit32.band(flags, 128 --[[ImGuiComboFlags.WidthFitPreview]]) ~= 0 then + assert(bit32.band(flags, bit32.bor(64 --[[ImGuiComboFlags.NoPreview]], 1048576 --[[ImGuiComboFlags.CustomPreview]])) == 0) end local arrow_size - if (bit32.band(flags, ImGuiComboFlags.NoArrowButton) ~= 0) then + if (bit32.band(flags, 32 --[[ImGuiComboFlags.NoArrowButton]]) ~= 0) then arrow_size = 0.0 else arrow_size = ImGui.GetFrameHeight() @@ -49556,16 +49599,16 @@ function ImGui.BeginCombo(label, preview_value, flags) local label_size = ImGui.CalcTextSize(label, label_end, false) local preview_width - if ((bit32.band(flags, ImGuiComboFlags.WidthFitPreview) ~= 0) and (preview_value ~= nil)) then + if ((bit32.band(flags, 128 --[[ImGuiComboFlags.WidthFitPreview]]) ~= 0) and (preview_value ~= nil)) then preview_width = ImGui.CalcTextSize(preview_value, nil, false).x else preview_width = 0.0 end local w - if bit32.band(flags, ImGuiComboFlags.NoPreview) ~= 0 then + if bit32.band(flags, 64 --[[ImGuiComboFlags.NoPreview]]) ~= 0 then w = arrow_size - elseif bit32.band(flags, ImGuiComboFlags.WidthFitPreview) ~= 0 then + elseif bit32.band(flags, 128 --[[ImGuiComboFlags.WidthFitPreview]]) ~= 0 then w = arrow_size + preview_width + style.FramePadding.x * 2.0 else w = ImGui.CalcItemWidth() @@ -49583,44 +49626,44 @@ function ImGui.BeginCombo(label, preview_value, flags) -- Open on click local pressed, hovered, held = ImGui.ButtonBehavior(bb, id) local popup_id = ImHashStr("##ComboPopup", nil, id) - local popup_open = ImGui.IsPopupOpen(popup_id, ImGuiPopupFlags.None) + local popup_open = ImGui.IsPopupOpen(popup_id, 0 --[[ImGuiPopupFlags.None]]) if pressed and not popup_open then - ImGui.OpenPopupEx(popup_id, ImGuiPopupFlags.None) + ImGui.OpenPopupEx(popup_id, 0 --[[ImGuiPopupFlags.None]]) popup_open = true end -- Render shape - local frame_col = ImGui.GetColorU32(hovered and ImGuiCol.FrameBgHovered or ImGuiCol.FrameBg) + local frame_col = ImGui.GetColorU32(hovered and 8 --[[ImGuiCol.FrameBgHovered]] or 7 --[[ImGuiCol.FrameBg]]) local value_x2 = ImMax(bb.Min.x, bb.Max.x - arrow_size) ImGui.RenderNavCursor(bb, id) - if bit32.band(flags, ImGuiComboFlags.NoPreview) == 0 then - window.DrawList:AddRectFilled(bb.Min, ImVec2(value_x2, bb.Max.y), frame_col, style.FrameRounding, (bit32.band(flags, ImGuiComboFlags.NoArrowButton) ~= 0) and ImDrawFlags.RoundCornersAll or ImDrawFlags.RoundCornersLeft) + if bit32.band(flags, 64 --[[ImGuiComboFlags.NoPreview]]) == 0 then + window.DrawList:AddRectFilled(bb.Min, ImVec2(value_x2, bb.Max.y), frame_col, style.FrameRounding, (bit32.band(flags, 32 --[[ImGuiComboFlags.NoArrowButton]]) ~= 0) and 240 --[[ImDrawFlags.RoundCornersAll]] or 80 --[[ImDrawFlags.RoundCornersLeft]]) end - if bit32.band(flags, ImGuiComboFlags.NoArrowButton) == 0 then - local bg_col = ImGui.GetColorU32((popup_open or hovered) and ImGuiCol.ButtonHovered or ImGuiCol.Button) - local text_col = ImGui.GetColorU32(ImGuiCol.Text) + if bit32.band(flags, 32 --[[ImGuiComboFlags.NoArrowButton]]) == 0 then + local bg_col = ImGui.GetColorU32((popup_open or hovered) and 23 --[[ImGuiCol.ButtonHovered]] or 22 --[[ImGuiCol.Button]]) + local text_col = ImGui.GetColorU32(0 --[[ImGuiCol.Text]]) - window.DrawList:AddRectFilled(ImVec2(value_x2, bb.Min.y), bb.Max, bg_col, style.FrameRounding, (w <= arrow_size) and ImDrawFlags.RoundCornersAll or ImDrawFlags.RoundCornersRight) + window.DrawList:AddRectFilled(ImVec2(value_x2, bb.Min.y), bb.Max, bg_col, style.FrameRounding, (w <= arrow_size) and 240 --[[ImDrawFlags.RoundCornersAll]] or 160 --[[ImDrawFlags.RoundCornersRight]]) if value_x2 + arrow_size - style.FramePadding.x <= bb.Max.x then - ImGui.RenderArrow(window.DrawList, ImVec2(value_x2 + style.FramePadding.y, bb.Min.y + style.FramePadding.y), text_col, ImGuiDir.Down, 1.0) + ImGui.RenderArrow(window.DrawList, ImVec2(value_x2 + style.FramePadding.y, bb.Min.y + style.FramePadding.y), text_col, 3 --[[ImGuiDir.Down]], 1.0) end end ImGui.RenderFrameBorder(bb.Min, bb.Max, style.FrameRounding) -- Custom preview - if bit32.band(flags, ImGuiComboFlags.CustomPreview) ~= 0 then + if bit32.band(flags, 1048576 --[[ImGuiComboFlags.CustomPreview]]) ~= 0 then g.ComboPreviewData.PreviewRect = ImRect(bb.Min.x, bb.Min.y, value_x2, bb.Max.y) - IM_ASSERT(preview_value == nil or preview_value == "") + assert(preview_value == nil or preview_value == "") preview_value = nil end -- Render preview and label - if preview_value ~= nil and bit32.band(flags, ImGuiComboFlags.NoPreview) == 0 then + if preview_value ~= nil and bit32.band(flags, 64 --[[ImGuiComboFlags.NoPreview]]) == 0 then if g.LogEnabled then ImGui.LogSetNextTextDecoration("{", "}") end @@ -49644,34 +49687,34 @@ end --- @param flags ImGuiComboFlags function ImGui.BeginComboPopup(popup_id, bb, flags) local g = GImGui - if not ImGui.IsPopupOpen(popup_id, ImGuiPopupFlags.None) then + if not ImGui.IsPopupOpen(popup_id, 0 --[[ImGuiPopupFlags.None]]) then g.NextWindowData:ClearFlags() return false end -- Set popup size local w = bb:GetWidth() - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasSizeConstraint) ~= 0 then + if bit32.band(g.NextWindowData.HasFlags, 16 --[[ImGuiNextWindowDataFlags.HasSizeConstraint]]) ~= 0 then g.NextWindowData.SizeConstraintRect.Min.x = ImMax(g.NextWindowData.SizeConstraintRect.Min.x, w) else - if bit32.band(flags, ImGuiComboFlags.HeightMask_) == 0 then - flags = bit32.bor(flags, ImGuiComboFlags.HeightRegular) + if bit32.band(flags, 30 --[[ImGuiComboFlags.HeightMask_]]) == 0 then + flags = bit32.bor(flags, 4 --[[ImGuiComboFlags.HeightRegular]]) end - IM_ASSERT(ImIsPowerOfTwo(bit32.band(flags, ImGuiComboFlags.HeightMask_))) -- Only one + assert(ImIsPowerOfTwo(bit32.band(flags, 30 --[[ImGuiComboFlags.HeightMask_]]))) -- Only one local popup_max_height_in_items = -1 - if bit32.band(flags, ImGuiComboFlags.HeightRegular) ~= 0 then + if bit32.band(flags, 4 --[[ImGuiComboFlags.HeightRegular]]) ~= 0 then popup_max_height_in_items = 8 - elseif bit32.band(flags, ImGuiComboFlags.HeightSmall) ~= 0 then + elseif bit32.band(flags, 2 --[[ImGuiComboFlags.HeightSmall]]) ~= 0 then popup_max_height_in_items = 4 - elseif bit32.band(flags, ImGuiComboFlags.HeightLarge) ~= 0 then + elseif bit32.band(flags, 8 --[[ImGuiComboFlags.HeightLarge]]) ~= 0 then popup_max_height_in_items = 20 end local constraint_min = ImVec2(0.0, 0.0) - local constraint_max = ImVec2(FLT_MAX, FLT_MAX) - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasSize) == 0 or g.NextWindowData.SizeVal.x <= 0.0 then -- Don't apply constraints if user specified a size + local constraint_max = ImVec2(3.4028234663853e+38 --[[FLT_MAX]], 3.4028234663853e+38 --[[FLT_MAX]]) + if bit32.band(g.NextWindowData.HasFlags, 2 --[[ImGuiNextWindowDataFlags.HasSize]]) == 0 or g.NextWindowData.SizeVal.x <= 0.0 then -- Don't apply constraints if user specified a size constraint_min.x = w end - if bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasSize) == 0 or g.NextWindowData.SizeVal.y <= 0.0 then + if bit32.band(g.NextWindowData.HasFlags, 2 --[[ImGuiNextWindowDataFlags.HasSize]]) == 0 or g.NextWindowData.SizeVal.y <= 0.0 then constraint_max.y = CalcMaxPopupHeightFromItemCount(popup_max_height_in_items) end ImGui.SetNextWindowSizeConstraints(constraint_min, constraint_max) @@ -49688,24 +49731,24 @@ function ImGui.BeginComboPopup(popup_id, bb, flags) if popup_window.WasActive then -- Always override 'AutoPosLastDirection' to not leave a chance for a past value to affect us. local size_expected = ImGui.CalcWindowNextAutoFitSize(popup_window) - popup_window.AutoPosLastDirection = (bit32.band(flags, ImGuiComboFlags.PopupAlignLeft) ~= 0) and ImGuiDir.Left or ImGuiDir.Down -- Left = "Below, Toward Left", Down = "Below, Toward Right (default)" + popup_window.AutoPosLastDirection = (bit32.band(flags, 1 --[[ImGuiComboFlags.PopupAlignLeft]]) ~= 0) and 0 --[[ImGuiDir.Left]] or 3 --[[ImGuiDir.Down]] -- Left = "Below, Toward Left", Down = "Below, Toward Right (default)" local r_outer = ImGui.GetPopupAllowedExtentRect(popup_window) local pos - pos, popup_window.AutoPosLastDirection = ImGui.FindBestWindowPosForPopupEx(bb:GetBL(), size_expected, popup_window.AutoPosLastDirection, r_outer, bb, ImGuiPopupPositionPolicy.ComboBox) + pos, popup_window.AutoPosLastDirection = ImGui.FindBestWindowPosForPopupEx(bb:GetBL(), size_expected, popup_window.AutoPosLastDirection, r_outer, bb, 1 --[[ImGuiPopupPositionPolicy.ComboBox]]) ImGui.SetNextWindowPos(pos) end end -- We don't use BeginPopupEx() solely because we have a custom name string, which we could make an argument to BeginPopupEx() - local window_flags = bit32.bor(ImGuiWindowFlags.AlwaysAutoResize, ImGuiWindowFlags.Popup, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoResize, ImGuiWindowFlags.NoSavedSettings, ImGuiWindowFlags.NoMove) - ImGui.PushStyleVarX(ImGuiStyleVar.WindowPadding, g.Style.FramePadding.x) -- Horizontally align ourselves with the framed text + local window_flags = bit32.bor(64 --[[ImGuiWindowFlags.AlwaysAutoResize]], 67108864 --[[ImGuiWindowFlags.Popup]], 1 --[[ImGuiWindowFlags.NoTitleBar]], 2 --[[ImGuiWindowFlags.NoResize]], 256 --[[ImGuiWindowFlags.NoSavedSettings]], 4 --[[ImGuiWindowFlags.NoMove]]) + ImGui.PushStyleVarX(2 --[[ImGuiStyleVar.WindowPadding]], g.Style.FramePadding.x) -- Horizontally align ourselves with the framed text local _, ret = ImGui.Begin(name, nil, window_flags) ImGui.PopStyleVar() if not ret then ImGui.EndPopup() if not g.IO.ConfigDebugBeginReturnValueOnce and not g.IO.ConfigDebugBeginReturnValueLoop then -- Begin may only return false with those debug tools activated. - IM_ASSERT(false) -- This should never happen as we tested for IsPopupOpen() above + assert(false) -- This should never happen as we tested for IsPopupOpen() above end return false end @@ -49738,11 +49781,11 @@ function ImGui.BeginComboPreview() local window = g.CurrentWindow local preview_data = g.ComboPreviewData - if window.SkipItems or not (bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.Visible) ~= 0) then + if window.SkipItems or not (bit32.band(g.LastItemData.StatusFlags, 256 --[[ImGuiItemStatusFlags.Visible]]) ~= 0) then return false end - IM_ASSERT(g.LastItemData.Rect.Min.x == preview_data.PreviewRect.Min.x and g.LastItemData.Rect.Min.y == preview_data.PreviewRect.Min.y) -- Didn't call after BeginCombo/EndCombo block or forgot to pass ImGuiComboFlags.CustomPreview flag? + assert(g.LastItemData.Rect.Min.x == preview_data.PreviewRect.Min.x and g.LastItemData.Rect.Min.y == preview_data.PreviewRect.Min.y) -- Didn't call after BeginCombo/EndCombo block or forgot to pass ImGuiComboFlags.CustomPreview flag? if not window.ClipRect:Overlaps(preview_data.PreviewRect) then -- Narrower test (optional) return false @@ -49757,7 +49800,7 @@ function ImGui.BeginComboPreview() ImVec2_Copy(window.DC.CursorPos, preview_data.PreviewRect.Min + g.Style.FramePadding) ImVec2_Copy(window.DC.CursorMaxPos, window.DC.CursorPos) - window.DC.LayoutType = ImGuiLayoutType.Horizontal + window.DC.LayoutType = 0 --[[ImGuiLayoutType.Horizontal]] window.DC.IsSameLine = false ImGui.PushClipRect(preview_data.PreviewRect.Min, preview_data.PreviewRect.Max, true) @@ -49848,18 +49891,18 @@ function ImGui.Combo(label, current_item, a, b, c, d) -- Call the getter to obtain the preview string which is a parameter to BeginCombo() local preview_value = nil - if bit32.band(bit32.bor(g.NextItemData.ItemFlagsSet, g.CurrentItemFlags), ImGuiItemFlags.MixedValue) ~= 0 then + if bit32.band(bit32.bor(g.NextItemData.ItemFlagsSet, g.CurrentItemFlags), 4096 --[[ImGuiItemFlags.MixedValue]]) ~= 0 then preview_value = "" elseif current_item >= 0 and current_item < items_count then preview_value = getter(user_data, current_item) end -- The old Combo() API exposed "popup_max_height_in_items". The new more general BeginCombo() API doesn't have/need it, but we emulate it here. - if popup_max_height_in_items ~= -1 and bit32.band(g.NextWindowData.HasFlags, ImGuiNextWindowDataFlags.HasSizeConstraint) == 0 then - ImGui.SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, CalcMaxPopupHeightFromItemCount(popup_max_height_in_items))) + if popup_max_height_in_items ~= -1 and bit32.band(g.NextWindowData.HasFlags, 16 --[[ImGuiNextWindowDataFlags.HasSizeConstraint]]) == 0 then + ImGui.SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(3.4028234663853e+38 --[[FLT_MAX]], CalcMaxPopupHeightFromItemCount(popup_max_height_in_items))) end - if not ImGui.BeginCombo(label, preview_value, ImGuiComboFlags.None) then + if not ImGui.BeginCombo(label, preview_value, 0 --[[ImGuiComboFlags.None]]) then return current_item, false end @@ -49942,7 +49985,7 @@ local GDataTypeInfo = { --- @param data_type ImGuiDataType function ImGui.DataTypeGetInfo(data_type) - IM_ASSERT(data_type >= 0 and data_type < ImGuiDataType.COUNT) + assert(data_type >= 0 and data_type < 10 --[[ImGuiDataType.COUNT]]) return GDataTypeInfo[data_type + 1] end @@ -49953,24 +49996,24 @@ end --- @param format string function ImGui.DataTypeFormatString(buf, buf_size, data_type, data, format) local str - if data_type == ImGuiDataType.S32 then + if data_type == 4 --[[ImGuiDataType.S32]] then str = ImFormatString(format, (ImS32)(data)) - elseif data_type == ImGuiDataType.U32 then + elseif data_type == 5 --[[ImGuiDataType.U32]] then str = ImFormatString(format, (ImU32)(data)) - elseif data_type == ImGuiDataType.Float then + elseif data_type == 6 --[[ImGuiDataType.Float]] then str = ImFormatString(format, data) - elseif data_type == ImGuiDataType.Double then + elseif data_type == 7 --[[ImGuiDataType.Double]] then str = ImFormatString(format, data) - elseif data_type == ImGuiDataType.S8 then + elseif data_type == 0 --[[ImGuiDataType.S8]] then str = ImFormatString(format, (ImS8)(data)) - elseif data_type == ImGuiDataType.U8 then + elseif data_type == 1 --[[ImGuiDataType.U8]] then str = ImFormatString(format, (ImU8)(data)) - elseif data_type == ImGuiDataType.S16 then + elseif data_type == 2 --[[ImGuiDataType.S16]] then str = ImFormatString(format, (ImS16)(data)) - elseif data_type == ImGuiDataType.U16 then + elseif data_type == 3 --[[ImGuiDataType.U16]] then str = ImFormatString(format, (ImU16)(data)) else - IM_ASSERT(false) + assert(false) end ImStd.ImStrncpy(buf, 1, { string.byte(str, 1, #str) }, 1, ImMin(#str + 1, buf_size)) -- TODO: update this when new ImFormatString is implemented end @@ -49980,51 +50023,51 @@ end --- @param arg1 number --- @param arg2 number function ImGui.DataTypeApplyOp(data_type, op, arg1, arg2) - IM_ASSERT(op == 43 or op == 45) -- '+' or '-' + assert(op == 43 or op == 45) -- '+' or '-' - if data_type == ImGuiDataType.S8 then + if data_type == 0 --[[ImGuiDataType.S8]] then if op == 43 then return ImAddClampOverflow(arg1, arg2, IM_S8_MIN, IM_S8_MAX) elseif op == 45 then return ImSubClampOverflow(arg1, arg2, IM_S8_MIN, IM_S8_MAX) end - elseif data_type == ImGuiDataType.U8 then + elseif data_type == 1 --[[ImGuiDataType.U8]] then if op == 43 then return ImAddClampOverflow(arg1, arg2, IM_U8_MIN, IM_U8_MAX) elseif op == 45 then return ImSubClampOverflow(arg1, arg2, IM_U8_MIN, IM_U8_MAX) end - elseif data_type == ImGuiDataType.S16 then + elseif data_type == 2 --[[ImGuiDataType.S16]] then if op == 43 then return ImAddClampOverflow((ImS16)(arg1), (ImS16)(arg2), IM_S16_MIN, IM_S16_MAX) elseif op == 45 then return ImSubClampOverflow((ImS16)(arg1), (ImS16)(arg2), IM_S16_MIN, IM_S16_MAX) end - elseif data_type == ImGuiDataType.U16 then + elseif data_type == 3 --[[ImGuiDataType.U16]] then if op == 43 then return ImAddClampOverflow((ImU16)(arg1), (ImU16)(arg2), IM_U16_MIN, IM_U16_MAX) elseif op == 45 then return ImSubClampOverflow((ImU16)(arg1), (ImU16)(arg2), IM_U16_MIN, IM_U16_MAX) end - elseif data_type == ImGuiDataType.S32 then + elseif data_type == 4 --[[ImGuiDataType.S32]] then if op == 43 then return ImAddClampOverflow(arg1, arg2, IM_S32_MIN, IM_S32_MAX) elseif op == 45 then return ImSubClampOverflow(arg1, arg2, IM_S32_MIN, IM_S32_MAX) end - elseif data_type == ImGuiDataType.U32 then + elseif data_type == 5 --[[ImGuiDataType.U32]] then if op == 43 then return ImAddClampOverflow(arg1, arg2, IM_U32_MIN, IM_U32_MAX) elseif op == 45 then return ImSubClampOverflow(arg1, arg2, IM_U32_MIN, IM_U32_MAX) end - elseif data_type == ImGuiDataType.Float then + elseif data_type == 6 --[[ImGuiDataType.Float]] then if op == 43 then return arg1 + arg2 elseif op == 45 then return arg1 - arg2 end - elseif data_type == ImGuiDataType.Double then + elseif data_type == 7 --[[ImGuiDataType.Double]] then if op == 43 then return arg1 + arg2 elseif op == 45 then @@ -50032,7 +50075,7 @@ function ImGui.DataTypeApplyOp(data_type, op, arg1, arg2) end end - IM_ASSERT(false) + assert(false) end local ImParseFormatSanitizeForScanning @@ -50064,7 +50107,7 @@ function ImGui.DataTypeApplyFromText(buf, data_type, data, format, data_when_emp -- Sanitize format -- - For float/double we have to ignore format with precision (e.g. "%.2f") because sscanf doesn't take them in, so force them into %f and %lf local format_sanitized, format_sanitized_size = {}, 32 - if (data_type == ImGuiDataType.Float or data_type == ImGuiDataType.Double) then + if (data_type == 6 --[[ImGuiDataType.Float]] or data_type == 7 --[[ImGuiDataType.Double]]) then format = type_info.ScanFmt else format = ImParseFormatSanitizeForScanning(format, format_sanitized, format_sanitized_size) @@ -50086,16 +50129,16 @@ function ImGui.DataTypeApplyFromText(buf, data_type, data, format, data_when_emp end if type_info.Size < 4 then - if data_type == ImGuiDataType.S8 then + if data_type == 0 --[[ImGuiDataType.S8]] then data = (ImS8)(ImClamp(v32, IM_S8_MIN, IM_S8_MAX)) - elseif data_type == ImGuiDataType.U8 then + elseif data_type == 1 --[[ImGuiDataType.U8]] then data = (ImU8)(ImClamp(v32, IM_U8_MIN, IM_U8_MAX)) - elseif data_type == ImGuiDataType.S16 then + elseif data_type == 2 --[[ImGuiDataType.S16]] then data = (ImS16)(ImClamp(v32, IM_S16_MIN, IM_S16_MAX)) - elseif data_type == ImGuiDataType.U16 then + elseif data_type == 3 --[[ImGuiDataType.U16]] then data = (ImU16)(ImClamp(v32, IM_U16_MIN, IM_U16_MAX)) else - IM_ASSERT(false) + assert(false) end end @@ -50115,16 +50158,16 @@ end --- @param arg1 number --- @param arg2 number function ImGui.DataTypeCompare(data_type, arg1, arg2) - if data_type == ImGuiDataType.S8 then return DataTypeCompareT((ImS8)(arg1), (ImS8)(arg2)) - elseif data_type == ImGuiDataType.U8 then return DataTypeCompareT((ImU8)(arg1), (ImU8)(arg2)) - elseif data_type == ImGuiDataType.S16 then return DataTypeCompareT((ImS16)(arg1), (ImS16)(arg2)) - elseif data_type == ImGuiDataType.U16 then return DataTypeCompareT((ImU16)(arg1), (ImU16)(arg2)) - elseif data_type == ImGuiDataType.S32 then return DataTypeCompareT((ImS32)(arg1), (ImS32)(arg2)) - elseif data_type == ImGuiDataType.U32 then return DataTypeCompareT((ImU32)(arg1), (ImU32)(arg2)) - elseif data_type == ImGuiDataType.Float then return DataTypeCompareT(arg1, arg2) - elseif data_type == ImGuiDataType.Double then return DataTypeCompareT(arg1, arg2) + if data_type == 0 --[[ImGuiDataType.S8]] then return DataTypeCompareT((ImS8)(arg1), (ImS8)(arg2)) + elseif data_type == 1 --[[ImGuiDataType.U8]] then return DataTypeCompareT((ImU8)(arg1), (ImU8)(arg2)) + elseif data_type == 2 --[[ImGuiDataType.S16]] then return DataTypeCompareT((ImS16)(arg1), (ImS16)(arg2)) + elseif data_type == 3 --[[ImGuiDataType.U16]] then return DataTypeCompareT((ImU16)(arg1), (ImU16)(arg2)) + elseif data_type == 4 --[[ImGuiDataType.S32]] then return DataTypeCompareT((ImS32)(arg1), (ImS32)(arg2)) + elseif data_type == 5 --[[ImGuiDataType.U32]] then return DataTypeCompareT((ImU32)(arg1), (ImU32)(arg2)) + elseif data_type == 6 --[[ImGuiDataType.Float]] then return DataTypeCompareT(arg1, arg2) + elseif data_type == 7 --[[ImGuiDataType.Double]] then return DataTypeCompareT(arg1, arg2) end - IM_ASSERT(false) + assert(false) return 0 end @@ -50145,16 +50188,16 @@ end --- @param min? number --- @param max? number function ImGui.DataTypeClamp(data_type, data, min, max) - if data_type == ImGuiDataType.S8 then return DataTypeClampT((ImS8)(data), min and (ImS8)(min), max and (ImS8)(max)) - elseif data_type == ImGuiDataType.U8 then return DataTypeClampT((ImU8)(data), min and (ImU8)(min), max and (ImU8)(max)) - elseif data_type == ImGuiDataType.S16 then return DataTypeClampT((ImS16)(data), min and (ImS16)(min), max and (ImS16)(max)) - elseif data_type == ImGuiDataType.U16 then return DataTypeClampT((ImU16)(data), min and (ImU16)(min), max and (ImU16)(max)) - elseif data_type == ImGuiDataType.S32 then return DataTypeClampT((ImS32)(data), min and (ImS32)(min), max and (ImS32)(max)) - elseif data_type == ImGuiDataType.U32 then return DataTypeClampT((ImU32)(data), min and (ImU32)(min), max and (ImU32)(max)) - elseif data_type == ImGuiDataType.Float then return DataTypeClampT(data, min, max) - elseif data_type == ImGuiDataType.Double then return DataTypeClampT(data, min, max) + if data_type == 0 --[[ImGuiDataType.S8]] then return DataTypeClampT((ImS8)(data), min and (ImS8)(min), max and (ImS8)(max)) + elseif data_type == 1 --[[ImGuiDataType.U8]] then return DataTypeClampT((ImU8)(data), min and (ImU8)(min), max and (ImU8)(max)) + elseif data_type == 2 --[[ImGuiDataType.S16]] then return DataTypeClampT((ImS16)(data), min and (ImS16)(min), max and (ImS16)(max)) + elseif data_type == 3 --[[ImGuiDataType.U16]] then return DataTypeClampT((ImU16)(data), min and (ImU16)(min), max and (ImU16)(max)) + elseif data_type == 4 --[[ImGuiDataType.S32]] then return DataTypeClampT((ImS32)(data), min and (ImS32)(min), max and (ImS32)(max)) + elseif data_type == 5 --[[ImGuiDataType.U32]] then return DataTypeClampT((ImU32)(data), min and (ImU32)(min), max and (ImU32)(max)) + elseif data_type == 6 --[[ImGuiDataType.Float]] then return DataTypeClampT(data, min, max) + elseif data_type == 7 --[[ImGuiDataType.Double]] then return DataTypeClampT(data, min, max) end - IM_ASSERT(false) + assert(false) return data, false end @@ -50173,7 +50216,7 @@ local min_steps = { 1.0, 0.1, 0.01, 0.001, 0.0001, 0.00001, 0.000001, 0.0000001, --- @return float function GetMinimumStepAtDecimalPrecision(decimal_precision) if decimal_precision < 0 then - return FLT_MIN + return 1.1754943508223e-38 --[[FLT_MIN]] end if decimal_precision < #min_steps then return min_steps[decimal_precision + 1] @@ -50191,7 +50234,7 @@ local ImParseFormatFindStart --- @param v number function ImGui.RoundScalarWithFormatT(format, data_type, v) -- IM_UNUSED(data_type) - IM_ASSERT(data_type == ImGuiDataType.Float or data_type == ImGuiDataType.Double) + assert(data_type == 6 --[[ImGuiDataType.Float]] or data_type == 7 --[[ImGuiDataType.Double]]) local fmt_start = ImParseFormatFindStart(format) if string.byte(format, fmt_start) ~= 37 or string.byte(format, fmt_start + 1) == 37 then return v -- Don't apply if the value is not visible in the format string @@ -50295,7 +50338,7 @@ end function ImParseFormatSanitizeForScanning(fmt_in, fmt_out, fmt_out_size) local fmt_end = ImParseFormatFindEnd(fmt_in, 1) -- IM_UNUSED(fmt_out_size) - IM_ASSERT(fmt_end < fmt_out_size) -- Format is too long, let us know if this happens to you! + assert(fmt_end < fmt_out_size) -- Format is too long, let us know if this happens to you! local has_type = false local fmt_in_begin = 1 local fmt_out_begin = 1 @@ -50360,7 +50403,7 @@ local function ImParseFormatPrecision(fmt, default_precision) c = string.byte(fmt, pos) if pos > len then break end end - local precision = INT_MAX + local precision = 2147483647 --[[INT_MAX]] if c == 46 then -- '.' precision, pos = ImAtoi(fmt, pos + 1) if precision < 0 or precision > 99 then @@ -50371,10 +50414,10 @@ local function ImParseFormatPrecision(fmt, default_precision) if c == 101 or c == 69 then -- Maximum precision with scientific notation precision = -1 end - if (c == 103 or c == 71) and precision == INT_MAX then + if (c == 103 or c == 71) and precision == 2147483647 --[[INT_MAX]] then precision = -1 end - return (precision == INT_MAX) and default_precision or precision + return (precision == 2147483647 --[[INT_MAX]]) and default_precision or precision end -- Create text input in place of another active widget (e.g. used when doing a Ctrl+Click on drag/slider widgets) @@ -50405,12 +50448,12 @@ function ImGui.TempInputText(bb, id, label, buf, buf_size, flags, callback, user local backup_pos = ImVec2() ImVec2_Copy(backup_pos, window.DC.CursorPos) ImVec2_Copy(window.DC.CursorPos, bb.Min) - g.LastItemData.ItemFlags = bit32.bor(g.LastItemData.ItemFlags, ImGuiItemFlags.AllowDuplicateId) -- Using ImGuiInputTextFlags.MergedItem above will skip ItemAdd() so we poke here. - local value_changed = ImGui.InputTextEx(label, nil, buf, buf_size, bb:GetSize(), bit32.bor(flags, ImGuiInputTextFlags.TempInput, ImGuiInputTextFlags.AutoSelectAll), callback, user_data) + g.LastItemData.ItemFlags = bit32.bor(g.LastItemData.ItemFlags, 32 --[[ImGuiItemFlags.AllowDuplicateId]]) -- Using ImGuiInputTextFlags.MergedItem above will skip ItemAdd() so we poke here. + local value_changed = ImGui.InputTextEx(label, nil, buf, buf_size, bb:GetSize(), bit32.bor(flags, 134217728 --[[ImGuiInputTextFlags.TempInput]], 4096 --[[ImGuiInputTextFlags.AutoSelectAll]]), callback, user_data) ImGui.KeepAliveID(id) -- Not done because of ImGuiInputTextFlags.TempInput if (not is_active and not is_deactivated) then -- First frame we started displaying the InputText widget, we expect it to take the active id. - IM_ASSERT(g.ActiveId == id) + assert(g.ActiveId == id) g.TempInputId = g.ActiveId end if is_active and g.ActiveId ~= id then @@ -50445,9 +50488,9 @@ function ImGui.TempInputScalar(bb, id, label, data_type, data, format, clamp_min ImGui.DataTypeFormatString(data_buf, data_buf_size, data_type, data, format) ImStd.ImStrTrimBlanks(data_buf) - local flags = bit32.bor(ImGuiInputTextFlags.AutoSelectAll, ImGuiInputTextFlags.LocalizeDecimalPoint) - g.LastItemData.ItemFlags = bit32.bor(g.LastItemData.ItemFlags, ImGuiItemFlags.NoMarkEdited) -- Because TempInputText() uses ImGuiInputTextFlags.MergedItem it doesn't submit a new item, so we poke LastItemData. - g.LastItemData.ItemFlags = (bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.LiveEditOnInputScalar) ~= 0) and bit32.bor(g.LastItemData.ItemFlags, ImGuiItemFlags.LiveEditOnInputText) or bit32.band(g.LastItemData.ItemFlags, bit32.bnot(ImGuiItemFlags.LiveEditOnInputText)) + local flags = bit32.bor(4096 --[[ImGuiInputTextFlags.AutoSelectAll]], 268435456 --[[ImGuiInputTextFlags.LocalizeDecimalPoint]]) + g.LastItemData.ItemFlags = bit32.bor(g.LastItemData.ItemFlags, 65536 --[[ImGuiItemFlags.NoMarkEdited]]) -- Because TempInputText() uses ImGuiInputTextFlags.MergedItem it doesn't submit a new item, so we poke LastItemData. + g.LastItemData.ItemFlags = (bit32.band(g.LastItemData.ItemFlags, 256 --[[ImGuiItemFlags.LiveEditOnInputScalar]]) ~= 0) and bit32.bor(g.LastItemData.ItemFlags, 128 --[[ImGuiItemFlags.LiveEditOnInputText]]) or bit32.band(g.LastItemData.ItemFlags, bit32.bnot(128 --[[ImGuiItemFlags.LiveEditOnInputText]])) if not ImGui.TempInputText(bb, id, label, data_buf, data_buf_size, flags) then return data, false end @@ -50465,7 +50508,7 @@ function ImGui.TempInputScalar(bb, id, label, data_type, data, format, clamp_min end -- Only mark as edited if new value is different - g.LastItemData.ItemFlags = bit32.band(g.LastItemData.ItemFlags, bit32.bnot(ImGuiItemFlags.NoMarkEdited)) + g.LastItemData.ItemFlags = bit32.band(g.LastItemData.ItemFlags, bit32.bnot(65536 --[[ImGuiItemFlags.NoMarkEdited]])) local value_changed = data_backup ~= data if value_changed then ImGui.MarkItemEdited(id) @@ -50499,10 +50542,10 @@ function ImGui.InputScalar(label, data_type, data, step, step_fast, format, flag format = ImGui.DataTypeGetInfo(data_type).PrintFmt end - local data_default = (bit32.band(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasRefVal) ~= 0) and g.NextItemData.RefVal or g.DataTypeZeroValue + local data_default = (bit32.band(g.NextItemData.HasFlags, 8 --[[ImGuiNextItemDataFlags.HasRefVal]]) ~= 0) and g.NextItemData.RefVal or g.DataTypeZeroValue local buf, buf_size = {}, 64 -- TODO: IM_COUNTOF() - if bit32.band(flags, ImGuiInputTextFlags.DisplayEmptyRefVal) ~= 0 and ImGui.DataTypeCompare(data_type, data, data_default) == 0 then + if bit32.band(flags, 16384 --[[ImGuiInputTextFlags.DisplayEmptyRefVal]]) ~= 0 and ImGui.DataTypeCompare(data_type, data, data_default) == 0 then buf[1] = 0 else ImGui.DataTypeFormatString(buf, buf_size, data_type, data, format) @@ -50510,8 +50553,8 @@ function ImGui.InputScalar(label, data_type, data, step, step_fast, format, flag -- Disable the MarkItemEdited() call in InputText but keep ImGuiItemStatusFlags.Edited. -- We call MarkItemEdited() ourselves by comparing the actual data rather than the string. - g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, ImGuiItemFlags.NoMarkEdited) - flags = bit32.bor(flags, ImGuiInputTextFlags.AutoSelectAll, ImGuiInputTextFlags.LocalizeDecimalPoint) + g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, 65536 --[[ImGuiItemFlags.NoMarkEdited]]) + flags = bit32.bor(flags, 4096 --[[ImGuiInputTextFlags.AutoSelectAll]], 268435456 --[[ImGuiInputTextFlags.LocalizeDecimalPoint]]) local has_step_buttons = (step ~= nil) local button_size = has_step_buttons and ImGui.GetFrameHeight() or 0.0 @@ -50530,17 +50573,17 @@ function ImGui.InputScalar(label, data_type, data, step, step_fast, format, flag -- Apply local value_changed = false - if bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.LiveEditOnInputScalar) ~= 0 then - local input_edited = bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.EditedInternal) ~= 0 -- We would be using 'ret' if ImGuiInputTextFlags.EnterReturnsTrue was not involved. + if bit32.band(g.LastItemData.ItemFlags, 256 --[[ImGuiItemFlags.LiveEditOnInputScalar]]) ~= 0 then + local input_edited = bit32.band(g.LastItemData.StatusFlags, 2048 --[[ImGuiItemStatusFlags.EditedInternal]]) ~= 0 -- We would be using 'ret' if ImGuiInputTextFlags.EnterReturnsTrue was not involved. if input_edited then - data, value_changed = ImGui.DataTypeApplyFromText(buf, data_type, data, format, bit32.band(flags, ImGuiInputTextFlags.ParseEmptyRefVal) ~= 0 and data_default or nil) + data, value_changed = ImGui.DataTypeApplyFromText(buf, data_type, data, format, bit32.band(flags, 8192 --[[ImGuiInputTextFlags.ParseEmptyRefVal]]) ~= 0 and data_default or nil) end else -- g.LastItemData.StatusFlags &= ~ImGuiItemStatusFlags_Edited if (g.DeactivatedItemData.ID == g.LastItemData.ID) then -- g.DeactivatedItemData.HasBeenEditedBefore = false; // Will be set below by MarkItemEdited() -- if (IsItemDeactivated()) // Should be unnecessary - data, value_changed = ImGui.DataTypeApplyFromText(buf, data_type, data, format, bit32.band(flags, ImGuiInputTextFlags.ParseEmptyRefVal) ~= 0 and data_default or nil) + data, value_changed = ImGui.DataTypeApplyFromText(buf, data_type, data, format, bit32.band(flags, 8192 --[[ImGuiInputTextFlags.ParseEmptyRefVal]]) ~= 0 and data_default or nil) end end @@ -50549,10 +50592,10 @@ function ImGui.InputScalar(label, data_type, data, step, step_fast, format, flag local backup_frame_padding = ImVec2() ImVec2_Copy(backup_frame_padding, style.FramePadding) style.FramePadding.x = style.FramePadding.y - if bit32.band(flags, ImGuiInputTextFlags.ReadOnly) ~= 0 then + if bit32.band(flags, 512 --[[ImGuiInputTextFlags.ReadOnly]]) ~= 0 then ImGui.BeginDisabled() end - ImGui.PushItemFlag(ImGuiItemFlags.ButtonRepeat, true) + ImGui.PushItemFlag(8 --[[ImGuiItemFlags.ButtonRepeat]], true) ImGui.SameLine(0, style.ItemInnerSpacing.x) --- @cast step number if ImGui.ButtonEx("-", ImVec2(button_size, button_size)) then @@ -50567,7 +50610,7 @@ function ImGui.InputScalar(label, data_type, data, step, step_fast, format, flag ret = true end ImGui.PopItemFlag() - if bit32.band(flags, ImGuiInputTextFlags.ReadOnly) ~= 0 then + if bit32.band(flags, 512 --[[ImGuiInputTextFlags.ReadOnly]]) ~= 0 then ImGui.EndDisabled() end local label_end = ImGui.FindRenderedTextEnd(label) @@ -50581,12 +50624,12 @@ function ImGui.InputScalar(label, data_type, data, step, step_fast, format, flag ImGui.EndGroup() end - g.LastItemData.ItemFlags = bit32.band(g.LastItemData.ItemFlags, bit32.bnot(ImGuiItemFlags.NoMarkEdited)) + g.LastItemData.ItemFlags = bit32.band(g.LastItemData.ItemFlags, bit32.bnot(65536 --[[ImGuiItemFlags.NoMarkEdited]])) if value_changed then ImGui.MarkItemEdited(g.LastItemData.ID) end - if bit32.band(flags, ImGuiInputTextFlags.EnterReturnsTrue) ~= 0 then + if bit32.band(flags, 64 --[[ImGuiInputTextFlags.EnterReturnsTrue]]) ~= 0 then return data, ret end return data, value_changed @@ -50644,27 +50687,27 @@ end function ImGui.InputFloat3(label, v, format, flags) if format == nil then format = "%.3f" end - return ImGui.InputScalarN(label, ImGuiDataType.Float, v, 3, nil, nil, format, flags) + return ImGui.InputScalarN(label, 6 --[[ImGuiDataType.Float]], v, 3, nil, nil, format, flags) end function ImGui.InputFloat2(label, v, format, flags) - return ImGui.InputScalarN(label, ImGuiDataType.Float, v, 2, nil, nil, format or "%.3f", flags) + return ImGui.InputScalarN(label, 6 --[[ImGuiDataType.Float]], v, 2, nil, nil, format or "%.3f", flags) end function ImGui.InputFloat4(label, v, format, flags) - return ImGui.InputScalarN(label, ImGuiDataType.Float, v, 4, nil, nil, format or "%.3f", flags) + return ImGui.InputScalarN(label, 6 --[[ImGuiDataType.Float]], v, 4, nil, nil, format or "%.3f", flags) end function ImGui.InputInt2(label, v, flags) - return ImGui.InputScalarN(label, ImGuiDataType.S32, v, 2, nil, nil, "%d", flags) + return ImGui.InputScalarN(label, 4 --[[ImGuiDataType.S32]], v, 2, nil, nil, "%d", flags) end function ImGui.InputInt3(label, v, flags) - return ImGui.InputScalarN(label, ImGuiDataType.S32, v, 3, nil, nil, "%d", flags) + return ImGui.InputScalarN(label, 4 --[[ImGuiDataType.S32]], v, 3, nil, nil, "%d", flags) end function ImGui.InputInt4(label, v, flags) - return ImGui.InputScalarN(label, ImGuiDataType.S32, v, 4, nil, nil, "%d", flags) + return ImGui.InputScalarN(label, 4 --[[ImGuiDataType.S32]], v, 4, nil, nil, "%d", flags) end --- @param label string @@ -50678,8 +50721,8 @@ function ImGui.InputInt(label, v, step, step_fast, flags) if flags == nil then flags = 0 end -- Hexadecimal input provided as a convenience but the flag name is awkward. Typically you'd use InputText() to parse your own data, if you want to handle prefixes. - local format = (bit32.band(flags, ImGuiInputTextFlags.CharsHexadecimal) ~= 0) and "%08X" or "%d" - return ImGui.InputScalar(label, ImGuiDataType.S32, v, (step > 0) and step or nil, (step_fast > 0) and step_fast or nil, format, flags) + local format = (bit32.band(flags, 2 --[[ImGuiInputTextFlags.CharsHexadecimal]]) ~= 0) and "%08X" or "%d" + return ImGui.InputScalar(label, 4 --[[ImGuiDataType.S32]], v, (step > 0) and step or nil, (step_fast > 0) and step_fast or nil, format, flags) end --- @param label string @@ -50693,7 +50736,7 @@ function ImGui.InputFloat(label, v, step, step_fast, format, flags) if step_fast == nil then step_fast = .0 end if format == nil then format = "%.3f" end - return ImGui.InputScalar(label, ImGuiDataType.Float, v, (step > 0.0 and step or nil), (step_fast > 0.0 and step_fast or nil), format, flags) + return ImGui.InputScalar(label, 6 --[[ImGuiDataType.Float]], v, (step > 0.0 and step or nil), (step_fast > 0.0 and step_fast or nil), format, flags) end --- @param label string @@ -50707,7 +50750,7 @@ function ImGui.InputDouble(label, v, step, step_fast, format, flags) if step_fast == nil then step_fast = .0 end if format == nil then format = "%.6f" end - return ImGui.InputScalar(label, ImGuiDataType.Double, v, (step > 0.0 and step or nil), (step_fast > 0.0 and step_fast or nil), format, flags) + return ImGui.InputScalar(label, 7 --[[ImGuiDataType.Double]], v, (step > 0.0 and step or nil), (step_fast > 0.0 and step_fast or nil), format, flags) end ------------------------------------------------------------------------------- @@ -50744,11 +50787,11 @@ end --- @return bool changed function ImGui.DragBehaviorT(TYPE, SIGNEDTYPE, data_type, v, v_speed, v_min, v_max, format, flags) local g = GImGui - local axis = (bit32.band(flags, ImGuiSliderFlags.Vertical) ~= 0) and ImGuiAxis.Y or ImGuiAxis.X - local is_bounded = (v_min < v_max) or ((v_min == v_max) and (v_min ~= 0.0 or (bit32.band(flags, ImGuiSliderFlags.ClampZeroRange) ~= 0))) - local is_wrapped = is_bounded and (bit32.band(flags, ImGuiSliderFlags.WrapAround) ~= 0) - local is_logarithmic = bit32.band(flags, ImGuiSliderFlags.Logarithmic) ~= 0 - local is_floating_point = (data_type == ImGuiDataType.Float) or (data_type == ImGuiDataType.Double) + local axis = (bit32.band(flags, 1048576 --[[ImGuiSliderFlags.Vertical]]) ~= 0) and 2 --[[ImGuiAxis.Y]] or 1 --[[ImGuiAxis.X]] + local is_bounded = (v_min < v_max) or ((v_min == v_max) and (v_min ~= 0.0 or (bit32.band(flags, 1024 --[[ImGuiSliderFlags.ClampZeroRange]]) ~= 0))) + local is_wrapped = is_bounded and (bit32.band(flags, 256 --[[ImGuiSliderFlags.WrapAround]]) ~= 0) + local is_logarithmic = bit32.band(flags, 32 --[[ImGuiSliderFlags.Logarithmic]]) ~= 0 + local is_floating_point = (data_type == 6 --[[ImGuiDataType.Float]]) or (data_type == 7 --[[ImGuiDataType.Double]]) -- Default tweak speed if v_speed == 0.0 and is_bounded and (v_max - v_min < math.huge) then @@ -50757,26 +50800,26 @@ function ImGui.DragBehaviorT(TYPE, SIGNEDTYPE, data_type, v, v_speed, v_min, v_m -- Inputs accumulates into g.DragCurrentAccum, which is flushed into the current value as soon as it makes a difference with our precision settings local adjust_delta = 0.0 - if g.ActiveIdSource == ImGuiInputSource.Mouse and ImGui.IsMousePosValid() and ImGui.IsMouseDragPastThreshold(0, g.IO.MouseDragThreshold * DRAG_MOUSE_THRESHOLD_FACTOR) then + if g.ActiveIdSource == 1 --[[ImGuiInputSource.Mouse]] and ImGui.IsMousePosValid() and ImGui.IsMouseDragPastThreshold(0, g.IO.MouseDragThreshold * DRAG_MOUSE_THRESHOLD_FACTOR) then adjust_delta = g.IO.MouseDelta[axis] - if g.IO.KeyAlt and bit32.band(flags, ImGuiSliderFlags.NoSpeedTweaks) == 0 then + if g.IO.KeyAlt and bit32.band(flags, 2048 --[[ImGuiSliderFlags.NoSpeedTweaks]]) == 0 then adjust_delta = adjust_delta / 100.0 end - if g.IO.KeyShift and bit32.band(flags, ImGuiSliderFlags.NoSpeedTweaks) == 0 then + if g.IO.KeyShift and bit32.band(flags, 2048 --[[ImGuiSliderFlags.NoSpeedTweaks]]) == 0 then adjust_delta = adjust_delta * 10.0 end - elseif g.ActiveIdSource == ImGuiInputSource.Keyboard or g.ActiveIdSource == ImGuiInputSource.Gamepad then + elseif g.ActiveIdSource == 2 --[[ImGuiInputSource.Keyboard]] or g.ActiveIdSource == 3 --[[ImGuiInputSource.Gamepad]] then local decimal_precision if is_floating_point then decimal_precision = ImParseFormatPrecision(format, 3) else decimal_precision = 0 end - local slow_key = (g.NavInputSource == ImGuiInputSource.Gamepad) and ImGuiKey.NavGamepadTweakSlow or ImGuiKey.NavKeyboardTweakSlow - local fast_key = (g.NavInputSource == ImGuiInputSource.Gamepad) and ImGuiKey.NavGamepadTweakFast or ImGuiKey.NavKeyboardTweakFast + local slow_key = (g.NavInputSource == 3 --[[ImGuiInputSource.Gamepad]]) and 642 --[[ImGuiKey.NavGamepadTweakSlow]] or 4096 --[[ImGuiKey.NavKeyboardTweakSlow]] + local fast_key = (g.NavInputSource == 3 --[[ImGuiInputSource.Gamepad]]) and 643 --[[ImGuiKey.NavGamepadTweakFast]] or 8192 --[[ImGuiKey.NavKeyboardTweakFast]] local tweak_factor - if bit32.band(flags, ImGuiSliderFlags.NoSpeedTweaks) ~= 0 then + if bit32.band(flags, 2048 --[[ImGuiSliderFlags.NoSpeedTweaks]]) ~= 0 then tweak_factor = 1.0 elseif ImGui.IsKeyDown(slow_key) then tweak_factor = 1.0 / 10.0 @@ -50792,12 +50835,12 @@ function ImGui.DragBehaviorT(TYPE, SIGNEDTYPE, data_type, v, v_speed, v_min, v_m adjust_delta = adjust_delta * v_speed -- For vertical drag we currently assume that Up=higher value (like we do with vertical sliders). This may become a parameter. - if axis == ImGuiAxis.Y then + if axis == 2 --[[ImGuiAxis.Y]] then adjust_delta = -adjust_delta end -- For logarithmic use our range is effectively 0..1 so scale the delta into that range - if is_logarithmic and (v_max - v_min < FLT_MAX) and (v_max - v_min > 0.000001) then -- Epsilon to avoid /0 + if is_logarithmic and (v_max - v_min < 3.4028234663853e+38 --[[FLT_MAX]]) and (v_max - v_min > 0.000001) then -- Epsilon to avoid /0 adjust_delta = adjust_delta / (v_max - v_min) end @@ -50842,7 +50885,7 @@ function ImGui.DragBehaviorT(TYPE, SIGNEDTYPE, data_type, v, v_speed, v_min, v_m end -- Round to user desired precision based on format string - if is_floating_point and bit32.band(flags, ImGuiSliderFlags.NoRoundToFormat) == 0 then + if is_floating_point and bit32.band(flags, 64 --[[ImGuiSliderFlags.NoRoundToFormat]]) == 0 then v_cur = ImGui.RoundScalarWithFormatT(format, data_type, v_cur) end @@ -50900,43 +50943,43 @@ end function ImGui.DragBehavior(id, data_type, v, v_speed, min, max, format, flags) -- Read imgui.cpp "API BREAKING CHANGES" section for 1.78 if you hit this assert. - IM_ASSERT((flags == 1 or bit32.band(flags, ImGuiSliderFlags.InvalidMask_) == 0), "Invalid ImGuiSliderFlags flags! Has the legacy 'float power' argument been mistakenly cast to flags? Call function with ImGuiSliderFlags_Logarithmic flags instead.") + assert((flags == 1 or bit32.band(flags, 1879048207 --[[ImGuiSliderFlags.InvalidMask_]]) == 0), "Invalid ImGuiSliderFlags flags! Has the legacy 'float power' argument been mistakenly cast to flags? Call function with ImGuiSliderFlags_Logarithmic flags instead.") -- Things we can do easily outside the DragBehaviorT<> template, saves code generation. local g = GImGui if g.ActiveId == id then - if g.ActiveIdSource == ImGuiInputSource.Mouse and not g.IO.MouseDown[0] then + if g.ActiveIdSource == 1 --[[ImGuiInputSource.Mouse]] and not g.IO.MouseDown[0] then ImGui.ClearActiveID() - elseif (g.ActiveIdSource == ImGuiInputSource.Keyboard or g.ActiveIdSource == ImGuiInputSource.Gamepad) and g.NavActivatePressedId == id and not g.ActiveIdIsJustActivated then + elseif (g.ActiveIdSource == 2 --[[ImGuiInputSource.Keyboard]] or g.ActiveIdSource == 3 --[[ImGuiInputSource.Gamepad]]) and g.NavActivatePressedId == id and not g.ActiveIdIsJustActivated then ImGui.ClearActiveID() end end if g.ActiveId ~= id then return v, false end - if bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.ReadOnly) ~= 0 or bit32.band(flags, ImGuiSliderFlags.ReadOnly) ~= 0 then + if bit32.band(g.LastItemData.ItemFlags, 2048 --[[ImGuiItemFlags.ReadOnly]]) ~= 0 or bit32.band(flags, 2097152 --[[ImGuiSliderFlags.ReadOnly]]) ~= 0 then return v, false end - if data_type == ImGuiDataType.S8 then - return ImGui.DragBehaviorT(ImS32, ImS32, ImGuiDataType.S32, v, v_speed, min and min or IM_S8_MIN, max and max or IM_S8_MAX, format, flags) - elseif data_type == ImGuiDataType.U8 then - return ImGui.DragBehaviorT(ImU32, ImS32, ImGuiDataType.U32, v, v_speed, min and min or IM_U8_MIN, max and max or IM_U8_MAX, format, flags) - elseif data_type == ImGuiDataType.S16 then - return ImGui.DragBehaviorT(ImS32, ImS32, ImGuiDataType.S32, v, v_speed, min and min or IM_S16_MIN, max and max or IM_S16_MAX, format, flags) - elseif data_type == ImGuiDataType.U16 then - return ImGui.DragBehaviorT(ImU32, ImS32, ImGuiDataType.U32, v, v_speed, min and min or IM_U16_MIN, max and max or IM_U16_MAX, format, flags) - elseif data_type == ImGuiDataType.S32 then + if data_type == 0 --[[ImGuiDataType.S8]] then + return ImGui.DragBehaviorT(ImS32, ImS32, 4 --[[ImGuiDataType.S32]], v, v_speed, min and min or IM_S8_MIN, max and max or IM_S8_MAX, format, flags) + elseif data_type == 1 --[[ImGuiDataType.U8]] then + return ImGui.DragBehaviorT(ImU32, ImS32, 5 --[[ImGuiDataType.U32]], v, v_speed, min and min or IM_U8_MIN, max and max or IM_U8_MAX, format, flags) + elseif data_type == 2 --[[ImGuiDataType.S16]] then + return ImGui.DragBehaviorT(ImS32, ImS32, 4 --[[ImGuiDataType.S32]], v, v_speed, min and min or IM_S16_MIN, max and max or IM_S16_MAX, format, flags) + elseif data_type == 3 --[[ImGuiDataType.U16]] then + return ImGui.DragBehaviorT(ImU32, ImS32, 5 --[[ImGuiDataType.U32]], v, v_speed, min and min or IM_U16_MIN, max and max or IM_U16_MAX, format, flags) + elseif data_type == 4 --[[ImGuiDataType.S32]] then return ImGui.DragBehaviorT(ImS32, ImS32, data_type, v, v_speed, min and min or IM_S32_MIN, max and max or IM_S32_MAX, format, flags) - elseif data_type == ImGuiDataType.U32 then + elseif data_type == 5 --[[ImGuiDataType.U32]] then return ImGui.DragBehaviorT(ImU32, ImS32, data_type, v, v_speed, min and min or IM_U32_MIN, max and max or IM_U32_MAX, format, flags) - elseif data_type == ImGuiDataType.Float then - return ImGui.DragBehaviorT(float, float, data_type, v, v_speed, min and min or -FLT_MAX, max and max or FLT_MAX, format, flags) - elseif data_type == ImGuiDataType.Double then - return ImGui.DragBehaviorT(double, double, data_type, v, v_speed, min and min or -DBL_MAX, max and max or DBL_MAX, format, flags) + elseif data_type == 6 --[[ImGuiDataType.Float]] then + return ImGui.DragBehaviorT(float, float, data_type, v, v_speed, min and min or -3.4028234663853e+38 --[[FLT_MAX]], max and max or 3.4028234663853e+38 --[[FLT_MAX]], format, flags) + elseif data_type == 7 --[[ImGuiDataType.Double]] then + return ImGui.DragBehaviorT(double, double, data_type, v, v_speed, min and min or -1.7976931348623e+308 --[[DBL_MAX]], max and max or 1.7976931348623e+308 --[[DBL_MAX]], format, flags) end - IM_ASSERT(false) + assert(false) return v, false end @@ -50946,7 +50989,7 @@ end --- @param min number --- @param max number local function TempInputIsClampEnabled(flags, data_type, min, max) - if bit32.band(flags, ImGuiSliderFlags.ClampOnInput) ~= 0 and (min ~= nil or max ~= nil) then + if bit32.band(flags, 512 --[[ImGuiSliderFlags.ClampOnInput]]) ~= 0 and (min ~= nil or max ~= nil) then local clamp_range_dir = 0 if min ~= nil and max ~= nil then clamp_range_dir = ImGui.DataTypeCompare(data_type, min, max) -- -1 when min < max, == 0 when min == max @@ -50955,7 +50998,7 @@ local function TempInputIsClampEnabled(flags, data_type, min, max) return true end if clamp_range_dir == 0 then - return ImGui.DataTypeIsZero(data_type, min) and (bit32.band(flags, ImGuiSliderFlags.ClampZeroRange) ~= 0) or true + return ImGui.DataTypeIsZero(data_type, min) and (bit32.band(flags, 1024 --[[ImGuiSliderFlags.ClampZeroRange]]) ~= 0) or true end end return false @@ -51000,7 +51043,7 @@ function ImGui.DragScalar(label, data_type, data, v_speed, min, max, format, fla local style = g.Style local id = window:GetID(label) local w = ImGui.CalcItemWidth() - local color_marker = (bit32.band(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasColorMarker) ~= 0) and g.NextItemData.ColorMarker or 0 + local color_marker = (bit32.band(g.NextItemData.HasFlags, 32 --[[ImGuiNextItemDataFlags.HasColorMarker]]) ~= 0) and g.NextItemData.ColorMarker or 0 local label_end = ImGui.FindRenderedTextEnd(label) local label_size = ImGui.CalcTextSize(label, label_end, false) @@ -51010,9 +51053,9 @@ function ImGui.DragScalar(label, data_type, data, v_speed, min, max, format, fla total_bb.Min.x = frame_bb.Min.x; total_bb.Min.y = frame_bb.Min.y total_bb.Max.x = frame_bb.Max.x + ((label_size.x > 0.0) and (style.ItemInnerSpacing.x + label_size.x) or 0.0); total_bb.Max.y = frame_bb.Max.y + 0.0 - local temp_input_allowed = (bit32.band(flags, ImGuiSliderFlags.NoInput) == 0) + local temp_input_allowed = (bit32.band(flags, 128 --[[ImGuiSliderFlags.NoInput]]) == 0) ImGui.ItemSize(total_bb, style.FramePadding.y) - if not ImGui.ItemAdd(total_bb, id, frame_bb, temp_input_allowed and ImGuiItemFlags.Inputable or 0) then + if not ImGui.ItemAdd(total_bb, id, frame_bb, temp_input_allowed and 1048576 --[[ImGuiItemFlags.Inputable]] or 0) then return data, false end @@ -51025,14 +51068,14 @@ function ImGui.DragScalar(label, data_type, data, v_speed, min, max, format, fla local temp_input_is_active = temp_input_allowed and ImGui.TempInputIsActive(id) if not temp_input_is_active then -- Tabbing or Ctrl+Click on Drag turns it into an InputText - local clicked = hovered and ImGui.IsMouseClickedEx(0, ImGuiInputFlags.None, id) - local double_clicked = (hovered and g.IO.MouseClickedCount[0] == 2 and ImGui.TestKeyOwner(ImGuiKey.MouseLeft, id)) + local clicked = hovered and ImGui.IsMouseClickedEx(0, 0 --[[ImGuiInputFlags.None]], id) + local double_clicked = (hovered and g.IO.MouseClickedCount[0] == 2 and ImGui.TestKeyOwner(656 --[[ImGuiKey.MouseLeft]], id)) local make_active = (clicked or double_clicked or g.NavActivateId == id) if make_active and (clicked or double_clicked) then - ImGui.SetKeyOwner(ImGuiKey.MouseLeft, id) + ImGui.SetKeyOwner(656 --[[ImGuiKey.MouseLeft]], id) end if make_active and temp_input_allowed then - if (clicked and g.IO.KeyCtrl) or double_clicked or (g.NavActivateId == id and bit32.band(g.NavActivateFlags, ImGuiActivateFlags.PreferInput) ~= 0) then + if (clicked and g.IO.KeyCtrl) or double_clicked or (g.NavActivateId == id and bit32.band(g.NavActivateFlags, 1 --[[ImGuiActivateFlags.PreferInput]]) ~= 0) then temp_input_is_active = true end end @@ -51041,7 +51084,7 @@ function ImGui.DragScalar(label, data_type, data, v_speed, min, max, format, fla if g.IO.ConfigDragClickToInputText and temp_input_allowed and not temp_input_is_active then if g.ActiveId == id and hovered and g.IO.MouseReleased[0] and not ImGui.IsMouseDragPastThreshold(0, g.IO.MouseDragThreshold * DRAG_MOUSE_THRESHOLD_FACTOR) then g.NavActivateId = id - g.NavActivateFlags = ImGuiActivateFlags.PreferInput + g.NavActivateFlags = 1 --[[ImGuiActivateFlags.PreferInput]] temp_input_is_active = true end end @@ -51055,7 +51098,7 @@ function ImGui.DragScalar(label, data_type, data, v_speed, min, max, format, fla ImGui.SetActiveID(id, window) ImGui.SetFocusID(id, window) ImGui.FocusWindow(window) - g.ActiveIdUsingNavDirMask = bit32.bor(bit32.lshift(1, ImGuiDir.Left), bit32.lshift(1, ImGuiDir.Right)) + g.ActiveIdUsingNavDirMask = bit32.bor(bit32.lshift(1, 0 --[[ImGuiDir.Left]]), bit32.lshift(1, 1 --[[ImGuiDir.Right]])) end end @@ -51065,7 +51108,7 @@ function ImGui.DragScalar(label, data_type, data, v_speed, min, max, format, fla end -- Draw frame - local frame_col = ImGui.GetColorU32(g.ActiveId == id and ImGuiCol.FrameBgActive or hovered and ImGuiCol.FrameBgHovered or ImGuiCol.FrameBg) + local frame_col = ImGui.GetColorU32(g.ActiveId == id and 9 --[[ImGuiCol.FrameBgActive]] or hovered and 8 --[[ImGuiCol.FrameBgHovered]] or 7 --[[ImGuiCol.FrameBg]]) ImGui.RenderNavCursor(frame_bb, id) ImGui.RenderFrame(frame_bb.Min, frame_bb.Max, frame_col, false, style.FrameRounding) @@ -51108,7 +51151,7 @@ function ImGui.DragFloat(label, v, v_speed, v_min, v_max, format, flags) if format == nil then format = "%.3f" end if flags == nil then flags = 0 end - return ImGui.DragScalar(label, ImGuiDataType.Float, v, v_speed, v_min, v_max, format, flags) + return ImGui.DragScalar(label, 6 --[[ImGuiDataType.Float]], v, v_speed, v_min, v_max, format, flags) end -- NB: v_speed is float to allow adjusting the drag speed with more precision @@ -51127,7 +51170,7 @@ function ImGui.DragInt(label, v, v_speed, v_min, v_max, format, flags) if format == nil then format = "%d" end if flags == nil then flags = 0 end - return ImGui.DragScalar(label, ImGuiDataType.S32, v, v_speed, v_min, v_max, format, flags) + return ImGui.DragScalar(label, 4 --[[ImGuiDataType.S32]], v, v_speed, v_min, v_max, format, flags) end -- `v` is mutated in place (1-based), returns value_changed @@ -51150,7 +51193,7 @@ function ImGui.DragScalarN(label, data_type, v, components, v_speed, v_min, v_ma if i > 1 then ImGui.SameLine(0, g.Style.ItemInnerSpacing.x) end - if bit32.band(flags, ImGuiSliderFlags.ColorMarkers) ~= 0 then + if bit32.band(flags, 4096 --[[ImGuiSliderFlags.ColorMarkers]]) ~= 0 then ImGui.SetNextItemColorMarker(GDefaultRgbaColorMarkers[i]) end local changed @@ -51173,12 +51216,12 @@ end local function DragFloatN(n) return function(label, v, v_speed, v_min, v_max, format, flags) - return ImGui.DragScalarN(label, ImGuiDataType.Float, v, n, v_speed or 1.0, v_min or 0.0, v_max or 0.0, format or "%.3f", flags or 0) + return ImGui.DragScalarN(label, 6 --[[ImGuiDataType.Float]], v, n, v_speed or 1.0, v_min or 0.0, v_max or 0.0, format or "%.3f", flags or 0) end end local function DragIntN(n) return function(label, v, v_speed, v_min, v_max, format, flags) - return ImGui.DragScalarN(label, ImGuiDataType.S32, v, n, v_speed or 1.0, v_min or 0, v_max or 0, format or "%d", flags or 0) + return ImGui.DragScalarN(label, 4 --[[ImGuiDataType.S32]], v, n, v_speed or 1.0, v_min or 0, v_max or 0, format or "%d", flags or 0) end end ImGui.DragFloat2 = DragFloatN(2) @@ -51199,15 +51242,15 @@ local function DragRange2(data_type, label, v_current_min, v_current_max, v_spee end local g = GImGui - local lo = (data_type == ImGuiDataType.Float) and -FLT_MAX or INT_MIN - local hi = (data_type == ImGuiDataType.Float) and FLT_MAX or INT_MAX + local lo = (data_type == 6 --[[ImGuiDataType.Float]]) and -3.4028234663853e+38 --[[FLT_MAX]] or (-2147483648) --[[INT_MIN]] + local hi = (data_type == 6 --[[ImGuiDataType.Float]]) and 3.4028234663853e+38 --[[FLT_MAX]] or 2147483647 --[[INT_MAX]] ImGui.PushID(label) ImGui.BeginGroup() ImGui.PushMultiItemsWidths(2, ImGui.CalcItemWidth()) local min_min = (v_min >= v_max) and lo or v_min local min_max = (v_min >= v_max) and v_current_max or ImMin(v_max, v_current_max) - local min_flags = bit32.bor(flags, (min_min == min_max) and ImGuiSliderFlags.ReadOnly or 0) + local min_flags = bit32.bor(flags, (min_min == min_max) and 2097152 --[[ImGuiSliderFlags.ReadOnly]] or 0) local value_changed, changed v_current_min, value_changed = ImGui.DragScalar("##min", data_type, v_current_min, v_speed, min_min, min_max, format, min_flags) ImGui.PopItemWidth() @@ -51215,7 +51258,7 @@ local function DragRange2(data_type, label, v_current_min, v_current_max, v_spee local max_min = (v_min >= v_max) and v_current_min or ImMax(v_min, v_current_min) local max_max = (v_min >= v_max) and hi or v_max - local max_flags = bit32.bor(flags, (max_min == max_max) and ImGuiSliderFlags.ReadOnly or 0) + local max_flags = bit32.bor(flags, (max_min == max_max) and 2097152 --[[ImGuiSliderFlags.ReadOnly]] or 0) v_current_max, changed = ImGui.DragScalar("##max", data_type, v_current_max, v_speed, max_min, max_max, format_max or format, max_flags) value_changed = value_changed or changed ImGui.PopItemWidth() @@ -51229,11 +51272,11 @@ local function DragRange2(data_type, label, v_current_min, v_current_max, v_spee end function ImGui.DragFloatRange2(label, v_current_min, v_current_max, v_speed, v_min, v_max, format, format_max, flags) - return DragRange2(ImGuiDataType.Float, label, v_current_min, v_current_max, v_speed or 1.0, v_min or 0.0, v_max or 0.0, format or "%.3f", format_max, flags or 0) + return DragRange2(6 --[[ImGuiDataType.Float]], label, v_current_min, v_current_max, v_speed or 1.0, v_min or 0.0, v_max or 0.0, format or "%.3f", format_max, flags or 0) end function ImGui.DragIntRange2(label, v_current_min, v_current_max, v_speed, v_min, v_max, format, format_max, flags) - return DragRange2(ImGuiDataType.S32, label, v_current_min, v_current_max, v_speed or 1.0, v_min or 0, v_max or 0, format or "%d", format_max, flags or 0) + return DragRange2(4 --[[ImGuiDataType.S32]], label, v_current_min, v_current_max, v_speed or 1.0, v_min or 0, v_max or 0, format or "%d", format_max, flags or 0) end ------------------------------------------------------------------------------- @@ -51400,7 +51443,7 @@ function ImGui.ScaleValueFromRatioT(TYPE, SIGNEDTYPE, data_type, t, v_min, v_max end else -- Linear slider - local is_floating_point = (data_type == ImGuiDataType.Float) or (data_type == ImGuiDataType.Double) + local is_floating_point = (data_type == 6 --[[ImGuiDataType.Float]]) or (data_type == 7 --[[ImGuiDataType.Double]]) if is_floating_point then result = ImLerp(v_min, v_max, t) elseif t < 1.0 then -- t is already < 1.0 here @@ -51435,10 +51478,10 @@ function ImGui.SliderBehaviorT(TYPE, SIGNEDTYPE, bb, id, data_type, v, v_min, v_ local g = GImGui local style = g.Style - local axis = (bit32.band(flags, ImGuiSliderFlags.Vertical) ~= 0) and ImGuiAxis.Y or ImGuiAxis.X - local axis_k = (axis == ImGuiAxis.X) and "x" or "y" -- [Luau] named key: ImVec2[axis] goes through IM_VEC2.__index - local is_logarithmic = bit32.band(flags, ImGuiSliderFlags.Logarithmic) ~= 0 - local is_floating_point = (data_type == ImGuiDataType.Float) or (data_type == ImGuiDataType.Double) + local axis = (bit32.band(flags, 1048576 --[[ImGuiSliderFlags.Vertical]]) ~= 0) and 2 --[[ImGuiAxis.Y]] or 1 --[[ImGuiAxis.X]] + local axis_k = (axis == 1 --[[ImGuiAxis.X]]) and "x" or "y" -- [Luau] named key: ImVec2[axis] goes through IM_VEC2.__index + local is_logarithmic = bit32.band(flags, 32 --[[ImGuiSliderFlags.Logarithmic]]) ~= 0 + local is_floating_point = (data_type == 6 --[[ImGuiDataType.Float]]) or (data_type == 7 --[[ImGuiDataType.Double]]) local v_range_f = (v_min < v_max) and (v_max - v_min) or (v_min - v_max) -- We don't need high precision for what we do with it. -- Calculate bounds @@ -51467,14 +51510,14 @@ function ImGui.SliderBehaviorT(TYPE, SIGNEDTYPE, bb, id, data_type, v, v_min, v_ if g.ActiveId == id then local set_new_value = false local clicked_t = 0.0 - if g.ActiveIdSource == ImGuiInputSource.Mouse then + if g.ActiveIdSource == 1 --[[ImGuiInputSource.Mouse]] then if not g.IO.MouseDown[0] then ImGui.ClearActiveID() else local mouse_abs_pos = g.IO.MousePos[axis_k] if g.ActiveIdIsJustActivated then local grab_t = ImGui.ScaleRatioFromValueT(data_type, v, v_min, v_max, logarithmic_zero_epsilon, zero_deadzone_halfsize) - if axis == ImGuiAxis.Y then + if axis == 2 --[[ImGuiAxis.Y]] then grab_t = 1.0 - grab_t end local grab_pos = ImLerp(slider_usable_pos_min, slider_usable_pos_max, grab_t) @@ -51484,21 +51527,21 @@ function ImGui.SliderBehaviorT(TYPE, SIGNEDTYPE, bb, id, data_type, v, v_min, v_ if slider_usable_sz > 0.0 then clicked_t = ImSaturate((mouse_abs_pos - g.SliderGrabClickOffset - slider_usable_pos_min) / slider_usable_sz) end - if axis == ImGuiAxis.Y then + if axis == 2 --[[ImGuiAxis.Y]] then clicked_t = 1.0 - clicked_t end set_new_value = true end - elseif g.ActiveIdSource == ImGuiInputSource.Keyboard or g.ActiveIdSource == ImGuiInputSource.Gamepad then + elseif g.ActiveIdSource == 2 --[[ImGuiInputSource.Keyboard]] or g.ActiveIdSource == 3 --[[ImGuiInputSource.Gamepad]] then if g.ActiveIdIsJustActivated then g.SliderCurrentAccum = 0.0 -- Reset any stored nav delta upon activation g.SliderCurrentAccumDirty = false end - local input_delta = (axis == ImGuiAxis.X) and ImGui.GetNavTweakPressedAmount(axis) or -ImGui.GetNavTweakPressedAmount(axis) + local input_delta = (axis == 1 --[[ImGuiAxis.X]]) and ImGui.GetNavTweakPressedAmount(axis) or -ImGui.GetNavTweakPressedAmount(axis) if input_delta ~= 0.0 then - local tweak_slow = ImGui.IsKeyDown((g.NavInputSource == ImGuiInputSource.Gamepad) and ImGuiKey.NavGamepadTweakSlow or ImGuiKey.NavKeyboardTweakSlow) - local tweak_fast = ImGui.IsKeyDown((g.NavInputSource == ImGuiInputSource.Gamepad) and ImGuiKey.NavGamepadTweakFast or ImGuiKey.NavKeyboardTweakFast) + local tweak_slow = ImGui.IsKeyDown((g.NavInputSource == 3 --[[ImGuiInputSource.Gamepad]]) and 642 --[[ImGuiKey.NavGamepadTweakSlow]] or 4096 --[[ImGuiKey.NavKeyboardTweakSlow]]) + local tweak_fast = ImGui.IsKeyDown((g.NavInputSource == 3 --[[ImGuiInputSource.Gamepad]]) and 643 --[[ImGuiKey.NavGamepadTweakFast]] or 8192 --[[ImGuiKey.NavKeyboardTweakFast]]) local decimal_precision = is_floating_point and ImParseFormatPrecision(format, 3) or 0 if decimal_precision > 0 then input_delta = input_delta / 100.0 -- Keyboard/Gamepad tweak speeds in % of slider bounds @@ -51536,7 +51579,7 @@ function ImGui.SliderBehaviorT(TYPE, SIGNEDTYPE, bb, id, data_type, v, v_min, v_ -- Calculate what our "new" clicked_t will be, and thus how far we actually moved the slider, and subtract this from the accumulator local v_new = ImGui.ScaleValueFromRatioT(TYPE, SIGNEDTYPE, data_type, clicked_t, v_min, v_max, logarithmic_zero_epsilon, zero_deadzone_halfsize) - if is_floating_point and bit32.band(flags, ImGuiSliderFlags.NoRoundToFormat) == 0 then + if is_floating_point and bit32.band(flags, 64 --[[ImGuiSliderFlags.NoRoundToFormat]]) == 0 then v_new = ImGui.RoundScalarWithFormatT(format, data_type, v_new) end local new_clicked_t = ImGui.ScaleRatioFromValueT(data_type, v_new, v_min, v_max, logarithmic_zero_epsilon, zero_deadzone_halfsize) @@ -51553,7 +51596,7 @@ function ImGui.SliderBehaviorT(TYPE, SIGNEDTYPE, bb, id, data_type, v, v_min, v_ end if set_new_value then - if (bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.ReadOnly) ~= 0) or (bit32.band(flags, ImGuiSliderFlags.ReadOnly) ~= 0) then + if (bit32.band(g.LastItemData.ItemFlags, 2048 --[[ImGuiItemFlags.ReadOnly]]) ~= 0) or (bit32.band(flags, 2097152 --[[ImGuiSliderFlags.ReadOnly]]) ~= 0) then set_new_value = false end end @@ -51562,7 +51605,7 @@ function ImGui.SliderBehaviorT(TYPE, SIGNEDTYPE, bb, id, data_type, v, v_min, v_ local v_new = ImGui.ScaleValueFromRatioT(TYPE, SIGNEDTYPE, data_type, clicked_t, v_min, v_max, logarithmic_zero_epsilon, zero_deadzone_halfsize) -- Round to user desired precision based on format string - if is_floating_point and bit32.band(flags, ImGuiSliderFlags.NoRoundToFormat) == 0 then + if is_floating_point and bit32.band(flags, 64 --[[ImGuiSliderFlags.NoRoundToFormat]]) == 0 then v_new = ImGui.RoundScalarWithFormatT(format, data_type, v_new) end @@ -51581,11 +51624,11 @@ function ImGui.SliderBehaviorT(TYPE, SIGNEDTYPE, bb, id, data_type, v, v_min, v_ else -- Output grab position so it can be displayed by the caller local grab_t = ImGui.ScaleRatioFromValueT(data_type, v, v_min, v_max, logarithmic_zero_epsilon, zero_deadzone_halfsize) - if axis == ImGuiAxis.Y then + if axis == 2 --[[ImGuiAxis.Y]] then grab_t = 1.0 - grab_t end local grab_pos = ImLerp(slider_usable_pos_min, slider_usable_pos_max, grab_t) - if axis == ImGuiAxis.X then + if axis == 1 --[[ImGuiAxis.X]] then og_min.x = grab_pos - grab_sz * 0.5; og_min.y = bb.Min.y + grab_padding; og_max.x = grab_pos + grab_sz * 0.5; og_max.y = bb.Max.y - grab_padding else og_min.x = bb.Min.x + grab_padding; og_min.y = grab_pos - grab_sz * 0.5; og_max.x = bb.Max.x - grab_padding; og_max.y = grab_pos + grab_sz * 0.5 @@ -51612,44 +51655,44 @@ end --- @return bool value_changed function ImGui.SliderBehavior(bb, id, data_type, v, min, max, format, flags, out_grab_bb) -- Read imgui.cpp "API BREAKING CHANGES" section for 1.78 if you hit this assert. - IM_ASSERT((flags == 1 or bit32.band(flags, ImGuiSliderFlags.InvalidMask_) == 0), "Invalid ImGuiSliderFlags flags! Has the legacy 'float power' argument been mistakenly cast to flags? Call function with ImGuiSliderFlags_Logarithmic flags instead.") - IM_ASSERT(bit32.band(flags, ImGuiSliderFlags.WrapAround) == 0) -- Not supported by SliderXXX(), only by DragXXX() + assert((flags == 1 or bit32.band(flags, 1879048207 --[[ImGuiSliderFlags.InvalidMask_]]) == 0), "Invalid ImGuiSliderFlags flags! Has the legacy 'float power' argument been mistakenly cast to flags? Call function with ImGuiSliderFlags_Logarithmic flags instead.") + assert(bit32.band(flags, 256 --[[ImGuiSliderFlags.WrapAround]]) == 0) -- Not supported by SliderXXX(), only by DragXXX() - if data_type == ImGuiDataType.S8 then + if data_type == 0 --[[ImGuiDataType.S8]] then local v32 = (ImS32)((ImS8)(v)); local r - v32, r = ImGui.SliderBehaviorT(ImS32, ImS32, bb, id, ImGuiDataType.S32, v32, min, max, format, flags, out_grab_bb) + v32, r = ImGui.SliderBehaviorT(ImS32, ImS32, bb, id, 4 --[[ImGuiDataType.S32]], v32, min, max, format, flags, out_grab_bb) if r then v = (ImS8)(v32) end return v, r - elseif data_type == ImGuiDataType.U8 then + elseif data_type == 1 --[[ImGuiDataType.U8]] then local v32 = (ImU32)((ImU8)(v)); local r - v32, r = ImGui.SliderBehaviorT(ImU32, ImS32, bb, id, ImGuiDataType.U32, v32, min, max, format, flags, out_grab_bb) + v32, r = ImGui.SliderBehaviorT(ImU32, ImS32, bb, id, 5 --[[ImGuiDataType.U32]], v32, min, max, format, flags, out_grab_bb) if r then v = (ImU8)(v32) end return v, r - elseif data_type == ImGuiDataType.S16 then + elseif data_type == 2 --[[ImGuiDataType.S16]] then local v32 = (ImS32)((ImS16)(v)); local r - v32, r = ImGui.SliderBehaviorT(ImS32, ImS32, bb, id, ImGuiDataType.S32, v32, min, max, format, flags, out_grab_bb) + v32, r = ImGui.SliderBehaviorT(ImS32, ImS32, bb, id, 4 --[[ImGuiDataType.S32]], v32, min, max, format, flags, out_grab_bb) if r then v = (ImS16)(v32) end return v, r - elseif data_type == ImGuiDataType.U16 then + elseif data_type == 3 --[[ImGuiDataType.U16]] then local v32 = (ImU32)((ImU16)(v)); local r - v32, r = ImGui.SliderBehaviorT(ImU32, ImS32, bb, id, ImGuiDataType.U32, v32, min, max, format, flags, out_grab_bb) + v32, r = ImGui.SliderBehaviorT(ImU32, ImS32, bb, id, 5 --[[ImGuiDataType.U32]], v32, min, max, format, flags, out_grab_bb) if r then v = (ImU16)(v32) end return v, r - elseif data_type == ImGuiDataType.S32 then - IM_ASSERT(min >= math.floor(IM_S32_MIN / 2) and max <= math.floor(IM_S32_MAX / 2)) + elseif data_type == 4 --[[ImGuiDataType.S32]] then + assert(min >= math.floor(IM_S32_MIN / 2) and max <= math.floor(IM_S32_MAX / 2)) return ImGui.SliderBehaviorT(ImS32, ImS32, bb, id, data_type, v, min, max, format, flags, out_grab_bb) - elseif data_type == ImGuiDataType.U32 then - IM_ASSERT(max <= math.floor(IM_U32_MAX / 2)) + elseif data_type == 5 --[[ImGuiDataType.U32]] then + assert(max <= math.floor(IM_U32_MAX / 2)) return ImGui.SliderBehaviorT(ImU32, ImS32, bb, id, data_type, v, min, max, format, flags, out_grab_bb) - elseif data_type == ImGuiDataType.Float then - IM_ASSERT(min >= -FLT_MAX / 2.0 and max <= FLT_MAX / 2.0) + elseif data_type == 6 --[[ImGuiDataType.Float]] then + assert(min >= -3.4028234663853e+38 --[[FLT_MAX]] / 2.0 and max <= 3.4028234663853e+38 --[[FLT_MAX]] / 2.0) return ImGui.SliderBehaviorT(float, float, bb, id, data_type, v, min, max, format, flags, out_grab_bb) - elseif data_type == ImGuiDataType.Double then - IM_ASSERT(min >= -DBL_MAX / 2.0 and max <= DBL_MAX / 2.0) + elseif data_type == 7 --[[ImGuiDataType.Double]] then + assert(min >= -1.7976931348623e+308 --[[DBL_MAX]] / 2.0 and max <= 1.7976931348623e+308 --[[DBL_MAX]] / 2.0) return ImGui.SliderBehaviorT(double, double, bb, id, data_type, v, min, max, format, flags, out_grab_bb) end - IM_ASSERT(false) + assert(false) return v, false end @@ -51675,7 +51718,7 @@ function ImGui.SliderScalar(label, data_type, data, min, max, format, flags) local style = g.Style local id = window:GetID(label) local w = ImGui.CalcItemWidth() - local color_marker = (bit32.band(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasColorMarker) ~= 0) and g.NextItemData.ColorMarker or 0 + local color_marker = (bit32.band(g.NextItemData.HasFlags, 32 --[[ImGuiNextItemDataFlags.HasColorMarker]]) ~= 0) and g.NextItemData.ColorMarker or 0 local label_end = ImGui.FindRenderedTextEnd(label) local label_size = ImGui.CalcTextSize(label, label_end, false) @@ -51685,9 +51728,9 @@ function ImGui.SliderScalar(label, data_type, data, min, max, format, flags) local total_bb = SliderScalar_total_bb -- [Luau] scratch: ItemSize()/ItemAdd() only read it total_bb.Min.x = frame_bb.Min.x; total_bb.Min.y = frame_bb.Min.y; total_bb.Max.x = total_bb_x; total_bb.Max.y = frame_bb.Max.y - local temp_input_allowed = bit32.band(flags, ImGuiSliderFlags.NoInput) == 0 + local temp_input_allowed = bit32.band(flags, 128 --[[ImGuiSliderFlags.NoInput]]) == 0 ImGui.ItemSize(total_bb, style.FramePadding.y) - local item_flags = temp_input_allowed and ImGuiItemFlags.Inputable or 0 + local item_flags = temp_input_allowed and 1048576 --[[ImGuiItemFlags.Inputable]] or 0 if not ImGui.ItemAdd(total_bb, id, frame_bb, item_flags) then return data, false end @@ -51701,13 +51744,13 @@ function ImGui.SliderScalar(label, data_type, data, min, max, format, flags) local temp_input_is_active = temp_input_allowed and ImGui.TempInputIsActive(id) if not temp_input_is_active then -- Tabbing or Ctrl+Click on Slider turns it into an input box - local clicked = hovered and ImGui.IsMouseClickedEx(0, ImGuiInputFlags.None, id) + local clicked = hovered and ImGui.IsMouseClickedEx(0, 0 --[[ImGuiInputFlags.None]], id) local make_active = clicked or g.NavActivateId == id if make_active and clicked then - ImGui.SetKeyOwner(ImGuiKey.MouseLeft, id) + ImGui.SetKeyOwner(656 --[[ImGuiKey.MouseLeft]], id) end if make_active and temp_input_allowed then - if (clicked and g.IO.KeyCtrl) or (g.NavActivateId == id and bit32.band(g.NavActivateFlags, ImGuiActivateFlags.PreferInput) ~= 0) then + if (clicked and g.IO.KeyCtrl) or (g.NavActivateId == id and bit32.band(g.NavActivateFlags, 1 --[[ImGuiActivateFlags.PreferInput]]) ~= 0) then temp_input_is_active = true end end @@ -51721,18 +51764,18 @@ function ImGui.SliderScalar(label, data_type, data, min, max, format, flags) ImGui.SetActiveID(id, window) ImGui.SetFocusID(id, window) ImGui.FocusWindow(window) - g.ActiveIdUsingNavDirMask = bit32.bor(g.ActiveIdUsingNavDirMask, bit32.lshift(1, ImGuiDir.Left), bit32.lshift(1, ImGuiDir.Right)) + g.ActiveIdUsingNavDirMask = bit32.bor(g.ActiveIdUsingNavDirMask, bit32.lshift(1, 0 --[[ImGuiDir.Left]]), bit32.lshift(1, 1 --[[ImGuiDir.Right]])) end end if temp_input_is_active then -- Only clamp Ctrl+Click input when ImGuiSliderFlags.ClampOnInput is set (generally via ImGuiSliderFlags.AlwaysClamp) - local clamp_enabled = bit32.band(flags, ImGuiSliderFlags.ClampOnInput) ~= 0 -- Don't use TempInputIsClampEnabled() + local clamp_enabled = bit32.band(flags, 512 --[[ImGuiSliderFlags.ClampOnInput]]) ~= 0 -- Don't use TempInputIsClampEnabled() return ImGui.TempInputScalar(frame_bb, id, label, data_type, data, format, clamp_enabled and min or nil, clamp_enabled and max or nil) end -- Draw frame - local frame_col = ImGui.GetColorU32((g.ActiveId == id) and ImGuiCol.FrameBgActive or (hovered and ImGuiCol.FrameBgHovered or ImGuiCol.FrameBg)) + local frame_col = ImGui.GetColorU32((g.ActiveId == id) and 9 --[[ImGuiCol.FrameBgActive]] or (hovered and 8 --[[ImGuiCol.FrameBgHovered]] or 7 --[[ImGuiCol.FrameBg]])) ImGui.RenderNavCursor(frame_bb, id) ImGui.RenderFrame(frame_bb.Min, frame_bb.Max, frame_col, false, style.FrameRounding) if color_marker ~= 0 and style.ColorMarkerSize > 0.0 then @@ -51750,7 +51793,7 @@ function ImGui.SliderScalar(label, data_type, data, min, max, format, flags) -- Render grab if grab_bb.Max.x > grab_bb.Min.x then - window.DrawList:AddRectFilled(grab_bb.Min, grab_bb.Max, ImGui.GetColorU32((g.ActiveId == id) and ImGuiCol.SliderGrabActive or ImGuiCol.SliderGrab), style.GrabRounding) + window.DrawList:AddRectFilled(grab_bb.Min, grab_bb.Max, ImGui.GetColorU32((g.ActiveId == id) and 21 --[[ImGuiCol.SliderGrabActive]] or 20 --[[ImGuiCol.SliderGrab]]), style.GrabRounding) end -- TODO: ImGui.DataTypeFormatString() should be used here instead of ImFormatString() @@ -51797,7 +51840,7 @@ function ImGui.SliderScalarN(label, data_type, v, components, v_min, v_max, form if i > 1 then ImGui.SameLine(0, g.Style.ItemInnerSpacing.x) end - if bit32.band(flags, ImGuiSliderFlags.ColorMarkers) ~= 0 then + if bit32.band(flags, 4096 --[[ImGuiSliderFlags.ColorMarkers]]) ~= 0 then ImGui.SetNextItemColorMarker(GDefaultRgbaColorMarkers[i]) end local changed @@ -51825,7 +51868,7 @@ end --- @param format? string --- @param flags? ImGuiSliderFlags function ImGui.SliderFloat2(label, v, v_min, v_max, format, flags) - return ImGui.SliderScalarN(label, ImGuiDataType.Float, v, 2, v_min, v_max, format, flags) + return ImGui.SliderScalarN(label, 6 --[[ImGuiDataType.Float]], v, 2, v_min, v_max, format, flags) end --- @param label string @@ -51835,7 +51878,7 @@ end --- @param format? string --- @param flags? ImGuiSliderFlags function ImGui.SliderFloat3(label, v, v_min, v_max, format, flags) - return ImGui.SliderScalarN(label, ImGuiDataType.Float, v, 3, v_min, v_max, format, flags) + return ImGui.SliderScalarN(label, 6 --[[ImGuiDataType.Float]], v, 3, v_min, v_max, format, flags) end --- @param label string @@ -51845,7 +51888,7 @@ end --- @param format? string --- @param flags? ImGuiSliderFlags function ImGui.SliderFloat4(label, v, v_min, v_max, format, flags) - return ImGui.SliderScalarN(label, ImGuiDataType.Float, v, 4, v_min, v_max, format, flags) + return ImGui.SliderScalarN(label, 6 --[[ImGuiDataType.Float]], v, 4, v_min, v_max, format, flags) end --- @param label string @@ -51858,7 +51901,7 @@ function ImGui.SliderFloat(label, v, v_min, v_max, format, flags) if format == nil then format = "%.3f" end if flags == nil then flags = 0 end - return ImGui.SliderScalar(label, ImGuiDataType.Float, v, v_min, v_max, format, flags) + return ImGui.SliderScalar(label, 6 --[[ImGuiDataType.Float]], v, v_min, v_max, format, flags) end --- @param label string @@ -51875,11 +51918,11 @@ function ImGui.SliderAngle(label, v_rad, v_degrees_min, v_degrees_max, format, f if format == nil then format = "%.0f deg" end if flags == nil then flags = 0 end - local v_deg = v_rad * 360.0 / (2 * IM_PI) + local v_deg = v_rad * 360.0 / (2 * 3.141592653589793 --[[IM_PI]]) local value_changed v_deg, value_changed = ImGui.SliderFloat(label, v_deg, v_degrees_min, v_degrees_max, format, flags) if value_changed then - v_rad = v_deg * (2 * IM_PI) / 360.0 + v_rad = v_deg * (2 * 3.141592653589793 --[[IM_PI]]) / 360.0 end return v_rad, value_changed end @@ -51894,19 +51937,19 @@ function ImGui.SliderInt(label, v, v_min, v_max, format, flags) if format == nil then format = "%d" end if flags == nil then flags = 0 end - return ImGui.SliderScalar(label, ImGuiDataType.S32, v, v_min, v_max, format, flags) + return ImGui.SliderScalar(label, 4 --[[ImGuiDataType.S32]], v, v_min, v_max, format, flags) end function ImGui.SliderInt2(label, v, v_min, v_max, format, flags) - return ImGui.SliderScalarN(label, ImGuiDataType.S32, v, 2, v_min, v_max, format or "%d", flags) + return ImGui.SliderScalarN(label, 4 --[[ImGuiDataType.S32]], v, 2, v_min, v_max, format or "%d", flags) end function ImGui.SliderInt3(label, v, v_min, v_max, format, flags) - return ImGui.SliderScalarN(label, ImGuiDataType.S32, v, 3, v_min, v_max, format or "%d", flags) + return ImGui.SliderScalarN(label, 4 --[[ImGuiDataType.S32]], v, 3, v_min, v_max, format or "%d", flags) end function ImGui.SliderInt4(label, v, v_min, v_max, format, flags) - return ImGui.SliderScalarN(label, ImGuiDataType.S32, v, 4, v_min, v_max, format or "%d", flags) + return ImGui.SliderScalarN(label, 4 --[[ImGuiDataType.S32]], v, 4, v_min, v_max, format or "%d", flags) end --- @param label string @@ -51944,33 +51987,33 @@ function ImGui.VSliderScalar(label, size, data_type, data, min, max, format, fla end local hovered = ImGui.ItemHoverable(frame_bb, id, g.LastItemData.ItemFlags) - local clicked = hovered and ImGui.IsMouseClickedEx(0, ImGuiInputFlags.None, id) + local clicked = hovered and ImGui.IsMouseClickedEx(0, 0 --[[ImGuiInputFlags.None]], id) if clicked or g.NavActivateId == id then if clicked then - ImGui.SetKeyOwner(ImGuiKey.MouseLeft, id) + ImGui.SetKeyOwner(656 --[[ImGuiKey.MouseLeft]], id) end ImGui.SetActiveID(id, window) ImGui.SetFocusID(id, window) ImGui.FocusWindow(window) - g.ActiveIdUsingNavDirMask = bit32.bor(g.ActiveIdUsingNavDirMask, bit32.lshift(1, ImGuiDir.Up), bit32.lshift(1, ImGuiDir.Down)) + g.ActiveIdUsingNavDirMask = bit32.bor(g.ActiveIdUsingNavDirMask, bit32.lshift(1, 2 --[[ImGuiDir.Up]]), bit32.lshift(1, 3 --[[ImGuiDir.Down]])) end -- Draw frame - local frame_col = ImGui.GetColorU32((g.ActiveId == id) and ImGuiCol.FrameBgActive or (hovered and ImGuiCol.FrameBgHovered or ImGuiCol.FrameBg)) + local frame_col = ImGui.GetColorU32((g.ActiveId == id) and 9 --[[ImGuiCol.FrameBgActive]] or (hovered and 8 --[[ImGuiCol.FrameBgHovered]] or 7 --[[ImGuiCol.FrameBg]])) ImGui.RenderNavCursor(frame_bb, id) ImGui.RenderFrame(frame_bb.Min, frame_bb.Max, frame_col, true, g.Style.FrameRounding) -- Slider behavior local grab_bb = ImRect() local value_changed - data, value_changed = ImGui.SliderBehavior(frame_bb, id, data_type, data, min, max, format, bit32.bor(flags or 0, ImGuiSliderFlags.Vertical), grab_bb) + data, value_changed = ImGui.SliderBehavior(frame_bb, id, data_type, data, min, max, format, bit32.bor(flags or 0, 1048576 --[[ImGuiSliderFlags.Vertical]]), grab_bb) if value_changed then ImGui.MarkItemEdited(id) end -- Render grab if grab_bb.Max.y > grab_bb.Min.y then - window.DrawList:AddRectFilled(grab_bb.Min, grab_bb.Max, ImGui.GetColorU32((g.ActiveId == id) and ImGuiCol.SliderGrabActive or ImGuiCol.SliderGrab), style.GrabRounding) + window.DrawList:AddRectFilled(grab_bb.Min, grab_bb.Max, ImGui.GetColorU32((g.ActiveId == id) and 21 --[[ImGuiCol.SliderGrabActive]] or 20 --[[ImGuiCol.SliderGrab]]), style.GrabRounding) end -- Display value using user-provided display format so user can add prefix/suffix/decorations to the value. @@ -51996,7 +52039,7 @@ end function ImGui.VSliderFloat(label, size, v, v_min, v_max, format, flags) if format == nil then format = "%.3f" end - return ImGui.VSliderScalar(label, size, ImGuiDataType.Float, v, v_min, v_max, format, flags) + return ImGui.VSliderScalar(label, size, 6 --[[ImGuiDataType.Float]], v, v_min, v_max, format, flags) end --- @param label string @@ -52009,7 +52052,7 @@ end function ImGui.VSliderInt(label, size, v, v_min, v_max, format, flags) if format == nil then format = "%d" end - return ImGui.VSliderScalar(label, size, ImGuiDataType.S32, v, v_min, v_max, format, flags) + return ImGui.VSliderScalar(label, size, 4 --[[ImGuiDataType.S32]], v, v_min, v_max, format, flags) end ------------------------------------------------------------------------------- @@ -52032,7 +52075,7 @@ end function ImGui.InputText(label, buf, buf_size, flags, callback, user_data) if flags == nil then flags = 0 end - IM_ASSERT(bit32.band(flags, ImGuiInputTextFlags.Multiline) == 0) -- call InputTextMultiline() + assert(bit32.band(flags, 67108864 --[[ImGuiInputTextFlags.Multiline]]) == 0) -- call InputTextMultiline() return ImGui.InputTextEx(label, nil, buf, buf_size, ImVec2(0, 0), flags, callback, user_data) end @@ -52052,7 +52095,7 @@ end --- @param size? ImVec2 function ImGui.InputTextMultiline(label, buf, buf_size, size, flags, callback, user_data) - return ImGui.InputTextEx(label, nil, buf, buf_size, size or ImVec2(0, 0), bit32.bor(flags or 0, ImGuiInputTextFlags.Multiline), callback, user_data) + return ImGui.InputTextEx(label, nil, buf, buf_size, size or ImVec2(0, 0), bit32.bor(flags or 0, 67108864 --[[ImGuiInputTextFlags.Multiline]]), callback, user_data) end ImStb = {} @@ -52076,8 +52119,8 @@ local function InputTextCalcTextSize(ctx, text, text_begin, text_end_display, te local g = ctx local obj = g.InputTextState - IM_ASSERT(text_end_display >= text_begin and text_end_display <= text_end) - return ImFontCalcTextSizeEx(g.Font, g.FontSize, FLT_MAX, obj.WrapWidth, text, text_begin, text_end_display, text_end, out_offset, flags) + assert(text_end_display >= text_begin and text_end_display <= text_end) + return ImFontCalcTextSizeEx(g.Font, g.FontSize, 3.4028234663853e+38 --[[FLT_MAX]], obj.WrapWidth, text, text_begin, text_end_display, text_end, out_offset, flags) end -- Wrapper for stb_textedit.h to edit text (our wrapper is for: statically sized buffer, single-line, wchar characters. InputText converts between UTF-8 and wchar) @@ -52091,7 +52134,7 @@ function ImStb.TEXTEDIT_STRINGLEN(obj) return obj.TextLen end --- @param obj ImGuiInputTextState --- @param idx int # 1-based -function ImStb.TEXTEDIT_GETCHAR(obj, idx) IM_ASSERT(idx >= 1 and idx <= obj.TextLen + 1); return obj.TextSrc[idx] end +function ImStb.TEXTEDIT_GETCHAR(obj, idx) assert(idx >= 1 and idx <= obj.TextLen + 1); return obj.TextSrc[idx] end --- @param obj ImGuiInputTextState --- @param line_start_idx int # 1-based @@ -52104,7 +52147,7 @@ function ImStb.TEXTEDIT_GETWIDTH(obj, line_start_idx, char_idx) local _, c = ImS --- @param line_start_idx int # 1-based function ImStb.TEXTEDIT_LAYOUTROW(r, obj, line_start_idx) local text = obj.TextSrc - local size, text_remaining = InputTextCalcTextSize(obj.Ctx, text, line_start_idx, obj.TextLen + 1, obj.TextLen + 1, nil, bit32.bor(ImDrawTextFlags.StopOnNewLine, ImDrawTextFlags.WrapKeepBlanks)) + local size, text_remaining = InputTextCalcTextSize(obj.Ctx, text, line_start_idx, obj.TextLen + 1, obj.TextLen + 1, nil, bit32.bor(4 --[[ImDrawTextFlags.StopOnNewLine]], 2 --[[ImDrawTextFlags.WrapKeepBlanks]])) r.x0 = 0.0 r.x1 = size.x r.baseline_y_delta = size.y @@ -52156,7 +52199,7 @@ end --- @param idx int function ImStb.is_word_boundary_from_right(obj, idx) -- When ImGuiInputTextFlags.Password is set, we don't want actions such as Ctrl+Arrow to leak the fact that underlying data are blanks or separators. - if bit32.band(obj.Flags, ImGuiInputTextFlags.Password) ~= 0 or idx <= 1 then + if bit32.band(obj.Flags, 1024 --[[ImGuiInputTextFlags.Password]]) ~= 0 or idx <= 1 then return false end @@ -52174,7 +52217,7 @@ end --- @param obj ImGuiInputTextState --- @param idx int function ImStb.is_word_boundary_from_left(obj, idx) - if bit32.band(obj.Flags, ImGuiInputTextFlags.Password) ~= 0 or idx <= 1 then + if bit32.band(obj.Flags, 1024 --[[ImGuiInputTextFlags.Password]]) ~= 0 or idx <= 1 then return false end @@ -52247,11 +52290,11 @@ function ImStb.TEXTEDIT_MOVELINESTART(obj, state, cursor) local p = bol local text_end = obj.TextLen + 1 -- End of line would be enough while p >= bol do - local eol = ImFontCalcWordWrapPositionEx(g.Font, g.FontSize, obj.TextSrc, p, text_end, obj.WrapWidth, ImDrawTextFlags.WrapKeepBlanks) + local eol = ImFontCalcWordWrapPositionEx(g.Font, g.FontSize, obj.TextSrc, p, text_end, obj.WrapWidth, 2 --[[ImDrawTextFlags.WrapKeepBlanks]]) if p == cursor then -- If we are already on a visible beginning-of-line, return real beginning-of-line (would be same as regular handler below) return bol end - if eol == cursor and obj.TextA[cursor] ~= 10 and obj.LastMoveDirectionLR == ImGuiDir.Left then + if eol == cursor and obj.TextA[cursor] ~= 10 and obj.LastMoveDirectionLR == 0 --[[ImGuiDir.Left]] then return bol end if eol >= cursor then @@ -52264,7 +52307,7 @@ function ImStb.TEXTEDIT_MOVELINESTART(obj, state, cursor) -- Regular handler, same as stb_textedit_move_line_start() while cursor > 1 do local prev_cursor = ImStb.TEXTEDIT_GETPREVCHARINDEX(obj, cursor) - if (ImStb.TEXTEDIT_GETCHAR(obj, prev_cursor) == STB_TEXTEDIT_NEWLINE) then + if (ImStb.TEXTEDIT_GETCHAR(obj, prev_cursor) == 10 --[[STB_TEXTEDIT_NEWLINE]]) then break end cursor = prev_cursor @@ -52286,9 +52329,9 @@ function ImStb.TEXTEDIT_MOVELINEEND(obj, state, cursor) local p = ImStd.ImStrbol(obj.TextSrc, cursor, 1) local text_end = obj.TextLen + 1 -- End of line would be enough while p < text_end do - local eol = ImFontCalcWordWrapPositionEx(g.Font, g.FontSize, obj.TextSrc, p, text_end, obj.WrapWidth, ImDrawTextFlags.WrapKeepBlanks) + local eol = ImFontCalcWordWrapPositionEx(g.Font, g.FontSize, obj.TextSrc, p, text_end, obj.WrapWidth, 2 --[[ImDrawTextFlags.WrapKeepBlanks]]) cursor = eol - if eol == cursor and obj.LastMoveDirectionLR ~= ImGuiDir.Left then -- If we are already on a visible end-of-line, switch to regular handle + if eol == cursor and obj.LastMoveDirectionLR ~= 0 --[[ImGuiDir.Left]] then -- If we are already on a visible end-of-line, switch to regular handle break end if eol > cursor then @@ -52299,7 +52342,7 @@ function ImStb.TEXTEDIT_MOVELINEEND(obj, state, cursor) end -- Regular handler, same as stb_textedit_move_line_end() - while (cursor < n and ImStb.TEXTEDIT_GETCHAR(obj, cursor) ~= STB_TEXTEDIT_NEWLINE) do + while (cursor < n and ImStb.TEXTEDIT_GETCHAR(obj, cursor) ~= 10 --[[STB_TEXTEDIT_NEWLINE]]) do cursor = ImStb.TEXTEDIT_GETNEXTCHARINDEX(obj, cursor) end return cursor @@ -52310,7 +52353,7 @@ end --- @param n int function ImStb.TEXTEDIT_DELETECHARS(obj, pos, n) -- Offset remaining text (+ copy zero terminator) - IM_ASSERT(obj.TextSrc == obj.TextA.Data) + assert(obj.TextSrc == obj.TextA.Data) ImStd.memmove(obj.TextA.Data, pos, obj.TextA.Data, pos + n, obj.TextLen - n - pos + 2) obj.EditedBefore = true obj.EditedThisFrame = true @@ -52323,9 +52366,9 @@ end --- @param new_text_pos int --- @param new_text_len int function ImStb.TEXTEDIT_INSERTCHARS(obj, pos, new_text, new_text_pos, new_text_len) - local is_resizable = bit32.band(obj.Flags, ImGuiInputTextFlags.CallbackResize) ~= 0 + local is_resizable = bit32.band(obj.Flags, 4194304 --[[ImGuiInputTextFlags.CallbackResize]]) ~= 0 local text_len = obj.TextLen - IM_ASSERT(pos <= text_len + 1) + assert(pos <= text_len + 1) -- We support partial insertion (with a mod in stb_textedit.h) local avail = obj.BufCapacity - 1 - obj.TextLen @@ -52337,7 +52380,7 @@ function ImStb.TEXTEDIT_INSERTCHARS(obj, pos, new_text, new_text_pos, new_text_l end -- Grow internal buffer if needed - IM_ASSERT(obj.TextSrc == obj.TextA.Data) + assert(obj.TextSrc == obj.TextA.Data) if text_len + new_text_len + 1 > obj.TextA.Size and is_resizable then obj.TextA:resize(text_len + ImClamp(new_text_len, 32, ImMax(256, new_text_len)) + 1) obj.TextSrc = obj.TextA.Data @@ -52385,7 +52428,7 @@ function ImStb.stb_textedit_replace(str, state, text, text_len) return end - IM_ASSERT(false) -- Failed to insert character, normally shouldn't happen because of how we currently use stb_textedit_replace() + assert(false) -- Failed to insert character, normally shouldn't happen because of how we currently use stb_textedit_replace() end local MT = ImGui.GetMetatables() @@ -52397,11 +52440,11 @@ function MT.ImGuiInputTextState:OnKeyPressed(key) stbte.key(self, self.Stb, key) self.CursorFollow = true self:CursorAnimReset() - local key_u = bit32.band(key, bit32.bnot(STB_TEXTEDIT_K_SHIFT)) - if key_u == STB_TEXTEDIT_K_LEFT or key_u == STB_TEXTEDIT_K_LINESTART or key_u == STB_TEXTEDIT_K_TEXTSTART or key_u == STB_TEXTEDIT_K_BACKSPACE or key_u == STB_TEXTEDIT_K_WORDLEFT then - self.LastMoveDirectionLR = ImGuiDir.Left - elseif key_u == STB_TEXTEDIT_K_RIGHT or key_u == STB_TEXTEDIT_K_LINEEND or key_u == STB_TEXTEDIT_K_TEXTEND or key_u == STB_TEXTEDIT_K_DELETE or key_u == STB_TEXTEDIT_K_WORDRIGHT then - self.LastMoveDirectionLR = ImGuiDir.Right + local key_u = bit32.band(key, bit32.bnot(4194304 --[[STB_TEXTEDIT_K_SHIFT]])) + if key_u == 2097152 --[[STB_TEXTEDIT_K_LEFT]] or key_u == 2097156 --[[STB_TEXTEDIT_K_LINESTART]] or key_u == 2097158 --[[STB_TEXTEDIT_K_TEXTSTART]] or key_u == 2097161 --[[STB_TEXTEDIT_K_BACKSPACE]] or key_u == 2097164 --[[STB_TEXTEDIT_K_WORDLEFT]] then + self.LastMoveDirectionLR = 0 --[[ImGuiDir.Left]] + elseif key_u == 2097153 --[[STB_TEXTEDIT_K_RIGHT]] or key_u == 2097157 --[[STB_TEXTEDIT_K_LINEEND]] or key_u == 2097159 --[[STB_TEXTEDIT_K_TEXTEND]] or key_u == 2097160 --[[STB_TEXTEDIT_K_DELETE]] or key_u == 2097165 --[[STB_TEXTEDIT_K_WORDRIGHT]] then + self.LastMoveDirectionLR = 1 --[[ImGuiDir.Right]] end end @@ -52442,14 +52485,14 @@ end function ImGui.PushPasswordFont() local g = GImGui local backup = g.InputTextPasswordFontBackupBaked - IM_ASSERT(backup.IndexAdvanceX.Size == 0 and backup.IndexLookup.Size == 0) + assert(backup.IndexAdvanceX.Size == 0 and backup.IndexLookup.Size == 0) local glyph = g.FontBaked:FindGlyph(42) -- '*' g.InputTextPasswordFontBackupFlags = g.Font.Flags backup.FallbackGlyphIndex = g.FontBaked.FallbackGlyphIndex backup.FallbackAdvanceX = g.FontBaked.FallbackAdvanceX backup.IndexLookup:swap(g.FontBaked.IndexLookup) backup.IndexAdvanceX:swap(g.FontBaked.IndexAdvanceX) - g.Font.Flags = bit32.bor(g.Font.Flags, ImFontFlags.NoLoadGlyphs) + g.Font.Flags = bit32.bor(g.Font.Flags, 4 --[[ImFontFlags.NoLoadGlyphs]]) g.FontBaked.FallbackGlyphIndex = g.FontBaked.Glyphs:index_from_ptr(glyph) + 1 g.FontBaked.FallbackAdvanceX = glyph.AdvanceX end @@ -52462,7 +52505,7 @@ function ImGui.PopPasswordFont() g.FontBaked.FallbackAdvanceX = backup.FallbackAdvanceX g.FontBaked.IndexLookup:swap(backup.IndexLookup) g.FontBaked.IndexAdvanceX:swap(backup.IndexAdvanceX) - IM_ASSERT(backup.IndexAdvanceX.Size == 0 and backup.IndexLookup.Size == 0) + assert(backup.IndexAdvanceX.Size == 0 and backup.IndexLookup.Size == 0) end -- Return false to discard a character. Returns (char, ok). @@ -52477,7 +52520,7 @@ end local function InputTextFilterCharacter(ctx, state, char, callback, user_data, input_source_is_clipboard) if input_source_is_clipboard == nil then input_source_is_clipboard = false end - IM_ASSERT(state ~= nil) + assert(state ~= nil) local c = char local flags = state.Flags @@ -52486,14 +52529,14 @@ local function InputTextFilterCharacter(ctx, state, char, callback, user_data, i local apply_named_filters = true if c < 0x20 then local pass = false - pass = pass or (c == 10) and (bit32.band(flags, ImGuiInputTextFlags.Multiline) ~= 0) -- Note that an Enter KEY will emit \r and be ignored (we poll for KEY in InputText() code) - if c == 10 and input_source_is_clipboard and (bit32.band(flags, ImGuiInputTextFlags.Multiline) == 0) then -- In single line mode, replace \n with a space + pass = pass or (c == 10) and (bit32.band(flags, 67108864 --[[ImGuiInputTextFlags.Multiline]]) ~= 0) -- Note that an Enter KEY will emit \r and be ignored (we poll for KEY in InputText() code) + if c == 10 and input_source_is_clipboard and (bit32.band(flags, 67108864 --[[ImGuiInputTextFlags.Multiline]]) == 0) then -- In single line mode, replace \n with a space char = 32 c = 32 pass = true end - pass = pass or (c == 10) and (bit32.band(flags, ImGuiInputTextFlags.Multiline) ~= 0) - pass = pass or (c == 9) and (bit32.band(flags, ImGuiInputTextFlags.AllowTabInput) ~= 0) -- tab + pass = pass or (c == 10) and (bit32.band(flags, 67108864 --[[ImGuiInputTextFlags.Multiline]]) ~= 0) + pass = pass or (c == 9) and (bit32.band(flags, 32 --[[ImGuiInputTextFlags.AllowTabInput]]) ~= 0) -- tab if not pass then return char, false end @@ -52513,12 +52556,12 @@ local function InputTextFilterCharacter(ctx, state, char, callback, user_data, i end -- Filter Unicode ranges we are not handling in this build - if c > IM_UNICODE_CODEPOINT_MAX then + if c > 65535 --[[IM_UNICODE_CODEPOINT_MAX]] then return char, false end -- Generic named filters - if apply_named_filters and (bit32.band(flags, bit32.bor(ImGuiInputTextFlags.CharsDecimal, ImGuiInputTextFlags.CharsHexadecimal, ImGuiInputTextFlags.CharsUppercase, ImGuiInputTextFlags.CharsNoBlank, ImGuiInputTextFlags.CharsScientific, ImGuiInputTextFlags.LocalizeDecimalPoint))) ~= 0 then + if apply_named_filters and (bit32.band(flags, bit32.bor(1 --[[ImGuiInputTextFlags.CharsDecimal]], 2 --[[ImGuiInputTextFlags.CharsHexadecimal]], 8 --[[ImGuiInputTextFlags.CharsUppercase]], 16 --[[ImGuiInputTextFlags.CharsNoBlank]], 4 --[[ImGuiInputTextFlags.CharsScientific]], 268435456 --[[ImGuiInputTextFlags.LocalizeDecimalPoint]]))) ~= 0 then -- The standard mandate that programs starts in the "C" locale where the decimal point is '.'. -- We don't really intend to provide widespread support for it, but out of empathy for people stuck with using odd API, we support the bare minimum aka overriding the decimal point. -- Change the default decimal_point with: @@ -52526,7 +52569,7 @@ local function InputTextFilterCharacter(ctx, state, char, callback, user_data, i -- Users of non-default decimal point (in particular ',') may be affected by word-selection logic (is_word_boundary_from_right/is_word_boundary_from_left) functions. local g = ctx local c_decimal_point = g.PlatformIO.Platform_LocaleDecimalPoint - if bit32.band(flags, bit32.bor(ImGuiInputTextFlags.CharsDecimal, ImGuiInputTextFlags.CharsScientific, ImGuiInputTextFlags.LocalizeDecimalPoint)) ~= 0 then + if bit32.band(flags, bit32.bor(1 --[[ImGuiInputTextFlags.CharsDecimal]], 4 --[[ImGuiInputTextFlags.CharsScientific]], 268435456 --[[ImGuiInputTextFlags.LocalizeDecimalPoint]])) ~= 0 then if c == 46 or c == 44 then -- '.' or ',' c = c_decimal_point end @@ -52535,41 +52578,41 @@ local function InputTextFilterCharacter(ctx, state, char, callback, user_data, i -- Full-width -> half-width conversion for numeric fields: https://en.wikipedia.org/wiki/Halfwidth_and_Fullwidth_Forms_(Unicode_block) -- While this is mostly convenient, this has the side-effect for uninformed users accidentally inputting full-width characters that they may -- scratch their head as to why it works in numerical fields vs in generic text fields it would require support in the font. - if bit32.band(flags, bit32.bor(ImGuiInputTextFlags.CharsDecimal, ImGuiInputTextFlags.CharsScientific, ImGuiInputTextFlags.CharsHexadecimal)) ~= 0 then + if bit32.band(flags, bit32.bor(1 --[[ImGuiInputTextFlags.CharsDecimal]], 4 --[[ImGuiInputTextFlags.CharsScientific]], 2 --[[ImGuiInputTextFlags.CharsHexadecimal]])) ~= 0 then if c >= 0xFF01 and c <= 0xFF5E then c = c - 0xFF01 + 0x21 end end -- Allow 0-9 . - + * / - if bit32.band(flags, ImGuiInputTextFlags.CharsDecimal) ~= 0 then + if bit32.band(flags, 1 --[[ImGuiInputTextFlags.CharsDecimal]]) ~= 0 then if not (c >= 48 and c <= 57) and (c ~= c_decimal_point) and (c ~= 45) and (c ~= 43) and (c ~= 42) and (c ~= 47) then -- 0-9 . - + * / return char, false end end -- Allow 0-9 . - + * / e E - if bit32.band(flags, ImGuiInputTextFlags.CharsScientific) ~= 0 then + if bit32.band(flags, 4 --[[ImGuiInputTextFlags.CharsScientific]]) ~= 0 then if not (c >= 48 and c <= 57) and (c ~= c_decimal_point) and (c ~= 45) and (c ~= 43) and (c ~= 42) and (c ~= 47) and (c ~= 101) and (c ~= 69) then -- 0-9 . - + * / e E return char, false end end -- Allow 0-9 a-F A-F - if bit32.band(flags, ImGuiInputTextFlags.CharsHexadecimal) ~= 0 then + if bit32.band(flags, 2 --[[ImGuiInputTextFlags.CharsHexadecimal]]) ~= 0 then if not (c >= 48 and c <= 57) and not (c >= 97 and c <= 102) and not (c >= 65 and c <= 70) then -- 0-9 a-f A-F return char, false end end -- Turn a-z into A-Z - if bit32.band(flags, ImGuiInputTextFlags.CharsUppercase) ~= 0 then + if bit32.band(flags, 8 --[[ImGuiInputTextFlags.CharsUppercase]]) ~= 0 then if c >= 97 and c <= 122 then -- a-z c = c + (65 - 97) -- 'A' - 'a' end end - if bit32.band(flags, ImGuiInputTextFlags.CharsNoBlank) ~= 0 then + if bit32.band(flags, 16 --[[ImGuiInputTextFlags.CharsNoBlank]]) ~= 0 then if ImStd.ImCharIsBlankW(c) then return char, false end @@ -52579,13 +52622,13 @@ local function InputTextFilterCharacter(ctx, state, char, callback, user_data, i end -- Custom callback filter - if bit32.band(flags, ImGuiInputTextFlags.CallbackCharFilter) ~= 0 then + if bit32.band(flags, 2097152 --[[ImGuiInputTextFlags.CallbackCharFilter]]) ~= 0 then local g = GImGui local callback_data = ImGuiInputTextCallbackData() callback_data.Ctx = g callback_data.ID = state.ID callback_data.Flags = flags - callback_data.EventFlag = ImGuiInputTextFlags.CallbackCharFilter + callback_data.EventFlag = 2097152 --[[ImGuiInputTextFlags.CallbackCharFilter]] callback_data.EventChar = c callback_data.EventActivated = (state ~= nil and g.ActiveId == state.ID and g.ActiveIdIsJustActivated) callback_data.CursorPos = state.Stb.cursor @@ -52667,10 +52710,10 @@ function ImGui.InputTextDeactivateHook(id) g.InputTextDeactivatedState.ID = state.ID g.InputTextDeactivatedState.ElapseFrame = g.FrameCount + 1 - if bit32.band(state.Flags, ImGuiInputTextFlags.ReadOnly) ~= 0 then + if bit32.band(state.Flags, 512 --[[ImGuiInputTextFlags.ReadOnly]]) ~= 0 then g.InputTextDeactivatedState.TextA:resize(0) -- In theory this data won't be used, but clear to be neat. else - IM_ASSERT(state.TextA.Data ~= nil) + assert(state.TextA.Data ~= nil) -- IM_ASSERT(state.TextA[state.TextLen + 1] == 0) g.InputTextDeactivatedState.TextA:resize(state.TextLen + 1) ImStd.memmove(g.InputTextDeactivatedState.TextA.Data, 1, state.TextA.Data, 1, state.TextLen) -- state.TextLen + 1 @@ -52692,13 +52735,13 @@ local function InputTextLineIndexBuild(flags, line_index, buf, buf_end, wrap_wid local size = 0 local s = 1 local trailing_line_already_counted = false - if bit32.band(flags, ImGuiInputTextFlags.WordWrap) ~= 0 then + if bit32.band(flags, 16777216 --[[ImGuiInputTextFlags.WordWrap]]) ~= 0 then while s < buf_end do if size <= max_output_buffer_size then line_index.Offsets:push_back(s - 1) end size = size + 1 - s = ImFontCalcWordWrapPositionEx(g.Font, g.FontSize, buf, s, buf_end, wrap_width, ImDrawTextFlags.WrapKeepBlanks) + s = ImFontCalcWordWrapPositionEx(g.Font, g.FontSize, buf, s, buf_end, wrap_width, 2 --[[ImDrawTextFlags.WrapKeepBlanks]]) if buf[s] == 10 then s = s + 1 end end @@ -52790,7 +52833,7 @@ local function InputTextLineIndexGetPosOffset(g, state, line_index, buf, buf_end local it = ImLowerBound(line_index.Offsets, 1, line_index.Offsets.Size + 1, cursor_ptr) if it > 1 then - if it > line_index.Offsets.Size or line_index.Offsets[it] ~= cursor_ptr or (state ~= nil and state.WrapWidth > 0.0 and state.LastMoveDirectionLR == ImGuiDir.Right and + if it > line_index.Offsets.Size or line_index.Offsets[it] ~= cursor_ptr or (state ~= nil and state.WrapWidth > 0.0 and state.LastMoveDirectionLR == 1 --[[ImGuiDir.Right]] and buf[cursor_ptr - 1] ~= 10 and buf[cursor_ptr - 1] ~= 0) then it = it - 1 end @@ -52800,7 +52843,7 @@ local function InputTextLineIndexGetPosOffset(g, state, line_index, buf, buf_end local line_start = (line_no == 1) and 1 or line_index.Offsets[line_no] + 1 local offset = ImVec2() - offset.x = InputTextCalcTextSize(g, buf, line_start, cursor_ptr, buf_end, nil, ImDrawTextFlags.WrapKeepBlanks).x + offset.x = InputTextCalcTextSize(g, buf, line_start, cursor_ptr, buf_end, nil, 2 --[[ImDrawTextFlags.WrapKeepBlanks]]).x offset.y = line_no * g.FontSize return offset @@ -52836,19 +52879,19 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback return false end - IM_ASSERT(buf ~= nil and buf_size >= 0) - IM_ASSERT(not (bit32.band(flags, ImGuiInputTextFlags.CallbackHistory) ~= 0 and bit32.band(flags, ImGuiInputTextFlags.Multiline) ~= 0)) -- Can't use both together (they both use up/down keys) - IM_ASSERT(not (bit32.band(flags, ImGuiInputTextFlags.CallbackCompletion) ~= 0 and bit32.band(flags, ImGuiInputTextFlags.AllowTabInput) ~= 0)) -- Can't use both together (they both use tab key) - IM_ASSERT(not (bit32.band(flags, ImGuiInputTextFlags.ElideLeft) ~= 0 and bit32.band(flags, ImGuiInputTextFlags.Multiline) ~= 0)) -- Multiline does not work with left-trimming - IM_ASSERT(bit32.band(flags, ImGuiInputTextFlags.WordWrap) == 0 or bit32.band(flags, ImGuiInputTextFlags.Password) == 0) -- WordWrap does not work with Password mode. - IM_ASSERT(bit32.band(flags, ImGuiInputTextFlags.WordWrap) == 0 or bit32.band(flags, ImGuiInputTextFlags.Multiline) ~= 0) -- WordWrap does not work in single-line mode. + assert(buf ~= nil and buf_size >= 0) + assert(not (bit32.band(flags, 524288 --[[ImGuiInputTextFlags.CallbackHistory]]) ~= 0 and bit32.band(flags, 67108864 --[[ImGuiInputTextFlags.Multiline]]) ~= 0)) -- Can't use both together (they both use up/down keys) + assert(not (bit32.band(flags, 262144 --[[ImGuiInputTextFlags.CallbackCompletion]]) ~= 0 and bit32.band(flags, 32 --[[ImGuiInputTextFlags.AllowTabInput]]) ~= 0)) -- Can't use both together (they both use tab key) + assert(not (bit32.band(flags, 131072 --[[ImGuiInputTextFlags.ElideLeft]]) ~= 0 and bit32.band(flags, 67108864 --[[ImGuiInputTextFlags.Multiline]]) ~= 0)) -- Multiline does not work with left-trimming + assert(bit32.band(flags, 16777216 --[[ImGuiInputTextFlags.WordWrap]]) == 0 or bit32.band(flags, 1024 --[[ImGuiInputTextFlags.Password]]) == 0) -- WordWrap does not work with Password mode. + assert(bit32.band(flags, 16777216 --[[ImGuiInputTextFlags.WordWrap]]) == 0 or bit32.band(flags, 67108864 --[[ImGuiInputTextFlags.Multiline]]) ~= 0) -- WordWrap does not work in single-line mode. local g = GImGui --[[@as ImGuiContext]] local io = g.IO local style = g.Style local RENDER_SELECTION_WHEN_INACTIVE = false - local is_multiline = bit32.band(flags, ImGuiInputTextFlags.Multiline) ~= 0 + local is_multiline = bit32.band(flags, 67108864 --[[ImGuiInputTextFlags.Multiline]]) ~= 0 if is_multiline then -- Open group before calling GetID() because groups tracks id created within their scope (including the scrollbar) ImGui.BeginGroup() @@ -52871,7 +52914,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback ImVec2_Copy(backup_pos, window.DC.CursorPos) ImGui.ItemSize(total_bb, style.FramePadding.y) local no_clip = (g.InputTextDeactivatedState.ID == id) or (g.ActiveId == id) or (id == g.NavActivateId) -- Mimic some of ItemAdd() logic + add InputTextDeactivatedState.ID check. - if not ImGui.ItemAdd(total_bb, id, frame_bb, ImGuiItemFlags.Inputable) and not no_clip then + if not ImGui.ItemAdd(total_bb, id, frame_bb, 1048576 --[[ImGuiItemFlags.Inputable]]) and not no_clip then ImGui.EndGroup() return false end @@ -52879,7 +52922,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback ImVec2_Copy(window.DC.CursorPos, backup_pos) -- Prevent NavActivation from explicit Tabbing when our widget accepts Tab inputs: this allows cycling through widgets without stopping. - if g.NavActivateId == id and (bit32.band(g.NavActivateFlags, ImGuiActivateFlags.FromTabbing) ~= 0) and (bit32.band(g.NavActivateFlags, ImGuiActivateFlags.FromFocusApi) == 0) and (bit32.band(flags, ImGuiInputTextFlags.AllowTabInput) ~= 0) then + if g.NavActivateId == id and (bit32.band(g.NavActivateFlags, 8 --[[ImGuiActivateFlags.FromTabbing]]) ~= 0) and (bit32.band(g.NavActivateFlags, 32 --[[ImGuiActivateFlags.FromFocusApi]]) == 0) and (bit32.band(flags, 32 --[[ImGuiInputTextFlags.AllowTabInput]]) ~= 0) then g.NavActivateId = 0 end @@ -52890,11 +52933,11 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback end -- We reproduce the contents of BeginChildFrame() in order to provide 'label' so our window internal data are easier to read/debug. - ImGui.PushStyleColor(ImGuiCol.ChildBg, style.Colors[ImGuiCol.FrameBg]) - ImGui.PushStyleVar(ImGuiStyleVar.ChildRounding, style.FrameRounding) - ImGui.PushStyleVar(ImGuiStyleVar.ChildBorderSize, style.FrameBorderSize) - ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, ImVec2(0, 0)) -- Ensure no clip rect so mouse hover can reach FramePadding edges - local child_visible = ImGui.BeginChildEx(label, id, frame_bb:GetSize(), ImGuiChildFlags.Borders, ImGuiWindowFlags.NoMove) + ImGui.PushStyleColor(3 --[[ImGuiCol.ChildBg]], style.Colors[7 --[[ImGuiCol.FrameBg]]]) + ImGui.PushStyleVar(7 --[[ImGuiStyleVar.ChildRounding]], style.FrameRounding) + ImGui.PushStyleVar(8 --[[ImGuiStyleVar.ChildBorderSize]], style.FrameBorderSize) + ImGui.PushStyleVar(2 --[[ImGuiStyleVar.WindowPadding]], ImVec2(0, 0)) -- Ensure no clip rect so mouse hover can reach FramePadding edges + local child_visible = ImGui.BeginChildEx(label, id, frame_bb:GetSize(), 1 --[[ImGuiChildFlags.Borders]], 4 --[[ImGuiWindowFlags.NoMove]]) g.NavActivateId = backup_activate_id ImGui.PopStyleVar(3) ImGui.PopStyleColor() @@ -52916,17 +52959,17 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- Support for internal ImGuiInputTextFlags.MergedItem flag, which could be redesigned as an ItemFlags if needed (with test performed in ItemAdd) ImGui.ItemSize(total_bb, style.FramePadding.y) - if bit32.band(flags, ImGuiInputTextFlags.TempInput) == 0 then - if not ImGui.ItemAdd(total_bb, id, frame_bb, ImGuiItemFlags.Inputable) then + if bit32.band(flags, 134217728 --[[ImGuiInputTextFlags.TempInput]]) == 0 then + if not ImGui.ItemAdd(total_bb, id, frame_bb, 1048576 --[[ImGuiItemFlags.Inputable]]) then return false end end end -- Ensure mouse cursor is set even after switching to keyboard/gamepad mode. May generalize further? (#6417) - local hovered = ImGui.ItemHoverable(frame_bb, id, bit32.bor(g.LastItemData.ItemFlags, ImGuiItemFlags.NoNavDisableMouseHover)) + local hovered = ImGui.ItemHoverable(frame_bb, id, bit32.bor(g.LastItemData.ItemFlags, 32768 --[[ImGuiItemFlags.NoNavDisableMouseHover]])) if hovered then - ImGui.SetMouseCursor(ImGuiMouseCursor.TextInput) + ImGui.SetMouseCursor(1 --[[ImGuiMouseCursor.TextInput]]) end if hovered and g.NavHighlightItemUnderNav then hovered = false @@ -52935,44 +52978,44 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- We are only allowed to access the state if we are already the active widget. local state = ImGui.GetInputTextState(id) - if bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.ReadOnly) ~= 0 then - flags = bit32.bor(flags, ImGuiInputTextFlags.ReadOnly) + if bit32.band(g.LastItemData.ItemFlags, 2048 --[[ImGuiItemFlags.ReadOnly]]) ~= 0 then + flags = bit32.bor(flags, 512 --[[ImGuiInputTextFlags.ReadOnly]]) end - local is_readonly = bit32.band(flags, ImGuiInputTextFlags.ReadOnly) ~= 0 - local is_password = bit32.band(flags, ImGuiInputTextFlags.Password) ~= 0 - local is_undoable = bit32.band(flags, ImGuiInputTextFlags.NoUndoRedo) == 0 - local is_resizable = bit32.band(flags, ImGuiInputTextFlags.CallbackResize) ~= 0 + local is_readonly = bit32.band(flags, 512 --[[ImGuiInputTextFlags.ReadOnly]]) ~= 0 + local is_password = bit32.band(flags, 1024 --[[ImGuiInputTextFlags.Password]]) ~= 0 + local is_undoable = bit32.band(flags, 65536 --[[ImGuiInputTextFlags.NoUndoRedo]]) == 0 + local is_resizable = bit32.band(flags, 4194304 --[[ImGuiInputTextFlags.CallbackResize]]) ~= 0 if is_resizable then - IM_ASSERT(callback ~= nil) -- Must provide a callback if you set the ImGuiInputTextFlags.CallbackResize flag! + assert(callback ~= nil) -- Must provide a callback if you set the ImGuiInputTextFlags.CallbackResize flag! end -- Word-wrapping: enforcing a fixed width not altered by vertical scrollbar makes things easier, notably to track cursor reliably and avoid one-frame glitches. -- Instead of using ImGuiWindowFlags_AlwaysVerticalScrollbar we account for that space if the scrollbar is not visible. - local is_wordwrap = bit32.band(flags, ImGuiInputTextFlags.WordWrap) ~= 0 + local is_wordwrap = bit32.band(flags, 16777216 --[[ImGuiInputTextFlags.WordWrap]]) ~= 0 local wrap_width = 0.0 if is_wordwrap then wrap_width = ImMax(1.0, ImGui.GetContentRegionAvail().x + (draw_window.ScrollbarY and 0.0 or -g.Style.ScrollbarSize)) end local user_clicked = hovered and io.MouseClicked[0] - local input_requested_by_nav = (g.ActiveId ~= id) and (g.NavActivateId == id) and ((bit32.band(g.NavActivateFlags, ImGuiActivateFlags.PreferInput) ~= 0) or (g.NavInputSource == ImGuiInputSource.Keyboard)) + local input_requested_by_nav = (g.ActiveId ~= id) and (g.NavActivateId == id) and ((bit32.band(g.NavActivateFlags, 1 --[[ImGuiActivateFlags.PreferInput]]) ~= 0) or (g.NavInputSource == 2 --[[ImGuiInputSource.Keyboard]])) local input_requested_by_reactivate = (g.InputTextReactivateId == id) -- for io.ConfigInputTextEnterKeepActive - local input_requested_by_user = (user_clicked) or (g.ActiveId == 0 and bit32.band(flags, ImGuiInputTextFlags.TempInput) ~= 0 and g.InputTextDeactivatedState.ID ~= id) - local scrollbar_id = (is_multiline and state ~= nil) and ImGui.GetWindowScrollbarID(draw_window, ImGuiAxis.Y) or 0 + local input_requested_by_user = (user_clicked) or (g.ActiveId == 0 and bit32.band(flags, 134217728 --[[ImGuiInputTextFlags.TempInput]]) ~= 0 and g.InputTextDeactivatedState.ID ~= id) + local scrollbar_id = (is_multiline and state ~= nil) and ImGui.GetWindowScrollbarID(draw_window, 2 --[[ImGuiAxis.Y]]) or 0 local user_scroll_finish = is_multiline and state ~= nil and g.ActiveId == 0 and g.ActiveIdPreviousFrame == scrollbar_id local user_scroll_active = is_multiline and state ~= nil and g.ActiveId == scrollbar_id local clear_active_id = false local select_all = false - local scroll_y = is_multiline and draw_window.Scroll.y or FLT_MAX + local scroll_y = is_multiline and draw_window.Scroll.y or 3.4028234663853e+38 --[[FLT_MAX]] local init_reload_from_user_buf = (state ~= nil and state.WantReloadUserBuf) local init_changed_specs_multiline = (state ~= nil and (state.Stb.single_line ~= (not is_multiline))) -- state ~= nil means its our state. - local init_changed_specs_readonly = (state ~= nil and (bit32.band(bit32.bxor(state.Flags, flags), ImGuiInputTextFlags.ReadOnly) ~= 0)) -- state ~= nil means its our state. + local init_changed_specs_readonly = (state ~= nil and (bit32.band(bit32.bxor(state.Flags, flags), 512 --[[ImGuiInputTextFlags.ReadOnly]]) ~= 0)) -- state ~= nil means its our state. local init_make_active = (input_requested_by_user or input_requested_by_nav or input_requested_by_reactivate or user_scroll_finish) if init_reload_from_user_buf then local new_len = ImStd.ImStrlen(buf) - IM_ASSERT(new_len + 1 <= buf_size, "Is your input buffer properly zero-terminated?") + assert(new_len + 1 <= buf_size, "Is your input buffer properly zero-terminated?") state.WantReloadUserBuf = false --- @cast state ImGuiInputTextState InputTextReconcileUndoState(state, state.TextA.Data, state.TextLen, buf, new_len) @@ -52995,7 +53038,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- Take a copy of the initial buffer value. -- From the moment we focused we are normally ignoring the content of 'buf' (unless we are in read-only mode) local buf_len = ImStd.ImStrlen(buf) - IM_ASSERT(((buf_len + 1 <= buf_size) or (buf_len == 0 and buf_size == 0)), "Is your input buffer properly zero-terminated?") + assert(((buf_len + 1 <= buf_size) or (buf_len == 0 and buf_size == 0)), "Is your input buffer properly zero-terminated?") if not user_scroll_finish then state.TextToRevertTo:resize(buf_len + 1) -- UTF-8. we use +1 to make sure that .Data is always pointing to at least an empty string. ImStd.memmove(state.TextToRevertTo.Data, 1, buf, 1, buf_len + 1) @@ -53019,7 +53062,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- Find initial scroll position for right alignment ImVec2_Copy(state.Scroll, ImVec2(0.0, 0.0)) - if bit32.band(flags, ImGuiInputTextFlags.ElideLeft) ~= 0 then + if bit32.band(flags, 131072 --[[ImGuiInputTextFlags.ElideLeft]]) ~= 0 then state.Scroll.x = state.Scroll.x + ImMax(0.0, ImGui.CalcTextSize(table.concat(buf)).x - frame_size.x + style.FramePadding.x * 2.0) -- FIXME: no table.concat here end @@ -53030,10 +53073,10 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback end if not is_multiline then - if bit32.band(flags, ImGuiInputTextFlags.AutoSelectAll) ~= 0 then + if bit32.band(flags, 4096 --[[ImGuiInputTextFlags.AutoSelectAll]]) ~= 0 then select_all = true end - if input_requested_by_nav and (not recycle_state or (bit32.band(g.NavActivateFlags, ImGuiActivateFlags.TryToPreserveState) == 0)) then + if input_requested_by_nav and (not recycle_state or (bit32.band(g.NavActivateFlags, 4 --[[ImGuiActivateFlags.TryToPreserveState]]) == 0)) then select_all = true end if user_clicked and io.KeyCtrl then @@ -53041,7 +53084,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback end end - if bit32.band(flags, ImGuiInputTextFlags.AlwaysOverwrite) ~= 0 then + if bit32.band(flags, 2048 --[[ImGuiInputTextFlags.AlwaysOverwrite]]) ~= 0 then state.Stb.insert_mode = true -- stb field name is indeed incorrect (see #2863) end end @@ -53049,7 +53092,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback local is_osx = io.ConfigMacOSXBehaviors if init_make_active and g.ActiveId ~= id then - IM_ASSERT(state ~= nil and state.ID == id) + assert(state ~= nil and state.ID == id) ImGui.SetActiveID(id, window) ImGui.SetFocusID(id, window) ImGui.FocusWindow(window) @@ -53060,26 +53103,26 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback if g.ActiveId == id then -- Declare some inputs, the other are registered and polled via Shortcut() routing system. -- FIXME: The reason we don't use Shortcut() is we would need a routing flag to specify multiple mods, or to all mods combination into individual shortcuts. - local always_owned_keys = { ImGuiKey.LeftArrow, ImGuiKey.RightArrow, ImGuiKey.Delete, ImGuiKey.Backspace, ImGuiKey.Home, ImGuiKey.End } + local always_owned_keys = { 513 --[[ImGuiKey.LeftArrow]], 514 --[[ImGuiKey.RightArrow]], 522 --[[ImGuiKey.Delete]], 523 --[[ImGuiKey.Backspace]], 519 --[[ImGuiKey.Home]], 520 --[[ImGuiKey.End]] } for _, key in ipairs(always_owned_keys) do ImGui.SetKeyOwner(key, id) end if user_clicked then - ImGui.SetKeyOwner(ImGuiKey.MouseLeft, id) + ImGui.SetKeyOwner(656 --[[ImGuiKey.MouseLeft]], id) end - g.ActiveIdUsingNavDirMask = bit32.bor(g.ActiveIdUsingNavDirMask, bit32.lshift(1, ImGuiDir.Left), bit32.lshift(1, ImGuiDir.Right)) - if is_multiline or (bit32.band(flags, ImGuiInputTextFlags.CallbackHistory) ~= 0) then - g.ActiveIdUsingNavDirMask = bit32.bor(g.ActiveIdUsingNavDirMask, bit32.lshift(1, ImGuiDir.Up), bit32.lshift(1, ImGuiDir.Down)) - ImGui.SetKeyOwner(ImGuiKey.UpArrow, id) - ImGui.SetKeyOwner(ImGuiKey.DownArrow, id) + g.ActiveIdUsingNavDirMask = bit32.bor(g.ActiveIdUsingNavDirMask, bit32.lshift(1, 0 --[[ImGuiDir.Left]]), bit32.lshift(1, 1 --[[ImGuiDir.Right]])) + if is_multiline or (bit32.band(flags, 524288 --[[ImGuiInputTextFlags.CallbackHistory]]) ~= 0) then + g.ActiveIdUsingNavDirMask = bit32.bor(g.ActiveIdUsingNavDirMask, bit32.lshift(1, 2 --[[ImGuiDir.Up]]), bit32.lshift(1, 3 --[[ImGuiDir.Down]])) + ImGui.SetKeyOwner(515 --[[ImGuiKey.UpArrow]], id) + ImGui.SetKeyOwner(516 --[[ImGuiKey.DownArrow]], id) end if is_multiline then - ImGui.SetKeyOwner(ImGuiKey.PageUp, id) - ImGui.SetKeyOwner(ImGuiKey.PageDown, id) + ImGui.SetKeyOwner(517 --[[ImGuiKey.PageUp]], id) + ImGui.SetKeyOwner(518 --[[ImGuiKey.PageDown]], id) end -- FIXME: May be a problem to always steal Alt on OSX, would ideally still allow an uninterrupted Alt down-up to toggle menu if is_osx then - ImGui.SetKeyOwner(ImGuiMod_Alt, id) + ImGui.SetKeyOwner(16384 --[[ImGuiMod_Alt]], id) end -- Expose scroll in a manner that is agnostic to us using a child window @@ -53141,7 +53184,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- Process mouse inputs and character inputs if g.ActiveId == id then --- @cast state ImGuiInputTextState - IM_ASSERT(state ~= nil) + assert(state ~= nil) state.EditedThisFrame = false state.BufCapacity = buf_size state.WrapWidth = wrap_width @@ -53166,7 +53209,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- FIXME: There are likely many ways to improve this behavior, but there's no "right" behavior (depends on use-case, software, OS) local is_bol = (state.Stb.cursor == 1) or ImStb.TEXTEDIT_GETCHAR(state, state.Stb.cursor - 1) == 10 if stbte.HAS_SELECTION(state.Stb) or not is_bol then - state:OnKeyPressed(STB_TEXTEDIT_K_WORDLEFT) + state:OnKeyPressed(2097164 --[[STB_TEXTEDIT_K_WORDLEFT]]) end -- state:OnKeyPressed(bit32.bor(STB_TEXTEDIT_K_WORDRIGHT, STB_TEXTEDIT_K_SHIFT)) if not stbte.HAS_SELECTION(state.Stb) then @@ -53179,9 +53222,9 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- Triple-click: Select line local is_eol = ImStb.TEXTEDIT_GETCHAR(state, state.Stb.cursor) == 10 state.WrapWidth = 0.0 -- Temporarily disable wrapping so we use real line start. - state:OnKeyPressed(STB_TEXTEDIT_K_LINESTART) - state:OnKeyPressed(bit32.bor(STB_TEXTEDIT_K_LINEEND, STB_TEXTEDIT_K_SHIFT)) - state:OnKeyPressed(bit32.bor(STB_TEXTEDIT_K_RIGHT, STB_TEXTEDIT_K_SHIFT)) + state:OnKeyPressed(2097156 --[[STB_TEXTEDIT_K_LINESTART]]) + state:OnKeyPressed(bit32.bor(2097157 --[[STB_TEXTEDIT_K_LINEEND]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]])) + state:OnKeyPressed(bit32.bor(2097153 --[[STB_TEXTEDIT_K_RIGHT]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]])) state.WrapWidth = wrap_width if not is_eol and is_multiline then state.Stb.select_start, state.Stb.select_end = state.Stb.select_end, state.Stb.select_start @@ -53210,8 +53253,8 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- We expect backends to emit a Tab key but some also emit a Tab character which we ignore (#2467, #1336) -- (For Tab and Enter: Win32/SFML/Allegro are sending both keys and chars, GLFW and SDL are only sending keys. For Space they all send all threes) - if bit32.band(flags, ImGuiInputTextFlags.AllowTabInput) ~= 0 and not is_readonly then - if ImGui.Shortcut(ImGuiKey.Tab, ImGuiInputFlags.Repeat, id) then + if bit32.band(flags, 32 --[[ImGuiInputTextFlags.AllowTabInput]]) ~= 0 and not is_readonly then + if ImGui.Shortcut(512 --[[ImGuiKey.Tab]], 1 --[[ImGuiInputFlags.Repeat]], id) then local c = 9 -- Insert TAB local ret2 c, ret2 = InputTextFilterCharacter(g, state, c, callback, callback_user_data) @@ -53256,82 +53299,82 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- Process other shortcuts/key-presses local revert_edit = false if g.ActiveId == id and not g.ActiveIdIsJustActivated and not clear_active_id then - IM_ASSERT(state ~= nil) + assert(state ~= nil) --- @cast state ImGuiInputTextState local row_count_per_page = ImMax(ImTrunc((inner_size.y - style.FramePadding.y) / g.FontSize), 1) state.Stb.row_count_per_page = row_count_per_page - local k_mask = (io.KeyShift and STB_TEXTEDIT_K_SHIFT or 0) + local k_mask = (io.KeyShift and 4194304 --[[STB_TEXTEDIT_K_SHIFT]] or 0) local is_wordmove_key_down = is_osx and io.KeyAlt or io.KeyCtrl -- OS X style: Text editing cursor movement using Alt instead of Ctrl local is_startend_key_down = is_osx and io.KeyCtrl and not io.KeySuper and not io.KeyAlt -- OS X style: Line/Text Start and End using Cmd+Arrows instead of Home/End -- Using Shortcut() with ImGuiInputFlags.RouteFocused (default policy) to allow routing operations for other code (e.g. calling window trying to use Ctrl+A and Ctrl+B: former would be handled by InputText) -- Otherwise we could simply assume that we own the keys as we are active. - local f_repeat = ImGuiInputFlags.Repeat - local is_cut = (ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.X), f_repeat, id) or ImGui.Shortcut(bit32.bor(ImGuiMod_Shift, ImGuiKey.Delete), f_repeat, id)) and not is_readonly and not is_password and (not is_multiline or state:HasSelection()) - local is_copy = (ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.C), 0, id) or ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.Insert), 0, id)) and not is_password and (not is_multiline or state:HasSelection()) - local is_paste = (ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.V), f_repeat, id) or ImGui.Shortcut(bit32.bor(ImGuiMod_Shift, ImGuiKey.Insert), f_repeat, id)) and not is_readonly - local is_undo = (ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.Z), f_repeat, id)) and not is_readonly and is_undoable - local is_redo = (ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.Y), f_repeat, id) or ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey.Z), f_repeat, id)) and not is_readonly and is_undoable - local is_select_all = ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.A), 0, id) + local f_repeat = 1 --[[ImGuiInputFlags.Repeat]] + local is_cut = (ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 569 --[[ImGuiKey.X]]), f_repeat, id) or ImGui.Shortcut(bit32.bor(8192 --[[ImGuiMod_Shift]], 522 --[[ImGuiKey.Delete]]), f_repeat, id)) and not is_readonly and not is_password and (not is_multiline or state:HasSelection()) + local is_copy = (ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 548 --[[ImGuiKey.C]]), 0, id) or ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 521 --[[ImGuiKey.Insert]]), 0, id)) and not is_password and (not is_multiline or state:HasSelection()) + local is_paste = (ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 567 --[[ImGuiKey.V]]), f_repeat, id) or ImGui.Shortcut(bit32.bor(8192 --[[ImGuiMod_Shift]], 521 --[[ImGuiKey.Insert]]), f_repeat, id)) and not is_readonly + local is_undo = (ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 571 --[[ImGuiKey.Z]]), f_repeat, id)) and not is_readonly and is_undoable + local is_redo = (ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 570 --[[ImGuiKey.Y]]), f_repeat, id) or ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 8192 --[[ImGuiMod_Shift]], 571 --[[ImGuiKey.Z]]), f_repeat, id)) and not is_readonly and is_undoable + local is_select_all = ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 546 --[[ImGuiKey.A]]), 0, id) -- We allow validate/cancel with Nav source (gamepad) to makes it easier to undo an accidental NavInput press with no keyboard wired, but otherwise it isn't very useful. - local nav_gamepad_active = (bit32.band(io.ConfigFlags, ImGuiConfigFlags.NavEnableGamepad) ~= 0) and (bit32.band(io.BackendFlags, ImGuiBackendFlags.HasGamepad) ~= 0) - local is_enter = ImGui.Shortcut(ImGuiKey.Enter, f_repeat, id) or ImGui.Shortcut(ImGuiKey.KeypadEnter, f_repeat, id) - local is_ctrl_enter = ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.Enter), f_repeat, id) or ImGui.Shortcut(bit32.bor(ImGuiMod_Ctrl, ImGuiKey.KeypadEnter), f_repeat, id) - local is_shift_enter = ImGui.Shortcut(bit32.bor(ImGuiMod_Shift, ImGuiKey.Enter), f_repeat, id) or ImGui.Shortcut(bit32.bor(ImGuiMod_Shift, ImGuiKey.KeypadEnter), f_repeat, id) + local nav_gamepad_active = (bit32.band(io.ConfigFlags, 2 --[[ImGuiConfigFlags.NavEnableGamepad]]) ~= 0) and (bit32.band(io.BackendFlags, 1 --[[ImGuiBackendFlags.HasGamepad]]) ~= 0) + local is_enter = ImGui.Shortcut(525 --[[ImGuiKey.Enter]], f_repeat, id) or ImGui.Shortcut(627 --[[ImGuiKey.KeypadEnter]], f_repeat, id) + local is_ctrl_enter = ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 525 --[[ImGuiKey.Enter]]), f_repeat, id) or ImGui.Shortcut(bit32.bor(4096 --[[ImGuiMod_Ctrl]], 627 --[[ImGuiKey.KeypadEnter]]), f_repeat, id) + local is_shift_enter = ImGui.Shortcut(bit32.bor(8192 --[[ImGuiMod_Shift]], 525 --[[ImGuiKey.Enter]]), f_repeat, id) or ImGui.Shortcut(bit32.bor(8192 --[[ImGuiMod_Shift]], 627 --[[ImGuiKey.KeypadEnter]]), f_repeat, id) local is_gamepad_validate = nav_gamepad_active and ImGui.IsKeyPressed(ImGuiKey.NavGamepadActivate, false) - local is_cancel = ImGui.Shortcut(ImGuiKey.Escape, f_repeat, id) or (nav_gamepad_active and ImGui.Shortcut(ImGuiKey.NavGamepadCancel, f_repeat, id)) + local is_cancel = ImGui.Shortcut(526 --[[ImGuiKey.Escape]], f_repeat, id) or (nav_gamepad_active and ImGui.Shortcut(ImGuiKey.NavGamepadCancel, f_repeat, id)) -- FIXME: Should use more Shortcut() and reduce IsKeyPressed()+SetKeyOwner(), but requires modifiers combination to be taken account of. -- FIXME-OSX: Missing support for Alt(option)+Right/Left = go to end of line, or next line if already in end of line. - if ImGui.IsKeyPressed(ImGuiKey.LeftArrow) then - state:OnKeyPressed(bit32.bor(is_startend_key_down and STB_TEXTEDIT_K_LINESTART or (is_wordmove_key_down and STB_TEXTEDIT_K_WORDLEFT or STB_TEXTEDIT_K_LEFT), k_mask)) - elseif ImGui.IsKeyPressed(ImGuiKey.RightArrow) then - state:OnKeyPressed(bit32.bor(is_startend_key_down and STB_TEXTEDIT_K_LINEEND or (is_wordmove_key_down and STB_TEXTEDIT_K_WORDRIGHT or STB_TEXTEDIT_K_RIGHT), k_mask)) - elseif ImGui.IsKeyPressed(ImGuiKey.UpArrow) and is_multiline then + if ImGui.IsKeyPressed(513 --[[ImGuiKey.LeftArrow]]) then + state:OnKeyPressed(bit32.bor(is_startend_key_down and 2097156 --[[STB_TEXTEDIT_K_LINESTART]] or (is_wordmove_key_down and 2097164 --[[STB_TEXTEDIT_K_WORDLEFT]] or 2097152 --[[STB_TEXTEDIT_K_LEFT]]), k_mask)) + elseif ImGui.IsKeyPressed(514 --[[ImGuiKey.RightArrow]]) then + state:OnKeyPressed(bit32.bor(is_startend_key_down and 2097157 --[[STB_TEXTEDIT_K_LINEEND]] or (is_wordmove_key_down and 2097165 --[[STB_TEXTEDIT_K_WORDRIGHT]] or 2097153 --[[STB_TEXTEDIT_K_RIGHT]]), k_mask)) + elseif ImGui.IsKeyPressed(515 --[[ImGuiKey.UpArrow]]) and is_multiline then if io.KeyCtrl then ImGui.SetScrollY(draw_window, ImMax(draw_window.Scroll.y - g.FontSize, 0.0)) else - state:OnKeyPressed(bit32.bor(is_startend_key_down and STB_TEXTEDIT_K_TEXTSTART or STB_TEXTEDIT_K_UP, k_mask)) + state:OnKeyPressed(bit32.bor(is_startend_key_down and 2097158 --[[STB_TEXTEDIT_K_TEXTSTART]] or 2097154 --[[STB_TEXTEDIT_K_UP]], k_mask)) end - elseif ImGui.IsKeyPressed(ImGuiKey.DownArrow) and is_multiline then + elseif ImGui.IsKeyPressed(516 --[[ImGuiKey.DownArrow]]) and is_multiline then if io.KeyCtrl then ImGui.SetScrollY(draw_window, ImMin(draw_window.Scroll.y + g.FontSize, ImGui.GetScrollMaxY())) else - state:OnKeyPressed(bit32.bor(is_startend_key_down and STB_TEXTEDIT_K_TEXTEND or STB_TEXTEDIT_K_DOWN, k_mask)) + state:OnKeyPressed(bit32.bor(is_startend_key_down and 2097159 --[[STB_TEXTEDIT_K_TEXTEND]] or 2097155 --[[STB_TEXTEDIT_K_DOWN]], k_mask)) end - elseif ImGui.IsKeyPressed(ImGuiKey.PageUp) and is_multiline then - state:OnKeyPressed(bit32.bor(STB_TEXTEDIT_K_PGUP, k_mask)) + elseif ImGui.IsKeyPressed(517 --[[ImGuiKey.PageUp]]) and is_multiline then + state:OnKeyPressed(bit32.bor(2097166 --[[STB_TEXTEDIT_K_PGUP]], k_mask)) scroll_y = scroll_y - row_count_per_page * g.FontSize - elseif ImGui.IsKeyPressed(ImGuiKey.PageDown) and is_multiline then - state:OnKeyPressed(bit32.bor(STB_TEXTEDIT_K_PGDOWN, k_mask)) + elseif ImGui.IsKeyPressed(518 --[[ImGuiKey.PageDown]]) and is_multiline then + state:OnKeyPressed(bit32.bor(2097167 --[[STB_TEXTEDIT_K_PGDOWN]], k_mask)) scroll_y = scroll_y + row_count_per_page * g.FontSize - elseif ImGui.IsKeyPressed(ImGuiKey.Home) then - state:OnKeyPressed(io.KeyCtrl and bit32.bor(STB_TEXTEDIT_K_TEXTSTART, k_mask) or bit32.bor(STB_TEXTEDIT_K_LINESTART, k_mask)) - elseif ImGui.IsKeyPressed(ImGuiKey.End) then - state:OnKeyPressed(io.KeyCtrl and bit32.bor(STB_TEXTEDIT_K_TEXTEND, k_mask) or bit32.bor(STB_TEXTEDIT_K_LINEEND, k_mask)) - elseif ImGui.IsKeyPressed(ImGuiKey.Delete) and not is_readonly and not is_cut then + elseif ImGui.IsKeyPressed(519 --[[ImGuiKey.Home]]) then + state:OnKeyPressed(io.KeyCtrl and bit32.bor(2097158 --[[STB_TEXTEDIT_K_TEXTSTART]], k_mask) or bit32.bor(2097156 --[[STB_TEXTEDIT_K_LINESTART]], k_mask)) + elseif ImGui.IsKeyPressed(520 --[[ImGuiKey.End]]) then + state:OnKeyPressed(io.KeyCtrl and bit32.bor(2097159 --[[STB_TEXTEDIT_K_TEXTEND]], k_mask) or bit32.bor(2097157 --[[STB_TEXTEDIT_K_LINEEND]], k_mask)) + elseif ImGui.IsKeyPressed(522 --[[ImGuiKey.Delete]]) and not is_readonly and not is_cut then if not state:HasSelection() then -- OSX doesn't seem to have Super+Delete to delete until end-of-line, so we don't emulate that (as opposed to Super+Backspace) if is_wordmove_key_down then - state:OnKeyPressed(bit32.bor(STB_TEXTEDIT_K_WORDRIGHT, STB_TEXTEDIT_K_SHIFT)) + state:OnKeyPressed(bit32.bor(2097165 --[[STB_TEXTEDIT_K_WORDRIGHT]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]])) end end - state:OnKeyPressed(bit32.bor(STB_TEXTEDIT_K_DELETE, k_mask)) - elseif ImGui.IsKeyPressed(ImGuiKey.Backspace) and not is_readonly then + state:OnKeyPressed(bit32.bor(2097160 --[[STB_TEXTEDIT_K_DELETE]], k_mask)) + elseif ImGui.IsKeyPressed(523 --[[ImGuiKey.Backspace]]) and not is_readonly then if not state:HasSelection() then if is_wordmove_key_down then - state:OnKeyPressed(bit32.bor(STB_TEXTEDIT_K_WORDLEFT, STB_TEXTEDIT_K_SHIFT)) + state:OnKeyPressed(bit32.bor(2097164 --[[STB_TEXTEDIT_K_WORDLEFT]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]])) elseif is_osx and io.KeyCtrl and not io.KeyAlt and not io.KeySuper then - state:OnKeyPressed(bit32.bor(STB_TEXTEDIT_K_LINESTART, STB_TEXTEDIT_K_SHIFT)) + state:OnKeyPressed(bit32.bor(2097156 --[[STB_TEXTEDIT_K_LINESTART]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]])) end end - state:OnKeyPressed(bit32.bor(STB_TEXTEDIT_K_BACKSPACE, k_mask)) + state:OnKeyPressed(bit32.bor(2097161 --[[STB_TEXTEDIT_K_BACKSPACE]], k_mask)) elseif is_enter or is_ctrl_enter or is_shift_enter or is_gamepad_validate then -- Determine if we turn Enter into a \n character - local ctrl_enter_for_new_line = bit32.band(flags, ImGuiInputTextFlags.CtrlEnterForNewLine) ~= 0 + local ctrl_enter_for_new_line = bit32.band(flags, 256 --[[ImGuiInputTextFlags.CtrlEnterForNewLine]]) ~= 0 local is_new_line = is_multiline and not is_gamepad_validate and (is_shift_enter or (is_enter and not ctrl_enter_for_new_line) or (is_ctrl_enter and ctrl_enter_for_new_line)) if not is_new_line then validated = true @@ -53351,7 +53394,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback end end elseif is_cancel then - if bit32.band(flags, ImGuiInputTextFlags.EscapeClearsAll) ~= 0 then + if bit32.band(flags, 128 --[[ImGuiInputTextFlags.EscapeClearsAll]]) ~= 0 then if state.TextA.Data[1] ~= 0 then revert_edit = true else @@ -53366,7 +53409,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback render_selection = false end elseif is_undo or is_redo then - state:OnKeyPressed(is_undo and STB_TEXTEDIT_K_UNDO or STB_TEXTEDIT_K_REDO) + state:OnKeyPressed(is_undo and 2097162 --[[STB_TEXTEDIT_K_UNDO]] or 2097163 --[[STB_TEXTEDIT_K_REDO]]) state:ClearSelection() elseif is_select_all then state:SelectAll() @@ -53435,13 +53478,13 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback local apply_new_text = nil local apply_new_text_length = 0 if g.ActiveId == id then - IM_ASSERT(state ~= nil) + assert(state ~= nil) --- @cast state ImGuiInputTextState if revert_edit and not is_readonly then - if bit32.band(flags, ImGuiInputTextFlags.EscapeClearsAll) ~= 0 then + if bit32.band(flags, 128 --[[ImGuiInputTextFlags.EscapeClearsAll]]) ~= 0 then -- Clear input - IM_ASSERT(state.TextA.Data[1] ~= 0) + assert(state.TextA.Data[1] ~= 0) apply_new_text = {0} apply_new_text_length = 0 value_changed = true @@ -53459,26 +53502,26 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback end -- User callback - if bit32.band(flags, bit32.bor(ImGuiInputTextFlags.CallbackCompletion, ImGuiInputTextFlags.CallbackHistory, ImGuiInputTextFlags.CallbackEdit, ImGuiInputTextFlags.CallbackAlways)) ~= 0 then - IM_ASSERT(callback ~= nil) + if bit32.band(flags, bit32.bor(262144 --[[ImGuiInputTextFlags.CallbackCompletion]], 524288 --[[ImGuiInputTextFlags.CallbackHistory]], 8388608 --[[ImGuiInputTextFlags.CallbackEdit]], 1048576 --[[ImGuiInputTextFlags.CallbackAlways]])) ~= 0 then + assert(callback ~= nil) -- The reason we specify the usage semantic (Completion/History) is that Completion needs to disable keyboard TABBING at the moment. local event_flag = 0 - local event_key = ImGuiKey.None - if bit32.band(flags, ImGuiInputTextFlags.CallbackCompletion) ~= 0 and ImGui.Shortcut(ImGuiKey.Tab, 0, id) then - event_flag = ImGuiInputTextFlags.CallbackCompletion - event_key = ImGuiKey.Tab - elseif bit32.band(flags, ImGuiInputTextFlags.CallbackHistory) ~= 0 and ImGui.IsKeyPressed(ImGuiKey.UpArrow) then - event_flag = ImGuiInputTextFlags.CallbackHistory - event_key = ImGuiKey.UpArrow - elseif bit32.band(flags, ImGuiInputTextFlags.CallbackHistory) ~= 0 and ImGui.IsKeyPressed(ImGuiKey.DownArrow) then - event_flag = ImGuiInputTextFlags.CallbackHistory - event_key = ImGuiKey.DownArrow - elseif bit32.band(flags, ImGuiInputTextFlags.CallbackEdit) ~= 0 and state.EditedThisFrame then - event_flag = ImGuiInputTextFlags.CallbackEdit - elseif bit32.band(flags, ImGuiInputTextFlags.CallbackAlways) ~= 0 then - event_flag = ImGuiInputTextFlags.CallbackAlways + local event_key = 0 --[[ImGuiKey.None]] + if bit32.band(flags, 262144 --[[ImGuiInputTextFlags.CallbackCompletion]]) ~= 0 and ImGui.Shortcut(512 --[[ImGuiKey.Tab]], 0, id) then + event_flag = 262144 --[[ImGuiInputTextFlags.CallbackCompletion]] + event_key = 512 --[[ImGuiKey.Tab]] + elseif bit32.band(flags, 524288 --[[ImGuiInputTextFlags.CallbackHistory]]) ~= 0 and ImGui.IsKeyPressed(515 --[[ImGuiKey.UpArrow]]) then + event_flag = 524288 --[[ImGuiInputTextFlags.CallbackHistory]] + event_key = 515 --[[ImGuiKey.UpArrow]] + elseif bit32.band(flags, 524288 --[[ImGuiInputTextFlags.CallbackHistory]]) ~= 0 and ImGui.IsKeyPressed(516 --[[ImGuiKey.DownArrow]]) then + event_flag = 524288 --[[ImGuiInputTextFlags.CallbackHistory]] + event_key = 516 --[[ImGuiKey.DownArrow]] + elseif bit32.band(flags, 8388608 --[[ImGuiInputTextFlags.CallbackEdit]]) ~= 0 and state.EditedThisFrame then + event_flag = 8388608 --[[ImGuiInputTextFlags.CallbackEdit]] + elseif bit32.band(flags, 1048576 --[[ImGuiInputTextFlags.CallbackAlways]]) ~= 0 then + event_flag = 1048576 --[[ImGuiInputTextFlags.CallbackAlways]] end if event_flag ~= 0 then @@ -53492,7 +53535,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- FIXME-OPT: Undo stack reconcile needs a backup of the data until we rework API, see #7925 local callback_buf = is_readonly and buf or state.TextA.Data - IM_ASSERT(callback_buf == state.TextSrc) + assert(callback_buf == state.TextSrc) state.CallbackTextBackup:resize(state.TextLen + 1) ImStd.memmove(state.CallbackTextBackup.Data, 1, callback_buf, 1, state.TextLen + 1) @@ -53510,9 +53553,9 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- Read back what user may have modified callback_buf = is_readonly and buf or state.TextA.Data -- Pointer may have been invalidated by a resize callback - IM_ASSERT(callback_data.Buf == callback_buf) -- Invalid to modify those fields - IM_ASSERT(callback_data.BufSize == state.BufCapacity) - IM_ASSERT(callback_data.Flags == flags) + assert(callback_data.Buf == callback_buf) -- Invalid to modify those fields + assert(callback_data.BufSize == state.BufCapacity) + assert(callback_data.Flags == flags) if callback_data.BufDirty or callback_data.CursorPos ~= state.Stb.cursor then state.CursorFollow = true end @@ -53521,7 +53564,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback state.Stb.select_end = ImClamp(callback_data.SelectionEnd, 0, callback_data.BufTextLen) if callback_data.BufDirty then -- Callback may update buffer and thus set buf_dirty even in read-only mode. - IM_ASSERT(callback_data.BufTextLen == ImStd.ImStrlen(callback_data.Buf)) -- You need to maintain BufTextLen if you change the text! + assert(callback_data.BufTextLen == ImStd.ImStrlen(callback_data.Buf)) -- You need to maintain BufTextLen if you change the text! InputTextReconcileUndoState(state, state.CallbackTextBackup.Data, state.CallbackTextBackup.Size - 1, callback_data.Buf, callback_data.BufTextLen) state.TextLen = callback_data.BufTextLen -- Assume correct length and valid UTF-8 from user, saves us an extra strlen() state.EditedBefore = true; state.EditedThisFrame = true @@ -53533,7 +53576,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- Write back result string if modified. -- FIXME-OPT: Could mark dirty state from the stb_textedit callbacks if not is_readonly then - if bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.LiveEditOnInputScalar) ~= 0 then + if bit32.band(g.LastItemData.ItemFlags, 256 --[[ImGuiItemFlags.LiveEditOnInputScalar]]) ~= 0 then -- Apply when modified if (ImStd.strcmp(state.TextSrc, buf) ~= 0) then apply_new_text = state.TextSrc @@ -53553,7 +53596,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- This is used when e.g. losing focus or tabbing out into another InputText() which may already be using the temp buffer. if g.InputTextDeactivatedState.ID == id then -- The state only exists after an Edit. IsItemDeactivatedAfterEdit() is not valid in every code path (see "widgets_inputtext_status_noliveedit" test). - if ((g.ActiveId ~= id and ImGui.IsItemDeactivated()) or (g.ActiveId == id and bit32.band(flags, ImGuiInputTextFlags.TempInput) ~= 0)) then + if ((g.ActiveId ~= id and ImGui.IsItemDeactivated()) or (g.ActiveId == id and bit32.band(flags, 134217728 --[[ImGuiInputTextFlags.TempInput]]) ~= 0)) then if (not is_readonly and ImStd.strcmp(g.InputTextDeactivatedState.TextA.Data, buf) ~= 0) then apply_new_text = g.InputTextDeactivatedState.TextA.Data apply_new_text_length = g.InputTextDeactivatedState.TextA.Size - 1 @@ -53571,13 +53614,13 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- (PS: if you use this property together with ImGuiInputTextFlags.CallbackResize, you are at the risk of recreating a temporary -- allocated/string object every frame. Which in the grand scheme of scheme is nothing, but isn't dear imgui vibe). if apply_new_text ~= nil then - IM_ASSERT(apply_new_text_length >= 0) + assert(apply_new_text_length >= 0) if is_resizable then local callback_data = ImGuiInputTextCallbackData() callback_data.Ctx = g callback_data.ID = id callback_data.Flags = flags - callback_data.EventFlag = ImGuiInputTextFlags.CallbackResize + callback_data.EventFlag = 4194304 --[[ImGuiInputTextFlags.CallbackResize]] callback_data.EventActivated = (g.ActiveId == state.ID and g.ActiveIdIsJustActivated) callback_data.Buf = buf callback_data.BufTextLen = apply_new_text_length @@ -53589,7 +53632,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback buf = callback_data.Buf buf_size = callback_data.BufSize apply_new_text_length = ImMin(callback_data.BufTextLen, buf_size - 1) - IM_ASSERT(apply_new_text_length <= buf_size) + assert(apply_new_text_length <= buf_size) end -- IMGUI_DEBUG_PRINT("InputText(\"%s\"): apply_new_text length %d\n", label, apply_new_text_length); @@ -53608,7 +53651,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- Render frame if not is_multiline then ImGui.RenderNavCursor(frame_bb, id) - ImGui.RenderFrame(frame_bb.Min, frame_bb.Max, ImGui.GetColorU32(ImGuiCol.FrameBg), true, style.FrameRounding) + ImGui.RenderFrame(frame_bb.Min, frame_bb.Max, ImGui.GetColorU32(7 --[[ImGuiCol.FrameBg]]), true, style.FrameRounding) end local draw_pos = ImVec2() @@ -53667,7 +53710,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback local will_scroll_y = state and ((state.CursorFollow and render_cursor) or (state.CursorCenterY and (render_cursor or render_selection))) --- @cast buf_display_end int local out_buf_end - line_count, out_buf_end = InputTextLineIndexBuild(flags, line_index, buf_display, buf_display_end, wrap_width, will_scroll_y and INT_MAX or (line_visible_n1 + 1)) + line_count, out_buf_end = InputTextLineIndexBuild(flags, line_index, buf_display, buf_display_end, wrap_width, will_scroll_y and 2147483647 --[[INT_MAX]] or (line_visible_n1 + 1)) if buf_display_end then buf_display_end = out_buf_end end @@ -53685,7 +53728,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback local draw_scroll = ImVec2() -- Render text. We currently only render selection when the widget is active or while scrolling. - local text_col = ImGui.GetColorU32(is_displaying_hint and ImGuiCol.TextDisabled or ImGuiCol.Text) + local text_col = ImGui.GetColorU32(is_displaying_hint and 1 --[[ImGuiCol.TextDisabled]] or 0 --[[ImGuiCol.Text]]) if render_cursor or render_selection then -- Render text (with cursor and selection) -- This is going to be messy. We need to: @@ -53694,14 +53737,14 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- - Measure text height (for scrollbar) -- We are attempting to do most of that in **one main pass** to minimize the computation cost (non-negligible for large amount of text) + 2nd pass for selection rendering (we could merge them by an extra refactoring effort) -- FIXME: This should occur on buf_display but we'd need to maintain cursor/select_start/select_end for UTF-8. - IM_ASSERT(state ~= nil) + assert(state ~= nil) state.LineCount = line_count -- Scroll local new_scroll_y = scroll_y if render_cursor and state.CursorFollow then -- Horizontal scroll in chunks of quarter width - if bit32.band(flags, ImGuiInputTextFlags.NoHorizontalScroll) == 0 then + if bit32.band(flags, 32768 --[[ImGuiInputTextFlags.NoHorizontalScroll]]) == 0 then local scroll_increment_x = inner_size.x * 0.25 local visible_width = inner_size.x - style.FramePadding.x if cursor_offset.x < state.Scroll.x then @@ -53743,7 +53786,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback -- Draw selection draw_scroll.x = state.Scroll.x if render_selection then - local bg_color = ImGui.GetColorU32(ImGuiCol.TextSelectedBg, render_cursor and 1.0 or 0.6) -- FIXME: current code flow mandate that render_cursor is always true here, we are leaving the transparent one for tests. + local bg_color = ImGui.GetColorU32(54 --[[ImGuiCol.TextSelectedBg]], render_cursor and 1.0 or 0.6) -- FIXME: current code flow mandate that render_cursor is always true here, we are leaving the transparent one for tests. local bg_offy_up = is_multiline and 0.0 or -1.0 -- FIXME-DPI: those offsets should be part of the style? they don't play so well with multi-line selection. local bg_offy_dn = is_multiline and 0.0 or 2.0 local bg_eol_width = IM_TRUNC(g.FontBaked:GetCharAdvance(32) * 0.50) -- So we can see selected empty lines @@ -53787,20 +53830,20 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback end -- Find render position for right alignment (single-line only) - if g.ActiveId ~= id and bit32.band(flags, ImGuiInputTextFlags.ElideLeft) ~= 0 and not render_cursor and not render_selection then + if g.ActiveId ~= id and bit32.band(flags, 131072 --[[ImGuiInputTextFlags.ElideLeft]]) ~= 0 and not render_cursor and not render_selection then draw_pos.x = ImMin(draw_pos.x, frame_bb.Max.x - ImGui.CalcTextSize(buf_display, nil).x - style.FramePadding.x) end -- draw_scroll.x = state.Scroll.x -- Preserve scroll when inactive? -- Render text - if (is_multiline or (buf_display_end - 1) < buf_display_max_length) and bit32.band(text_col, IM_COL32_A_MASK) ~= 0 and line_visible_n0 < line_visible_n1 then + if (is_multiline or (buf_display_end - 1) < buf_display_max_length) and bit32.band(text_col, 4278190080 --[[IM_COL32_A_MASK]]) ~= 0 and line_visible_n0 < line_visible_n1 then g.Font:RenderText(draw_window.DrawList, g.FontSize, draw_pos - draw_scroll + ImVec2(0.0, (line_visible_n0 - 1) * g.FontSize), text_col, clip_rect:AsVec4(), buf_display, line_index:get_line_begin(1, line_visible_n0), line_index:get_line_end(1, line_visible_n1 - 1), - wrap_width, bit32.bor(ImDrawTextFlags.WrapKeepBlanks, ImDrawTextFlags.CpuFineClip)) + wrap_width, bit32.bor(2 --[[ImDrawTextFlags.WrapKeepBlanks]], 1 --[[ImDrawTextFlags.CpuFineClip]])) end -- Render blinking cursor @@ -53812,7 +53855,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback 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) 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(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) 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.) @@ -53835,14 +53878,14 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback if is_multiline then -- For focus requests to work on our multiline we need to ensure our child ItemAdd() call specifies the ImGuiItemFlags.Inputable (see #4761, #7870)... ImGui.Dummy(ImVec2(0.0, text_size_y + style.FramePadding.y)) - g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, ImGuiItemFlags.Inputable, ImGuiItemFlags.NoTabStop) + g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, 1048576 --[[ImGuiItemFlags.Inputable]], 1 --[[ImGuiItemFlags.NoTabStop]]) ImGui.EndChild() - item_data_backup.StatusFlags = bit32.bor(item_data_backup.StatusFlags, bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HoveredWindow)) + item_data_backup.StatusFlags = bit32.bor(item_data_backup.StatusFlags, bit32.band(g.LastItemData.StatusFlags, 128 --[[ImGuiItemStatusFlags.HoveredWindow]])) -- ...and then we need to undo the group overriding last item data, which gets a bit messy as EndGroup() tries to forward scrollbar being active... -- FIXME: This quite messy/tricky, should attempt to get rid of the child window. ImGui.EndGroup() - if g.LastItemData.ID == 0 or g.LastItemData.ID ~= ImGui.GetWindowScrollbarID(draw_window, ImGuiAxis.Y) then + if g.LastItemData.ID == 0 or g.LastItemData.ID ~= ImGui.GetWindowScrollbarID(draw_window, 2 --[[ImGuiAxis.Y]]) then g.LastItemData.ID = id g.LastItemData.ItemFlags = item_data_backup.ItemFlags g.LastItemData.StatusFlags = item_data_backup.StatusFlags @@ -53861,7 +53904,7 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback ImGui.MarkItemEdited(id) end - if bit32.band(flags, ImGuiInputTextFlags.EnterReturnsTrue) ~= 0 then + if bit32.band(flags, 64 --[[ImGuiInputTextFlags.EnterReturnsTrue]]) ~= 0 then return validated else return value_changed @@ -53878,7 +53921,7 @@ end function ImGui.InputTextWithHint(label, hint, buf, buf_size, flags, callback, user_data) if flags == nil then flags = 0 end - IM_ASSERT(bit32.band(flags, ImGuiInputTextFlags.Multiline) == 0) -- call InputTextMultiline() or InputTextEx() manually if you need multi-line + hint. + assert(bit32.band(flags, 67108864 --[[ImGuiInputTextFlags.Multiline]]) == 0) -- call InputTextMultiline() or InputTextEx() manually if you need multi-line + hint. return ImGui.InputTextEx(label, hint, buf, buf_size, ImVec2(0, 0), flags, callback, user_data) end @@ -53901,7 +53944,7 @@ end --- @return float local function ColorEditRestoreH(col, H) local g = GImGui - IM_ASSERT(g.ColorEditCurrentID ~= 0) + assert(g.ColorEditCurrentID ~= 0) if g.ColorEditSavedID ~= g.ColorEditCurrentID or g.ColorEditSavedColor ~= ImGui.ColorConvertFloat4ToU32(ImVec4(col[1], col[2], col[3], 0)) then return H end @@ -53918,7 +53961,7 @@ end --- @return float, float, float local function ColorEditRestoreHS(col, H, S, V) local g = GImGui - IM_ASSERT(g.ColorEditCurrentID ~= 0) + assert(g.ColorEditCurrentID ~= 0) if g.ColorEditSavedID ~= g.ColorEditCurrentID or g.ColorEditSavedColor ~= ImGui.ColorConvertFloat4ToU32(ImVec4(col[1], col[2], col[3], 0)) then return H, S, V @@ -53977,7 +54020,7 @@ function ImGui.ColorEdit4(label, col, flags) -- inside would draw, be hovered or receive input, so only reproduce the layout (same group size, baseline and -- last item rect as the full path). Not taken while anything could depend on the inner items: an active item -- or popup, keyboard navigation, logging, or the ID debug hook. - if label_display_end == 1 and bit32.band(flags, bit32.bor(ImGuiColorEditFlags.NoInputs, ImGuiColorEditFlags.NoSmallPreview)) == 0 + if label_display_end == 1 and bit32.band(flags, bit32.bor(32 --[[ImGuiColorEditFlags.NoInputs]], 16 --[[ImGuiColorEditFlags.NoSmallPreview]])) == 0 and g.ActiveId == 0 and g.OpenPopupStack.Size == 0 and not g.NavCursorVisible and not g.NavAnyRequest and not g.LogEnabled and g.DebugHookIdInfoId == 0 then local w_button = square_sz + style.ItemInnerSpacing.x @@ -54003,44 +54046,44 @@ function ImGui.ColorEdit4(label, col, flags) -- If we're not showing any slider there's no point in doing any HSV conversions local flags_untouched = flags - if bit32.band(flags, ImGuiColorEditFlags.NoInputs) ~= 0 then - flags = bit32.bor(bit32.band(flags, bit32.bnot(ImGuiColorEditFlags.DisplayMask_)), ImGuiColorEditFlags.DisplayRGB, ImGuiColorEditFlags.NoOptions) + if bit32.band(flags, 32 --[[ImGuiColorEditFlags.NoInputs]]) ~= 0 then + flags = bit32.bor(bit32.band(flags, bit32.bnot(7340032 --[[ImGuiColorEditFlags.DisplayMask_]])), 1048576 --[[ImGuiColorEditFlags.DisplayRGB]], 8 --[[ImGuiColorEditFlags.NoOptions]]) end -- Context menu: display and modify options (before defaults are applied) - if bit32.band(flags, ImGuiColorEditFlags.NoOptions) == 0 then + if bit32.band(flags, 8 --[[ImGuiColorEditFlags.NoOptions]]) == 0 then ImGui.ColorEditOptionsPopup(col, flags) end -- Read stored options - if bit32.band(flags, ImGuiColorEditFlags.DisplayMask_) == 0 then - flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, ImGuiColorEditFlags.DisplayMask_)) + if bit32.band(flags, 7340032 --[[ImGuiColorEditFlags.DisplayMask_]]) == 0 then + flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, 7340032 --[[ImGuiColorEditFlags.DisplayMask_]])) end - if bit32.band(flags, ImGuiColorEditFlags.DataTypeMask_) == 0 then - flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, ImGuiColorEditFlags.DataTypeMask_)) + if bit32.band(flags, 25165824 --[[ImGuiColorEditFlags.DataTypeMask_]]) == 0 then + flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, 25165824 --[[ImGuiColorEditFlags.DataTypeMask_]])) end - if bit32.band(flags, ImGuiColorEditFlags.PickerMask_) == 0 then - flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, ImGuiColorEditFlags.PickerMask_)) + if bit32.band(flags, 100663296 --[[ImGuiColorEditFlags.PickerMask_]]) == 0 then + flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, 100663296 --[[ImGuiColorEditFlags.PickerMask_]])) end - if bit32.band(flags, ImGuiColorEditFlags.InputMask_) == 0 then - flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, ImGuiColorEditFlags.InputMask_)) + if bit32.band(flags, 805306368 --[[ImGuiColorEditFlags.InputMask_]]) == 0 then + flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, 805306368 --[[ImGuiColorEditFlags.InputMask_]])) end - flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, bit32.bnot(bit32.bor(ImGuiColorEditFlags.DisplayMask_, ImGuiColorEditFlags.DataTypeMask_, ImGuiColorEditFlags.PickerMask_, ImGuiColorEditFlags.InputMask_)))) - IM_ASSERT(ImIsPowerOfTwo(bit32.band(flags, ImGuiColorEditFlags.DisplayMask_))) -- Check that only 1 is selected - IM_ASSERT(ImIsPowerOfTwo(bit32.band(flags, ImGuiColorEditFlags.InputMask_))) -- Check that only 1 is selected + flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, bit32.bnot(bit32.bor(7340032 --[[ImGuiColorEditFlags.DisplayMask_]], 25165824 --[[ImGuiColorEditFlags.DataTypeMask_]], 100663296 --[[ImGuiColorEditFlags.PickerMask_]], 805306368 --[[ImGuiColorEditFlags.InputMask_]])))) + assert(ImIsPowerOfTwo(bit32.band(flags, 7340032 --[[ImGuiColorEditFlags.DisplayMask_]]))) -- Check that only 1 is selected + assert(ImIsPowerOfTwo(bit32.band(flags, 805306368 --[[ImGuiColorEditFlags.InputMask_]]))) -- Check that only 1 is selected - local alpha = bit32.band(flags, ImGuiColorEditFlags.NoAlpha) == 0 - local hdr = bit32.band(flags, ImGuiColorEditFlags.HDR) ~= 0 + local alpha = bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) == 0 + local hdr = bit32.band(flags, 524288 --[[ImGuiColorEditFlags.HDR]]) ~= 0 local components = alpha and 4 or 3 - local w_button = (bit32.band(flags, ImGuiColorEditFlags.NoSmallPreview) ~= 0) and 0.0 or (square_sz + style.ItemInnerSpacing.x) + local w_button = (bit32.band(flags, 16 --[[ImGuiColorEditFlags.NoSmallPreview]]) ~= 0) and 0.0 or (square_sz + style.ItemInnerSpacing.x) local w_inputs = ImMax(w_full - w_button, 1.0) w_full = w_inputs + w_button -- Convert to the formats we need local f = { col[1], col[2], col[3], alpha and col[4] or 1.0 } - if bit32.band(flags, ImGuiColorEditFlags.InputHSV) ~= 0 and bit32.band(flags, ImGuiColorEditFlags.DisplayRGB) ~= 0 then + if bit32.band(flags, 536870912 --[[ImGuiColorEditFlags.InputHSV]]) ~= 0 and bit32.band(flags, 1048576 --[[ImGuiColorEditFlags.DisplayRGB]]) ~= 0 then f[1], f[2], f[3] = ImGui.ColorConvertHSVtoRGB(f[1], f[2], f[3]) - elseif bit32.band(flags, ImGuiColorEditFlags.InputRGB) ~= 0 and bit32.band(flags, ImGuiColorEditFlags.DisplayHSV) ~= 0 then + elseif bit32.band(flags, 268435456 --[[ImGuiColorEditFlags.InputRGB]]) ~= 0 and bit32.band(flags, 2097152 --[[ImGuiColorEditFlags.DisplayHSV]]) ~= 0 then -- Hue is lost when converting from grayscale rgb (saturation=0). Restore it. f[1], f[2], f[3] = ImGui.ColorConvertRGBtoHSV(f[1], f[2], f[3]) f[1], f[2], f[3] = ColorEditRestoreHS(col, f[1], f[2], f[3]) @@ -54052,25 +54095,25 @@ function ImGui.ColorEdit4(label, col, flags) local pos = ImVec2() ImVec2_Copy(pos, window.DC.CursorPos) - local inputs_offset_x = (style.ColorButtonPosition == ImGuiDir.Left) and w_button or 0.0 + local inputs_offset_x = (style.ColorButtonPosition == 0 --[[ImGuiDir.Left]]) and w_button or 0.0 window.DC.CursorPos.x = pos.x + inputs_offset_x - if bit32.band(flags, bit32.bor(ImGuiColorEditFlags.DisplayRGB, ImGuiColorEditFlags.DisplayHSV)) ~= 0 and bit32.band(flags, ImGuiColorEditFlags.NoInputs) == 0 then + if bit32.band(flags, bit32.bor(1048576 --[[ImGuiColorEditFlags.DisplayRGB]], 2097152 --[[ImGuiColorEditFlags.DisplayHSV]])) ~= 0 and bit32.band(flags, 32 --[[ImGuiColorEditFlags.NoInputs]]) == 0 then -- RGB/HSV 0..255 Sliders local w_items = w_inputs - style.ItemInnerSpacing.x * (components - 1) local w_per_component = IM_TRUNC(w_items / components) - local draw_color_marker = bit32.band(flags, bit32.bor(ImGuiColorEditFlags.DisplayHSV, ImGuiColorEditFlags.NoColorMarkers)) == 0 - local hide_prefix = draw_color_marker or (w_per_component <= ImGui.CalcTextSize((bit32.band(flags, ImGuiColorEditFlags.Float) ~= 0) and "M:0.000" or "M:000").x) + local draw_color_marker = bit32.band(flags, bit32.bor(2097152 --[[ImGuiColorEditFlags.DisplayHSV]], 2048 --[[ImGuiColorEditFlags.NoColorMarkers]])) == 0 + local hide_prefix = draw_color_marker or (w_per_component <= ImGui.CalcTextSize((bit32.band(flags, 16777216 --[[ImGuiColorEditFlags.Float]]) ~= 0) and "M:0.000" or "M:000").x) local fmt_idx if hide_prefix then fmt_idx = 1 - elseif bit32.band(flags, ImGuiColorEditFlags.DisplayHSV) ~= 0 then + elseif bit32.band(flags, 2097152 --[[ImGuiColorEditFlags.DisplayHSV]]) ~= 0 then fmt_idx = 3 else fmt_idx = 2 end - local drag_flags = draw_color_marker and ImGuiSliderFlags.ColorMarkers or ImGuiSliderFlags.None + local drag_flags = draw_color_marker and 4096 --[[ImGuiSliderFlags.ColorMarkers]] or 0 --[[ImGuiSliderFlags.None]] local prev_split = 0.0 for n = 1, components do @@ -54085,7 +54128,7 @@ function ImGui.ColorEdit4(label, col, flags) end -- FIXME: When ImGuiColorEditFlags_HDR flag is passed HS values snap in weird ways when SV values go below 0. - if bit32.band(flags, ImGuiColorEditFlags.Float) ~= 0 then + if bit32.band(flags, 16777216 --[[ImGuiColorEditFlags.Float]]) ~= 0 then local changed f[n], changed = ImGui.DragFloat(ids[n], f[n], 1.0 / 255.0, 0.0, hdr and 0.0 or 1.0, fmt_table_float[fmt_idx][n], drag_flags) value_changed = value_changed or changed @@ -54096,11 +54139,11 @@ function ImGui.ColorEdit4(label, col, flags) value_changed = value_changed or changed end - if bit32.band(flags, ImGuiColorEditFlags.NoOptions) == 0 then - ImGui.OpenPopupOnItemClick("context", ImGuiPopupFlags.MouseButtonRight) + if bit32.band(flags, 8 --[[ImGuiColorEditFlags.NoOptions]]) == 0 then + ImGui.OpenPopupOnItemClick("context", 8 --[[ImGuiPopupFlags.MouseButtonRight]]) end end - elseif bit32.band(flags, ImGuiColorEditFlags.DisplayHex) ~= 0 and bit32.band(flags, ImGuiColorEditFlags.NoInputs) == 0 then + elseif bit32.band(flags, 4194304 --[[ImGuiColorEditFlags.DisplayHex]]) ~= 0 and bit32.band(flags, 32 --[[ImGuiColorEditFlags.NoInputs]]) == 0 then -- RGB Hexadecimal Input -- TODO: resolve sprintf, sscanf requirement. currently this section creates a lot of temp tables and strings... local buf, buf_size = nil, 64 @@ -54115,7 +54158,7 @@ function ImGui.ColorEdit4(label, col, flags) end ImGui.SetNextItemWidth(w_inputs) - if ImGui.InputText("##Text", buf, buf_size, ImGuiInputTextFlags.CharsUppercase) then + if ImGui.InputText("##Text", buf, buf_size, 8 --[[ImGuiInputTextFlags.CharsUppercase]]) then value_changed = true local p = 1 while buf[p] == 35 or ImCharIsBlankA(buf[p]) do @@ -54133,27 +54176,27 @@ function ImGui.ColorEdit4(label, col, flags) -- IM_UNUSED(r) -- Fixes C6031: Return value ignored: 'sscanf'. end - if bit32.band(flags, ImGuiColorEditFlags.NoOptions) == 0 then - ImGui.OpenPopupOnItemClick("context", ImGuiPopupFlags.MouseButtonRight) + if bit32.band(flags, 8 --[[ImGuiColorEditFlags.NoOptions]]) == 0 then + ImGui.OpenPopupOnItemClick("context", 8 --[[ImGuiPopupFlags.MouseButtonRight]]) end end local picker_active_window = nil - if bit32.band(flags, ImGuiColorEditFlags.NoSmallPreview) == 0 then - local button_offset_x = (bit32.band(flags, ImGuiColorEditFlags.NoInputs) ~= 0 or style.ColorButtonPosition == ImGuiDir.Left) and 0.0 or (w_inputs + style.ItemInnerSpacing.x) + if bit32.band(flags, 16 --[[ImGuiColorEditFlags.NoSmallPreview]]) == 0 then + local button_offset_x = (bit32.band(flags, 32 --[[ImGuiColorEditFlags.NoInputs]]) ~= 0 or style.ColorButtonPosition == 0 --[[ImGuiDir.Left]]) and 0.0 or (w_inputs + style.ItemInnerSpacing.x) ImVec2_Copy(window.DC.CursorPos, ImVec2(pos.x + button_offset_x, pos.y)) local col_v4 = ImVec4(col[1], col[2], col[3], alpha and col[4] or 1.0) if ImGui.ColorButton("##ColorButton", col_v4, flags) then - if bit32.band(flags, ImGuiColorEditFlags.NoPicker) == 0 then + if bit32.band(flags, 4 --[[ImGuiColorEditFlags.NoPicker]]) == 0 then -- Store current color and open a picker ImVec4_Copy(g.ColorPickerRef, col_v4) ImGui.OpenPopup("picker") ImGui.SetNextWindowPos(g.LastItemData.Rect:GetBL() + ImVec2(0.0, style.ItemSpacing.y)) end end - if bit32.band(flags, ImGuiColorEditFlags.NoOptions) == 0 then - ImGui.OpenPopupOnItemClick("context", ImGuiPopupFlags.MouseButtonRight) + if bit32.band(flags, 8 --[[ImGuiColorEditFlags.NoOptions]]) == 0 then + ImGui.OpenPopupOnItemClick("context", 8 --[[ImGuiPopupFlags.MouseButtonRight]]) end if ImGui.BeginPopup("picker") then @@ -54163,8 +54206,8 @@ function ImGui.ColorEdit4(label, col, flags) ImGui.TextEx(label, label_display_end) ImGui.Spacing() end - local picker_flags_to_forward = bit32.bor(ImGuiColorEditFlags.DataTypeMask_, ImGuiColorEditFlags.PickerMask_, ImGuiColorEditFlags.InputMask_, ImGuiColorEditFlags.HDR, ImGuiColorEditFlags.NoAlpha, ImGuiColorEditFlags.AlphaBar) - local picker_flags = bit32.bor(bit32.band(flags_untouched, picker_flags_to_forward), ImGuiColorEditFlags.DisplayMask_, ImGuiColorEditFlags.NoLabel, ImGuiColorEditFlags.AlphaPreviewHalf) + local picker_flags_to_forward = bit32.bor(25165824 --[[ImGuiColorEditFlags.DataTypeMask_]], 100663296 --[[ImGuiColorEditFlags.PickerMask_]], 805306368 --[[ImGuiColorEditFlags.InputMask_]], 524288 --[[ImGuiColorEditFlags.HDR]], 2 --[[ImGuiColorEditFlags.NoAlpha]], 262144 --[[ImGuiColorEditFlags.AlphaBar]]) + local picker_flags = bit32.bor(bit32.band(flags_untouched, picker_flags_to_forward), 7340032 --[[ImGuiColorEditFlags.DisplayMask_]], 128 --[[ImGuiColorEditFlags.NoLabel]], 16384 --[[ImGuiColorEditFlags.AlphaPreviewHalf]]) ImGui.SetNextItemWidth(square_sz * 12.0) -- Use 256 + bar sizes? value_changed = value_changed or ImGui.ColorPicker4("##picker", col, picker_flags, g.ColorPickerRef) end @@ -54172,11 +54215,11 @@ function ImGui.ColorEdit4(label, col, flags) end end - if label ~= "" and label_display_end > 1 and bit32.band(flags, ImGuiColorEditFlags.NoLabel) == 0 then + if label ~= "" and label_display_end > 1 and bit32.band(flags, 128 --[[ImGuiColorEditFlags.NoLabel]]) == 0 then -- Position not necessarily next to last submitted button (e.g. if style.ColorButtonPosition == ImGuiDir_Left), -- but we need to use SameLine() to setup baseline correctly. Might want to refactor SameLine() to simplify this. ImGui.SameLine(0.0, style.ItemInnerSpacing.x) - window.DC.CursorPos.x = pos.x + ((bit32.band(flags, ImGuiColorEditFlags.NoInputs) ~= 0) and w_button or (w_full + style.ItemInnerSpacing.x)) + window.DC.CursorPos.x = pos.x + ((bit32.band(flags, 32 --[[ImGuiColorEditFlags.NoInputs]]) ~= 0) and w_button or (w_full + style.ItemInnerSpacing.x)) ImGui.TextEx(label, label_display_end) end @@ -54187,14 +54230,14 @@ function ImGui.ColorEdit4(label, col, flags) f[n] = i[n] / 255.0 end end - if bit32.band(flags, ImGuiColorEditFlags.DisplayHSV) ~= 0 and bit32.band(flags, ImGuiColorEditFlags.InputRGB) ~= 0 then + if bit32.band(flags, 2097152 --[[ImGuiColorEditFlags.DisplayHSV]]) ~= 0 and bit32.band(flags, 268435456 --[[ImGuiColorEditFlags.InputRGB]]) ~= 0 then g.ColorEditSavedHue = f[1] g.ColorEditSavedSat = f[2] f[1], f[2], f[3] = ImGui.ColorConvertHSVtoRGB(f[1], f[2], f[3]) g.ColorEditSavedID = g.ColorEditCurrentID g.ColorEditSavedColor = ImGui.ColorConvertFloat4ToU32(ImVec4(f[1], f[2], f[3], 0)) end - if bit32.band(flags, ImGuiColorEditFlags.DisplayRGB) ~= 0 and bit32.band(flags, ImGuiColorEditFlags.InputHSV) ~= 0 then + if bit32.band(flags, 1048576 --[[ImGuiColorEditFlags.DisplayRGB]]) ~= 0 and bit32.band(flags, 536870912 --[[ImGuiColorEditFlags.InputHSV]]) ~= 0 then f[1], f[2], f[3] = ImGui.ColorConvertRGBtoHSV(f[1], f[2], f[3]) end @@ -54236,14 +54279,14 @@ function ImGui.ColorEdit3(label, col, flags) if flags == nil then flags = 0 end if flags == nil then flags = 0 end - return ImGui.ColorEdit4(label, col, bit32.bor(flags, ImGuiColorEditFlags.NoAlpha)) + return ImGui.ColorEdit4(label, col, bit32.bor(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]])) end -- `col` mutated in place, returns value_changed function ImGui.ColorPicker3(label, col, flags) if flags == nil then flags = 0 end local col4 = { col[1], col[2], col[3], 1.0 } - if not ImGui.ColorPicker4(label, col4, bit32.bor(flags or 0, ImGuiColorEditFlags.NoAlpha)) then + if not ImGui.ColorPicker4(label, col4, bit32.bor(flags or 0, 2 --[[ImGuiColorEditFlags.NoAlpha]])) then return false end col[1] = col4[1]; col[2] = col4[2]; col[3] = col4[3] @@ -54253,8 +54296,8 @@ end -- This allowed passing 0 to set default, whereas NewFrame() will assert if one of missing. Abide to old logic. function ImGui.SetColorEditOptions(flags) local g = GImGui - local def = ImGuiColorEditFlags.DefaultOptions_ - for _, mask in ipairs({ ImGuiColorEditFlags.DisplayMask_, ImGuiColorEditFlags.DataTypeMask_, ImGuiColorEditFlags.PickerMask_, ImGuiColorEditFlags.InputMask_ }) do + local def = 311427072 --[[ImGuiColorEditFlags.DefaultOptions_]] + for _, mask in ipairs({ 7340032 --[[ImGuiColorEditFlags.DisplayMask_]], 25165824 --[[ImGuiColorEditFlags.DataTypeMask_]], 100663296 --[[ImGuiColorEditFlags.PickerMask_]], 805306368 --[[ImGuiColorEditFlags.InputMask_]] }) do if bit32.band(flags, mask) == 0 then flags = bit32.bor(flags, bit32.band(def, mask)) end @@ -54270,10 +54313,10 @@ end --- @param alpha float local function RenderArrowsForVerticalBar(draw_list, pos, half_sz, bar_w, alpha) local alpha8 = IM_F32_TO_INT8_SAT(alpha) - ImGui.RenderArrowPointingAt(draw_list, ImVec2(pos.x + half_sz.x + 1, pos.y), ImVec2(half_sz.x + 2, half_sz.y + 1), ImGuiDir.Right, IM_COL32(0, 0, 0, alpha8)) - ImGui.RenderArrowPointingAt(draw_list, ImVec2(pos.x + half_sz.x, pos.y), half_sz, ImGuiDir.Right, IM_COL32(255, 255, 255, alpha8)) - ImGui.RenderArrowPointingAt(draw_list, ImVec2(pos.x + bar_w - half_sz.x - 1, pos.y), ImVec2(half_sz.x + 2, half_sz.y + 1), ImGuiDir.Left, IM_COL32(0, 0, 0, alpha8)) - ImGui.RenderArrowPointingAt(draw_list, ImVec2(pos.x + bar_w - half_sz.x, pos.y), half_sz, ImGuiDir.Left, IM_COL32(255, 255, 255, alpha8)) + ImGui.RenderArrowPointingAt(draw_list, ImVec2(pos.x + half_sz.x + 1, pos.y), ImVec2(half_sz.x + 2, half_sz.y + 1), 1 --[[ImGuiDir.Right]], IM_COL32(0, 0, 0, alpha8)) + ImGui.RenderArrowPointingAt(draw_list, ImVec2(pos.x + half_sz.x, pos.y), half_sz, 1 --[[ImGuiDir.Right]], IM_COL32(255, 255, 255, alpha8)) + ImGui.RenderArrowPointingAt(draw_list, ImVec2(pos.x + bar_w - half_sz.x - 1, pos.y), ImVec2(half_sz.x + 2, half_sz.y + 1), 0 --[[ImGuiDir.Left]], IM_COL32(0, 0, 0, alpha8)) + ImGui.RenderArrowPointingAt(draw_list, ImVec2(pos.x + bar_w - half_sz.x, pos.y), half_sz, 0 --[[ImGuiDir.Left]], IM_COL32(255, 255, 255, alpha8)) end do --[[ColorPicker4]] @@ -54300,7 +54343,7 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) local io = g.IO local width = ImGui.CalcItemWidth() - local is_readonly = bit32.band(bit32.bor(g.NextItemData.ItemFlagsSet, g.CurrentItemFlags), ImGuiItemFlags.ReadOnly) ~= 0 + local is_readonly = bit32.band(bit32.bor(g.NextItemData.ItemFlagsSet, g.CurrentItemFlags), 2048 --[[ImGuiItemFlags.ReadOnly]]) ~= 0 g.NextItemData:ClearFlags() ImGui.PushID(label) @@ -54310,41 +54353,41 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) end ImGui.BeginGroup() - if bit32.band(flags, ImGuiColorEditFlags.NoSidePreview) == 0 then - flags = bit32.bor(flags, ImGuiColorEditFlags.NoSmallPreview) + if bit32.band(flags, 256 --[[ImGuiColorEditFlags.NoSidePreview]]) == 0 then + flags = bit32.bor(flags, 16 --[[ImGuiColorEditFlags.NoSmallPreview]]) end -- Context menu: display and store options. - if bit32.band(flags, ImGuiColorEditFlags.NoOptions) == 0 then + if bit32.band(flags, 8 --[[ImGuiColorEditFlags.NoOptions]]) == 0 then ImGui.ColorPickerOptionsPopup(col, flags) end -- Read stored options - if bit32.band(flags, ImGuiColorEditFlags.PickerMask_) == 0 then - local picker_flags = bit32.band(g.IO.ConfigColorEditFlags, ImGuiColorEditFlags.PickerMask_) + if bit32.band(flags, 100663296 --[[ImGuiColorEditFlags.PickerMask_]]) == 0 then + local picker_flags = bit32.band(g.IO.ConfigColorEditFlags, 100663296 --[[ImGuiColorEditFlags.PickerMask_]]) if picker_flags ~= 0 then flags = bit32.bor(flags, picker_flags) else - flags = bit32.bor(flags, bit32.band(ImGuiColorEditFlags.DefaultOptions_, ImGuiColorEditFlags.PickerMask_)) + flags = bit32.bor(flags, bit32.band(311427072 --[[ImGuiColorEditFlags.DefaultOptions_]], 100663296 --[[ImGuiColorEditFlags.PickerMask_]])) end end - if bit32.band(flags, ImGuiColorEditFlags.InputMask_) == 0 then - local input_flags = bit32.band(g.IO.ConfigColorEditFlags, ImGuiColorEditFlags.InputMask_) + if bit32.band(flags, 805306368 --[[ImGuiColorEditFlags.InputMask_]]) == 0 then + local input_flags = bit32.band(g.IO.ConfigColorEditFlags, 805306368 --[[ImGuiColorEditFlags.InputMask_]]) if input_flags ~= 0 then flags = bit32.bor(flags, input_flags) else - flags = bit32.bor(flags, bit32.band(ImGuiColorEditFlags.DefaultOptions_, ImGuiColorEditFlags.InputMask_)) + flags = bit32.bor(flags, bit32.band(311427072 --[[ImGuiColorEditFlags.DefaultOptions_]], 805306368 --[[ImGuiColorEditFlags.InputMask_]])) end end - IM_ASSERT(ImIsPowerOfTwo(bit32.band(flags, ImGuiColorEditFlags.PickerMask_))) -- Check that only 1 is selected - IM_ASSERT(ImIsPowerOfTwo(bit32.band(flags, ImGuiColorEditFlags.InputMask_))) -- Check that only 1 is selected - if bit32.band(flags, ImGuiColorEditFlags.NoOptions) == 0 then - flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, ImGuiColorEditFlags.AlphaBar)) + assert(ImIsPowerOfTwo(bit32.band(flags, 100663296 --[[ImGuiColorEditFlags.PickerMask_]]))) -- Check that only 1 is selected + assert(ImIsPowerOfTwo(bit32.band(flags, 805306368 --[[ImGuiColorEditFlags.InputMask_]]))) -- Check that only 1 is selected + if bit32.band(flags, 8 --[[ImGuiColorEditFlags.NoOptions]]) == 0 then + flags = bit32.bor(flags, bit32.band(g.IO.ConfigColorEditFlags, 262144 --[[ImGuiColorEditFlags.AlphaBar]])) end -- Setup - local components = (bit32.band(flags, ImGuiColorEditFlags.NoAlpha) ~= 0) and 3 or 4 - local alpha_bar = (bit32.band(flags, ImGuiColorEditFlags.AlphaBar) ~= 0) and (bit32.band(flags, ImGuiColorEditFlags.NoAlpha) == 0) + local components = (bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) ~= 0) and 3 or 4 + local alpha_bar = (bit32.band(flags, 262144 --[[ImGuiColorEditFlags.AlphaBar]]) ~= 0) and (bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) == 0) local picker_pos = ImVec2() ImVec2_Copy(picker_pos, window.DC.CursorPos) local square_sz = ImGui.GetFrameHeight() @@ -54362,7 +54405,7 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) local wheel_center = ImVec2(picker_pos.x + (sv_picker_size + bars_width) * 0.5, picker_pos.y + sv_picker_size * 0.5) -- Note: the triangle is displayed rotated with triangle_pa pointing to Hue, but most coordinates stays unrotated for logic. - local triangle_rotate = bit32.band(flags, ImGuiColorEditFlags.PickerNoRotate) == 0 + local triangle_rotate = bit32.band(flags, 134217728 --[[ImGuiColorEditFlags.PickerNoRotate]]) == 0 local triangle_r = wheel_r_inner - math.floor(sv_picker_size * 0.027) local triangle_pa, triangle_pb, triangle_pc if triangle_rotate then triangle_pa = ImVec2( triangle_r, 0.0) else triangle_pa = ImVec2( triangle_r * 0.866, triangle_r * 0.5) end -- Hue point. @@ -54371,18 +54414,18 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) local H = col[1]; local S = col[2]; local V = col[3] local R = col[1]; local G = col[2]; local B = col[3] - if bit32.band(flags, ImGuiColorEditFlags.InputRGB) ~= 0 then + if bit32.band(flags, 268435456 --[[ImGuiColorEditFlags.InputRGB]]) ~= 0 then -- Hue is lost when converting from grayscale rgb (saturation=0). Restore it. H, S, V = ImGui.ColorConvertRGBtoHSV(R, G, B) H, S, V = ColorEditRestoreHS(col, H, S, V) - elseif bit32.band(flags, ImGuiColorEditFlags.InputHSV) ~= 0 then + elseif bit32.band(flags, 536870912 --[[ImGuiColorEditFlags.InputHSV]]) ~= 0 then R, G, B = ImGui.ColorConvertHSVtoRGB(H, S, V) end local value_changed = false; local value_changed_h = false; local value_changed_sv = false - ImGui.PushItemFlag(ImGuiItemFlags.NoNav, true) - if bit32.band(flags, ImGuiColorEditFlags.PickerHueWheel) ~= 0 then + ImGui.PushItemFlag(2 --[[ImGuiItemFlags.NoNav]], true) + if bit32.band(flags, 67108864 --[[ImGuiColorEditFlags.PickerHueWheel]]) ~= 0 then -- Hue wheel + SV triangle logic ImGui.InvisibleButton("hsv", ImVec2(sv_picker_size + style.ItemInnerSpacing.x + bars_width, sv_picker_size)) if ImGui.IsItemActive() and not is_readonly then @@ -54392,7 +54435,7 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) if initial_dist2 >= (wheel_r_inner - 1) * (wheel_r_inner - 1) and initial_dist2 <= (wheel_r_outer + 1) * (wheel_r_outer + 1) then -- Interactive with Hue wheel - H = ImAtan2(current_off.y, current_off.x) / IM_PI * 0.5 + H = ImAtan2(current_off.y, current_off.x) / 3.141592653589793 --[[IM_PI]] * 0.5 if H < 0.0 then H = H + 1.0 end @@ -54400,8 +54443,8 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) value_changed_h = true end - local cos_hue_angle = triangle_rotate and ImCos(-H * 2.0 * IM_PI) or 1.0 - local sin_hue_angle = triangle_rotate and ImSin(-H * 2.0 * IM_PI) or 0.0 + local cos_hue_angle = triangle_rotate and ImCos(-H * 2.0 * 3.141592653589793 --[[IM_PI]]) or 1.0 + local sin_hue_angle = triangle_rotate and ImSin(-H * 2.0 * 3.141592653589793 --[[IM_PI]]) or 0.0 if ImStd.ImTriangleContainsPoint(triangle_pa, triangle_pb, triangle_pc, ImRotate(initial_off, cos_hue_angle, sin_hue_angle)) then -- Interacting with SV triangle @@ -54418,10 +54461,10 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) end end - if bit32.band(flags, ImGuiColorEditFlags.NoOptions) == 0 then - ImGui.OpenPopupOnItemClick("context", ImGuiPopupFlags.MouseButtonRight) + if bit32.band(flags, 8 --[[ImGuiColorEditFlags.NoOptions]]) == 0 then + ImGui.OpenPopupOnItemClick("context", 8 --[[ImGuiPopupFlags.MouseButtonRight]]) end - elseif bit32.band(flags, ImGuiColorEditFlags.PickerHueBar) ~= 0 then + elseif bit32.band(flags, 33554432 --[[ImGuiColorEditFlags.PickerHueBar]]) ~= 0 then -- SV rectangle logic ImGui.InvisibleButton("sv", ImVec2(sv_picker_size, sv_picker_size)) if ImGui.IsItemActive() and not is_readonly then @@ -54432,8 +54475,8 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) value_changed_sv = true end - if bit32.band(flags, ImGuiColorEditFlags.NoOptions) == 0 then - ImGui.OpenPopupOnItemClick("context", ImGuiPopupFlags.MouseButtonRight) + if bit32.band(flags, 8 --[[ImGuiColorEditFlags.NoOptions]]) == 0 then + ImGui.OpenPopupOnItemClick("context", 8 --[[ImGuiPopupFlags.MouseButtonRight]]) end -- Hue bar logic @@ -54457,36 +54500,36 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) end ImGui.PopItemFlag() -- ImGuiItemFlags.NoNav - if bit32.band(flags, ImGuiColorEditFlags.NoSidePreview) == 0 then + if bit32.band(flags, 256 --[[ImGuiColorEditFlags.NoSidePreview]]) == 0 then ImGui.SameLine(0, style.ItemInnerSpacing.x) ImGui.BeginGroup() end - if bit32.band(flags, ImGuiColorEditFlags.NoLabel) == 0 then + if bit32.band(flags, 128 --[[ImGuiColorEditFlags.NoLabel]]) == 0 then local label_display_end = ImGui.FindRenderedTextEnd(label) if label ~= "" and label_display_end > 1 then - if bit32.band(flags, ImGuiColorEditFlags.NoSidePreview) ~= 0 then + if bit32.band(flags, 256 --[[ImGuiColorEditFlags.NoSidePreview]]) ~= 0 then ImGui.SameLine(0, style.ItemInnerSpacing.x) end ImGui.TextEx(label, label_display_end) end end - if bit32.band(flags, ImGuiColorEditFlags.NoSidePreview) == 0 then - ImGui.PushItemFlag(ImGuiItemFlags.NoNavDefaultFocus, true) - local col_v4 = ImVec4(col[1], col[2], col[3], (bit32.band(flags, ImGuiColorEditFlags.NoAlpha) ~= 0) and 1.0 or col[4]) + if bit32.band(flags, 256 --[[ImGuiColorEditFlags.NoSidePreview]]) == 0 then + ImGui.PushItemFlag(4 --[[ImGuiItemFlags.NoNavDefaultFocus]], true) + local col_v4 = ImVec4(col[1], col[2], col[3], (bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) ~= 0) and 1.0 or col[4]) - if bit32.band(flags, ImGuiColorEditFlags.NoLabel) ~= 0 then + if bit32.band(flags, 128 --[[ImGuiColorEditFlags.NoLabel]]) ~= 0 then ImGui.Text("Current") end - local sub_flags_to_forward = bit32.bor(ImGuiColorEditFlags.InputMask_, ImGuiColorEditFlags.HDR, ImGuiColorEditFlags.AlphaMask_, ImGuiColorEditFlags.NoTooltip) + local sub_flags_to_forward = bit32.bor(805306368 --[[ImGuiColorEditFlags.InputMask_]], 524288 --[[ImGuiColorEditFlags.HDR]], 28674 --[[ImGuiColorEditFlags.AlphaMask_]], 64 --[[ImGuiColorEditFlags.NoTooltip]]) ImGui.ColorButton("##current", col_v4, bit32.band(flags, sub_flags_to_forward), ImVec2(square_sz * 3, square_sz * 2)) if ref_col ~= nil then ImGui.Text("Original") - local ref_col_v4 = ImVec4(ref_col[1], ref_col[2], ref_col[3], (bit32.band(flags, ImGuiColorEditFlags.NoAlpha) ~= 0) and 1.0 or ref_col[4]) + local ref_col_v4 = ImVec4(ref_col[1], ref_col[2], ref_col[3], (bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) ~= 0) and 1.0 or ref_col[4]) if ImGui.ColorButton("##original", ref_col_v4, bit32.band(flags, sub_flags_to_forward), ImVec2(square_sz * 3, square_sz * 2)) then for i = 1, components do col[i] = ref_col[i] @@ -54501,13 +54544,13 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) -- Convert back color to RGB if value_changed_h or value_changed_sv then - if bit32.band(flags, ImGuiColorEditFlags.InputRGB) ~= 0 then + if bit32.band(flags, 268435456 --[[ImGuiColorEditFlags.InputRGB]]) ~= 0 then col[1], col[2], col[3] = ImGui.ColorConvertHSVtoRGB(H, S, V) -- Lua 1-based indexing g.ColorEditSavedHue = H g.ColorEditSavedSat = S g.ColorEditSavedID = g.ColorEditCurrentID g.ColorEditSavedColor = ImGui.ColorConvertFloat4ToU32(ImVec4(col[1], col[2], col[3], 0)) - elseif bit32.band(flags, ImGuiColorEditFlags.InputHSV) ~= 0 then + elseif bit32.band(flags, 536870912 --[[ImGuiColorEditFlags.InputHSV]]) ~= 0 then col[1] = H col[2] = S col[3] = V @@ -54516,14 +54559,14 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) -- R,G,B and H,S,V slider color editor local value_changed_fix_hue_wrap = false - if bit32.band(flags, ImGuiColorEditFlags.NoInputs) == 0 then + if bit32.band(flags, 32 --[[ImGuiColorEditFlags.NoInputs]]) == 0 then ImGui.PushItemWidth((alpha_bar and bar1_pos_x or bar0_pos_x) + bars_width - picker_pos.x) - local sub_flags_to_forward = bit32.bor(ImGuiColorEditFlags.DataTypeMask_, ImGuiColorEditFlags.InputMask_, ImGuiColorEditFlags.HDR, ImGuiColorEditFlags.AlphaMask_, ImGuiColorEditFlags.NoOptions, ImGuiColorEditFlags.NoTooltip, ImGuiColorEditFlags.NoSmallPreview) - local sub_flags = bit32.bor(bit32.band(flags, sub_flags_to_forward), ImGuiColorEditFlags.NoPicker) + local sub_flags_to_forward = bit32.bor(25165824 --[[ImGuiColorEditFlags.DataTypeMask_]], 805306368 --[[ImGuiColorEditFlags.InputMask_]], 524288 --[[ImGuiColorEditFlags.HDR]], 28674 --[[ImGuiColorEditFlags.AlphaMask_]], 8 --[[ImGuiColorEditFlags.NoOptions]], 64 --[[ImGuiColorEditFlags.NoTooltip]], 16 --[[ImGuiColorEditFlags.NoSmallPreview]]) + local sub_flags = bit32.bor(bit32.band(flags, sub_flags_to_forward), 4 --[[ImGuiColorEditFlags.NoPicker]]) - if bit32.band(flags, ImGuiColorEditFlags.DisplayRGB) ~= 0 or bit32.band(flags, ImGuiColorEditFlags.DisplayMask_) == 0 then - if ImGui.ColorEdit4("##rgb", col, bit32.bor(sub_flags, ImGuiColorEditFlags.DisplayRGB)) then + if bit32.band(flags, 1048576 --[[ImGuiColorEditFlags.DisplayRGB]]) ~= 0 or bit32.band(flags, 7340032 --[[ImGuiColorEditFlags.DisplayMask_]]) == 0 then + if ImGui.ColorEdit4("##rgb", col, bit32.bor(sub_flags, 1048576 --[[ImGuiColorEditFlags.DisplayRGB]])) then -- FIXME: Hackily differentiating using the DragInt (ActiveId != 0 && !ActiveIdAllowOverlap) vs. using the InputText or DropTarget. -- For the later we don't want to run the hue-wrap canceling code. If you are well versed in HSV picker please provide your input! (See #2050) value_changed_fix_hue_wrap = (g.ActiveId ~= 0 and not g.ActiveIdAllowOverlap) @@ -54531,14 +54574,14 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) end end - if bit32.band(flags, ImGuiColorEditFlags.DisplayHSV) ~= 0 or bit32.band(flags, ImGuiColorEditFlags.DisplayMask_) == 0 then - if ImGui.ColorEdit4("##hsv", col, bit32.bor(sub_flags, ImGuiColorEditFlags.DisplayHSV)) then + if bit32.band(flags, 2097152 --[[ImGuiColorEditFlags.DisplayHSV]]) ~= 0 or bit32.band(flags, 7340032 --[[ImGuiColorEditFlags.DisplayMask_]]) == 0 then + if ImGui.ColorEdit4("##hsv", col, bit32.bor(sub_flags, 2097152 --[[ImGuiColorEditFlags.DisplayHSV]])) then value_changed = true end end - if bit32.band(flags, ImGuiColorEditFlags.DisplayHex) ~= 0 or bit32.band(flags, ImGuiColorEditFlags.DisplayMask_) == 0 then - if ImGui.ColorEdit4("##hex", col, bit32.bor(sub_flags, ImGuiColorEditFlags.DisplayHex)) then + if bit32.band(flags, 4194304 --[[ImGuiColorEditFlags.DisplayHex]]) ~= 0 or bit32.band(flags, 7340032 --[[ImGuiColorEditFlags.DisplayMask_]]) == 0 then + if ImGui.ColorEdit4("##hex", col, bit32.bor(sub_flags, 4194304 --[[ImGuiColorEditFlags.DisplayHex]])) then value_changed = true end end @@ -54547,7 +54590,7 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) end -- Try to cancel hue wrap (after ColorEdit4 call), if any - if value_changed_fix_hue_wrap and bit32.band(flags, ImGuiColorEditFlags.InputRGB) ~= 0 then + if value_changed_fix_hue_wrap and bit32.band(flags, 268435456 --[[ImGuiColorEditFlags.InputRGB]]) ~= 0 then local new_H, new_S, new_V = ImGui.ColorConvertRGBtoHSV(col[1], col[2], col[3]) -- Lua 1-based indexing if new_H <= 0 and H > 0 then @@ -54560,13 +54603,13 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) end if value_changed then - if bit32.band(flags, ImGuiColorEditFlags.InputRGB) ~= 0 then + if bit32.band(flags, 268435456 --[[ImGuiColorEditFlags.InputRGB]]) ~= 0 then R = col[1] G = col[2] B = col[3] H, S, V = ImGui.ColorConvertRGBtoHSV(R, G, B) H, S, V = ColorEditRestoreHS(col, H, S, V) -- Fix local Hue as display below will use it immediately. - elseif bit32.band(flags, ImGuiColorEditFlags.InputHSV) ~= 0 then + elseif bit32.band(flags, 536870912 --[[ImGuiColorEditFlags.InputHSV]]) ~= 0 then H = col[1] S = col[2] V = col[3] @@ -54587,14 +54630,14 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) local sv_cursor_pos = ImVec2() - if bit32.band(flags, ImGuiColorEditFlags.PickerHueWheel) ~= 0 then + if bit32.band(flags, 67108864 --[[ImGuiColorEditFlags.PickerHueWheel]]) ~= 0 then -- Render Hue Wheel local aeps = 0.5 / wheel_r_outer -- Half a pixel arc length in radians (2pi cancels out). local segment_per_arc = ImMax(4, math.floor(wheel_r_outer / 12)) for n = 1, 6 do - local a0 = (n - 1) / 6.0 * 2.0 * IM_PI - aeps - local a1 = n / 6.0 * 2.0 * IM_PI + aeps + local a0 = (n - 1) / 6.0 * 2.0 * 3.141592653589793 --[[IM_PI]] - aeps + local a1 = n / 6.0 * 2.0 * 3.141592653589793 --[[IM_PI]] + aeps local vert_start_idx = draw_list.VtxBuffer.Size + 1 draw_list:PathArcTo(wheel_center, (wheel_r_inner + wheel_r_outer) * 0.5, a0, a1, segment_per_arc) @@ -54609,8 +54652,8 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) end -- Render Cursor + preview on Hue Wheel - local cos_hue_angle = ImCos(H * 2.0 * IM_PI) - local sin_hue_angle = ImSin(H * 2.0 * IM_PI) + local cos_hue_angle = ImCos(H * 2.0 * 3.141592653589793 --[[IM_PI]]) + local sin_hue_angle = ImSin(H * 2.0 * 3.141592653589793 --[[IM_PI]]) local hue_cursor_pos = ImVec2(wheel_center.x + cos_hue_angle * (wheel_r_inner + wheel_r_outer) * 0.5, wheel_center.y + sin_hue_angle * (wheel_r_inner + wheel_r_outer) * 0.5) @@ -54639,7 +54682,7 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) draw_list:AddTriangle(tra, trb, trc, col_midgrey, 1.5) sv_cursor_pos = ImLerp(ImLerp(trc, tra, ImSaturate(S)), trb, ImSaturate(1 - V)) - elseif bit32.band(flags, ImGuiColorEditFlags.PickerHueBar) ~= 0 then + elseif bit32.band(flags, 33554432 --[[ImGuiColorEditFlags.PickerHueBar]]) ~= 0 then -- Render SV Square draw_list:AddRectFilledMultiColor(picker_pos, picker_pos + ImVec2(sv_picker_size, sv_picker_size), col_white, hue_color32, hue_color32, col_white) draw_list:AddRectFilledMultiColor(picker_pos, picker_pos + ImVec2(sv_picker_size, sv_picker_size), 0, 0, col_black, col_black) @@ -54670,7 +54713,7 @@ function ImGui.ColorPicker4(label, col, flags, ref_col) 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)) - 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(IM_COL32_A_MASK)), bit32.band(user_col32_striped_of_alpha, bit32.bnot(IM_COL32_A_MASK))) + 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) ImGui.RenderFrameBorder(bar1_bb.Min, bar1_bb.Max, 0.0) @@ -54735,12 +54778,12 @@ function ImGui.ColorButton(desc_id, col, flags, size_arg) local pressed, hovered, _ = ImGui.ButtonBehavior(bb, id) - if bit32.band(flags, bit32.bor(ImGuiColorEditFlags.NoAlpha, ImGuiColorEditFlags.AlphaOpaque)) ~= 0 then - flags = bit32.band(flags, bit32.bnot(bit32.bor(ImGuiColorEditFlags.AlphaNoBg, ImGuiColorEditFlags.AlphaPreviewHalf))) + if bit32.band(flags, bit32.bor(2 --[[ImGuiColorEditFlags.NoAlpha]], 4096 --[[ImGuiColorEditFlags.AlphaOpaque]])) ~= 0 then + flags = bit32.band(flags, bit32.bnot(bit32.bor(8192 --[[ImGuiColorEditFlags.AlphaNoBg]], 16384 --[[ImGuiColorEditFlags.AlphaPreviewHalf]]))) end local col_rgb = ImVec4(col.x, col.y, col.z, col.w) - if bit32.band(flags, ImGuiColorEditFlags.InputHSV) ~= 0 then + if bit32.band(flags, 536870912 --[[ImGuiColorEditFlags.InputHSV]]) ~= 0 then col_rgb.x, col_rgb.y, col_rgb.z = ImGui.ColorConvertHSVtoRGB(col_rgb.x, col_rgb.y, col_rgb.z) end @@ -54750,33 +54793,33 @@ function ImGui.ColorButton(desc_id, col, flags, size_arg) local bb_inner = ImRect() ImRect_Copy(bb_inner, bb) local off = 0.0 - if bit32.band(flags, ImGuiColorEditFlags.NoBorder) == 0 then + if bit32.band(flags, 1024 --[[ImGuiColorEditFlags.NoBorder]]) == 0 then off = -0.75 bb_inner:Expand(off) end - if bit32.band(flags, ImGuiColorEditFlags.AlphaPreviewHalf) ~= 0 and col_rgb.w < 1.0 then + 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, 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, ImDrawFlags.RoundCornersRight) + 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.RoundCornersRight]]) else - window.DrawList:AddRectFilled(ImVec2(bb_inner.Min.x + grid_step, bb_inner.Min.y), bb_inner.Max, ImGui.GetColorU32(col_rgb), rounding, ImDrawFlags.RoundCornersRight) + window.DrawList:AddRectFilled(ImVec2(bb_inner.Min.x + grid_step, bb_inner.Min.y), bb_inner.Max, ImGui.GetColorU32(col_rgb), rounding, 160 --[[ImDrawFlags.RoundCornersRight]]) end - window.DrawList:AddRectFilled(bb_inner.Min, ImVec2(mid_x, bb_inner.Max.y), ImGui.GetColorU32(col_rgb_without_alpha), rounding, ImDrawFlags.RoundCornersLeft) + window.DrawList:AddRectFilled(bb_inner.Min, ImVec2(mid_x, bb_inner.Max.y), ImGui.GetColorU32(col_rgb_without_alpha), rounding, 80 --[[ImDrawFlags.RoundCornersLeft]]) 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, ImGuiColorEditFlags.AlphaOpaque) ~= 0) and col_rgb_without_alpha or col_rgb - if col_source.w < 1.0 and bit32.band(flags, ImGuiColorEditFlags.AlphaNoBg) == 0 then + 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) else window.DrawList:AddRectFilled(bb_inner.Min, bb_inner.Max, ImGui.GetColorU32(col_source), rounding) end end ImGui.RenderNavCursor(bb, id) - if bit32.band(flags, ImGuiColorEditFlags.NoBorder) == 0 then + 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(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) -- Color buttons are often in need of some sort of border end end @@ -54795,8 +54838,8 @@ function ImGui.ColorButton(desc_id, col, flags, size_arg) -- end -- Tooltip - if bit32.band(flags, ImGuiColorEditFlags.NoTooltip) == 0 and hovered and ImGui.IsItemHovered(ImGuiHoveredFlags.ForTooltip) then - ImGui.ColorTooltip(desc_id, col, bit32.band(flags, bit32.bor(ImGuiColorEditFlags.InputMask_, ImGuiColorEditFlags.AlphaMask_))) + if bit32.band(flags, 64 --[[ImGuiColorEditFlags.NoTooltip]]) == 0 and hovered and ImGui.IsItemHovered(4096 --[[ImGuiHoveredFlags.ForTooltip]]) then + ImGui.ColorTooltip(desc_id, col, bit32.band(flags, bit32.bor(805306368 --[[ImGuiColorEditFlags.InputMask_]], 28674 --[[ImGuiColorEditFlags.AlphaMask_]]))) end return pressed @@ -54809,7 +54852,7 @@ end function ImGui.ColorTooltip(text, col, flags) local g = GImGui - if not ImGui.BeginTooltipEx(ImGuiTooltipFlags.OverridePrevious, ImGuiWindowFlags.None) then + if not ImGui.BeginTooltipEx(2 --[[ImGuiTooltipFlags.OverridePrevious]], 0 --[[ImGuiWindowFlags.None]]) then return end @@ -54821,24 +54864,24 @@ function ImGui.ColorTooltip(text, col, flags) end local sz = ImVec2(g.FontSize * 3 + g.Style.FramePadding.y * 2, g.FontSize * 3 + g.Style.FramePadding.y * 2) - local cf = ImVec4(col.x, col.y, col.z, (bit32.band(flags, ImGuiColorEditFlags.NoAlpha) ~= 0) and 1.0 or col.w) + local cf = ImVec4(col.x, col.y, col.z, (bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) ~= 0) and 1.0 or col.w) local cr = IM_F32_TO_INT8_SAT(col.x) local cg = IM_F32_TO_INT8_SAT(col.y) local cb = IM_F32_TO_INT8_SAT(col.z) - local ca = (bit32.band(flags, ImGuiColorEditFlags.NoAlpha) ~= 0) and 255 or IM_F32_TO_INT8_SAT(col.w) + local ca = (bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) ~= 0) and 255 or IM_F32_TO_INT8_SAT(col.w) - local flags_to_forward = bit32.bor(ImGuiColorEditFlags.InputMask_, ImGuiColorEditFlags.AlphaMask_) - ImGui.ColorButton("##preview", cf, bit32.bor(bit32.band(flags, flags_to_forward), ImGuiColorEditFlags.NoTooltip), sz) + local flags_to_forward = bit32.bor(805306368 --[[ImGuiColorEditFlags.InputMask_]], 28674 --[[ImGuiColorEditFlags.AlphaMask_]]) + ImGui.ColorButton("##preview", cf, bit32.bor(bit32.band(flags, flags_to_forward), 64 --[[ImGuiColorEditFlags.NoTooltip]]), sz) ImGui.SameLine() - if bit32.band(flags, ImGuiColorEditFlags.InputRGB) ~= 0 or bit32.band(flags, ImGuiColorEditFlags.InputMask_) == 0 then - if bit32.band(flags, ImGuiColorEditFlags.NoAlpha) ~= 0 then + if bit32.band(flags, 268435456 --[[ImGuiColorEditFlags.InputRGB]]) ~= 0 or bit32.band(flags, 805306368 --[[ImGuiColorEditFlags.InputMask_]]) == 0 then + if bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) ~= 0 then ImGui.Text("#%02X%02X%02X\nR: %d, G: %d, B: %d\n(%.3f, %.3f, %.3f)", cr, cg, cb, cr, cg, cb, col.x, col.y, col.z) else ImGui.Text("#%02X%02X%02X%02X\nR:%d, G:%d, B:%d, A:%d\n(%.3f, %.3f, %.3f, %.3f)", cr, cg, cb, ca, cr, cg, cb, ca, col.x, col.y, col.z, col.w) end - elseif bit32.band(flags, ImGuiColorEditFlags.InputHSV) ~= 0 then - if bit32.band(flags, ImGuiColorEditFlags.NoAlpha) ~= 0 then + elseif bit32.band(flags, 536870912 --[[ImGuiColorEditFlags.InputHSV]]) ~= 0 then + if bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) ~= 0 then ImGui.Text("H: %.3f, S: %.3f, V: %.3f", col.x, col.y, col.z) else ImGui.Text("H: %.3f, S: %.3f, V: %.3f, A: %.3f", col.x, col.y, col.z, col.w) @@ -54851,34 +54894,34 @@ end --- @param col float[] --- @param flags ImGuiColorEditFlags function ImGui.ColorEditOptionsPopup(col, flags) - local allow_opt_inputs = bit32.band(flags, ImGuiColorEditFlags.DisplayMask_) == 0 - local allow_opt_datatype = bit32.band(flags, ImGuiColorEditFlags.DataTypeMask_) == 0 + local allow_opt_inputs = bit32.band(flags, 7340032 --[[ImGuiColorEditFlags.DisplayMask_]]) == 0 + local allow_opt_datatype = bit32.band(flags, 25165824 --[[ImGuiColorEditFlags.DataTypeMask_]]) == 0 if (not allow_opt_inputs and not allow_opt_datatype) or not ImGui.BeginPopup("context") then return end local g = GImGui - ImGui.PushItemFlag(ImGuiItemFlags.NoMarkEdited, true) + ImGui.PushItemFlag(65536 --[[ImGuiItemFlags.NoMarkEdited]], true) local opts = g.IO.ConfigColorEditFlags if allow_opt_inputs then - if ImGui.RadioButtonEx("RGB", bit32.band(opts, ImGuiColorEditFlags.DisplayRGB) ~= 0) then - opts = bit32.bor(bit32.band(opts, bit32.bnot(ImGuiColorEditFlags.DisplayMask_)), ImGuiColorEditFlags.DisplayRGB) + if ImGui.RadioButtonEx("RGB", bit32.band(opts, 1048576 --[[ImGuiColorEditFlags.DisplayRGB]]) ~= 0) then + opts = bit32.bor(bit32.band(opts, bit32.bnot(7340032 --[[ImGuiColorEditFlags.DisplayMask_]])), 1048576 --[[ImGuiColorEditFlags.DisplayRGB]]) end - if ImGui.RadioButtonEx("HSV", bit32.band(opts, ImGuiColorEditFlags.DisplayHSV) ~= 0) then - opts = bit32.bor(bit32.band(opts, bit32.bnot(ImGuiColorEditFlags.DisplayMask_)), ImGuiColorEditFlags.DisplayHSV) + if ImGui.RadioButtonEx("HSV", bit32.band(opts, 2097152 --[[ImGuiColorEditFlags.DisplayHSV]]) ~= 0) then + opts = bit32.bor(bit32.band(opts, bit32.bnot(7340032 --[[ImGuiColorEditFlags.DisplayMask_]])), 2097152 --[[ImGuiColorEditFlags.DisplayHSV]]) end - if ImGui.RadioButtonEx("Hex", bit32.band(opts, ImGuiColorEditFlags.DisplayHex) ~= 0) then - opts = bit32.bor(bit32.band(opts, bit32.bnot(ImGuiColorEditFlags.DisplayMask_)), ImGuiColorEditFlags.DisplayHex) + if ImGui.RadioButtonEx("Hex", bit32.band(opts, 4194304 --[[ImGuiColorEditFlags.DisplayHex]]) ~= 0) then + opts = bit32.bor(bit32.band(opts, bit32.bnot(7340032 --[[ImGuiColorEditFlags.DisplayMask_]])), 4194304 --[[ImGuiColorEditFlags.DisplayHex]]) end end if allow_opt_datatype then if allow_opt_inputs then ImGui.Separator() end - if ImGui.RadioButtonEx("0..255", bit32.band(opts, ImGuiColorEditFlags.Uint8) ~= 0) then - opts = bit32.bor(bit32.band(opts, bit32.bnot(ImGuiColorEditFlags.DataTypeMask_)), ImGuiColorEditFlags.Uint8) + if ImGui.RadioButtonEx("0..255", bit32.band(opts, 8388608 --[[ImGuiColorEditFlags.Uint8]]) ~= 0) then + opts = bit32.bor(bit32.band(opts, bit32.bnot(25165824 --[[ImGuiColorEditFlags.DataTypeMask_]])), 8388608 --[[ImGuiColorEditFlags.Uint8]]) end - if ImGui.RadioButtonEx("0.00..1.00", bit32.band(opts, ImGuiColorEditFlags.Float) ~= 0) then - opts = bit32.bor(bit32.band(opts, bit32.bnot(ImGuiColorEditFlags.DataTypeMask_)), ImGuiColorEditFlags.Float) + if ImGui.RadioButtonEx("0.00..1.00", bit32.band(opts, 16777216 --[[ImGuiColorEditFlags.Float]]) ~= 0) then + opts = bit32.bor(bit32.band(opts, bit32.bnot(25165824 --[[ImGuiColorEditFlags.DataTypeMask_]])), 16777216 --[[ImGuiColorEditFlags.Float]]) end end @@ -54892,9 +54935,9 @@ function ImGui.ColorEditOptionsPopup(col, flags) local cr = IM_F32_TO_INT8_SAT(col[1]) local cg = IM_F32_TO_INT8_SAT(col[2]) local cb = IM_F32_TO_INT8_SAT(col[3]) - local ca = (bit32.band(flags, ImGuiColorEditFlags.NoAlpha) ~= 0) and 255 or IM_F32_TO_INT8_SAT(col[4]) + local ca = (bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) ~= 0) and 255 or IM_F32_TO_INT8_SAT(col[4]) - local buf1 = ImFormatString("(%.3ff, %.3ff, %.3ff, %.3ff)", col[1], col[2], col[3], (bit32.band(flags, ImGuiColorEditFlags.NoAlpha) ~= 0) and 1.0 or col[4]) + local buf1 = ImFormatString("(%.3ff, %.3ff, %.3ff, %.3ff)", col[1], col[2], col[3], (bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) ~= 0) and 1.0 or col[4]) if ImGui.Selectable(buf1) then ImGui.SetClipboardText(buf1) end @@ -54909,7 +54952,7 @@ function ImGui.ColorEditOptionsPopup(col, flags) ImGui.SetClipboardText(buf3) end - if bit32.band(flags, ImGuiColorEditFlags.NoAlpha) == 0 then + if bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) == 0 then local buf4 = ImFormatString("#%02X%02X%02X%02X", cr, cg, cb, ca) if ImGui.Selectable(buf4) then ImGui.SetClipboardText(buf4) @@ -54927,15 +54970,15 @@ end --- @param ref_col float[] --- @param flags ImGuiColorEditFlags function ImGui.ColorPickerOptionsPopup(ref_col, flags) - local allow_opt_picker = bit32.band(flags, ImGuiColorEditFlags.PickerMask_) == 0 - local allow_opt_alpha_bar = (bit32.band(flags, ImGuiColorEditFlags.NoAlpha) == 0) and (bit32.band(flags, ImGuiColorEditFlags.AlphaBar) == 0) + local allow_opt_picker = bit32.band(flags, 100663296 --[[ImGuiColorEditFlags.PickerMask_]]) == 0 + local allow_opt_alpha_bar = (bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) == 0) and (bit32.band(flags, 262144 --[[ImGuiColorEditFlags.AlphaBar]]) == 0) if (not allow_opt_picker and not allow_opt_alpha_bar) or not ImGui.BeginPopup("context") then return end local g = GImGui - ImGui.PushItemFlag(ImGuiItemFlags.NoMarkEdited, true) + ImGui.PushItemFlag(65536 --[[ImGuiItemFlags.NoMarkEdited]], true) if allow_opt_picker then local picker_size = ImVec2(g.FontSize * 8, ImMax(g.FontSize * 8 - (ImGui.GetFrameHeight() + g.Style.ItemInnerSpacing.x), 1.0)) -- FIXME: Picker size copied from main picker function ImGui.PushItemWidth(picker_size.x) @@ -54945,20 +54988,20 @@ function ImGui.ColorPickerOptionsPopup(ref_col, flags) ImGui.Separator() end ImGui.PushID(picker_type) - local picker_flags = bit32.bor(ImGuiColorEditFlags.NoInputs, ImGuiColorEditFlags.NoOptions, ImGuiColorEditFlags.NoLabel, ImGuiColorEditFlags.NoSidePreview, bit32.band(flags, ImGuiColorEditFlags.NoAlpha)) + local picker_flags = bit32.bor(32 --[[ImGuiColorEditFlags.NoInputs]], 8 --[[ImGuiColorEditFlags.NoOptions]], 128 --[[ImGuiColorEditFlags.NoLabel]], 256 --[[ImGuiColorEditFlags.NoSidePreview]], bit32.band(flags, 2 --[[ImGuiColorEditFlags.NoAlpha]])) if picker_type == 0 then - picker_flags = bit32.bor(picker_flags, ImGuiColorEditFlags.PickerHueBar) + picker_flags = bit32.bor(picker_flags, 33554432 --[[ImGuiColorEditFlags.PickerHueBar]]) end if picker_type == 1 then - picker_flags = bit32.bor(picker_flags, ImGuiColorEditFlags.PickerHueWheel) + picker_flags = bit32.bor(picker_flags, 67108864 --[[ImGuiColorEditFlags.PickerHueWheel]]) end local backup_pos = ImGui.GetCursorScreenPos() if ImGui.Selectable("##selectable", false, 0, picker_size) then -- By default, Selectable() is closing popup - g.IO.ConfigColorEditFlags = bit32.bor(bit32.band(g.IO.ConfigColorEditFlags, bit32.bnot(ImGuiColorEditFlags.PickerMask_)), bit32.band(picker_flags, ImGuiColorEditFlags.PickerMask_)) + g.IO.ConfigColorEditFlags = bit32.bor(bit32.band(g.IO.ConfigColorEditFlags, bit32.bnot(100663296 --[[ImGuiColorEditFlags.PickerMask_]])), bit32.band(picker_flags, 100663296 --[[ImGuiColorEditFlags.PickerMask_]])) end ImGui.SetCursorScreenPos(backup_pos) local previewing_ref_col = ImVec4() - for i = 1, (bit32.band(picker_flags, ImGuiColorEditFlags.NoAlpha) ~= 0 and 3 or 4) do + for i = 1, (bit32.band(picker_flags, 2 --[[ImGuiColorEditFlags.NoAlpha]]) ~= 0 and 3 or 4) do previewing_ref_col[i] = ref_col[i] end ImGui.ColorPicker4("##previewing_picker", previewing_ref_col, picker_flags) @@ -54970,7 +55013,7 @@ function ImGui.ColorPickerOptionsPopup(ref_col, flags) if allow_opt_picker then ImGui.Separator() end - _, g.IO.ConfigColorEditFlags = ImGui.CheckboxFlags("Alpha Bar", g.IO.ConfigColorEditFlags, ImGuiColorEditFlags.AlphaBar) + _, g.IO.ConfigColorEditFlags = ImGui.CheckboxFlags("Alpha Bar", g.IO.ConfigColorEditFlags, 262144 --[[ImGuiColorEditFlags.AlphaBar]]) end ImGui.PopItemFlag() ImGui.EndPopup() @@ -55004,7 +55047,7 @@ ImGui.BulletTextV = function(...) return ImGui.BulletText(...) end --- @param v number function ImGui.SetNextItemRefVal(data_type, v) local g = GImGui - g.NextItemData.HasFlags = bit32.bor(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasRefVal) + g.NextItemData.HasFlags = bit32.bor(g.NextItemData.HasFlags, 8 --[[ImGuiNextItemDataFlags.HasRefVal]]) g.NextItemData.RefVal = v end @@ -55020,7 +55063,7 @@ function ImGui.TreeNode(label, fmt, ...) return false end local id = window:GetID(label) - return ImGui.TreeNodeBehavior(id, ImGuiTreeNodeFlags.None, label, nil) + return ImGui.TreeNodeBehavior(id, 0 --[[ImGuiTreeNodeFlags.None]], label, nil) end function ImGui.TreeNodeV(str_id, fmt, ...) @@ -55075,7 +55118,7 @@ end --- @param flags ImGuiTreeNodeFlags function ImGui.TreeNodeUpdateNextOpen(storage_id, flags) -- Leaf node always open a new tree/id scope. If you never use it, add ImGuiTreeNodeFlags.NoTreePushOnOpen. - if bit32.band(flags, ImGuiTreeNodeFlags.Leaf) ~= 0 then + if bit32.band(flags, 256 --[[ImGuiTreeNodeFlags.Leaf]]) ~= 0 then return true end @@ -55085,8 +55128,8 @@ function ImGui.TreeNodeUpdateNextOpen(storage_id, flags) local storage = window.DC.StateStorage local is_open - if bit32.band(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasOpen) ~= 0 then - if bit32.band(g.NextItemData.OpenCond, ImGuiCond.Always) ~= 0 then + if bit32.band(g.NextItemData.HasFlags, 2 --[[ImGuiNextItemDataFlags.HasOpen]]) ~= 0 then + if bit32.band(g.NextItemData.OpenCond, 1 --[[ImGuiCond.Always]]) ~= 0 then is_open = g.NextItemData.OpenVal ImGui.TreeNodeSetOpen(storage_id, is_open) else @@ -55100,12 +55143,12 @@ function ImGui.TreeNodeUpdateNextOpen(storage_id, flags) end end else - is_open = (storage[storage_id] == nil) and (bit32.band(flags, ImGuiTreeNodeFlags.DefaultOpen) ~= 0) or storage[storage_id] + is_open = (storage[storage_id] == nil) and (bit32.band(flags, 32 --[[ImGuiTreeNodeFlags.DefaultOpen]]) ~= 0) or storage[storage_id] end -- When logging is enabled, we automatically expand tree nodes (but *NOT* collapsing headers.. seems like sensible behavior). -- NB- If we are above max depth we still allow manually opened nodes to be logged. - if g.LogEnabled and bit32.band(flags, ImGuiTreeNodeFlags.NoAutoOpenOnLog) == 0 and (window.DC.TreeDepth - g.LogDepthRef) < g.LogDepthToExpand then + if g.LogEnabled and bit32.band(flags, 16 --[[ImGuiTreeNodeFlags.NoAutoOpenOnLog]]) == 0 and (window.DC.TreeDepth - g.LogDepthRef) < g.LogDepthToExpand then is_open = true end @@ -55128,12 +55171,12 @@ local function TreeNodeStoreStackData(flags, x1) ImRect_Copy(tree_node_data.NavRect, g.LastItemData.NavRect) -- Initially I tried to latch value for GetColorU32(ImGuiCol.TreeLines) but it's not a good trade-off for very large trees. - local draw_lines = bit32.band(flags, bit32.bor(ImGuiTreeNodeFlags.DrawLinesFull, ImGuiTreeNodeFlags.DrawLinesToNodes)) ~= 0 - tree_node_data.DrawLinesX1 = draw_lines and (x1 + g.FontSize * 0.5 + g.Style.FramePadding.x) or FLT_MAX + local draw_lines = bit32.band(flags, bit32.bor(524288 --[[ImGuiTreeNodeFlags.DrawLinesFull]], 1048576 --[[ImGuiTreeNodeFlags.DrawLinesToNodes]])) ~= 0 + tree_node_data.DrawLinesX1 = draw_lines and (x1 + g.FontSize * 0.5 + g.Style.FramePadding.x) or 3.4028234663853e+38 --[[FLT_MAX]] tree_node_data.DrawLinesTableColumn = (draw_lines and g.CurrentTable) and g.CurrentTable.CurrentColumn or -1 - tree_node_data.DrawLinesToNodesY2 = -FLT_MAX + tree_node_data.DrawLinesToNodesY2 = -3.4028234663853e+38 --[[FLT_MAX]] window.DC.TreeHasStackDataDepthMask = bit32.bor(window.DC.TreeHasStackDataDepthMask, bit32.lshift(1, window.DC.TreeDepth)) - if bit32.band(flags, ImGuiTreeNodeFlags.DrawLinesToNodes) ~= 0 then + if bit32.band(flags, 1048576 --[[ImGuiTreeNodeFlags.DrawLinesToNodes]]) ~= 0 then window.DC.TreeRecordsClippedNodesY2Mask = bit32.bor(window.DC.TreeRecordsClippedNodesY2Mask, bit32.lshift(1, window.DC.TreeDepth)) end end @@ -55153,8 +55196,8 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) local style = g.Style -- When not framed, we vertically increase height up to typical framed widget height - local display_frame = bit32.band(flags, ImGuiTreeNodeFlags.Framed) ~= 0 - local use_frame_padding = display_frame or (bit32.band(flags, ImGuiTreeNodeFlags.FramePadding) ~= 0) + local display_frame = bit32.band(flags, 2 --[[ImGuiTreeNodeFlags.Framed]]) ~= 0 + local use_frame_padding = display_frame or (bit32.band(flags, 1024 --[[ImGuiTreeNodeFlags.FramePadding]]) ~= 0) -- [Luau] scalar padding, no temporary ImVec2 local padding_x, padding_y if use_frame_padding then @@ -55173,12 +55216,12 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) local text_width = g.FontSize + label_size.x + padding_x * 2 -- Include collapsing arrow local frame_height = label_size.y + padding_y * 2 - local span_all_columns = bit32.band(flags, ImGuiTreeNodeFlags.SpanAllColumns) ~= 0 and (g.CurrentTable ~= nil) - local span_all_columns_label = bit32.band(flags, ImGuiTreeNodeFlags.LabelSpanAllColumns) ~= 0 and (g.CurrentTable ~= nil) + local span_all_columns = bit32.band(flags, 16384 --[[ImGuiTreeNodeFlags.SpanAllColumns]]) ~= 0 and (g.CurrentTable ~= nil) + local span_all_columns_label = bit32.band(flags, 32768 --[[ImGuiTreeNodeFlags.LabelSpanAllColumns]]) ~= 0 and (g.CurrentTable ~= nil) local frame_bb = ImRect() - frame_bb.Min.x = span_all_columns and window.ParentWorkRect.Min.x or (bit32.band(flags, ImGuiTreeNodeFlags.SpanFullWidth) ~= 0 and window.WorkRect.Min.x or window.DC.CursorPos.x) + frame_bb.Min.x = span_all_columns and window.ParentWorkRect.Min.x or (bit32.band(flags, 4096 --[[ImGuiTreeNodeFlags.SpanFullWidth]]) ~= 0 and window.WorkRect.Min.x or window.DC.CursorPos.x) frame_bb.Min.y = window.DC.CursorPos.y + (text_offset_y - padding_y) - frame_bb.Max.x = span_all_columns and window.ParentWorkRect.Max.x or (bit32.band(flags, ImGuiTreeNodeFlags.SpanLabelWidth) ~= 0 and window.DC.CursorPos.x + text_width + padding_x or window.WorkRect.Max.x) + frame_bb.Max.x = span_all_columns and window.ParentWorkRect.Max.x or (bit32.band(flags, 8192 --[[ImGuiTreeNodeFlags.SpanLabelWidth]]) ~= 0 and window.DC.CursorPos.x + text_width + padding_x or window.WorkRect.Max.x) frame_bb.Max.y = window.DC.CursorPos.y + (text_offset_y - padding_y) + frame_height if display_frame then local outer_extend = IM_TRUNC(window.WindowPadding.x * 0.5) -- Framed header expand a little outside of current limits @@ -55193,12 +55236,12 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) -- For regular tree nodes, we arbitrary allow to click past 2 worth of ItemSpacing local interact_bb = ImRect() ImRect_Copy(interact_bb, frame_bb) - if bit32.band(flags, bit32.bor(ImGuiTreeNodeFlags.Framed, ImGuiTreeNodeFlags.SpanAvailWidth, ImGuiTreeNodeFlags.SpanFullWidth, ImGuiTreeNodeFlags.SpanLabelWidth, ImGuiTreeNodeFlags.SpanAllColumns)) == 0 then + if bit32.band(flags, bit32.bor(2 --[[ImGuiTreeNodeFlags.Framed]], 2048 --[[ImGuiTreeNodeFlags.SpanAvailWidth]], 4096 --[[ImGuiTreeNodeFlags.SpanFullWidth]], 8192 --[[ImGuiTreeNodeFlags.SpanLabelWidth]], 16384 --[[ImGuiTreeNodeFlags.SpanAllColumns]])) == 0 then interact_bb.Max.x = frame_bb.Min.x + text_width + (label_size.x > 0.0 and (style.ItemSpacing.x * 2.0) or 0.0) end -- Compute open and multi-select states before ItemAdd() as it clear NextItem data. - local storage_id = (bit32.band(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasStorageID) ~= 0) and g.NextItemData.StorageId or id + local storage_id = (bit32.band(g.NextItemData.HasFlags, 16 --[[ImGuiNextItemDataFlags.HasStorageID]]) ~= 0) and g.NextItemData.StorageId or id local is_open = ImGui.TreeNodeUpdateNextOpen(storage_id, flags) local is_visible @@ -55214,7 +55257,7 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) else is_visible = ImGui.ItemAdd(interact_bb, id) end - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HasDisplayRect) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 2 --[[ImGuiItemStatusFlags.HasDisplayRect]]) ImRect_Copy(g.LastItemData.DisplayRect, frame_bb) -- If a NavLeft request is happening and ImGuiTreeNodeFlags.NavLeftJumpsToParent enabled: @@ -55222,22 +55265,22 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) -- For this purpose we essentially compare if g.NavIdIsAlive went from 0 to 1 between TreeNode() and TreePop(). -- It will become tempting to enable ImGuiTreeNodeFlags.NavLeftJumpsToParent by default or move it to ImGuiStyle. local store_tree_node_stack_data = false - if bit32.band(flags, ImGuiTreeNodeFlags.DrawLinesMask_) == 0 then + if bit32.band(flags, 1835008 --[[ImGuiTreeNodeFlags.DrawLinesMask_]]) == 0 then flags = bit32.bor(flags, g.Style.TreeLinesFlags) end - local draw_tree_lines = (bit32.band(flags, bit32.bor(ImGuiTreeNodeFlags.DrawLinesFull, ImGuiTreeNodeFlags.DrawLinesToNodes)) ~= 0) and (frame_bb.Min.y < window.ClipRect.Max.y) and (g.Style.TreeLinesSize > 0.0) - if bit32.band(flags, ImGuiTreeNodeFlags.NoTreePushOnOpen) == 0 then + local draw_tree_lines = (bit32.band(flags, bit32.bor(524288 --[[ImGuiTreeNodeFlags.DrawLinesFull]], 1048576 --[[ImGuiTreeNodeFlags.DrawLinesToNodes]])) ~= 0) and (frame_bb.Min.y < window.ClipRect.Max.y) and (g.Style.TreeLinesSize > 0.0) + if bit32.band(flags, 8 --[[ImGuiTreeNodeFlags.NoTreePushOnOpen]]) == 0 then store_tree_node_stack_data = draw_tree_lines - if bit32.band(flags, ImGuiTreeNodeFlags.NavLeftJumpsToParent) ~= 0 and not g.NavIdIsAlive then - if g.NavMoveDir == ImGuiDir.Left and g.NavWindow == window and ImGui.NavMoveRequestButNoResultYet() then + if bit32.band(flags, 131072 --[[ImGuiTreeNodeFlags.NavLeftJumpsToParent]]) ~= 0 and not g.NavIdIsAlive then + if g.NavMoveDir == 0 --[[ImGuiDir.Left]] and g.NavWindow == window and ImGui.NavMoveRequestButNoResultYet() then store_tree_node_stack_data = true end end end - local is_leaf = bit32.band(flags, ImGuiTreeNodeFlags.Leaf) ~= 0 + local is_leaf = bit32.band(flags, 256 --[[ImGuiTreeNodeFlags.Leaf]]) ~= 0 if not is_visible then - if bit32.band(flags, ImGuiTreeNodeFlags.DrawLinesToNodes) ~= 0 and bit32.band(window.DC.TreeRecordsClippedNodesY2Mask, bit32.lshift(1, (window.DC.TreeDepth - 1))) ~= 0 then + if bit32.band(flags, 1048576 --[[ImGuiTreeNodeFlags.DrawLinesToNodes]]) ~= 0 and bit32.band(window.DC.TreeRecordsClippedNodesY2Mask, bit32.lshift(1, (window.DC.TreeDepth - 1))) ~= 0 then local parent_data = g.TreeNodeStack.Data[g.TreeNodeStack.Size] parent_data.DrawLinesToNodesY2 = ImMax(parent_data.DrawLinesToNodesY2, window.DC.CursorPos.y) -- Don't need to aim to mid Y position as we are clipped anyway. if frame_bb.Min.y >= window.ClipRect.Max.y then @@ -55247,7 +55290,7 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) if is_open and store_tree_node_stack_data then TreeNodeStoreStackData(flags, text_pos.x - text_offset_x) -- Call before TreePushOverrideID() end - if is_open and bit32.band(flags, ImGuiTreeNodeFlags.NoTreePushOnOpen) == 0 then + if is_open and bit32.band(flags, 8 --[[ImGuiTreeNodeFlags.NoTreePushOnOpen]]) == 0 then ImGui.TreePushOverrideID(id) end -- IMGUI_TEST_ENGINE_ITEM_INFO(g.LastItemData.ID, label, g.LastItemData.StatusFlags | (is_leaf ? 0 : ImGuiItemStatusFlags_Openable) | (is_open ? ImGuiItemStatusFlags_Opened : 0)) @@ -55256,16 +55299,16 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) if span_all_columns or span_all_columns_label then ImGui.TablePushBackgroundChannel() - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HasClipRect) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 512 --[[ImGuiItemStatusFlags.HasClipRect]]) ImRect_Copy(g.LastItemData.ClipRect, window.ClipRect) end - local button_flags = ImGuiTreeNodeFlags.None - if bit32.band(flags, ImGuiTreeNodeFlags.AllowOverlap) ~= 0 or bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.AllowOverlap) ~= 0 then - button_flags = bit32.bor(button_flags, ImGuiButtonFlags.AllowOverlap) + local button_flags = 0 --[[ImGuiTreeNodeFlags.None]] + if bit32.band(flags, 4 --[[ImGuiTreeNodeFlags.AllowOverlap]]) ~= 0 or bit32.band(g.LastItemData.ItemFlags, 16384 --[[ImGuiItemFlags.AllowOverlap]]) ~= 0 then + button_flags = bit32.bor(button_flags, 4096 --[[ImGuiButtonFlags.AllowOverlap]]) end if not is_leaf then - button_flags = bit32.bor(button_flags, ImGuiButtonFlags.PressedOnDragDropHold) + button_flags = bit32.bor(button_flags, 512 --[[ImGuiButtonFlags.PressedOnDragDropHold]]) end -- We allow clicking on the arrow section with keyboard modifiers held, in order to easily @@ -55275,9 +55318,9 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) local arrow_hit_x2 = (text_pos.x - text_offset_x) + (g.FontSize + padding_x * 2.0) + style.TouchExtraPadding.x local is_mouse_x_over_arrow = (g.IO.MousePos.x >= arrow_hit_x1 and g.IO.MousePos.x < arrow_hit_x2) - local is_multi_select = bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.IsMultiSelect) ~= 0 + local is_multi_select = bit32.band(g.LastItemData.ItemFlags, 4194304 --[[ImGuiItemFlags.IsMultiSelect]]) ~= 0 if is_multi_select then -- We absolutely need to distinguish open vs select so _OpenOnArrow comes by default - flags = bit32.bor(flags, (bit32.band(flags, ImGuiTreeNodeFlags.OpenOnMask_) == 0) and bit32.bor(ImGuiTreeNodeFlags.OpenOnArrow, ImGuiTreeNodeFlags.OpenOnDoubleClick) or ImGuiTreeNodeFlags.OpenOnArrow) + flags = bit32.bor(flags, (bit32.band(flags, 192 --[[ImGuiTreeNodeFlags.OpenOnMask_]]) == 0) and bit32.bor(128 --[[ImGuiTreeNodeFlags.OpenOnArrow]], 64 --[[ImGuiTreeNodeFlags.OpenOnDoubleClick]]) or 128 --[[ImGuiTreeNodeFlags.OpenOnArrow]]) end -- Open behaviors can be altered with the _OpenOnArrow and _OnOnDoubleClick flags. @@ -55290,17 +55333,17 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) -- It is rather standard that arrow click react on Down rather than Up. -- We set ImGuiButtonFlags.PressedOnClickRelease on OpenOnDoubleClick because we want the item to be active on the initial MouseDown in order for drag and drop to work. if is_mouse_x_over_arrow then - button_flags = bit32.bor(button_flags, ImGuiButtonFlags.PressedOnClick) - elseif bit32.band(flags, ImGuiTreeNodeFlags.OpenOnDoubleClick) ~= 0 then - button_flags = bit32.bor(button_flags, ImGuiButtonFlags.PressedOnClickRelease, ImGuiButtonFlags.PressedOnDoubleClick) + button_flags = bit32.bor(button_flags, 16 --[[ImGuiButtonFlags.PressedOnClick]]) + elseif bit32.band(flags, 64 --[[ImGuiTreeNodeFlags.OpenOnDoubleClick]]) ~= 0 then + button_flags = bit32.bor(button_flags, 32 --[[ImGuiButtonFlags.PressedOnClickRelease]], 256 --[[ImGuiButtonFlags.PressedOnDoubleClick]]) else - button_flags = bit32.bor(button_flags, ImGuiButtonFlags.PressedOnClickRelease) + button_flags = bit32.bor(button_flags, 32 --[[ImGuiButtonFlags.PressedOnClickRelease]]) end - if bit32.band(flags, ImGuiTreeNodeFlags.NoNavFocus) ~= 0 then - button_flags = bit32.bor(button_flags, ImGuiButtonFlags.NoNavFocus) + if bit32.band(flags, 134217728 --[[ImGuiTreeNodeFlags.NoNavFocus]]) ~= 0 then + button_flags = bit32.bor(button_flags, 262144 --[[ImGuiButtonFlags.NoNavFocus]]) end - local selected = bit32.band(flags, ImGuiTreeNodeFlags.Selected) ~= 0 + local selected = bit32.band(flags, 1 --[[ImGuiTreeNodeFlags.Selected]]) ~= 0 local was_selected = selected -- Multi-selection support (header) @@ -55308,11 +55351,11 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) -- Handle multi-select + alter button flags for it selected, button_flags = ImGui.MultiSelectItemHeader(id, selected, button_flags) if is_mouse_x_over_arrow then - button_flags = bit32.band(bit32.bor(button_flags, ImGuiButtonFlags.PressedOnClick), bit32.bnot(ImGuiButtonFlags.PressedOnClickRelease)) + button_flags = bit32.band(bit32.bor(button_flags, 16 --[[ImGuiButtonFlags.PressedOnClick]]), bit32.bnot(32 --[[ImGuiButtonFlags.PressedOnClickRelease]])) end else if window ~= g.HoveredWindow or not is_mouse_x_over_arrow then - button_flags = bit32.bor(button_flags, ImGuiButtonFlags.NoKeyModsAllowed) + button_flags = bit32.bor(button_flags, 65536 --[[ImGuiButtonFlags.NoKeyModsAllowed]]) end end @@ -55320,17 +55363,17 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) local toggled = false if not is_leaf then if pressed and g.DragDropHoldJustPressedId ~= id then - if bit32.band(flags, ImGuiTreeNodeFlags.OpenOnMask_) == 0 or (g.NavActivateId == id and not is_multi_select) then + if bit32.band(flags, 192 --[[ImGuiTreeNodeFlags.OpenOnMask_]]) == 0 or (g.NavActivateId == id and not is_multi_select) then toggled = true -- Single click end - if bit32.band(flags, ImGuiTreeNodeFlags.OpenOnArrow) ~= 0 then + if bit32.band(flags, 128 --[[ImGuiTreeNodeFlags.OpenOnArrow]]) ~= 0 then toggled = toggled or (is_mouse_x_over_arrow and not g.NavHighlightItemUnderNav) -- Lightweight equivalent of IsMouseHoveringRect() since ButtonBehavior() already did the job end - if bit32.band(flags, ImGuiTreeNodeFlags.OpenOnDoubleClick) ~= 0 and g.IO.MouseClickedCount[0] == 2 then + if bit32.band(flags, 64 --[[ImGuiTreeNodeFlags.OpenOnDoubleClick]]) ~= 0 and g.IO.MouseClickedCount[0] == 2 then toggled = true -- Double click end elseif pressed and g.DragDropHoldJustPressedId == id then - IM_ASSERT(bit32.band(button_flags, ImGuiButtonFlags.PressedOnDragDropHold) ~= 0) + assert(bit32.band(button_flags, 512 --[[ImGuiButtonFlags.PressedOnDragDropHold]]) ~= 0) if not is_open then -- When using Drag and Drop "hold to open" we keep the node highlighted after opening, but never close it again. toggled = true else @@ -55338,21 +55381,21 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) end end - if g.NavId == id and g.NavMoveDir == ImGuiDir.Left and is_open then + if g.NavId == id and g.NavMoveDir == 0 --[[ImGuiDir.Left]] and is_open then toggled = true - ImGui.NavClearPreferredPosForAxis(ImGuiAxis.X) + ImGui.NavClearPreferredPosForAxis(1 --[[ImGuiAxis.X]]) ImGui.NavMoveRequestCancel() end - if g.NavId == id and g.NavMoveDir == ImGuiDir.Right and not is_open then -- If there's something upcoming on the line we may want to give it the priority? + if g.NavId == id and g.NavMoveDir == 1 --[[ImGuiDir.Right]] and not is_open then -- If there's something upcoming on the line we may want to give it the priority? toggled = true - ImGui.NavClearPreferredPosForAxis(ImGuiAxis.X) + ImGui.NavClearPreferredPosForAxis(1 --[[ImGuiAxis.X]]) ImGui.NavMoveRequestCancel() end if toggled then is_open = not is_open window.DC.StateStorage[storage_id] = is_open - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.ToggledOpen) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 16 --[[ImGuiItemStatusFlags.ToggledOpen]]) end end @@ -55366,32 +55409,32 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) end if selected ~= was_selected then - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.ToggledSelection) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 8 --[[ImGuiItemStatusFlags.ToggledSelection]]) end -- Render do - local text_col = ImGui.GetColorU32(ImGuiCol.Text) - local nav_render_cursor_flags = ImGuiNavRenderCursorFlags.Compact + local text_col = ImGui.GetColorU32(0 --[[ImGuiCol.Text]]) + local nav_render_cursor_flags = 2 --[[ImGuiNavRenderCursorFlags.Compact]] if is_multi_select then - nav_render_cursor_flags = bit32.bor(nav_render_cursor_flags, ImGuiNavRenderCursorFlags.AlwaysDraw) -- Always show the nav rectangle + nav_render_cursor_flags = bit32.bor(nav_render_cursor_flags, 4 --[[ImGuiNavRenderCursorFlags.AlwaysDraw]]) -- Always show the nav rectangle end if display_frame then -- Framed type - local bg_col = ImGui.GetColorU32((held and hovered) and ImGuiCol.HeaderActive or (hovered and ImGuiCol.HeaderHovered or ImGuiCol.Header)) + local bg_col = ImGui.GetColorU32((held and hovered) and 27 --[[ImGuiCol.HeaderActive]] or (hovered and 26 --[[ImGuiCol.HeaderHovered]] or 25 --[[ImGuiCol.Header]])) ImGui.RenderFrame(frame_bb.Min, frame_bb.Max, bg_col, true, style.FrameRounding) ImGui.RenderNavCursor(frame_bb, id, nav_render_cursor_flags) if span_all_columns and not span_all_columns_label then ImGui.TablePopBackgroundChannel() end - if bit32.band(flags, ImGuiTreeNodeFlags.Bullet) ~= 0 then + if bit32.band(flags, 512 --[[ImGuiTreeNodeFlags.Bullet]]) ~= 0 then ImGui.RenderBullet(window.DrawList, ImVec2(text_pos.x - text_offset_x * 0.60, text_pos.y + g.FontSize * 0.5), text_col) elseif not is_leaf then - ImGui.RenderArrow(window.DrawList, ImVec2(text_pos.x - text_offset_x + padding_x, text_pos.y), text_col, is_open and ((bit32.band(flags, ImGuiTreeNodeFlags.UpsideDownArrow) ~= 0) and ImGuiDir.Up or ImGuiDir.Down) or ImGuiDir.Right, 1.0) + ImGui.RenderArrow(window.DrawList, ImVec2(text_pos.x - text_offset_x + padding_x, text_pos.y), text_col, is_open and ((bit32.band(flags, 536870912 --[[ImGuiTreeNodeFlags.UpsideDownArrow]]) ~= 0) and 2 --[[ImGuiDir.Up]] or 3 --[[ImGuiDir.Down]]) or 1 --[[ImGuiDir.Right]], 1.0) else -- Leaf without bullet, left-adjusted text text_pos.x = text_pos.x - (text_offset_x - padding_x) end - if bit32.band(flags, ImGuiTreeNodeFlags.ClipLabelForTrailingButton) ~= 0 then + if bit32.band(flags, 268435456 --[[ImGuiTreeNodeFlags.ClipLabelForTrailingButton]]) ~= 0 then frame_bb.Max.x = frame_bb.Max.x - (g.FontSize + style.FramePadding.x) end -- if g.LogEnabled then @@ -55400,17 +55443,17 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) else -- Unframed typed for tree nodes if hovered or selected then - local bg_col = ImGui.GetColorU32((held and hovered) and ImGuiCol.HeaderActive or (hovered and ImGuiCol.HeaderHovered or ImGuiCol.Header)) + local bg_col = ImGui.GetColorU32((held and hovered) and 27 --[[ImGuiCol.HeaderActive]] or (hovered and 26 --[[ImGuiCol.HeaderHovered]] or 25 --[[ImGuiCol.Header]])) ImGui.RenderFrame(frame_bb.Min, frame_bb.Max, bg_col, false, 0.0) end ImGui.RenderNavCursor(frame_bb, id, nav_render_cursor_flags, 0.0) if span_all_columns and not span_all_columns_label then ImGui.TablePopBackgroundChannel() end - if bit32.band(flags, ImGuiTreeNodeFlags.Bullet) ~= 0 then + if bit32.band(flags, 512 --[[ImGuiTreeNodeFlags.Bullet]]) ~= 0 then ImGui.RenderBullet(window.DrawList, ImVec2(text_pos.x - text_offset_x * 0.5, text_pos.y + g.FontSize * 0.5), text_col) elseif not is_leaf then - ImGui.RenderArrow(window.DrawList, ImVec2(text_pos.x - text_offset_x + padding_x, text_pos.y + g.FontSize * 0.15), text_col, is_open and ((bit32.band(flags, ImGuiTreeNodeFlags.UpsideDownArrow) ~= 0) and ImGuiDir.Up or ImGuiDir.Down) or ImGuiDir.Right, 0.70) + ImGui.RenderArrow(window.DrawList, ImVec2(text_pos.x - text_offset_x + padding_x, text_pos.y + g.FontSize * 0.15), text_col, is_open and ((bit32.band(flags, 536870912 --[[ImGuiTreeNodeFlags.UpsideDownArrow]]) ~= 0) and 2 --[[ImGuiDir.Up]] or 3 --[[ImGuiDir.Down]]) or 1 --[[ImGuiDir.Right]], 0.70) end -- if g.LogEnabled then -- ImGui.LogSetNextTextDecoration(">", nil) @@ -55436,7 +55479,7 @@ function ImGui.TreeNodeBehavior(id, flags, label, label_end) if is_open and store_tree_node_stack_data then TreeNodeStoreStackData(flags, text_pos.x - text_offset_x) -- Call before TreePushOverrideID() end - if is_open and bit32.band(flags, ImGuiTreeNodeFlags.NoTreePushOnOpen) == 0 then + if is_open and bit32.band(flags, 8 --[[ImGuiTreeNodeFlags.NoTreePushOnOpen]]) == 0 then ImGui.TreePushOverrideID(id) -- Could use TreePush(label) but this avoid computing twice end @@ -55470,9 +55513,9 @@ function ImGui.TreeNodeDrawLineToChildNode(target_pos) if x1 < x2 then window.DrawList:PathLineTo(ImVec2(x2, y)) end - window.DrawList:PathStroke(ImGui.GetColorU32(ImGuiCol.TreeLines), g.Style.TreeLinesSize) + window.DrawList:PathStroke(ImGui.GetColorU32(55 --[[ImGuiCol.TreeLines]]), g.Style.TreeLinesSize) else - window.DrawList:AddLineH(x1, x2, y, ImGui.GetColorU32(ImGuiCol.TreeLines), g.Style.TreeLinesSize) + window.DrawList:AddLineH(x1, x2, y, ImGui.GetColorU32(55 --[[ImGuiCol.TreeLines]]), g.Style.TreeLinesSize) end end @@ -55483,7 +55526,7 @@ function ImGui.TreeNodeDrawLineToTreePop(data) local window = g.CurrentWindow local y1 = ImMax(data.NavRect.Max.y, window.ClipRect.Min.y) local y2 = data.DrawLinesToNodesY2 - if bit32.band(data.TreeFlags, ImGuiTreeNodeFlags.DrawLinesFull) ~= 0 then + if bit32.band(data.TreeFlags, 524288 --[[ImGuiTreeNodeFlags.DrawLinesFull]]) ~= 0 then local y2_full = window.DC.CursorPos.y if g.CurrentTable then y2_full = ImMax(g.CurrentTable.RowPosY2, y2_full) @@ -55503,7 +55546,7 @@ function ImGui.TreeNodeDrawLineToTreePop(data) end -- We use AddLine() instead of AddLineV() as we provide coordinates for line center (FIXME-OPT) - window.DrawList:AddLine(ImVec2(x, y1), ImVec2(x, y2), ImGui.GetColorU32(ImGuiCol.TreeLines), g.Style.TreeLinesSize) + window.DrawList:AddLine(ImVec2(x, y1), ImVec2(x, y2), ImGui.GetColorU32(55 --[[ImGuiCol.TreeLines]]), g.Style.TreeLinesSize) if data.DrawLinesTableColumn ~= -1 then ImGui.TablePopColumnChannel() end @@ -55536,17 +55579,17 @@ function ImGui.TreePop() if bit32.band(window.DC.TreeHasStackDataDepthMask, tree_depth_mask) ~= 0 then local data = g.TreeNodeStack.Data[g.TreeNodeStack.Size] - IM_ASSERT(data.ID == window.IDStack:back()) + assert(data.ID == window.IDStack:back()) -- Handle Left arrow to move to parent tree node (when ImGuiTreeNodeFlags.NavLeftJumpsToParent is enabled) - if bit32.band(data.TreeFlags, ImGuiTreeNodeFlags.NavLeftJumpsToParent) ~= 0 then - if g.NavIdIsAlive and g.NavMoveDir == ImGuiDir.Left and g.NavWindow == window and ImGui.NavMoveRequestButNoResultYet() then + if bit32.band(data.TreeFlags, 131072 --[[ImGuiTreeNodeFlags.NavLeftJumpsToParent]]) ~= 0 then + if g.NavIdIsAlive and g.NavMoveDir == 0 --[[ImGuiDir.Left]] and g.NavWindow == window and ImGui.NavMoveRequestButNoResultYet() then ImGui.NavMoveRequestResolveWithPastTreeNode(g.NavMoveResultLocal, data) end end -- Draw hierarchy lines - if data.DrawLinesX1 ~= FLT_MAX and window.DC.CursorPos.y >= window.ClipRect.Min.y then + if data.DrawLinesX1 ~= 3.4028234663853e+38 --[[FLT_MAX]] and window.DC.CursorPos.y >= window.ClipRect.Min.y then ImGui.TreeNodeDrawLineToTreePop(data) end @@ -55555,7 +55598,7 @@ function ImGui.TreePop() window.DC.TreeRecordsClippedNodesY2Mask = bit32.band(window.DC.TreeRecordsClippedNodesY2Mask, bit32.bnot(tree_depth_mask)) end - IM_ASSERT(window.IDStack.Size > 1) -- There should always be 1 element in the IDStack (pushed during window creation). If this triggers you called TreePop/PopID too much. + assert(window.IDStack.Size > 1) -- There should always be 1 element in the IDStack (pushed during window creation). If this triggers you called TreePop/PopID too much. ImGui.PopID() end @@ -55569,9 +55612,9 @@ function ImGui.SetNextItemOpen(is_open, cond) if g.CurrentWindow.SkipItems then return end - g.NextItemData.HasFlags = bit32.bor(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasOpen) + g.NextItemData.HasFlags = bit32.bor(g.NextItemData.HasFlags, 2 --[[ImGuiNextItemDataFlags.HasOpen]]) g.NextItemData.OpenVal = is_open - g.NextItemData.OpenCond = (cond ~= 0) and cond or ImGuiCond.Always + g.NextItemData.OpenCond = (cond ~= 0) and cond or 1 --[[ImGuiCond.Always]] end -- Horizontal distance preceding label when using TreeNode() or Bullet() @@ -55587,7 +55630,7 @@ function ImGui.SetNextItemStorageID(storage_id) if g.CurrentWindow.SkipItems then return end - g.NextItemData.HasFlags = bit32.bor(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasStorageID) + g.NextItemData.HasFlags = bit32.bor(g.NextItemData.HasFlags, 16 --[[ImGuiNextItemDataFlags.HasStorageID]]) g.NextItemData.StorageId = storage_id end @@ -55616,9 +55659,9 @@ function ImGui.CollapsingHeader(label, a, b) end local id = window:GetID(label) - flags = bit32.bor(flags, ImGuiTreeNodeFlags.CollapsingHeader) + flags = bit32.bor(flags, 26 --[[ImGuiTreeNodeFlags.CollapsingHeader]]) if p_visible ~= nil then - flags = bit32.bor(flags, ImGuiTreeNodeFlags.AllowOverlap, ImGuiTreeNodeFlags.ClipLabelForTrailingButton) + flags = bit32.bor(flags, 4 --[[ImGuiTreeNodeFlags.AllowOverlap]], 268435456 --[[ImGuiTreeNodeFlags.ClipLabelForTrailingButton]]) end local is_open = ImGui.TreeNodeBehavior(id, flags, label) if p_visible ~= nil then @@ -55685,17 +55728,17 @@ function ImGui.Selectable(label, selected, flags, size_arg) -- Fill horizontal space -- We don't support (size < 0.0) in Selectable() because the ItemSpacing extension would make explicitly right-aligned sizes not visibly match other widgets. - local span_all_columns = bit32.band(flags, ImGuiSelectableFlags.SpanAllColumns) ~= 0 + local span_all_columns = bit32.band(flags, 2 --[[ImGuiSelectableFlags.SpanAllColumns]]) ~= 0 local min_x = span_all_columns and window.ParentWorkRect.Min.x or pos.x local max_x = span_all_columns and window.ParentWorkRect.Max.x or window.WorkRect.Max.x - if size_arg.x == 0.0 or bit32.band(flags, ImGuiSelectableFlags.SpanAvailWidth) ~= 0 then + if size_arg.x == 0.0 or bit32.band(flags, 16777216 --[[ImGuiSelectableFlags.SpanAvailWidth]]) ~= 0 then size.x = ImMax(label_size.x, max_x - min_x) end -- Selectables are meant to be tightly packed together with no click-gap, so we extend their box to cover spacing between selectable. -- FIXME: Not part of layout so not included in clipper calculation, but ItemSize currently doesn't allow offsetting CursorPos. local bb = ImRect(min_x, pos.y, min_x + size.x, pos.y + size.y) - if bit32.band(flags, ImGuiSelectableFlags.NoPadWithHalfSpacing) == 0 then + if bit32.band(flags, 67108864 --[[ImGuiSelectableFlags.NoPadWithHalfSpacing]]) == 0 then local spacing_x = span_all_columns and 0.0 or style.ItemSpacing.x local spacing_y = style.ItemSpacing.y local spacing_L = IM_TRUNC(spacing_x * 0.50) @@ -55708,8 +55751,8 @@ function ImGui.Selectable(label, selected, flags, size_arg) end -- if g.IO.KeyCtrl then ImGui.GetForegroundDrawList():AddRect(bb.Min, bb.Max, IM_COL32(0, 255, 0, 255)) end - local disabled_item = bit32.band(flags, ImGuiSelectableFlags.Disabled) ~= 0 - local extra_item_flags = disabled_item and ImGuiItemFlags.Disabled or ImGuiItemFlags.None + local disabled_item = bit32.band(flags, 8 --[[ImGuiSelectableFlags.Disabled]]) ~= 0 + local extra_item_flags = disabled_item and 64 --[[ImGuiItemFlags.Disabled]] or 0 --[[ImGuiItemFlags.None]] local is_visible if span_all_columns then @@ -55728,7 +55771,7 @@ function ImGui.Selectable(label, selected, flags, size_arg) is_visible = ImGui.ItemAdd(bb, id, nil, extra_item_flags) end - local is_multi_select = bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.IsMultiSelect) ~= 0 + local is_multi_select = bit32.band(g.LastItemData.ItemFlags, 4194304 --[[ImGuiItemFlags.IsMultiSelect]]) ~= 0 if not is_visible then if not is_multi_select or not g.BoxSelectState.UnclipMode or not g.BoxSelectState.UnclipRect:Overlaps(bb) then -- Extra layer of "no logic clip" for box-select support (would be more overhead to add to ItemAdd) @@ -55736,7 +55779,7 @@ function ImGui.Selectable(label, selected, flags, size_arg) end end - local disabled_global = bit32.band(g.CurrentItemFlags, ImGuiItemFlags.Disabled) ~= 0 + local disabled_global = bit32.band(g.CurrentItemFlags, 64 --[[ImGuiItemFlags.Disabled]]) ~= 0 if disabled_item and not disabled_global then -- Only testing this as an optimization ImGui.BeginDisabled() @@ -55751,18 +55794,18 @@ function ImGui.Selectable(label, selected, flags, size_arg) ImGui.PushColumnsBackground() end - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HasClipRect) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 512 --[[ImGuiItemStatusFlags.HasClipRect]]) ImRect_Copy(g.LastItemData.ClipRect, window.ClipRect) end -- We use NoHoldingActiveID on menus so user can click and _hold_ on a menu then drag to browse child entries local button_flags = 0 - if bit32.band(flags, ImGuiSelectableFlags.NoHoldingActiveID) ~= 0 then button_flags = bit32.bor(button_flags, ImGuiButtonFlags.NoHoldingActiveId) end - if bit32.band(flags, ImGuiSelectableFlags.NoSetKeyOwner) ~= 0 then button_flags = bit32.bor(button_flags, ImGuiButtonFlags.NoSetKeyOwner) end - if bit32.band(flags, ImGuiSelectableFlags.SelectOnClick) ~= 0 then button_flags = bit32.bor(button_flags, ImGuiButtonFlags.PressedOnClick) end - if bit32.band(flags, ImGuiSelectableFlags.SelectOnRelease) ~= 0 then button_flags = bit32.bor(button_flags, ImGuiButtonFlags.PressedOnRelease) end - if bit32.band(flags, ImGuiSelectableFlags.AllowDoubleClick) ~= 0 then button_flags = bit32.bor(button_flags, ImGuiButtonFlags.PressedOnClickRelease, ImGuiButtonFlags.PressedOnDoubleClick) end - if bit32.band(flags, ImGuiSelectableFlags.AllowOverlap) ~= 0 or bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.AllowOverlap) ~= 0 then button_flags = bit32.bor(button_flags, ImGuiButtonFlags.AllowOverlap) end + if bit32.band(flags, 1048576 --[[ImGuiSelectableFlags.NoHoldingActiveID]]) ~= 0 then button_flags = bit32.bor(button_flags, 131072 --[[ImGuiButtonFlags.NoHoldingActiveId]]) end + if bit32.band(flags, 134217728 --[[ImGuiSelectableFlags.NoSetKeyOwner]]) ~= 0 then button_flags = bit32.bor(button_flags, 1048576 --[[ImGuiButtonFlags.NoSetKeyOwner]]) end + if bit32.band(flags, 4194304 --[[ImGuiSelectableFlags.SelectOnClick]]) ~= 0 then button_flags = bit32.bor(button_flags, 16 --[[ImGuiButtonFlags.PressedOnClick]]) end + if bit32.band(flags, 8388608 --[[ImGuiSelectableFlags.SelectOnRelease]]) ~= 0 then button_flags = bit32.bor(button_flags, 128 --[[ImGuiButtonFlags.PressedOnRelease]]) end + if bit32.band(flags, 4 --[[ImGuiSelectableFlags.AllowDoubleClick]]) ~= 0 then button_flags = bit32.bor(button_flags, 32 --[[ImGuiButtonFlags.PressedOnClickRelease]], 256 --[[ImGuiButtonFlags.PressedOnDoubleClick]]) end + if bit32.band(flags, 16 --[[ImGuiSelectableFlags.AllowOverlap]]) ~= 0 or bit32.band(g.LastItemData.ItemFlags, 16384 --[[ImGuiItemFlags.AllowOverlap]]) ~= 0 then button_flags = bit32.bor(button_flags, 4096 --[[ImGuiButtonFlags.AllowOverlap]]) end -- Multi-selection support (header) local was_selected = selected @@ -55785,8 +55828,8 @@ function ImGui.Selectable(label, selected, flags, size_arg) -- - (1) it would require focus scope to be set, need exposing PushFocusScope() or equivalent (e.g. BeginSelection() calling PushFocusScope()) -- - (2) usage will fail with clipped items -- The multi-select API aim to fix those issues, e.g. may be replaced with a BeginSelection() API. - if bit32.band(flags, ImGuiSelectableFlags.SelectOnNav) ~= 0 and g.NavJustMovedToId ~= 0 and g.NavJustMovedToFocusScopeId == g.CurrentFocusScopeId then - if g.NavJustMovedToId == id and bit32.band(g.NavJustMovedToKeyMods, ImGuiMod_Ctrl) == 0 then + if bit32.band(flags, 64 --[[ImGuiSelectableFlags.SelectOnNav]]) ~= 0 and g.NavJustMovedToId ~= 0 and g.NavJustMovedToFocusScopeId == g.CurrentFocusScopeId then + if g.NavJustMovedToId == id and bit32.band(g.NavJustMovedToKeyMods, 4096 --[[ImGuiMod_Ctrl]]) == 0 then selected = true pressed = true auto_selected = true @@ -55795,7 +55838,7 @@ function ImGui.Selectable(label, selected, flags, size_arg) end -- Update NavId when clicking or when Hovering (this doesn't happen on most widgets), so navigation can be resumed with keyboard/gamepad - if pressed or (hovered and bit32.band(flags, ImGuiSelectableFlags.SetNavIdOnHover) ~= 0) then + if pressed or (hovered and bit32.band(flags, 33554432 --[[ImGuiSelectableFlags.SetNavIdOnHover]]) ~= 0) then if not g.NavHighlightItemUnderNav and g.NavWindow == window and g.NavLayer == window.DC.NavLayerCurrent then ImGui.SetNavID(id, window.DC.NavLayerCurrent, g.CurrentFocusScopeId, ImGui.WindowRectAbsToRel(window, bb)) -- (bb == NavRect) if g.IO.ConfigNavCursorVisibleAuto then @@ -55808,7 +55851,7 @@ function ImGui.Selectable(label, selected, flags, size_arg) end if selected ~= was_selected then - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.ToggledSelection) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 8 --[[ImGuiItemStatusFlags.ToggledSelection]]) end if g.ActiveId == id and g.ActiveIdIsJustActivated then g.ActiveIdWasSelected = was_selected @@ -55817,25 +55860,25 @@ function ImGui.Selectable(label, selected, flags, size_arg) -- Render if is_visible then - local highlighted = hovered or (bit32.band(flags, ImGuiSelectableFlags.Highlight) ~= 0) + local highlighted = hovered or (bit32.band(flags, 32 --[[ImGuiSelectableFlags.Highlight]]) ~= 0) if highlighted or selected then -- Between 1.91.0 and 1.91.4 we made selected Selectable use an arbitrary lerp between _Header and _HeaderHovered. Removed that now. (#8106) local col if held and highlighted then - col = ImGui.GetColorU32(ImGuiCol.HeaderActive) + col = ImGui.GetColorU32(27 --[[ImGuiCol.HeaderActive]]) elseif highlighted then - col = ImGui.GetColorU32(ImGuiCol.HeaderHovered) + col = ImGui.GetColorU32(26 --[[ImGuiCol.HeaderHovered]]) else - col = ImGui.GetColorU32(ImGuiCol.Header) + col = ImGui.GetColorU32(25 --[[ImGuiCol.Header]]) end ImGui.RenderFrame(bb.Min, bb.Max, col, false, style.SelectableRounding) end if g.NavId == id then - local nav_render_cursor_flags = ImGuiNavRenderCursorFlags.Compact + local nav_render_cursor_flags = 2 --[[ImGuiNavRenderCursorFlags.Compact]] if is_multi_select then - nav_render_cursor_flags = bit32.bor(nav_render_cursor_flags, ImGuiNavRenderCursorFlags.AlwaysDraw) -- Always show the nav rectangle + nav_render_cursor_flags = bit32.bor(nav_render_cursor_flags, 4 --[[ImGuiNavRenderCursorFlags.AlwaysDraw]]) -- Always show the nav rectangle end ImGui.RenderNavCursor(bb, id, nav_render_cursor_flags, style.SelectableRounding) end @@ -55855,7 +55898,7 @@ function ImGui.Selectable(label, selected, flags, size_arg) end -- Automatically close popups - if pressed and not auto_selected and bit32.band(window.Flags, ImGuiWindowFlags.Popup) ~= 0 and bit32.band(flags, ImGuiSelectableFlags.NoAutoClosePopups) == 0 and bit32.band(g.LastItemData.ItemFlags, ImGuiItemFlags.AutoClosePopups) ~= 0 then + if pressed and not auto_selected and bit32.band(window.Flags, 67108864 --[[ImGuiWindowFlags.Popup]]) ~= 0 and bit32.band(flags, 1 --[[ImGuiSelectableFlags.NoAutoClosePopups]]) == 0 and bit32.band(g.LastItemData.ItemFlags, 16 --[[ImGuiItemFlags.AutoClosePopups]]) ~= 0 then ImGui.CloseCurrentPopup() end @@ -55921,14 +55964,14 @@ function ImGui.BeginListBox(label, size_arg) ImGui.AlignTextToFramePadding() end - ImGui.BeginChild(id, frame_bb:GetSize(), ImGuiChildFlags.FrameStyle) + ImGui.BeginChild(id, frame_bb:GetSize(), 128 --[[ImGuiChildFlags.FrameStyle]]) return true end function ImGui.EndListBox() local g = GImGui local window = g.CurrentWindow - IM_ASSERT(bit32.band(window.Flags, ImGuiWindowFlags.ChildWindow) ~= 0, "Mismatched BeginListBox/EndListBox calls. Did you test the return value of BeginListBox?") + assert(bit32.band(window.Flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) ~= 0, "Mismatched BeginListBox/EndListBox calls. Did you test the return value of BeginListBox?") ImGui.EndChild() ImGui.EndGroup() -- This is only required to be able to do IsItemXXX query on the whole ListBox including label @@ -56030,50 +56073,50 @@ function ImGui.PlotEx(plot_type, label, values_getter, data, values_count, value local inner_bb = ImRect(frame_bb.Min + style.FramePadding, frame_bb.Max - style.FramePadding) local total_bb = ImRect(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0 and style.ItemInnerSpacing.x + label_size.x or 0.0, 0)) ImGui.ItemSize(total_bb, style.FramePadding.y) - if not ImGui.ItemAdd(total_bb, id, frame_bb, ImGuiItemFlags.NoNav) then + if not ImGui.ItemAdd(total_bb, id, frame_bb, 2 --[[ImGuiItemFlags.NoNav]]) then return -1 end local _, hovered, _ = ImGui.ButtonBehavior(frame_bb, id) -- Determine scale from values if not specified - if scale_min == FLT_MAX or scale_max == FLT_MAX then - local v_min = FLT_MAX - local v_max = -FLT_MAX + if scale_min == 3.4028234663853e+38 --[[FLT_MAX]] or scale_max == 3.4028234663853e+38 --[[FLT_MAX]] then + local v_min = 3.4028234663853e+38 --[[FLT_MAX]] + local v_max = -3.4028234663853e+38 --[[FLT_MAX]] for i = 1, values_count do local v = values_getter(data, i) -- NaN isn't checked here v_min = ImMin(v_min, v) v_max = ImMax(v_max, v) end - if scale_min == FLT_MAX then + if scale_min == 3.4028234663853e+38 --[[FLT_MAX]] then scale_min = v_min end - if scale_max == FLT_MAX then + if scale_max == 3.4028234663853e+38 --[[FLT_MAX]] then scale_max = v_max end end - ImGui.RenderFrame(frame_bb.Min, frame_bb.Max, ImGui.GetColorU32(ImGuiCol.FrameBg), true, style.FrameRounding) + ImGui.RenderFrame(frame_bb.Min, frame_bb.Max, ImGui.GetColorU32(7 --[[ImGuiCol.FrameBg]]), true, style.FrameRounding) - local values_count_min = (plot_type == ImGuiPlotType.Lines) and 2 or 1 + local values_count_min = (plot_type == 0 --[[ImGuiPlotType.Lines]]) and 2 or 1 local idx_hovered = -1 if values_count >= values_count_min then - local res_w = ImMin(math.floor(frame_size.x), values_count) + ((plot_type == ImGuiPlotType.Lines) and -1 or 0) - local item_count = values_count + ((plot_type == ImGuiPlotType.Lines) and -1 or 0) + local res_w = ImMin(math.floor(frame_size.x), values_count) + ((plot_type == 0 --[[ImGuiPlotType.Lines]]) and -1 or 0) + local item_count = values_count + ((plot_type == 0 --[[ImGuiPlotType.Lines]]) and -1 or 0) -- Tooltip on hover if hovered and inner_bb:Contains(g.IO.MousePos) then local t = ImClamp((g.IO.MousePos.x - inner_bb.Min.x) / (inner_bb.Max.x - inner_bb.Min.x), 0.0, 0.999) local v_idx = math.floor(t * item_count) + 1 - IM_ASSERT(v_idx >= 1 and v_idx <= values_count) + assert(v_idx >= 1 and v_idx <= values_count) local v0 = values_getter(data, (v_idx - 1 + values_offset) % values_count + 1) local v1 = values_getter(data, (v_idx - 1 + 1 + values_offset) % values_count + 1) - if plot_type == ImGuiPlotType.Lines then + if plot_type == 0 --[[ImGuiPlotType.Lines]] then ImGui.SetTooltip("%d: %8.4g\n%d: %8.4g", v_idx, v0, v_idx + 1, v1) - elseif plot_type == ImGuiPlotType.Histogram then + elseif plot_type == 1 --[[ImGuiPlotType.Histogram]] then ImGui.SetTooltip("%d: %8.4g", v_idx, v0) end idx_hovered = v_idx @@ -56087,28 +56130,28 @@ function ImGui.PlotEx(plot_type, label, values_getter, data, values_count, value local tp0 = ImVec2(t0, 1.0 - ImSaturate((v0 - scale_min) * inv_scale)) -- Point in the normalized space of our target rectangle local histogram_zero_line_t = (scale_min * scale_max < 0.0) and (1 + scale_min * inv_scale) or (scale_min < 0.0 and 0.0 or 1.0) -- Where does the zero line stands - local col_base = ImGui.GetColorU32((plot_type == ImGuiPlotType.Lines) and ImGuiCol.PlotLines or ImGuiCol.PlotHistogram) - local col_hovered = ImGui.GetColorU32((plot_type == ImGuiPlotType.Lines) and ImGuiCol.PlotLinesHovered or ImGuiCol.PlotHistogramHovered) + local col_base = ImGui.GetColorU32((plot_type == 0 --[[ImGuiPlotType.Lines]]) and 44 --[[ImGuiCol.PlotLines]] or 46 --[[ImGuiCol.PlotHistogram]]) + local col_hovered = ImGui.GetColorU32((plot_type == 0 --[[ImGuiPlotType.Lines]]) and 45 --[[ImGuiCol.PlotLinesHovered]] or 47 --[[ImGuiCol.PlotHistogramHovered]]) for _ = 0, res_w - 1 do local t1 = t0 + t_step local v1_idx = math.floor(t0 * item_count + 0.5) + 1 - IM_ASSERT(v1_idx >= 1 and v1_idx <= values_count) + assert(v1_idx >= 1 and v1_idx <= values_count) local v1 = values_getter(data, (v1_idx - 1 + values_offset + 1) % values_count + 1) local tp1 = ImVec2(t1, 1.0 - ImSaturate((v1 - scale_min) * inv_scale)) -- NB: Draw calls are merged together by the DrawList system. Still, we should render our batch are lower level to save a bit of CPU. local pos0 = ImLerp(inner_bb.Min, inner_bb.Max, tp0) local pos1 - if plot_type == ImGuiPlotType.Lines then + if plot_type == 0 --[[ImGuiPlotType.Lines]] then pos1 = ImLerp(inner_bb.Min, inner_bb.Max, tp1) else pos1 = ImLerp(inner_bb.Min, inner_bb.Max, ImVec2(tp1.x, histogram_zero_line_t)) end - if plot_type == ImGuiPlotType.Lines then + if plot_type == 0 --[[ImGuiPlotType.Lines]] then window.DrawList:AddLine(pos0, pos1, idx_hovered == v1_idx and col_hovered or col_base) - elseif plot_type == ImGuiPlotType.Histogram then + elseif plot_type == 1 --[[ImGuiPlotType.Histogram]] then if pos1.x >= pos0.x + 2.0 then pos1.x = pos1.x - 1.0 end @@ -56169,16 +56212,16 @@ end --- @param stride? int # Defaults to 1 function ImGui.PlotLines(label, values_or_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size, stride) if values_offset == nil then values_offset = 0 end - if scale_min == nil then scale_min = FLT_MAX end - if scale_max == nil then scale_max = FLT_MAX end + if scale_min == nil then scale_min = 3.4028234663853e+38 --[[FLT_MAX]] end + if scale_max == nil then scale_max = 3.4028234663853e+38 --[[FLT_MAX]] end if graph_size == nil then graph_size = ImVec2(0, 0) end if stride == nil then stride = 1 end if type(values_or_getter) == "function" then - ImGui.PlotEx(ImGuiPlotType.Lines, label, values_or_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size) + ImGui.PlotEx(0 --[[ImGuiPlotType.Lines]], label, values_or_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size) else data = ImGuiPlotArrayGetterData(values_or_getter, stride) - ImGui.PlotEx(ImGuiPlotType.Lines, label, Plot_ArrayGetter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size) + ImGui.PlotEx(0 --[[ImGuiPlotType.Lines]], label, Plot_ArrayGetter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size) end end @@ -56195,16 +56238,16 @@ end --- @param stride? int # Defaults to 1 function ImGui.PlotHistogram(label, values_or_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size, stride) if values_offset == nil then values_offset = 0 end - if scale_min == nil then scale_min = FLT_MAX end - if scale_max == nil then scale_max = FLT_MAX end + if scale_min == nil then scale_min = 3.4028234663853e+38 --[[FLT_MAX]] end + if scale_max == nil then scale_max = 3.4028234663853e+38 --[[FLT_MAX]] end if graph_size == nil then graph_size = ImVec2(0, 0) end if stride == nil then stride = 1 end if type(values_or_getter) == "function" then - ImGui.PlotEx(ImGuiPlotType.Histogram, label, values_or_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size) + ImGui.PlotEx(1 --[[ImGuiPlotType.Histogram]], label, values_or_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size) else data = ImGuiPlotArrayGetterData(values_or_getter, stride) - ImGui.PlotEx(ImGuiPlotType.Histogram, label, Plot_ArrayGetter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size) + ImGui.PlotEx(1 --[[ImGuiPlotType.Histogram]], label, Plot_ArrayGetter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size) end end @@ -56278,11 +56321,11 @@ function ImGui.BeginMenuBar() if window.SkipItems then return false end - if bit32.band(window.Flags, ImGuiWindowFlags.MenuBar) == 0 then + if bit32.band(window.Flags, 1024 --[[ImGuiWindowFlags.MenuBar]]) == 0 then return false end - IM_ASSERT(not window.DC.MenuBarAppending) + assert(not window.DC.MenuBarAppending) ImGui.BeginGroup() -- Backup position on layer 0 // FIXME: Misleading to use a group for that backup/restore ImGui.PushID("##MenuBar") @@ -56298,9 +56341,9 @@ function ImGui.BeginMenuBar() -- We overwrite CursorMaxPos because BeginGroup sets it to CursorPos (essentially the .EmitItem hack in EndMenuBar() would need something analogous here, maybe a BeginGroupEx() with flags). ImVec2_Copy(window.DC.CursorPos, ImVec2(bar_rect.Min.x + window.DC.MenuBarOffset.x, bar_rect.Min.y + window.DC.MenuBarOffset.y)) ImVec2_Copy(window.DC.CursorMaxPos, window.DC.CursorPos) - window.DC.LayoutType = ImGuiLayoutType.Horizontal + window.DC.LayoutType = 0 --[[ImGuiLayoutType.Horizontal]] window.DC.IsSameLine = false - window.DC.NavLayerCurrent = ImGuiNavLayer.Menu + window.DC.NavLayerCurrent = 1 --[[ImGuiNavLayer.Menu]] window.DC.MenuBarAppending = true ImGui.AlignTextToFramePadding() @@ -56314,21 +56357,21 @@ function ImGui.EndMenuBar() end local g = GImGui - IM_ASSERT(bit32.band(window.Flags, ImGuiWindowFlags.MenuBar) ~= 0) - IM_ASSERT(window.DC.MenuBarAppending) + assert(bit32.band(window.Flags, 1024 --[[ImGuiWindowFlags.MenuBar]]) ~= 0) + assert(window.DC.MenuBarAppending) -- Nav: When a move request within one of our child menu failed, capture the request to navigate among our siblings. - if ImGui.NavMoveRequestButNoResultYet() and (g.NavMoveDir == ImGuiDir.Left or g.NavMoveDir == ImGuiDir.Right) and bit32.band(g.NavWindow.Flags, ImGuiWindowFlags.ChildMenu) ~= 0 then + if ImGui.NavMoveRequestButNoResultYet() and (g.NavMoveDir == 0 --[[ImGuiDir.Left]] or g.NavMoveDir == 1 --[[ImGuiDir.Right]]) and bit32.band(g.NavWindow.Flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0 then -- Try to find out if the request is for one of our child menu local nav_earliest_child = g.NavWindow - while nav_earliest_child.ParentWindow and bit32.band(nav_earliest_child.ParentWindow.Flags, ImGuiWindowFlags.ChildMenu) ~= 0 do + while nav_earliest_child.ParentWindow and bit32.band(nav_earliest_child.ParentWindow.Flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0 do nav_earliest_child = nav_earliest_child.ParentWindow end - if nav_earliest_child.ParentWindow == window and nav_earliest_child.DC.ParentLayoutType == ImGuiLayoutType.Horizontal and bit32.band(g.NavMoveFlags, ImGuiNavMoveFlags.Forwarded) == 0 then + if nav_earliest_child.ParentWindow == window and nav_earliest_child.DC.ParentLayoutType == 0 --[[ImGuiLayoutType.Horizontal]] and bit32.band(g.NavMoveFlags, 128 --[[ImGuiNavMoveFlags.Forwarded]]) == 0 then -- To do so we claim focus back, restore NavId and then process the movement request for yet another frame. -- This involve a one-frame delay which isn't very problematic in this situation. We could remove it by scoring in advance for multiple window (probably not worth bothering) - local layer = ImGuiNavLayer.Menu - IM_ASSERT(bit32.band(window.DC.NavLayersActiveMaskNext, bit32.lshift(1, layer)) ~= 0) -- Sanity check (FIXME: Seems unnecessary) + local layer = 1 --[[ImGuiNavLayer.Menu]] + assert(bit32.band(window.DC.NavLayersActiveMaskNext, bit32.lshift(1, layer)) ~= 0) -- Sanity check (FIXME: Seems unnecessary) ImGui.FocusWindow(window) ImGui.SetNavID(window.NavLastIds[layer], layer, 0, window.NavRectRel[layer]) -- FIXME-NAV: How to deal with this when not using g.IO.ConfigNavCursorVisibleAuto? @@ -56341,7 +56384,7 @@ function ImGui.EndMenuBar() ImGui.NavMoveRequestForward(g.NavMoveDir, g.NavMoveClipDir, g.NavMoveFlags, g.NavMoveScrollFlags) -- Repeat end else - ImGui.NavMoveRequestTryWrapping(window, ImGuiNavMoveFlags.WrapX) + ImGui.NavMoveRequestTryWrapping(window, 4 --[[ImGuiNavMoveFlags.WrapX]]) end ImGui.PopClipRect() @@ -56355,9 +56398,9 @@ function ImGui.EndMenuBar() ImVec2_Copy(restore_cursor_max_pos, group_data.BackupCursorMaxPos) window.DC.IdealMaxPos.x = ImMax(window.DC.IdealMaxPos.x, window.DC.CursorMaxPos.x - window.Scroll.x) -- Convert ideal extents for scrolling layer equivalent. ImGui.EndGroup() -- Restore position on layer 0 // FIXME: Misleading to use a group for that backup/restore - window.DC.LayoutType = ImGuiLayoutType.Vertical + window.DC.LayoutType = 1 --[[ImGuiLayoutType.Vertical]] window.DC.IsSameLine = false - window.DC.NavLayerCurrent = ImGuiNavLayer.Main + window.DC.NavLayerCurrent = 0 --[[ImGuiNavLayer.Main]] window.DC.MenuBarAppending = false ImVec2_Copy(window.DC.CursorMaxPos, restore_cursor_max_pos) end @@ -56371,16 +56414,16 @@ end --- @param axis_size float --- @param window_flags ImGuiWindowFlags function ImGui.BeginViewportSideBar(name, viewport_p, dir, axis_size, window_flags) - IM_ASSERT(dir ~= ImGuiDir.None) + assert(dir ~= (-1) --[[ImGuiDir.None]]) local bar_window = ImGui.FindWindowByName(name) local viewport = viewport_p or ImGui.GetMainViewport() if bar_window == nil or bar_window.BeginCount == 0 then -- Calculate and set window size/position local avail_rect = viewport:GetBuildWorkRect() - local axis = (dir == ImGuiDir.Up or dir == ImGuiDir.Down) and ImGuiAxis.Y or ImGuiAxis.X + local axis = (dir == 2 --[[ImGuiDir.Up]] or dir == 3 --[[ImGuiDir.Down]]) and 2 --[[ImGuiAxis.Y]] or 1 --[[ImGuiAxis.X]] local pos = ImVec2(avail_rect.Min.x, avail_rect.Min.y) - if dir == ImGuiDir.Right or dir == ImGuiDir.Down then + if dir == 1 --[[ImGuiDir.Right]] or dir == 3 --[[ImGuiDir.Down]] then pos[axis] = avail_rect.Max[axis] - axis_size end local size = avail_rect:GetSize() @@ -56389,17 +56432,17 @@ function ImGui.BeginViewportSideBar(name, viewport_p, dir, axis_size, window_fla ImGui.SetNextWindowSize(size) -- Report our size into work area (for next frame) using actual window size - if dir == ImGuiDir.Up or dir == ImGuiDir.Left then + if dir == 2 --[[ImGuiDir.Up]] or dir == 0 --[[ImGuiDir.Left]] then viewport.BuildWorkInsetMin[axis] = viewport.BuildWorkInsetMin[axis] + axis_size - elseif dir == ImGuiDir.Down or dir == ImGuiDir.Right then + elseif dir == 3 --[[ImGuiDir.Down]] or dir == 1 --[[ImGuiDir.Right]] then viewport.BuildWorkInsetMax[axis] = viewport.BuildWorkInsetMax[axis] + axis_size end end - window_flags = bit32.bor(window_flags or 0, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoResize, ImGuiWindowFlags.NoMove, ImGuiWindowFlags.NoDocking) + window_flags = bit32.bor(window_flags or 0, 1 --[[ImGuiWindowFlags.NoTitleBar]], 2 --[[ImGuiWindowFlags.NoResize]], 4 --[[ImGuiWindowFlags.NoMove]], 524288 --[[ImGuiWindowFlags.NoDocking]]) ImGui.SetNextWindowViewport(viewport.ID) - ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 0.0) - ImGui.PushStyleVar(ImGuiStyleVar.WindowMinSize, ImVec2(0, 0)) -- Lift normal size constraint + ImGui.PushStyleVar(3 --[[ImGuiStyleVar.WindowRounding]], 0.0) + ImGui.PushStyleVar(5 --[[ImGuiStyleVar.WindowMinSize]], ImVec2(0, 0)) -- Lift normal size constraint local _, is_open = ImGui.Begin(name, nil, window_flags) ImGui.PopStyleVar(2) @@ -56417,9 +56460,9 @@ function ImGui.BeginMainMenuBar() -- FIXME: This could be generalized as an opt-in way to clamp window.DC.CursorStartPos to avoid SafeArea? -- FIXME: Consider removing support for safe area down the line... it's messy. Nowadays consoles have support for TV calibration in OS settings. g.NextWindowData.MenuBarOffsetMinVal = ImVec2(g.Style.DisplaySafeAreaPadding.x, ImMax(g.Style.DisplaySafeAreaPadding.y - g.Style.FramePadding.y, 0.0)) - local window_flags = bit32.bor(ImGuiWindowFlags.NoScrollbar, ImGuiWindowFlags.NoSavedSettings, ImGuiWindowFlags.MenuBar) + local window_flags = bit32.bor(8 --[[ImGuiWindowFlags.NoScrollbar]], 256 --[[ImGuiWindowFlags.NoSavedSettings]], 1024 --[[ImGuiWindowFlags.MenuBar]]) local height = ImGui.GetFrameHeight() - local is_open = ImGui.BeginViewportSideBar("##MainMenuBar", viewport, ImGuiDir.Up, height, window_flags) + local is_open = ImGui.BeginViewportSideBar("##MainMenuBar", viewport, 2 --[[ImGuiDir.Up]], height, window_flags) g.NextWindowData.MenuBarOffsetMinVal = ImVec2(0.0, 0.0) if not is_open then ImGui.End() @@ -56427,7 +56470,7 @@ function ImGui.BeginMainMenuBar() end -- Temporarily disable _NoSavedSettings, in the off-chance that tables or child windows submitted within the menu-bar may want to use settings. (#8356) - g.CurrentWindow.Flags = bit32.band(g.CurrentWindow.Flags, bit32.bnot(ImGuiWindowFlags.NoSavedSettings)) + g.CurrentWindow.Flags = bit32.band(g.CurrentWindow.Flags, bit32.bnot(256 --[[ImGuiWindowFlags.NoSavedSettings]])) ImGui.BeginMenuBar() return is_open end @@ -56437,12 +56480,12 @@ function ImGui.EndMainMenuBar() IM_ASSERT_USER_ERROR_RET(g.CurrentWindow.DC.MenuBarAppending, "Calling EndMainMenuBar() not from a menu-bar!") -- Not technically testing that it is the main menu bar ImGui.EndMenuBar() - g.CurrentWindow.Flags = bit32.bor(g.CurrentWindow.Flags, ImGuiWindowFlags.NoSavedSettings) -- Restore _NoSavedSettings (#8356) + g.CurrentWindow.Flags = bit32.bor(g.CurrentWindow.Flags, 256 --[[ImGuiWindowFlags.NoSavedSettings]]) -- Restore _NoSavedSettings (#8356) -- When the user has left the menu layer (typically: closed menus through activation of an item), we restore focus to the previous window -- FIXME: With this strategy we won't be able to restore a nil focus. - if g.CurrentWindow == g.NavWindow and g.NavLayer == ImGuiNavLayer.Main and not g.NavAnyRequest and g.ActiveId == 0 then - ImGui.FocusTopMostWindowUnderOne(g.NavWindow, nil, nil, bit32.bor(ImGuiFocusRequestFlags.UnlessBelowModal, ImGuiFocusRequestFlags.RestoreFocusedChild)) + if g.CurrentWindow == g.NavWindow and g.NavLayer == 0 --[[ImGuiNavLayer.Main]] and not g.NavAnyRequest and g.ActiveId == 0 then + ImGui.FocusTopMostWindowUnderOne(g.NavWindow, nil, nil, bit32.bor(2 --[[ImGuiFocusRequestFlags.UnlessBelowModal]], 1 --[[ImGuiFocusRequestFlags.RestoreFocusedChild]])) end ImGui.End() @@ -56451,7 +56494,7 @@ end local function IsRootOfOpenMenuSet() local g = GImGui local window = g.CurrentWindow - if (g.OpenPopupStack.Size <= g.BeginPopupStack.Size) or (bit32.band(window.Flags, ImGuiWindowFlags.ChildMenu) ~= 0) then + if (g.OpenPopupStack.Size <= g.BeginPopupStack.Size) or (bit32.band(window.Flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0) then return false end @@ -56470,7 +56513,7 @@ local function IsRootOfOpenMenuSet() if window.DC.NavLayerCurrent ~= upper_popup.ParentNavLayer then return false end - return upper_popup.Window and (bit32.band(upper_popup.Window.Flags, ImGuiWindowFlags.ChildMenu) ~= 0) and ImGui.IsWindowChildOf(upper_popup.Window, window, true, false) + return upper_popup.Window and (bit32.band(upper_popup.Window.Flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0) and ImGui.IsWindowChildOf(upper_popup.Window, window, true, false) end --- @param label string @@ -56485,13 +56528,13 @@ function ImGui.BeginMenuEx(label, icon, enabled) local g = GImGui local style = g.Style local id = window:GetID(label) - local menu_is_open = ImGui.IsPopupOpen(id, ImGuiPopupFlags.None) + local menu_is_open = ImGui.IsPopupOpen(id, 0 --[[ImGuiPopupFlags.None]]) -- Sub-menus are ChildWindow so that mouse can be hovering across them (otherwise top-most popup menu would steal focus and not allow hovering on parent menu) -- The first menu in a hierarchy isn't so hovering doesn't get across (otherwise e.g. resizing borders with ImGuiButtonFlags.FlattenChildren would react), but top-most BeginMenu() will bypass that limitation. - local window_flags = bit32.bor(ImGuiWindowFlags.ChildMenu, ImGuiWindowFlags.AlwaysAutoResize, ImGuiWindowFlags.NoMove, ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoSavedSettings, ImGuiWindowFlags.NoNavFocus) - if bit32.band(window.Flags, ImGuiWindowFlags.ChildMenu) ~= 0 then - window_flags = bit32.bor(window_flags, ImGuiWindowFlags.ChildWindow) + local window_flags = bit32.bor(268435456 --[[ImGuiWindowFlags.ChildMenu]], 64 --[[ImGuiWindowFlags.AlwaysAutoResize]], 4 --[[ImGuiWindowFlags.NoMove]], 1 --[[ImGuiWindowFlags.NoTitleBar]], 256 --[[ImGuiWindowFlags.NoSavedSettings]], 131072 --[[ImGuiWindowFlags.NoNavFocus]]) + if bit32.band(window.Flags, 268435456 --[[ImGuiWindowFlags.ChildMenu]]) ~= 0 then + window_flags = bit32.bor(window_flags, 16777216 --[[ImGuiWindowFlags.ChildWindow]]) end -- If a menu with same the ID was already submitted, we will append to it, matching the behavior of Begin(). @@ -56516,7 +56559,7 @@ function ImGui.BeginMenuEx(label, icon, enabled) -- This is only done for items for the menu set and not the full parent window. local menuset_is_open = IsRootOfOpenMenuSet() if menuset_is_open then - g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, ImGuiItemFlags.NoWindowHoverableCheck) + g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, 8192 --[[ImGuiItemFlags.NoWindowHoverableCheck]]) end -- The reference position stored in popup_pos will be used by Begin() to find a suitable position for the child menu, @@ -56534,14 +56577,14 @@ function ImGui.BeginMenuEx(label, icon, enabled) local backup_rounding = style.SelectableRounding style.SelectableRounding = style.MenuItemRounding - local selectable_flags = bit32.bor(ImGuiSelectableFlags.SelectOnClick, ImGuiSelectableFlags.NoAutoClosePopups) + local selectable_flags = bit32.bor(4194304 --[[ImGuiSelectableFlags.SelectOnClick]], 1 --[[ImGuiSelectableFlags.NoAutoClosePopups]]) local offsets = window.DC.MenuColumns - if window.DC.LayoutType == ImGuiLayoutType.Horizontal then + if window.DC.LayoutType == 0 --[[ImGuiLayoutType.Horizontal]] then -- Menu inside a horizontal menu bar -- Selectable extend their highlight by half ItemSpacing in each direction. -- For ChildMenu, the popup position will be overwritten by the call to FindBestWindowPosForPopup() in Begin() window.DC.CursorPos.x = window.DC.CursorPos.x + IM_TRUNC(style.ItemSpacing.x * 0.5) - ImGui.PushStyleVarX(ImGuiStyleVar.ItemSpacing, style.ItemSpacing.x * 2.0) + ImGui.PushStyleVarX(14 --[[ImGuiStyleVar.ItemSpacing]], style.ItemSpacing.x * 2.0) local text_pos = ImVec2(window.DC.CursorPos.x + offsets.OffsetLabel, pos.y + window.DC.CurrLineTextBaseOffset) pressed = ImGui.Selectable("", menu_is_open, selectable_flags, label_size) -- TODO: ImGui.LogSetNextTextDecoration("[", "]") @@ -56559,14 +56602,14 @@ function ImGui.BeginMenuEx(label, icon, enabled) local min_w = offsets:DeclColumns(icon_w, label_size.x, 0.0, checkmark_w) -- Feedback to next frame local extra_w = ImMax(0.0, ImGui.GetContentRegionAvail().x - min_w) local text_pos = ImVec2(window.DC.CursorPos.x, pos.y + window.DC.CurrLineTextBaseOffset) - pressed = ImGui.Selectable("", menu_is_open, bit32.bor(selectable_flags, ImGuiSelectableFlags.SpanAvailWidth), ImVec2(min_w, label_size.y)) + pressed = ImGui.Selectable("", menu_is_open, bit32.bor(selectable_flags, 16777216 --[[ImGuiSelectableFlags.SpanAvailWidth]]), ImVec2(min_w, label_size.y)) -- ImGui.LogSetNextTextDecoration("", ">") ImGui.RenderText(ImVec2(text_pos.x + offsets.OffsetLabel, text_pos.y), label, 1, label_end, false) if icon_w > 0.0 then --- @cast icon string ImGui.RenderText(ImVec2(text_pos.x + offsets.OffsetIcon, text_pos.y), icon) end - ImGui.RenderArrow(window.DrawList, ImVec2(text_pos.x + offsets.OffsetMark + extra_w + g.FontSize * 0.30, text_pos.y), ImGui.GetColorU32(ImGuiCol.Text), ImGuiDir.Right) + ImGui.RenderArrow(window.DrawList, ImVec2(text_pos.x + offsets.OffsetMark + extra_w + g.FontSize * 0.30, text_pos.y), ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), 1 --[[ImGuiDir.Right]]) popup_pos = ImVec2(pos.x, text_pos.y - style.WindowPadding.y) end style.SelectableRounding = backup_rounding @@ -56577,9 +56620,9 @@ function ImGui.BeginMenuEx(label, icon, enabled) -- Once dragged, release ActiveId + key ownership. This is to allow the idiom of mouse down a menu, dragging elsewhere, up on some other MenuItem(). (#8233, #9394) -- Could move logic into lower-level ImGuiButtonFlags.AutoReleaseActiveId + ImGuiButtonFlags.AutoReleaseKeyOwner? Easier once we get rid of the Selectable() middle-man here. - if g.ActiveId == id and g.HoveredId ~= id and g.ActiveIdSource == ImGuiInputSource.Mouse and ImGui.IsMouseDragging(0) then + if g.ActiveId == id and g.HoveredId ~= id and g.ActiveIdSource == 1 --[[ImGuiInputSource.Mouse]] and ImGui.IsMouseDragging(0) then ImGui.ClearActiveID() - ImGui.SetKeyOwner(ImGuiKey.MouseLeft, ImGuiKeyOwner_NoOwner) + ImGui.SetKeyOwner(656 --[[ImGuiKey.MouseLeft]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) end local hovered = g.HoveredId == id and enabled and not g.NavHighlightItemUnderNav @@ -56587,7 +56630,7 @@ function ImGui.BeginMenuEx(label, icon, enabled) local want_open = false local want_open_nav_init = false local want_close = false - if window.DC.LayoutType == ImGuiLayoutType.Vertical then -- (window.Flags & (ImGuiWindowFlags.Popup|ImGuiWindowFlags.ChildMenu)) + if window.DC.LayoutType == 1 --[[ImGuiLayoutType.Vertical]] then -- (window.Flags & (ImGuiWindowFlags.Popup|ImGuiWindowFlags.ChildMenu)) -- Close menu when not hovering it anymore unless we are moving roughly in the direction of the menu -- Implement http://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown to avoid using timers, so menus feels more reactive. local moving_toward_child_menu = false @@ -56633,7 +56676,7 @@ function ImGui.BeginMenuEx(label, icon, enabled) elseif not menu_is_open and hovered and g.HoveredIdTimer >= 0.30 and g.MouseStationaryTimer >= 0.30 then -- Hover to open (timer fallback) want_open = true end - if g.NavId == id and g.NavMoveDir == ImGuiDir.Right then -- Nav-Right to open + if g.NavId == id and g.NavMoveDir == 1 --[[ImGuiDir.Right]] then -- Nav-Right to open want_open = true want_open_nav_init = true ImGui.NavMoveRequestCancel() @@ -56647,7 +56690,7 @@ function ImGui.BeginMenuEx(label, icon, enabled) menu_is_open = false elseif pressed or (hovered and menuset_is_open and not menu_is_open) then -- First click to open, then hover to open others want_open = true - elseif g.NavId == id and g.NavMoveDir == ImGuiDir.Down then -- Nav-Down to open + elseif g.NavId == id and g.NavMoveDir == 3 --[[ImGuiDir.Down]] then -- Nav-Down to open want_open = true ImGui.NavMoveRequestCancel() end @@ -56656,7 +56699,7 @@ function ImGui.BeginMenuEx(label, icon, enabled) if not enabled then -- explicitly close if an open menu becomes disabled, facilitate users code a lot in pattern such as 'if (BeginMenu("options", has_object)) { ..use object.. }' want_close = true end - if want_close and ImGui.IsPopupOpen(id, ImGuiPopupFlags.None) then + if want_close and ImGui.IsPopupOpen(id, 0 --[[ImGuiPopupFlags.None]]) then ImGui.ClosePopupToLevel(g.BeginPopupStack.Size, true) end @@ -56672,22 +56715,22 @@ function ImGui.BeginMenuEx(label, icon, enabled) ImGui.OpenPopup(label) elseif want_open then menu_is_open = true - ImGui.OpenPopup(label, ImGuiPopupFlags.NoReopen) -- | (want_open_nav_init ? ImGuiPopupFlags.NoReopenAlwaysNavInit : 0)) + ImGui.OpenPopup(label, 32 --[[ImGuiPopupFlags.NoReopen]]) -- | (want_open_nav_init ? ImGuiPopupFlags.NoReopenAlwaysNavInit : 0)) end if menu_is_open then local last_item_in_parent = ImGuiLastItemData() ImGuiLastItemData_Copy(last_item_in_parent, g.LastItemData) - ImGui.SetNextWindowPos(popup_pos, ImGuiCond.Always) -- Note: misleading: the value will serve as reference for FindBestWindowPosForPopup(), not actual pos. - ImGui.PushStyleVar(ImGuiStyleVar.ChildRounding, style.PopupRounding) -- First level will use _PopupRounding, subsequent will use _ChildRounding + ImGui.SetNextWindowPos(popup_pos, 1 --[[ImGuiCond.Always]]) -- Note: misleading: the value will serve as reference for FindBestWindowPosForPopup(), not actual pos. + ImGui.PushStyleVar(7 --[[ImGuiStyleVar.ChildRounding]], style.PopupRounding) -- First level will use _PopupRounding, subsequent will use _ChildRounding menu_is_open = ImGui.BeginPopupMenuEx(id, label, window_flags) -- menu_is_open may be 'false' when the popup is completely clipped (e.g. zero size display) ImGui.PopStyleVar() if menu_is_open then -- Implement what ImGuiPopupFlags.NoReopenAlwaysNavInit would do: -- Perform an init request in the case the popup was already open (via a previous mouse hover) if want_open and want_open_nav_init and not g.NavInitRequest then - ImGui.FocusWindow(g.CurrentWindow, ImGuiFocusRequestFlags.UnlessBelowModal) + ImGui.FocusWindow(g.CurrentWindow, 2 --[[ImGuiFocusRequestFlags.UnlessBelowModal]]) ImGui.NavInitWindow(g.CurrentWindow, false) end @@ -56695,7 +56738,7 @@ function ImGui.BeginMenuEx(label, icon, enabled) -- (This fixes using IsItemClicked() and IsItemHovered(), but IsItemHovered() also relies on its support for ImGuiItemFlags.NoWindowHoverableCheck) ImGuiLastItemData_Copy(g.LastItemData, last_item_in_parent) if g.HoveredWindow == window then - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HoveredWindow) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 128 --[[ImGuiItemStatusFlags.HoveredWindow]]) end end else @@ -56717,12 +56760,12 @@ function ImGui.EndMenu() -- Nav: When a left move request our menu failed, close ourselves. local g = GImGui local window = g.CurrentWindow - IM_ASSERT_USER_ERROR_RET(bit32.band(window.Flags, bit32.bor(ImGuiWindowFlags.Popup, ImGuiWindowFlags.ChildMenu)) == bit32.bor(ImGuiWindowFlags.Popup, ImGuiWindowFlags.ChildMenu), "Calling EndMenu() in wrong window!") + IM_ASSERT_USER_ERROR_RET(bit32.band(window.Flags, bit32.bor(67108864 --[[ImGuiWindowFlags.Popup]], 268435456 --[[ImGuiWindowFlags.ChildMenu]])) == bit32.bor(67108864 --[[ImGuiWindowFlags.Popup]], 268435456 --[[ImGuiWindowFlags.ChildMenu]]), "Calling EndMenu() in wrong window!") local parent_window = window.ParentWindow -- Should always be ~= nil is we passed assert. if window.BeginCount == window.BeginCountPreviousFrame then - if g.NavMoveDir == ImGuiDir.Left and ImGui.NavMoveRequestButNoResultYet() then - if g.NavWindow and g.NavWindow.RootWindowForNav == window and parent_window.DC.LayoutType == ImGuiLayoutType.Vertical then + if g.NavMoveDir == 0 --[[ImGuiDir.Left]] and ImGui.NavMoveRequestButNoResultYet() then + if g.NavWindow and g.NavWindow.RootWindowForNav == window and parent_window.DC.LayoutType == 1 --[[ImGuiLayoutType.Vertical]] then ImGui.ClosePopupToLevel(g.BeginPopupStack.Size - 1, true) ImGui.NavMoveRequestCancel() end @@ -56756,7 +56799,7 @@ function ImGui.MenuItemEx(label, icon, shortcut, selected, enabled) -- See BeginMenuEx() for comments about this. local menuset_is_open = IsRootOfOpenMenuSet() if menuset_is_open then - g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, ImGuiItemFlags.NoWindowHoverableCheck) + g.NextItemData.ItemFlagsSet = bit32.bor(g.NextItemData.ItemFlagsSet, 8192 --[[ImGuiItemFlags.NoWindowHoverableCheck]]) end -- We've been using the equivalent of ImGuiSelectableFlags.SetNavIdOnHover on all Selectable() since early Nav system days (commit 43ee5d73), @@ -56771,17 +56814,17 @@ function ImGui.MenuItemEx(label, icon, shortcut, selected, enabled) -- We use ImGuiSelectableFlags.NoSetKeyOwner to allow down on one menu item, move, up on another. local backup_rounding = style.SelectableRounding style.SelectableRounding = style.MenuItemRounding - local selectable_flags = bit32.bor(ImGuiSelectableFlags.SelectOnRelease, ImGuiSelectableFlags.SetNavIdOnHover) + local selectable_flags = bit32.bor(8388608 --[[ImGuiSelectableFlags.SelectOnRelease]], 33554432 --[[ImGuiSelectableFlags.SetNavIdOnHover]]) local offsets = window.DC.MenuColumns - if window.DC.LayoutType == ImGuiLayoutType.Horizontal then + if window.DC.LayoutType == 0 --[[ImGuiLayoutType.Horizontal]] then -- Mimic the exact layout spacing of BeginMenu() to allow MenuItem() inside a menu bar, which is a little misleading but may be useful -- Note that in this situation: we don't render the shortcut, we render a highlight instead of the selected tick mark. window.DC.CursorPos.x = window.DC.CursorPos.x + IM_TRUNC(style.ItemSpacing.x * 0.5) local text_pos = ImVec2(window.DC.CursorPos.x + offsets.OffsetLabel, window.DC.CursorPos.y + window.DC.CurrLineTextBaseOffset) - ImGui.PushStyleVarX(ImGuiStyleVar.ItemSpacing, style.ItemSpacing.x * 2.0) + ImGui.PushStyleVarX(14 --[[ImGuiStyleVar.ItemSpacing]], style.ItemSpacing.x * 2.0) pressed = ImGui.Selectable("", selected, selectable_flags, ImVec2(label_size.x, 0.0)) ImGui.PopStyleVar() - if bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.Visible) ~= 0 then + if bit32.band(g.LastItemData.StatusFlags, 256 --[[ImGuiItemStatusFlags.Visible]]) ~= 0 then ImGui.RenderText(text_pos, label, 1, label_end, false) end window.DC.CursorPos.x = window.DC.CursorPos.x + IM_TRUNC(style.ItemSpacing.x * (-1.0 + 0.5)) -- -1 spacing to compensate the spacing added when Selectable() did a SameLine(). It would also work to call SameLine() ourselves after the PopStyleVar(). @@ -56801,22 +56844,22 @@ function ImGui.MenuItemEx(label, icon, shortcut, selected, enabled) local min_w = offsets:DeclColumns(icon_w, label_size.x, shortcut_w, checkmark_w) -- Feedback for next frame local stretch_w = ImMax(0.0, ImGui.GetContentRegionAvail().x - min_w) local text_pos = ImVec2(pos.x, pos.y + window.DC.CurrLineTextBaseOffset) - pressed = ImGui.Selectable("", false, bit32.bor(selectable_flags, ImGuiSelectableFlags.SpanAvailWidth), ImVec2(min_w, label_size.y)) - if bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.Visible) ~= 0 then + pressed = ImGui.Selectable("", false, bit32.bor(selectable_flags, 16777216 --[[ImGuiSelectableFlags.SpanAvailWidth]]), ImVec2(min_w, label_size.y)) + if bit32.band(g.LastItemData.StatusFlags, 256 --[[ImGuiItemStatusFlags.Visible]]) ~= 0 then ImGui.RenderText(text_pos + ImVec2(offsets.OffsetLabel, 0.0), label, 1, label_end, false) if icon_w > 0.0 then --- @cast icon string ImGui.RenderText(text_pos + ImVec2(offsets.OffsetIcon, 0.0), icon) end if shortcut_w > 0.0 then - ImGui.PushStyleColor(ImGuiCol.Text, style.Colors[ImGuiCol.TextDisabled]) + ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], style.Colors[1 --[[ImGuiCol.TextDisabled]]]) -- ImGui.LogSetNextTextDecoration("(", ")") --- @cast shortcut string ImGui.RenderText(text_pos + ImVec2(offsets.OffsetShortcut + stretch_w, 0.0), shortcut, nil, nil, false) ImGui.PopStyleColor() end if selected then - ImGui.RenderCheckMark(window.DrawList, text_pos + ImVec2(offsets.OffsetMark + stretch_w + g.FontSize * 0.40, g.FontSize * 0.134 * 0.5), ImGui.GetColorU32(ImGuiCol.Text), g.FontSize * 0.866) + ImGui.RenderCheckMark(window.DrawList, text_pos + ImVec2(offsets.OffsetMark + stretch_w + g.FontSize * 0.40, g.FontSize * 0.134 * 0.5), ImGui.GetColorU32(0 --[[ImGuiCol.Text]]), g.FontSize * 0.866) end end end @@ -56825,9 +56868,9 @@ function ImGui.MenuItemEx(label, icon, shortcut, selected, enabled) -- Once dragged, release ActiveId + key ownership. This is to allow the idiom of mouse down a menu, dragging elsewhere, up on some other MenuItem(). (#8233, #9394) -- Could move logic into lower-level ImGuiButtonFlags_AutoReleaseActiveId + ImGuiButtonFlags_AutoReleaseKeyOwner? Easier once we get rid of the Selectable() middle-man here. local id = g.LastItemData.ID - if g.ActiveId == id and g.HoveredId ~= id and g.ActiveIdSource == ImGuiInputSource.Mouse and ImGui.IsMouseDragging(0) then + if g.ActiveId == id and g.HoveredId ~= id and g.ActiveIdSource == 1 --[[ImGuiInputSource.Mouse]] and ImGui.IsMouseDragging(0) then ImGui.ClearActiveID() - ImGui.SetKeyOwner(ImGuiKey.MouseLeft, ImGuiKeyOwner_NoOwner) + ImGui.SetKeyOwner(656 --[[ImGuiKey.MouseLeft]], 4294967295 --[[ImGuiKeyOwner_NoOwner]]) end -- IMGUI_TEST_ENGINE_ITEM_INFO() @@ -56880,8 +56923,8 @@ local function ImLinearSweep(current, target, speed) end local function TabItemGetSectionIdx(tab) - if bit32.band(tab.Flags, ImGuiTabItemFlags.Leading) ~= 0 then return 0 end - if bit32.band(tab.Flags, ImGuiTabItemFlags.Trailing) ~= 0 then return 2 end + if bit32.band(tab.Flags, 64 --[[ImGuiTabItemFlags.Leading]]) ~= 0 then return 0 end + if bit32.band(tab.Flags, 128 --[[ImGuiTabItemFlags.Trailing]]) ~= 0 then return 2 end return 1 end @@ -57025,7 +57068,7 @@ function ImGui.BeginTabBar(str_id, flags) tab_bar.SeparatorMinX = tab_bar_bb.Min.x - IM_TRUNC(window.WindowPadding.x * 0.5) tab_bar.SeparatorMaxX = tab_bar_bb.Max.x + IM_TRUNC(window.WindowPadding.x * 0.5) -- if (g.NavWindow and ImGui.IsWindowChildOf(g.NavWindow, window, false, false)) - flags = bit32.bor(flags, ImGuiTabBarFlags.IsFocused) + flags = bit32.bor(flags, 2097152 --[[ImGuiTabBarFlags.IsFocused]]) return ImGui.BeginTabBarEx(tab_bar, tab_bar_bb, flags) end @@ -57035,8 +57078,8 @@ function ImGui.BeginTabBarEx(tab_bar, tab_bar_bb, flags) local window = g.CurrentWindow if window.SkipItems then return false end - IM_ASSERT(tab_bar.ID ~= 0) - if bit32.band(flags, ImGuiTabBarFlags.DockNode) == 0 then -- Already done + assert(tab_bar.ID ~= 0) + if bit32.band(flags, 1048576 --[[ImGuiTabBarFlags.DockNode]]) == 0 then -- Already done ImGui.PushOverrideID(tab_bar.ID) end @@ -57054,17 +57097,17 @@ function ImGui.BeginTabBarEx(tab_bar, tab_bar_bb, flags) end -- Ensure correct ordering when toggling ImGuiTabBarFlags.Reorderable flag, or when a new tab was added while being not reorderable - if bit32.band(flags, ImGuiTabBarFlags.Reorderable) ~= bit32.band(tab_bar.Flags, ImGuiTabBarFlags.Reorderable) - or (tab_bar.TabsAddedNew and bit32.band(flags, ImGuiTabBarFlags.Reorderable) == 0) then - if bit32.band(flags, ImGuiTabBarFlags.DockNode) == 0 then -- FIXME: TabBar with DockNode can now be hybrid + if bit32.band(flags, 1 --[[ImGuiTabBarFlags.Reorderable]]) ~= bit32.band(tab_bar.Flags, 1 --[[ImGuiTabBarFlags.Reorderable]]) + or (tab_bar.TabsAddedNew and bit32.band(flags, 1 --[[ImGuiTabBarFlags.Reorderable]]) == 0) then + if bit32.band(flags, 1048576 --[[ImGuiTabBarFlags.DockNode]]) == 0 then -- FIXME: TabBar with DockNode can now be hybrid SortTabsByBeginOrder(tab_bar) end end tab_bar.TabsAddedNew = false -- Flags - if bit32.band(flags, ImGuiTabBarFlags.FittingPolicyMask_) == 0 then - flags = bit32.bor(flags, ImGuiTabBarFlags.FittingPolicyDefault_) + if bit32.band(flags, 896 --[[ImGuiTabBarFlags.FittingPolicyMask_]]) == 0 then + flags = bit32.bor(flags, 128 --[[ImGuiTabBarFlags.FittingPolicyDefault_]]) end tab_bar.Flags = flags @@ -57085,7 +57128,7 @@ function ImGui.BeginTabBarEx(tab_bar, tab_bar_bb, flags) -- Draw separator -- (it would be misleading to draw this in EndTabBar() suggesting that it may be drawn over tabs, as tab bar are appendable) - local col = ImGui.GetColorU32(bit32.band(flags, ImGuiTabBarFlags.IsFocused) ~= 0 and ImGuiCol.TabSelected or ImGuiCol.TabDimmedSelected) + local col = ImGui.GetColorU32(bit32.band(flags, 2097152 --[[ImGuiTabBarFlags.IsFocused]]) ~= 0 and 37 --[[ImGuiCol.TabSelected]] or 40 --[[ImGuiCol.TabDimmedSelected]]) if g.Style.TabBarBorderSize > 0.0 then local y = tab_bar.BarRect.Max.y window.DrawList:AddRectFilled(ImVec2(tab_bar.SeparatorMinX, y - g.Style.TabBarBorderSize), ImVec2(tab_bar.SeparatorMaxX, y), col) @@ -57100,7 +57143,7 @@ function ImGui.EndTabBar() if window.SkipItems then return end local tab_bar = g.CurrentTabBar - IM_ASSERT(tab_bar ~= nil, "Mismatched BeginTabBar()/EndTabBar()!") + assert(tab_bar ~= nil, "Mismatched BeginTabBar()/EndTabBar()!") -- Fallback in case no TabItem have been submitted if tab_bar.WantLayout then ImGui.TabBarLayout(tab_bar) end @@ -57118,7 +57161,7 @@ function ImGui.EndTabBar() end tab_bar.LastTabItemIdx = -1 - if bit32.band(tab_bar.Flags, ImGuiTabBarFlags.DockNode) == 0 then -- Already done + if bit32.band(tab_bar.Flags, 1048576 --[[ImGuiTabBarFlags.DockNode]]) == 0 then -- Already done ImGui.PopID() end @@ -57201,7 +57244,7 @@ function ImGui.TabBarLayout(tab_bar) end -- Tab List Popup (will alter tab_bar.BarRect and therefore the available width!) - local tab_list_popup_button = bit32.band(tab_bar.Flags, ImGuiTabBarFlags.TabListPopupButton) ~= 0 + local tab_list_popup_button = bit32.band(tab_bar.Flags, 4 --[[ImGuiTabBarFlags.TabListPopupButton]]) ~= 0 if tab_list_popup_button then local tab_to_select = ImGui.TabBarTabListPopupButton(tab_bar) -- NB: Will alter BarRect.Min.x! if tab_to_select then @@ -57219,7 +57262,7 @@ function ImGui.TabBarLayout(tab_bar) for i = 1, tabs.Size do if swb.Data[i] == nil then swb.Data[i] = ImGuiShrinkWidthItem() end end -- Minimum shrink width - local shrink_min_width = (bit32.band(tab_bar.Flags, ImGuiTabBarFlags.FittingPolicyMixed) ~= 0) and g.Style.TabMinWidthShrink or 1.0 + local shrink_min_width = (bit32.band(tab_bar.Flags, 128 --[[ImGuiTabBarFlags.FittingPolicyMixed]]) ~= 0) and g.Style.TabMinWidthShrink or 1.0 -- Compute ideal tabs widths + store them into shrink buffer local most_recently_selected_tab = nil @@ -57227,9 +57270,9 @@ function ImGui.TabBarLayout(tab_bar) local found_selected_tab_id = false for tab_n = 0, tabs.Size - 1 do local tab = tabs.Data[tab_n + 1] - IM_ASSERT(tab.LastFrameVisible >= tab_bar.PrevFrameVisible) + assert(tab.LastFrameVisible >= tab_bar.PrevFrameVisible) - if (most_recently_selected_tab == nil or most_recently_selected_tab.LastFrameSelected < tab.LastFrameSelected) and bit32.band(tab.Flags, ImGuiTabItemFlags.Button) == 0 then + if (most_recently_selected_tab == nil or most_recently_selected_tab.LastFrameSelected < tab.LastFrameSelected) and bit32.band(tab.Flags, 2097152 --[[ImGuiTabItemFlags.Button]]) == 0 then most_recently_selected_tab = tab end if tab.ID == tab_bar.SelectedTabId then found_selected_tab_id = true end @@ -57239,9 +57282,9 @@ function ImGui.TabBarLayout(tab_bar) -- Additionally, when using TabBarAddTab() to manipulate tab bar order we occasionally insert new tabs that don't have a width yet, -- and we cannot wait for the next BeginTabItem() call. We cannot compute this width within TabBarAddTab() because font size depends on the active window. local tab_name = ImGui.TabBarGetTabName(tab_bar, tab) - local has_close_button_or_unsaved_marker = bit32.band(tab.Flags, ImGuiTabItemFlags.NoCloseButton) == 0 or bit32.band(tab.Flags, ImGuiTabItemFlags.UnsavedDocument) ~= 0 + local has_close_button_or_unsaved_marker = bit32.band(tab.Flags, 1048576 --[[ImGuiTabItemFlags.NoCloseButton]]) == 0 or bit32.band(tab.Flags, 1 --[[ImGuiTabItemFlags.UnsavedDocument]]) ~= 0 tab.ContentWidth = (tab.RequestedWidth >= 0.0) and tab.RequestedWidth or ImGui.TabItemCalcSize(tab_name, has_close_button_or_unsaved_marker).x - if bit32.band(tab.Flags, ImGuiTabItemFlags.Button) == 0 then + if bit32.band(tab.Flags, 2097152 --[[ImGuiTabItemFlags.Button]]) == 0 then tab.ContentWidth = ImMax(tab.ContentWidth, g.Style.TabMinWidthBase) end @@ -57271,14 +57314,14 @@ function ImGui.TabBarLayout(tab_bar) -- Horizontal scrolling buttons -- - Important: note that TabBarScrollButtons() will alter BarRect.Max.x. -- - Selection skips buttons and might cross through sections if there are Tabs in Leading/Trailing sections. - local can_scroll = bit32.band(tab_bar.Flags, ImGuiTabBarFlags.FittingPolicyScroll) ~= 0 or bit32.band(tab_bar.Flags, ImGuiTabBarFlags.FittingPolicyMixed) ~= 0 - local width_all_tabs_to_use_for_scroll = (bit32.band(tab_bar.Flags, ImGuiTabBarFlags.FittingPolicyScroll) ~= 0) and tab_bar.WidthAllTabs or width_all_tabs_after_min_width_shrink + local can_scroll = bit32.band(tab_bar.Flags, 512 --[[ImGuiTabBarFlags.FittingPolicyScroll]]) ~= 0 or bit32.band(tab_bar.Flags, 128 --[[ImGuiTabBarFlags.FittingPolicyMixed]]) ~= 0 + local width_all_tabs_to_use_for_scroll = (bit32.band(tab_bar.Flags, 512 --[[ImGuiTabBarFlags.FittingPolicyScroll]]) ~= 0) and tab_bar.WidthAllTabs or width_all_tabs_after_min_width_shrink tab_bar.ScrollButtonEnabled = (width_all_tabs_to_use_for_scroll > tab_bar.BarRect:GetWidth() and tabs.Size > 1) - and bit32.band(tab_bar.Flags, ImGuiTabBarFlags.NoTabListScrollingButtons) == 0 and can_scroll + and bit32.band(tab_bar.Flags, 16 --[[ImGuiTabBarFlags.NoTabListScrollingButtons]]) == 0 and can_scroll if tab_bar.ScrollButtonEnabled then local scroll_and_select_tab = ImGui.TabBarScrollingButtons(tab_bar) if scroll_and_select_tab then - if bit32.band(scroll_and_select_tab.Flags, ImGuiTabItemFlags.Button) == 0 then + if bit32.band(scroll_and_select_tab.Flags, 2097152 --[[ImGuiTabItemFlags.Button]]) == 0 then tab_bar.SelectedTabId = scroll_and_select_tab.ID end scroll_to_tab_id = scroll_and_select_tab.ID @@ -57301,7 +57344,7 @@ function ImGui.TabBarLayout(tab_bar) end -- With ImGuiTabBarFlags.FittingPolicyScroll policy, we will only shrink leading/trailing if the central section is not visible anymore - local can_shrink = bit32.band(tab_bar.Flags, ImGuiTabBarFlags.FittingPolicyShrink) ~= 0 or bit32.band(tab_bar.Flags, ImGuiTabBarFlags.FittingPolicyMixed) ~= 0 + local can_shrink = bit32.band(tab_bar.Flags, 256 --[[ImGuiTabBarFlags.FittingPolicyShrink]]) ~= 0 or bit32.band(tab_bar.Flags, 128 --[[ImGuiTabBarFlags.FittingPolicyMixed]]) ~= 0 if width_excess >= 1.0 and (can_shrink or not central_section_is_visible) then local shrink_data_count = central_section_is_visible and sections[2].TabCount or (sections[1].TabCount + sections[3].TabCount) local shrink_data_offset = central_section_is_visible and (sections[1].TabCount + sections[3].TabCount) or 0 @@ -57366,7 +57409,7 @@ function ImGui.TabBarLayout(tab_bar) ImGui.TabBarScrollToTab(tab_bar, scroll_to_tab_id, sections) elseif tab_bar.ScrollButtonEnabled and ImGui.IsMouseHoveringRect(tab_bar.BarRect.Min, tab_bar.BarRect.Max, true) and ImGui.IsWindowContentHoverable(g.CurrentWindow) then local wheel = g.IO.MouseWheelRequestAxisSwap and g.IO.MouseWheel or g.IO.MouseWheelH - local wheel_key = g.IO.MouseWheelRequestAxisSwap and ImGuiKey.MouseWheelY or ImGuiKey.MouseWheelX + local wheel_key = g.IO.MouseWheelRequestAxisSwap and 662 --[[ImGuiKey.MouseWheelY]] or 661 --[[ImGuiKey.MouseWheelX]] if ImGui.TestKeyOwner(wheel_key, tab_bar.ID) and wheel ~= 0.0 then local scroll_step = wheel * TabBarCalcScrollableWidth(tab_bar, sections) / 3.0 tab_bar.ScrollingTargetDistToVisibility = 0.0 @@ -57401,7 +57444,7 @@ end -- Dockable windows uses Name/ID in the global namespace. Non-dockable items use the ID stack. function ImGui.TabBarCalcTabID(tab_bar, label, docked_window) if docked_window ~= nil then - IM_ASSERT(bit32.band(tab_bar.Flags, ImGuiTabBarFlags.DockNode) ~= 0) + assert(bit32.band(tab_bar.Flags, 1048576 --[[ImGuiTabBarFlags.DockNode]]) ~= 0) local id = docked_window.TabId ImGui.KeepAliveID(id) return id @@ -57460,7 +57503,7 @@ function ImGui.TabBarGetTabName(tab_bar, tab) end function ImGui.TabBarGetTabPos(tab_bar, tab) - if bit32.band(tab.Flags, ImGuiTabItemFlags.SectionMask_) == 0 then + if bit32.band(tab.Flags, 192 --[[ImGuiTabItemFlags.SectionMask_]]) == 0 then return tab_bar.BarRect.Min + ImVec2(IM_TRUNC(tab.Offset - tab_bar.ScrollingAnim), 0.0) end return tab_bar.BarRect.Min + ImVec2(tab.Offset, 0.0) @@ -57470,10 +57513,10 @@ end -- Otherwise calling this is unnecessary as tabs are appending as needed by the BeginTabItem() function. function ImGui.TabBarAddTab(tab_bar, tab_flags, window) local g = ImGui.GetCurrentContext() - IM_ASSERT(ImGui.TabBarFindTabByID(tab_bar, window.TabId) == nil) - IM_ASSERT(g.CurrentTabBar ~= tab_bar) -- Can't work while the tab bar is active as our tab doesn't have an X offset yet, in theory we could/should test something like (tab_bar.CurrFrameVisible < g.FrameCount) but we'd need to solve why triggers the commented early-out assert in BeginTabBarEx() (probably dock node going from implicit to explicit in same frame) + assert(ImGui.TabBarFindTabByID(tab_bar, window.TabId) == nil) + assert(g.CurrentTabBar ~= tab_bar) -- Can't work while the tab bar is active as our tab doesn't have an X offset yet, in theory we could/should test something like (tab_bar.CurrFrameVisible < g.FrameCount) but we'd need to solve why triggers the commented early-out assert in BeginTabBarEx() (probably dock node going from implicit to explicit in same frame) if not window.HasCloseButton then - tab_flags = bit32.bor(tab_flags, ImGuiTabItemFlags.NoCloseButton) -- Set _NoCloseButton immediately because it will be used for first-frame width calculation. + tab_flags = bit32.bor(tab_flags, 1048576 --[[ImGuiTabItemFlags.NoCloseButton]]) -- Set _NoCloseButton immediately because it will be used for first-frame width calculation. end local new_tab = ImGuiTabItem() new_tab.ID = window.TabId @@ -57495,9 +57538,9 @@ end -- Called on manual closure attempt function ImGui.TabBarCloseTab(tab_bar, tab) - if bit32.band(tab.Flags, ImGuiTabItemFlags.Button) ~= 0 then return end -- A button appended with TabItemButton(). + if bit32.band(tab.Flags, 2097152 --[[ImGuiTabItemFlags.Button]]) ~= 0 then return end -- A button appended with TabItemButton(). - if bit32.band(tab.Flags, bit32.bor(ImGuiTabItemFlags.UnsavedDocument, ImGuiTabItemFlags.NoAssumedClosure)) == 0 then + if bit32.band(tab.Flags, bit32.bor(1 --[[ImGuiTabItemFlags.UnsavedDocument]], 256 --[[ImGuiTabItemFlags.NoAssumedClosure]])) == 0 then -- This will remove a frame of lag for selecting another tab on closure. -- However we don't run it in the case where the 'Unsaved' flag is set, so user gets a chance to fully undo the closure tab.WantClose = true @@ -57524,12 +57567,12 @@ function ImGui.TabBarScrollToTab(tab_bar, tab_id, sections) -- Clamp attempt to scroll to leading/trailing sections items. -- This could be done at the TabBarScrollingButtons() call site as well, but here works. - if bit32.band(tab.Flags, ImGuiTabItemFlags.Leading) ~= 0 then + if bit32.band(tab.Flags, 64 --[[ImGuiTabItemFlags.Leading]]) ~= 0 then tab = tab_bar.Tabs.Data[sections[1].TabCount + 1] - elseif bit32.band(tab.Flags, ImGuiTabItemFlags.Trailing) ~= 0 then + elseif bit32.band(tab.Flags, 128 --[[ImGuiTabItemFlags.Trailing]]) ~= 0 then tab = tab_bar.Tabs.Data[sections[1].TabCount + sections[2].TabCount + 1] end - if tab == nil or bit32.band(tab.Flags, ImGuiTabItemFlags.SectionMask_) ~= 0 then return end + if tab == nil or bit32.band(tab.Flags, 192 --[[ImGuiTabItemFlags.SectionMask_]]) ~= 0 then return end -- When scrolling to make Tab N+1 visible always make a bit of N visible to suggest more scrolling area (since we don't have a scrollbar) -- Disable the margin if the scrolling section is too small for the target tab: prefer displaying a maximum of the label. @@ -57558,7 +57601,7 @@ end --- TabBarQueueFocus(tab_bar, tab) or TabBarQueueFocus(tab_bar, tab_name) function ImGui.TabBarQueueFocus(tab_bar, tab) if type(tab) == "string" then - IM_ASSERT(bit32.band(tab_bar.Flags, ImGuiTabBarFlags.DockNode) == 0) -- Only supported for manual/explicit tab bars + assert(bit32.band(tab_bar.Flags, 1048576 --[[ImGuiTabBarFlags.DockNode]]) == 0) -- Only supported for manual/explicit tab bars tab_bar.NextSelectedTabId = ImGui.TabBarCalcTabID(tab_bar, tab, nil) return end @@ -57566,19 +57609,19 @@ function ImGui.TabBarQueueFocus(tab_bar, tab) end function ImGui.TabBarQueueReorder(tab_bar, tab, offset) - IM_ASSERT(offset ~= 0) - IM_ASSERT(tab_bar.ReorderRequestTabId == 0) + assert(offset ~= 0) + assert(tab_bar.ReorderRequestTabId == 0) tab_bar.ReorderRequestTabId = tab.ID tab_bar.ReorderRequestOffset = offset end function ImGui.TabBarQueueReorderFromMousePos(tab_bar, src_tab, mouse_pos) local g = ImGui.GetCurrentContext() - IM_ASSERT(tab_bar.ReorderRequestTabId == 0) - if bit32.band(tab_bar.Flags, ImGuiTabBarFlags.Reorderable) == 0 then return end + assert(tab_bar.ReorderRequestTabId == 0) + if bit32.band(tab_bar.Flags, 1 --[[ImGuiTabBarFlags.Reorderable]]) == 0 then return end local tab_spacing = g.Style.ItemInnerSpacing.x - local is_central_section = bit32.band(src_tab.Flags, ImGuiTabItemFlags.SectionMask_) == 0 + local is_central_section = bit32.band(src_tab.Flags, 192 --[[ImGuiTabItemFlags.SectionMask_]]) == 0 local bar_offset = tab_bar.BarRect.Min.x - (is_central_section and tab_bar.ScrollingTarget or 0) -- Count number of contiguous tabs we are crossing over @@ -57589,8 +57632,8 @@ function ImGui.TabBarQueueReorderFromMousePos(tab_bar, src_tab, mouse_pos) while i >= 0 and i < tab_bar.Tabs.Size do -- Reordered tabs must share the same section local dst_tab = tab_bar.Tabs.Data[i + 1] - if bit32.band(dst_tab.Flags, ImGuiTabItemFlags.NoReorder) ~= 0 then break end - if bit32.band(dst_tab.Flags, ImGuiTabItemFlags.SectionMask_) ~= bit32.band(src_tab.Flags, ImGuiTabItemFlags.SectionMask_) then break end + if bit32.band(dst_tab.Flags, 32 --[[ImGuiTabItemFlags.NoReorder]]) ~= 0 then break end + if bit32.band(dst_tab.Flags, 192 --[[ImGuiTabItemFlags.SectionMask_]]) ~= bit32.band(src_tab.Flags, 192 --[[ImGuiTabItemFlags.SectionMask_]]) then break end dst_idx = i -- Include spacing after tab, so when mouse cursor is between tabs we would not continue checking further tabs that are not hovered. @@ -57608,7 +57651,7 @@ end function ImGui.TabBarProcessReorder(tab_bar) local tab1 = ImGui.TabBarFindTabByID(tab_bar, tab_bar.ReorderRequestTabId) - if tab1 == nil or bit32.band(tab1.Flags, ImGuiTabItemFlags.NoReorder) ~= 0 then return false end + if tab1 == nil or bit32.band(tab1.Flags, 32 --[[ImGuiTabItemFlags.NoReorder]]) ~= 0 then return false end -- IM_ASSERT(bit32.band(tab_bar.Flags, ImGuiTabBarFlags.Reorderable) ~= 0) -- <- this may happen when using debug tools local tab1_order = ImGui.TabBarGetTabOrder(tab_bar, tab1) @@ -57618,14 +57661,14 @@ function ImGui.TabBarProcessReorder(tab_bar) -- Reordered tabs must share the same section -- (Note: TabBarQueueReorderFromMousePos() also has a similar test but since we allow direct calls to TabBarQueueReorder() we do it here too) local tab2 = tab_bar.Tabs.Data[tab2_order + 1] - if bit32.band(tab2.Flags, ImGuiTabItemFlags.NoReorder) ~= 0 then return false end - if bit32.band(tab1.Flags, ImGuiTabItemFlags.SectionMask_) ~= bit32.band(tab2.Flags, ImGuiTabItemFlags.SectionMask_) then return false end + if bit32.band(tab2.Flags, 32 --[[ImGuiTabItemFlags.NoReorder]]) ~= 0 then return false end + if bit32.band(tab1.Flags, 192 --[[ImGuiTabItemFlags.SectionMask_]]) ~= bit32.band(tab2.Flags, 192 --[[ImGuiTabItemFlags.SectionMask_]]) then return false end -- Move tab1 to tab2's position, shifting the tabs in between table.remove(tab_bar.Tabs.Data, tab1_order + 1) table.insert(tab_bar.Tabs.Data, tab2_order + 1, tab1) - if bit32.band(tab_bar.Flags, ImGuiTabBarFlags.SaveSettings) ~= 0 then ImGui.MarkIniSettingsDirty() end + if bit32.band(tab_bar.Flags, 4194304 --[[ImGuiTabBarFlags.SaveSettings]]) ~= 0 then ImGui.MarkIniSettingsDirty() end return true end @@ -57640,21 +57683,21 @@ function ImGui.TabBarScrollingButtons(tab_bar) -- window.DrawList:AddRect(ImVec2(tab_bar.BarRect.Max.x - scrolling_buttons_width, tab_bar.BarRect.Min.y), ImVec2(tab_bar.BarRect.Max.x, tab_bar.BarRect.Max.y), IM_COL32(255,0,0,255)) local select_dir = 0 - local tc = g.Style.Colors[ImGuiCol.Text] + local tc = g.Style.Colors[0 --[[ImGuiCol.Text]]] local arrow_col = ImVec4(tc.x, tc.y, tc.z, tc.w * 0.5) - ImGui.PushStyleColor(ImGuiCol.Text, arrow_col) - ImGui.PushStyleColor(ImGuiCol.Button, ImVec4(0, 0, 0, 0)) - ImGui.PushItemFlag(bit32.bor(ImGuiItemFlags.ButtonRepeat, ImGuiItemFlags.NoNav), true) + ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], arrow_col) + ImGui.PushStyleColor(22 --[[ImGuiCol.Button]], ImVec4(0, 0, 0, 0)) + ImGui.PushItemFlag(bit32.bor(8 --[[ImGuiItemFlags.ButtonRepeat]], 2 --[[ImGuiItemFlags.NoNav]]), true) local backup_repeat_delay = g.IO.KeyRepeatDelay local backup_repeat_rate = g.IO.KeyRepeatRate g.IO.KeyRepeatDelay = 0.250 g.IO.KeyRepeatRate = 0.200 local x = ImMax(tab_bar.BarRect.Min.x, tab_bar.BarRect.Max.x - scrolling_buttons_width) ImVec2_CopyV(window.DC.CursorPos, x, tab_bar.BarRect.Min.y) - if ImGui.ArrowButtonEx("##<", ImGuiDir.Left, arrow_button_size, ImGuiButtonFlags.PressedOnClick) then select_dir = -1 end + if ImGui.ArrowButtonEx("##<", 0 --[[ImGuiDir.Left]], arrow_button_size, 16 --[[ImGuiButtonFlags.PressedOnClick]]) then select_dir = -1 end ImVec2_CopyV(window.DC.CursorPos, x + arrow_button_size.x, tab_bar.BarRect.Min.y) - if ImGui.ArrowButtonEx("##>", ImGuiDir.Right, arrow_button_size, ImGuiButtonFlags.PressedOnClick) then select_dir = 1 end + if ImGui.ArrowButtonEx("##>", 1 --[[ImGuiDir.Right]], arrow_button_size, 16 --[[ImGuiButtonFlags.PressedOnClick]]) then select_dir = 1 end ImGui.PopItemFlag() ImGui.PopStyleColor(2) g.IO.KeyRepeatRate = backup_repeat_rate @@ -57675,7 +57718,7 @@ function ImGui.TabBarScrollingButtons(tab_bar) -- Cross through buttons -- (even if first/last item is a button, return it so we can update the scroll) - if bit32.band(tab_to_scroll_to.Flags, ImGuiTabItemFlags.Button) ~= 0 then + if bit32.band(tab_to_scroll_to.Flags, 2097152 --[[ImGuiTabItemFlags.Button]]) ~= 0 then target_order = target_order + select_dir selected_order = selected_order + select_dir if not (target_order < 0 or target_order >= tab_bar.Tabs.Size) then tab_to_scroll_to = nil end @@ -57699,17 +57742,17 @@ function ImGui.TabBarTabListPopupButton(tab_bar) ImVec2_CopyV(window.DC.CursorPos, tab_bar.BarRect.Min.x - g.Style.FramePadding.y, tab_bar.BarRect.Min.y) tab_bar.BarRect.Min.x = tab_bar.BarRect.Min.x + tab_list_popup_button_width - local tc = g.Style.Colors[ImGuiCol.Text] - ImGui.PushStyleColor(ImGuiCol.Text, ImVec4(tc.x, tc.y, tc.z, tc.w * 0.5)) - ImGui.PushStyleColor(ImGuiCol.Button, ImVec4(0, 0, 0, 0)) - local open = ImGui.BeginCombo("##v", nil, bit32.bor(ImGuiComboFlags.NoPreview, ImGuiComboFlags.HeightLargest)) + local tc = g.Style.Colors[0 --[[ImGuiCol.Text]]] + ImGui.PushStyleColor(0 --[[ImGuiCol.Text]], ImVec4(tc.x, tc.y, tc.z, tc.w * 0.5)) + ImGui.PushStyleColor(22 --[[ImGuiCol.Button]], ImVec4(0, 0, 0, 0)) + local open = ImGui.BeginCombo("##v", nil, bit32.bor(64 --[[ImGuiComboFlags.NoPreview]], 16 --[[ImGuiComboFlags.HeightLargest]])) ImGui.PopStyleColor(2) local tab_to_select = nil if open then for n = 1, tab_bar.Tabs.Size do local tab = tab_bar.Tabs.Data[n] - if bit32.band(tab.Flags, ImGuiTabItemFlags.Button) == 0 then + if bit32.band(tab.Flags, 2097152 --[[ImGuiTabItemFlags.Button]]) == 0 then local tab_name = ImGui.TabBarGetTabName(tab_bar, tab) if ImGui.Selectable(tab_name, tab_bar.SelectedTabId == tab.ID) then tab_to_select = tab @@ -57744,12 +57787,12 @@ function ImGui.BeginTabItem(label, p_open, flags) if window.SkipItems then return false, p_open end local tab_bar = g.CurrentTabBar - IM_ASSERT(tab_bar ~= nil, "Needs to be called between BeginTabBar() and EndTabBar()!") - IM_ASSERT(bit32.band(flags, ImGuiTabItemFlags.Button) == 0) -- BeginTabItem() Can't be used with button flags, use TabItemButton() instead! + assert(tab_bar ~= nil, "Needs to be called between BeginTabBar() and EndTabBar()!") + assert(bit32.band(flags, 2097152 --[[ImGuiTabItemFlags.Button]]) == 0) -- BeginTabItem() Can't be used with button flags, use TabItemButton() instead! local ret ret, p_open = ImGui.TabItemEx(tab_bar, label, p_open, flags, nil) - if ret and bit32.band(flags, ImGuiTabItemFlags.NoPushId) == 0 then + if ret and bit32.band(flags, 8 --[[ImGuiTabItemFlags.NoPushId]]) == 0 then local tab = tab_bar.Tabs.Data[tab_bar.LastTabItemIdx + 1] ImGui.PushOverrideID(tab.ID) -- We already hashed 'label' so push into the ID stack directly instead of doing another hash through PushID(label) end @@ -57762,10 +57805,10 @@ function ImGui.EndTabItem() if window.SkipItems then return end local tab_bar = g.CurrentTabBar - IM_ASSERT(tab_bar ~= nil, "Needs to be called between BeginTabBar() and EndTabBar()!") - IM_ASSERT(tab_bar.LastTabItemIdx >= 0) + assert(tab_bar ~= nil, "Needs to be called between BeginTabBar() and EndTabBar()!") + assert(tab_bar.LastTabItemIdx >= 0) local tab = tab_bar.Tabs.Data[tab_bar.LastTabItemIdx + 1] - if bit32.band(tab.Flags, ImGuiTabItemFlags.NoPushId) == 0 then + if bit32.band(tab.Flags, 8 --[[ImGuiTabItemFlags.NoPushId]]) == 0 then ImGui.PopID() end end @@ -57776,8 +57819,8 @@ function ImGui.TabItemButton(label, flags) local window = g.CurrentWindow if window.SkipItems then return false end local tab_bar = g.CurrentTabBar - IM_ASSERT(tab_bar ~= nil, "Needs to be called between BeginTabBar() and EndTabBar()!") - return (ImGui.TabItemEx(tab_bar, label, nil, bit32.bor(flags, ImGuiTabItemFlags.Button, ImGuiTabItemFlags.NoReorder), nil)) + assert(tab_bar ~= nil, "Needs to be called between BeginTabBar() and EndTabBar()!") + return (ImGui.TabItemEx(tab_bar, label, nil, bit32.bor(flags, 2097152 --[[ImGuiTabItemFlags.Button]], 32 --[[ImGuiTabItemFlags.NoReorder]]), nil)) end function ImGui.TabItemSpacing(str_id, flags, width) @@ -57785,9 +57828,9 @@ function ImGui.TabItemSpacing(str_id, flags, width) local window = g.CurrentWindow if window.SkipItems then return end local tab_bar = g.CurrentTabBar - IM_ASSERT(tab_bar ~= nil, "Needs to be called between BeginTabBar() and EndTabBar()!") + assert(tab_bar ~= nil, "Needs to be called between BeginTabBar() and EndTabBar()!") ImGui.SetNextItemWidth(width) - ImGui.TabItemEx(tab_bar, str_id, nil, bit32.bor(flags or 0, ImGuiTabItemFlags.Button, ImGuiTabItemFlags.NoReorder, ImGuiTabItemFlags.Invisible), nil) + ImGui.TabItemEx(tab_bar, str_id, nil, bit32.bor(flags or 0, 2097152 --[[ImGuiTabItemFlags.Button]], 32 --[[ImGuiTabItemFlags.NoReorder]], 4194304 --[[ImGuiTabItemFlags.Invisible]]), nil) end --- @return bool ret, bool? p_open @@ -57809,19 +57852,19 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) -- If the user called us with p_open == false, we early out and don't render. -- We make a call to ItemAdd() so that attempts to use a contextual popup menu with an implicit ID won't use an older ID. if p_open ~= nil and not p_open then - ImGui.ItemAdd(ImRect(), id, nil, ImGuiItemFlags.NoNav) + ImGui.ItemAdd(ImRect(), id, nil, 2 --[[ImGuiItemFlags.NoNav]]) return false, p_open end - IM_ASSERT(p_open == nil or bit32.band(flags, ImGuiTabItemFlags.Button) == 0) - IM_ASSERT(bit32.band(flags, bit32.bor(ImGuiTabItemFlags.Leading, ImGuiTabItemFlags.Trailing)) ~= bit32.bor(ImGuiTabItemFlags.Leading, ImGuiTabItemFlags.Trailing)) -- Can't use both Leading and Trailing + assert(p_open == nil or bit32.band(flags, 2097152 --[[ImGuiTabItemFlags.Button]]) == 0) + assert(bit32.band(flags, bit32.bor(64 --[[ImGuiTabItemFlags.Leading]], 128 --[[ImGuiTabItemFlags.Trailing]])) ~= bit32.bor(64 --[[ImGuiTabItemFlags.Leading]], 128 --[[ImGuiTabItemFlags.Trailing]])) -- Can't use both Leading and Trailing -- Store into ImGuiTabItemFlags.NoCloseButton, also honor ImGuiTabItemFlags.NoCloseButton passed by user (although not documented) local has_p_open = (p_open ~= nil) - if bit32.band(flags, ImGuiTabItemFlags.NoCloseButton) ~= 0 then + if bit32.band(flags, 1048576 --[[ImGuiTabItemFlags.NoCloseButton]]) ~= 0 then has_p_open = false elseif not has_p_open then - flags = bit32.bor(flags, ImGuiTabItemFlags.NoCloseButton) + flags = bit32.bor(flags, 1048576 --[[ImGuiTabItemFlags.NoCloseButton]]) end -- Acquire tab data @@ -57837,9 +57880,9 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) tab_bar.LastTabItemIdx = ImGui.TabBarGetTabOrder(tab_bar, tab) -- Calculate tab contents size - local size = ImGui.TabItemCalcSize(label, has_p_open or bit32.band(flags, ImGuiTabItemFlags.UnsavedDocument) ~= 0) + local size = ImGui.TabItemCalcSize(label, has_p_open or bit32.band(flags, 1 --[[ImGuiTabItemFlags.UnsavedDocument]]) ~= 0) tab.RequestedWidth = -1.0 - if bit32.band(g.NextItemData.HasFlags, ImGuiNextItemDataFlags.HasWidth) ~= 0 then + if bit32.band(g.NextItemData.HasFlags, 1 --[[ImGuiNextItemDataFlags.HasWidth]]) ~= 0 then size.x = g.NextItemData.Width tab.RequestedWidth = size.x end @@ -57849,10 +57892,10 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) tab_bar.TabsActiveCount = tab_bar.TabsActiveCount + 1 local tab_bar_appearing = (tab_bar.PrevFrameVisible + 1 < g.FrameCount) - local tab_bar_focused = bit32.band(tab_bar.Flags, ImGuiTabBarFlags.IsFocused) ~= 0 + local tab_bar_focused = bit32.band(tab_bar.Flags, 2097152 --[[ImGuiTabBarFlags.IsFocused]]) ~= 0 local tab_appearing = (tab.LastFrameVisible + 1 < g.FrameCount) - local tab_just_unsaved = bit32.band(flags, ImGuiTabItemFlags.UnsavedDocument) ~= 0 and bit32.band(tab.Flags, ImGuiTabItemFlags.UnsavedDocument) == 0 - local is_tab_button = bit32.band(flags, ImGuiTabItemFlags.Button) ~= 0 + local tab_just_unsaved = bit32.band(flags, 1 --[[ImGuiTabItemFlags.UnsavedDocument]]) ~= 0 and bit32.band(tab.Flags, 1 --[[ImGuiTabItemFlags.UnsavedDocument]]) == 0 + local is_tab_button = bit32.band(flags, 2097152 --[[ImGuiTabItemFlags.Button]]) ~= 0 tab.LastFrameVisible = g.FrameCount tab.Flags = flags tab.Window = docked_window @@ -57860,7 +57903,7 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) -- Append name (port: stored on tab.Name) -- (regular tabs are permitted in a DockNode tab bar, but window tabs not permitted in a non-DockNode tab bar) if docked_window ~= nil then - IM_ASSERT(bit32.band(tab_bar.Flags, ImGuiTabBarFlags.DockNode) ~= 0) + assert(bit32.band(tab_bar.Flags, 1048576 --[[ImGuiTabBarFlags.DockNode]]) ~= 0) tab.NameOffset = -1 tab.Name = nil else @@ -57870,12 +57913,12 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) -- Update selected tab if not is_tab_button then - if tab_appearing and bit32.band(tab_bar.Flags, ImGuiTabBarFlags.AutoSelectNewTabs) ~= 0 and tab_bar.NextSelectedTabId == 0 then + if tab_appearing and bit32.band(tab_bar.Flags, 2 --[[ImGuiTabBarFlags.AutoSelectNewTabs]]) ~= 0 and tab_bar.NextSelectedTabId == 0 then if not tab_bar_appearing or tab_bar.SelectedTabId == 0 then ImGui.TabBarQueueFocus(tab_bar, tab) -- New tabs gets activated end end - if bit32.band(flags, ImGuiTabItemFlags.SetSelected) ~= 0 and tab_bar.SelectedTabId ~= id then -- _SetSelected can only be passed on explicit tab bar + if bit32.band(flags, 2 --[[ImGuiTabItemFlags.SetSelected]]) ~= 0 and tab_bar.SelectedTabId ~= id then -- _SetSelected can only be passed on explicit tab bar ImGui.TabBarQueueFocus(tab_bar, tab) end end @@ -57887,7 +57930,7 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) -- On the very first frame of a tab bar we let first tab contents be visible to minimize appearing glitches if not tab_contents_visible and tab_bar.SelectedTabId == 0 and tab_bar_appearing and docked_window == nil then - if tab_bar.Tabs.Size == 1 and bit32.band(tab_bar.Flags, ImGuiTabBarFlags.AutoSelectNewTabs) == 0 then + if tab_bar.Tabs.Size == 1 and bit32.band(tab_bar.Flags, 2 --[[ImGuiTabBarFlags.AutoSelectNewTabs]]) == 0 then tab_contents_visible = true end end @@ -57895,7 +57938,7 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) -- Note that tab_is_new is not necessarily the same as tab_appearing! When a tab bar stops being submitted -- and then gets submitted again, the tabs will have 'tab_appearing=true' but 'tab_is_new=false'. if tab_appearing and (not tab_bar_appearing or tab_is_new) then - ImGui.ItemAdd(ImRect(), id, nil, ImGuiItemFlags.NoNav) + ImGui.ItemAdd(ImRect(), id, nil, 2 --[[ImGuiItemFlags.NoNav]]) if is_tab_button then return false, p_open end return tab_contents_visible, p_open end @@ -57906,7 +57949,7 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) local backup_main_cursor_pos = ImVec2(window.DC.CursorPos.x, window.DC.CursorPos.y) -- Layout - local is_central_section = bit32.band(tab.Flags, ImGuiTabItemFlags.SectionMask_) == 0 + local is_central_section = bit32.band(tab.Flags, 192 --[[ImGuiTabItemFlags.SectionMask_]]) == 0 size.x = tab.Width local pos = ImGui.TabBarGetTabPos(tab_bar, tab) ImVec2_Copy(window.DC.CursorPos, pos) @@ -57929,12 +57972,12 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) end -- Click to Select a tab - local button_flags = bit32.bor(is_tab_button and ImGuiButtonFlags.PressedOnClickRelease or ImGuiButtonFlags.PressedOnClick, ImGuiButtonFlags.AllowOverlap) + local button_flags = bit32.bor(is_tab_button and 32 --[[ImGuiButtonFlags.PressedOnClickRelease]] or 16 --[[ImGuiButtonFlags.PressedOnClick]], 4096 --[[ImGuiButtonFlags.AllowOverlap]]) if g.DragDropActive and not ImGuiPayload_IsDataType(g.DragDropPayload, IMGUI_PAYLOAD_TYPE_WINDOW) then -- FIXME: May be an opt-in property of the payload to disable this - button_flags = bit32.bor(button_flags, ImGuiButtonFlags.PressedOnDragDropHold) + button_flags = bit32.bor(button_flags, 512 --[[ImGuiButtonFlags.PressedOnDragDropHold]]) end local hovered, held, pressed - if bit32.band(flags, ImGuiTabItemFlags.Invisible) ~= 0 then + if bit32.band(flags, 4194304 --[[ImGuiTabItemFlags.Invisible]]) ~= 0 then hovered, held, pressed = false, false, false else pressed, hovered, held = ImGui.ButtonBehavior(bb, id, button_flags) @@ -57957,7 +58000,7 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) -- Drag and drop: re-order tabs local drag_dir = 0 local drag_distance_from_edge_x = 0.0 - if not g.DragDropActive and (bit32.band(tab_bar.Flags, ImGuiTabBarFlags.Reorderable) ~= 0 or docked_window ~= nil) then + if not g.DragDropActive and (bit32.band(tab_bar.Flags, 1 --[[ImGuiTabBarFlags.Reorderable]]) ~= 0 or docked_window ~= nil) then -- While moving a tab it will jump on the other side of the mouse, so we also test for MouseDelta.x if g.IO.MouseDelta.x < 0.0 and g.IO.MousePos.x < bb.Min.x then drag_dir = -1 @@ -57971,7 +58014,7 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) end -- Extract a Dockable window out of it's tab bar - local can_undock = docked_window ~= nil and bit32.band(docked_window.Flags, ImGuiWindowFlags.NoMove) == 0 and bit32.band(node.MergedFlags, ImGuiDockNodeFlags.NoUndocking) == 0 + local can_undock = docked_window ~= nil and bit32.band(docked_window.Flags, 4 --[[ImGuiWindowFlags.NoMove]]) == 0 and bit32.band(node.MergedFlags, 128 --[[ImGuiDockNodeFlags.NoUndocking]]) == 0 if can_undock then -- We use a variable threshold to distinguish dragging tabs within a tab bar and extracting them out of the tab bar local undocking_tab = (g.DragDropActive and g.DragDropPayload.SourceId == id) @@ -58004,19 +58047,19 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) end -- Render tab shape - local is_visible = bit32.band(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.Visible) ~= 0 and bit32.band(flags, ImGuiTabItemFlags.Invisible) == 0 + local is_visible = bit32.band(g.LastItemData.StatusFlags, 256 --[[ImGuiItemStatusFlags.Visible]]) ~= 0 and bit32.band(flags, 4194304 --[[ImGuiTabItemFlags.Invisible]]) == 0 if is_visible then local display_draw_list = window.DrawList local col_idx - if held or hovered then col_idx = ImGuiCol.TabHovered - elseif tab_contents_visible then col_idx = tab_bar_focused and ImGuiCol.TabSelected or ImGuiCol.TabDimmedSelected - else col_idx = tab_bar_focused and ImGuiCol.Tab or ImGuiCol.TabDimmed end + if held or hovered then col_idx = 35 --[[ImGuiCol.TabHovered]] + elseif tab_contents_visible then col_idx = tab_bar_focused and 37 --[[ImGuiCol.TabSelected]] or 40 --[[ImGuiCol.TabDimmedSelected]] + else col_idx = tab_bar_focused and 36 --[[ImGuiCol.Tab]] or 39 --[[ImGuiCol.TabDimmed]] end ImGui.TabItemBackground(display_draw_list, bb, flags, ImGui.GetColorU32(col_idx)) - if tab_contents_visible and bit32.band(tab_bar.Flags, ImGuiTabBarFlags.DrawSelectedOverline) ~= 0 and style.TabBarOverlineSize > 0.0 then + if tab_contents_visible and bit32.band(tab_bar.Flags, 64 --[[ImGuiTabBarFlags.DrawSelectedOverline]]) ~= 0 and style.TabBarOverlineSize > 0.0 then -- Might be moved to TabItemBackground() ? local tl = ImVec2(bb.Min.x, bb.Min.y + style.TabBarOverlineSize * 0.5) local tr = ImVec2(bb.Max.x, bb.Min.y + style.TabBarOverlineSize * 0.5) - local overline_col = ImGui.GetColorU32(tab_bar_focused and ImGuiCol.TabSelectedOverline or ImGuiCol.TabDimmedSelectedOverline) + local overline_col = ImGui.GetColorU32(tab_bar_focused and 38 --[[ImGuiCol.TabSelectedOverline]] or 41 --[[ImGuiCol.TabDimmedSelectedOverline]]) if style.TabRounding > 0.0 then local rounding = style.TabRounding display_draw_list:PathArcToFast(tl + ImVec2(rounding, rounding), rounding, 7, 9) @@ -58029,18 +58072,18 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) ImGui.RenderNavCursor(bb, id) -- Select with right mouse button. This is so the common idiom for context menu automatically highlight the current widget. - local hovered_unblocked = ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenBlockedByPopup) + local hovered_unblocked = ImGui.IsItemHovered(32 --[[ImGuiHoveredFlags.AllowWhenBlockedByPopup]]) if tab_bar.SelectedTabId ~= tab.ID and hovered_unblocked and (ImGui.IsMouseClicked(1) or ImGui.IsMouseReleased(1)) and not is_tab_button then ImGui.TabBarQueueFocus(tab_bar, tab) end - if bit32.band(tab_bar.Flags, ImGuiTabBarFlags.NoCloseWithMiddleMouseButton) ~= 0 then - flags = bit32.bor(flags, ImGuiTabItemFlags.NoCloseWithMiddleMouseButton) + if bit32.band(tab_bar.Flags, 8 --[[ImGuiTabBarFlags.NoCloseWithMiddleMouseButton]]) ~= 0 then + flags = bit32.bor(flags, 4 --[[ImGuiTabItemFlags.NoCloseWithMiddleMouseButton]]) end -- Render tab label, process close button local close_button_id = has_p_open and ImGui.GetIDWithSeed("#CLOSE", nil, docked_window and docked_window.ID or id) or 0 - local label_flags = tab_just_unsaved and bit32.band(flags, bit32.bnot(ImGuiTabItemFlags.UnsavedDocument)) or flags + local label_flags = tab_just_unsaved and bit32.band(flags, bit32.bnot(1 --[[ImGuiTabItemFlags.UnsavedDocument]])) or flags local just_closed, text_clipped = ImGui.TabItemLabelAndCloseButton(display_draw_list, bb, label_flags, tab_bar.FramePadding, label, id, close_button_id, tab_contents_visible) if just_closed and has_p_open then p_open = false @@ -58050,7 +58093,7 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) -- Forward Hovered state so IsItemHovered() after Begin() can work (even though we are technically hovering our parent) -- That state is copied to window.DockTabItemStatusFlags by our caller. if docked_window and (hovered or g.HoveredId == close_button_id) then - g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, ImGuiItemStatusFlags.HoveredWindow) + g.LastItemData.StatusFlags = bit32.bor(g.LastItemData.StatusFlags, 128 --[[ImGuiItemStatusFlags.HoveredWindow]]) end -- Tooltip @@ -58059,7 +58102,7 @@ function ImGui.TabItemEx(tab_bar, label, p_open, flags, docked_window) -- FIXME: This is a mess. -- FIXME: We may want disabled tab to still display the tooltip? if text_clipped and g.HoveredId == id and not held then - if bit32.band(tab_bar.Flags, ImGuiTabBarFlags.NoTooltip) == 0 and bit32.band(tab.Flags, ImGuiTabItemFlags.NoTooltip) == 0 then + if bit32.band(tab_bar.Flags, 32 --[[ImGuiTabBarFlags.NoTooltip]]) == 0 and bit32.band(tab.Flags, 16 --[[ImGuiTabItemFlags.NoTooltip]]) == 0 then local label_end = ImGui.FindRenderedTextEnd(label) ImGui.SetItemTooltip("%s", string.sub(label, 1, label_end - 1)) end @@ -58079,7 +58122,7 @@ end -- Tabs closed by the close button will automatically be flagged to avoid this issue. function ImGui.SetTabItemClosed(label) local g = ImGui.GetCurrentContext() - local is_within_manual_tab_bar = g.CurrentTabBar and bit32.band(g.CurrentTabBar.Flags, ImGuiTabBarFlags.DockNode) == 0 + local is_within_manual_tab_bar = g.CurrentTabBar and bit32.band(g.CurrentTabBar.Flags, 1048576 --[[ImGuiTabBarFlags.DockNode]]) == 0 if is_within_manual_tab_bar then local tab_bar = g.CurrentTabBar local tab_id = ImGui.TabBarCalcTabID(tab_bar, label, nil) @@ -58102,7 +58145,7 @@ end function ImGui.TabItemCalcSize(label, has_close_button_or_unsaved_marker) if type(label) == "table" then local window = label - return ImGui.TabItemCalcSize(window.Name, window.HasCloseButton or bit32.band(window.Flags, ImGuiWindowFlags.UnsavedDocument) ~= 0) + return ImGui.TabItemCalcSize(window.Name, window.HasCloseButton or bit32.band(window.Flags, 262144 --[[ImGuiWindowFlags.UnsavedDocument]]) ~= 0) end local g = ImGui.GetCurrentContext() local label_size = ImGui.CalcTextSize(label, nil, true) @@ -58119,17 +58162,17 @@ function ImGui.TabItemBackground(draw_list, bb, flags, col) -- While rendering tabs, we trim 1 pixel off the top of our bounding box so they can fit within a regular frame height while looking "detached" from it. local g = ImGui.GetCurrentContext() local width = bb:GetWidth() - IM_ASSERT(width > 0.0) - local rounding = ImMax(0.0, ImMin(bit32.band(flags, ImGuiTabItemFlags.Button) ~= 0 and g.Style.FrameRounding or g.Style.TabRounding, width * 0.5 - 1.0)) + assert(width > 0.0) + local rounding = ImMax(0.0, ImMin(bit32.band(flags, 2097152 --[[ImGuiTabItemFlags.Button]]) ~= 0 and g.Style.FrameRounding or g.Style.TabRounding, width * 0.5 - 1.0)) local y1 = bb.Min.y + 1.0 -- Leave a bit of room in title bars. local y2 = bb.Max.y - g.Style.TabBarBorderSize - draw_list:AddRectFilled(ImVec2(bb.Min.x, y1), ImVec2(bb.Max.x, y2), col, rounding, ImDrawFlags.RoundCornersTop) + draw_list:AddRectFilled(ImVec2(bb.Min.x, y1), ImVec2(bb.Max.x, y2), col, rounding, 48 --[[ImDrawFlags.RoundCornersTop]]) if g.Style.TabBorderSize > 0.0 then draw_list:PathLineTo(ImVec2(bb.Min.x, y2)) 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(ImGuiCol.Border), g.Style.TabBorderSize) + draw_list:PathStroke(ImGui.GetColorU32(5 --[[ImGuiCol.Border]]), g.Style.TabBorderSize) end end @@ -58171,10 +58214,10 @@ function ImGui.TabItemLabelAndCloseButton(draw_list, bb, flags, frame_padding, l end -- When tabs/document is unsaved, the unsaved marker takes priority over the close button. - local unsaved_marker_visible = bit32.band(flags, ImGuiTabItemFlags.UnsavedDocument) ~= 0 and (button_pos.x + button_sz <= bb.Max.x) and (not close_button_visible or not is_hovered) + local unsaved_marker_visible = bit32.band(flags, 1 --[[ImGuiTabItemFlags.UnsavedDocument]]) ~= 0 and (button_pos.x + button_sz <= bb.Max.x) and (not close_button_visible or not is_hovered) if unsaved_marker_visible then local bullet_pos = button_pos + ImVec2(button_sz, button_sz) * 0.5 - ImGui.RenderBullet(draw_list, bullet_pos, ImGui.GetColorU32(ImGuiCol.UnsavedMarker)) + ImGui.RenderBullet(draw_list, bullet_pos, ImGui.GetColorU32(58 --[[ImGuiCol.UnsavedMarker]])) elseif close_button_visible then local last_item_backup = ImGuiLastItemData() ImGuiLastItemData_Copy(last_item_backup, g.LastItemData) @@ -58182,7 +58225,7 @@ function ImGui.TabItemLabelAndCloseButton(draw_list, bb, flags, frame_padding, l ImGuiLastItemData_Copy(g.LastItemData, last_item_backup) -- Close with middle mouse button - if is_hovered and bit32.band(flags, ImGuiTabItemFlags.NoCloseWithMiddleMouseButton) == 0 and ImGui.IsMouseClicked(2) then + if is_hovered and bit32.band(flags, 4 --[[ImGuiTabItemFlags.NoCloseWithMiddleMouseButton]]) == 0 and ImGui.IsMouseClicked(2) then close_button_pressed = true end end @@ -59189,7 +59232,7 @@ end --- @nodiscard local function StbUndoState() local undo_rec = {} - for i = 1, IMSTB_TEXTEDIT_UNDOSTATECOUNT do + for i = 1, 99 --[[IMSTB_TEXTEDIT_UNDOSTATECOUNT]] do undo_rec[i] = StbUndoRecord() end @@ -59404,7 +59447,7 @@ function stb_text_locate_coord(str, x, y) -- if the last character is a newline, return that. otherwise return 'after' the last character out_side_on_line = true - if STB_TEXTEDIT_GETCHAR(str, i + r.num_chars - 1) == STB_TEXTEDIT_NEWLINE then + if STB_TEXTEDIT_GETCHAR(str, i + r.num_chars - 1) == 10 --[[STB_TEXTEDIT_NEWLINE]] then return i + r.num_chars - 1, out_side_on_line else return i + r.num_chars, out_side_on_line @@ -59436,7 +59479,7 @@ function stb_textedit_click(str, state, x, y) state.select_start = state.cursor state.select_end = state.cursor state.has_preferred_x = false - str.LastMoveDirectionLR = side_on_line and ImGuiDir.Right or ImGuiDir.Left + str.LastMoveDirectionLR = side_on_line and 1 --[[ImGuiDir.Right]] or 0 --[[ImGuiDir.Left]] end end @@ -59469,7 +59512,7 @@ function stb_textedit_drag(str, state, x, y) p, side_on_line = stb_text_locate_coord(str, x, y) state.cursor = p state.select_end = p - str.LastMoveDirectionLR = (side_on_line ~= false) and ImGuiDir.Right or ImGuiDir.Left + str.LastMoveDirectionLR = (side_on_line ~= false) and 1 --[[ImGuiDir.Right]] or 0 --[[ImGuiDir.Left]] end end @@ -59551,10 +59594,10 @@ function stb_textedit_find_charpos(find, str, n, single_line) if n < i + r.num_chars - 1 then break end - if str.LastMoveDirectionLR == ImGuiDir.Right and str.Stb.cursor > 1 and str.Stb.cursor == i + r.num_chars and STB_TEXTEDIT_GETCHAR(str, i + r.num_chars - 1) ~= STB_TEXTEDIT_NEWLINE then -- [DEAR IMGUI] Wrapping point handling + if str.LastMoveDirectionLR == 1 --[[ImGuiDir.Right]] and str.Stb.cursor > 1 and str.Stb.cursor == i + r.num_chars and STB_TEXTEDIT_GETCHAR(str, i + r.num_chars - 1) ~= 10 --[[STB_TEXTEDIT_NEWLINE]] then -- [DEAR IMGUI] Wrapping point handling break end - if (i - 1) + r.num_chars == z and z > 0 and STB_TEXTEDIT_GETCHAR(str, z) ~= STB_TEXTEDIT_NEWLINE then -- [DEAR IMGUI] special handling for last line + if (i - 1) + r.num_chars == z and z > 0 and STB_TEXTEDIT_GETCHAR(str, z) ~= 10 --[[STB_TEXTEDIT_NEWLINE]] then -- [DEAR IMGUI] special handling for last line break -- [DEAR IMGUI] end prev_start = i @@ -59717,7 +59760,7 @@ end --- @param text_len int local function stb_textedit_text(str, state, text, text_len) -- can't add newline in single-line mode - if text[1] == STB_TEXTEDIT_NEWLINE and state.single_line then + if text[1] == 10 --[[STB_TEXTEDIT_NEWLINE]] and state.single_line then return end @@ -59750,13 +59793,13 @@ local row = StbTexteditRow() --- @param state STB_TexteditState --- @param key STB_TEXTEDIT_KEYTYPE function stb_textedit_key(str, state, key) - if key == STB_TEXTEDIT_K_UNDO then + if key == 2097162 --[[STB_TEXTEDIT_K_UNDO]] then stb_text_undo(str, state) state.has_preferred_x = false - elseif key == STB_TEXTEDIT_K_REDO then + elseif key == 2097163 --[[STB_TEXTEDIT_K_REDO]] then stb_text_redo(str, state) state.has_preferred_x = false - elseif key == STB_TEXTEDIT_K_LEFT then + elseif key == 2097152 --[[STB_TEXTEDIT_K_LEFT]] then -- if currently there's a selection, move cursor to start of selection if STB_TEXT_HAS_SELECTION(state) then stb_textedit_move_to_first(state) @@ -59767,7 +59810,7 @@ function stb_textedit_key(str, state, key) end state.has_preferred_x = false - elseif key == STB_TEXTEDIT_K_RIGHT then + elseif key == 2097153 --[[STB_TEXTEDIT_K_RIGHT]] then -- if currently there's a selection, move cursor to end of selection if STB_TEXT_HAS_SELECTION(state) then stb_textedit_move_to_last(str, state) @@ -59777,7 +59820,7 @@ function stb_textedit_key(str, state, key) stb_textedit_clamp(str, state) state.has_preferred_x = false - elseif key == bit32.bor(STB_TEXTEDIT_K_LEFT, STB_TEXTEDIT_K_SHIFT) then + elseif key == bit32.bor(2097152 --[[STB_TEXTEDIT_K_LEFT]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then stb_textedit_clamp(str, state) stb_textedit_prep_selection_at_cursor(state) -- move selection left @@ -59786,7 +59829,7 @@ function stb_textedit_key(str, state, key) end state.cursor = state.select_end state.has_preferred_x = false - elseif key == STB_TEXTEDIT_K_WORDLEFT then + elseif key == 2097164 --[[STB_TEXTEDIT_K_WORDLEFT]] then -- if currently there's a selection, move cursor to start of selection if STB_TEXT_HAS_SELECTION(state) then stb_textedit_move_to_first(state) @@ -59794,7 +59837,7 @@ function stb_textedit_key(str, state, key) state.cursor = STB_TEXTEDIT_MOVEWORDLEFT(str, state.cursor) stb_textedit_clamp(str, state) end - elseif key == bit32.bor(STB_TEXTEDIT_K_WORDLEFT, STB_TEXTEDIT_K_SHIFT) then + elseif key == bit32.bor(2097164 --[[STB_TEXTEDIT_K_WORDLEFT]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then if not STB_TEXT_HAS_SELECTION(state) then stb_textedit_prep_selection_at_cursor(state) end @@ -59803,7 +59846,7 @@ function stb_textedit_key(str, state, key) state.select_end = state.cursor stb_textedit_clamp(str, state) - elseif key == STB_TEXTEDIT_K_WORDRIGHT then + elseif key == 2097165 --[[STB_TEXTEDIT_K_WORDRIGHT]] then -- if currently there's a selection, move cursor to end of selection if STB_TEXT_HAS_SELECTION(state) then stb_textedit_move_to_last(str, state) @@ -59811,7 +59854,7 @@ function stb_textedit_key(str, state, key) state.cursor = STB_TEXTEDIT_MOVEWORDRIGHT(str, state.cursor) stb_textedit_clamp(str, state) end - elseif key == bit32.bor(STB_TEXTEDIT_K_WORDRIGHT, STB_TEXTEDIT_K_SHIFT) then + elseif key == bit32.bor(2097165 --[[STB_TEXTEDIT_K_WORDRIGHT]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then if not STB_TEXT_HAS_SELECTION(state) then stb_textedit_prep_selection_at_cursor(state) end @@ -59820,27 +59863,27 @@ function stb_textedit_key(str, state, key) state.select_end = state.cursor stb_textedit_clamp(str, state) - elseif key == bit32.bor(STB_TEXTEDIT_K_RIGHT, STB_TEXTEDIT_K_SHIFT) then + elseif key == bit32.bor(2097153 --[[STB_TEXTEDIT_K_RIGHT]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then stb_textedit_prep_selection_at_cursor(state) -- move selection right state.select_end = IMSTB_TEXTEDIT_GETNEXTCHARINDEX(str, state.select_end) stb_textedit_clamp(str, state) state.cursor = state.select_end state.has_preferred_x = false - elseif key == STB_TEXTEDIT_K_DOWN - or key == bit32.bor(STB_TEXTEDIT_K_DOWN, STB_TEXTEDIT_K_SHIFT) - or key == STB_TEXTEDIT_K_PGDOWN - or key == bit32.bor(STB_TEXTEDIT_K_PGDOWN, STB_TEXTEDIT_K_SHIFT) then + elseif key == 2097155 --[[STB_TEXTEDIT_K_DOWN]] + or key == bit32.bor(2097155 --[[STB_TEXTEDIT_K_DOWN]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) + or key == 2097167 --[[STB_TEXTEDIT_K_PGDOWN]] + or key == bit32.bor(2097167 --[[STB_TEXTEDIT_K_PGDOWN]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then StbFindState_Reset(find) StbTexteditRow_Reset(row) - local sel = (bit32.band(key, STB_TEXTEDIT_K_SHIFT) ~= 0) - local is_page = (bit32.band(key, bit32.bnot(STB_TEXTEDIT_K_SHIFT)) == STB_TEXTEDIT_K_PGDOWN) + local sel = (bit32.band(key, 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) ~= 0) + local is_page = (bit32.band(key, bit32.bnot(4194304 --[[STB_TEXTEDIT_K_SHIFT]])) == 2097167 --[[STB_TEXTEDIT_K_PGDOWN]]) local row_count = is_page and state.row_count_per_page or 1 if not is_page and state.single_line then -- on windows, up&down in single-line behave like left&right - key = bit32.bor(STB_TEXTEDIT_K_RIGHT, bit32.band(key, STB_TEXTEDIT_K_SHIFT)) + key = bit32.bor(2097153 --[[STB_TEXTEDIT_K_RIGHT]], bit32.band(key, 4194304 --[[STB_TEXTEDIT_K_SHIFT]])) return stb_textedit_key(str, state, key) -- was `goto retry` end @@ -59887,7 +59930,7 @@ function stb_textedit_key(str, state, key) stb_textedit_clamp(str, state) if state.cursor == find.first_char + find.length then - str.LastMoveDirectionLR = ImGuiDir.Left + str.LastMoveDirectionLR = 0 --[[ImGuiDir.Left]] end state.has_preferred_x = true state.preferred_x = goal_x @@ -59900,20 +59943,20 @@ function stb_textedit_key(str, state, key) find.first_char = find.first_char + find.length find.length = row.num_chars end - elseif key == STB_TEXTEDIT_K_UP - or key == bit32.bor(STB_TEXTEDIT_K_UP, STB_TEXTEDIT_K_SHIFT) - or key == STB_TEXTEDIT_K_PGUP - or key == bit32.bor(STB_TEXTEDIT_K_PGUP, STB_TEXTEDIT_K_SHIFT) then + elseif key == 2097154 --[[STB_TEXTEDIT_K_UP]] + or key == bit32.bor(2097154 --[[STB_TEXTEDIT_K_UP]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) + or key == 2097166 --[[STB_TEXTEDIT_K_PGUP]] + or key == bit32.bor(2097166 --[[STB_TEXTEDIT_K_PGUP]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then StbFindState_Reset(find) StbTexteditRow_Reset(row) - local sel = (bit32.band(key, STB_TEXTEDIT_K_SHIFT) ~= 0) - local is_page = (bit32.band(key, bit32.bnot(STB_TEXTEDIT_K_SHIFT)) == STB_TEXTEDIT_K_PGUP) + local sel = (bit32.band(key, 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) ~= 0) + local is_page = (bit32.band(key, bit32.bnot(4194304 --[[STB_TEXTEDIT_K_SHIFT]])) == 2097166 --[[STB_TEXTEDIT_K_PGUP]]) local row_count = is_page and state.row_count_per_page or 1 if not is_page and state.single_line then -- on windows, up&down become left&right - key = bit32.bor(STB_TEXTEDIT_K_LEFT, bit32.band(key, STB_TEXTEDIT_K_SHIFT)) + key = bit32.bor(2097152 --[[STB_TEXTEDIT_K_LEFT]], bit32.band(key, 4194304 --[[STB_TEXTEDIT_K_SHIFT]])) return stb_textedit_key(str, state, key) -- was `goto retry` end @@ -59959,9 +60002,9 @@ function stb_textedit_key(str, state, key) stb_textedit_clamp(str, state) if state.cursor == find.first_char then - str.LastMoveDirectionLR = ImGuiDir.Right + str.LastMoveDirectionLR = 1 --[[ImGuiDir.Right]] elseif state.cursor == find.prev_first then - str.LastMoveDirectionLR = ImGuiDir.Left + str.LastMoveDirectionLR = 0 --[[ImGuiDir.Left]] end state.has_preferred_x = true state.preferred_x = goal_x @@ -59975,7 +60018,7 @@ function stb_textedit_key(str, state, key) local prev_scan = find.prev_first > 1 and find.prev_first - 1 or 1 while prev_scan > 1 do local prev = IMSTB_TEXTEDIT_GETPREVCHARINDEX(str, prev_scan) - if STB_TEXTEDIT_GETCHAR(str, prev) == STB_TEXTEDIT_NEWLINE then + if STB_TEXTEDIT_GETCHAR(str, prev) == 10 --[[STB_TEXTEDIT_NEWLINE]] then break end prev_scan = prev @@ -59983,8 +60026,8 @@ function stb_textedit_key(str, state, key) find.first_char = find.prev_first find.prev_first = STB_TEXTEDIT_MOVELINESTART(str, state, prev_scan) end - elseif key == STB_TEXTEDIT_K_DELETE - or key == bit32.bor(STB_TEXTEDIT_K_DELETE, STB_TEXTEDIT_K_SHIFT) then + elseif key == 2097160 --[[STB_TEXTEDIT_K_DELETE]] + or key == bit32.bor(2097160 --[[STB_TEXTEDIT_K_DELETE]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then if STB_TEXT_HAS_SELECTION(state) then stb_textedit_delete_selection(str, state) @@ -59995,8 +60038,8 @@ function stb_textedit_key(str, state, key) end end state.has_preferred_x = false - elseif key == STB_TEXTEDIT_K_BACKSPACE - or key == bit32.bor(STB_TEXTEDIT_K_BACKSPACE, STB_TEXTEDIT_K_SHIFT) then + elseif key == 2097161 --[[STB_TEXTEDIT_K_BACKSPACE]] + or key == bit32.bor(2097161 --[[STB_TEXTEDIT_K_BACKSPACE]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then if STB_TEXT_HAS_SELECTION(state) then stb_textedit_delete_selection(str, state) @@ -60009,43 +60052,43 @@ function stb_textedit_key(str, state, key) end end state.has_preferred_x = false - elseif key == STB_TEXTEDIT_K_TEXTSTART then + elseif key == 2097158 --[[STB_TEXTEDIT_K_TEXTSTART]] then state.cursor = 1 state.select_start = 1 state.select_end = 1 state.has_preferred_x = false - elseif key == STB_TEXTEDIT_K_TEXTEND then + elseif key == 2097159 --[[STB_TEXTEDIT_K_TEXTEND]] then state.cursor = STB_TEXTEDIT_STRINGLEN(str) + 1 state.select_start = 1 state.select_end = 1 state.has_preferred_x = false - elseif key == bit32.bor(STB_TEXTEDIT_K_TEXTSTART, STB_TEXTEDIT_K_SHIFT) then + elseif key == bit32.bor(2097158 --[[STB_TEXTEDIT_K_TEXTSTART]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then stb_textedit_prep_selection_at_cursor(state) state.cursor = 1 state.select_end = 1 state.has_preferred_x = false - elseif key == bit32.bor(STB_TEXTEDIT_K_TEXTEND, STB_TEXTEDIT_K_SHIFT) then + elseif key == bit32.bor(2097159 --[[STB_TEXTEDIT_K_TEXTEND]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then stb_textedit_prep_selection_at_cursor(state) state.cursor = STB_TEXTEDIT_STRINGLEN(str) + 1 state.select_end = state.cursor state.has_preferred_x = false - elseif key == STB_TEXTEDIT_K_LINESTART then + elseif key == 2097156 --[[STB_TEXTEDIT_K_LINESTART]] then stb_textedit_clamp(str, state) stb_textedit_move_to_first(state) state.cursor = STB_TEXTEDIT_MOVELINESTART(str, state, state.cursor) state.has_preferred_x = false - elseif key == STB_TEXTEDIT_K_LINEEND then + elseif key == 2097157 --[[STB_TEXTEDIT_K_LINEEND]] then stb_textedit_clamp(str, state) stb_textedit_move_to_last(str, state) state.cursor = STB_TEXTEDIT_MOVELINEEND(str, state, state.cursor) state.has_preferred_x = false - elseif key == bit32.bor(STB_TEXTEDIT_K_LINESTART, STB_TEXTEDIT_K_SHIFT) then + elseif key == bit32.bor(2097156 --[[STB_TEXTEDIT_K_LINESTART]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then stb_textedit_clamp(str, state) stb_textedit_prep_selection_at_cursor(state) state.cursor = STB_TEXTEDIT_MOVELINESTART(str, state, state.cursor) state.select_end = state.cursor state.has_preferred_x = false - elseif key == bit32.bor(STB_TEXTEDIT_K_LINEEND, STB_TEXTEDIT_K_SHIFT) then + elseif key == bit32.bor(2097157 --[[STB_TEXTEDIT_K_LINEEND]], 4194304 --[[STB_TEXTEDIT_K_SHIFT]]) then stb_textedit_clamp(str, state) stb_textedit_prep_selection_at_cursor(state) state.cursor = STB_TEXTEDIT_MOVELINEEND(str, state, state.cursor) @@ -60065,7 +60108,7 @@ end --- @param state StbUndoState local function stb_textedit_flush_redo(state) - state.redo_point = IMSTB_TEXTEDIT_UNDOSTATECOUNT + 1 + state.redo_point = 99 --[[IMSTB_TEXTEDIT_UNDOSTATECOUNT]] + 1 state.redo_char_point = IMSTB_TEXTEDIT_UNDOCHARCOUNT + 1 end @@ -60096,7 +60139,7 @@ end -- fill up even though the undo buffer didn't --- @param state StbUndoState local function stb_textedit_discard_redo(state) - local k = IMSTB_TEXTEDIT_UNDOSTATECOUNT + local k = 99 --[[IMSTB_TEXTEDIT_UNDOSTATECOUNT]] if state.redo_point <= k then -- if the k'th undo state has characters, clean those up @@ -60115,7 +60158,7 @@ local function stb_textedit_discard_redo(state) -- now move all the redo records towards the end of the buffer; the first one is at 'redo_point' -- [DEAR IMGUI] - local move_size = IMSTB_TEXTEDIT_UNDOSTATECOUNT - state.redo_point - 1 + local move_size = 99 --[[IMSTB_TEXTEDIT_UNDOSTATECOUNT]] - state.redo_point - 1 IMSTB_TEXTEDIT_memmove(state.undo_rec, state.redo_point + 1, state.undo_rec, state.redo_point, move_size) -- now move redo_point to point to the new one @@ -60131,7 +60174,7 @@ local function stb_text_create_undo_record(state, numchars) -- if we have no free records, we have to make room, by sliding the -- existing records down - if state.undo_point == IMSTB_TEXTEDIT_UNDOSTATECOUNT then + if state.undo_point == 99 --[[IMSTB_TEXTEDIT_UNDOSTATECOUNT]] then stb_textedit_discard_undo(state) end @@ -60213,7 +60256,7 @@ function stb_text_undo(str, state) -- there's definitely room to store the characters eventually while s.undo_char_point + u.delete_length > s.redo_char_point do -- should never happen: - if s.redo_point == IMSTB_TEXTEDIT_UNDOSTATECOUNT + 1 then + if s.redo_point == 99 --[[IMSTB_TEXTEDIT_UNDOSTATECOUNT]] + 1 then return end @@ -60252,7 +60295,7 @@ end --- @param state STB_TexteditState function stb_text_redo(str, state) local s = state.undostate - if s.undo_point == IMSTB_TEXTEDIT_UNDOSTATECOUNT + 1 then + if s.undo_point == 99 --[[IMSTB_TEXTEDIT_UNDOSTATECOUNT]] + 1 then return end @@ -60342,7 +60385,7 @@ end local function stb_textedit_clear_state(state, is_single_line) state.undostate.undo_point = 1 state.undostate.undo_char_point = 1 - state.undostate.redo_point = IMSTB_TEXTEDIT_UNDOSTATECOUNT + 1 + state.undostate.redo_point = 99 --[[IMSTB_TEXTEDIT_UNDOSTATECOUNT]] + 1 state.undostate.redo_char_point = IMSTB_TEXTEDIT_UNDOCHARCOUNT + 1 state.select_end = 1 state.select_start = 1 @@ -63246,8 +63289,8 @@ end -- we force this behavior by default local function clamp_if_overflow(spec, val) if spec == CHAR_d or spec == CHAR_x or spec == CHAR_X then - if val > INT_MAX then return INT_MAX end - if val < INT_MIN then return INT_MIN end + if val > 2147483647 --[[INT_MAX]] then return 2147483647 --[[INT_MAX]] end + if val < (-2147483648) --[[INT_MIN]] then return (-2147483648) --[[INT_MIN]] end end return val diff --git a/imgui_h.lua b/imgui_h.lua index 58c4126..3018c9f 100644 --- a/imgui_h.lua +++ b/imgui_h.lua @@ -30,7 +30,7 @@ --- @meta -local type = ImGui._GetTypeFunc() +local type = type -- [Luau] builtin (FASTCALL); ImGui._GetTypeFunc() kept for compatibility local rawget = rawget; local rawset = rawset -- [LuaBitOp](https://bitop.luajit.org/semantics.html) @@ -2130,7 +2130,8 @@ IM_COL32_A_MASK = 0xFF000000 --- @param G ImU32 --- @param B ImU32 --- @param A ImU32 -IM_COL32 = function(R, G, B, A) return (bitOr(bitLShift(A, IM_COL32_A_SHIFT), bitLShift(B, IM_COL32_B_SHIFT), bitLShift(G, IM_COL32_G_SHIFT), bitLShift(R, IM_COL32_R_SHIFT))) end +--@hoist +function IM_COL32(R, G, B, A) return (bitOr(bitLShift(A, IM_COL32_A_SHIFT), bitLShift(B, IM_COL32_B_SHIFT), bitLShift(G, IM_COL32_G_SHIFT), bitLShift(R, IM_COL32_R_SHIFT))) end IM_COL32_WHITE = IM_COL32(255, 255, 255, 255) IM_COL32_BLACK = IM_COL32(0, 0, 0, 255) IM_COL32_BLACK_TRANS = IM_COL32(0, 0, 0, 0) diff --git a/imgui_internal.lua b/imgui_internal.lua index 1204c46..05e2f0d 100644 --- a/imgui_internal.lua +++ b/imgui_internal.lua @@ -30,7 +30,7 @@ --- @meta -local type = ImGui._GetTypeFunc() +local type = type -- [Luau] builtin (FASTCALL); ImGui._GetTypeFunc() kept for compatibility local rawget = rawget local mathMin = math.min; local mathMax = math.max @@ -189,6 +189,7 @@ end -- - ImMin/ImMax/ImClamp/ImLerp/ImSwap are used by widgets which support variety of types: signed/unsigned int/long long float/double --- @overload fun(lhs: number, rhs: number): number --- @overload fun(lhs: ImVec2, rhs: ImVec2): ImVec2 +--@hoist @native function ImMin(lhs, rhs) if type(lhs) == "number" then return mathMin(lhs, rhs) end @@ -197,6 +198,7 @@ end --- @overload fun(lhs: number, rhs: number): number --- @overload fun(lhs: ImVec2, rhs: ImVec2): ImVec2 +--@hoist @native function ImMax(lhs, rhs) if type(lhs) == "number" then return mathMax(lhs, rhs) end @@ -211,6 +213,7 @@ ImStd.ImQsort = function(base, count, cmp_func) if count > 0 then t_sort(base, c --- @overload fun(v: number, mn: number, mx: number): number --- @overload fun(v: ImVec2, mn: ImVec2, mx: ImVec2): ImVec2 +--@hoist @native function ImClamp(v, mn, mx) if type(v) == "number" and type(mn) == "number" and type(mx) == "number" then return mathMin(mathMax(v, mn), mx) @@ -221,6 +224,7 @@ end --- @overload fun(a: number, b: number, t: number): number --- @overload fun(a: ImVec2, b: ImVec2, t: number): ImVec2 --- @overload fun(a: ImVec2, b: ImVec2, t: ImVec2): ImVec2 +--@hoist @native function ImLerp(a, b, t) if type(a) == "number" and type(b) == "number" and type(t) == "number" then return ((a) + ((b) - (a)) * (t)) @@ -229,10 +233,12 @@ function ImLerp(a, b, t) end end +--@hoist local function _Trunc(val) if val >= 0 then return mathFloor(val) else return mathCeil(val) end end --- @overload fun(v: float): float --- @overload fun(v: ImVec2): ImVec2 +--@hoist function ImTrunc(v) if type(v) == "number" then return _Trunc(v) elseif type(v) == "table" then return ImVec2(_Trunc(v.x), _Trunc(v.y)) @@ -256,6 +262,7 @@ function ImRsqrt(x) return (1 / ImSqrt(x)) end function IM_TRUNC(VAL) return math.floor(VAL) end -- Positive values only! function IM_ROUND(VAL) return math.floor(VAL + 0.5) end -- Positive values only! +--@hoist function ImFloor(f) if f >= 0 or math.floor(f) == f then return math.floor(f) else return math.floor(f) - 1 end end -- Decent replacement for floorf() -- Helpers: Bit manipulation @@ -376,6 +383,7 @@ function ImStd.strncmp(str1, str2, max_count) return 0 end +--@hoist function ImSaturate(f) return ((f < 0.0 and 0.0) or (f > 1.0 and 1.0) or f) end IM_F32_TO_INT8_UNBOUND = function(val) return math.floor(val * 255.0 + (val >= 0 and 0.5 or -0.5)) end -- Unsaturated, for display purpose diff --git a/tools/bundle.py b/tools/bundle.py index 9b196a0..8e74223 100644 --- a/tools/bundle.py +++ b/tools/bundle.py @@ -7,15 +7,34 @@ # Each source file becomes a function in __FILES; IM_INCLUDE(name) runs it once and caches the result. # The module returns a table with every global the library defines (ImGui, ImVec2, ImGuiConfigFlags, ImGui_ImplRoblox, ...). # Roblox target also writes ImGuiTyped.luau (types + require(script.Impl), see tools/gen_types.py). -import os, re +# +# Build-time optimizations (token rewrites with minify.py's lexer: strings/comments are never touched, every source line +# stays on its line so linemap.json still maps errors). IMGUI_BUNDLE_NOOPT=1 turns all off, IMGUI_BUNDLE_NO_=1 one: +# A hot library globals (most referenced names assigned at a file's top level) become bundle-level locals declared +# before __FILES: every file's assignment/reference then hits an upvalue instead of GETGLOBAL. Fewer names for +# LuaJIT (60 upvalues per function). Library globals can't be patched from outside (use the returned table). +# B enum folding: the bundle is loaded once headless (Luau CLI) to dump enum-like tables (all values numbers, never +# written inside a function) and numeric constants assigned once at top level; reads `ImGuiCol.Text` / `FLT_MAX` +# inside function bodies become `0 --[[ImGuiCol.Text]]`. Load-time (top-level) code is left alone. +# C `--@hoist` functions in the sources (pure numeric helpers: ImMin, ImMax, ImClamp, ...) are moved to the bundle top +# as `local function`s (their source lines become blank) so Luau -O2 can inline them everywhere. +# E statement-form `IM_ASSERT(...)` becomes `assert(...)` (fast builtin); expression uses are left alone. +import os, re, sys, json, shutil, subprocess, tempfile + +HERE = os.path.dirname(os.path.abspath(__file__)) +ROOT = os.path.dirname(HERE) +sys.path.insert(0, HERE) +from minify import TOKEN -ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -import sys NO_DEMO = "--no-demo" in sys.argv LOVE = False if "--target" in sys.argv: i = sys.argv.index("--target"); LOVE = sys.argv[i + 1] == "love"; del sys.argv[i:i + 2] sys.argv = [a for a in sys.argv if a != "--no-demo"] +OPT = {x: os.environ.get("IMGUI_BUNDLE_NOOPT") != "1" and os.environ.get("IMGUI_BUNDLE_NO_" + x) != "1" for x in "ABCE"} +# A limits: Luau 200 locals in the main chunk (+ helpers, __FILES, ...), 200 upvalues per function; LuaJIT 60 upvalues +# per function (margin left for nested functions that also capture file locals) +MAX_LOCALS, MAX_UPVALUES = 160, (45 if LOVE else 150) BACKEND = "imgui_impl_love.lua" if LOVE else "imgui_impl_roblox.lua" SKIP = {"imgui_impl_roblox.lua", "imgui_impl_roblox_fonts.lua"} if LOVE else {"imgui_impl_love.lua"} FILES = {} @@ -26,6 +45,7 @@ for d in (ROOT, os.path.join(ROOT, "backends"), os.path.join(ROOT, "fonts")): if LOVE: src = re.sub(r"^@native$", "", src, flags=re.M) # keep line numbers FILES[f] = src +ORIG = dict(FILES) # for gen_types ENTRY = ["imgui.lua", BACKEND] + ([] if NO_DEMO else ["imgui_demo.lua"]) # run order names = set() @@ -33,16 +53,207 @@ for src in FILES.values(): names.update(re.findall(r"^function ([A-Za-z_]\w*)\s*\(", src, re.M)) names.update(re.findall(r"^([A-Za-z_]\w*)\s*=[^=]", src, re.M)) +# ---- lexer helpers ---- +KW = set("and break do else elseif end false for function goto if in local nil not or repeat return then true until while".split()) + +def lex(src): + """[(kind, text, start)] without whitespace/comments; kinds: name num str op.""" + toks, pos = [], 0 + while pos < len(src): + m = TOKEN.match(src, pos) + k = m.lastgroup + if k in ("ceq", "seq"): k = "lcom" if m.group(0).startswith("--") else "lstr" + if k not in ("ws", "lcom", "com"): toks.append(("str" if k == "lstr" else k, m.group(0), pos)) + pos = m.end() + return toks + +def fdepths(toks): + """function nesting depth of every token (0 = runs at load time)""" + st, fd, out = [], 0, [] + for k, t, _ in toks: + out.append(fd) + if k == "name": + if t == "function": st.append(1); fd += 1 + elif t in ("if", "do", "repeat"): st.append(0) + elif t in ("end", "until"): fd -= st.pop() + assert not st, "unbalanced blocks" + return out + +def declared(toks): + """names declared as locals / parameters / loop variables anywhere""" + out, n = set(), len(toks) + for i, (k, t, _) in enumerate(toks): + j = None + if t == "local": j = i + 2 if toks[i + 1][1] == "function" else i + 1 + elif t == "for": j = i + 1 + elif t == "function": + j = i + 1 + while toks[j][1] != "(": j += 1 + j += 1 + while j is not None and j < n and toks[j][0] == "name" and toks[j][1] not in KW: + out.add(toks[j][1]) + j += 1 + if j < n and toks[j][1] == ",": j += 1 + else: break + return out + +def apply(src, edits): + for s, e, r in sorted(edits, reverse=True): src = src[:s] + r + src[e:] + return src + +def isref(toks, i): + """toks[i] is a variable read/write (not a field name)""" + return toks[i][0] == "name" and (i == 0 or toks[i - 1][1] not in (".", ":")) + +def nexttext(toks, i): return toks[i + 1][1] if i + 1 < len(toks) else "" + +# ---- C: --@hoist helpers ---- +hoisted, hoisted_names = [], [] +if OPT["C"]: + for f, src in FILES.items(): + while "--@hoist\n" in src: + s = src.index("--@hoist\n") + len("--@hoist\n") + toks = lex(src[s:]) + depth, i = 0, 0 + while True: # first `function` ... matching end + t = toks[i][1] + if t == "function" or t in ("if", "do", "repeat"): depth += 1 + elif t in ("end", "until"): + depth -= 1 + if depth == 0: break + i += 1 + e = s + toks[i][2] + 3 + text = src[s:e] + m = re.search(r"^(local )?function ([A-Za-z_]\w*)", text, re.M) + hoisted_names.append(m.group(2)) + hoisted.append(text[:m.start()] + "local function " + text[m.start() + len(m.group(0)) - len(m.group(2)):]) + src = src[:s - len("--@hoist\n")] + "\n" + re.sub(r"[^\n]", "", text) + src[e:] + FILES[f] = src +HOIST_DEPS = "local type, mathMin, mathMax, mathFloor, mathCeil, bitOr, bitLShift = type, math.min, math.max, math.floor, math.ceil, bit32.bor, bit32.lshift" + +# ---- E: statement IM_ASSERT -> assert ---- +STMT_PREV_KW = {"end", "true", "false", "nil", "break", "then", "do", "else", "repeat"} +def rewrite_assert(src): + toks, edits = lex(src), [] + for i, (k, t, p) in enumerate(toks): + if t == "IM_ASSERT" and isref(toks, i) and nexttext(toks, i) == "(": + pk, pt = (toks[i - 1][0], toks[i - 1][1]) if i else ("op", ";") + if (pk == "name" and (pt not in KW or pt in STMT_PREV_KW)) or pk in ("num", "str") or pt in (")", "]", "}", ";", "..."): + edits.append((p, p + len(t), "assert")) + return apply(src, edits) + +if OPT["E"]: + FILES = {f: rewrite_assert(s) for f, s in FILES.items()} + hoisted = [rewrite_assert(s) for s in hoisted] + +# ---- B: enum / constant folding ---- +LUAU = shutil.which("luau") or "/nix/store/2m2ja613nndihc8qm10f2rhq6znp1nh4-luau-0.734/bin/luau" + +def header(): + return ["local __FILES, __LOADED = {}, {}", + "function IM_INCLUDE(name)", + " local r = __LOADED[name]", + " if r == nil then r = __FILES[name](); if r == nil then r = true end; __LOADED[name] = r end", + " return r", + "end", ""] + +def numtext(s): + v = float(s) + if v != v or v in (float("inf"), float("-inf")) or (v == 0 and s.startswith("-")): return None + r = str(int(v)) if v.is_integer() and abs(v) < 2 ** 53 else repr(v) + return "(%s)" % r if v < 0 else r + +def dump_values(): + """{name: number} and {name: {key: number}} of the loaded library (imgui.lua and what it includes)""" + src = ["--!optimize 1"] + ([HOIST_DEPS] + hoisted if hoisted else []) + header() + for name, s in sorted(FILES.items()): src += ["__FILES[%r] = function()" % name, s, "end"] + src += ['IM_INCLUDE("imgui.lua")', + 'local function D(n, v) if type(v) == "number" then print("C", n, string.format("%.17g", v)) elseif type(v) == "table" then', + ' for k, x in pairs(v) do print("T", n, type(k) == "string" and k or "?", type(x) == "number" and string.format("%.17g", x) or "?") end end end'] + src += ["D(%r, %s)" % (n, n) for n in sorted(names)] + with tempfile.NamedTemporaryFile("w", suffix=".luau", delete=False) as fp: fp.write("\n".join(src)) + try: + p = subprocess.run([LUAU, fp.name], capture_output=True, text=True, timeout=60) + finally: + os.unlink(fp.name) + if p.returncode: raise RuntimeError("enum dump failed:\n" + p.stdout[-2000:] + p.stderr[-2000:]) + consts, tables = {}, {} + for line in p.stdout.splitlines(): + a = line.split("\t") + if a[0] == "C": consts[a[1]] = a[2] + elif a[0] == "T": tables.setdefault(a[1], {})[a[2]] = a[3] + tables = {n: t for n, t in tables.items() if "?" not in t and "?" not in t.values()} + return consts, tables + +def fold(files): + consts, tables = dump_values() + lexed = {f: lex(s) for f, s in files.items()} + depth = {f: fdepths(t) for f, t in lexed.items()} + # tables written inside a function, constants assigned more than once or not at top level: not foldable + assigns = {} + for f, toks in lexed.items(): + for i, (k, t, _) in enumerate(toks): + if not isref(toks, i): continue + if t in tables and depth[f][i] > 0: + j = i + 1 + if nexttext(toks, i) == ".": j = i + 3 + elif nexttext(toks, i) == "[": + b = 0 + while True: + b += {"[": 1, "]": -1}.get(toks[j][1], 0); j += 1 + if b == 0: break + if j < len(toks) and toks[j][1] == "=": tables.pop(t, None) + if t in consts and nexttext(toks, i) == "=": + assigns[t] = assigns.get(t, 0) + (1 if depth[f][i] == 0 else 2) + consts = {n: v for n, v in consts.items() if assigns.get(n) == 1 and numtext(v)} + out = {} + for f, toks in lexed.items(): + shadow = declared(toks) + edits = [] + for i, (k, t, p) in enumerate(toks): + if depth[f][i] == 0 or not isref(toks, i) or t in shadow: continue + if t in tables and nexttext(toks, i) == "." and i + 2 < len(toks): + key = toks[i + 2][1] + if key in tables[t] and numtext(tables[t][key]) and nexttext(toks, i + 2) not in ("=", ".", ":", "[", "(", "{") and toks[i + 3][0] != "str": + edits.append((p, toks[i + 2][2] + len(key), "%s --[[%s.%s]]" % (numtext(tables[t][key]), t, key))) + elif t in consts and nexttext(toks, i) not in ("=", ".", ":", "[", "(", "{") and toks[i + 1][0] != "str": + edits.append((p, p + len(t), "%s --[[%s]]" % (numtext(consts[t]), t))) + out[f] = apply(files[f], edits) + return out + +if OPT["B"]: + try: + allf = dict(FILES); allf.update({"@hoist%d" % i: "local function __h()\n" + s + "\nend" for i, s in enumerate(hoisted)}) + allf = fold(allf) + hoisted = [allf.pop("@hoist%d" % i)[len("local function __h()\n"):-len("\nend")] for i in range(len(hoisted))] + FILES = allf + except (OSError, RuntimeError) as e: + if os.environ.get("IMGUI_BUNDLE_STRICT"): raise # CI: a release must not silently lose the folding + print("bundle.py: enum folding skipped (%s)" % str(e).strip()[:300], file=sys.stderr) + +# ---- A: hot globals -> bundle locals ---- +hot = [] +if OPT["A"]: + count, used = {}, [] + for src in FILES.values(): + toks = lex(src) + used.append({t for i, (k, t, _) in enumerate(toks) if isref(toks, i)}) + for i, (k, t, _) in enumerate(toks): + if t in names and isref(toks, i): count[t] = count.get(t, 0) + 1 + # greedy by reference count; each file function's upvalues (hoisted names it uses) stay <= MAX_UPVALUES + taken = [len(u & set(hoisted_names + re.findall(r"\w+", HOIST_DEPS.split("=")[0]))) for u in used] + for n in sorted((n for n in count if n not in hoisted_names), key=lambda n: (-count[n], n)): + if len(hot) == MAX_LOCALS: break + if all(taken[i] < MAX_UPVALUES for i, u in enumerate(used) if n in u): + hot.append(n) + taken = [c + (n in u) for c, u in zip(taken, used)] + out = ["--!optimize 2", "-- GENERATED by tools/bundle.py from *.lua, backends/, fonts/ - do not edit", ""] if LOVE: out = ["-- GENERATED by tools/bundle.py --target love - do not edit", re.search(r"--@compat-begin\n(.*?)--@compat-end", open(os.path.join(ROOT, "backends", "imgui_impl_love.lua")).read(), re.S).group(1), ""] -out += [ - "local __FILES, __LOADED = {}, {}", - "function IM_INCLUDE(name)", - " local r = __LOADED[name]", - " if r == nil then r = __FILES[name](); if r == nil then r = true end; __LOADED[name] = r end", - " return r", - "end", ""] +if hot: out.append("local " + ", ".join(hot)) +if hoisted: out += [HOIST_DEPS] + hoisted +out += header() linemap = [] # (first bundle line, file) for error -> source mapping (tools/test/run.py) for name, src in sorted(FILES.items()): out.append("__FILES[%r] = function()" % name) @@ -58,15 +269,12 @@ for n in sorted(names): out.append(" %s = %s," % (n, n)) out.append("}") -import sys OUT = sys.argv[1] if len(sys.argv) > 1 else os.path.join(ROOT, "build") os.makedirs(OUT, exist_ok=True) NAME = "imgui_love.lua" if LOVE else "ImGui.luau" open(os.path.join(OUT, NAME), "w").write("\n".join(out) + "\n") -import json json.dump(linemap, open(os.path.join(OUT, NAME.rsplit(".", 1)[0] + ".linemap.json"), "w")) if not LOVE: - sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from gen_types import wrapper - open(os.path.join(OUT, "ImGuiTyped.luau"), "w").write(wrapper(FILES)) + open(os.path.join(OUT, "ImGuiTyped.luau"), "w").write(wrapper(ORIG)) print("wrote build/%s (%d files, %d exports)" % (NAME, len(FILES), len(names)))