Immediate-mode UI for the editor, scripted in Lua
I am finally back on the editor. Its UI will be written in Lua scripts.
My starting point was the simple, usable immediate-mode UI code from the Recast library. Here is how a button works there:
if ( imguiButton("Start game") )
LoadLevel("super-duper mega Quake level.mdl")
Creating the button, drawing it and handling the click all happen in one place. After years of Windows UI programming this was a revelation.
I exposed this API to Lua with the luabind library, and UI script code now looks like this:
if object_selected
rollout( "Object", 0, 0, width, height )
show_object_properties()
if collapse("physics", true, true)
show_physics_properties()
if collapse("visual", true, true)
show_visual_properties()
if collapse("script", true, true)
show_object_script()
end_rollout()