@defold-typescript/types 0.39.0 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/api-availability.json +4024 -716
  2. package/api-migrations.json +27 -0
  3. package/api-signatures.json +18118 -10264
  4. package/api-targets.json +448 -11
  5. package/examples/translations.json +619 -148
  6. package/fixtures/messages_doc.json +96 -0
  7. package/generated/b2d.d.ts +680 -4
  8. package/generated/b2d_body.d.ts +29 -103
  9. package/generated/b2d_chain.d.ts +5 -6
  10. package/generated/b2d_fixture.d.ts +34 -38
  11. package/generated/b2d_joint.d.ts +503 -25
  12. package/generated/b2d_shape.d.ts +199 -14
  13. package/generated/b2d_world.d.ts +57 -63
  14. package/generated/buffer.d.ts +33 -29
  15. package/generated/builtin-messages.d.ts +7 -1
  16. package/generated/bullet3d.d.ts +91 -0
  17. package/generated/bullet3d_collision_object.d.ts +433 -0
  18. package/generated/bullet3d_constraint.d.ts +818 -0
  19. package/generated/bullet3d_rigid_body.d.ts +429 -0
  20. package/generated/bullet3d_shape.d.ts +123 -0
  21. package/generated/bullet3d_world.d.ts +492 -0
  22. package/generated/camera.d.ts +31 -34
  23. package/generated/collectionfactory.d.ts +26 -27
  24. package/generated/collectionproxy.d.ts +22 -6
  25. package/generated/compute.d.ts +12 -238
  26. package/generated/crash.d.ts +24 -10
  27. package/generated/editor-vm/http.d.ts +90 -7
  28. package/generated/editor-vm/image.d.ts +7 -7
  29. package/generated/editor-vm/json.d.ts +11 -0
  30. package/generated/editor-vm/localization.d.ts +7 -7
  31. package/generated/editor-vm/tilemap_tiles.d.ts +56 -10
  32. package/generated/editor-vm/zip.d.ts +28 -0
  33. package/generated/editor.d.ts +1496 -430
  34. package/generated/factory.d.ts +21 -25
  35. package/generated/font.d.ts +64 -22
  36. package/generated/go.d.ts +243 -186
  37. package/generated/graphics.d.ts +374 -84
  38. package/generated/gui.d.ts +282 -492
  39. package/generated/html5.d.ts +5 -3
  40. package/generated/http.d.ts +31 -36
  41. package/generated/image.d.ts +127 -85
  42. package/generated/json.d.ts +34 -16
  43. package/generated/kinds/gui-script.d.ts +8 -0
  44. package/generated/kinds/render-script.d.ts +8 -0
  45. package/generated/kinds/script.d.ts +8 -0
  46. package/generated/label.d.ts +77 -7
  47. package/generated/liveupdate.d.ts +13 -10
  48. package/generated/material.d.ts +312 -360
  49. package/generated/model.d.ts +72 -42
  50. package/generated/particlefx.d.ts +19 -28
  51. package/generated/physics.d.ts +378 -144
  52. package/generated/profiler.d.ts +14 -24
  53. package/generated/render.d.ts +294 -297
  54. package/generated/resource.d.ts +753 -641
  55. package/generated/socket.d.ts +131 -134
  56. package/generated/sound.d.ts +65 -34
  57. package/generated/sprite.d.ts +39 -17
  58. package/generated/sys.d.ts +237 -182
  59. package/generated/tilemap.d.ts +21 -16
  60. package/generated/timer.d.ts +34 -21
  61. package/generated/versions/defold-1.12.4/b2d_body.d.ts +0 -7
  62. package/generated/versions/defold-1.12.4/buffer.d.ts +18 -17
  63. package/generated/versions/defold-1.12.4/camera.d.ts +23 -23
  64. package/generated/versions/defold-1.12.4/collectionfactory.d.ts +21 -19
  65. package/generated/versions/defold-1.12.4/collectionproxy.d.ts +2 -2
  66. package/generated/versions/defold-1.12.4/crash.d.ts +2 -2
  67. package/generated/versions/defold-1.12.4/factory.d.ts +15 -16
  68. package/generated/versions/defold-1.12.4/go.d.ts +15 -17
  69. package/generated/versions/defold-1.12.4/gui.d.ts +111 -193
  70. package/generated/versions/defold-1.12.4/html5.d.ts +4 -2
  71. package/generated/versions/defold-1.12.4/http.d.ts +4 -15
  72. package/generated/versions/defold-1.12.4/image.d.ts +38 -46
  73. package/generated/versions/defold-1.12.4/index.d.ts +2 -0
  74. package/generated/versions/defold-1.12.4/json.d.ts +10 -6
  75. package/generated/versions/defold-1.12.4/label.d.ts +2 -3
  76. package/generated/versions/defold-1.12.4/liveupdate.d.ts +5 -3
  77. package/generated/versions/defold-1.12.4/model.d.ts +34 -13
  78. package/generated/versions/defold-1.12.4/particlefx.d.ts +2 -5
  79. package/generated/versions/defold-1.12.4/physics.d.ts +82 -78
  80. package/generated/versions/defold-1.12.4/profiler.d.ts +3 -6
  81. package/generated/versions/defold-1.12.4/render.d.ts +160 -132
  82. package/generated/versions/defold-1.12.4/resource.d.ts +212 -209
  83. package/generated/versions/defold-1.12.4/socket.d.ts +45 -61
  84. package/generated/versions/defold-1.12.4/sound.d.ts +11 -11
  85. package/generated/versions/defold-1.12.4/sprite.d.ts +24 -6
  86. package/generated/versions/defold-1.12.4/sys.d.ts +45 -68
  87. package/generated/versions/defold-1.12.4/tilemap.d.ts +18 -11
  88. package/generated/versions/defold-1.12.4/timer.d.ts +5 -3
  89. package/generated/versions/defold-1.12.4/vmath.d.ts +5 -26
  90. package/generated/versions/defold-1.12.4/window.d.ts +1 -16
  91. package/generated/versions/defold-1.13.0/b2d_body.d.ts +10 -55
  92. package/generated/versions/defold-1.13.0/b2d_fixture.d.ts +25 -25
  93. package/generated/versions/defold-1.13.0/b2d_shape.d.ts +188 -5
  94. package/generated/versions/defold-1.13.0/b2d_world.d.ts +16 -10
  95. package/generated/versions/defold-1.13.0/buffer.d.ts +18 -17
  96. package/generated/versions/defold-1.13.0/camera.d.ts +27 -27
  97. package/generated/versions/defold-1.13.0/collectionfactory.d.ts +21 -19
  98. package/generated/versions/defold-1.13.0/collectionproxy.d.ts +2 -2
  99. package/generated/versions/defold-1.13.0/compute.d.ts +1 -70
  100. package/generated/versions/defold-1.13.0/crash.d.ts +2 -2
  101. package/generated/versions/defold-1.13.0/editor-vm/tilemap_tiles.d.ts +3 -3
  102. package/generated/versions/defold-1.13.0/editor.d.ts +34 -24
  103. package/generated/versions/defold-1.13.0/factory.d.ts +15 -16
  104. package/generated/versions/defold-1.13.0/go.d.ts +15 -17
  105. package/generated/versions/defold-1.13.0/graphics.d.ts +121 -37
  106. package/generated/versions/defold-1.13.0/gui.d.ts +111 -193
  107. package/generated/versions/defold-1.13.0/html5.d.ts +4 -2
  108. package/generated/versions/defold-1.13.0/http.d.ts +4 -15
  109. package/generated/versions/defold-1.13.0/image.d.ts +38 -46
  110. package/generated/versions/defold-1.13.0/index.d.ts +2 -0
  111. package/generated/versions/defold-1.13.0/json.d.ts +10 -6
  112. package/generated/versions/defold-1.13.0/label.d.ts +2 -3
  113. package/generated/versions/defold-1.13.0/liveupdate.d.ts +7 -5
  114. package/generated/versions/defold-1.13.0/material.d.ts +69 -107
  115. package/generated/versions/defold-1.13.0/model.d.ts +34 -13
  116. package/generated/versions/defold-1.13.0/particlefx.d.ts +2 -5
  117. package/generated/versions/defold-1.13.0/physics.d.ts +82 -78
  118. package/generated/versions/defold-1.13.0/profiler.d.ts +3 -6
  119. package/generated/versions/defold-1.13.0/render.d.ts +160 -132
  120. package/generated/versions/defold-1.13.0/resource.d.ts +217 -210
  121. package/generated/versions/defold-1.13.0/socket.d.ts +45 -61
  122. package/generated/versions/defold-1.13.0/sound.d.ts +11 -11
  123. package/generated/versions/defold-1.13.0/sprite.d.ts +24 -6
  124. package/generated/versions/defold-1.13.0/sys.d.ts +45 -68
  125. package/generated/versions/defold-1.13.0/tilemap.d.ts +18 -11
  126. package/generated/versions/defold-1.13.0/timer.d.ts +5 -3
  127. package/generated/versions/defold-1.13.0/vmath.d.ts +5 -26
  128. package/generated/versions/defold-1.13.0/window.d.ts +1 -16
  129. package/generated/versions/defold-1.13.1/b2d.d.ts +33 -0
  130. package/generated/versions/defold-1.13.1/b2d_body.d.ts +636 -0
  131. package/generated/versions/defold-1.13.1/b2d_chain.d.ts +106 -0
  132. package/generated/versions/defold-1.13.1/b2d_fixture.d.ts +157 -0
  133. package/generated/versions/defold-1.13.1/b2d_joint.d.ts +823 -0
  134. package/generated/versions/defold-1.13.1/b2d_shape.d.ts +400 -0
  135. package/generated/versions/defold-1.13.1/b2d_world.d.ts +320 -0
  136. package/generated/versions/defold-1.13.1/buffer.d.ts +189 -0
  137. package/generated/versions/defold-1.13.1/camera.d.ts +303 -0
  138. package/generated/versions/defold-1.13.1/collectionfactory.d.ts +151 -0
  139. package/generated/versions/defold-1.13.1/collectionproxy.d.ts +93 -0
  140. package/generated/versions/defold-1.13.1/compute.d.ts +237 -0
  141. package/generated/versions/defold-1.13.1/crash.d.ts +143 -0
  142. package/generated/versions/defold-1.13.1/editor-vm/http.d.ts +56 -0
  143. package/generated/versions/defold-1.13.1/editor-vm/image.d.ts +48 -0
  144. package/generated/versions/defold-1.13.1/editor-vm/json.d.ts +10 -0
  145. package/generated/versions/defold-1.13.1/editor-vm/localization.d.ts +42 -0
  146. package/generated/versions/defold-1.13.1/editor-vm/tilemap_tiles.d.ts +80 -0
  147. package/generated/versions/defold-1.13.1/editor-vm/zip.d.ts +10 -0
  148. package/generated/versions/defold-1.13.1/editor-vm/zlib.d.ts +24 -0
  149. package/generated/versions/defold-1.13.1/editor.d.ts +1121 -0
  150. package/generated/versions/defold-1.13.1/factory.d.ts +124 -0
  151. package/generated/versions/defold-1.13.1/font.d.ts +81 -0
  152. package/generated/versions/defold-1.13.1/go.d.ts +1107 -0
  153. package/generated/versions/defold-1.13.1/graphics.d.ts +411 -0
  154. package/generated/versions/defold-1.13.1/gui.d.ts +2353 -0
  155. package/generated/versions/defold-1.13.1/html5.d.ts +55 -0
  156. package/generated/versions/defold-1.13.1/http.d.ts +77 -0
  157. package/generated/versions/defold-1.13.1/image.d.ts +131 -0
  158. package/generated/versions/defold-1.13.1/index.d.ts +57 -0
  159. package/generated/versions/defold-1.13.1/json.d.ts +80 -0
  160. package/generated/versions/defold-1.13.1/kinds/editor-script.d.ts +14 -0
  161. package/generated/versions/defold-1.13.1/label.d.ts +93 -0
  162. package/generated/versions/defold-1.13.1/liveupdate.d.ts +142 -0
  163. package/generated/versions/defold-1.13.1/material.d.ts +408 -0
  164. package/generated/versions/defold-1.13.1/model.d.ts +272 -0
  165. package/generated/versions/defold-1.13.1/msg.d.ts +10 -0
  166. package/generated/versions/defold-1.13.1/particlefx.d.ts +163 -0
  167. package/generated/versions/defold-1.13.1/physics.d.ts +559 -0
  168. package/generated/versions/defold-1.13.1/profiler.d.ts +235 -0
  169. package/generated/versions/defold-1.13.1/render.d.ts +1190 -0
  170. package/generated/versions/defold-1.13.1/resource.d.ts +1523 -0
  171. package/generated/versions/defold-1.13.1/socket.d.ts +784 -0
  172. package/generated/versions/defold-1.13.1/sound.d.ts +292 -0
  173. package/generated/versions/defold-1.13.1/sprite.d.ts +175 -0
  174. package/generated/versions/defold-1.13.1/sys.d.ts +678 -0
  175. package/generated/versions/defold-1.13.1/tilemap.d.ts +208 -0
  176. package/generated/versions/defold-1.13.1/timer.d.ts +125 -0
  177. package/generated/versions/defold-1.13.1/types.d.ts +61 -0
  178. package/generated/versions/defold-1.13.1/vmath.d.ts +774 -0
  179. package/generated/versions/defold-1.13.1/window.d.ts +183 -0
  180. package/generated/versions/defold-1.13.1/zlib.d.ts +41 -0
  181. package/generated/vmath.d.ts +6 -26
  182. package/generated/window.d.ts +71 -71
  183. package/identity-vocabulary.json +561 -0
  184. package/index.d.ts +8 -0
  185. package/package.json +13 -2
  186. package/scripts/example-store-io.ts +12 -1
  187. package/scripts/extension-goldens.ts +1 -0
  188. package/scripts/fidelity-baseline.json +146 -46
  189. package/scripts/generate-api-availability.ts +90 -12
  190. package/scripts/generate-api-signatures.ts +14 -3
  191. package/scripts/import-defold-release.ts +85 -24
  192. package/scripts/prose-constants.ts +157 -0
  193. package/scripts/regen.ts +396 -78
  194. package/scripts/shared-handle-methods.ts +53 -0
  195. package/scripts/signature-store-fs.ts +1 -0
  196. package/scripts/sync-api-docs.ts +16 -5
  197. package/src/api-availability.ts +0 -0
  198. package/src/api-doc.ts +201 -3
  199. package/src/api-identity.ts +252 -0
  200. package/src/component-properties.d.ts +33 -0
  201. package/src/core-types.ts +28 -3
  202. package/src/correction-pins.ts +49 -0
  203. package/src/custom-messages.d.ts +4 -3
  204. package/src/doc-comment.ts +139 -23
  205. package/src/doc-corrections.ts +108 -0
  206. package/src/editor-vm-globals.d.ts +5 -2
  207. package/src/emit-dts.ts +2474 -281
  208. package/src/emit-messages.ts +52 -0
  209. package/src/engine-globals.d.ts +2 -2
  210. package/src/example-store.ts +125 -14
  211. package/src/field-correction-coverage.ts +204 -0
  212. package/src/fnv1a.ts +16 -0
  213. package/src/go-overloads.d.ts +33 -13
  214. package/src/index-base-table.ts +145 -0
  215. package/src/index-slot-classifications.ts +588 -0
  216. package/src/index.ts +39 -2
  217. package/src/library-index-slot-classifications.ts +332 -0
  218. package/src/lifecycle.ts +61 -199
  219. package/src/luals-type-expr.ts +354 -0
  220. package/src/msg-overloads.d.ts +0 -1
  221. package/src/param-correction-provenance.ts +64 -0
  222. package/src/return-correction-provenance.ts +58 -16
  223. package/src/script-api.ts +3 -1
  224. package/src/sys-overloads.d.ts +48 -0
  225. package/src/vmath-overloads.d.ts +27 -1
  226. package/src/window-event-guard.d.ts +6 -9
  227. package/url-parameters.json +1 -2
