I’ve been playing around with Dear ImGUI and I really like how easy it is to quickly create a fairly complex UI with it. I obviously want this in Lua so I’ve started working on a Dear ImgUI extension for Defold:
With a few lines of Lua:
imgui.begin_window("Hello, world!")
imgui.text("This is some useful text.")
local changed, checked = imgui.checkbox("Demo window", self.show_demo_window)
if changed then
self.show_demo_window = checked
end
imgui.separator()
if imgui.button("Button") then
self.counter = self.counter + 1
end
imgui.same_line()
imgui.text(("counter = %d"):format(self.counter))
imgui.separator()
local pos = go.get_position("object")
local changed, x, y, z = imgui.input_float3("pos", pos.x, pos.y, pos.z)
if changed then
pos.x = x
pos.y = y
pos.z = z
go.set_position(pos, "object")
end
imgui.end_window()
You get this: