README modelled on upstream with rendered screenshots/GIF, docs/TODO.txt, screenshot tooling, t_readme snippet test, ImGui.NewTextBuffer helpers
This commit is contained in:
@@ -1 +1 @@
|
||||
[[12, "imgui.lua"], [18472, "imgui_demo.lua"], [25757, "imgui_draw.lua"], [30995, "imgui_h.lua"], [33193, "imgui_impl_roblox.lua"], [34319, "imgui_impl_roblox_fonts.lua"], [40722, "imgui_internal.lua"], [43894, "imgui_tables.lua"], [48241, "imgui_widgets.lua"], [57982, "imstb_rectpack.lua"], [58428, "imstb_textedit.lua"], [59669, "imstb_truetype.lua"], [62137, "imstd_minstdio.lua"]]
|
||||
[[12, "imgui.lua"], [18472, "imgui_demo.lua"], [25757, "imgui_draw.lua"], [30995, "imgui_h.lua"], [33193, "imgui_impl_roblox.lua"], [34319, "imgui_impl_roblox_fonts.lua"], [40722, "imgui_internal.lua"], [43894, "imgui_tables.lua"], [48241, "imgui_widgets.lua"], [57996, "imstb_rectpack.lua"], [58442, "imstb_textedit.lua"], [59683, "imstb_truetype.lua"], [62151, "imstd_minstdio.lua"]]
|
||||
@@ -52294,6 +52294,20 @@ function ImGui.InputText(label, buf, buf_size, flags, callback, user_data)
|
||||
return ImGui.InputTextEx(label, nil, buf, buf_size, ImVec2(0, 0), flags, callback, user_data)
|
||||
end
|
||||
|
||||
-- [Luau] InputText edits a byte table in place (C++ char buf[N]). Helpers to make/read one:
|
||||
-- local buf = ImGui.NewTextBuffer("Hello", 256); ImGui.InputText("label", buf, 256); print(ImGui.TextBufferToString(buf))
|
||||
function ImGui.NewTextBuffer(str, size)
|
||||
local t = {}
|
||||
for i = 1, #str do t[i] = string.byte(str, i) end
|
||||
for i = #str + 1, math.max(size or 0, #str + 1) do t[i] = 0 end
|
||||
return t
|
||||
end
|
||||
function ImGui.TextBufferToString(buf)
|
||||
local n = 0
|
||||
while buf[n + 1] ~= nil and buf[n + 1] ~= 0 do n += 1 end
|
||||
return n == 0 and "" or ImGui._ByteArrayToString(buf, 1, n + 1)
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user