@@ -0,0 +1,2353 @@
1
+ /** @noSelfInFile */
2
+ import type { Hash, Matrix4, Opaque, Quaternion, Url, Vector, Vector3, Vector4 } from "../../../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * GUI API documentation
7
+ */
8
+ namespace gui {
9
+ type AdjustMode = typeof gui.ADJUST_FIT | typeof gui.ADJUST_ZOOM | typeof gui.ADJUST_STRETCH;
10
+ type BlendMode = typeof gui.BLEND_ALPHA | typeof gui.BLEND_ADD | typeof gui.BLEND_ADD_ALPHA | typeof gui.BLEND_MULT | typeof gui.BLEND_SCREEN;
11
+ type ClippingMode = typeof gui.CLIPPING_MODE_NONE | typeof gui.CLIPPING_MODE_STENCIL;
12
+ type Easing = typeof gui.EASING_INBACK | typeof gui.EASING_INBOUNCE | typeof gui.EASING_INCIRC | typeof gui.EASING_INCUBIC | typeof gui.EASING_INELASTIC | typeof gui.EASING_INEXPO | typeof gui.EASING_INOUTBACK | typeof gui.EASING_INOUTBOUNCE | typeof gui.EASING_INOUTCIRC | typeof gui.EASING_INOUTCUBIC | typeof gui.EASING_INOUTELASTIC | typeof gui.EASING_INOUTEXPO | typeof gui.EASING_INOUTQUAD | typeof gui.EASING_INOUTQUART | typeof gui.EASING_INOUTQUINT | typeof gui.EASING_INOUTSINE | typeof gui.EASING_INQUAD | typeof gui.EASING_INQUART | typeof gui.EASING_INQUINT | typeof gui.EASING_INSINE | typeof gui.EASING_LINEAR | typeof gui.EASING_OUTBACK | typeof gui.EASING_OUTBOUNCE | typeof gui.EASING_OUTCIRC | typeof gui.EASING_OUTCUBIC | typeof gui.EASING_OUTELASTIC | typeof gui.EASING_OUTEXPO | typeof gui.EASING_OUTINBACK | typeof gui.EASING_OUTINBOUNCE | typeof gui.EASING_OUTINCIRC | typeof gui.EASING_OUTINCUBIC | typeof gui.EASING_OUTINELASTIC | typeof gui.EASING_OUTINEXPO | typeof gui.EASING_OUTINQUAD | typeof gui.EASING_OUTINQUART | typeof gui.EASING_OUTINQUINT | typeof gui.EASING_OUTINSINE | typeof gui.EASING_OUTQUAD | typeof gui.EASING_OUTQUART | typeof gui.EASING_OUTQUINT | typeof gui.EASING_OUTSINE;
13
+ type KeyboardType = typeof gui.KEYBOARD_TYPE_DEFAULT | typeof gui.KEYBOARD_TYPE_EMAIL | typeof gui.KEYBOARD_TYPE_NUMBER_PAD | typeof gui.KEYBOARD_TYPE_PASSWORD;
14
+ type NodeType = typeof gui.TYPE_BOX | typeof gui.TYPE_TEXT | typeof gui.TYPE_PIE | typeof gui.TYPE_PARTICLEFX | typeof gui.TYPE_CUSTOM;
15
+ type PieBounds = typeof gui.PIEBOUNDS_RECTANGLE | typeof gui.PIEBOUNDS_ELLIPSE;
16
+ type Pivot = typeof gui.PIVOT_CENTER | typeof gui.PIVOT_N | typeof gui.PIVOT_NE | typeof gui.PIVOT_E | typeof gui.PIVOT_SE | typeof gui.PIVOT_S | typeof gui.PIVOT_SW | typeof gui.PIVOT_W | typeof gui.PIVOT_NW;
17
+ type Playback = typeof gui.PLAYBACK_ONCE_FORWARD | typeof gui.PLAYBACK_ONCE_BACKWARD | typeof gui.PLAYBACK_ONCE_PINGPONG | typeof gui.PLAYBACK_LOOP_FORWARD | typeof gui.PLAYBACK_LOOP_BACKWARD | typeof gui.PLAYBACK_LOOP_PINGPONG;
18
+ type Property = typeof gui.PROP_POSITION | typeof gui.PROP_ROTATION | typeof gui.PROP_EULER | typeof gui.PROP_SCALE | typeof gui.PROP_COLOR | typeof gui.PROP_OUTLINE | typeof gui.PROP_SHADOW | typeof gui.PROP_SIZE | typeof gui.PROP_FILL_ANGLE | typeof gui.PROP_INNER_RADIUS | typeof gui.PROP_LEADING | typeof gui.PROP_TRACKING | typeof gui.PROP_SLICE9;
19
+ type SafeAreaMode = typeof gui.SAFE_AREA_NONE | typeof gui.SAFE_AREA_LONG | typeof gui.SAFE_AREA_SHORT | typeof gui.SAFE_AREA_BOTH;
20
+ type SizeMode = typeof gui.SIZE_MODE_MANUAL | typeof gui.SIZE_MODE_AUTO;
21
+ type XAnchor = typeof gui.ANCHOR_NONE | typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_RIGHT;
22
+ type YAnchor = typeof gui.ANCHOR_NONE | typeof gui.ANCHOR_TOP | typeof gui.ANCHOR_BOTTOM;
23
+ /**
24
+ * Adjust mode is used when the screen resolution differs from the project settings.
25
+ * The fit mode ensures that the entire node is visible in the adjusted gui scene.
26
+ */
27
+ const ADJUST_FIT: number & { readonly __brand: "gui.ADJUST_FIT" };
28
+ /**
29
+ * Adjust mode is used when the screen resolution differs from the project settings.
30
+ * The stretch mode ensures that the node is displayed as is in the adjusted gui scene, which might scale it non-uniformally.
31
+ */
32
+ const ADJUST_STRETCH: number & { readonly __brand: "gui.ADJUST_STRETCH" };
33
+ /**
34
+ * Adjust mode is used when the screen resolution differs from the project settings.
35
+ * The zoom mode ensures that the node fills its entire area and might make the node exceed it.
36
+ */
37
+ const ADJUST_ZOOM: number & { readonly __brand: "gui.ADJUST_ZOOM" };
38
+ /**
39
+ * bottom y-anchor
40
+ */
41
+ const ANCHOR_BOTTOM: number & { readonly __brand: "gui.ANCHOR_BOTTOM" };
42
+ /**
43
+ * left x-anchor
44
+ */
45
+ const ANCHOR_LEFT: number & { readonly __brand: "gui.ANCHOR_LEFT" };
46
+ /**
47
+ * no anchor
48
+ */
49
+ const ANCHOR_NONE: number & { readonly __brand: "gui.ANCHOR_NONE" };
50
+ /**
51
+ * right x-anchor
52
+ */
53
+ const ANCHOR_RIGHT: number & { readonly __brand: "gui.ANCHOR_RIGHT" };
54
+ /**
55
+ * top y-anchor
56
+ */
57
+ const ANCHOR_TOP: number & { readonly __brand: "gui.ANCHOR_TOP" };
58
+ /**
59
+ * additive blending
60
+ */
61
+ const BLEND_ADD: number & { readonly __brand: "gui.BLEND_ADD" };
62
+ /**
63
+ * additive alpha blending
64
+ */
65
+ const BLEND_ADD_ALPHA: number & { readonly __brand: "gui.BLEND_ADD_ALPHA" };
66
+ /**
67
+ * alpha blending
68
+ */
69
+ const BLEND_ALPHA: number & { readonly __brand: "gui.BLEND_ALPHA" };
70
+ /**
71
+ * multiply blending
72
+ */
73
+ const BLEND_MULT: number & { readonly __brand: "gui.BLEND_MULT" };
74
+ /**
75
+ * screen blending
76
+ */
77
+ const BLEND_SCREEN: number & { readonly __brand: "gui.BLEND_SCREEN" };
78
+ /**
79
+ * clipping mode none
80
+ */
81
+ const CLIPPING_MODE_NONE: number & { readonly __brand: "gui.CLIPPING_MODE_NONE" };
82
+ /**
83
+ * clipping mode stencil
84
+ */
85
+ const CLIPPING_MODE_STENCIL: number & { readonly __brand: "gui.CLIPPING_MODE_STENCIL" };
86
+ /**
87
+ * in-back
88
+ */
89
+ const EASING_INBACK: number & { readonly __brand: "gui.EASING_INBACK" };
90
+ /**
91
+ * in-bounce
92
+ */
93
+ const EASING_INBOUNCE: number & { readonly __brand: "gui.EASING_INBOUNCE" };
94
+ /**
95
+ * in-circlic
96
+ */
97
+ const EASING_INCIRC: number & { readonly __brand: "gui.EASING_INCIRC" };
98
+ /**
99
+ * in-cubic
100
+ */
101
+ const EASING_INCUBIC: number & { readonly __brand: "gui.EASING_INCUBIC" };
102
+ /**
103
+ * in-elastic
104
+ */
105
+ const EASING_INELASTIC: number & { readonly __brand: "gui.EASING_INELASTIC" };
106
+ /**
107
+ * in-exponential
108
+ */
109
+ const EASING_INEXPO: number & { readonly __brand: "gui.EASING_INEXPO" };
110
+ /**
111
+ * in-out-back
112
+ */
113
+ const EASING_INOUTBACK: number & { readonly __brand: "gui.EASING_INOUTBACK" };
114
+ /**
115
+ * in-out-bounce
116
+ */
117
+ const EASING_INOUTBOUNCE: number & { readonly __brand: "gui.EASING_INOUTBOUNCE" };
118
+ /**
119
+ * in-out-circlic
120
+ */
121
+ const EASING_INOUTCIRC: number & { readonly __brand: "gui.EASING_INOUTCIRC" };
122
+ /**
123
+ * in-out-cubic
124
+ */
125
+ const EASING_INOUTCUBIC: number & { readonly __brand: "gui.EASING_INOUTCUBIC" };
126
+ /**
127
+ * in-out-elastic
128
+ */
129
+ const EASING_INOUTELASTIC: number & { readonly __brand: "gui.EASING_INOUTELASTIC" };
130
+ /**
131
+ * in-out-exponential
132
+ */
133
+ const EASING_INOUTEXPO: number & { readonly __brand: "gui.EASING_INOUTEXPO" };
134
+ /**
135
+ * in-out-quadratic
136
+ */
137
+ const EASING_INOUTQUAD: number & { readonly __brand: "gui.EASING_INOUTQUAD" };
138
+ /**
139
+ * in-out-quartic
140
+ */
141
+ const EASING_INOUTQUART: number & { readonly __brand: "gui.EASING_INOUTQUART" };
142
+ /**
143
+ * in-out-quintic
144
+ */
145
+ const EASING_INOUTQUINT: number & { readonly __brand: "gui.EASING_INOUTQUINT" };
146
+ /**
147
+ * in-out-sine
148
+ */
149
+ const EASING_INOUTSINE: number & { readonly __brand: "gui.EASING_INOUTSINE" };
150
+ /**
151
+ * in-quadratic
152
+ */
153
+ const EASING_INQUAD: number & { readonly __brand: "gui.EASING_INQUAD" };
154
+ /**
155
+ * in-quartic
156
+ */
157
+ const EASING_INQUART: number & { readonly __brand: "gui.EASING_INQUART" };
158
+ /**
159
+ * in-quintic
160
+ */
161
+ const EASING_INQUINT: number & { readonly __brand: "gui.EASING_INQUINT" };
162
+ /**
163
+ * in-sine
164
+ */
165
+ const EASING_INSINE: number & { readonly __brand: "gui.EASING_INSINE" };
166
+ /**
167
+ * linear interpolation
168
+ */
169
+ const EASING_LINEAR: number & { readonly __brand: "gui.EASING_LINEAR" };
170
+ /**
171
+ * out-back
172
+ */
173
+ const EASING_OUTBACK: number & { readonly __brand: "gui.EASING_OUTBACK" };
174
+ /**
175
+ * out-bounce
176
+ */
177
+ const EASING_OUTBOUNCE: number & { readonly __brand: "gui.EASING_OUTBOUNCE" };
178
+ /**
179
+ * out-circlic
180
+ */
181
+ const EASING_OUTCIRC: number & { readonly __brand: "gui.EASING_OUTCIRC" };
182
+ /**
183
+ * out-cubic
184
+ */
185
+ const EASING_OUTCUBIC: number & { readonly __brand: "gui.EASING_OUTCUBIC" };
186
+ /**
187
+ * out-elastic
188
+ */
189
+ const EASING_OUTELASTIC: number & { readonly __brand: "gui.EASING_OUTELASTIC" };
190
+ /**
191
+ * out-exponential
192
+ */
193
+ const EASING_OUTEXPO: number & { readonly __brand: "gui.EASING_OUTEXPO" };
194
+ /**
195
+ * out-in-back
196
+ */
197
+ const EASING_OUTINBACK: number & { readonly __brand: "gui.EASING_OUTINBACK" };
198
+ /**
199
+ * out-in-bounce
200
+ */
201
+ const EASING_OUTINBOUNCE: number & { readonly __brand: "gui.EASING_OUTINBOUNCE" };
202
+ /**
203
+ * out-in-circlic
204
+ */
205
+ const EASING_OUTINCIRC: number & { readonly __brand: "gui.EASING_OUTINCIRC" };
206
+ /**
207
+ * out-in-cubic
208
+ */
209
+ const EASING_OUTINCUBIC: number & { readonly __brand: "gui.EASING_OUTINCUBIC" };
210
+ /**
211
+ * out-in-elastic
212
+ */
213
+ const EASING_OUTINELASTIC: number & { readonly __brand: "gui.EASING_OUTINELASTIC" };
214
+ /**
215
+ * out-in-exponential
216
+ */
217
+ const EASING_OUTINEXPO: number & { readonly __brand: "gui.EASING_OUTINEXPO" };
218
+ /**
219
+ * out-in-quadratic
220
+ */
221
+ const EASING_OUTINQUAD: number & { readonly __brand: "gui.EASING_OUTINQUAD" };
222
+ /**
223
+ * out-in-quartic
224
+ */
225
+ const EASING_OUTINQUART: number & { readonly __brand: "gui.EASING_OUTINQUART" };
226
+ /**
227
+ * out-in-quintic
228
+ */
229
+ const EASING_OUTINQUINT: number & { readonly __brand: "gui.EASING_OUTINQUINT" };
230
+ /**
231
+ * out-in-sine
232
+ */
233
+ const EASING_OUTINSINE: number & { readonly __brand: "gui.EASING_OUTINSINE" };
234
+ /**
235
+ * out-quadratic
236
+ */
237
+ const EASING_OUTQUAD: number & { readonly __brand: "gui.EASING_OUTQUAD" };
238
+ /**
239
+ * out-quartic
240
+ */
241
+ const EASING_OUTQUART: number & { readonly __brand: "gui.EASING_OUTQUART" };
242
+ /**
243
+ * out-quintic
244
+ */
245
+ const EASING_OUTQUINT: number & { readonly __brand: "gui.EASING_OUTQUINT" };
246
+ /**
247
+ * out-sine
248
+ */
249
+ const EASING_OUTSINE: number & { readonly __brand: "gui.EASING_OUTSINE" };
250
+ /**
251
+ * default keyboard
252
+ */
253
+ const KEYBOARD_TYPE_DEFAULT: number & { readonly __brand: "gui.KEYBOARD_TYPE_DEFAULT" };
254
+ /**
255
+ * email keyboard
256
+ */
257
+ const KEYBOARD_TYPE_EMAIL: number & { readonly __brand: "gui.KEYBOARD_TYPE_EMAIL" };
258
+ /**
259
+ * number input keyboard
260
+ */
261
+ const KEYBOARD_TYPE_NUMBER_PAD: number & { readonly __brand: "gui.KEYBOARD_TYPE_NUMBER_PAD" };
262
+ /**
263
+ * password keyboard
264
+ */
265
+ const KEYBOARD_TYPE_PASSWORD: number & { readonly __brand: "gui.KEYBOARD_TYPE_PASSWORD" };
266
+ /**
267
+ * elliptical pie node bounds
268
+ */
269
+ const PIEBOUNDS_ELLIPSE: number & { readonly __brand: "gui.PIEBOUNDS_ELLIPSE" };
270
+ /**
271
+ * rectangular pie node bounds
272
+ */
273
+ const PIEBOUNDS_RECTANGLE: number & { readonly __brand: "gui.PIEBOUNDS_RECTANGLE" };
274
+ /**
275
+ * center pivot
276
+ */
277
+ const PIVOT_CENTER: number & { readonly __brand: "gui.PIVOT_CENTER" };
278
+ /**
279
+ * east pivot
280
+ */
281
+ const PIVOT_E: number & { readonly __brand: "gui.PIVOT_E" };
282
+ /**
283
+ * north pivot
284
+ */
285
+ const PIVOT_N: number & { readonly __brand: "gui.PIVOT_N" };
286
+ /**
287
+ * north-east pivot
288
+ */
289
+ const PIVOT_NE: number & { readonly __brand: "gui.PIVOT_NE" };
290
+ /**
291
+ * north-west pivot
292
+ */
293
+ const PIVOT_NW: number & { readonly __brand: "gui.PIVOT_NW" };
294
+ /**
295
+ * south pivot
296
+ */
297
+ const PIVOT_S: number & { readonly __brand: "gui.PIVOT_S" };
298
+ /**
299
+ * south-east pivot
300
+ */
301
+ const PIVOT_SE: number & { readonly __brand: "gui.PIVOT_SE" };
302
+ /**
303
+ * south-west pivot
304
+ */
305
+ const PIVOT_SW: number & { readonly __brand: "gui.PIVOT_SW" };
306
+ /**
307
+ * west pivot
308
+ */
309
+ const PIVOT_W: number & { readonly __brand: "gui.PIVOT_W" };
310
+ /**
311
+ * loop backward
312
+ */
313
+ const PLAYBACK_LOOP_BACKWARD: number & { readonly __brand: "gui.PLAYBACK_LOOP_BACKWARD" };
314
+ /**
315
+ * loop forward
316
+ */
317
+ const PLAYBACK_LOOP_FORWARD: number & { readonly __brand: "gui.PLAYBACK_LOOP_FORWARD" };
318
+ /**
319
+ * ping pong loop
320
+ */
321
+ const PLAYBACK_LOOP_PINGPONG: number & { readonly __brand: "gui.PLAYBACK_LOOP_PINGPONG" };
322
+ /**
323
+ * once backward
324
+ */
325
+ const PLAYBACK_ONCE_BACKWARD: number & { readonly __brand: "gui.PLAYBACK_ONCE_BACKWARD" };
326
+ /**
327
+ * once forward
328
+ */
329
+ const PLAYBACK_ONCE_FORWARD: number & { readonly __brand: "gui.PLAYBACK_ONCE_FORWARD" };
330
+ /**
331
+ * once forward and then backward
332
+ */
333
+ const PLAYBACK_ONCE_PINGPONG: number & { readonly __brand: "gui.PLAYBACK_ONCE_PINGPONG" };
334
+ /**
335
+ * color property
336
+ */
337
+ const PROP_COLOR: string & { readonly __brand: "gui.PROP_COLOR" };
338
+ /**
339
+ * euler property
340
+ */
341
+ const PROP_EULER: string & { readonly __brand: "gui.PROP_EULER" };
342
+ /**
343
+ * fill_angle property
344
+ */
345
+ const PROP_FILL_ANGLE: string & { readonly __brand: "gui.PROP_FILL_ANGLE" };
346
+ /**
347
+ * inner_radius property
348
+ */
349
+ const PROP_INNER_RADIUS: string & { readonly __brand: "gui.PROP_INNER_RADIUS" };
350
+ /**
351
+ * leading property
352
+ */
353
+ const PROP_LEADING: string & { readonly __brand: "gui.PROP_LEADING" };
354
+ /**
355
+ * outline color property
356
+ */
357
+ const PROP_OUTLINE: string & { readonly __brand: "gui.PROP_OUTLINE" };
358
+ /**
359
+ * position property
360
+ */
361
+ const PROP_POSITION: string & { readonly __brand: "gui.PROP_POSITION" };
362
+ /**
363
+ * rotation property
364
+ */
365
+ const PROP_ROTATION: string & { readonly __brand: "gui.PROP_ROTATION" };
366
+ /**
367
+ * scale property
368
+ */
369
+ const PROP_SCALE: string & { readonly __brand: "gui.PROP_SCALE" };
370
+ /**
371
+ * shadow color property
372
+ */
373
+ const PROP_SHADOW: string & { readonly __brand: "gui.PROP_SHADOW" };
374
+ /**
375
+ * size property
376
+ */
377
+ const PROP_SIZE: string & { readonly __brand: "gui.PROP_SIZE" };
378
+ /**
379
+ * slice9 property
380
+ */
381
+ const PROP_SLICE9: string & { readonly __brand: "gui.PROP_SLICE9" };
382
+ /**
383
+ * tracking property
384
+ */
385
+ const PROP_TRACKING: string & { readonly __brand: "gui.PROP_TRACKING" };
386
+ /**
387
+ * The provided data is not in the expected format or is in some other way
388
+ * incorrect, for instance the image data provided to gui.new_texture().
389
+ */
390
+ const RESULT_DATA_ERROR: number & { readonly __brand: "gui.RESULT_DATA_ERROR" };
391
+ /**
392
+ * The system is out of resources, for instance when trying to create a new
393
+ * texture using gui.new_texture().
394
+ */
395
+ const RESULT_OUT_OF_RESOURCES: number & { readonly __brand: "gui.RESULT_OUT_OF_RESOURCES" };
396
+ /**
397
+ * The texture id already exists when trying to use gui.new_texture().
398
+ */
399
+ const RESULT_TEXTURE_ALREADY_EXISTS: number & { readonly __brand: "gui.RESULT_TEXTURE_ALREADY_EXISTS" };
400
+ /**
401
+ * Safe area mode that applies insets on all edges.
402
+ */
403
+ const SAFE_AREA_BOTH: number & { readonly __brand: "gui.SAFE_AREA_BOTH" };
404
+ /**
405
+ * Safe area mode that applies insets only on the long edges.
406
+ */
407
+ const SAFE_AREA_LONG: number & { readonly __brand: "gui.SAFE_AREA_LONG" };
408
+ /**
409
+ * Safe area mode that ignores safe area insets.
410
+ */
411
+ const SAFE_AREA_NONE: number & { readonly __brand: "gui.SAFE_AREA_NONE" };
412
+ /**
413
+ * Safe area mode that applies insets only on the short edges.
414
+ */
415
+ const SAFE_AREA_SHORT: number & { readonly __brand: "gui.SAFE_AREA_SHORT" };
416
+ /**
417
+ * The size of the node is determined by the currently assigned texture.
418
+ */
419
+ const SIZE_MODE_AUTO: number & { readonly __brand: "gui.SIZE_MODE_AUTO" };
420
+ /**
421
+ * The size of the node is determined by the size set in the editor, the constructor or by gui.set_size()
422
+ */
423
+ const SIZE_MODE_MANUAL: number & { readonly __brand: "gui.SIZE_MODE_MANUAL" };
424
+ /**
425
+ * box type
426
+ */
427
+ const TYPE_BOX: number & { readonly __brand: "gui.TYPE_BOX" };
428
+ /**
429
+ * custom type
430
+ */
431
+ const TYPE_CUSTOM: number & { readonly __brand: "gui.TYPE_CUSTOM" };
432
+ /**
433
+ * particlefx type
434
+ */
435
+ const TYPE_PARTICLEFX: number & { readonly __brand: "gui.TYPE_PARTICLEFX" };
436
+ /**
437
+ * pie type
438
+ */
439
+ const TYPE_PIE: number & { readonly __brand: "gui.TYPE_PIE" };
440
+ /**
441
+ * text type
442
+ */
443
+ const TYPE_TEXT: number & { readonly __brand: "gui.TYPE_TEXT" };
444
+ /**
445
+ * This starts an animation of a node property according to the specified parameters.
446
+ * If the node property is already being animated, that animation will be canceled and
447
+ * replaced by the new one. Note however that several different node properties
448
+ * can be animated simultaneously. Use `gui.cancel_animations` to stop the animation
449
+ * before it has completed.
450
+ * Composite properties of type vector3, vector4 or quaternion
451
+ * also expose their sub-components (x, y, z and w).
452
+ * You can address the components individually by suffixing the name with a dot '.'
453
+ * and the name of the component.
454
+ * For instance, `"position.x"` (the position x coordinate) or `"color.w"`
455
+ * (the color alpha value).
456
+ * If a `complete_function` (Lua function) is specified, that function will be called
457
+ * when the animation has completed.
458
+ * By starting a new animation in that function, several animations can be sequenced
459
+ * together. See the examples below for more information.
460
+ *
461
+ * @param node - node to animate
462
+ * @param property - property to animate
463
+ *
464
+ * - `"position"`
465
+ * - `"rotation"`
466
+ * - `"euler"`
467
+ * - `"scale"`
468
+ * - `"color"`
469
+ * - `"outline"`
470
+ * - `"shadow"`
471
+ * - `"size"`
472
+ * - `"fill_angle"` (pie)
473
+ * - `"inner_radius"` (pie)
474
+ * - `"leading"` (text)
475
+ * - `"tracking"` (text)
476
+ * - `"slice9"` (slice9)
477
+ *
478
+ * The following property constants are defined equaling the corresponding property string names.
479
+ *
480
+ * - `gui.PROP_POSITION`
481
+ * - `gui.PROP_ROTATION`
482
+ * - `gui.PROP_EULER`
483
+ * - `gui.PROP_SCALE`
484
+ * - `gui.PROP_COLOR`
485
+ * - `gui.PROP_OUTLINE`
486
+ * - `gui.PROP_SHADOW`
487
+ * - `gui.PROP_SIZE`
488
+ * - `gui.PROP_FILL_ANGLE`
489
+ * - `gui.PROP_INNER_RADIUS`
490
+ * - `gui.PROP_LEADING`
491
+ * - `gui.PROP_TRACKING`
492
+ * - `gui.PROP_SLICE9`
493
+ * @param to - target property value
494
+ * @param easing - easing to use during animation.
495
+ * Either specify one of the `gui.EASING_*` constants or provide a
496
+ * vector with a custom curve. See the animation guide for more information.
497
+ * @param duration - duration of the animation in seconds.
498
+ * @param delay - delay before the animation starts in seconds.
499
+ * @param complete_function - function to call when the
500
+ * animation has completed
501
+ * @param playback - playback mode
502
+ *
503
+ * - `gui.PLAYBACK_ONCE_FORWARD`
504
+ * - `gui.PLAYBACK_ONCE_BACKWARD`
505
+ * - `gui.PLAYBACK_ONCE_PINGPONG`
506
+ * - `gui.PLAYBACK_LOOP_FORWARD`
507
+ * - `gui.PLAYBACK_LOOP_BACKWARD`
508
+ * - `gui.PLAYBACK_LOOP_PINGPONG`
509
+ * @example
510
+ * How to start a simple color animation, where the node fades in to white during 0.5 seconds:
511
+ * ```ts
512
+ * // How to start a simple color animation, where the node fades in to white during 0.5 seconds:
513
+ * const node = gui.get_node("my_node");
514
+ * gui.set_color(node, vmath.vector4(0, 0, 0, 0)); // node is fully transparent
515
+ * gui.animate(node, gui.PROP_COLOR, vmath.vector4(1, 1, 1, 1), gui.EASING_INOUTQUAD, 0.5); // start animation
516
+ * ```
517
+ * @example
518
+ * 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:
519
+ * ```ts
520
+ * // How to start a sequenced animation where the node fades in to white during 0.5
521
+ * // seconds, stays visible for 2 seconds and then fades out:
522
+ * function on_animation_done(self: unknown, node: unknown) {
523
+ * // fade out node, but wait 2 seconds before the animation starts
524
+ * gui.animate(node as Opaque<"node">, gui.PROP_COLOR, vmath.vector4(0, 0, 0, 0), gui.EASING_OUTQUAD, 0.5, 2.0);
525
+ * }
526
+ *
527
+ * export default defineGuiScript({
528
+ * init(self) {
529
+ * // fetch the node we want to animate
530
+ * const my_node = gui.get_node("my_node");
531
+ * // node is initially set to fully transparent
532
+ * gui.set_color(my_node, vmath.vector4(0, 0, 0, 0));
533
+ * // animate the node immediately and call on_animation_done when the animation has completed
534
+ * gui.animate(my_node, gui.PROP_COLOR, vmath.vector4(1, 1, 1, 1), gui.EASING_INOUTQUAD, 0.5, 0.0, on_animation_done);
535
+ * },
536
+ * });
537
+ * ```
538
+ * @example
539
+ * How to animate a node's y position using a crazy custom easing curve:
540
+ * ```ts
541
+ * // How to animate a node's y position using a crazy custom easing curve:
542
+ * export default defineGuiScript({
543
+ * init(self) {
544
+ * const values = [
545
+ * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
546
+ * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
547
+ * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
548
+ * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
549
+ * ];
550
+ * const vec = vmath.vector(values);
551
+ * const node = gui.get_node("box");
552
+ * gui.animate(node, "position.y", 100, vec, 4.0, 0, undefined, gui.PLAYBACK_LOOP_PINGPONG);
553
+ * },
554
+ * });
555
+ * ```
556
+ */
557
+ function animate(node: Opaque<"node">, property: string | gui.Property | Hash, to: number | Vector3 | Vector4 | Quaternion, easing: gui.Easing | Vector, duration: number, delay?: number, complete_function?: (self: unknown, node: unknown) => void, playback?: gui.Playback): void;
558
+ /**
559
+ * If one or more animations of the specified node is currently running (started by `gui.animate`), they will immediately be canceled.
560
+ *
561
+ * @param node - node that should have its animation canceled
562
+ * @param property - optional property for which the animation should be canceled
563
+ *
564
+ * - `"position"`
565
+ * - `"rotation"`
566
+ * - `"euler"`
567
+ * - `"scale"`
568
+ * - `"color"`
569
+ * - `"outline"`
570
+ * - `"shadow"`
571
+ * - `"size"`
572
+ * - `"fill_angle"` (pie)
573
+ * - `"inner_radius"` (pie)
574
+ * - `"leading"` (text)
575
+ * - `"tracking"` (text)
576
+ * - `"slice9"` (slice9)
577
+ * @example
578
+ * Start an animation of the position property of a node, then cancel parts of
579
+ * the animation:
580
+ * ```ts
581
+ * const node = gui.get_node("my_node");
582
+ * // animate to new position
583
+ * const pos = vmath.vector3(100, 100, 0);
584
+ * gui.animate(node, "position", pos, gui.EASING_LINEAR, 2);
585
+ * // ...
586
+ * // cancel animation of the x component.
587
+ * gui.cancel_animations(node, "position.x");
588
+ * ```
589
+ * @example
590
+ * Cancels all property animations on a node in a single call:
591
+ * ```ts
592
+ * const node = gui.get_node("my_node");
593
+ * // animate to new position and scale
594
+ * gui.animate(node, "position", vmath.vector3(100, 100, 0), gui.EASING_LINEAR, 5);
595
+ * gui.animate(node, "scale", vmath.vector3(0.5), gui.EASING_LINEAR, 5);
596
+ * // ...
597
+ * // cancel positioning and scaling at once
598
+ * gui.cancel_animations(node);
599
+ * ```
600
+ */
601
+ function cancel_animations(node: Opaque<"node">, property?: string | gui.Property | Hash): void;
602
+ /**
603
+ * Cancels any running flipbook animation on the specified node.
604
+ *
605
+ * @param node - node cancel flipbook animation for
606
+ * @example
607
+ * ```ts
608
+ * const node = gui.get_node("anim_node");
609
+ * gui.cancel_flipbook(node);
610
+ * ```
611
+ */
612
+ function cancel_flipbook(node: Opaque<"node">): void;
613
+ /**
614
+ * Make a clone instance of a node. The cloned node will be identical to the
615
+ * original node, except the id which is generated as the string "node" plus
616
+ * a sequential unsigned integer value.
617
+ * This function does not clone the supplied node's children nodes.
618
+ * Use gui.clone_tree for that purpose.
619
+ *
620
+ * @param node - node to clone
621
+ * @returns the cloned node
622
+ */
623
+ function clone(node: Opaque<"node">): Opaque<"node">;
624
+ /**
625
+ * Make a clone instance of a node and all its children.
626
+ * Use gui.clone to clone a node excluding its children.
627
+ *
628
+ * @param node - root node to clone
629
+ * @returns a table mapping node ids to the corresponding cloned nodes
630
+ */
631
+ function clone_tree(node: Opaque<"node">): LuaMap<Hash, Opaque<"node">>;
632
+ /**
633
+ * Deletes the specified node. Any child nodes of the specified node will be
634
+ * recursively deleted.
635
+ *
636
+ * @param node - node to delete
637
+ * @example
638
+ * ```ts
639
+ * // Delete a particular node and any child nodes it might have:
640
+ * const node = gui.get_node("my_node");
641
+ * gui.delete_node(node);
642
+ * ```
643
+ */
644
+ function delete_node(node: Opaque<"node">): void;
645
+ /**
646
+ * Delete a dynamically created texture.
647
+ *
648
+ * @param texture - texture id
649
+ * @example
650
+ * ```ts
651
+ * export default defineGuiScript({
652
+ * init(self) {
653
+ * // Create a texture.
654
+ * if (gui.new_texture("temp_tx", 10, 10, "rgb", "\0".repeat(10 * 10 * 3))) {
655
+ * // Do something with the texture.
656
+ * // ...
657
+ *
658
+ * // Delete the texture
659
+ * gui.delete_texture("temp_tx");
660
+ * }
661
+ * },
662
+ * });
663
+ * ```
664
+ */
665
+ function delete_texture(texture: string | Hash): void;
666
+ /**
667
+ * This is a callback-function, which is called by the engine when a gui component is finalized (destroyed). It can
668
+ * be used to e.g. take some last action, report the finalization to other game object instances
669
+ * or release user input focus (see `release_input_focus`). There is no use in starting any animations or similar
670
+ * from this function since the gui component is about to be destroyed.
671
+ *
672
+ * @param self - reference to the script state to be used for storing data
673
+ * @example
674
+ * ```ts
675
+ * export default defineScript({
676
+ * init() {
677
+ * return { some_value: 0 };
678
+ * },
679
+ *
680
+ * final(self) {
681
+ * // report finalization
682
+ * msg.post("my_friend_instance", "im_dead", { my_stats: self.some_value });
683
+ * },
684
+ * });
685
+ * ```
686
+ */
687
+ function final(self: Opaque<"userdata">): void;
688
+ /**
689
+ * Instead of using specific getters such as gui.get_position or gui.get_scale,
690
+ * you can use gui.get instead and supply the property as a string or a hash.
691
+ * While this function is similar to go.get, there are a few more restrictions
692
+ * when operating in the gui namespace. Most notably, only these explicitly named properties are supported:
693
+ *
694
+ * - `"position"`
695
+ * - `"rotation"`
696
+ * - `"euler"`
697
+ * - `"scale"`
698
+ * - `"color"`
699
+ * - `"outline"`
700
+ * - `"shadow"`
701
+ * - `"size"`
702
+ * - `"fill_angle"` (pie)
703
+ * - `"inner_radius"` (pie)
704
+ * - `"leading"` (text)
705
+ * - `"tracking"` (text)
706
+ * - `"slice9"` (slice9)
707
+ *
708
+ * The value returned will either be a vmath.vector4 or a single number, i.e getting the "position"
709
+ * property will return a vec4 while getting the "position.x" property will return a single value.
710
+ * You can also use this function to get material constants.
711
+ *
712
+ * @param node - node to get the property for
713
+ * @param property - the property to retrieve
714
+ * @param options - optional options table (only applicable for material constants)
715
+ * - `index` number index into array property (1 based)
716
+ *
717
+ * **⚠️ `index` is 1-based; passed to Defold unchanged.**
718
+ * @example
719
+ * ```ts
720
+ * // Get properties on existing nodes:
721
+ * const node = gui.get_node("my_box_node");
722
+ * const node_position = gui.get(node, "position");
723
+ * ```
724
+ */
725
+ function get(node: Opaque<"node">, property: string | Hash | gui.Property, options?: { index?: number; key?: string | Hash; keys?: (Hash | string)[] }): unknown;
726
+ /**
727
+ * Returns the adjust mode of a node.
728
+ * The adjust mode defines how the node will adjust itself to screen
729
+ * resolutions that differs from the one in the project settings.
730
+ *
731
+ * @param node - node from which to get the adjust mode (node)
732
+ * @returns the current adjust mode
733
+ *
734
+ * - `gui.ADJUST_FIT`
735
+ * - `gui.ADJUST_ZOOM`
736
+ * - `gui.ADJUST_STRETCH`
737
+ */
738
+ function get_adjust_mode(node: Opaque<"node">): gui.AdjustMode;
739
+ /**
740
+ * gets the node alpha
741
+ *
742
+ * @param node - node from which to get alpha
743
+ * @returns alpha
744
+ */
745
+ function get_alpha(node: Opaque<"node">): number;
746
+ /**
747
+ * Returns the blend mode of a node.
748
+ * Blend mode defines how the node will be blended with the background.
749
+ *
750
+ * @param node - node from which to get the blend mode
751
+ * @returns blend mode
752
+ *
753
+ * - `gui.BLEND_ALPHA`
754
+ * - `gui.BLEND_ADD`
755
+ * - `gui.BLEND_ADD_ALPHA`
756
+ * - `gui.BLEND_MULT`
757
+ * - `gui.BLEND_SCREEN`
758
+ */
759
+ function get_blend_mode(node: Opaque<"node">): gui.BlendMode;
760
+ /**
761
+ * If node is set as an inverted clipping node, it will clip anything inside as opposed to outside.
762
+ *
763
+ * @param node - node from which to get the clipping inverted state
764
+ * @returns `true` or `false`
765
+ */
766
+ function get_clipping_inverted(node: Opaque<"node">): boolean;
767
+ /**
768
+ * Clipping mode defines how the node will clip it's children nodes
769
+ *
770
+ * @param node - node from which to get the clipping mode
771
+ * @returns clipping mode
772
+ *
773
+ * - `gui.CLIPPING_MODE_NONE`
774
+ * - `gui.CLIPPING_MODE_STENCIL`
775
+ */
776
+ function get_clipping_mode(node: Opaque<"node">): gui.ClippingMode;
777
+ /**
778
+ * 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.
779
+ *
780
+ * @param node - node from which to get the clipping visibility state
781
+ * @returns `true` or `false`
782
+ */
783
+ function get_clipping_visible(node: Opaque<"node">): boolean;
784
+ /**
785
+ * Returns the color of the supplied node. The components
786
+ * of the returned vector4 contains the color channel values:
787
+ *
788
+ * Component
789
+ * Color value
790
+ *
791
+ * x
792
+ * Red value
793
+ *
794
+ * y
795
+ * Green value
796
+ *
797
+ * z
798
+ * Blue value
799
+ *
800
+ * w
801
+ * Alpha value
802
+ *
803
+ * @param node - node to get the color from
804
+ * @returns node color
805
+ */
806
+ function get_color(node: Opaque<"node">): Vector4;
807
+ /**
808
+ * Returns the rotation of the supplied node.
809
+ * The rotation is expressed in degree Euler angles.
810
+ *
811
+ * @param node - node to get the rotation from
812
+ * @returns node rotation
813
+ */
814
+ function get_euler(node: Opaque<"node">): Vector3;
815
+ /**
816
+ * Returns the sector angle of a pie node.
817
+ *
818
+ * @param node - node from which to get the fill angle
819
+ * @returns sector angle
820
+ */
821
+ function get_fill_angle(node: Opaque<"node">): number;
822
+ /**
823
+ * Get node flipbook animation.
824
+ *
825
+ * @param node - node to get flipbook animation from
826
+ * @returns animation id
827
+ */
828
+ function get_flipbook(node: Opaque<"node">): Hash;
829
+ /**
830
+ * This is only useful nodes with flipbook animations. Gets the normalized cursor of the flipbook animation on a node.
831
+ *
832
+ * @param node - node to get the cursor for (node)
833
+ * @returns cursor value
834
+ */
835
+ function get_flipbook_cursor(node: Opaque<"node">): number;
836
+ /**
837
+ * This is only useful nodes with flipbook animations. Gets the playback rate of the flipbook animation on a node.
838
+ *
839
+ * @param node - node to set the cursor for
840
+ * @returns playback rate
841
+ */
842
+ function get_flipbook_playback_rate(node: Opaque<"node">): number;
843
+ /**
844
+ * This is only useful for text nodes. The font must be mapped to the gui scene in the gui editor.
845
+ *
846
+ * @param node - node from which to get the font
847
+ * @returns font id
848
+ */
849
+ function get_font(node: Opaque<"node">): Hash;
850
+ /**
851
+ * This is only useful for text nodes. The font must be mapped to the gui scene in the gui editor.
852
+ *
853
+ * @param font_name - font of which to get the path hash
854
+ * @returns path hash to resource
855
+ * @example
856
+ * ```ts
857
+ * // Get the text metrics for a text
858
+ * export default defineGuiScript({
859
+ * init(self) {
860
+ * const node = gui.get_node("name");
861
+ * const font_name = gui.get_font(node);
862
+ * const font = gui.get_font_resource(font_name);
863
+ * const metrics = resource.get_text_metrics(font, "The quick brown fox\n jumps over the lazy dog");
864
+ * },
865
+ * });
866
+ * ```
867
+ */
868
+ function get_font_resource(font_name: Hash | string): Hash;
869
+ /**
870
+ * Returns the scene height.
871
+ *
872
+ * @returns scene height
873
+ */
874
+ function get_height(): number;
875
+ /**
876
+ * Retrieves the id of the specified node.
877
+ *
878
+ * @param node - the node to retrieve the id from
879
+ * @returns the id of the node
880
+ * @example
881
+ * ```ts
882
+ * // Gets the id of a node:
883
+ * const node = gui.get_node("my_node");
884
+ *
885
+ * const id = gui.get_id(node);
886
+ * print(id); // => hash: [my_node]
887
+ * ```
888
+ */
889
+ function get_id(node: Opaque<"node">): Hash;
890
+ /**
891
+ * Retrieve the index of the specified node among its siblings.
892
+ * The index defines the order in which a node appear in a GUI scene.
893
+ * Higher index means the node is drawn on top of lower indexed nodes.
894
+ *
895
+ * @param node - the node to retrieve the id from
896
+ * @returns the index of the node. **0️⃣ 0-based; passed to Defold unchanged.**
897
+ * @example
898
+ * ```ts
899
+ * // Compare the index order of two sibling nodes:
900
+ * const node1 = gui.get_node("my_node_1");
901
+ * const node2 = gui.get_node("my_node_2");
902
+ *
903
+ * if (gui.get_index(node1) < gui.get_index(node2)) {
904
+ * // node1 is drawn below node2
905
+ * } else {
906
+ * // node2 is drawn below node1
907
+ * }
908
+ * ```
909
+ */
910
+ function get_index(node: Opaque<"node">): number;
911
+ /**
912
+ * gets the node inherit alpha state
913
+ *
914
+ * @param node - node from which to get the inherit alpha state
915
+ * @returns `true` or `false`
916
+ */
917
+ function get_inherit_alpha(node: Opaque<"node">): boolean;
918
+ /**
919
+ * Returns the inner radius of a pie node.
920
+ * The radius is defined along the x-axis.
921
+ *
922
+ * @param node - node from where to get the inner radius
923
+ * @returns inner radius
924
+ */
925
+ function get_inner_radius(node: Opaque<"node">): number;
926
+ /**
927
+ * The layer must be mapped to the gui scene in the gui editor.
928
+ *
929
+ * @param node - node from which to get the layer
930
+ * @returns layer id
931
+ */
932
+ function get_layer(node: Opaque<"node">): Hash;
933
+ /**
934
+ * gets the scene current layout
935
+ *
936
+ * @returns layout id
937
+ */
938
+ function get_layout(): Hash;
939
+ /**
940
+ * Returns a table mapping each layout id hash to a vector3(width, height, 0). For the default layout,
941
+ * the current scene resolution is returned. If a layout name is not present in the Display Profiles (or when
942
+ * no display profiles are assigned), the width/height pair is 0.
943
+ *
944
+ * @returns layout_id_hash -> vmath.vector3(width, height, 0)
945
+ */
946
+ function get_layouts(): LuaMap<Hash, Vector3>;
947
+ /**
948
+ * Returns the leading value for a text node.
949
+ *
950
+ * @param node - node from where to get the leading
951
+ * @returns leading scaling value (default=1)
952
+ */
953
+ function get_leading(node: Opaque<"node">): number;
954
+ /**
955
+ * Returns whether a text node is in line-break mode or not.
956
+ * This is only useful for text nodes.
957
+ *
958
+ * @param node - node from which to get the line-break for
959
+ * @returns `true` or `false`
960
+ */
961
+ function get_line_break(node: Opaque<"node">): boolean;
962
+ /**
963
+ * Returns the material of a node.
964
+ * The material must be mapped to the gui scene in the gui editor.
965
+ *
966
+ * @param node - node to get the material for
967
+ * @returns material id
968
+ * @example
969
+ * ```ts
970
+ * // Getting the material for a node, and assign it to another node:
971
+ * const node1 = gui.get_node("my_node");
972
+ * const node2 = gui.get_node("other_node");
973
+ * const node1_material = gui.get_material(node1);
974
+ * gui.set_material(node2, node1_material);
975
+ * ```
976
+ */
977
+ function get_material(node: Opaque<"node">): Hash;
978
+ /**
979
+ * Retrieves the node with the specified id.
980
+ *
981
+ * @param id - id of the node to retrieve
982
+ * @returns a new node instance
983
+ * @example
984
+ * ```ts
985
+ * // Gets a node by id and change its color:
986
+ * const node = gui.get_node("my_node");
987
+ * const red = vmath.vector4(1.0, 0.0, 0.0, 1.0);
988
+ * gui.set_color(node, red);
989
+ * ```
990
+ */
991
+ function get_node(id: string | Hash): Opaque<"node">;
992
+ /**
993
+ * Returns the outer bounds mode for a pie node.
994
+ *
995
+ * @param node - node from where to get the outer bounds mode
996
+ * @returns the outer bounds mode of the pie node:
997
+ *
998
+ * - `gui.PIEBOUNDS_RECTANGLE`
999
+ * - `gui.PIEBOUNDS_ELLIPSE`
1000
+ */
1001
+ function get_outer_bounds(node: Opaque<"node">): gui.PieBounds;
1002
+ /**
1003
+ * Returns the outline color of the supplied node.
1004
+ * See gui.get_color for info how vectors encode color values.
1005
+ *
1006
+ * @param node - node to get the outline color from
1007
+ * @returns outline color
1008
+ */
1009
+ function get_outline(node: Opaque<"node">): Vector4;
1010
+ /**
1011
+ * Returns the parent node of the specified node.
1012
+ * If the supplied node does not have a parent, `nil` is returned.
1013
+ *
1014
+ * @param node - the node from which to retrieve its parent
1015
+ * @returns parent instance or `nil`
1016
+ */
1017
+ function get_parent(node: Opaque<"node">): Opaque<"node"> | undefined;
1018
+ /**
1019
+ * Get the paricle fx for a gui node
1020
+ *
1021
+ * @param node - node to get particle fx for
1022
+ * @returns particle fx id
1023
+ */
1024
+ function get_particlefx(node: Opaque<"node">): Hash;
1025
+ /**
1026
+ * Returns the number of generated vertices around the perimeter
1027
+ * of a pie node.
1028
+ *
1029
+ * @param node - pie node
1030
+ * @returns vertex count
1031
+ */
1032
+ function get_perimeter_vertices(node: Opaque<"node">): number;
1033
+ /**
1034
+ * The pivot specifies how the node is drawn and rotated from its position.
1035
+ *
1036
+ * @param node - node to get pivot from
1037
+ * @returns pivot constant
1038
+ *
1039
+ * - `gui.PIVOT_CENTER`
1040
+ * - `gui.PIVOT_N`
1041
+ * - `gui.PIVOT_NE`
1042
+ * - `gui.PIVOT_E`
1043
+ * - `gui.PIVOT_SE`
1044
+ * - `gui.PIVOT_S`
1045
+ * - `gui.PIVOT_SW`
1046
+ * - `gui.PIVOT_W`
1047
+ * - `gui.PIVOT_NW`
1048
+ */
1049
+ function get_pivot(node: Opaque<"node">): gui.Pivot;
1050
+ /**
1051
+ * Returns the position of the supplied node.
1052
+ *
1053
+ * @param node - node to get the position from
1054
+ * @returns node position
1055
+ */
1056
+ function get_position(node: Opaque<"node">): Vector3;
1057
+ /**
1058
+ * Returns the rotation of the supplied node.
1059
+ * The rotation is expressed as a quaternion
1060
+ *
1061
+ * @param node - node to get the rotation from
1062
+ * @returns node rotation
1063
+ */
1064
+ function get_rotation(node: Opaque<"node">): Quaternion;
1065
+ /**
1066
+ * Returns the scale of the supplied node.
1067
+ *
1068
+ * @param node - node to get the scale from
1069
+ * @returns node scale
1070
+ */
1071
+ function get_scale(node: Opaque<"node">): Vector3;
1072
+ /**
1073
+ * Returns the screen position of the supplied node. This function returns the
1074
+ * calculated transformed position of the node, taking into account any parent node
1075
+ * transforms.
1076
+ *
1077
+ * @param node - node to get the screen position from
1078
+ * @returns node screen position
1079
+ */
1080
+ function get_screen_position(node: Opaque<"node">): Vector3;
1081
+ /**
1082
+ * Returns the shadow color of the supplied node.
1083
+ * See gui.get_color for info how vectors encode color values.
1084
+ *
1085
+ * @param node - node to get the shadow color from
1086
+ * @returns node shadow color
1087
+ */
1088
+ function get_shadow(node: Opaque<"node">): Vector4;
1089
+ /**
1090
+ * Returns the size of the supplied node.
1091
+ *
1092
+ * @param node - node to get the size from
1093
+ * @returns node size
1094
+ */
1095
+ function get_size(node: Opaque<"node">): Vector3;
1096
+ /**
1097
+ * Returns the size of a node.
1098
+ * The size mode defines how the node will adjust itself in size. Automatic
1099
+ * size mode alters the node size based on the node's content. Automatic size
1100
+ * mode works for Box nodes and Pie nodes which will both adjust their size
1101
+ * to match the assigned image. Particle fx and Text nodes will ignore
1102
+ * any size mode setting.
1103
+ *
1104
+ * @param node - node from which to get the size mode (node)
1105
+ * @returns the current size mode
1106
+ *
1107
+ * - `gui.SIZE_MODE_MANUAL`
1108
+ * - `gui.SIZE_MODE_AUTO`
1109
+ */
1110
+ function get_size_mode(node: Opaque<"node">): gui.SizeMode;
1111
+ /**
1112
+ * Returns the slice9 configuration values for the node.
1113
+ *
1114
+ * @param node - node to manipulate
1115
+ * @returns configuration values
1116
+ */
1117
+ function get_slice9(node: Opaque<"node">): Vector4;
1118
+ /**
1119
+ * Returns the text value of a text node. This is only useful for text nodes.
1120
+ *
1121
+ * @param node - node from which to get the text
1122
+ * @returns text value
1123
+ */
1124
+ function get_text(node: Opaque<"node">): string;
1125
+ /**
1126
+ * Returns the texture of a node.
1127
+ * This is currently only useful for box or pie nodes.
1128
+ * The texture must be mapped to the gui scene in the gui editor.
1129
+ *
1130
+ * @param node - node to get texture from
1131
+ * @returns texture id
1132
+ */
1133
+ function get_texture(node: Opaque<"node">): Hash;
1134
+ /**
1135
+ * Returns the tracking value of a text node.
1136
+ *
1137
+ * @param node - node from where to get the tracking
1138
+ * @returns tracking scaling number (default=0)
1139
+ */
1140
+ function get_tracking(node: Opaque<"node">): number;
1141
+ /**
1142
+ * Get a node and all its children as a Lua table.
1143
+ *
1144
+ * @param node - root node to get node tree from
1145
+ * @returns a table mapping node ids to the corresponding nodes
1146
+ */
1147
+ function get_tree(node: Opaque<"node">): LuaMap<Hash, Opaque<"node">>;
1148
+ /**
1149
+ * gets the node type
1150
+ *
1151
+ * @param node - node from which to get the type
1152
+ */
1153
+ function get_type(node: Opaque<"node">): LuaMultiReturn<[gui.NodeType, number | undefined]>;
1154
+ /**
1155
+ * Returns `true` if a node is visible and `false` if it's not.
1156
+ * Invisible nodes are not rendered.
1157
+ *
1158
+ * @param node - node to query
1159
+ * @returns whether the node is visible or not
1160
+ */
1161
+ function get_visible(node: Opaque<"node">): boolean;
1162
+ /**
1163
+ * Returns the scene width.
1164
+ *
1165
+ * @returns scene width
1166
+ */
1167
+ function get_width(): number;
1168
+ /**
1169
+ * The x-anchor specifies how the node is moved when the game is run in a different resolution.
1170
+ *
1171
+ * @param node - node to get x-anchor from
1172
+ * @returns anchor constant
1173
+ *
1174
+ * - `gui.ANCHOR_NONE`
1175
+ * - `gui.ANCHOR_LEFT`
1176
+ * - `gui.ANCHOR_RIGHT`
1177
+ */
1178
+ function get_xanchor(node: Opaque<"node">): gui.XAnchor;
1179
+ /**
1180
+ * The y-anchor specifies how the node is moved when the game is run in a different resolution.
1181
+ *
1182
+ * @param node - node to get y-anchor from
1183
+ * @returns anchor constant
1184
+ *
1185
+ * - `gui.ANCHOR_NONE`
1186
+ * - `gui.ANCHOR_TOP`
1187
+ * - `gui.ANCHOR_BOTTOM`
1188
+ */
1189
+ function get_yanchor(node: Opaque<"node">): gui.YAnchor;
1190
+ /**
1191
+ * Hides the on-display touch keyboard on the device.
1192
+ */
1193
+ function hide_keyboard(): void;
1194
+ /**
1195
+ * This is a callback-function, which is called by the engine when a gui component is initialized. It can be used
1196
+ * to set the initial state of the script and gui scene.
1197
+ *
1198
+ * @param self - reference to the script state to be used for storing data
1199
+ * @example
1200
+ * ```ts
1201
+ * export default defineScript({
1202
+ * init() {
1203
+ * // set up useful data
1204
+ * return { my_value: 1 };
1205
+ * },
1206
+ * });
1207
+ * ```
1208
+ */
1209
+ function init(self: Opaque<"userdata">): void;
1210
+ /**
1211
+ * Returns `true` if a node is enabled and `false` if it's not.
1212
+ * Disabled nodes are not rendered and animations acting on them are not evaluated.
1213
+ *
1214
+ * @param node - node to query
1215
+ * @param recursive - check hierarchy recursively
1216
+ * @returns whether the node is enabled or not
1217
+ */
1218
+ function is_enabled(node: Opaque<"node">, recursive?: boolean): boolean;
1219
+ /**
1220
+ * Alters the ordering of the two supplied nodes by moving the first node
1221
+ * above the second.
1222
+ * If the second argument is `nil` the first node is moved to the top.
1223
+ *
1224
+ * @param node - to move
1225
+ * @param reference - reference node above which the first node should be moved
1226
+ */
1227
+ function move_above(node: Opaque<"node">, reference: Opaque<"node"> | undefined): void;
1228
+ /**
1229
+ * Alters the ordering of the two supplied nodes by moving the first node
1230
+ * below the second.
1231
+ * If the second argument is `nil` the first node is moved to the bottom.
1232
+ *
1233
+ * @param node - to move
1234
+ * @param reference - reference node below which the first node should be moved
1235
+ */
1236
+ function move_below(node: Opaque<"node">, reference: Opaque<"node"> | undefined): void;
1237
+ /**
1238
+ * Dynamically create a new box node.
1239
+ *
1240
+ * @param pos - node position
1241
+ * @param size - node size
1242
+ * @returns new box node
1243
+ */
1244
+ function new_box_node(pos: Vector3 | Vector4, size: Vector3): Opaque<"node">;
1245
+ /**
1246
+ * Dynamically create a particle fx node.
1247
+ *
1248
+ * @param pos - node position
1249
+ * @param particlefx - particle fx resource name
1250
+ * @returns new particle fx node
1251
+ */
1252
+ function new_particlefx_node(pos: Vector3 | Vector4, particlefx: Hash | string): Opaque<"node">;
1253
+ /**
1254
+ * Dynamically create a new pie node.
1255
+ *
1256
+ * @param pos - node position
1257
+ * @param size - node size
1258
+ * @returns new pie node
1259
+ */
1260
+ function new_pie_node(pos: Vector3 | Vector4, size: Vector3): Opaque<"node">;
1261
+ /**
1262
+ * Dynamically create a new text node.
1263
+ *
1264
+ * @param pos - node position
1265
+ * @param text - node text
1266
+ * @returns new text node
1267
+ */
1268
+ function new_text_node(pos: Vector3 | Vector4, text: string): Opaque<"node">;
1269
+ /**
1270
+ * Dynamically create a new texture.
1271
+ *
1272
+ * @param texture_id - texture id
1273
+ * @param width - texture width
1274
+ * @param height - texture height
1275
+ * @param type - texture type
1276
+ *
1277
+ * - `"rgb"` - RGB
1278
+ * - `"rgba"` - RGBA
1279
+ * - `"l"` - LUMINANCE
1280
+ * - `"astc"` - ASTC compressed format
1281
+ * @param buffer - texture data
1282
+ * @param flip - flip texture vertically
1283
+ * @example
1284
+ * How to create a texture and apply it to a new box node:
1285
+ * ```ts
1286
+ * export default defineGuiScript({
1287
+ * init(self) {
1288
+ * const w = 200;
1289
+ * const h = 300;
1290
+ *
1291
+ * // A nice orange. String with the RGB values.
1292
+ * const orange = String.fromCharCode(0xff, 0x80, 0x10);
1293
+ *
1294
+ * // Create the texture. Repeat the color string for each pixel.
1295
+ * const [ok, reason] = gui.new_texture("orange_tx", w, h, "rgb", orange.repeat(w * h));
1296
+ * if (ok) {
1297
+ * // Create a box node and apply the texture to it.
1298
+ * const n = gui.new_box_node(vmath.vector3(200, 200, 0), vmath.vector3(w, h, 0));
1299
+ * gui.set_texture(n, "orange_tx");
1300
+ * } else {
1301
+ * // Could not create texture for some reason...
1302
+ * if (reason === gui.RESULT_TEXTURE_ALREADY_EXISTS) {
1303
+ * // ...
1304
+ * } else {
1305
+ * // ...
1306
+ * }
1307
+ * }
1308
+ * },
1309
+ * });
1310
+ * ```
1311
+ * @example
1312
+ * How to create a texture using .astc format
1313
+ * ```ts
1314
+ * const size = 4;
1315
+ * const pos = vmath.vector3(200, 200, 0);
1316
+ * const path = "/assets/images/logo_4x4.astc";
1317
+ * const [data] = sys.load_resource(path);
1318
+ * if (data !== undefined) {
1319
+ * const n = gui.new_box_node(pos, vmath.vector3(size, size, 0));
1320
+ * // size is read from the .astc buffer
1321
+ * // flip is not supported
1322
+ * gui.new_texture(path, 0, 0, "astc", data, false);
1323
+ * gui.set_texture(n, path);
1324
+ * }
1325
+ * ```
1326
+ */
1327
+ function new_texture(texture_id: string | Hash, width: number, height: number, type: string | Opaque<"constant">, buffer: string, flip?: boolean): LuaMultiReturn<[boolean, number | undefined]>;
1328
+ /**
1329
+ * This is a callback-function, which is called by the engine when user input is sent to the instance of the gui component.
1330
+ * It can be used to take action on the input, e.g. modify the gui according to the input.
1331
+ * For an instance to obtain user input, it must first acquire input
1332
+ * focus through the message `acquire_input_focus`.
1333
+ * Any instance that has obtained input will be put on top of an
1334
+ * input stack. Input is sent to all listeners on the stack until the
1335
+ * end of stack is reached, or a listener returns `true`
1336
+ * to signal that it wants input to be consumed.
1337
+ * See the documentation of acquire_input_focus for more
1338
+ * information.
1339
+ * The `action` parameter is a table containing data about the input mapped to the
1340
+ * `action_id`.
1341
+ * For mapped actions it specifies the value of the input and if it was just pressed or released.
1342
+ * Actions are mapped to input in an input_binding-file.
1343
+ * Mouse movement is specifically handled and uses `nil` as its `action_id`.
1344
+ * The `action` only contains positional parameters in this case, such as x and y of the pointer.
1345
+ * Here is a brief description of the available table fields:
1346
+ *
1347
+ * Field
1348
+ * Description
1349
+ *
1350
+ * `value`
1351
+ * The amount of input given by the user. This is usually 1 for buttons and 0-1 for analogue inputs. This is not present for mouse movement and text input.
1352
+ *
1353
+ * `pressed`
1354
+ * If the input was pressed this frame. This is not present for mouse movement and text input.
1355
+ *
1356
+ * `released`
1357
+ * If the input was released this frame. This is not present for mouse movement and text input.
1358
+ *
1359
+ * `repeated`
1360
+ * If the input was repeated this frame. This is similar to how a key on a keyboard is repeated when you hold it down. This is not present for mouse movement and text input.
1361
+ *
1362
+ * `x`
1363
+ * The x value of a pointer device, if present. This is not present for gamepad, key and text input.
1364
+ *
1365
+ * `y`
1366
+ * The y value of a pointer device, if present. This is not present for gamepad, key and text input.
1367
+ *
1368
+ * `screen_x`
1369
+ * The screen space x value of a pointer device, if present. This is not present for gamepad, key and text input.
1370
+ *
1371
+ * `screen_y`
1372
+ * The screen space y value of a pointer device, if present. This is not present for gamepad, key and text input.
1373
+ *
1374
+ * `dx`
1375
+ * The change in x value of a pointer device, if present. This is not present for gamepad, key and text input.
1376
+ *
1377
+ * `dy`
1378
+ * The change in y value of a pointer device, if present. This is not present for gamepad, key and text input.
1379
+ *
1380
+ * `screen_dx`
1381
+ * The change in screen space x value of a pointer device, if present. This is not present for gamepad, key and text input.
1382
+ *
1383
+ * `screen_dy`
1384
+ * The change in screen space y value of a pointer device, if present. This is not present for gamepad, key and text input.
1385
+ *
1386
+ * `gamepad`
1387
+ * The index of the gamepad device that provided the input. See table below about gamepad input.
1388
+ *
1389
+ * `touch`
1390
+ * List of touch input, one element per finger, if present. See table below about touch input
1391
+ *
1392
+ * `text`
1393
+ * Text input from a (virtual) keyboard or similar.
1394
+ *
1395
+ * `marked_text`
1396
+ * Sequence of entered symbols while entering a symbol combination, for example Japanese Kana.
1397
+ *
1398
+ * Gamepad specific fields:
1399
+ *
1400
+ * Field
1401
+ * Description
1402
+ *
1403
+ * `gamepad`
1404
+ * The index of the gamepad device that provided the input.
1405
+ *
1406
+ * `userid`
1407
+ * Id of the user associated with the controller. Usually only relevant on consoles.
1408
+ *
1409
+ * `gamepad_unknown`
1410
+ * True if the inout originated from an unknown/unmapped gamepad.
1411
+ *
1412
+ * `gamepad_name`
1413
+ * Name of the gamepad
1414
+ *
1415
+ * `gamepad_axis`
1416
+ * List of gamepad axis values. For raw gamepad input only.
1417
+ *
1418
+ * `gamepadhats`
1419
+ * List of gamepad hat values. For raw gamepad input only.
1420
+ *
1421
+ * `gamepad_buttons`
1422
+ * List of gamepad button values. For raw gamepad input only.
1423
+ *
1424
+ * Touch input table:
1425
+ *
1426
+ * Field
1427
+ * Description
1428
+ *
1429
+ * `id`
1430
+ * A number identifying the touch input during its duration.
1431
+ *
1432
+ * `pressed`
1433
+ * True if the finger was pressed this frame.
1434
+ *
1435
+ * `released`
1436
+ * True if the finger was released this frame.
1437
+ *
1438
+ * `tap_count`
1439
+ * Number of taps, one for single, two for double-tap, etc
1440
+ *
1441
+ * `x`
1442
+ * The x touch location.
1443
+ *
1444
+ * `y`
1445
+ * The y touch location.
1446
+ *
1447
+ * `dx`
1448
+ * The change in x value.
1449
+ *
1450
+ * `dy`
1451
+ * The change in y value.
1452
+ *
1453
+ * `acc_x`
1454
+ * Accelerometer x value (if present).
1455
+ *
1456
+ * `acc_y`
1457
+ * Accelerometer y value (if present).
1458
+ *
1459
+ * `acc_z`
1460
+ * Accelerometer z value (if present).
1461
+ *
1462
+ * @param self - reference to the script state to be used for storing data
1463
+ * @param action_id - id of the received input action, as mapped in the input_binding-file
1464
+ * @param action - a table containing the input data, see above for a description. **0️⃣ `gamepad` is 0-based; passed to Defold unchanged.**
1465
+ * @returns optional boolean to signal if the input should be consumed (not passed on to others) or not, default is false
1466
+ * @example
1467
+ * ```ts
1468
+ * export default defineGuiScript({
1469
+ * init(): { my_value: number | undefined } {
1470
+ * return { my_value: undefined };
1471
+ * },
1472
+ *
1473
+ * on_input(self, action_id, action) {
1474
+ * // check for input
1475
+ * if (action_id === hash("my_action")) {
1476
+ * // take appropriate action
1477
+ * self.my_value = action.value;
1478
+ * }
1479
+ * // consume input
1480
+ * return true;
1481
+ * },
1482
+ * });
1483
+ * ```
1484
+ */
1485
+ function on_input(self: Opaque<"userdata">, action_id: Hash, action: { value?: number; pressed?: boolean; released?: boolean; repeated?: boolean; x?: number; y?: number; screen_x?: number; screen_y?: number; dx?: number; dy?: number; screen_dx?: number; screen_dy?: number; gamepad?: number; gamepad_axis?: Vector3; touch?: { id?: number; pressed?: boolean; released?: boolean; tap_count?: number; x?: number; y?: number; dx?: number; dy?: number; acc_x?: number; acc_y?: number; acc_z?: number }[]; text?: string }): boolean | undefined;
1486
+ /**
1487
+ * This is a callback-function, which is called by the engine whenever a message has been sent to the gui component.
1488
+ * It can be used to take action on the message, e.g. update the gui or send a response back to the sender of the message.
1489
+ * The `message` parameter is a table containing the message data. If the message is sent from the engine, the
1490
+ * documentation of the message specifies which data is supplied.
1491
+ * See the update function for examples on how to use this callback-function.
1492
+ *
1493
+ * @param self - reference to the script state to be used for storing data
1494
+ * @param message_id - id of the received message
1495
+ * @param message - a table containing the message data
1496
+ */
1497
+ function on_message(self: Opaque<"userdata">, message_id: Hash, message: Record<string | number, unknown>): void;
1498
+ /**
1499
+ * This is a callback-function, which is called by the engine when the gui script is reloaded, e.g. from the editor.
1500
+ * It can be used for live development, e.g. to tweak constants or set up the state properly for the script.
1501
+ *
1502
+ * @param self - reference to the script state to be used for storing data
1503
+ * @example
1504
+ * ```ts
1505
+ * export default defineGuiScript({
1506
+ * init() {
1507
+ * return { my_original_color: gui.get_color(gui.get_node("my_node")) };
1508
+ * },
1509
+ *
1510
+ * on_reload(self) {
1511
+ * // restore some color (or similar)
1512
+ * gui.set_color(gui.get_node("my_node"), self.my_original_color);
1513
+ * },
1514
+ * });
1515
+ * ```
1516
+ */
1517
+ function on_reload(self: Opaque<"userdata">): void;
1518
+ /**
1519
+ * Tests whether a coordinate is within the bounding box of a
1520
+ * node.
1521
+ *
1522
+ * @param node - node to be tested for picking
1523
+ * @param x - x-coordinate (see on_input )
1524
+ * @param y - y-coordinate (see on_input )
1525
+ * @returns pick result
1526
+ */
1527
+ function pick_node(node: Opaque<"node">, x: number, y: number): boolean;
1528
+ /**
1529
+ * Play flipbook animation on a box or pie node.
1530
+ * The current node texture must contain the animation.
1531
+ * Use this function to set one-frame still images on the node.
1532
+ *
1533
+ * @param node - node to set animation for
1534
+ * @param animation - animation id
1535
+ * @param complete_function - optional function to call when the animation has completed
1536
+ *
1537
+ * `self`
1538
+ *
1539
+ * object The current object.
1540
+ *
1541
+ * `node`
1542
+ *
1543
+ * node The node that is animated.
1544
+ * @param play_properties - optional table with properties
1545
+ *
1546
+ * `offset`
1547
+ * number The normalized initial value of the animation cursor when the animation starts playing
1548
+ * `playback_rate`
1549
+ * number The rate with which the animation will be played. Must be positive
1550
+ * @example
1551
+ * Set the texture of a node to a flipbook animation from an atlas:
1552
+ * ```ts
1553
+ * function anim_callback(self: unknown, node: unknown) {
1554
+ * // Take action after animation has played.
1555
+ * }
1556
+ *
1557
+ * export default defineGuiScript({
1558
+ * init(self) {
1559
+ * // Create a new node and set the texture to a flipbook animation
1560
+ * const node = gui.get_node("button_node");
1561
+ * gui.set_texture(node, "gui_sprites");
1562
+ * gui.play_flipbook(node, "animated_button");
1563
+ * },
1564
+ * });
1565
+ * ```
1566
+ * @example
1567
+ * Set the texture of a node to an image from an atlas:
1568
+ * ```ts
1569
+ * // Create a new node and set the texture to a "button.png" from atlas
1570
+ * const node = gui.get_node("button_node");
1571
+ * gui.set_texture(node, "gui_sprites");
1572
+ * gui.play_flipbook(node, "button");
1573
+ * ```
1574
+ */
1575
+ function play_flipbook(node: Opaque<"node">, animation: string | Hash, complete_function?: (self: unknown, node: unknown) => void, play_properties?: { offset?: number; playback_rate?: number }): void;
1576
+ /**
1577
+ * Plays the paricle fx for a gui node
1578
+ *
1579
+ * @param node - node to play particle fx for
1580
+ * @param emitter_state_function - optional callback function that will be called when an emitter attached to this particlefx changes state.
1581
+ *
1582
+ * `self`
1583
+ * object The current object
1584
+ * `node`
1585
+ * hash The particle fx node, or `nil` if the node was deleted
1586
+ * `emitter`
1587
+ * hash The id of the emitter
1588
+ * `state`
1589
+ * constant the new state of the emitter:
1590
+ *
1591
+ * - `particlefx.EMITTER_STATE_SLEEPING`
1592
+ * - `particlefx.EMITTER_STATE_PRESPAWN`
1593
+ * - `particlefx.EMITTER_STATE_SPAWNING`
1594
+ * - `particlefx.EMITTER_STATE_POSTSPAWN`
1595
+ * @example
1596
+ * ```ts
1597
+ * // How to play a particle fx when a gui node is created.
1598
+ * // The callback receives the gui node, the hash of the id
1599
+ * // of the emitter, and the new state of the emitter as particlefx.EMITTER_STATE_.
1600
+ * function emitter_state_change(self: unknown, node: unknown, emitter: unknown, state: unknown) {
1601
+ * if (emitter === hash("exhaust") && state === particlefx.EMITTER_STATE_POSTSPAWN) {
1602
+ * // exhaust is done spawning particles...
1603
+ * }
1604
+ * }
1605
+ *
1606
+ * export default defineGuiScript({
1607
+ * init(self) {
1608
+ * gui.play_particlefx(gui.get_node("particlefx"), emitter_state_change);
1609
+ * },
1610
+ * });
1611
+ * ```
1612
+ */
1613
+ function play_particlefx(node: Opaque<"node">, emitter_state_function?: (self: unknown, node: unknown, emitter: unknown, state: unknown) => void): void;
1614
+ /**
1615
+ * Resets the input context of keyboard. This will clear marked text.
1616
+ */
1617
+ function reset_keyboard(): void;
1618
+ /**
1619
+ * Resets the node material to the material assigned in the gui scene.
1620
+ *
1621
+ * @param node - node to reset the material for
1622
+ * @example
1623
+ * ```ts
1624
+ * // Resetting the material for a node:
1625
+ * const node = gui.get_node("my_node");
1626
+ * gui.reset_material(node);
1627
+ * ```
1628
+ */
1629
+ function reset_material(node: Opaque<"node">): void;
1630
+ /**
1631
+ * Resets all nodes in the current GUI scene to their initial state.
1632
+ * The reset only applies to static node loaded from the scene.
1633
+ * Nodes that are created dynamically from script are not affected.
1634
+ */
1635
+ function reset_nodes(): void;
1636
+ /**
1637
+ * Converts a screen-space position to the local position value for the supplied node.
1638
+ * The conversion takes the parent transform, anchors, adjust mode, and adjust reference into account.
1639
+ *
1640
+ * @param node - node whose local position space should be used
1641
+ * @param screen_position - screen-space position
1642
+ * @returns local position value for the node
1643
+ * @example
1644
+ * ```ts
1645
+ * // Animate a node to the pressed pointer position:
1646
+ * export default defineGuiScript({
1647
+ * init() {
1648
+ * msg.post(".", "acquire_input_focus");
1649
+ * return { marker: gui.get_node("marker") };
1650
+ * },
1651
+ *
1652
+ * on_input(self, action_id, action) {
1653
+ * if (
1654
+ * action_id === hash("touch") &&
1655
+ * action.pressed &&
1656
+ * action.screen_x !== undefined &&
1657
+ * action.screen_y !== undefined
1658
+ * ) {
1659
+ * const screen_position = vmath.vector3(action.screen_x, action.screen_y, 0);
1660
+ * const target_position = gui.screen_to_local(self.marker, screen_position);
1661
+ * gui.animate(self.marker, gui.PROP_POSITION, target_position, gui.EASING_OUTQUAD, 0.2);
1662
+ * return true;
1663
+ * }
1664
+ * },
1665
+ * });
1666
+ * ```
1667
+ */
1668
+ function screen_to_local(node: Opaque<"node">, screen_position: Vector3 | Vector4): Vector3;
1669
+ /**
1670
+ * Instead of using specific setteres such as gui.set_position or gui.set_scale,
1671
+ * you can use gui.set instead and supply the property as a string or a hash.
1672
+ * While this function is similar to go.get and go.set, there are a few more restrictions
1673
+ * when operating in the gui namespace. Most notably, only these named properties identifiers are supported:
1674
+ *
1675
+ * - `"position"`
1676
+ * - `"rotation"`
1677
+ * - `"euler"`
1678
+ * - `"scale"`
1679
+ * - `"color"`
1680
+ * - `"outline"`
1681
+ * - `"shadow"`
1682
+ * - `"size"`
1683
+ * - `"fill_angle"` (pie)
1684
+ * - `"inner_radius"` (pie)
1685
+ * - `"leading"` (text)
1686
+ * - `"tracking"` (text)
1687
+ * - `"slice9"` (slice9)
1688
+ *
1689
+ * The value to set must either be a vmath.vector4, vmath.vector3, vmath.quat or a single number and depends on the property name you want to set.
1690
+ * I.e when setting the "position" property, you need to use a vmath.vector4 and when setting a single component of the property,
1691
+ * such as "position.x", you need to use a single value.
1692
+ * Note: When setting the rotation using the "rotation" property, you need to pass in a vmath.quat. This behaviour is different than from the gui.set_rotation function,
1693
+ * the intention is to move new functionality closer to go namespace so that migrating between gui and go is easier. To set the rotation using degrees instead,
1694
+ * use the "euler" property instead. The rotation and euler properties are linked, changing one of them will change the backing data of the other.
1695
+ * Similar to go.set, you can also use gui.set for setting material constant values on a node. E.g if a material has specified a constant called `tint` in
1696
+ * the .material file, you can use gui.set to set the value of that constant by calling `gui.set(node, "tint", vmath.vec4(1,0,0,1))`, or `gui.set(node, "matrix", vmath.matrix4())`
1697
+ * if the constant is a matrix. Arrays are also supported by gui.set - to set an array constant, you need to pass in an options table with the 'index' key set.
1698
+ * If the material has a constant array called 'tint_array' specified in the material, you can use `gui.set(node, "tint_array", vmath.vec4(1,0,0,1), { index = 4})` to set the fourth array element to a different value.
1699
+ *
1700
+ * @param node - node to set the property for, or msg.url() to the gui itself
1701
+ * @param property - the property to set
1702
+ * @param value - the property to set. `nil` is only supported for removing runtime texture mappings with `gui.set(msg.url(), "textures", nil, {key = ...})`.
1703
+ * @param options - optional options table (only applicable for material constants)
1704
+ * - `index` number index into array property (1 based)
1705
+ * - `key` hash name of internal property
1706
+ *
1707
+ * **⚠️ `index` is 1-based; passed to Defold unchanged.**
1708
+ * @example
1709
+ * Updates the position property on an existing node:
1710
+ * ```ts
1711
+ * const node = gui.get_node("my_box_node");
1712
+ * const node_position = gui.get(node, "position") as Vector3;
1713
+ * gui.set(node, "position.x", node_position.x + 128);
1714
+ * ```
1715
+ * @example
1716
+ * Updates the rotation property on an existing node:
1717
+ * ```ts
1718
+ * const node = gui.get_node("my_box_node");
1719
+ * gui.set(node, "rotation", vmath.quat_rotation_z(math.rad(45)));
1720
+ * // this is equivalent to:
1721
+ * gui.set(node, "euler.z", 45);
1722
+ * // or using the entire vector:
1723
+ * gui.set(node, "euler", vmath.vector3(0, 0, 45));
1724
+ * // or using the set_rotation
1725
+ * gui.set_rotation(node, vmath.vector3(0, 0, 45));
1726
+ * ```
1727
+ * @example
1728
+ * Sets various material constants for a node:
1729
+ * ```ts
1730
+ * const node = gui.get_node("my_box_node");
1731
+ * gui.set(node, "tint", vmath.vector4(1, 0, 0, 1));
1732
+ * // matrix4 is also supported
1733
+ * gui.set(node, "light_matrix", vmath.matrix4());
1734
+ * // update a constant in an array at position 4. the array is specified in the shader as:
1735
+ * // uniform vec4 tint_array[4]; // lua is 1 based, shader is 0 based
1736
+ * gui.set(node, "tint_array", vmath.vector4(1, 0, 0, 1), { index: 4 });
1737
+ * // update a matrix constant in an array at position 4. the array is specified in the shader as:
1738
+ * // uniform mat4 light_matrix_array[4];
1739
+ * gui.set(node, "light_matrix_array", vmath.matrix4(), { index: 4 });
1740
+ * // update a sub-element in a constant
1741
+ * gui.set(node, "tint.x", 1);
1742
+ * // update a sub-element in an array constant at position 4
1743
+ * gui.set(node, "tint_array.x", 1, { index: 4 });
1744
+ * ```
1745
+ * @example
1746
+ * Set a named property
1747
+ * ```ts
1748
+ * export default defineGuiScript({
1749
+ * on_message(self, message_id, message) {
1750
+ * if (message_id === hash("set_font") && types.is_hash(message.font)) {
1751
+ * gui.set(msg.url(), "fonts", message.font, { key: "my_font_name" });
1752
+ * gui.set_font(gui.get_node("text"), "my_font_name");
1753
+ * } else if (message_id === hash("set_texture") && types.is_hash(message.texture)) {
1754
+ * gui.set(msg.url(), "textures", message.texture, { key: "my_texture" });
1755
+ * gui.set_texture(gui.get_node("box"), "my_texture");
1756
+ * gui.play_flipbook(gui.get_node("box"), "logo_256");
1757
+ * }
1758
+ * },
1759
+ * });
1760
+ * ```
1761
+ * @example
1762
+ * Remove a named runtime texture resource mapping:
1763
+ * ```ts
1764
+ * const atlas_params = {
1765
+ * texture: "/runtime.texturec",
1766
+ * animations: [{ id: "runtime", width: 1, height: 1, frames: [1] }],
1767
+ * geometries: [{ vertices: [0, 0, 0, 1, 1, 1, 1, 0], uvs: [0, 0, 0, 1, 1, 1, 1, 0], indices: [0, 1, 2, 0, 2, 3] }],
1768
+ * } satisfies Parameters<typeof resource.create_atlas>[1];
1769
+ * const atlas_id = resource.create_atlas("/runtime.texturesetc", atlas_params);
1770
+ * gui.set(msg.url(), "textures", atlas_id, { key: "runtime_texture" });
1771
+ * gui.set_texture(gui.get_node("box"), "runtime_texture");
1772
+ *
1773
+ * // Later, remove the GUI mapping before releasing the atlas resource.
1774
+ * gui.set(msg.url(), "textures", undefined, { key: "runtime_texture" });
1775
+ * resource.release(atlas_id);
1776
+ * ```
1777
+ */
1778
+ function set(node: Opaque<"node"> | Url, property: string | Hash | gui.Property, value: number | Vector4 | Vector3 | Quaternion | Matrix4 | Hash | undefined, options?: { index?: number; key?: string | Hash; keys?: (Hash | string)[] }): void;
1779
+ /**
1780
+ * Sets the adjust mode on a node.
1781
+ * The adjust mode defines how the node will adjust itself to screen
1782
+ * resolutions that differs from the one in the project settings.
1783
+ *
1784
+ * @param node - node to set adjust mode for
1785
+ * @param adjust_mode - adjust mode to set
1786
+ *
1787
+ * - `gui.ADJUST_FIT`
1788
+ * - `gui.ADJUST_ZOOM`
1789
+ * - `gui.ADJUST_STRETCH`
1790
+ */
1791
+ function set_adjust_mode(node: Opaque<"node">, adjust_mode: gui.AdjustMode): void;
1792
+ /**
1793
+ * sets the node alpha
1794
+ *
1795
+ * @param node - node for which to set alpha
1796
+ * @param alpha - 0..1 alpha color
1797
+ */
1798
+ function set_alpha(node: Opaque<"node">, alpha: number): void;
1799
+ /**
1800
+ * Set the blend mode of a node.
1801
+ * Blend mode defines how the node will be blended with the background.
1802
+ *
1803
+ * @param node - node to set blend mode for
1804
+ * @param blend_mode - blend mode to set
1805
+ *
1806
+ * - `gui.BLEND_ALPHA`
1807
+ * - `gui.BLEND_ADD`
1808
+ * - `gui.BLEND_ADD_ALPHA`
1809
+ * - `gui.BLEND_MULT`
1810
+ * - `gui.BLEND_SCREEN`
1811
+ */
1812
+ function set_blend_mode(node: Opaque<"node">, blend_mode: gui.BlendMode): void;
1813
+ /**
1814
+ * If node is set as an inverted clipping node, it will clip anything inside as opposed to outside.
1815
+ *
1816
+ * @param node - node to set clipping inverted state for
1817
+ * @param inverted - `true` or `false`
1818
+ */
1819
+ function set_clipping_inverted(node: Opaque<"node">, inverted: boolean): void;
1820
+ /**
1821
+ * Clipping mode defines how the node will clip it's children nodes
1822
+ *
1823
+ * @param node - node to set clipping mode for
1824
+ * @param clipping_mode - clipping mode to set
1825
+ *
1826
+ * - `gui.CLIPPING_MODE_NONE`
1827
+ * - `gui.CLIPPING_MODE_STENCIL`
1828
+ */
1829
+ function set_clipping_mode(node: Opaque<"node">, clipping_mode: gui.ClippingMode): void;
1830
+ /**
1831
+ * 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.
1832
+ *
1833
+ * @param node - node to set clipping visibility for
1834
+ * @param visible - `true` or `false`
1835
+ */
1836
+ function set_clipping_visible(node: Opaque<"node">, visible: boolean): void;
1837
+ /**
1838
+ * Sets the color of the supplied node. The components
1839
+ * of the supplied vector3 or vector4 should contain the color channel values:
1840
+ *
1841
+ * Component
1842
+ * Color value
1843
+ *
1844
+ * x
1845
+ * Red value
1846
+ *
1847
+ * y
1848
+ * Green value
1849
+ *
1850
+ * z
1851
+ * Blue value
1852
+ *
1853
+ * w vector4
1854
+ * Alpha value
1855
+ *
1856
+ * @param node - node to set the color for
1857
+ * @param color - new color
1858
+ */
1859
+ function set_color(node: Opaque<"node">, color: Vector3 | Vector4): void;
1860
+ /**
1861
+ * Sets a node to the disabled or enabled state.
1862
+ * Disabled nodes are not rendered and animations acting on them are not evaluated.
1863
+ *
1864
+ * @param node - node to be enabled/disabled
1865
+ * @param enabled - whether the node should be enabled or not
1866
+ */
1867
+ function set_enabled(node: Opaque<"node">, enabled: boolean): void;
1868
+ /**
1869
+ * Sets the rotation of the supplied node.
1870
+ * The rotation is expressed in degree Euler angles.
1871
+ *
1872
+ * @param node - node to set the rotation for
1873
+ * @param rotation - new rotation
1874
+ */
1875
+ function set_euler(node: Opaque<"node">, rotation: Vector3 | Vector4): void;
1876
+ /**
1877
+ * Set the sector angle of a pie node.
1878
+ *
1879
+ * @param node - node to set the fill angle for
1880
+ * @param angle - sector angle
1881
+ */
1882
+ function set_fill_angle(node: Opaque<"node">, angle: number): void;
1883
+ /**
1884
+ * This is only useful nodes with flipbook animations. The cursor is normalized.
1885
+ *
1886
+ * @param node - node to set the cursor for
1887
+ * @param cursor - cursor value
1888
+ */
1889
+ function set_flipbook_cursor(node: Opaque<"node">, cursor: number): void;
1890
+ /**
1891
+ * This is only useful nodes with flipbook animations. Sets the playback rate of the flipbook animation on a node. Must be positive.
1892
+ *
1893
+ * @param node - node to set the cursor for
1894
+ * @param playback_rate - playback rate
1895
+ */
1896
+ function set_flipbook_playback_rate(node: Opaque<"node">, playback_rate: number): void;
1897
+ /**
1898
+ * This is only useful for text nodes.
1899
+ * The font must be mapped to the gui scene in the gui editor.
1900
+ *
1901
+ * @param node - node for which to set the font
1902
+ * @param font - font id
1903
+ */
1904
+ function set_font(node: Opaque<"node">, font: string | Hash): void;
1905
+ /**
1906
+ * Set the id of the specicied node to a new value.
1907
+ * Nodes created with the gui.new_*_node() functions get
1908
+ * an empty id. This function allows you to give dynamically
1909
+ * created nodes an id.
1910
+ * No checking is done on the uniqueness of supplied ids.
1911
+ * It is up to you to make sure you use unique ids.
1912
+ *
1913
+ * @param node - node to set the id for
1914
+ * @param id - id to set
1915
+ * @example
1916
+ * ```ts
1917
+ * // Create a new node and set its id:
1918
+ * const pos = vmath.vector3(100, 100, 0);
1919
+ * const size = vmath.vector3(100, 100, 0);
1920
+ * const node = gui.new_box_node(pos, size);
1921
+ * gui.set_id(node, "my_new_node");
1922
+ * ```
1923
+ */
1924
+ function set_id(node: Opaque<"node">, id: string | Hash): void;
1925
+ /**
1926
+ * sets the node inherit alpha state
1927
+ *
1928
+ * @param node - node from which to set the inherit alpha state
1929
+ * @param inherit_alpha - `true` or `false`
1930
+ */
1931
+ function set_inherit_alpha(node: Opaque<"node">, inherit_alpha: boolean): void;
1932
+ /**
1933
+ * Sets the inner radius of a pie node.
1934
+ * The radius is defined along the x-axis.
1935
+ *
1936
+ * @param node - node to set the inner radius for
1937
+ * @param radius - inner radius
1938
+ */
1939
+ function set_inner_radius(node: Opaque<"node">, radius: number): void;
1940
+ /**
1941
+ * The layer must be mapped to the gui scene in the gui editor.
1942
+ *
1943
+ * @param node - node for which to set the layer
1944
+ * @param layer - layer id
1945
+ */
1946
+ function set_layer(node: Opaque<"node">, layer: string | Hash): void;
1947
+ /**
1948
+ * Applies a named layout on the GUI scene. This re-applies per-layout node descriptors
1949
+ * and, if a matching Display Profile exists, updates the scene resolution. Emits
1950
+ * the "layout_changed" message to the scene script when the layout actually changes.
1951
+ *
1952
+ * @param layout - the layout id to apply
1953
+ * @returns true if the layout exists in the scene and was applied, false otherwise
1954
+ */
1955
+ function set_layout(layout: string | Hash): boolean;
1956
+ /**
1957
+ * Sets the leading value for a text node. This value is used to
1958
+ * scale the line spacing of text.
1959
+ *
1960
+ * @param node - node for which to set the leading
1961
+ * @param leading - a scaling value for the line spacing (default=1)
1962
+ */
1963
+ function set_leading(node: Opaque<"node">, leading: number): void;
1964
+ /**
1965
+ * Sets the line-break mode on a text node.
1966
+ * This is only useful for text nodes.
1967
+ *
1968
+ * @param node - node to set line-break for
1969
+ * @param line_break - `true` or `false`
1970
+ */
1971
+ function set_line_break(node: Opaque<"node">, line_break: boolean): void;
1972
+ /**
1973
+ * Set the material on a node. The material must be mapped to the gui scene in the gui editor,
1974
+ * and assigning a material is supported for all node types. To set the default material that
1975
+ * is assigned to the gui scene node, use `gui.reset_material(node_id)` instead.
1976
+ *
1977
+ * @param node - node to set material for
1978
+ * @param material - material id
1979
+ * @example
1980
+ * ```ts
1981
+ * // Assign an existing material to a node:
1982
+ * const node = gui.get_node("my_node");
1983
+ * gui.set_material(node, "my_material");
1984
+ * ```
1985
+ */
1986
+ function set_material(node: Opaque<"node">, material: string | Hash): void;
1987
+ /**
1988
+ * Sets the outer bounds mode for a pie node.
1989
+ *
1990
+ * @param node - node for which to set the outer bounds mode
1991
+ * @param bounds_mode - the outer bounds mode of the pie node:
1992
+ *
1993
+ * - `gui.PIEBOUNDS_RECTANGLE`
1994
+ * - `gui.PIEBOUNDS_ELLIPSE`
1995
+ */
1996
+ function set_outer_bounds(node: Opaque<"node">, bounds_mode: gui.PieBounds): void;
1997
+ /**
1998
+ * Sets the outline color of the supplied node.
1999
+ * See gui.set_color for info how vectors encode color values.
2000
+ *
2001
+ * @param node - node to set the outline color for
2002
+ * @param color - new outline color
2003
+ */
2004
+ function set_outline(node: Opaque<"node">, color: Vector3 | Vector4): void;
2005
+ /**
2006
+ * Sets the parent node of the specified node.
2007
+ *
2008
+ * @param node - node for which to set its parent
2009
+ * @param parent - parent node to set, pass `nil` to remove parent
2010
+ * @param keep_scene_transform - optional flag to make the scene position being perserved
2011
+ */
2012
+ function set_parent(node: Opaque<"node">, parent: Opaque<"node"> | undefined, keep_scene_transform?: boolean): void;
2013
+ /**
2014
+ * Set the paricle fx for a gui node
2015
+ *
2016
+ * @param node - node to set particle fx for
2017
+ * @param particlefx - particle fx id
2018
+ */
2019
+ function set_particlefx(node: Opaque<"node">, particlefx: Hash | string): void;
2020
+ /**
2021
+ * Sets the number of generated vertices around the perimeter of a pie node.
2022
+ *
2023
+ * @param node - pie node
2024
+ * @param vertices - vertex count
2025
+ */
2026
+ function set_perimeter_vertices(node: Opaque<"node">, vertices: number): void;
2027
+ /**
2028
+ * The pivot specifies how the node is drawn and rotated from its position.
2029
+ *
2030
+ * @param node - node to set pivot for
2031
+ * @param pivot - pivot constant
2032
+ *
2033
+ * - `gui.PIVOT_CENTER`
2034
+ * - `gui.PIVOT_N`
2035
+ * - `gui.PIVOT_NE`
2036
+ * - `gui.PIVOT_E`
2037
+ * - `gui.PIVOT_SE`
2038
+ * - `gui.PIVOT_S`
2039
+ * - `gui.PIVOT_SW`
2040
+ * - `gui.PIVOT_W`
2041
+ * - `gui.PIVOT_NW`
2042
+ */
2043
+ function set_pivot(node: Opaque<"node">, pivot: gui.Pivot): void;
2044
+ /**
2045
+ * Sets the position of the supplied node.
2046
+ *
2047
+ * @param node - node to set the position for
2048
+ * @param position - new position
2049
+ */
2050
+ function set_position(node: Opaque<"node">, position: Vector3 | Vector4): void;
2051
+ /**
2052
+ * Set the order number for the current GUI scene.
2053
+ * The number dictates the sorting of the "gui" render predicate,
2054
+ * in other words in which order the scene will be rendered in relation
2055
+ * to other currently rendered GUI scenes.
2056
+ * The number must be in the range 0 to 15.
2057
+ *
2058
+ * @param order - rendering order (0-15)
2059
+ */
2060
+ function set_render_order(order: number): void;
2061
+ /**
2062
+ * Sets the rotation of the supplied node.
2063
+ * The rotation is expressed as a quaternion
2064
+ *
2065
+ * @param node - node to set the rotation for
2066
+ * @param rotation - new rotation
2067
+ */
2068
+ function set_rotation(node: Opaque<"node">, rotation: Quaternion | Vector4 | Vector3): void;
2069
+ /**
2070
+ * Sets how the safe area is applied to this gui scene.
2071
+ *
2072
+ * @param mode - safe area mode
2073
+ *
2074
+ * - `gui.SAFE_AREA_NONE`
2075
+ * - `gui.SAFE_AREA_LONG`
2076
+ * - `gui.SAFE_AREA_SHORT`
2077
+ * - `gui.SAFE_AREA_BOTH`
2078
+ */
2079
+ function set_safe_area_mode(mode: gui.SafeAreaMode): void;
2080
+ /**
2081
+ * Sets the scaling of the supplied node.
2082
+ *
2083
+ * @param node - node to set the scale for
2084
+ * @param scale - new scale
2085
+ */
2086
+ function set_scale(node: Opaque<"node">, scale: Vector3 | Vector4): void;
2087
+ /**
2088
+ * Set the screen position to the supplied node
2089
+ *
2090
+ * @param node - node to set the screen position to
2091
+ * @param screen_position - screen position
2092
+ */
2093
+ function set_screen_position(node: Opaque<"node">, screen_position: Vector3 | Vector4): void;
2094
+ /**
2095
+ * Sets the shadow color of the supplied node.
2096
+ * See gui.set_color for info how vectors encode color values.
2097
+ *
2098
+ * @param node - node to set the shadow color for
2099
+ * @param color - new shadow color
2100
+ */
2101
+ function set_shadow(node: Opaque<"node">, color: Vector3 | Vector4): void;
2102
+ /**
2103
+ * Sets the size of the supplied node.
2104
+ * You can only set size on nodes with size mode set to SIZE_MODE_MANUAL
2105
+ *
2106
+ * @param node - node to set the size for
2107
+ * @param size - new size
2108
+ */
2109
+ function set_size(node: Opaque<"node">, size: Vector3 | Vector4): void;
2110
+ /**
2111
+ * Sets the size mode of a node.
2112
+ * The size mode defines how the node will adjust itself in size. Automatic
2113
+ * size mode alters the node size based on the node's content. Automatic size
2114
+ * mode works for Box nodes and Pie nodes which will both adjust their size
2115
+ * to match the assigned image. Particle fx and Text nodes will ignore
2116
+ * any size mode setting.
2117
+ *
2118
+ * @param node - node to set size mode for
2119
+ * @param size_mode - size mode to set
2120
+ *
2121
+ * - `gui.SIZE_MODE_MANUAL`
2122
+ * - `gui.SIZE_MODE_AUTO`
2123
+ */
2124
+ function set_size_mode(node: Opaque<"node">, size_mode: gui.SizeMode): void;
2125
+ /**
2126
+ * Set the slice9 configuration values for the node.
2127
+ *
2128
+ * @param node - node to manipulate
2129
+ * @param values - new values
2130
+ */
2131
+ function set_slice9(node: Opaque<"node">, values: Vector4): void;
2132
+ /**
2133
+ * Set the text value of a text node. This is only useful for text nodes.
2134
+ *
2135
+ * @param node - node to set text for
2136
+ * @param text - text to set
2137
+ */
2138
+ function set_text(node: Opaque<"node">, text: string | number): void;
2139
+ /**
2140
+ * Set the texture on a box or pie node. The texture must be mapped to
2141
+ * the gui scene in the gui editor. The function points out which texture
2142
+ * the node should render from. If the texture is an atlas, further
2143
+ * information is needed to select which image/animation in the atlas
2144
+ * to render. In such cases, use `gui.play_flipbook()` in
2145
+ * addition to this function.
2146
+ *
2147
+ * @param node - node to set texture for
2148
+ * @param texture - texture id
2149
+ * @example
2150
+ * To set a texture (or animation) from an atlas:
2151
+ * ```ts
2152
+ * const node = gui.get_node("box_node");
2153
+ * gui.set_texture(node, "my_atlas");
2154
+ * gui.play_flipbook(node, "image");
2155
+ * ```
2156
+ * @example
2157
+ * Set a dynamically created texture to a node. Note that there is only
2158
+ * one texture image in this case so `gui.set_texture()` is
2159
+ * sufficient.
2160
+ * ```ts
2161
+ * const w = 200;
2162
+ * const h = 300;
2163
+ * // A nice orange. String with the RGB values.
2164
+ * const orange = String.fromCharCode(0xff, 0x80, 0x10);
2165
+ * // Create the texture. Repeat the color string for each pixel.
2166
+ * const [ok] = gui.new_texture("orange_tx", w, h, "rgb", orange.repeat(w * h));
2167
+ * if (ok) {
2168
+ * const node = gui.get_node("box_node");
2169
+ * gui.set_texture(node, "orange_tx");
2170
+ * }
2171
+ * ```
2172
+ */
2173
+ function set_texture(node: Opaque<"node">, texture: string | Hash): void;
2174
+ /**
2175
+ * Set the texture buffer data for a dynamically created texture.
2176
+ *
2177
+ * @param texture - texture id
2178
+ * @param width - texture width
2179
+ * @param height - texture height
2180
+ * @param type - texture type
2181
+ *
2182
+ * - `"rgb"` - RGB
2183
+ * - `"rgba"` - RGBA
2184
+ * - `"l"` - LUMINANCE
2185
+ * - `"astc"` - ASTC compressed format
2186
+ * @param buffer - texture data
2187
+ * @param flip - flip texture vertically
2188
+ * @returns setting the data was successful
2189
+ * @example
2190
+ * ```ts
2191
+ * export default defineGuiScript({
2192
+ * init(self) {
2193
+ * const w = 200;
2194
+ * const h = 300;
2195
+ *
2196
+ * // Create a dynamic texture, all white.
2197
+ * if (gui.new_texture("dynamic_tx", w, h, "rgb", String.fromCharCode(0xff).repeat(w * h * 3))) {
2198
+ * // Create a box node and apply the texture to it.
2199
+ * const n = gui.new_box_node(vmath.vector3(200, 200, 0), vmath.vector3(w, h, 0));
2200
+ * gui.set_texture(n, "dynamic_tx");
2201
+ *
2202
+ * // ...
2203
+ *
2204
+ * // Change the data in the texture to a nice orange.
2205
+ * const orange = String.fromCharCode(0xff, 0x80, 0x10);
2206
+ * if (gui.set_texture_data("dynamic_tx", w, h, "rgb", orange.repeat(w * h))) {
2207
+ * // Go on and to more stuff
2208
+ * // ...
2209
+ * }
2210
+ * } else {
2211
+ * // Something went wrong
2212
+ * // ...
2213
+ * }
2214
+ * },
2215
+ * });
2216
+ * ```
2217
+ */
2218
+ function set_texture_data(texture: string | Hash, width: number, height: number, type: string | Opaque<"constant">, buffer: string, flip?: boolean): boolean;
2219
+ /**
2220
+ * Sets the tracking value of a text node. This value is used to
2221
+ * adjust the vertical spacing of characters in the text.
2222
+ *
2223
+ * @param node - node for which to set the tracking
2224
+ * @param tracking - a scaling number for the letter spacing (default=0)
2225
+ */
2226
+ function set_tracking(node: Opaque<"node">, tracking: number): void;
2227
+ /**
2228
+ * Set if a node should be visible or not. Only visible nodes are rendered.
2229
+ *
2230
+ * @param node - node to be visible or not
2231
+ * @param visible - whether the node should be visible or not
2232
+ */
2233
+ function set_visible(node: Opaque<"node">, visible: boolean): void;
2234
+ /**
2235
+ * The x-anchor specifies how the node is moved when the game is run in a different resolution.
2236
+ *
2237
+ * @param node - node to set x-anchor for
2238
+ * @param anchor - anchor constant
2239
+ *
2240
+ * - `gui.ANCHOR_NONE`
2241
+ * - `gui.ANCHOR_LEFT`
2242
+ * - `gui.ANCHOR_RIGHT`
2243
+ */
2244
+ function set_xanchor(node: Opaque<"node">, anchor: gui.XAnchor): void;
2245
+ /**
2246
+ * The y-anchor specifies how the node is moved when the game is run in a different resolution.
2247
+ *
2248
+ * @param node - node to set y-anchor for
2249
+ * @param anchor - anchor constant
2250
+ *
2251
+ * - `gui.ANCHOR_NONE`
2252
+ * - `gui.ANCHOR_TOP`
2253
+ * - `gui.ANCHOR_BOTTOM`
2254
+ */
2255
+ function set_yanchor(node: Opaque<"node">, anchor: gui.YAnchor): void;
2256
+ /**
2257
+ * Shows the on-display touch keyboard.
2258
+ * The specified type of keyboard is displayed if it is available on
2259
+ * the device.
2260
+ * This function is only available on iOS and Android. .
2261
+ *
2262
+ * @param type - keyboard type
2263
+ *
2264
+ * - `gui.KEYBOARD_TYPE_DEFAULT`
2265
+ * - `gui.KEYBOARD_TYPE_EMAIL`
2266
+ * - `gui.KEYBOARD_TYPE_NUMBER_PAD`
2267
+ * - `gui.KEYBOARD_TYPE_PASSWORD`
2268
+ * @param autoclose - if the keyboard should automatically close when clicking outside
2269
+ */
2270
+ function show_keyboard(type: gui.KeyboardType, autoclose: boolean): void;
2271
+ /**
2272
+ * Stops the particle fx for a gui node
2273
+ *
2274
+ * @param node - node to stop particle fx for
2275
+ * @param options - options when stopping the particle fx. Supported options:
2276
+ *
2277
+ * - boolean `clear`: instantly clear spawned particles
2278
+ */
2279
+ function stop_particlefx(node: Opaque<"node">, options?: { clear?: boolean }): void;
2280
+ /**
2281
+ * This is a callback-function, which is called by the engine every frame to update the state of a gui component.
2282
+ * It can be used to perform any kind of gui related tasks, e.g. animating nodes.
2283
+ *
2284
+ * @param self - reference to the script state to be used for storing data
2285
+ * @param dt - the time-step of the frame update
2286
+ * @example
2287
+ * ```ts
2288
+ * // This example demonstrates how to update a text node that displays game score
2289
+ * // in a counting fashion. It is assumed that the gui component receives messages
2290
+ * // from the game when a new score is to be shown.
2291
+ * export default defineGuiScript({
2292
+ * init() {
2293
+ * return {
2294
+ * // fetch the score text node for later use (assumes it is called "score")
2295
+ * score_node: gui.get_node("score"),
2296
+ * // keep track of the current score counted up so far
2297
+ * current_score: 0,
2298
+ * // keep track of the target score we should count up to
2299
+ * target_score: 0,
2300
+ * // how fast we will update the score, in score/second
2301
+ * score_update_speed: 1,
2302
+ * };
2303
+ * },
2304
+ *
2305
+ * update(self, dt) {
2306
+ * // check if target score is more than current score
2307
+ * if (self.current_score < self.target_score) {
2308
+ * // increment current score according to the speed
2309
+ * self.current_score = self.current_score + dt * self.score_update_speed;
2310
+ * // check if we went past the target score, clamp current score in that case
2311
+ * if (self.current_score > self.target_score) {
2312
+ * self.current_score = self.target_score;
2313
+ * }
2314
+ * // update the score text node
2315
+ * gui.set_text(self.score_node, "" + math.floor(self.current_score));
2316
+ * }
2317
+ * },
2318
+ *
2319
+ * on_message(self, message_id, message) {
2320
+ * // check the message
2321
+ * if (message_id === hash("set_score") && typeof message.score === "number") {
2322
+ * self.target_score = message.score;
2323
+ * }
2324
+ * },
2325
+ * });
2326
+ * ```
2327
+ */
2328
+ function update(self: Opaque<"userdata">, dt: number): void;
2329
+ interface properties {
2330
+ /**
2331
+ * The fonts used in the gui. The type of the property is hash.
2332
+ * Key must be specified in options table.
2333
+ */
2334
+ fonts: Hash;
2335
+ /**
2336
+ * The main material (the default material assigned to a GUI) used when rendering the gui. The type of the property is hash.
2337
+ */
2338
+ material: Hash;
2339
+ /**
2340
+ * The materials used when rendering the gui. The type of the property is hash.
2341
+ * Key must be specified in options table.
2342
+ */
2343
+ materials: Hash;
2344
+ /**
2345
+ * The textures used in the gui. The type of the property is hash.
2346
+ * Key must be specified in options table.
2347
+ */
2348
+ textures: Hash;
2349
+ }
2350
+ }
2351
+ }
2352
+
2353
+ export {};