baochungit/defold-wrap/wrap.wrap
The module a project requires to use defold-wrap: node and go wrap one GUI node or
game object, or a list of them, so calls on them chain, and gui_applet creates an
applet that shows scenes.
- GitHub: baochungit/defold-wrap — pinned to
1.1.0- Pick a release from baochungit/defold-wrap releases and add its Source code (zip) URL (or a packaged
.zipasset, if the library ships one) togame.projectunder[project]dependencies, then Fetch Libraries in the Defold editor. - Run
bunx @defold-typescript/cli resolveto materialize its types. - Import it under a namespace alias of your choice:
import * as wrap from "wrap.wrap"
- Pick a release from baochungit/defold-wrap releases and add its Source code (zip) URL (or a packaged
Functions
node(3 overloads)
(node: string | Opaque<'node'>, tree?: NodeTree): NodeWraps a GUI node, from
wrap.node.new.Parameters
node:string | Opaque<'node'>— The node, or its id. An id is looked up intreefirst, then withgui.get_node.tree?:NodeTree— A table fromgui.clone_treeorgui.get_treeto look an id up in.
Returns
Node
<const K extends string>(node: readonly K[], tree?: NodeTree): NodeList<K>Wraps the node with each id, keyed by the id, from
wrap.node_list.new.Parameters
node:readonly K[]— The node ids.tree?:NodeTree— A table fromgui.clone_treeorgui.get_treeto look each id up in first. An id it lacks, or every id when it is omitted, is looked up withgui.get_node.
Returns
NodeList<K>
<K extends string>(node: Record<K, string | Opaque<'node'>>, tree?: NodeTree): NodeList<K>Wraps each node, keyed by its name, from
wrap.node_list.new.Parameters
node:Record<K, string | Opaque<'node'>>— Each name, paired with a node id or a node.tree?:NodeTree— A table fromgui.clone_treeorgui.get_treeto look each id up in first. An id it lacks, or every id when it is omitted, is looked up withgui.get_node.
Returns
NodeList<K>
go(3 overloads)
(go: SceneGameObjectAddress | Hash | Url): GoWraps a game object, from
wrap.go.new.Parameters
go:SceneGameObjectAddress | Hash | Url— The game object's url.
Returns
Go
<const K extends string>(go: readonly K[]): GoList<K>Wraps the game object at each url, keyed by the url, from
wrap.go_list.new.Parameters
go:readonly K[]— The game object urls.
Returns
GoList<K>
<K extends string>(go: Record<K, SceneGameObjectAddress | Hash | Url>): GoList<K>Wraps each game object, keyed by its name, from
wrap.go_list.new.Parameters
go:Record<K, SceneGameObjectAddress | Hash | Url>— Each name, paired with a game object url.
Returns
GoList<K>
gui_applet(2 overloads): GuiApplet
(root_node: string | Opaque<'node'>, scene?: GuiSceneClass<object>)Creates an applet on a node, from
wrap.gui_applet.new, and when given a scene class shows a new scene of it.Parameters
root_node:string | Opaque<'node'>— The node, or the idgui.get_nodelooks it up by.scene?:GuiSceneClass<object>— A classwrap.gui_scene.extendreturns.
<F extends object = {}>(root_node: string | Opaque<'node'>, scene: GuiSceneHooks<F>)Creates an applet on a node, from
wrap.gui_applet.new, and shows a scene built from a plain table of hooks and fields, copied onto a freshwrap.gui_scene.extend().Parameters
root_node:string | Opaque<'node'>— The node, or the idgui.get_nodelooks it up by.scene:GuiSceneHooks<F>— The hooks and fields, each hook seeing the scene asthis.
Returns
GuiApplet