GUI
A2 gives camera scripts the ability to design their own GUI window for configuration or control. A subset of the Dear ImGui library is available for use in camera scripts under the Gui
namespace.
Usage
GUI elements can only be created during the onGui()
function.
This function is called by the game every time the GUI is updated, which is generally every frame if the GUI is visible. All GUI functions are contained in the Gui
namespace.
Input GUI elements generally return the old or changed value. A common pattern is to pass in a variable, then set the same variable to the return value of the GUI element's return value:
local myBool: boolean = false
local myFloat: number = 0
function onGui()
myBool = Gui.checkbox("My Bool", myBool)
myFloat = Gui.sliderFloat("My Float", myFloat, 0, 100)
end
Buttons return true on the frame that they are clicked:
Currently available GUI elements: