Skip to content

Instantly share code, notes, and snippets.

@dextercd
Last active December 9, 2022 14:13
Show Gist options
  • Save dextercd/da6602d94b6eecf87f4f0a1e6c56c4cd to your computer and use it in GitHub Desktop.
Save dextercd/da6602d94b6eecf87f4f0a1e6c56c4cd to your computer and use it in GitHub Desktop.
local imgui = load_imgui({version="1.0.0", name="test"})
function OnWorldPreUpdate()
if imgui.Begin("Main Window Title") then
local available_width, available_height = imgui.GetContentRegionAvail()
if imgui.BeginChild("TopLeft", 0.2 * available_width, 200, true) then
imgui.Text("TopLeft")
imgui.EndChild()
end
imgui.SameLine()
local tr_flags = bit.bor(
imgui.WindowFlags.MenuBar
)
if imgui.BeginChild("TopRight", 0.8 * available_width, 200, true, tr_flags) then
if imgui.BeginMenuBar() then
if imgui.BeginMenu("Files") then
if imgui.MenuItem("New") then
print("Clicked on new file!")
end
imgui.EndMenu()
end
imgui.EndMenuBar()
end
for i=1,20 do
imgui.Text("TopRight" .. i)
end
imgui.EndChild()
end
if imgui.BeginChild("DownLeft", 0.2 * available_width, 0, true) then
imgui.Text("DownLeft")
imgui.EndChild()
end
imgui.SameLine()
if imgui.BeginChild("DownRight", 0.8 * available_width, 0, true) then
imgui.Text("DownRight")
imgui.EndChild()
end
imgui.End()
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment