Open perandersson opened 11 years ago
End-result suggestion:
local mainMenu = CanvasGroup()
local example = Frame({ Title = "Example", Width = 200, Height = 200 })
example:AddControl(Rows({
Columns = {
{"", Field({ Value = "Hello World", Hint = "Enter value here"})},
{"size", Slider({ Default = 1.0, Min = 0.0, Max = 10.0, Steps = 0.1 })},
{"show?", Checkbox({ Default = true })},
{"", Button({ Text = "Reset", Action = function(self) end })}
}
}))
mainMenu:AddControl(example)
return mainMenu
Not a good suggestion, this will result in a lot of duplicated code and/or unnecessary code complexity. The result should be something that uses the existing Scene concept but with a specific render processor instead, for example a UserInterfaceRenderProcessor. Create a SceneGroup like this:
local mainMenu = SceneGroup(UpdateProcessorFactory, UserInterfaceRenderProcessorFactory, LightSourceProcessorFactory)
This new render processor should listen for USER_INTERFACE queries during render time.
To make the user interface generation simply. A UI factory should be implemented that support a designed like the one suggested above.
After some more consideration, my previous statement wasn't as solid as i thought. It might be better to create custom GUI containers (Canvas, GuiControl, ... etc). This makes it easier to handle script changes specificly for them.
Branch: 2-gui