Demo: re-ported imgui_demo.cpp line by line in upstream order (one function per upstream function, same labels/HelpMarkers/comments, 176/186 IMGUI_DEMO_MARKERs; port table driver/Sub()/Demo* helpers removed, statics in S.<Function>). New: DemoWindowInputs (Inputs & Focus), Image Viewer, ShowExampleAppDockSpaceBasic. Selection/Assets Browser stubbed until multi-select is ported. ImColor helper (imgui_h.lua). PORT_STATUS demo similarity 29% -> 51%

This commit is contained in:
4DBug
2026-10-15 02:32:58 -05:00
parent b929de5206
commit 9c8c1b018e
9 changed files with 27917 additions and 21742 deletions
+1 -1
View File
@@ -1 +1 @@
[[46, "imgui.lua"], [21395, "imgui_demo.lua"], [29813, "imgui_draw.lua"], [35756, "imgui_h.lua"], [38423, "imgui_impl_roblox.lua"], [40071, "imgui_impl_roblox_fonts.lua"], [46474, "imgui_internal.lua"], [49943, "imgui_tables.lua"], [55002, "imgui_widgets.lua"], [65642, "imstb_rectpack.lua"], [66306, "imstb_textedit.lua"], [67848, "imstb_truetype.lua"], [70636, "imstd_minstdio.lua"]] [[46, "imgui.lua"], [21395, "imgui_demo.lua"], [31828, "imgui_draw.lua"], [37771, "imgui_h.lua"], [40464, "imgui_impl_roblox.lua"], [42112, "imgui_impl_roblox_fonts.lua"], [48515, "imgui_internal.lua"], [51984, "imgui_tables.lua"], [57043, "imgui_widgets.lua"], [67683, "imstb_rectpack.lua"], [68347, "imstb_textedit.lua"], [69889, "imstb_truetype.lua"], [72677, "imstd_minstdio.lua"]]
+9124 -7057
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1 +1 @@
[[183, "imgui.lua"], [21532, "imgui_demo.lua"], [29950, "imgui_draw.lua"], [35893, "imgui_h.lua"], [38560, "imgui_impl_love.lua"], [39100, "imgui_internal.lua"], [42569, "imgui_tables.lua"], [47628, "imgui_widgets.lua"], [58268, "imstb_rectpack.lua"], [58932, "imstb_textedit.lua"], [60474, "imstb_truetype.lua"], [63262, "imstd_minstdio.lua"]] [[183, "imgui.lua"], [21532, "imgui_demo.lua"], [31965, "imgui_draw.lua"], [37908, "imgui_h.lua"], [40601, "imgui_impl_love.lua"], [41141, "imgui_internal.lua"], [44610, "imgui_tables.lua"], [49669, "imgui_widgets.lua"], [60309, "imstb_rectpack.lua"], [60973, "imstb_textedit.lua"], [62515, "imstb_truetype.lua"], [65303, "imstd_minstdio.lua"]]
+9124 -7057
View File
File diff suppressed because it is too large Load Diff
+581 -581
View File
File diff suppressed because it is too large Load Diff
+9058 -7043
View File
File diff suppressed because it is too large Load Diff
+26
View File
@@ -2653,6 +2653,32 @@ function ImGuiTextBufferMT:appendf(fmt, ...) self.Buf[#self.Buf + 1] = string.fo
function ImGuiTextBufferMT:c_str() return table.concat(self.Buf) end function ImGuiTextBufferMT:c_str() return table.concat(self.Buf) end
function ImGuiTextBufferMT:size() return #self:c_str() end function ImGuiTextBufferMT:size() return #self:c_str() end
-- Helpers: ImColor() implicitly converts colors to either ImU32 (packed 4x1 byte) or ImVec4 (4x1 float)
-- Prefer using IM_COL32() macros. Avoid storing ImColor! Store either u32 of ImVec4. This is not a full-featured color class.
-- **None of the ImGui API are using ImColor directly but you can use it as a convenience to pass colors in either ImU32 or ImVec4 formats. Explicitly cast to ImU32 or ImVec4 if needed.
-- [Luau] no implicit conversions: use :U32() / .Value (ImVec4). Overloads: ImColor(), ImColor(r, g, b, a) floats,
-- ImColor(ImVec4), ImColor(ImU32). The C++ int (0-255) overload can't be told apart from floats: use ImColor(IM_COL32(r, g, b, a)).
--- @class ImColor
local ImColorMT = {}
ImColorMT.__index = ImColorMT
ImColor = setmetatable({}, { __call = function(_, r, g, b, a)
local self = setmetatable({ Value = ImVec4() }, ImColorMT)
if type(r) == "table" then
ImVec4_Copy(self.Value, r)
elseif r ~= nil and g == nil then
local s = 1.0 / 255.0
self.Value.x = bit32.band(bit32.rshift(r, IM_COL32_R_SHIFT), 0xFF) * s; self.Value.y = bit32.band(bit32.rshift(r, IM_COL32_G_SHIFT), 0xFF) * s
self.Value.z = bit32.band(bit32.rshift(r, IM_COL32_B_SHIFT), 0xFF) * s; self.Value.w = bit32.band(bit32.rshift(r, IM_COL32_A_SHIFT), 0xFF) * s
elseif r ~= nil then
self.Value.x = r; self.Value.y = g; self.Value.z = b; self.Value.w = a or 1.0
end
return self
end })
function ImColorMT:U32() return ImGui.ColorConvertFloat4ToU32(self.Value) end
-- FIXME-OBSOLETE: May need to obsolete/cleanup those helpers.
function ImColorMT:SetHSV(h, s, v, a) self.Value.x, self.Value.y, self.Value.z = ImGui.ColorConvertHSVtoRGB(h, s, v); self.Value.w = a or 1.0 end
function ImColor.HSV(h, s, v, a) local r, g, b = ImGui.ColorConvertHSVtoRGB(h, s, v); return ImColor(r, g, b, a or 1.0) end
--- @class ImGuiSettingsHandler --- @class ImGuiSettingsHandler
--- Fns take (ctx, handler, ...) like upstream. ReadOpenFn(ctx, handler, name) returns entry; ReadLineFn(ctx, handler, entry, line); --- Fns take (ctx, handler, ...) like upstream. ReadOpenFn(ctx, handler, name) returns entry; ReadLineFn(ctx, handler, entry, line);
--- WriteAllFn(ctx, handler, buf: ImGuiTextBuffer) --- WriteAllFn(ctx, handler, buf: ImGuiTextBuffer)
+1 -1
View File
@@ -4,4 +4,4 @@ set -e
cd "$(dirname "$0")/../../.." cd "$(dirname "$0")/../../.."
python3 tools/bundle.py --target love >/dev/null python3 tools/bundle.py --target love >/dev/null
nix-shell -p luajit --run "luajit tools/test/love/t_drawhash.lua 150 Widgets,Basic && luajit tools/test/love/t_drawhash.lua 150 all && luajit tools/test/love/t_examples.lua" nix-shell -p luajit --run "luajit tools/test/love/t_drawhash.lua 150 Widgets,Basic && luajit tools/test/love/t_drawhash.lua 150 all && luajit tools/test/love/t_examples.lua"
echo "expected (Luau, tools/test/scripts/t_drawhash.luau): 1385106188 / 1292122782" echo "expected (Luau, tools/test/scripts/t_drawhash.luau): 379637274 / 1789163281"
+1 -1
View File
@@ -7,7 +7,7 @@ io.ConfigFlags = bit32.bor(io.ConfigFlags, G.ImGuiConfigFlags.DockingEnable)
G.ImGui_ImplRoblox.Init() G.ImGui_ImplRoblox.Init()
local names = { "ShowExampleAppConsole", "ShowExampleAppLog", "ShowExampleAppLayout", "ShowExampleAppPropertyEditor", "ShowExampleAppLongText", local names = { "ShowExampleAppConsole", "ShowExampleAppLog", "ShowExampleAppLayout", "ShowExampleAppPropertyEditor", "ShowExampleAppLongText",
"ShowExampleAppAutoResize", "ShowExampleAppConstrainedResize", "ShowExampleAppSimpleOverlay", "ShowExampleAppWindowTitles", "ShowExampleAppAutoResize", "ShowExampleAppConstrainedResize", "ShowExampleAppSimpleOverlay", "ShowExampleAppWindowTitles",
"ShowExampleAppCustomRendering", "ShowExampleAppDocuments", "ShowExampleAppDockSpace", "ShowExampleAppFullscreen", "ShowExampleAppAssetsBrowser", "ShowExampleAppMainMenuBar" } "ShowExampleAppCustomRendering", "ShowExampleAppDocuments", "ShowExampleAppDockSpace", "ShowExampleAppFullscreen", "ShowExampleAppAssetsBrowser", "ShowExampleAppMainMenuBar", "ShowExampleAppImageViewer" }
local tools = { "ShowMetricsWindow", "ShowDebugLogWindow", "ShowIDStackToolWindow", "ShowAboutWindow" } local tools = { "ShowMetricsWindow", "ShowDebugLogWindow", "ShowIDStackToolWindow", "ShowAboutWindow" }
local open = {} local open = {}
local frame = 0 local frame = 0