gui
GUI API documentation
Functions
gui.animate(4 overloads): void<K extends keyof gui.NodeProperties | gui.Prop>(node:Opaque<"node">, property: K, to: NodePropertyAnimateTo<NodePropertyName<K>>, easing: gui.Easing| Vector, duration: number)<K extends keyof gui.NodeProperties | gui.Prop>(node:Opaque<"node">, property: K, to: NodePropertyAnimateTo<NodePropertyName<K>>, easing: gui.Easing| Vector, duration: number, delay: number, complete_function?: (self: unknown, node:Opaque<"node">) => void, playback?: gui.Playback)(node:Opaque<"node">, property: Hash, to: number | Vector3 | Vector4 | Quaternion, easing:gui.Easing| Vector, duration: number)(node:Opaque<"node">, property: Hash, to: number | Vector3 | Vector4 | Quaternion, easing:gui.Easing| Vector, duration: number, delay: number, complete_function?: (self: unknown, node:Opaque<"node">) => void, playback?:gui.Playback)
gui.cancel_animations(node:Opaque<"node">, property?: keyof gui.NodeProperties |gui.Prop| Hash): voidgui.cancel_flipbook(node:Opaque<"node">): voidgui.clone(node:Opaque<"node">):Opaque<"node">gui.clone_tree(node:Opaque<"node"> | undefined): LuaTable<Hash,Opaque<"node">> & { get: LuaTableGetMethod<string,Opaque<"node">> }gui.delete_node(node:Opaque<"node">): voidgui.delete_texture(texture: string | Hash): voidgui.get(3 overloads)<K extends keyof gui.NodeProperties | gui.Prop>(node:Opaque<"node">, property: K): gui.NodeProperties[NodePropertyName<K>](node:Opaque<"node">, property: Hash): number | Vector4 | Quaternion | Matrix4 | number[] | Vector4[] | Matrix4[](node:Opaque<"node">, property: Hash, options: gui.PropertyOptions): number | Vector4 | Quaternion | Matrix4 | number[] | Vector4[] | Matrix4[]
gui.get_adjust_mode(node:Opaque<"node">):gui.Adjustgui.get_alpha(node:Opaque<"node">): numbergui.get_blend_mode(node:Opaque<"node">):gui.Blendgui.get_clipping_inverted(node:Opaque<"node">): booleangui.get_clipping_mode(node:Opaque<"node">):gui.ClippingModegui.get_clipping_visible(node:Opaque<"node">): booleangui.get_color(node:Opaque<"node">): Vector4gui.get_euler(node:Opaque<"node">): Vector3gui.get_fill_angle(node:Opaque<"node">): numbergui.get_flipbook(node:Opaque<"node">): Hashgui.get_flipbook_cursor(node:Opaque<"node">): numbergui.get_flipbook_playback_rate(node:Opaque<"node">): numbergui.get_font(node:Opaque<"node">): Hashgui.get_font_resource(font_name: Hash | string): Hashgui.get_height(): numbergui.get_id(node:Opaque<"node">): Hashgui.get_index(node:Opaque<"node">): numbergui.get_inherit_alpha(node:Opaque<"node">): booleangui.get_inner_radius(node:Opaque<"node">): numbergui.get_layer(node:Opaque<"node">): Hashgui.get_layout(): Hashgui.get_layouts(): LuaMap<Hash, Vector3>gui.get_leading(node:Opaque<"node">): numbergui.get_line_break(node:Opaque<"node">): booleangui.get_material(node:Opaque<"node">): Hashgui.get_node(id: string | Hash):Opaque<"node">gui.get_outer_bounds(node:Opaque<"node">):gui.PieBoundsgui.get_outline(node:Opaque<"node">): Vector4gui.get_parent(node:Opaque<"node">):Opaque<"node"> | undefinedgui.get_particlefx(node:Opaque<"node">): Hashgui.get_perimeter_vertices(node:Opaque<"node">): numbergui.get_pivot(node:Opaque<"node">):gui.Pivotgui.get_position(node:Opaque<"node">): Vector3gui.get_rotation(node:Opaque<"node">): Quaterniongui.get_scale(node:Opaque<"node">): Vector3gui.get_screen_position(node:Opaque<"node">): Vector3gui.get_shadow(node:Opaque<"node">): Vector4gui.get_size(node:Opaque<"node">): Vector3gui.get_size_mode(node:Opaque<"node">):gui.SizeModegui.get_slice9(node:Opaque<"node">): Vector4gui.get_text(node:Opaque<"node">): stringgui.get_texture(node:Opaque<"node">): Hashgui.get_tracking(node:Opaque<"node">): numbergui.get_tree(node:Opaque<"node"> | undefined): LuaTable<Hash,Opaque<"node">> & { get: LuaTableGetMethod<string,Opaque<"node">> }gui.get_type(node:Opaque<"node">): LuaMultiReturn<[gui.Type, number | undefined]>gui.get_visible(node:Opaque<"node">): booleangui.get_width(): numbergui.get_xanchor(node:Opaque<"node">): Exclude<gui.Anchor, typeof gui.ANCHOR_BOTTOM | typeof gui.ANCHOR_TOP>gui.get_yanchor(node:Opaque<"node">): Exclude<gui.Anchor, typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_RIGHT>gui.hide_keyboard(): voidgui.is_enabled(node:Opaque<"node">, recursive?: boolean): booleangui.move_above(node:Opaque<"node">, reference:Opaque<"node"> | undefined): voidgui.move_below(node:Opaque<"node">, reference:Opaque<"node"> | undefined): voidgui.new_box_node(pos: Vector3 | Vector4, size: Vector3):Opaque<"node">gui.new_particlefx_node(pos: Vector3 | Vector4, particlefx: Hash | string):Opaque<"node">gui.new_pie_node(pos: Vector3 | Vector4, size: Vector3):Opaque<"node">gui.new_text_node(pos: Vector3 | Vector4, text: string):Opaque<"node">gui.new_texture(2 overloads): LuaMultiReturn<[boolean, number | undefined]>gui.pick_node(node:Opaque<"node">, x: number, y: number): booleangui.play_flipbook(2 overloads): voidgui.play_particlefx(node:Opaque<"node">, emitter_state_function?: (self: unknown, node: unknown, emitter: unknown, state: unknown) => void): voidgui.reset_keyboard(): voidgui.reset_material(node:Opaque<"node">): voidgui.reset_nodes(): voidgui.screen_to_local(node:Opaque<"node">, screen_position: Vector3 | Vector4): Vector3gui.set(4 overloads): void(node:Opaque<"node">, property: Hash, value: number | Vector4 | Vector3 | Quaternion | Matrix4 | Hash)(node:Opaque<"node">, property: Hash, value: number | Vector4 | Vector3 | Quaternion | Matrix4 | Hash, options: gui.PropertyOptions)(url: Url, property: "material" | "materials" | "fonts" | "textures" | Hash, value: Hash)(url: Url, property: "material" | "materials" | "fonts" | "textures" | Hash, value: Hash, options: gui.PropertyOptions)
gui.set_adjust_mode(node:Opaque<"node">, adjust_mode:gui.Adjust): voidgui.set_alpha(node:Opaque<"node">, alpha: number): voidgui.set_blend_mode(node:Opaque<"node">, blend_mode:gui.Blend): voidgui.set_clipping_inverted(node:Opaque<"node">, inverted: boolean): voidgui.set_clipping_mode(node:Opaque<"node">, clipping_mode:gui.ClippingMode): voidgui.set_clipping_visible(node:Opaque<"node">, visible: boolean): voidgui.set_color(node:Opaque<"node">, color: Vector3 | Vector4): voidgui.set_enabled(node:Opaque<"node">, enabled: boolean): voidgui.set_euler(node:Opaque<"node">, rotation: Vector3 | Vector4): voidgui.set_fill_angle(node:Opaque<"node">, angle: number): voidgui.set_flipbook_cursor(node:Opaque<"node">, cursor: number): voidgui.set_flipbook_playback_rate(node:Opaque<"node">, playback_rate: number): voidgui.set_font(node:Opaque<"node">, font: string | Hash): voidgui.set_id(node:Opaque<"node">, id: string | Hash): voidgui.set_inherit_alpha(node:Opaque<"node">, inherit_alpha: boolean): voidgui.set_inner_radius(node:Opaque<"node">, radius: number): voidgui.set_layer(node:Opaque<"node">, layer: string | Hash): voidgui.set_layout(layout: string | Hash): booleangui.set_leading(node:Opaque<"node">, leading: number): voidgui.set_line_break(node:Opaque<"node">, line_break: boolean): voidgui.set_material(node:Opaque<"node">, material: string | Hash): voidgui.set_outer_bounds(node:Opaque<"node">, bounds_mode:gui.PieBounds): voidgui.set_outline(node:Opaque<"node">, color: Vector3 | Vector4): voidgui.set_parent(node:Opaque<"node">, parent:Opaque<"node"> | undefined, keep_scene_transform?: boolean): voidgui.set_particlefx(node:Opaque<"node">, particlefx: Hash | string): voidgui.set_perimeter_vertices(node:Opaque<"node">, vertices: number): voidgui.set_pivot(node:Opaque<"node">, pivot:gui.Pivot): voidgui.set_position(node:Opaque<"node">, position: Vector3 | Vector4): voidgui.set_render_order(order: number): voidgui.set_rotation(node:Opaque<"node">, rotation: Quaternion | Vector4 | Vector3): voidgui.set_safe_area_mode(mode:gui.SafeArea): voidgui.set_scale(node:Opaque<"node">, scale: Vector3 | Vector4): voidgui.set_screen_position(node:Opaque<"node">, screen_position: Vector3 | Vector4): voidgui.set_shadow(node:Opaque<"node">, color: Vector3 | Vector4): voidgui.set_size(node:Opaque<"node">, size: Vector3 | Vector4): voidgui.set_size_mode(node:Opaque<"node">, size_mode:gui.SizeMode): voidgui.set_slice9(node:Opaque<"node">, values: Vector4): voidgui.set_text(node:Opaque<"node">, text: string | number): voidgui.set_texture(node:Opaque<"node">, texture: string | Hash): voidgui.set_texture_data(2 overloads): booleangui.set_tracking(node:Opaque<"node">, tracking: number): voidgui.set_visible(node:Opaque<"node">, visible: boolean): voidgui.set_xanchor(node:Opaque<"node">, anchor: Exclude<gui.Anchor, typeof gui.ANCHOR_BOTTOM | typeof gui.ANCHOR_TOP>): voidgui.set_yanchor(node:Opaque<"node">, anchor: Exclude<gui.Anchor, typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_RIGHT>): voidgui.show_keyboard(type:gui.KeyboardType, autoclose: boolean): voidgui.stop_particlefx(2 overloads): void
gui.animate(4 overloads): void
<K extends keyof gui.NodeProperties | gui.Prop>(node: Opaque<"node">, property: K, to: NodePropertyAnimateTo<NodePropertyName<K>>, easing: gui.Easing | Vector, duration: number)This starts an animation of a node property according to the specified parameters. If the node property is already being animated, that animation will be canceled and replaced by the new one. Note however that several different node properties can be animated simultaneously. Use
gui.cancel_animationsto stop the animation before it has completed. Only the node properties gui.get lists can be animated; a material constant cannot. Composite properties of type vector3, vector4 or quaternion also expose their sub-components (x, y, z and w). You can address the components individually by suffixing the name with a dot '.' and the name of the component. For instance,"position.x"(the position x coordinate) or"color.w"(the color alpha value). If acomplete_function(Lua function) is specified, that function will be called when the animation has completed. By starting a new animation in that function, several animations can be sequenced together. See the examples below for more information.<K extends keyof gui.NodeProperties | gui.Prop>(node: Opaque<"node">, property: K, to: NodePropertyAnimateTo<NodePropertyName<K>>, easing: gui.Easing | Vector, duration: number, delay: number, complete_function?: (self: unknown, node: Opaque<"node">) => void, playback?: gui.Playback)Same description as form 1.
Parameters
node:Opaque<"node">— node to animateproperty:K— property to animate; each gui.PROP member equals its corresponding property name stringto:NodePropertyAnimateTo<NodePropertyName<K>>— target property valueeasing:gui.Easing | Vector— easing to use during animation. Either specify one of thegui.EASING_*constants or provide a vector with a custom curve. See the animation guide for more information.duration:number— duration of the animation in seconds.delay:number— delay before the animation starts in seconds.complete_function?:(self: unknown, node: Opaque<"node">) => void— function to call when the animation has completedplayback?:gui.Playback— playback mode
(node: Opaque<"node">, property: Hash, to: number | Vector3 | Vector4 | Quaternion, easing: gui.Easing | Vector, duration: number)Animates a node property named by a hash, such as
hash("position.y"). The engine resolves the name at run time, so the target value is not checked against the property: pass a number, a vmath.vector3, a vmath.vector4 or a vmath.quat as the named property expects.(node: Opaque<"node">, property: Hash, to: number | Vector3 | Vector4 | Quaternion, easing: gui.Easing | Vector, duration: number, delay: number, complete_function?: (self: unknown, node: Opaque<"node">) => void, playback?: gui.Playback)Same description as form 3.
Parameters
node:Opaque<"node">— node to animateproperty:Hash— property to animate; each gui.PROP member equals its corresponding property name stringto:number | Vector3 | Vector4 | Quaternion— target property valueeasing:gui.Easing | Vector— easing to use during animation. Either specify one of thegui.EASING_*constants or provide a vector with a custom curve. See the animation guide for more information.duration:number— duration of the animation in seconds.delay:number— delay before the animation starts in seconds.complete_function?:(self: unknown, node: Opaque<"node">) => void— function to call when the animation has completedplayback?:gui.Playback— playback mode
How to start a simple color animation, where the node fades in to white during 0.5 seconds:
// How to start a simple color animation, where the node fades in to white during 0.5 seconds:
const node = gui.get_node("my_node");
gui.set_color(node, vmath.vector4(0, 0, 0, 0)); // node is fully transparent
gui.animate(node, gui.PROP_COLOR, vmath.vector4(1, 1, 1, 1), gui.EASING_INOUTQUAD, 0.5); // start animationgui.set_color(node, vmath.vector4(0, 0, 0, 0)) -- node is fully transparent
gui.animate(node, gui.PROP_COLOR, vmath.vector4(1, 1, 1, 1), gui.EASING_INOUTQUAD, 0.5) -- start animationHow to start a sequenced animation where the node fades in to white during 0.5 seconds, stays visible for 2 seconds and then fades out:
// How to start a sequenced animation where the node fades in to white during 0.5
// seconds, stays visible for 2 seconds and then fades out:
function on_animation_done(self: unknown, node: Opaque<"node">) {
// fade out node, but wait 2 seconds before the animation starts
gui.animate(node, gui.PROP_COLOR, vmath.vector4(0, 0, 0, 0), gui.EASING_OUTQUAD, 0.5, 2.0);
}
export default defineGuiScript({
init(self) {
// fetch the node we want to animate
const my_node = gui.get_node("my_node");
// node is initially set to fully transparent
gui.set_color(my_node, vmath.vector4(0, 0, 0, 0));
// animate the node immediately and call on_animation_done when the animation has completed
gui.animate(my_node, gui.PROP_COLOR, vmath.vector4(1, 1, 1, 1), gui.EASING_INOUTQUAD, 0.5, 0.0, on_animation_done);
},
});local function on_animation_done(self, node)
-- fade out node, but wait 2 seconds before the animation starts
gui.animate(node, gui.PROP_COLOR, vmath.vector4(0, 0, 0, 0), gui.EASING_OUTQUAD, 0.5, 2.0)
end
function init(self)
-- fetch the node we want to animate
local my_node = gui.get_node("my_node")
-- node is initially set to fully transparent
gui.set_color(my_node, vmath.vector4(0, 0, 0, 0))
-- animate the node immediately and call on_animation_done when the animation has completed
gui.animate(my_node, gui.PROP_COLOR, vmath.vector4(1, 1, 1, 1), gui.EASING_INOUTQUAD, 0.5, 0.0, on_animation_done)
endHow to animate a node's y position using a crazy custom easing curve:
// How to animate a node's y position using a crazy custom easing curve:
export default defineGuiScript({
init(self) {
const values = [
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
];
const vec = vmath.vector(values);
const node = gui.get_node("box");
gui.animate(node, "position.y", 100, vec, 4.0, 0, undefined, gui.PLAYBACK_LOOP_PINGPONG);
},
});function init(self)
local values = { 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1 }
local vec = vmath.vector(values)
local node = gui.get_node("box")
gui.animate(node, "position.y", 100, vec, 4.0, 0, nil, gui.PLAYBACK_LOOP_PINGPONG)
endgui.cancel_animations(node: Opaque<"node">, property?: keyof gui.NodeProperties | gui.Prop | Hash): void
If one or more animations of the specified node is currently running (started by gui.animate), they will immediately be canceled.
Start an animation of the position property of a node, then cancel parts of the animation:
const node = gui.get_node("my_node");
// animate to new position
const pos = vmath.vector3(100, 100, 0);
gui.animate(node, "position", pos, gui.EASING_LINEAR, 2);
// ...
// cancel animation of the x component.
gui.cancel_animations(node, "position.x");local node = gui.get_node("my_node")
-- animate to new position
local pos = vmath.vector3(100, 100, 0)
gui.animate(node, "position", pos, go.EASING_LINEAR, 2)
...
-- cancel animation of the x component.
gui.cancel_animations(node, "position.x")Cancels all property animations on a node in a single call:
const node = gui.get_node("my_node");
// animate to new position and scale
gui.animate(node, "position", vmath.vector3(100, 100, 0), gui.EASING_LINEAR, 5);
gui.animate(node, "scale", vmath.vector3(0.5), gui.EASING_LINEAR, 5);
// ...
// cancel positioning and scaling at once
gui.cancel_animations(node);local node = gui.get_node("my_node")
-- animate to new position and scale
gui.animate(node, "position", vmath.vector3(100, 100, 0), go.EASING_LINEAR, 5)
gui.animate(node, "scale", vmath.vector3(0.5), go.EASING_LINEAR, 5)
...
-- cancel positioning and scaling at once
gui.cancel_animations(node)Parameters
node:Opaque<"node">— node that should have its animation canceledproperty?:keyof gui.NodeProperties | gui.Prop | Hash— optional property for which the animation should be canceled"position""rotation""euler""scale""color""outline""shadow""size""fill_angle"(pie)"inner_radius"(pie)"leading"(text)"tracking"(text)"slice9"(slice9)
gui.cancel_flipbook(node: Opaque<"node">): void
Cancels any running flipbook animation on the specified node.
const node = gui.get_node("anim_node");
gui.cancel_flipbook(node);local node = gui.get_node("anim_node")
gui.cancel_flipbook(node)Parameters
node:Opaque<"node">— node cancel flipbook animation for
gui.clone(node: Opaque<"node">): Opaque<"node">
Make a clone instance of a node. The cloned node will be identical to the original node, except the id which is generated as the string "node" plus a sequential unsigned integer value. This function does not clone the supplied node's children nodes. Use gui.clone_tree for that purpose.
Parameters
node:Opaque<"node">— node to clone
Returns
clone:Opaque<"node">— the cloned node
gui.clone_tree(node: Opaque<"node"> | undefined): LuaTable<Hash, Opaque<"node">> & { get: LuaTableGetMethod<string, Opaque<"node">> }
Make a clone instance of a node and all its children. Use gui.clone to clone a node excluding its children.
Parameters
node:Opaque<"node"> | undefined— root node to clone, ornilto clone the whole scene; leaving the argument out raises an error
Returns
clones:LuaTable<Hash, Opaque<"node">> & { get: LuaTableGetMethod<string, Opaque<"node">> }— a table mapping node ids to the corresponding cloned nodes
gui.delete_node(node: Opaque<"node">): void
Deletes the specified node. Any child nodes of the specified node will be recursively deleted.
// Delete a particular node and any child nodes it might have:
const node = gui.get_node("my_node");
gui.delete_node(node);local node = gui.get_node("my_node")
gui.delete_node(node)Parameters
node:Opaque<"node">— node to delete
gui.delete_texture(texture: string | Hash): void
Delete a dynamically created texture.
export default defineGuiScript({
init(self) {
// Create a texture.
if (gui.new_texture("temp_tx", 10, 10, "rgb", "\0".repeat(10 * 10 * 3))) {
// Do something with the texture.
// ...
// Delete the texture
gui.delete_texture("temp_tx");
}
},
});function init(self)
-- Create a texture.
if gui.new_texture("temp_tx", 10, 10, "rgb", string.rep('\0', 10 * 10 * 3)) then
-- Do something with the texture.
...
-- Delete the texture
gui.delete_texture("temp_tx")
end
endParameters
texture:string | Hash— texture id
gui.get(3 overloads)
<K extends keyof gui.NodeProperties | gui.Prop>(node: Opaque<"node">, property: K): gui.NodeProperties[NodePropertyName<K>]Instead of using specific getters such as gui.get_position or gui.get_scale, you can use gui.get instead and supply the property as a string or a
gui.PROP_*constant. Only these node properties are supported:"position""rotation""euler""scale""color""outline""shadow""size""fill_angle"(pie)"inner_radius"(pie)"leading"(text)"tracking"(text)"slice9"(slice9)
Each property but the four scalars (
fill_angle,inner_radius,leadingandtracking) also exposes its components as"<name>.x"to"<name>.w". Getting"rotation"returns a vmath.quat, another vector property a vmath.vector4, and a component or a scalar property a single number. To get a material constant, pass its name as a hash.(node: Opaque<"node">, property: Hash): number | Vector4 | Quaternion | Matrix4 | number[] | Vector4[] | Matrix4[]Gets a material constant of a node, or any property named by a hash. Pass the constant's name as a hash, such as
hash("tint"). Reading an array constant withoutindexreturns every element in a table.(node: Opaque<"node">, property: Hash, options: gui.PropertyOptions): number | Vector4 | Quaternion | Matrix4 | number[] | Vector4[] | Matrix4[]Same description as form 2.
Parameters
node:Opaque<"node">— node to get the property forproperty:Hash— the property to retrieveoptions:gui.PropertyOptions— optional options table (only applicable for material constants)indexinteger index into array property (1 based)
indexis 1-based; passed to Defold unchanged.
// Get properties on existing nodes:
const node = gui.get_node("my_box_node");
const node_position = gui.get(node, "position");local node = gui.get_node("my_box_node")
local node_position = gui.get(node, "position")gui.get_adjust_mode(node: Opaque<"node">): gui.Adjust
Returns the adjust mode of a node. The adjust mode defines how the node will adjust itself to screen resolutions that differs from the one in the project settings.
Parameters
node:Opaque<"node">— node from which to get the adjust mode (node)
Returns
adjust_mode:gui.Adjust— the current adjust mode
gui.get_alpha(node: Opaque<"node">): number
gets the node alpha
Parameters
node:Opaque<"node">— node from which to get alpha
Returns
alpha:number— alpha
gui.get_blend_mode(node: Opaque<"node">): gui.Blend
Returns the blend mode of a node. Blend mode defines how the node will be blended with the background.
Parameters
node:Opaque<"node">— node from which to get the blend mode
Returns
blend_mode:gui.Blend— blend mode
gui.get_clipping_inverted(node: Opaque<"node">): boolean
If node is set as an inverted clipping node, it will clip anything inside as opposed to outside.
Parameters
node:Opaque<"node">— node from which to get the clipping inverted state
Returns
inverted:boolean—trueorfalse
gui.get_clipping_mode(node: Opaque<"node">): gui.ClippingMode
Clipping mode defines how the node will clip it's children nodes
Parameters
node:Opaque<"node">— node from which to get the clipping mode
Returns
clipping_mode:gui.ClippingMode— clipping modegui.CLIPPING_MODE_NONEgui.CLIPPING_MODE_STENCIL
gui.get_clipping_visible(node: Opaque<"node">): boolean
If node is set as visible clipping node, it will be shown as well as clipping. Otherwise, it will only clip but not show visually.
Parameters
node:Opaque<"node">— node from which to get the clipping visibility state
Returns
visible:boolean—trueorfalse
gui.get_color(node: Opaque<"node">): Vector4
Returns the color of the supplied node. The components of the returned vector4 contains the color channel values:
Component Color value
x Red value
y Green value
z Blue value
w Alpha value
Parameters
node:Opaque<"node">— node to get the color from
Returns
color:Vector4— node color
gui.get_euler(node: Opaque<"node">): Vector3
Returns the rotation of the supplied node. The rotation is expressed in degree Euler angles.
Parameters
node:Opaque<"node">— node to get the rotation from
Returns
rotation:Vector3— node rotation
gui.get_fill_angle(node: Opaque<"node">): number
Returns the sector angle of a pie node.
Parameters
node:Opaque<"node">— node from which to get the fill angle
Returns
angle:number— sector angle
gui.get_flipbook(node: Opaque<"node">): Hash
Get node flipbook animation.
Parameters
node:Opaque<"node">— node to get flipbook animation from
Returns
animation:Hash— animation id
gui.get_flipbook_cursor(node: Opaque<"node">): number
This is only useful nodes with flipbook animations. Gets the normalized cursor of the flipbook animation on a node.
Parameters
node:Opaque<"node">— node to get the cursor for (node)
Returns
cursor:number— cursor value
gui.get_flipbook_playback_rate(node: Opaque<"node">): number
This is only useful nodes with flipbook animations. Gets the playback rate of the flipbook animation on a node.
Parameters
node:Opaque<"node">— node to set the cursor for
Returns
rate:number— playback rate
gui.get_font(node: Opaque<"node">): Hash
This is only useful for text nodes. The font must be mapped to the gui scene in the gui editor.
Parameters
node:Opaque<"node">— node from which to get the font
Returns
font:Hash— font id
gui.get_font_resource(font_name: Hash | string): Hash
This is only useful for text nodes. The font must be mapped to the gui scene in the gui editor.
// Get the text metrics for a text
export default defineGuiScript({
init(self) {
const node = gui.get_node("name");
const font_name = gui.get_font(node);
const font = gui.get_font_resource(font_name);
const metrics = resource.get_text_metrics(font, "The quick brown fox\n jumps over the lazy dog");
},
});function init(self)
local node = gui.get_node("name")
local font_name = gui.get_font(node)
local font = gui.get_font_resource(font_name)
local metrics = resource.get_text_metrics(font, "The quick brown fox\n jumps over the lazy dog")
endParameters
font_name:Hash | string— font of which to get the path hash
Returns
hash:Hash— path hash to resource
gui.get_height(): number
Returns the scene height.
Returns
height:number— scene height
gui.get_id(node: Opaque<"node">): Hash
Retrieves the id of the specified node.
// Gets the id of a node:
const node = gui.get_node("my_node");
const id = gui.get_id(node);
print(id); // => hash: [my_node]local node = gui.get_node("my_node")
local id = gui.get_id(node)
print(id) --> hash: [my_node]Parameters
node:Opaque<"node">— the node to retrieve the id from
Returns
id:Hash— the id of the node
gui.get_index(node: Opaque<"node">): number
Retrieve the index of the specified node among its siblings. The index defines the order in which a node appear in a GUI scene. Higher index means the node is drawn on top of lower indexed nodes.
// Compare the index order of two sibling nodes:
const node1 = gui.get_node("my_node_1");
const node2 = gui.get_node("my_node_2");
if (gui.get_index(node1) < gui.get_index(node2)) {
// node1 is drawn below node2
} else {
// node2 is drawn below node1
}local node1 = gui.get_node("my_node_1")
local node2 = gui.get_node("my_node_2")
if gui.get_index(node1) < gui.get_index(node2) then
-- node1 is drawn below node2
else
-- node2 is drawn below node1
endParameters
node:Opaque<"node">— the node to retrieve the id from
Returns
index:number— the index of the node. 0️⃣ 0-based; passed to Defold unchanged.
gui.get_inherit_alpha(node: Opaque<"node">): boolean
gets the node inherit alpha state
Parameters
node:Opaque<"node">— node from which to get the inherit alpha state
Returns
inherit_alpha:boolean—trueorfalse
gui.get_inner_radius(node: Opaque<"node">): number
Returns the inner radius of a pie node. The radius is defined along the x-axis.
Parameters
node:Opaque<"node">— node from where to get the inner radius
Returns
radius:number— inner radius
gui.get_layer(node: Opaque<"node">): Hash
The layer must be mapped to the gui scene in the gui editor.
Parameters
node:Opaque<"node">— node from which to get the layer
Returns
layer:Hash— layer id
gui.get_layout(): Hash
gets the scene current layout
Returns
layout:Hash— layout id
gui.get_layouts(): LuaMap<Hash, Vector3>
Returns a table mapping each layout id hash to a vector3(width, height, 0). For the default layout, the current scene resolution is returned. If a layout name is not present in the Display Profiles (or when no display profiles are assigned), the width/height pair is 0.
Returns
LuaMap<Hash, Vector3>— layout_id_hash -> vmath.vector3(width, height, 0)
gui.get_leading(node: Opaque<"node">): number
Returns the leading value for a text node.
Parameters
node:Opaque<"node">— node from where to get the leading
Returns
leading:number— leading scaling value (default=1)
gui.get_line_break(node: Opaque<"node">): boolean
Returns whether a text node is in line-break mode or not. This is only useful for text nodes.
Parameters
node:Opaque<"node">— node from which to get the line-break for
Returns
line_break:boolean—trueorfalse
gui.get_material(node: Opaque<"node">): Hash
Returns the material of a node. The material must be mapped to the gui scene in the gui editor.
// Getting the material for a node, and assign it to another node:
const node1 = gui.get_node("my_node");
const node2 = gui.get_node("other_node");
const node1_material = gui.get_material(node1);
gui.set_material(node2, node1_material);local node1 = gui.get_node("my_node")
local node2 = gui.get_node("other_node")
local node1_material = gui.get_material(node1)
gui.set_material(node2, node1_material)Parameters
node:Opaque<"node">— node to get the material for
Returns
materal:Hash— material id
gui.get_node(id: string | Hash): Opaque<"node">
Retrieves the node with the specified id.
// Gets a node by id and change its color:
const node = gui.get_node("my_node");
const red = vmath.vector4(1.0, 0.0, 0.0, 1.0);
gui.set_color(node, red);local node = gui.get_node("my_node")
local red = vmath.vector4(1.0, 0.0, 0.0, 1.0)
gui.set_color(node, red)Parameters
id:string | Hash— id of the node to retrieve
Returns
instance:Opaque<"node">— a new node instance
gui.get_outer_bounds(node: Opaque<"node">): gui.PieBounds
Returns the outer bounds mode for a pie node.
Parameters
node:Opaque<"node">— node from where to get the outer bounds mode
Returns
bounds_mode:gui.PieBounds— the outer bounds mode of the pie node
gui.get_outline(node: Opaque<"node">): Vector4
Returns the outline color of the supplied node. See gui.get_color for info how vectors encode color values.
Parameters
node:Opaque<"node">— node to get the outline color from
Returns
color:Vector4— outline color
gui.get_parent(node: Opaque<"node">): Opaque<"node"> | undefined
Returns the parent node of the specified node.
If the supplied node does not have a parent, nil is returned.
Parameters
node:Opaque<"node">— the node from which to retrieve its parent
Returns
parent:Opaque<"node"> | undefined— parent instance ornil
gui.get_particlefx(node: Opaque<"node">): Hash
Get the paricle fx for a gui node
Parameters
node:Opaque<"node">— node to get particle fx for
Returns
particlefx:Hash— particle fx id
gui.get_perimeter_vertices(node: Opaque<"node">): number
Returns the number of generated vertices around the perimeter of a pie node.
Parameters
node:Opaque<"node">— pie node
Returns
vertices:number— vertex count
gui.get_pivot(node: Opaque<"node">): gui.Pivot
The pivot specifies how the node is drawn and rotated from its position.
Parameters
node:Opaque<"node">— node to get pivot from
Returns
pivot:gui.Pivot— pivot constantgui.PIVOT_CENTERgui.PIVOT_Ngui.PIVOT_NEgui.PIVOT_Egui.PIVOT_SEgui.PIVOT_Sgui.PIVOT_SWgui.PIVOT_Wgui.PIVOT_NW
gui.get_position(node: Opaque<"node">): Vector3
Returns the position of the supplied node.
Parameters
node:Opaque<"node">— node to get the position from
Returns
position:Vector3— node position
gui.get_rotation(node: Opaque<"node">): Quaternion
Returns the rotation of the supplied node. The rotation is expressed as a quaternion
Parameters
node:Opaque<"node">— node to get the rotation from
Returns
rotation:Quaternion— node rotation
gui.get_scale(node: Opaque<"node">): Vector3
Returns the scale of the supplied node.
Parameters
node:Opaque<"node">— node to get the scale from
Returns
scale:Vector3— node scale
gui.get_screen_position(node: Opaque<"node">): Vector3
Returns the screen position of the supplied node. This function returns the calculated transformed position of the node, taking into account any parent node transforms.
Parameters
node:Opaque<"node">— node to get the screen position from
Returns
position:Vector3— node screen position
gui.get_shadow(node: Opaque<"node">): Vector4
Returns the shadow color of the supplied node. See gui.get_color for info how vectors encode color values.
Parameters
node:Opaque<"node">— node to get the shadow color from
Returns
color:Vector4— node shadow color
gui.get_size(node: Opaque<"node">): Vector3
Returns the size of the supplied node.
Parameters
node:Opaque<"node">— node to get the size from
Returns
size:Vector3— node size
gui.get_size_mode(node: Opaque<"node">): gui.SizeMode
Returns the size of a node. The size mode defines how the node will adjust itself in size. Automatic size mode alters the node size based on the node's content. Automatic size mode works for Box nodes and Pie nodes which will both adjust their size to match the assigned image. Particle fx and Text nodes will ignore any size mode setting.
Parameters
node:Opaque<"node">— node from which to get the size mode (node)
Returns
size_mode:gui.SizeMode— the current size mode
gui.get_slice9(node: Opaque<"node">): Vector4
Returns the slice9 configuration values for the node.
Parameters
node:Opaque<"node">— node to manipulate
Returns
values:Vector4— configuration values
gui.get_text(node: Opaque<"node">): string
Returns the text value of a text node. This is only useful for text nodes.
Parameters
node:Opaque<"node">— node from which to get the text
Returns
text:string— text value
gui.get_texture(node: Opaque<"node">): Hash
Returns the texture of a node. This is currently only useful for box or pie nodes. The texture must be mapped to the gui scene in the gui editor.
Parameters
node:Opaque<"node">— node to get texture from
Returns
texture:Hash— texture id
gui.get_tracking(node: Opaque<"node">): number
Returns the tracking value of a text node.
Parameters
node:Opaque<"node">— node from where to get the tracking
Returns
tracking:number— tracking scaling number (default=0)
gui.get_tree(node: Opaque<"node"> | undefined): LuaTable<Hash, Opaque<"node">> & { get: LuaTableGetMethod<string, Opaque<"node">> }
Get a node and all its children as a Lua table.
Parameters
node:Opaque<"node"> | undefined— root node to get node tree from, ornilto get the whole scene; leaving the argument out raises an error
Returns
clones:LuaTable<Hash, Opaque<"node">> & { get: LuaTableGetMethod<string, Opaque<"node">> }— a table mapping node ids to the corresponding nodes
gui.get_type(node: Opaque<"node">): LuaMultiReturn<[gui.Type, number | undefined]>
gets the node type
Parameters
node:Opaque<"node">— node from which to get the type
Returns
type:gui.Type— typesubtype:number | undefined— id of the custom type
gui.get_visible(node: Opaque<"node">): boolean
Returns true if a node is visible and false if it's not.
Invisible nodes are not rendered.
Parameters
node:Opaque<"node">— node to query
Returns
visible:boolean— whether the node is visible or not
gui.get_width(): number
Returns the scene width.
Returns
width:number— scene width
gui.get_xanchor(node: Opaque<"node">): Exclude<gui.Anchor, typeof gui.ANCHOR_BOTTOM | typeof gui.ANCHOR_TOP>
The x-anchor specifies how the node is moved when the game is run in a different resolution.
Parameters
node:Opaque<"node">— node to get x-anchor from
Returns
anchor:Exclude<gui.Anchor, typeof gui.ANCHOR_BOTTOM | typeof gui.ANCHOR_TOP>— anchor constantgui.ANCHOR_NONEgui.ANCHOR_LEFTgui.ANCHOR_RIGHT
gui.get_yanchor(node: Opaque<"node">): Exclude<gui.Anchor, typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_RIGHT>
The y-anchor specifies how the node is moved when the game is run in a different resolution.
Parameters
node:Opaque<"node">— node to get y-anchor from
Returns
anchor:Exclude<gui.Anchor, typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_RIGHT>— anchor constantgui.ANCHOR_NONEgui.ANCHOR_TOPgui.ANCHOR_BOTTOM
gui.hide_keyboard(): void
Hides the on-display touch keyboard on the device.
gui.is_enabled(node: Opaque<"node">, recursive?: boolean): boolean
Returns true if a node is enabled and false if it's not.
Disabled nodes are not rendered and animations acting on them are not evaluated.
Parameters
node:Opaque<"node">— node to queryrecursive?:boolean— check hierarchy recursively
Returns
enabled:boolean— whether the node is enabled or not
gui.move_above(node: Opaque<"node">, reference: Opaque<"node"> | undefined): void
Alters the ordering of the two supplied nodes by moving the first node
above the second.
If the second argument is nil the first node is moved to the top.
Parameters
node:Opaque<"node">— to movereference:Opaque<"node"> | undefined— reference node above which the first node should be moved
gui.move_below(node: Opaque<"node">, reference: Opaque<"node"> | undefined): void
Alters the ordering of the two supplied nodes by moving the first node
below the second.
If the second argument is nil the first node is moved to the bottom.
Parameters
node:Opaque<"node">— to movereference:Opaque<"node"> | undefined— reference node below which the first node should be moved
gui.new_box_node(pos: Vector3 | Vector4, size: Vector3): Opaque<"node">
Dynamically create a new box node.
Parameters
pos:Vector3 | Vector4— node positionsize:Vector3— node size
Returns
node:Opaque<"node">— new box node
gui.new_particlefx_node(pos: Vector3 | Vector4, particlefx: Hash | string): Opaque<"node">
Dynamically create a particle fx node.
Parameters
pos:Vector3 | Vector4— node positionparticlefx:Hash | string— particle fx resource name
Returns
node:Opaque<"node">— new particle fx node
gui.new_pie_node(pos: Vector3 | Vector4, size: Vector3): Opaque<"node">
Dynamically create a new pie node.
Parameters
pos:Vector3 | Vector4— node positionsize:Vector3— node size
Returns
node:Opaque<"node">— new pie node
gui.new_text_node(pos: Vector3 | Vector4, text: string): Opaque<"node">
Dynamically create a new text node.
Parameters
pos:Vector3 | Vector4— node positiontext:string— node text
Returns
node:Opaque<"node">— new text node
gui.new_texture(2 overloads): LuaMultiReturn<[boolean, number | undefined]>
- Signature changed in Defold 1.13.2
Dynamically create a new texture.
(texture_id: string | Hash, width: number, height: number, type: string | Opaque<"constant">, buffer: string)(texture_id: string | Hash, width: number, height: number, type: string | Opaque<"constant">, buffer: string, flip: boolean)Parameters
texture_id:string | Hash— texture idwidth:number— texture widthheight:number— texture heighttype:string | Opaque<"constant">— texture type"rgb"- RGB"rgba"- RGBA"l"- LUMINANCE"astc"- ASTC compressed format
buffer:string— texture dataflip:boolean— flip texture vertically
Returns
success:boolean— texture creation was successfulcode:number | undefined— one of the gui.RESULT_* codes if unsuccessful
How to create a texture and apply it to a new box node:
export default defineGuiScript({
init(self) {
const w = 200;
const h = 300;
// A nice orange. String with the RGB values.
const orange = String.fromCharCode(0xff, 0x80, 0x10);
// Create the texture. Repeat the color string for each pixel.
const [ok, reason] = gui.new_texture("orange_tx", w, h, "rgb", orange.repeat(w * h));
if (ok) {
// Create a box node and apply the texture to it.
const n = gui.new_box_node(vmath.vector3(200, 200, 0), vmath.vector3(w, h, 0));
gui.set_texture(n, "orange_tx");
} else {
// Could not create texture for some reason...
if (reason === gui.RESULT_TEXTURE_ALREADY_EXISTS) {
// ...
} else {
// ...
}
}
},
});function init(self)
local w = 200
local h = 300
-- A nice orange. String with the RGB values.
local orange = string.char(0xff) .. string.char(0x80) .. string.char(0x10)
-- Create the texture. Repeat the color string for each pixel.
local ok, reason = gui.new_texture("orange_tx", w, h, "rgb", string.rep(orange, w * h))
if ok then
-- Create a box node and apply the texture to it.
local n = gui.new_box_node(vmath.vector3(200, 200, 0), vmath.vector3(w, h, 0))
gui.set_texture(n, "orange_tx")
else
-- Could not create texture for some reason...
if reason == gui.RESULT_TEXTURE_ALREADY_EXISTS then
...
else
...
end
end
endHow to create a texture using .astc format
const size = 4;
const pos = vmath.vector3(200, 200, 0);
const path = "/assets/images/logo_4x4.astc";
const [data] = sys.load_resource(path);
if (data !== undefined) {
const n = gui.new_box_node(pos, vmath.vector3(size, size, 0));
// size is read from the .astc buffer
// flip is not supported
gui.new_texture(path, 0, 0, "astc", data, false);
gui.set_texture(n, path);
}local path = "/assets/images/logo_4x4.astc"
local buffer = sys.load_resource(path)
local n = gui.new_box_node(pos, vmath.vector3(size, size, 0))
-- size is read from the .astc buffer
-- flip is not supported
gui.new_texture(path, 0, 0, "astc", buffer, false)
gui.set_texture(n, path)gui.pick_node(node: Opaque<"node">, x: number, y: number): boolean
Tests whether a coordinate is within the bounding box of a node.
Parameters
node:Opaque<"node">— node to be tested for pickingx:number— x-coordinate (see on_input )y:number— y-coordinate (see on_input )
Returns
pickable:boolean— pick result
gui.play_flipbook(2 overloads): void
Play flipbook animation on a box or pie node. The current node texture must contain the animation. Use this function to set one-frame still images on the node.
(node: Opaque<"node">, animation: string | Hash, complete_function?: (self: unknown, node: unknown) => void)(node: Opaque<"node">, animation: string | Hash, complete_function: ((self: unknown, node: unknown) => void) | undefined, play_properties: { offset?: number; playback_rate?: number })Parameters
node:Opaque<"node">— node to set animation foranimation:string | Hash— animation idcomplete_function:((self: unknown, node: unknown) => void) | undefined— optional function to call when the animation has completedselfscript_instance The current script instance.nodenode The node that is animated.play_properties:{ offset?: number; playback_rate?: number }— optional playback properties
Set the texture of a node to a flipbook animation from an atlas:
function anim_callback(self: unknown, node: unknown) {
// Take action after animation has played.
}
export default defineGuiScript({
init(self) {
// Create a new node and set the texture to a flipbook animation
const node = gui.get_node("button_node");
gui.set_texture(node, "gui_sprites");
gui.play_flipbook(node, "animated_button");
},
});local function anim_callback(self, node)
-- Take action after animation has played.
end
function init(self)
-- Create a new node and set the texture to a flipbook animation
local node = gui.get_node("button_node")
gui.set_texture(node, "gui_sprites")
gui.play_flipbook(node, "animated_button")
endSet the texture of a node to an image from an atlas:
// Create a new node and set the texture to a "button.png" from atlas
const node = gui.get_node("button_node");
gui.set_texture(node, "gui_sprites");
gui.play_flipbook(node, "button");-- Create a new node and set the texture to a "button.png" from atlas
local node = gui.get_node("button_node")
gui.set_texture(node, "gui_sprites")
gui.play_flipbook(node, "button")gui.play_particlefx(node: Opaque<"node">, emitter_state_function?: (self: unknown, node: unknown, emitter: unknown, state: unknown) => void): void
Plays the paricle fx for a gui node
// How to play a particle fx when a gui node is created.
// The callback receives the gui node, the hash of the id
// of the emitter, and the new state of the emitter as particlefx.EMITTER_STATE_<STATE>.
export default defineGuiScript({
init(self) {
gui.play_particlefx(gui.get_node("particlefx"), (self, node, emitter, state) => {
if (emitter === hash("exhaust") && state === particlefx.EMITTER_STATE_POSTSPAWN) {
// exhaust is done spawning particles...
}
});
},
});local function emitter_state_change(self, node, emitter, state)
if emitter == hash("exhaust") and state == particlefx.EMITTER_STATE_POSTSPAWN then
-- exhaust is done spawning particles...
end
end
function init(self)
gui.play_particlefx(gui.get_node("particlefx"), emitter_state_change)
endParameters
node:Opaque<"node">— node to play particle fx foremitter_state_function?:(self: unknown, node: unknown, emitter: unknown, state: unknown) => void— optional callback function that will be called when an emitter attached to this particlefx changes state.
gui.reset_keyboard(): void
Resets the input context of keyboard. This will clear marked text.
gui.reset_material(node: Opaque<"node">): void
Resets the node material to the material assigned in the gui scene.
// Resetting the material for a node:
const node = gui.get_node("my_node");
gui.reset_material(node);local node = gui.get_node("my_node")
gui.reset_material(node)Parameters
node:Opaque<"node">— node to reset the material for
gui.reset_nodes(): void
Resets all nodes in the current GUI scene to their initial state. The reset only applies to static node loaded from the scene. Nodes that are created dynamically from script are not affected.
gui.screen_to_local(node: Opaque<"node">, screen_position: Vector3 | Vector4): Vector3
Converts a screen-space position to the local position value for the supplied node. The conversion takes the parent transform, anchors, adjust mode, and adjust reference into account.
// Animate a node to the pressed pointer position:
export default defineGuiScript({
init() {
msg.post(".", "acquire_input_focus");
return { marker: gui.get_node("marker") };
},
on_input(self, action_id, action) {
if (
action_id === hash("touch") &&
action.pressed &&
action.screen_x !== undefined &&
action.screen_y !== undefined
) {
const screen_position = vmath.vector3(action.screen_x, action.screen_y, 0);
const target_position = gui.screen_to_local(self.marker, screen_position);
gui.animate(self.marker, gui.PROP_POSITION, target_position, gui.EASING_OUTQUAD, 0.2);
return true;
}
},
});function init(self)
msg.post(".", "acquire_input_focus")
self.marker = gui.get_node("marker")
end
function on_input(self, action_id, action)
if action_id == hash("touch") and action.pressed then
local screen_position = vmath.vector3(action.screen_x, action.screen_y, 0)
local target_position = gui.screen_to_local(self.marker, screen_position)
gui.animate(self.marker, gui.PROP_POSITION, target_position, gui.EASING_OUTQUAD, 0.2)
return true
end
endParameters
node:Opaque<"node">— node whose local position space should be usedscreen_position:Vector3 | Vector4— screen-space position
Returns
local_position:Vector3— local position value for the node
gui.set(4 overloads): void
- 1 overload removed in Defold 1.13.1
(node: Opaque<"node">, property: Hash, value: number | Vector4 | Vector3 | Quaternion | Matrix4 | Hash)Sets a material constant of a node, or any property named by a hash. If a material specifies a constant called
tintin the .material file, set it withgui.set(node, hash("tint"), vmath.vector4(1, 0, 0, 1)), or pass a vmath.matrix4 if the constant is a matrix. To set one element of an array constant, pass an options table withindexset.(node: Opaque<"node">, property: Hash, value: number | Vector4 | Vector3 | Quaternion | Matrix4 | Hash, options: gui.PropertyOptions)Same description as form 1.
(url: Url, property: "material" | "materials" | "fonts" | "textures" | Hash, value: Hash)Sets a resource property of the gui component itself, addressed with
msg.url():"material", or the"materials","fonts"or"textures"entry named by thekeyoption. A property a native extension registers is named by a hash.(url: Url, property: "material" | "materials" | "fonts" | "textures" | Hash, value: Hash, options: gui.PropertyOptions)Same description as form 3.
Removed in Defold 1.13.1:
<K extends keyof gui.NodeProperties | gui.Prop>(node: Opaque<"node">, property: K, value: NodePropertyWrite<NodePropertyName<K>>)
gui.set_adjust_mode(node: Opaque<"node">, adjust_mode: gui.Adjust): void
Sets the adjust mode on a node. The adjust mode defines how the node will adjust itself to screen resolutions that differs from the one in the project settings.
Parameters
node:Opaque<"node">— node to set adjust mode foradjust_mode:gui.Adjust— adjust mode to set
gui.set_alpha(node: Opaque<"node">, alpha: number): void
sets the node alpha
Parameters
node:Opaque<"node">— node for which to set alphaalpha:number— 0..1 alpha color
gui.set_blend_mode(node: Opaque<"node">, blend_mode: gui.Blend): void
Set the blend mode of a node. Blend mode defines how the node will be blended with the background.
Parameters
node:Opaque<"node">— node to set blend mode forblend_mode:gui.Blend— blend mode to set
gui.set_clipping_inverted(node: Opaque<"node">, inverted: boolean): void
If node is set as an inverted clipping node, it will clip anything inside as opposed to outside.
Parameters
node:Opaque<"node">— node to set clipping inverted state forinverted:boolean—trueorfalse
gui.set_clipping_mode(node: Opaque<"node">, clipping_mode: gui.ClippingMode): void
Clipping mode defines how the node will clip it's children nodes
Parameters
node:Opaque<"node">— node to set clipping mode forclipping_mode:gui.ClippingMode— clipping mode to setgui.CLIPPING_MODE_NONEgui.CLIPPING_MODE_STENCIL
gui.set_clipping_visible(node: Opaque<"node">, visible: boolean): void
If node is set as an visible clipping node, it will be shown as well as clipping. Otherwise, it will only clip but not show visually.
Parameters
node:Opaque<"node">— node to set clipping visibility forvisible:boolean—trueorfalse
gui.set_color(node: Opaque<"node">, color: Vector3 | Vector4): void
Sets the color of the supplied node. The components of the supplied vector3 or vector4 should contain the color channel values in the range 0 to 1:
Component Color value
x Red value
y Green value
z Blue value
w vector4 Alpha value
Parameters
node:Opaque<"node">— node to set the color forcolor:Vector3 | Vector4— new color
gui.set_enabled(node: Opaque<"node">, enabled: boolean): void
Sets a node to the disabled or enabled state. Disabled nodes are not rendered and animations acting on them are not evaluated.
Parameters
node:Opaque<"node">— node to be enabled/disabledenabled:boolean— whether the node should be enabled or not
gui.set_euler(node: Opaque<"node">, rotation: Vector3 | Vector4): void
Sets the rotation of the supplied node. The rotation is expressed in degree Euler angles.
Parameters
node:Opaque<"node">— node to set the rotation forrotation:Vector3 | Vector4— new rotation
gui.set_fill_angle(node: Opaque<"node">, angle: number): void
Set the sector angle of a pie node.
Parameters
node:Opaque<"node">— node to set the fill angle forangle:number— sector angle
gui.set_flipbook_cursor(node: Opaque<"node">, cursor: number): void
This is only useful nodes with flipbook animations. The cursor is normalized.
Parameters
node:Opaque<"node">— node to set the cursor forcursor:number— cursor value
gui.set_flipbook_playback_rate(node: Opaque<"node">, playback_rate: number): void
This is only useful nodes with flipbook animations. Sets the playback rate of the flipbook animation on a node. Must be positive.
Parameters
node:Opaque<"node">— node to set the cursor forplayback_rate:number— playback rate
gui.set_font(node: Opaque<"node">, font: string | Hash): void
This is only useful for text nodes. The font must be mapped to the gui scene in the gui editor.
Parameters
node:Opaque<"node">— node for which to set the fontfont:string | Hash— font id
gui.set_id(node: Opaque<"node">, id: string | Hash): void
Set the id of the specicied node to a new value. Nodes created with the gui.new_*_node() functions get an empty id. This function allows you to give dynamically created nodes an id. No checking is done on the uniqueness of supplied ids. It is up to you to make sure you use unique ids.
// Create a new node and set its id:
const pos = vmath.vector3(100, 100, 0);
const size = vmath.vector3(100, 100, 0);
const node = gui.new_box_node(pos, size);
gui.set_id(node, "my_new_node");local pos = vmath.vector3(100, 100, 0)
local size = vmath.vector3(100, 100, 0)
local node = gui.new_box_node(pos, size)
gui.set_id(node, "my_new_node")Parameters
node:Opaque<"node">— node to set the id forid:string | Hash— id to set
gui.set_inherit_alpha(node: Opaque<"node">, inherit_alpha: boolean): void
sets the node inherit alpha state
Parameters
node:Opaque<"node">— node from which to set the inherit alpha stateinherit_alpha:boolean—trueorfalse
gui.set_inner_radius(node: Opaque<"node">, radius: number): void
Sets the inner radius of a pie node. The radius is defined along the x-axis.
Parameters
node:Opaque<"node">— node to set the inner radius forradius:number— inner radius
gui.set_layer(node: Opaque<"node">, layer: string | Hash): void
The layer must be mapped to the gui scene in the gui editor.
Parameters
node:Opaque<"node">— node for which to set the layerlayer:string | Hash— layer id
gui.set_layout(layout: string | Hash): boolean
Applies a named layout on the GUI scene. This re-applies per-layout node descriptors and, if a matching Display Profile exists, updates the scene resolution. Emits the "layout_changed" message to the scene script when the layout actually changes.
Parameters
layout:string | Hash— the layout id to apply
Returns
boolean— true if the layout exists in the scene and was applied, false otherwise
gui.set_leading(node: Opaque<"node">, leading: number): void
Sets the leading value for a text node. This value is used to scale the line spacing of text.
Parameters
node:Opaque<"node">— node for which to set the leadingleading:number— a scaling value for the line spacing (default=1)
gui.set_line_break(node: Opaque<"node">, line_break: boolean): void
Sets the line-break mode on a text node. This is only useful for text nodes.
Parameters
node:Opaque<"node">— node to set line-break forline_break:boolean—trueorfalse
gui.set_material(node: Opaque<"node">, material: string | Hash): void
Set the material on a node. The material must be mapped to the gui scene in the gui editor,
and assigning a material is supported for all node types. To set the default material that
is assigned to the gui scene node, use gui.reset_material(node_id) instead.
// Assign an existing material to a node:
const node = gui.get_node("my_node");
gui.set_material(node, "my_material");local node = gui.get_node("my_node")
gui.set_material(node, "my_material")Parameters
node:Opaque<"node">— node to set material formaterial:string | Hash— material id
gui.set_outer_bounds(node: Opaque<"node">, bounds_mode: gui.PieBounds): void
Sets the outer bounds mode for a pie node.
Parameters
node:Opaque<"node">— node for which to set the outer bounds modebounds_mode:gui.PieBounds— the outer bounds mode of the pie node
gui.set_outline(node: Opaque<"node">, color: Vector3 | Vector4): void
Sets the outline color of the supplied node. See gui.set_color for info how vectors encode color values.
Parameters
node:Opaque<"node">— node to set the outline color forcolor:Vector3 | Vector4— new outline color
gui.set_parent(node: Opaque<"node">, parent: Opaque<"node"> | undefined, keep_scene_transform?: boolean): void
Sets the parent node of the specified node.
Parameters
node:Opaque<"node">— node for which to set its parentparent:Opaque<"node"> | undefined— parent node to set, passnilto remove parentkeep_scene_transform?:boolean— optional flag to make the scene position being perserved
gui.set_particlefx(node: Opaque<"node">, particlefx: Hash | string): void
Set the paricle fx for a gui node
Parameters
node:Opaque<"node">— node to set particle fx forparticlefx:Hash | string— particle fx id
gui.set_perimeter_vertices(node: Opaque<"node">, vertices: number): void
Sets the number of generated vertices around the perimeter of a pie node.
Parameters
node:Opaque<"node">— pie nodevertices:number— vertex count
gui.set_pivot(node: Opaque<"node">, pivot: gui.Pivot): void
The pivot specifies how the node is drawn and rotated from its position.
Parameters
node:Opaque<"node">— node to set pivot forpivot:gui.Pivot— pivot constantgui.PIVOT_CENTERgui.PIVOT_Ngui.PIVOT_NEgui.PIVOT_Egui.PIVOT_SEgui.PIVOT_Sgui.PIVOT_SWgui.PIVOT_Wgui.PIVOT_NW
gui.set_position(node: Opaque<"node">, position: Vector3 | Vector4): void
Sets the position of the supplied node.
Parameters
node:Opaque<"node">— node to set the position forposition:Vector3 | Vector4— new position
gui.set_render_order(order: number): void
Set the order number for the current GUI scene. The number dictates the sorting of the "gui" render predicate, in other words in which order the scene will be rendered in relation to other currently rendered GUI scenes. The number must be in the range 0 to 15.
Parameters
order:number— rendering order (0-15)
gui.set_rotation(node: Opaque<"node">, rotation: Quaternion | Vector4 | Vector3): void
Sets the rotation of the supplied node. The rotation is expressed as a quaternion
Parameters
node:Opaque<"node">— node to set the rotation forrotation:Quaternion | Vector4 | Vector3— new rotation
gui.set_safe_area_mode(mode: gui.SafeArea): void
gui.set_scale(node: Opaque<"node">, scale: Vector3 | Vector4): void
Sets the scaling of the supplied node.
Parameters
node:Opaque<"node">— node to set the scale forscale:Vector3 | Vector4— new scale
gui.set_screen_position(node: Opaque<"node">, screen_position: Vector3 | Vector4): void
Set the screen position to the supplied node
Parameters
node:Opaque<"node">— node to set the screen position toscreen_position:Vector3 | Vector4— screen position
gui.set_shadow(node: Opaque<"node">, color: Vector3 | Vector4): void
Sets the shadow color of the supplied node. See gui.set_color for info how vectors encode color values.
Parameters
node:Opaque<"node">— node to set the shadow color forcolor:Vector3 | Vector4— new shadow color
gui.set_size(node: Opaque<"node">, size: Vector3 | Vector4): void
Sets the size of the supplied node. You can only set size on nodes with size mode set to SIZE_MODE_MANUAL
Parameters
node:Opaque<"node">— node to set the size forsize:Vector3 | Vector4— new size
gui.set_size_mode(node: Opaque<"node">, size_mode: gui.SizeMode): void
Sets the size mode of a node. The size mode defines how the node will adjust itself in size. Automatic size mode alters the node size based on the node's content. Automatic size mode works for Box nodes and Pie nodes which will both adjust their size to match the assigned image. Particle fx and Text nodes will ignore any size mode setting.
Parameters
node:Opaque<"node">— node to set size mode forsize_mode:gui.SizeMode— size mode to set
gui.set_slice9(node: Opaque<"node">, values: Vector4): void
Set the slice9 configuration values for the node.
Parameters
node:Opaque<"node">— node to manipulatevalues:Vector4— new values
gui.set_text(node: Opaque<"node">, text: string | number): void
Set the text value of a text node. This is only useful for text nodes.
Parameters
node:Opaque<"node">— node to set text fortext:string | number— text to set
gui.set_texture(node: Opaque<"node">, texture: string | Hash): void
Set the texture on a box or pie node. The texture must be mapped to
the gui scene in the gui editor. The function points out which texture
the node should render from. If the texture is an atlas, further
information is needed to select which image/animation in the atlas
to render. In such cases, use gui.play_flipbook() in
addition to this function.
To set a texture (or animation) from an atlas:
const node = gui.get_node("box_node");
gui.set_texture(node, "my_atlas");
gui.play_flipbook(node, "image");local node = gui.get_node("box_node")
gui.set_texture(node, "my_atlas")
gui.play_flipbook(node, "image")Set a dynamically created texture to a node. Note that there is only
one texture image in this case so gui.set_texture() is
sufficient.
const w = 200;
const h = 300;
// A nice orange. String with the RGB values.
const orange = String.fromCharCode(0xff, 0x80, 0x10);
// Create the texture. Repeat the color string for each pixel.
const [ok] = gui.new_texture("orange_tx", w, h, "rgb", orange.repeat(w * h));
if (ok) {
const node = gui.get_node("box_node");
gui.set_texture(node, "orange_tx");
}local w = 200
local h = 300
-- A nice orange. String with the RGB values.
local orange = string.char(0xff) .. string.char(0x80) .. string.char(0x10)
-- Create the texture. Repeat the color string for each pixel.
if gui.new_texture("orange_tx", w, h, "rgb", string.rep(orange, w * h)) then
local node = gui.get_node("box_node")
gui.set_texture(node, "orange_tx")
endParameters
node:Opaque<"node">— node to set texture fortexture:string | Hash— texture id
gui.set_texture_data(2 overloads): boolean
- Signature changed in Defold 1.13.2
Set the texture buffer data for a dynamically created texture.
(texture: string | Hash, width: number, height: number, type: string | Opaque<"constant">, buffer: string)(texture: string | Hash, width: number, height: number, type: string | Opaque<"constant">, buffer: string, flip: boolean)Parameters
texture:string | Hash— texture idwidth:number— texture widthheight:number— texture heighttype:string | Opaque<"constant">— texture type"rgb"- RGB"rgba"- RGBA"l"- LUMINANCE"astc"- ASTC compressed format
buffer:string— texture dataflip:boolean— flip texture vertically
Returns
success:boolean— setting the data was successful
export default defineGuiScript({
init(self) {
const w = 200;
const h = 300;
// Create a dynamic texture, all white.
if (gui.new_texture("dynamic_tx", w, h, "rgb", String.fromCharCode(0xff).repeat(w * h * 3))) {
// Create a box node and apply the texture to it.
const n = gui.new_box_node(vmath.vector3(200, 200, 0), vmath.vector3(w, h, 0));
gui.set_texture(n, "dynamic_tx");
// ...
// Change the data in the texture to a nice orange.
const orange = String.fromCharCode(0xff, 0x80, 0x10);
if (gui.set_texture_data("dynamic_tx", w, h, "rgb", orange.repeat(w * h))) {
// Go on and to more stuff
// ...
}
} else {
// Something went wrong
// ...
}
},
});function init(self)
local w = 200
local h = 300
-- Create a dynamic texture, all white.
if gui.new_texture("dynamic_tx", w, h, "rgb", string.rep(string.char(0xff), w * h * 3)) then
-- Create a box node and apply the texture to it.
local n = gui.new_box_node(vmath.vector3(200, 200, 0), vmath.vector3(w, h, 0))
gui.set_texture(n, "dynamic_tx")
...
-- Change the data in the texture to a nice orange.
local orange = string.char(0xff) .. string.char(0x80) .. string.char(0x10)
if gui.set_texture_data("dynamic_tx", w, h, "rgb", string.rep(orange, w * h)) then
-- Go on and to more stuff
...
end
else
-- Something went wrong
...
end
endgui.set_tracking(node: Opaque<"node">, tracking: number): void
Sets the tracking value of a text node. This value is used to adjust the vertical spacing of characters in the text.
Parameters
node:Opaque<"node">— node for which to set the trackingtracking:number— a scaling number for the letter spacing (default=0)
gui.set_visible(node: Opaque<"node">, visible: boolean): void
Set if a node should be visible or not. Only visible nodes are rendered.
Parameters
node:Opaque<"node">— node to be visible or notvisible:boolean— whether the node should be visible or not
gui.set_xanchor(node: Opaque<"node">, anchor: Exclude<gui.Anchor, typeof gui.ANCHOR_BOTTOM | typeof gui.ANCHOR_TOP>): void
The x-anchor specifies how the node is moved when the game is run in a different resolution.
Parameters
node:Opaque<"node">— node to set x-anchor foranchor:Exclude<gui.Anchor, typeof gui.ANCHOR_BOTTOM | typeof gui.ANCHOR_TOP>— anchor constantgui.ANCHOR_NONEgui.ANCHOR_LEFTgui.ANCHOR_RIGHT
gui.set_yanchor(node: Opaque<"node">, anchor: Exclude<gui.Anchor, typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_RIGHT>): void
The y-anchor specifies how the node is moved when the game is run in a different resolution.
Parameters
node:Opaque<"node">— node to set y-anchor foranchor:Exclude<gui.Anchor, typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_RIGHT>— anchor constantgui.ANCHOR_NONEgui.ANCHOR_TOPgui.ANCHOR_BOTTOM
gui.show_keyboard(type: gui.KeyboardType, autoclose: boolean): void
Shows the on-display touch keyboard. The specified type of keyboard is displayed if it is available on the device. This function is only available on iOS and Android. .
Parameters
type:gui.KeyboardType— keyboard typeautoclose:boolean— if the keyboard should automatically close when clicking outside
gui.stop_particlefx(2 overloads): void
Stops the particle fx for a gui node
(node: Opaque<"node">)(node: Opaque<"node">, options: { clear?: boolean })Parameters
node:Opaque<"node">— node to stop particle fx foroptions:{ clear?: boolean }— options used when stopping the particle fx
Constants
gui.ADJUST_FIT: number & { readonly __brand: "gui.ADJUST_FIT" }
fit adjust mode Adjust mode is used when the screen resolution differs from the project settings. The fit mode ensures that the entire node is visible in the adjusted gui scene.
gui.ADJUST_STRETCH: number & { readonly __brand: "gui.ADJUST_STRETCH" }
stretch adjust mode Adjust mode is used when the screen resolution differs from the project settings. The stretch mode ensures that the node is displayed as is in the adjusted gui scene, which might scale it non-uniformally.
gui.ADJUST_ZOOM: number & { readonly __brand: "gui.ADJUST_ZOOM" }
zoom adjust mode Adjust mode is used when the screen resolution differs from the project settings. The zoom mode ensures that the node fills its entire area and might make the node exceed it.
gui.ANCHOR_BOTTOM: number & { readonly __brand: "gui.ANCHOR_BOTTOM" }
bottom y-anchor
gui.ANCHOR_LEFT: number & { readonly __brand: "gui.ANCHOR_LEFT" }
left x-anchor
gui.ANCHOR_NONE: number & { readonly __brand: "gui.ANCHOR_NONE" }
no anchor
gui.ANCHOR_RIGHT: number & { readonly __brand: "gui.ANCHOR_RIGHT" }
right x-anchor
gui.ANCHOR_TOP: number & { readonly __brand: "gui.ANCHOR_TOP" }
top y-anchor
gui.BLEND_ADD: number & { readonly __brand: "gui.BLEND_ADD" }
additive blending
gui.BLEND_ADD_ALPHA: number & { readonly __brand: "gui.BLEND_ADD_ALPHA" }
additive alpha blending
gui.BLEND_ALPHA: number & { readonly __brand: "gui.BLEND_ALPHA" }
alpha blending
gui.BLEND_MULT: number & { readonly __brand: "gui.BLEND_MULT" }
multiply blending
gui.BLEND_SCREEN: number & { readonly __brand: "gui.BLEND_SCREEN" }
screen blending
gui.CLIPPING_MODE_NONE: number & { readonly __brand: "gui.CLIPPING_MODE_NONE" }
clipping mode none
gui.CLIPPING_MODE_STENCIL: number & { readonly __brand: "gui.CLIPPING_MODE_STENCIL" }
clipping mode stencil
gui.EASING_INBACK: number & { readonly __brand: "gui.EASING_INBACK" }
in-back
gui.EASING_INBOUNCE: number & { readonly __brand: "gui.EASING_INBOUNCE" }
in-bounce
gui.EASING_INCIRC: number & { readonly __brand: "gui.EASING_INCIRC" }
in-circlic
gui.EASING_INCUBIC: number & { readonly __brand: "gui.EASING_INCUBIC" }
in-cubic
gui.EASING_INELASTIC: number & { readonly __brand: "gui.EASING_INELASTIC" }
in-elastic
gui.EASING_INEXPO: number & { readonly __brand: "gui.EASING_INEXPO" }
in-exponential
gui.EASING_INOUTBACK: number & { readonly __brand: "gui.EASING_INOUTBACK" }
in-out-back
gui.EASING_INOUTBOUNCE: number & { readonly __brand: "gui.EASING_INOUTBOUNCE" }
in-out-bounce
gui.EASING_INOUTCIRC: number & { readonly __brand: "gui.EASING_INOUTCIRC" }
in-out-circlic
gui.EASING_INOUTCUBIC: number & { readonly __brand: "gui.EASING_INOUTCUBIC" }
in-out-cubic
gui.EASING_INOUTELASTIC: number & { readonly __brand: "gui.EASING_INOUTELASTIC" }
in-out-elastic
gui.EASING_INOUTEXPO: number & { readonly __brand: "gui.EASING_INOUTEXPO" }
in-out-exponential
gui.EASING_INOUTQUAD: number & { readonly __brand: "gui.EASING_INOUTQUAD" }
in-out-quadratic
gui.EASING_INOUTQUART: number & { readonly __brand: "gui.EASING_INOUTQUART" }
in-out-quartic
gui.EASING_INOUTQUINT: number & { readonly __brand: "gui.EASING_INOUTQUINT" }
in-out-quintic
gui.EASING_INOUTSINE: number & { readonly __brand: "gui.EASING_INOUTSINE" }
in-out-sine
gui.EASING_INQUAD: number & { readonly __brand: "gui.EASING_INQUAD" }
in-quadratic
gui.EASING_INQUART: number & { readonly __brand: "gui.EASING_INQUART" }
in-quartic
gui.EASING_INQUINT: number & { readonly __brand: "gui.EASING_INQUINT" }
in-quintic
gui.EASING_INSINE: number & { readonly __brand: "gui.EASING_INSINE" }
in-sine
gui.EASING_LINEAR: number & { readonly __brand: "gui.EASING_LINEAR" }
linear interpolation
gui.EASING_OUTBACK: number & { readonly __brand: "gui.EASING_OUTBACK" }
out-back
gui.EASING_OUTBOUNCE: number & { readonly __brand: "gui.EASING_OUTBOUNCE" }
out-bounce
gui.EASING_OUTCIRC: number & { readonly __brand: "gui.EASING_OUTCIRC" }
out-circlic
gui.EASING_OUTCUBIC: number & { readonly __brand: "gui.EASING_OUTCUBIC" }
out-cubic
gui.EASING_OUTELASTIC: number & { readonly __brand: "gui.EASING_OUTELASTIC" }
out-elastic
gui.EASING_OUTEXPO: number & { readonly __brand: "gui.EASING_OUTEXPO" }
out-exponential
gui.EASING_OUTINBACK: number & { readonly __brand: "gui.EASING_OUTINBACK" }
out-in-back
gui.EASING_OUTINBOUNCE: number & { readonly __brand: "gui.EASING_OUTINBOUNCE" }
out-in-bounce
gui.EASING_OUTINCIRC: number & { readonly __brand: "gui.EASING_OUTINCIRC" }
out-in-circlic
gui.EASING_OUTINCUBIC: number & { readonly __brand: "gui.EASING_OUTINCUBIC" }
out-in-cubic
gui.EASING_OUTINELASTIC: number & { readonly __brand: "gui.EASING_OUTINELASTIC" }
out-in-elastic
gui.EASING_OUTINEXPO: number & { readonly __brand: "gui.EASING_OUTINEXPO" }
out-in-exponential
gui.EASING_OUTINQUAD: number & { readonly __brand: "gui.EASING_OUTINQUAD" }
out-in-quadratic
gui.EASING_OUTINQUART: number & { readonly __brand: "gui.EASING_OUTINQUART" }
out-in-quartic
gui.EASING_OUTINQUINT: number & { readonly __brand: "gui.EASING_OUTINQUINT" }
out-in-quintic
gui.EASING_OUTINSINE: number & { readonly __brand: "gui.EASING_OUTINSINE" }
out-in-sine
gui.EASING_OUTQUAD: number & { readonly __brand: "gui.EASING_OUTQUAD" }
out-quadratic
gui.EASING_OUTQUART: number & { readonly __brand: "gui.EASING_OUTQUART" }
out-quartic
gui.EASING_OUTQUINT: number & { readonly __brand: "gui.EASING_OUTQUINT" }
out-quintic
gui.EASING_OUTSINE: number & { readonly __brand: "gui.EASING_OUTSINE" }
out-sine
gui.KEYBOARD_TYPE_DEFAULT: number & { readonly __brand: "gui.KEYBOARD_TYPE_DEFAULT" }
default keyboard
gui.KEYBOARD_TYPE_EMAIL: number & { readonly __brand: "gui.KEYBOARD_TYPE_EMAIL" }
email keyboard
gui.KEYBOARD_TYPE_NUMBER_PAD: number & { readonly __brand: "gui.KEYBOARD_TYPE_NUMBER_PAD" }
number input keyboard
gui.KEYBOARD_TYPE_PASSWORD: number & { readonly __brand: "gui.KEYBOARD_TYPE_PASSWORD" }
password keyboard
gui.PIEBOUNDS_ELLIPSE: number & { readonly __brand: "gui.PIEBOUNDS_ELLIPSE" }
elliptical pie node bounds
gui.PIEBOUNDS_RECTANGLE: number & { readonly __brand: "gui.PIEBOUNDS_RECTANGLE" }
rectangular pie node bounds
gui.PIVOT_CENTER: number & { readonly __brand: "gui.PIVOT_CENTER" }
center pivot
gui.PIVOT_E: number & { readonly __brand: "gui.PIVOT_E" }
east pivot
gui.PIVOT_N: number & { readonly __brand: "gui.PIVOT_N" }
north pivot
gui.PIVOT_NE: number & { readonly __brand: "gui.PIVOT_NE" }
north-east pivot
gui.PIVOT_NW: number & { readonly __brand: "gui.PIVOT_NW" }
north-west pivot
gui.PIVOT_S: number & { readonly __brand: "gui.PIVOT_S" }
south pivot
gui.PIVOT_SE: number & { readonly __brand: "gui.PIVOT_SE" }
south-east pivot
gui.PIVOT_SW: number & { readonly __brand: "gui.PIVOT_SW" }
south-west pivot
gui.PIVOT_W: number & { readonly __brand: "gui.PIVOT_W" }
west pivot
gui.PLAYBACK_LOOP_BACKWARD: number & { readonly __brand: "gui.PLAYBACK_LOOP_BACKWARD" }
loop backward
gui.PLAYBACK_LOOP_FORWARD: number & { readonly __brand: "gui.PLAYBACK_LOOP_FORWARD" }
loop forward
gui.PLAYBACK_LOOP_PINGPONG: number & { readonly __brand: "gui.PLAYBACK_LOOP_PINGPONG" }
ping pong loop
gui.PLAYBACK_ONCE_BACKWARD: number & { readonly __brand: "gui.PLAYBACK_ONCE_BACKWARD" }
once backward
gui.PLAYBACK_ONCE_FORWARD: number & { readonly __brand: "gui.PLAYBACK_ONCE_FORWARD" }
once forward
gui.PLAYBACK_ONCE_PINGPONG: number & { readonly __brand: "gui.PLAYBACK_ONCE_PINGPONG" }
once forward and then backward
gui.PROP_COLOR: string & { readonly __brand: "gui.PROP_COLOR" }
color property
gui.PROP_EULER: string & { readonly __brand: "gui.PROP_EULER" }
euler property
gui.PROP_FILL_ANGLE: string & { readonly __brand: "gui.PROP_FILL_ANGLE" }
fill_angle property
gui.PROP_INNER_RADIUS: string & { readonly __brand: "gui.PROP_INNER_RADIUS" }
inner_radius property
gui.PROP_LEADING: string & { readonly __brand: "gui.PROP_LEADING" }
leading property
gui.PROP_OUTLINE: string & { readonly __brand: "gui.PROP_OUTLINE" }
outline color property
gui.PROP_POSITION: string & { readonly __brand: "gui.PROP_POSITION" }
position property
gui.PROP_ROTATION: string & { readonly __brand: "gui.PROP_ROTATION" }
rotation property
gui.PROP_SCALE: string & { readonly __brand: "gui.PROP_SCALE" }
scale property
gui.PROP_SHADOW: string & { readonly __brand: "gui.PROP_SHADOW" }
shadow color property
gui.PROP_SIZE: string & { readonly __brand: "gui.PROP_SIZE" }
size property
gui.PROP_SLICE9: string & { readonly __brand: "gui.PROP_SLICE9" }
slice9 property
gui.PROP_TRACKING: string & { readonly __brand: "gui.PROP_TRACKING" }
tracking property
gui.RESULT_DATA_ERROR: number & { readonly __brand: "gui.RESULT_DATA_ERROR" }
data error The provided data is not in the expected format or is in some other way incorrect, for instance the image data provided to gui.new_texture().
gui.RESULT_OUT_OF_RESOURCES: number & { readonly __brand: "gui.RESULT_OUT_OF_RESOURCES" }
out of resource The system is out of resources, for instance when trying to create a new texture using gui.new_texture().
gui.RESULT_TEXTURE_ALREADY_EXISTS: number & { readonly __brand: "gui.RESULT_TEXTURE_ALREADY_EXISTS" }
texture already exists The texture id already exists when trying to use gui.new_texture().
gui.SAFE_AREA_BOTH: number & { readonly __brand: "gui.SAFE_AREA_BOTH" }
both sides safe area Safe area mode that applies insets on all edges.
gui.SAFE_AREA_LONG: number & { readonly __brand: "gui.SAFE_AREA_LONG" }
long side safe area Safe area mode that applies insets only on the long edges.
gui.SAFE_AREA_NONE: number & { readonly __brand: "gui.SAFE_AREA_NONE" }
no safe area Safe area mode that ignores safe area insets.
gui.SAFE_AREA_SHORT: number & { readonly __brand: "gui.SAFE_AREA_SHORT" }
short side safe area Safe area mode that applies insets only on the short edges.
gui.SIZE_MODE_AUTO: number & { readonly __brand: "gui.SIZE_MODE_AUTO" }
automatic size mode The size of the node is determined by the currently assigned texture.
gui.SIZE_MODE_MANUAL: number & { readonly __brand: "gui.SIZE_MODE_MANUAL" }
manual size mode The size of the node is determined by the size set in the editor, the constructor or by gui.set_size()
gui.TYPE_BOX: number & { readonly __brand: "gui.TYPE_BOX" }
box type
gui.TYPE_CUSTOM: number & { readonly __brand: "gui.TYPE_CUSTOM" }
custom type
gui.TYPE_PARTICLEFX: number & { readonly __brand: "gui.TYPE_PARTICLEFX" }
particlefx type
gui.TYPE_PIE: number & { readonly __brand: "gui.TYPE_PIE" }
pie type
gui.TYPE_TEXT: number & { readonly __brand: "gui.TYPE_TEXT" }
text type
Properties
fonts: Hash
The fonts used in the gui. The type of the property is hash. Key must be specified in options table.
material: Hash
The main material (the default material assigned to a GUI) used when rendering the gui. The type of the property is hash.
materials: Hash
The materials used when rendering the gui. The type of the property is hash. Key must be specified in options table.
textures: Hash
The textures used in the gui. The type of the property is hash. Key must be specified in options table.