User Interface
User interfaces in unbound are made using panels.Panels are entities that show as a flat surface, they can be visualized in 3d or 2d, they can display colors, borders and text.
getWindowSize()
Get the window size.
Return
vec2
setWindowOnMouseDown(callback)
Set a callback for when the mouse is clicked anywhere in the window.
Arguments
callback: function()
setWindowOnMouseMove(callback)
Set a callback for when the mouse is moved anywhere in the window.
Arguments
callback: function()
setWindowOnMouseUp(callback)
Set a callback for when the mouse click is released anywhere in the window.
Arguments
callback: function()
makePanel()
Make a panel. Panels are flat colored surfaces that can be displayed in 3D or 2D.
A panel can have rounded corners, contain text and even become a text editor.
Return
Entity , a pointer to a panel in the world
setPanelOverlay(panel, state)
Set whether a panel should is displayed as 2D.
Arguments
panel:
state: boolean
getPanelOverlay(panel)
Get whether a panel is be displayed as 2D.
Arguments
panel:
Return
bool
setPanelCornerRadius(panel, value)
Set the corner radius of a panel.
Arguments
panel:
value: number
getPanelCornerRadius(panel)
Get the corner radius of a panel.
Arguments
panel:
Return
float
setPanelColor(panel, color)
Set the color of a panel.
Arguments
panel:
color: vec4
getPanelColor(panel)
Get the color of a panel.
Arguments
panel:
Return
vec4
setPanelText(panel, text)
Set the text displayed in a panel.
Arguments
panel:
text:
getPanelText(panel)
Get the text displayed in a panel.
Arguments
panel:
Return
string
setPanelTextColor(panel, color)
Set a panel text color.
Arguments
panel:
color: vec4
getPanelTextColor(panel)
Get a panel text color.
Arguments
panel:
Return
vec4
setPanelFont(panel, fontId)
Set a panel text font style.
Arguments
panel:
fontId: int, available values are FONT_REGULAR, FONT_PIXEL, FONT_TYPEWRITER, FONT_CREEPY, FONT_SCIFI, FONT_MONO, FONT_VINTAGE, FONT_WEST, FONT_GOTH,
setPanelFontSize(panel, value)
Set a panel text font size.
Arguments
panel:
value: number
getPanelFontSize(panel)
Get a panel text font size.
Arguments
panel:
Return
float
setPanelTextOffset(panel, offset)
Offset the text position inside a panel.
Arguments
panel:
offset: vec2
setPanelTextAlignHorizontal(panel, align)
Set a panel text horizontal alignment.
Arguments
panel:
align:
setPanelTextAlignVertical(panel, align)
Set a panel text vertical alignment.
Arguments
panel:
align:
setPanelTextWrapLines(panel, state)
Set whether the panel text is wrapped or not.
Arguments
panel:
state: boolean
setPanelBorder(panel, value)
Set a panel border thickness.
Arguments
panel:
value: number
getPanelBorder(panel)
Get a panel text font size.
Arguments
panel:
Return
float
setPanelBorderColor(panel, color)
Set a panel border color.
Arguments
panel:
color: vec4
getPanelBorderColor(panel)
Get a panel border color.
Arguments
panel:
Return
vec4
setPanelDimensions(panel, dim)
Set a panel dimensions.
Arguments
panel:
dim:
getPanelDimensions(panel)
Get a panel dimensions.
Arguments
panel:
Return
vec2
setPanelScissor(panel, state)
Set a panel to cut out all its children panels. Useful to make UIs where a panel contains another panels.
Arguments
panel:
state: boolean
setPanelOnMouseDown(panel, callback)
Set a callback for when a panel is clicked.
Arguments
panel:
callback: function()
setPanelOnMouseUp(panel, callback)
Set a callback for when a panel mouse click is released.
Arguments
panel:
callback: function()
setPanelOnMouseEnter(panel, callback)
Set a callback for when the mouse enters a panel.
Arguments
panel:
callback: function()
setPanelOnMouseLeave(panel, callback)
Set a callback for when the mouse leaves a panel.
Arguments
panel:
callback: function()
setPanelOnMouseMove(panel, callback)
Set a callback for when the mouse is moving inside a panel.
Arguments
panel:
callback: function()
setPanelAsTextEditor(panel)
Set a panel to become a text editor.
Arguments
panel:
setPanelTextEditEnabled(panel, state)
Set if a panel text editor should be editable.
Arguments
panel:
state: boolean
setPanelTextEditShowCursor(panel, state)
Set if a panel text editor should show a cursor.
Arguments
panel:
state: boolean
sendMouseDownToTextEditor(panel, position)
Send a mouse-down action to a panel text editor.
Arguments
panel:
position: vec3
sendMouseMoveToTextEditor(panel, position)
Send a mouse-move action to a panel text editor.
Arguments
panel:
position: vec3
sendMouseUpToTextEditor(panel, position)
Send a mouse-up action to a panel text editor.
Arguments
panel:
position: vec3
sendMouseScrollToTextEditor(panel, value)
Send a mouse-scroll action to a panel text editor.
Arguments
panel:
value: number
sendCharToTextEditor(panel, text)
Send a char to a panel text editor.
Arguments
panel:
text:
sendKeyDownToTextEditor(panel, keyCode, ctrlPressed, shiftPressed, altPressed)
Send a key-down action to a panel text editor.
Arguments
panel:
keyCode:
ctrlPressed:
shiftPressed:
altPressed:
Return
bool