@defold-typescript/types 0.40.0 → 0.42.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 (224) hide show
  1. package/api-availability.json +3963 -772
  2. package/api-migrations.json +27 -0
  3. package/api-signatures.json +18069 -10240
  4. package/api-targets.json +448 -11
  5. package/examples/translations.json +560 -89
  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 +183 -20
  13. package/generated/b2d_world.d.ts +57 -63
  14. package/generated/buffer.d.ts +16 -15
  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 +29 -32
  23. package/generated/collectionfactory.d.ts +15 -18
  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 +235 -182
  37. package/generated/graphics.d.ts +335 -97
  38. package/generated/gui.d.ts +240 -471
  39. package/generated/html5.d.ts +2 -2
  40. package/generated/http.d.ts +28 -35
  41. package/generated/image.d.ts +105 -72
  42. package/generated/json.d.ts +34 -16
  43. package/generated/kinds/gui-script.d.ts +7 -0
  44. package/generated/kinds/render-script.d.ts +7 -0
  45. package/generated/kinds/script.d.ts +7 -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 +40 -39
  50. package/generated/particlefx.d.ts +19 -28
  51. package/generated/physics.d.ts +365 -133
  52. package/generated/profiler.d.ts +13 -23
  53. package/generated/render.d.ts +237 -297
  54. package/generated/resource.d.ts +664 -583
  55. package/generated/socket.d.ts +120 -133
  56. package/generated/sound.d.ts +62 -31
  57. package/generated/sprite.d.ts +31 -17
  58. package/generated/sys.d.ts +234 -190
  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 +1 -3
  63. package/generated/versions/defold-1.12.4/camera.d.ts +21 -21
  64. package/generated/versions/defold-1.12.4/collectionfactory.d.ts +9 -9
  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 +6 -12
  69. package/generated/versions/defold-1.12.4/gui.d.ts +77 -175
  70. package/generated/versions/defold-1.12.4/html5.d.ts +1 -1
  71. package/generated/versions/defold-1.12.4/http.d.ts +0 -13
  72. package/generated/versions/defold-1.12.4/image.d.ts +16 -33
  73. package/generated/versions/defold-1.12.4/index.d.ts +1 -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 +2 -10
  78. package/generated/versions/defold-1.12.4/particlefx.d.ts +2 -5
  79. package/generated/versions/defold-1.12.4/physics.d.ts +69 -67
  80. package/generated/versions/defold-1.12.4/profiler.d.ts +2 -5
  81. package/generated/versions/defold-1.12.4/render.d.ts +99 -128
  82. package/generated/versions/defold-1.12.4/resource.d.ts +120 -148
  83. package/generated/versions/defold-1.12.4/socket.d.ts +34 -60
  84. package/generated/versions/defold-1.12.4/sound.d.ts +8 -8
  85. package/generated/versions/defold-1.12.4/sprite.d.ts +15 -5
  86. package/generated/versions/defold-1.12.4/sys.d.ts +37 -71
  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 +0 -21
  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 +169 -8
  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 +1 -3
  96. package/generated/versions/defold-1.13.0/camera.d.ts +25 -25
  97. package/generated/versions/defold-1.13.0/collectionfactory.d.ts +9 -9
  98. package/generated/versions/defold-1.13.0/collectionproxy.d.ts +2 -2
  99. package/generated/versions/defold-1.13.0/compute.d.ts +0 -69
  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 +6 -12
  105. package/generated/versions/defold-1.13.0/graphics.d.ts +73 -37
  106. package/generated/versions/defold-1.13.0/gui.d.ts +77 -175
  107. package/generated/versions/defold-1.13.0/html5.d.ts +1 -1
  108. package/generated/versions/defold-1.13.0/http.d.ts +0 -13
  109. package/generated/versions/defold-1.13.0/image.d.ts +16 -33
  110. package/generated/versions/defold-1.13.0/index.d.ts +1 -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 +68 -106
  115. package/generated/versions/defold-1.13.0/model.d.ts +2 -10
  116. package/generated/versions/defold-1.13.0/particlefx.d.ts +2 -5
  117. package/generated/versions/defold-1.13.0/physics.d.ts +69 -67
  118. package/generated/versions/defold-1.13.0/profiler.d.ts +2 -5
  119. package/generated/versions/defold-1.13.0/render.d.ts +99 -128
  120. package/generated/versions/defold-1.13.0/resource.d.ts +126 -150
  121. package/generated/versions/defold-1.13.0/socket.d.ts +34 -60
  122. package/generated/versions/defold-1.13.0/sound.d.ts +8 -8
  123. package/generated/versions/defold-1.13.0/sprite.d.ts +15 -5
  124. package/generated/versions/defold-1.13.0/sys.d.ts +37 -71
  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 +0 -21
  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 +1 -21
  182. package/generated/window.d.ts +71 -71
  183. package/identity-vocabulary.json +561 -0
  184. package/index.d.ts +7 -0
  185. package/package.json +18 -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 +12 -2
  191. package/scripts/import-defold-release.ts +106 -26
  192. package/scripts/prose-constants.ts +77 -16
  193. package/scripts/regen.ts +391 -77
  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 +48 -10
  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/core-types.ts +26 -3
  201. package/src/correction-pins.ts +49 -0
  202. package/src/doc-comment.ts +104 -11
  203. package/src/doc-corrections.ts +108 -0
  204. package/src/editor-vm-globals.d.ts +5 -2
  205. package/src/emit-dts.ts +2064 -281
  206. package/src/emit-messages.ts +52 -0
  207. package/src/example-store.ts +125 -14
  208. package/src/field-correction-coverage.ts +204 -0
  209. package/src/fnv1a.ts +16 -0
  210. package/src/go-overloads.d.ts +25 -6
  211. package/src/index-base-table.ts +145 -0
  212. package/src/index-slot-classifications.ts +588 -0
  213. package/src/index.ts +38 -5
  214. package/src/library-index-slot-classifications.ts +332 -0
  215. package/src/lifecycle.ts +61 -199
  216. package/src/luals-type-expr.ts +354 -0
  217. package/src/msg-overloads.d.ts +0 -1
  218. package/src/param-correction-provenance.ts +8 -11
  219. package/src/render-overloads.d.ts +0 -15
  220. package/src/return-correction-provenance.ts +58 -16
  221. package/src/sys-overloads.d.ts +48 -0
  222. package/src/vmath-overloads.d.ts +27 -1
  223. package/src/window-event-guard.d.ts +6 -9
  224. package/url-parameters.json +1 -2
@@ -6,6 +6,74 @@ declare global {
6
6
  * GUI API documentation
7
7
  */
8
8
  namespace gui {
9
+ /**
10
+ * Rich-text layout object
11
+ */
12
+ interface layout_object {
13
+ /**
14
+ * object type, currently `link` or `sprite`
15
+ */
16
+ type: string;
17
+ /**
18
+ * the object's `id` attribute, or its generated layout object id
19
+ */
20
+ id: Hash;
21
+ /**
22
+ * zero-based UTF-32 offset in the visible text
23
+ */
24
+ text_offset: number;
25
+ /**
26
+ * visible UTF-32 text length covered by the object
27
+ */
28
+ text_length: number;
29
+ /**
30
+ * lower-left x-coordinate relative to the text node's upper-left layout origin
31
+ */
32
+ x: number;
33
+ /**
34
+ * lower-left y-coordinate relative to the text node's upper-left layout origin
35
+ */
36
+ y: number;
37
+ /**
38
+ * resolved object width
39
+ */
40
+ width: number;
41
+ /**
42
+ * resolved object height
43
+ */
44
+ height: number;
45
+ /**
46
+ * markup attributes keyed by name
47
+ */
48
+ attributes: LuaTable<string, string>;
49
+ }
50
+ type node = Opaque<"node">;
51
+ /**
52
+ * GUI flipbook playback properties
53
+ */
54
+ interface play_properties {
55
+ /**
56
+ * Normalized initial animation cursor.
57
+ */
58
+ offset?: number;
59
+ /**
60
+ * Positive animation playback rate.
61
+ */
62
+ playback_rate?: number;
63
+ }
64
+ /**
65
+ * Generic GUI property options
66
+ */
67
+ interface set_options {
68
+ /**
69
+ * One-based material-constant array index.
70
+ */
71
+ index?: number;
72
+ /**
73
+ * Internal property name.
74
+ */
75
+ key?: string | Hash;
76
+ }
9
77
  type AdjustMode = typeof gui.ADJUST_FIT | typeof gui.ADJUST_ZOOM | typeof gui.ADJUST_STRETCH;
10
78
  type BlendMode = typeof gui.BLEND_ALPHA | typeof gui.BLEND_ADD | typeof gui.BLEND_ADD_ALPHA | typeof gui.BLEND_MULT | typeof gui.BLEND_SCREEN;
11
79
  type ClippingMode = typeof gui.CLIPPING_MODE_NONE | typeof gui.CLIPPING_MODE_STENCIL;
@@ -20,19 +88,30 @@ declare global {
20
88
  type SizeMode = typeof gui.SIZE_MODE_MANUAL | typeof gui.SIZE_MODE_AUTO;
21
89
  type XAnchor = typeof gui.ANCHOR_NONE | typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_RIGHT;
22
90
  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.
91
+ type ADJUST = typeof gui.ADJUST_FIT | typeof gui.ADJUST_STRETCH | typeof gui.ADJUST_ZOOM;
92
+ type ANCHOR = typeof gui.ANCHOR_BOTTOM | typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_NONE | typeof gui.ANCHOR_RIGHT | typeof gui.ANCHOR_TOP;
93
+ type BLEND = typeof gui.BLEND_ADD | typeof gui.BLEND_ADD_ALPHA | typeof gui.BLEND_ALPHA | typeof gui.BLEND_MULT | typeof gui.BLEND_SCREEN;
94
+ type CLIPPING_MODE = typeof gui.CLIPPING_MODE_NONE | typeof gui.CLIPPING_MODE_STENCIL;
95
+ 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;
96
+ type KEYBOARD_TYPE = typeof gui.KEYBOARD_TYPE_DEFAULT | typeof gui.KEYBOARD_TYPE_EMAIL | typeof gui.KEYBOARD_TYPE_NUMBER_PAD | typeof gui.KEYBOARD_TYPE_PASSWORD;
97
+ type PIEBOUNDS = typeof gui.PIEBOUNDS_ELLIPSE | typeof gui.PIEBOUNDS_RECTANGLE;
98
+ type PIVOT = typeof gui.PIVOT_CENTER | typeof gui.PIVOT_E | typeof gui.PIVOT_N | typeof gui.PIVOT_NE | typeof gui.PIVOT_NW | typeof gui.PIVOT_S | typeof gui.PIVOT_SE | typeof gui.PIVOT_SW | typeof gui.PIVOT_W;
99
+ type PLAYBACK = typeof gui.PLAYBACK_LOOP_BACKWARD | typeof gui.PLAYBACK_LOOP_FORWARD | typeof gui.PLAYBACK_LOOP_PINGPONG | typeof gui.PLAYBACK_ONCE_BACKWARD | typeof gui.PLAYBACK_ONCE_FORWARD | typeof gui.PLAYBACK_ONCE_PINGPONG;
100
+ type PROP = typeof gui.PROP_COLOR | typeof gui.PROP_EULER | typeof gui.PROP_FILL_ANGLE | typeof gui.PROP_INNER_RADIUS | typeof gui.PROP_LEADING | typeof gui.PROP_OUTLINE | typeof gui.PROP_POSITION | typeof gui.PROP_ROTATION | typeof gui.PROP_SCALE | typeof gui.PROP_SHADOW | typeof gui.PROP_SIZE | typeof gui.PROP_SLICE9 | typeof gui.PROP_TRACKING;
101
+ type RESULT = typeof gui.RESULT_DATA_ERROR | typeof gui.RESULT_OUT_OF_RESOURCES | typeof gui.RESULT_TEXTURE_ALREADY_EXISTS;
102
+ type SAFE_AREA = typeof gui.SAFE_AREA_BOTH | typeof gui.SAFE_AREA_LONG | typeof gui.SAFE_AREA_NONE | typeof gui.SAFE_AREA_SHORT;
103
+ type SIZE_MODE = typeof gui.SIZE_MODE_AUTO | typeof gui.SIZE_MODE_MANUAL;
104
+ type TYPE = typeof gui.TYPE_BOX | typeof gui.TYPE_CUSTOM | typeof gui.TYPE_PARTICLEFX | typeof gui.TYPE_PIE | typeof gui.TYPE_TEXT;
105
+ /**
106
+ * fit adjust mode Adjust mode is used when the screen resolution differs from the project settings. The fit mode ensures that the entire node is visible in the adjusted gui scene.
26
107
  */
27
108
  const ADJUST_FIT: number & { readonly __brand: "gui.ADJUST_FIT" };
28
109
  /**
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.
110
+ * stretch adjust mode Adjust mode is used when the screen resolution differs from the project settings. The stretch mode ensures that the node is displayed as is in the adjusted gui scene, which might scale it non-uniformally.
31
111
  */
32
112
  const ADJUST_STRETCH: number & { readonly __brand: "gui.ADJUST_STRETCH" };
33
113
  /**
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.
114
+ * zoom adjust mode Adjust mode is used when the screen resolution differs from the project settings. The zoom mode ensures that the node fills its entire area and might make the node exceed it.
36
115
  */
37
116
  const ADJUST_ZOOM: number & { readonly __brand: "gui.ADJUST_ZOOM" };
38
117
  /**
@@ -334,91 +413,89 @@ declare global {
334
413
  /**
335
414
  * color property
336
415
  */
337
- const PROP_COLOR: number & { readonly __brand: "gui.PROP_COLOR" };
416
+ const PROP_COLOR: string & { readonly __brand: "gui.PROP_COLOR" };
338
417
  /**
339
418
  * euler property
340
419
  */
341
- const PROP_EULER: number & { readonly __brand: "gui.PROP_EULER" };
420
+ const PROP_EULER: string & { readonly __brand: "gui.PROP_EULER" };
342
421
  /**
343
422
  * fill_angle property
344
423
  */
345
- const PROP_FILL_ANGLE: number & { readonly __brand: "gui.PROP_FILL_ANGLE" };
424
+ const PROP_FILL_ANGLE: string & { readonly __brand: "gui.PROP_FILL_ANGLE" };
346
425
  /**
347
426
  * inner_radius property
348
427
  */
349
- const PROP_INNER_RADIUS: number & { readonly __brand: "gui.PROP_INNER_RADIUS" };
428
+ const PROP_INNER_RADIUS: string & { readonly __brand: "gui.PROP_INNER_RADIUS" };
350
429
  /**
351
430
  * leading property
352
431
  */
353
- const PROP_LEADING: number & { readonly __brand: "gui.PROP_LEADING" };
432
+ const PROP_LEADING: string & { readonly __brand: "gui.PROP_LEADING" };
354
433
  /**
355
434
  * outline color property
356
435
  */
357
- const PROP_OUTLINE: number & { readonly __brand: "gui.PROP_OUTLINE" };
436
+ const PROP_OUTLINE: string & { readonly __brand: "gui.PROP_OUTLINE" };
358
437
  /**
359
438
  * position property
360
439
  */
361
- const PROP_POSITION: number & { readonly __brand: "gui.PROP_POSITION" };
440
+ const PROP_POSITION: string & { readonly __brand: "gui.PROP_POSITION" };
362
441
  /**
363
442
  * rotation property
364
443
  */
365
- const PROP_ROTATION: number & { readonly __brand: "gui.PROP_ROTATION" };
444
+ const PROP_ROTATION: string & { readonly __brand: "gui.PROP_ROTATION" };
366
445
  /**
367
446
  * scale property
368
447
  */
369
- const PROP_SCALE: number & { readonly __brand: "gui.PROP_SCALE" };
448
+ const PROP_SCALE: string & { readonly __brand: "gui.PROP_SCALE" };
370
449
  /**
371
450
  * shadow color property
372
451
  */
373
- const PROP_SHADOW: number & { readonly __brand: "gui.PROP_SHADOW" };
452
+ const PROP_SHADOW: string & { readonly __brand: "gui.PROP_SHADOW" };
374
453
  /**
375
454
  * size property
376
455
  */
377
- const PROP_SIZE: number & { readonly __brand: "gui.PROP_SIZE" };
456
+ const PROP_SIZE: string & { readonly __brand: "gui.PROP_SIZE" };
378
457
  /**
379
458
  * slice9 property
380
459
  */
381
- const PROP_SLICE9: number & { readonly __brand: "gui.PROP_SLICE9" };
460
+ const PROP_SLICE9: string & { readonly __brand: "gui.PROP_SLICE9" };
382
461
  /**
383
462
  * tracking property
384
463
  */
385
- const PROP_TRACKING: number & { readonly __brand: "gui.PROP_TRACKING" };
464
+ const PROP_TRACKING: string & { readonly __brand: "gui.PROP_TRACKING" };
386
465
  /**
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().
466
+ * data error The provided data is not in the expected format or is in some other way incorrect, for instance the image data provided to gui.new_texture().
389
467
  */
390
468
  const RESULT_DATA_ERROR: number & { readonly __brand: "gui.RESULT_DATA_ERROR" };
391
469
  /**
392
- * The system is out of resources, for instance when trying to create a new
393
- * texture using gui.new_texture().
470
+ * out of resource The system is out of resources, for instance when trying to create a new texture using gui.new_texture().
394
471
  */
395
472
  const RESULT_OUT_OF_RESOURCES: number & { readonly __brand: "gui.RESULT_OUT_OF_RESOURCES" };
396
473
  /**
397
- * The texture id already exists when trying to use gui.new_texture().
474
+ * texture already exists The texture id already exists when trying to use gui.new_texture().
398
475
  */
399
476
  const RESULT_TEXTURE_ALREADY_EXISTS: number & { readonly __brand: "gui.RESULT_TEXTURE_ALREADY_EXISTS" };
400
477
  /**
401
- * Safe area mode that applies insets on all edges.
478
+ * both sides safe area Safe area mode that applies insets on all edges.
402
479
  */
403
480
  const SAFE_AREA_BOTH: number & { readonly __brand: "gui.SAFE_AREA_BOTH" };
404
481
  /**
405
- * Safe area mode that applies insets only on the long edges.
482
+ * long side safe area Safe area mode that applies insets only on the long edges.
406
483
  */
407
484
  const SAFE_AREA_LONG: number & { readonly __brand: "gui.SAFE_AREA_LONG" };
408
485
  /**
409
- * Safe area mode that ignores safe area insets.
486
+ * no safe area Safe area mode that ignores safe area insets.
410
487
  */
411
488
  const SAFE_AREA_NONE: number & { readonly __brand: "gui.SAFE_AREA_NONE" };
412
489
  /**
413
- * Safe area mode that applies insets only on the short edges.
490
+ * short side safe area Safe area mode that applies insets only on the short edges.
414
491
  */
415
492
  const SAFE_AREA_SHORT: number & { readonly __brand: "gui.SAFE_AREA_SHORT" };
416
493
  /**
417
- * The size of the node is determined by the currently assigned texture.
494
+ * automatic size mode The size of the node is determined by the currently assigned texture.
418
495
  */
419
496
  const SIZE_MODE_AUTO: number & { readonly __brand: "gui.SIZE_MODE_AUTO" };
420
497
  /**
421
- * The size of the node is determined by the size set in the editor, the constructor or by gui.set_size()
498
+ * manual size mode The size of the node is determined by the size set in the editor, the constructor or by gui.set_size()
422
499
  */
423
500
  const SIZE_MODE_MANUAL: number & { readonly __brand: "gui.SIZE_MODE_MANUAL" };
424
501
  /**
@@ -459,61 +536,7 @@ declare global {
459
536
  * together. See the examples below for more information.
460
537
  *
461
538
  * @param node - node to animate
462
- * @param property - property to animate
463
- *
464
- * - `"position"`
465
- *
466
- * - `"rotation"`
467
- *
468
- * - `"euler"`
469
- *
470
- * - `"scale"`
471
- *
472
- * - `"color"`
473
- *
474
- * - `"outline"`
475
- *
476
- * - `"shadow"`
477
- *
478
- * - `"size"`
479
- *
480
- * - `"fill_angle"` (pie)
481
- *
482
- * - `"inner_radius"` (pie)
483
- *
484
- * - `"leading"` (text)
485
- *
486
- * - `"tracking"` (text)
487
- *
488
- * - `"slice9"` (slice9)
489
- *
490
- * The following property constants are defined equaling the corresponding property string names.
491
- *
492
- * - `gui.PROP_POSITION`
493
- *
494
- * - `gui.PROP_ROTATION`
495
- *
496
- * - `gui.PROP_EULER`
497
- *
498
- * - `gui.PROP_SCALE`
499
- *
500
- * - `gui.PROP_COLOR`
501
- *
502
- * - `gui.PROP_OUTLINE`
503
- *
504
- * - `gui.PROP_SHADOW`
505
- *
506
- * - `gui.PROP_SIZE`
507
- *
508
- * - `gui.PROP_FILL_ANGLE`
509
- *
510
- * - `gui.PROP_INNER_RADIUS`
511
- *
512
- * - `gui.PROP_LEADING`
513
- *
514
- * - `gui.PROP_TRACKING`
515
- *
516
- * - `gui.PROP_SLICE9`
539
+ * @param property - property to animate; each gui.PROP member equals its corresponding property name string
517
540
  * @param to - target property value
518
541
  * @param easing - easing to use during animation.
519
542
  * Either specify one of the `gui.EASING_*` constants or provide a
@@ -523,18 +546,6 @@ declare global {
523
546
  * @param complete_function - function to call when the
524
547
  * animation has completed
525
548
  * @param playback - playback mode
526
- *
527
- * - `gui.PLAYBACK_ONCE_FORWARD`
528
- *
529
- * - `gui.PLAYBACK_ONCE_BACKWARD`
530
- *
531
- * - `gui.PLAYBACK_ONCE_PINGPONG`
532
- *
533
- * - `gui.PLAYBACK_LOOP_FORWARD`
534
- *
535
- * - `gui.PLAYBACK_LOOP_BACKWARD`
536
- *
537
- * - `gui.PLAYBACK_LOOP_PINGPONG`
538
549
  * @example
539
550
  * How to start a simple color animation, where the node fades in to white during 0.5 seconds:
540
551
  * ```ts
@@ -583,7 +594,7 @@ declare global {
583
594
  * });
584
595
  * ```
585
596
  */
586
- function animate(node: Opaque<"node">, property: string | gui.Property, to: number | Vector3 | Vector4 | Quaternion, easing: gui.Easing | Vector, duration: number, delay?: number, complete_function?: (self: unknown, node: unknown) => void, playback?: gui.Playback): void;
597
+ function animate(node: Opaque<"node">, property: string | Hash | gui.PROP, to: number | Vector3 | Vector4 | Quaternion, easing: gui.EASING | Vector, duration: number, delay?: number, complete_function?: (self: unknown, node: Opaque<"node">) => void, playback?: gui.PLAYBACK): void;
587
598
  /**
588
599
  * If one or more animations of the specified node is currently running (started by `gui.animate`), they will immediately be canceled.
589
600
  *
@@ -591,34 +602,22 @@ declare global {
591
602
  * @param property - optional property for which the animation should be canceled
592
603
  *
593
604
  * - `"position"`
594
- *
595
605
  * - `"rotation"`
596
- *
597
606
  * - `"euler"`
598
- *
599
607
  * - `"scale"`
600
- *
601
608
  * - `"color"`
602
- *
603
609
  * - `"outline"`
604
- *
605
610
  * - `"shadow"`
606
- *
607
611
  * - `"size"`
608
- *
609
612
  * - `"fill_angle"` (pie)
610
- *
611
613
  * - `"inner_radius"` (pie)
612
- *
613
614
  * - `"leading"` (text)
614
- *
615
615
  * - `"tracking"` (text)
616
- *
617
616
  * - `"slice9"` (slice9)
618
617
  * @example
618
+ * Start an animation of the position property of a node, then cancel parts of
619
+ * the animation:
619
620
  * ```ts
620
- * // Start an animation of the position property of a node, then cancel parts of
621
- * // the animation:
622
621
  * const node = gui.get_node("my_node");
623
622
  * // animate to new position
624
623
  * const pos = vmath.vector3(100, 100, 0);
@@ -626,8 +625,11 @@ declare global {
626
625
  * // ...
627
626
  * // cancel animation of the x component.
628
627
  * gui.cancel_animations(node, "position.x");
629
- *
630
- * // Cancels all property animations on a node in a single call:
628
+ * ```
629
+ * @example
630
+ * Cancels all property animations on a node in a single call:
631
+ * ```ts
632
+ * const node = gui.get_node("my_node");
631
633
  * // animate to new position and scale
632
634
  * gui.animate(node, "position", vmath.vector3(100, 100, 0), gui.EASING_LINEAR, 5);
633
635
  * gui.animate(node, "scale", vmath.vector3(0.5), gui.EASING_LINEAR, 5);
@@ -636,7 +638,7 @@ declare global {
636
638
  * gui.cancel_animations(node);
637
639
  * ```
638
640
  */
639
- function cancel_animations(node: Opaque<"node">, property?: string | gui.Property): void;
641
+ function cancel_animations(node: Opaque<"node">, property?: string | Hash | gui.PROP): void;
640
642
  /**
641
643
  * Cancels any running flipbook animation on the specified node.
642
644
  *
@@ -666,7 +668,7 @@ declare global {
666
668
  * @param node - root node to clone
667
669
  * @returns a table mapping node ids to the corresponding cloned nodes
668
670
  */
669
- function clone_tree(node: Opaque<"node">): LuaMap<Hash, Opaque<"node">>;
671
+ function clone_tree(node: Opaque<"node">): LuaTable<Hash, Opaque<"node">>;
670
672
  /**
671
673
  * Deletes the specified node. Any child nodes of the specified node will be
672
674
  * recursively deleted.
@@ -707,7 +709,7 @@ declare global {
707
709
  * or release user input focus (see `release_input_focus`). There is no use in starting any animations or similar
708
710
  * from this function since the gui component is about to be destroyed.
709
711
  *
710
- * @param self - reference to the script state to be used for storing data
712
+ * @param self - script instance used for storing state
711
713
  * @example
712
714
  * ```ts
713
715
  * export default defineScript({
@@ -722,7 +724,7 @@ declare global {
722
724
  * });
723
725
  * ```
724
726
  */
725
- function final(self: Opaque<"userdata">): void;
727
+ function final(self: unknown): void;
726
728
  /**
727
729
  * Instead of using specific getters such as gui.get_position or gui.get_scale,
728
730
  * you can use gui.get instead and supply the property as a string or a hash.
@@ -730,29 +732,17 @@ declare global {
730
732
  * when operating in the gui namespace. Most notably, only these explicitly named properties are supported:
731
733
  *
732
734
  * - `"position"`
733
- *
734
735
  * - `"rotation"`
735
- *
736
736
  * - `"euler"`
737
- *
738
737
  * - `"scale"`
739
- *
740
738
  * - `"color"`
741
- *
742
739
  * - `"outline"`
743
- *
744
740
  * - `"shadow"`
745
- *
746
741
  * - `"size"`
747
- *
748
742
  * - `"fill_angle"` (pie)
749
- *
750
743
  * - `"inner_radius"` (pie)
751
- *
752
744
  * - `"leading"` (text)
753
- *
754
745
  * - `"tracking"` (text)
755
- *
756
746
  * - `"slice9"` (slice9)
757
747
  *
758
748
  * The value returned will either be a vmath.vector4 or a single number, i.e getting the "position"
@@ -762,7 +752,9 @@ declare global {
762
752
  * @param node - node to get the property for
763
753
  * @param property - the property to retrieve
764
754
  * @param options - optional options table (only applicable for material constants)
765
- * - `index` number zero-based index into array property; the transpiler emits Defold's 1-based index
755
+ * - `index` integer index into array property (1 based)
756
+ *
757
+ * **⚠️ `index` is 1-based; passed to Defold unchanged.**
766
758
  * @example
767
759
  * ```ts
768
760
  * // Get properties on existing nodes:
@@ -770,7 +762,7 @@ declare global {
770
762
  * const node_position = gui.get(node, "position");
771
763
  * ```
772
764
  */
773
- function get(node: Opaque<"node">, property: string | Hash | gui.Property, options?: { index?: number }): unknown;
765
+ function get(node: Opaque<"node">, property: string | Hash | gui.PROP, options?: { index?: number; key?: string | Hash; keys?: (Hash | string)[] }): unknown;
774
766
  /**
775
767
  * Returns the adjust mode of a node.
776
768
  * The adjust mode defines how the node will adjust itself to screen
@@ -778,14 +770,8 @@ declare global {
778
770
  *
779
771
  * @param node - node from which to get the adjust mode (node)
780
772
  * @returns the current adjust mode
781
- *
782
- * - `gui.ADJUST_FIT`
783
- *
784
- * - `gui.ADJUST_ZOOM`
785
- *
786
- * - `gui.ADJUST_STRETCH`
787
773
  */
788
- function get_adjust_mode(node: Opaque<"node">): gui.AdjustMode;
774
+ function get_adjust_mode(node: Opaque<"node">): gui.ADJUST;
789
775
  /**
790
776
  * gets the node alpha
791
777
  *
@@ -799,18 +785,8 @@ declare global {
799
785
  *
800
786
  * @param node - node from which to get the blend mode
801
787
  * @returns blend mode
802
- *
803
- * - `gui.BLEND_ALPHA`
804
- *
805
- * - `gui.BLEND_ADD`
806
- *
807
- * - `gui.BLEND_ADD_ALPHA`
808
- *
809
- * - `gui.BLEND_MULT`
810
- *
811
- * - `gui.BLEND_SCREEN`
812
788
  */
813
- function get_blend_mode(node: Opaque<"node">): gui.BlendMode;
789
+ function get_blend_mode(node: Opaque<"node">): gui.BLEND;
814
790
  /**
815
791
  * If node is set as an inverted clipping node, it will clip anything inside as opposed to outside.
816
792
  *
@@ -825,10 +801,9 @@ declare global {
825
801
  * @returns clipping mode
826
802
  *
827
803
  * - `gui.CLIPPING_MODE_NONE`
828
- *
829
804
  * - `gui.CLIPPING_MODE_STENCIL`
830
805
  */
831
- function get_clipping_mode(node: Opaque<"node">): gui.ClippingMode;
806
+ function get_clipping_mode(node: Opaque<"node">): gui.CLIPPING_MODE;
832
807
  /**
833
808
  * 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.
834
809
  *
@@ -948,7 +923,7 @@ declare global {
948
923
  * Higher index means the node is drawn on top of lower indexed nodes.
949
924
  *
950
925
  * @param node - the node to retrieve the id from
951
- * @returns the index of the node
926
+ * @returns the index of the node. **0️⃣ 0-based; passed to Defold unchanged.**
952
927
  * @example
953
928
  * ```ts
954
929
  * // Compare the index order of two sibling nodes:
@@ -991,6 +966,15 @@ declare global {
991
966
  * @returns layout id
992
967
  */
993
968
  function get_layout(): Hash;
969
+ /**
970
+ * Returns the sprites and links found in the text node's current layout.
971
+ * Each object's `x` and `y` identify its lower-left corner relative to the
972
+ * text node's upper-left layout origin.
973
+ *
974
+ * @param node - text node to inspect
975
+ * @returns layout objects in source order. **0️⃣ `text_offset` is 0-based; passed to Defold unchanged.**
976
+ */
977
+ function get_layout_objects(node: Opaque<"node">): gui.layout_object[];
994
978
  /**
995
979
  * Returns a table mapping each layout id hash to a vector3(width, height, 0). For the default layout,
996
980
  * the current scene resolution is returned. If a layout name is not present in the Display Profiles (or when
@@ -998,7 +982,7 @@ declare global {
998
982
  *
999
983
  * @returns layout_id_hash -> vmath.vector3(width, height, 0)
1000
984
  */
1001
- function get_layouts(): LuaMap<Hash, Vector3>;
985
+ function get_layouts(): LuaTable<Hash, Vector3>;
1002
986
  /**
1003
987
  * Returns the leading value for a text node.
1004
988
  *
@@ -1048,13 +1032,9 @@ declare global {
1048
1032
  * Returns the outer bounds mode for a pie node.
1049
1033
  *
1050
1034
  * @param node - node from where to get the outer bounds mode
1051
- * @returns the outer bounds mode of the pie node:
1052
- *
1053
- * - `gui.PIEBOUNDS_RECTANGLE`
1054
- *
1055
- * - `gui.PIEBOUNDS_ELLIPSE`
1035
+ * @returns the outer bounds mode of the pie node
1056
1036
  */
1057
- function get_outer_bounds(node: Opaque<"node">): gui.PieBounds;
1037
+ function get_outer_bounds(node: Opaque<"node">): gui.PIEBOUNDS;
1058
1038
  /**
1059
1039
  * Returns the outline color of the supplied node.
1060
1040
  * See gui.get_color for info how vectors encode color values.
@@ -1093,24 +1073,16 @@ declare global {
1093
1073
  * @returns pivot constant
1094
1074
  *
1095
1075
  * - `gui.PIVOT_CENTER`
1096
- *
1097
1076
  * - `gui.PIVOT_N`
1098
- *
1099
1077
  * - `gui.PIVOT_NE`
1100
- *
1101
1078
  * - `gui.PIVOT_E`
1102
- *
1103
1079
  * - `gui.PIVOT_SE`
1104
- *
1105
1080
  * - `gui.PIVOT_S`
1106
- *
1107
1081
  * - `gui.PIVOT_SW`
1108
- *
1109
1082
  * - `gui.PIVOT_W`
1110
- *
1111
1083
  * - `gui.PIVOT_NW`
1112
1084
  */
1113
- function get_pivot(node: Opaque<"node">): gui.Pivot;
1085
+ function get_pivot(node: Opaque<"node">): gui.PIVOT;
1114
1086
  /**
1115
1087
  * Returns the position of the supplied node.
1116
1088
  *
@@ -1167,12 +1139,8 @@ declare global {
1167
1139
  *
1168
1140
  * @param node - node from which to get the size mode (node)
1169
1141
  * @returns the current size mode
1170
- *
1171
- * - `gui.SIZE_MODE_MANUAL`
1172
- *
1173
- * - `gui.SIZE_MODE_AUTO`
1174
1142
  */
1175
- function get_size_mode(node: Opaque<"node">): gui.SizeMode;
1143
+ function get_size_mode(node: Opaque<"node">): gui.SIZE_MODE;
1176
1144
  /**
1177
1145
  * Returns the slice9 configuration values for the node.
1178
1146
  *
@@ -1209,13 +1177,13 @@ declare global {
1209
1177
  * @param node - root node to get node tree from
1210
1178
  * @returns a table mapping node ids to the corresponding nodes
1211
1179
  */
1212
- function get_tree(node: Opaque<"node">): LuaMap<Hash, Opaque<"node">>;
1180
+ function get_tree(node: Opaque<"node">): LuaTable<Hash, Opaque<"node">>;
1213
1181
  /**
1214
1182
  * gets the node type
1215
1183
  *
1216
1184
  * @param node - node from which to get the type
1217
1185
  */
1218
- function get_type(node: Opaque<"node">): LuaMultiReturn<[gui.NodeType, number | undefined]>;
1186
+ function get_type(node: Opaque<"node">): LuaMultiReturn<[gui.TYPE, number | undefined]>;
1219
1187
  /**
1220
1188
  * Returns `true` if a node is visible and `false` if it's not.
1221
1189
  * Invisible nodes are not rendered.
@@ -1237,12 +1205,10 @@ declare global {
1237
1205
  * @returns anchor constant
1238
1206
  *
1239
1207
  * - `gui.ANCHOR_NONE`
1240
- *
1241
1208
  * - `gui.ANCHOR_LEFT`
1242
- *
1243
1209
  * - `gui.ANCHOR_RIGHT`
1244
1210
  */
1245
- function get_xanchor(node: Opaque<"node">): gui.XAnchor;
1211
+ function get_xanchor(node: Opaque<"node">): gui.ANCHOR;
1246
1212
  /**
1247
1213
  * The y-anchor specifies how the node is moved when the game is run in a different resolution.
1248
1214
  *
@@ -1250,12 +1216,10 @@ declare global {
1250
1216
  * @returns anchor constant
1251
1217
  *
1252
1218
  * - `gui.ANCHOR_NONE`
1253
- *
1254
1219
  * - `gui.ANCHOR_TOP`
1255
- *
1256
1220
  * - `gui.ANCHOR_BOTTOM`
1257
1221
  */
1258
- function get_yanchor(node: Opaque<"node">): gui.YAnchor;
1222
+ function get_yanchor(node: Opaque<"node">): gui.ANCHOR;
1259
1223
  /**
1260
1224
  * Hides the on-display touch keyboard on the device.
1261
1225
  */
@@ -1264,7 +1228,7 @@ declare global {
1264
1228
  * This is a callback-function, which is called by the engine when a gui component is initialized. It can be used
1265
1229
  * to set the initial state of the script and gui scene.
1266
1230
  *
1267
- * @param self - reference to the script state to be used for storing data
1231
+ * @param self - script instance used for storing state
1268
1232
  * @example
1269
1233
  * ```ts
1270
1234
  * export default defineScript({
@@ -1275,7 +1239,7 @@ declare global {
1275
1239
  * });
1276
1240
  * ```
1277
1241
  */
1278
- function init(self: Opaque<"userdata">): void;
1242
+ function init(self: unknown): void;
1279
1243
  /**
1280
1244
  * Returns `true` if a node is enabled and `false` if it's not.
1281
1245
  * Disabled nodes are not rendered and animations acting on them are not evaluated.
@@ -1293,7 +1257,7 @@ declare global {
1293
1257
  * @param node - to move
1294
1258
  * @param reference - reference node above which the first node should be moved
1295
1259
  */
1296
- function move_above(node: Opaque<"node">, reference?: Opaque<"node">): void;
1260
+ function move_above(node: Opaque<"node">, reference: Opaque<"node"> | undefined): void;
1297
1261
  /**
1298
1262
  * Alters the ordering of the two supplied nodes by moving the first node
1299
1263
  * below the second.
@@ -1302,7 +1266,7 @@ declare global {
1302
1266
  * @param node - to move
1303
1267
  * @param reference - reference node below which the first node should be moved
1304
1268
  */
1305
- function move_below(node: Opaque<"node">, reference?: Opaque<"node">): void;
1269
+ function move_below(node: Opaque<"node">, reference: Opaque<"node"> | undefined): void;
1306
1270
  /**
1307
1271
  * Dynamically create a new box node.
1308
1272
  *
@@ -1343,18 +1307,15 @@ declare global {
1343
1307
  * @param height - texture height
1344
1308
  * @param type - texture type
1345
1309
  *
1346
- * - `"rgb"` - RGB
1347
- *
1348
- * - `"rgba"` - RGBA
1349
- *
1350
- * - `"l"` - LUMINANCE
1351
- *
1310
+ * - `"rgb"` or `image.TYPE_RGB` - RGB
1311
+ * - `"rgba"` or `image.TYPE_RGBA` - RGBA
1312
+ * - `"l"` or `image.TYPE_LUMINANCE` - LUMINANCE
1352
1313
  * - `"astc"` - ASTC compressed format
1353
1314
  * @param buffer - texture data
1354
1315
  * @param flip - flip texture vertically
1355
1316
  * @example
1317
+ * How to create a texture and apply it to a new box node:
1356
1318
  * ```ts
1357
- * // How to create a texture and apply it to a new box node:
1358
1319
  * export default defineGuiScript({
1359
1320
  * init(self) {
1360
1321
  * const w = 200;
@@ -1379,8 +1340,10 @@ declare global {
1379
1340
  * }
1380
1341
  * },
1381
1342
  * });
1382
- *
1383
- * // How to create a texture using .astc format
1343
+ * ```
1344
+ * @example
1345
+ * How to create a texture using .astc format
1346
+ * ```ts
1384
1347
  * const size = 4;
1385
1348
  * const pos = vmath.vector3(200, 200, 0);
1386
1349
  * const path = "/assets/images/logo_4x4.astc";
@@ -1394,7 +1357,7 @@ declare global {
1394
1357
  * }
1395
1358
  * ```
1396
1359
  */
1397
- function new_texture(texture_id: string | Hash, width: number, height: number, type: string | Opaque<"constant">, buffer: string, flip?: boolean): LuaMultiReturn<[boolean, number]>;
1360
+ function new_texture(texture_id: string | Hash, width: number, height: number, type: string | image.TYPE, buffer: string, flip?: boolean): LuaMultiReturn<[boolean, gui.RESULT | undefined]>;
1398
1361
  /**
1399
1362
  * This is a callback-function, which is called by the engine when user input is sent to the instance of the gui component.
1400
1363
  * It can be used to take action on the input, e.g. modify the gui according to the input.
@@ -1406,132 +1369,10 @@ declare global {
1406
1369
  * to signal that it wants input to be consumed.
1407
1370
  * See the documentation of acquire_input_focus for more
1408
1371
  * information.
1409
- * The `action` parameter is a table containing data about the input mapped to the
1410
- * `action_id`.
1411
- * For mapped actions it specifies the value of the input and if it was just pressed or released.
1412
- * Actions are mapped to input in an input_binding-file.
1413
- * Mouse movement is specifically handled and uses `nil` as its `action_id`.
1414
- * The `action` only contains positional parameters in this case, such as x and y of the pointer.
1415
- * Here is a brief description of the available table fields:
1416
- *
1417
- * Field
1418
- * Description
1419
- *
1420
- * `value`
1421
- * 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.
1422
- *
1423
- * `pressed`
1424
- * If the input was pressed this frame. This is not present for mouse movement and text input.
1425
- *
1426
- * `released`
1427
- * If the input was released this frame. This is not present for mouse movement and text input.
1428
- *
1429
- * `repeated`
1430
- * 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.
1431
- *
1432
- * `x`
1433
- * The x value of a pointer device, if present. This is not present for gamepad, key and text input.
1434
- *
1435
- * `y`
1436
- * The y value of a pointer device, if present. This is not present for gamepad, key and text input.
1437
- *
1438
- * `screen_x`
1439
- * The screen space x value of a pointer device, if present. This is not present for gamepad, key and text input.
1440
- *
1441
- * `screen_y`
1442
- * The screen space y value of a pointer device, if present. This is not present for gamepad, key and text input.
1443
- *
1444
- * `dx`
1445
- * The change in x value of a pointer device, if present. This is not present for gamepad, key and text input.
1446
- *
1447
- * `dy`
1448
- * The change in y value of a pointer device, if present. This is not present for gamepad, key and text input.
1449
- *
1450
- * `screen_dx`
1451
- * The change in screen space x value of a pointer device, if present. This is not present for gamepad, key and text input.
1452
- *
1453
- * `screen_dy`
1454
- * The change in screen space y value of a pointer device, if present. This is not present for gamepad, key and text input.
1455
- *
1456
- * `gamepad`
1457
- * The index of the gamepad device that provided the input. See table below about gamepad input.
1458
- *
1459
- * `touch`
1460
- * List of touch input, one element per finger, if present. See table below about touch input
1461
- *
1462
- * `text`
1463
- * Text input from a (virtual) keyboard or similar.
1464
- *
1465
- * `marked_text`
1466
- * Sequence of entered symbols while entering a symbol combination, for example Japanese Kana.
1467
- *
1468
- * Gamepad specific fields:
1469
- *
1470
- * Field
1471
- * Description
1472
- *
1473
- * `gamepad`
1474
- * The index of the gamepad device that provided the input.
1475
- *
1476
- * `userid`
1477
- * Id of the user associated with the controller. Usually only relevant on consoles.
1478
- *
1479
- * `gamepad_unknown`
1480
- * True if the inout originated from an unknown/unmapped gamepad.
1481
1372
  *
1482
- * `gamepad_name`
1483
- * Name of the gamepad
1484
- *
1485
- * `gamepad_axis`
1486
- * List of gamepad axis values. For raw gamepad input only.
1487
- *
1488
- * `gamepadhats`
1489
- * List of gamepad hat values. For raw gamepad input only.
1490
- *
1491
- * `gamepad_buttons`
1492
- * List of gamepad button values. For raw gamepad input only.
1493
- *
1494
- * Touch input table:
1495
- *
1496
- * Field
1497
- * Description
1498
- *
1499
- * `id`
1500
- * A number identifying the touch input during its duration.
1501
- *
1502
- * `pressed`
1503
- * True if the finger was pressed this frame.
1504
- *
1505
- * `released`
1506
- * True if the finger was released this frame.
1507
- *
1508
- * `tap_count`
1509
- * Number of taps, one for single, two for double-tap, etc
1510
- *
1511
- * `x`
1512
- * The x touch location.
1513
- *
1514
- * `y`
1515
- * The y touch location.
1516
- *
1517
- * `dx`
1518
- * The change in x value.
1519
- *
1520
- * `dy`
1521
- * The change in y value.
1522
- *
1523
- * `acc_x`
1524
- * Accelerometer x value (if present).
1525
- *
1526
- * `acc_y`
1527
- * Accelerometer y value (if present).
1528
- *
1529
- * `acc_z`
1530
- * Accelerometer z value (if present).
1531
- *
1532
- * @param self - reference to the script state to be used for storing data
1533
- * @param action_id - id of the received input action, as mapped in the input_binding-file
1534
- * @param action - a table containing the input data, see above for a description
1373
+ * @param self - script instance used for storing state
1374
+ * @param action_id - id of the received input action, as mapped in the input_binding-file, or `nil` for mouse movement
1375
+ * @param action - input data for the action. **0️⃣ `gamepad` is 0-based; passed to Defold unchanged.**
1535
1376
  * @returns optional boolean to signal if the input should be consumed (not passed on to others) or not, default is false
1536
1377
  * @example
1537
1378
  * ```ts
@@ -1552,7 +1393,7 @@ declare global {
1552
1393
  * });
1553
1394
  * ```
1554
1395
  */
1555
- 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;
1396
+ function on_input(self: unknown, action_id: Hash | undefined, action: go.on_input.action): boolean | undefined;
1556
1397
  /**
1557
1398
  * This is a callback-function, which is called by the engine whenever a message has been sent to the gui component.
1558
1399
  * 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.
@@ -1560,16 +1401,17 @@ declare global {
1560
1401
  * documentation of the message specifies which data is supplied.
1561
1402
  * See the update function for examples on how to use this callback-function.
1562
1403
  *
1563
- * @param self - reference to the script state to be used for storing data
1404
+ * @param self - script instance used for storing state
1564
1405
  * @param message_id - id of the received message
1565
1406
  * @param message - a table containing the message data
1407
+ * @param sender - address of the sender
1566
1408
  */
1567
- function on_message(self: Opaque<"userdata">, message_id: Hash, message: Record<string | number, unknown>): void;
1409
+ function on_message(self: unknown, message_id: Hash, message: LuaMap<AnyNotNil, unknown> | Record<string, unknown>, sender: Url): void;
1568
1410
  /**
1569
1411
  * This is a callback-function, which is called by the engine when the gui script is reloaded, e.g. from the editor.
1570
1412
  * It can be used for live development, e.g. to tweak constants or set up the state properly for the script.
1571
1413
  *
1572
- * @param self - reference to the script state to be used for storing data
1414
+ * @param self - script instance used for storing state
1573
1415
  * @example
1574
1416
  * ```ts
1575
1417
  * export default defineGuiScript({
@@ -1584,7 +1426,7 @@ declare global {
1584
1426
  * });
1585
1427
  * ```
1586
1428
  */
1587
- function on_reload(self: Opaque<"userdata">): void;
1429
+ function on_reload(self: unknown): void;
1588
1430
  /**
1589
1431
  * Tests whether a coordinate is within the bounding box of a
1590
1432
  * node.
@@ -1606,20 +1448,15 @@ declare global {
1606
1448
  *
1607
1449
  * `self`
1608
1450
  *
1609
- * object The current object.
1451
+ * script_instance The current script instance.
1610
1452
  *
1611
1453
  * `node`
1612
1454
  *
1613
1455
  * node The node that is animated.
1614
- * @param play_properties - optional table with properties
1615
- *
1616
- * `offset`
1617
- * number The normalized initial value of the animation cursor when the animation starts playing
1618
- * `playback_rate`
1619
- * number The rate with which the animation will be played. Must be positive
1456
+ * @param play_properties - optional playback properties
1620
1457
  * @example
1458
+ * Set the texture of a node to a flipbook animation from an atlas:
1621
1459
  * ```ts
1622
- * // Set the texture of a node to a flipbook animation from an atlas:
1623
1460
  * function anim_callback(self: unknown, node: unknown) {
1624
1461
  * // Take action after animation has played.
1625
1462
  * }
@@ -1632,37 +1469,22 @@ declare global {
1632
1469
  * gui.play_flipbook(node, "animated_button");
1633
1470
  * },
1634
1471
  * });
1635
- *
1636
- * // Set the texture of a node to an image from an atlas:
1472
+ * ```
1473
+ * @example
1474
+ * Set the texture of a node to an image from an atlas:
1475
+ * ```ts
1637
1476
  * // Create a new node and set the texture to a "button.png" from atlas
1638
1477
  * const node = gui.get_node("button_node");
1639
1478
  * gui.set_texture(node, "gui_sprites");
1640
1479
  * gui.play_flipbook(node, "button");
1641
1480
  * ```
1642
1481
  */
1643
- function play_flipbook(node: Opaque<"node">, animation: string | Hash, complete_function?: (self: unknown, node: unknown) => void, play_properties?: { offset?: number; playback_rate?: number }): void;
1482
+ function play_flipbook(node: Opaque<"node">, animation: string | Hash, complete_function?: (self: unknown, node: Opaque<"node">) => void, play_properties?: gui.play_properties): void;
1644
1483
  /**
1645
1484
  * Plays the paricle fx for a gui node
1646
1485
  *
1647
1486
  * @param node - node to play particle fx for
1648
1487
  * @param emitter_state_function - optional callback function that will be called when an emitter attached to this particlefx changes state.
1649
- *
1650
- * `self`
1651
- * object The current object
1652
- * `node`
1653
- * hash The particle fx node, or `nil` if the node was deleted
1654
- * `emitter`
1655
- * hash The id of the emitter
1656
- * `state`
1657
- * constant the new state of the emitter:
1658
- *
1659
- * - `particlefx.EMITTER_STATE_SLEEPING`
1660
- *
1661
- * - `particlefx.EMITTER_STATE_PRESPAWN`
1662
- *
1663
- * - `particlefx.EMITTER_STATE_SPAWNING`
1664
- *
1665
- * - `particlefx.EMITTER_STATE_POSTSPAWN`
1666
1488
  * @example
1667
1489
  * ```ts
1668
1490
  * // How to play a particle fx when a gui node is created.
@@ -1681,7 +1503,7 @@ declare global {
1681
1503
  * });
1682
1504
  * ```
1683
1505
  */
1684
- function play_particlefx(node: Opaque<"node">, emitter_state_function?: (self: unknown, node: unknown, emitter: unknown, state: unknown) => void): void;
1506
+ function play_particlefx(node: Opaque<"node">, emitter_state_function?: (self: unknown, node: Opaque<"node"> | undefined, emitter: Hash, state: particlefx.EMITTER_STATE) => void): void;
1685
1507
  /**
1686
1508
  * Resets the input context of keyboard. This will clear marked text.
1687
1509
  */
@@ -1736,7 +1558,7 @@ declare global {
1736
1558
  * });
1737
1559
  * ```
1738
1560
  */
1739
- function screen_to_local(node: Opaque<"node">, screen_position: Vector3): Vector3;
1561
+ function screen_to_local(node: Opaque<"node">, screen_position: Vector3 | Vector4): Vector3;
1740
1562
  /**
1741
1563
  * Instead of using specific setteres such as gui.set_position or gui.set_scale,
1742
1564
  * you can use gui.set instead and supply the property as a string or a hash.
@@ -1744,29 +1566,17 @@ declare global {
1744
1566
  * when operating in the gui namespace. Most notably, only these named properties identifiers are supported:
1745
1567
  *
1746
1568
  * - `"position"`
1747
- *
1748
1569
  * - `"rotation"`
1749
- *
1750
1570
  * - `"euler"`
1751
- *
1752
1571
  * - `"scale"`
1753
- *
1754
1572
  * - `"color"`
1755
- *
1756
1573
  * - `"outline"`
1757
- *
1758
1574
  * - `"shadow"`
1759
- *
1760
1575
  * - `"size"`
1761
- *
1762
1576
  * - `"fill_angle"` (pie)
1763
- *
1764
1577
  * - `"inner_radius"` (pie)
1765
- *
1766
1578
  * - `"leading"` (text)
1767
- *
1768
1579
  * - `"tracking"` (text)
1769
- *
1770
1580
  * - `"slice9"` (slice9)
1771
1581
  *
1772
1582
  * 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.
@@ -1783,17 +1593,18 @@ declare global {
1783
1593
  * @param node - node to set the property for, or msg.url() to the gui itself
1784
1594
  * @param property - the property to set
1785
1595
  * @param value - the property to set. `nil` is only supported for removing runtime texture mappings with `gui.set(msg.url(), "textures", nil, {key = ...})`.
1786
- * @param options - optional options table (only applicable for material constants)
1787
- * - `index` number zero-based index into array property; the transpiler emits Defold's 1-based index
1788
- * - `key` hash name of internal property
1596
+ * @param options - optional material-constant options. **⚠️ `index` is 1-based; passed to Defold unchanged.**
1789
1597
  * @example
1598
+ * Updates the position property on an existing node:
1790
1599
  * ```ts
1791
- * // Updates the position property on an existing node:
1792
1600
  * const node = gui.get_node("my_box_node");
1793
1601
  * const node_position = gui.get(node, "position") as Vector3;
1794
1602
  * gui.set(node, "position.x", node_position.x + 128);
1795
- *
1796
- * // Updates the rotation property on an existing node:
1603
+ * ```
1604
+ * @example
1605
+ * Updates the rotation property on an existing node:
1606
+ * ```ts
1607
+ * const node = gui.get_node("my_box_node");
1797
1608
  * gui.set(node, "rotation", vmath.quat_rotation_z(math.rad(45)));
1798
1609
  * // this is equivalent to:
1799
1610
  * gui.set(node, "euler.z", 45);
@@ -1801,23 +1612,28 @@ declare global {
1801
1612
  * gui.set(node, "euler", vmath.vector3(0, 0, 45));
1802
1613
  * // or using the set_rotation
1803
1614
  * gui.set_rotation(node, vmath.vector3(0, 0, 45));
1804
- *
1805
- * // Sets various material constants for a node:
1615
+ * ```
1616
+ * @example
1617
+ * Sets various material constants for a node:
1618
+ * ```ts
1619
+ * const node = gui.get_node("my_box_node");
1806
1620
  * gui.set(node, "tint", vmath.vector4(1, 0, 0, 1));
1807
1621
  * // matrix4 is also supported
1808
1622
  * gui.set(node, "light_matrix", vmath.matrix4());
1809
1623
  * // update a constant in an array at position 4. the array is specified in the shader as:
1810
- * // uniform vec4 tint_array[4]; // TypeScript and the shader are both 0 based
1811
- * gui.set(node, "tint_array", vmath.vector4(1, 0, 0, 1), { index: 3 });
1624
+ * // uniform vec4 tint_array[4]; // lua is 1 based, shader is 0 based
1625
+ * gui.set(node, "tint_array", vmath.vector4(1, 0, 0, 1), { index: 4 });
1812
1626
  * // update a matrix constant in an array at position 4. the array is specified in the shader as:
1813
1627
  * // uniform mat4 light_matrix_array[4];
1814
- * gui.set(node, "light_matrix_array", vmath.matrix4(), { index: 3 });
1628
+ * gui.set(node, "light_matrix_array", vmath.matrix4(), { index: 4 });
1815
1629
  * // update a sub-element in a constant
1816
1630
  * gui.set(node, "tint.x", 1);
1817
1631
  * // update a sub-element in an array constant at position 4
1818
- * gui.set(node, "tint_array.x", 1, { index: 3 });
1819
- *
1820
- * // Set a named property
1632
+ * gui.set(node, "tint_array.x", 1, { index: 4 });
1633
+ * ```
1634
+ * @example
1635
+ * Set a named property
1636
+ * ```ts
1821
1637
  * export default defineGuiScript({
1822
1638
  * on_message(self, message_id, message) {
1823
1639
  * if (message_id === hash("set_font") && types.is_hash(message.font)) {
@@ -1830,9 +1646,15 @@ declare global {
1830
1646
  * }
1831
1647
  * },
1832
1648
  * });
1833
- *
1834
- * // Remove a named runtime texture resource mapping:
1835
- * const atlas_params = { texture: "/runtime.texturec", animations: [], geometries: [] };
1649
+ * ```
1650
+ * @example
1651
+ * Remove a named runtime texture resource mapping:
1652
+ * ```ts
1653
+ * const atlas_params = {
1654
+ * texture: "/runtime.texturec",
1655
+ * animations: [{ id: "runtime", width: 1, height: 1, frames: [1] }],
1656
+ * 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] }],
1657
+ * } satisfies Parameters<typeof resource.create_atlas>[1];
1836
1658
  * const atlas_id = resource.create_atlas("/runtime.texturesetc", atlas_params);
1837
1659
  * gui.set(msg.url(), "textures", atlas_id, { key: "runtime_texture" });
1838
1660
  * gui.set_texture(gui.get_node("box"), "runtime_texture");
@@ -1842,7 +1664,7 @@ declare global {
1842
1664
  * resource.release(atlas_id);
1843
1665
  * ```
1844
1666
  */
1845
- function set(node: Opaque<"node"> | Url, property: string | Hash | gui.Property, value?: number | Vector4 | Vector3 | Quaternion | Matrix4 | Hash, options?: { index?: number; key?: string | Hash }): void;
1667
+ function set(node: Opaque<"node"> | Url, property: string | Hash | gui.PROP, value: number | Vector4 | Vector3 | Quaternion | Matrix4 | Hash | undefined, options?: { index?: number; key?: string | Hash; keys?: (Hash | string)[] }): void;
1846
1668
  /**
1847
1669
  * Sets the adjust mode on a node.
1848
1670
  * The adjust mode defines how the node will adjust itself to screen
@@ -1850,14 +1672,8 @@ declare global {
1850
1672
  *
1851
1673
  * @param node - node to set adjust mode for
1852
1674
  * @param adjust_mode - adjust mode to set
1853
- *
1854
- * - `gui.ADJUST_FIT`
1855
- *
1856
- * - `gui.ADJUST_ZOOM`
1857
- *
1858
- * - `gui.ADJUST_STRETCH`
1859
1675
  */
1860
- function set_adjust_mode(node: Opaque<"node">, adjust_mode: gui.AdjustMode): void;
1676
+ function set_adjust_mode(node: Opaque<"node">, adjust_mode: gui.ADJUST): void;
1861
1677
  /**
1862
1678
  * sets the node alpha
1863
1679
  *
@@ -1871,18 +1687,8 @@ declare global {
1871
1687
  *
1872
1688
  * @param node - node to set blend mode for
1873
1689
  * @param blend_mode - blend mode to set
1874
- *
1875
- * - `gui.BLEND_ALPHA`
1876
- *
1877
- * - `gui.BLEND_ADD`
1878
- *
1879
- * - `gui.BLEND_ADD_ALPHA`
1880
- *
1881
- * - `gui.BLEND_MULT`
1882
- *
1883
- * - `gui.BLEND_SCREEN`
1884
1690
  */
1885
- function set_blend_mode(node: Opaque<"node">, blend_mode: gui.BlendMode): void;
1691
+ function set_blend_mode(node: Opaque<"node">, blend_mode: gui.BLEND): void;
1886
1692
  /**
1887
1693
  * If node is set as an inverted clipping node, it will clip anything inside as opposed to outside.
1888
1694
  *
@@ -1897,10 +1703,9 @@ declare global {
1897
1703
  * @param clipping_mode - clipping mode to set
1898
1704
  *
1899
1705
  * - `gui.CLIPPING_MODE_NONE`
1900
- *
1901
1706
  * - `gui.CLIPPING_MODE_STENCIL`
1902
1707
  */
1903
- function set_clipping_mode(node: Opaque<"node">, clipping_mode: gui.ClippingMode): void;
1708
+ function set_clipping_mode(node: Opaque<"node">, clipping_mode: gui.CLIPPING_MODE): void;
1904
1709
  /**
1905
1710
  * 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.
1906
1711
  *
@@ -2062,13 +1867,9 @@ declare global {
2062
1867
  * Sets the outer bounds mode for a pie node.
2063
1868
  *
2064
1869
  * @param node - node for which to set the outer bounds mode
2065
- * @param bounds_mode - the outer bounds mode of the pie node:
2066
- *
2067
- * - `gui.PIEBOUNDS_RECTANGLE`
2068
- *
2069
- * - `gui.PIEBOUNDS_ELLIPSE`
1870
+ * @param bounds_mode - the outer bounds mode of the pie node
2070
1871
  */
2071
- function set_outer_bounds(node: Opaque<"node">, bounds_mode: gui.PieBounds): void;
1872
+ function set_outer_bounds(node: Opaque<"node">, bounds_mode: gui.PIEBOUNDS): void;
2072
1873
  /**
2073
1874
  * Sets the outline color of the supplied node.
2074
1875
  * See gui.set_color for info how vectors encode color values.
@@ -2084,7 +1885,7 @@ declare global {
2084
1885
  * @param parent - parent node to set, pass `nil` to remove parent
2085
1886
  * @param keep_scene_transform - optional flag to make the scene position being perserved
2086
1887
  */
2087
- function set_parent(node: Opaque<"node">, parent?: Opaque<"node">, keep_scene_transform?: boolean): void;
1888
+ function set_parent(node: Opaque<"node">, parent: Opaque<"node"> | undefined, keep_scene_transform?: boolean): void;
2088
1889
  /**
2089
1890
  * Set the paricle fx for a gui node
2090
1891
  *
@@ -2106,24 +1907,16 @@ declare global {
2106
1907
  * @param pivot - pivot constant
2107
1908
  *
2108
1909
  * - `gui.PIVOT_CENTER`
2109
- *
2110
1910
  * - `gui.PIVOT_N`
2111
- *
2112
1911
  * - `gui.PIVOT_NE`
2113
- *
2114
1912
  * - `gui.PIVOT_E`
2115
- *
2116
1913
  * - `gui.PIVOT_SE`
2117
- *
2118
1914
  * - `gui.PIVOT_S`
2119
- *
2120
1915
  * - `gui.PIVOT_SW`
2121
- *
2122
1916
  * - `gui.PIVOT_W`
2123
- *
2124
1917
  * - `gui.PIVOT_NW`
2125
1918
  */
2126
- function set_pivot(node: Opaque<"node">, pivot: gui.Pivot): void;
1919
+ function set_pivot(node: Opaque<"node">, pivot: gui.PIVOT): void;
2127
1920
  /**
2128
1921
  * Sets the position of the supplied node.
2129
1922
  *
@@ -2153,16 +1946,8 @@ declare global {
2153
1946
  * Sets how the safe area is applied to this gui scene.
2154
1947
  *
2155
1948
  * @param mode - safe area mode
2156
- *
2157
- * - `gui.SAFE_AREA_NONE`
2158
- *
2159
- * - `gui.SAFE_AREA_LONG`
2160
- *
2161
- * - `gui.SAFE_AREA_SHORT`
2162
- *
2163
- * - `gui.SAFE_AREA_BOTH`
2164
1949
  */
2165
- function set_safe_area_mode(mode: gui.SafeAreaMode): void;
1950
+ function set_safe_area_mode(mode: gui.SAFE_AREA): void;
2166
1951
  /**
2167
1952
  * Sets the scaling of the supplied node.
2168
1953
  *
@@ -2176,7 +1961,7 @@ declare global {
2176
1961
  * @param node - node to set the screen position to
2177
1962
  * @param screen_position - screen position
2178
1963
  */
2179
- function set_screen_position(node: Opaque<"node">, screen_position: Vector3): void;
1964
+ function set_screen_position(node: Opaque<"node">, screen_position: Vector3 | Vector4): void;
2180
1965
  /**
2181
1966
  * Sets the shadow color of the supplied node.
2182
1967
  * See gui.set_color for info how vectors encode color values.
@@ -2203,12 +1988,8 @@ declare global {
2203
1988
  *
2204
1989
  * @param node - node to set size mode for
2205
1990
  * @param size_mode - size mode to set
2206
- *
2207
- * - `gui.SIZE_MODE_MANUAL`
2208
- *
2209
- * - `gui.SIZE_MODE_AUTO`
2210
1991
  */
2211
- function set_size_mode(node: Opaque<"node">, size_mode: gui.SizeMode): void;
1992
+ function set_size_mode(node: Opaque<"node">, size_mode: gui.SIZE_MODE): void;
2212
1993
  /**
2213
1994
  * Set the slice9 configuration values for the node.
2214
1995
  *
@@ -2234,20 +2015,25 @@ declare global {
2234
2015
  * @param node - node to set texture for
2235
2016
  * @param texture - texture id
2236
2017
  * @example
2018
+ * To set a texture (or animation) from an atlas:
2237
2019
  * ```ts
2238
- * // To set a texture (or animation) from an atlas:
2239
2020
  * const node = gui.get_node("box_node");
2240
2021
  * gui.set_texture(node, "my_atlas");
2241
2022
  * gui.play_flipbook(node, "image");
2242
- *
2243
- * // Set a dynamically created texture to a node. Note that there is only
2244
- * // one texture image in this case so gui.set_texture() is sufficient.
2023
+ * ```
2024
+ * @example
2025
+ * Set a dynamically created texture to a node. Note that there is only
2026
+ * one texture image in this case so `gui.set_texture()` is
2027
+ * sufficient.
2028
+ * ```ts
2245
2029
  * const w = 200;
2246
2030
  * const h = 300;
2247
2031
  * // A nice orange. String with the RGB values.
2248
2032
  * const orange = String.fromCharCode(0xff, 0x80, 0x10);
2249
2033
  * // Create the texture. Repeat the color string for each pixel.
2250
- * if (gui.new_texture("orange_tx", w, h, "rgb", orange.repeat(w * h))) {
2034
+ * const [ok] = gui.new_texture("orange_tx", w, h, "rgb", orange.repeat(w * h));
2035
+ * if (ok) {
2036
+ * const node = gui.get_node("box_node");
2251
2037
  * gui.set_texture(node, "orange_tx");
2252
2038
  * }
2253
2039
  * ```
@@ -2261,12 +2047,9 @@ declare global {
2261
2047
  * @param height - texture height
2262
2048
  * @param type - texture type
2263
2049
  *
2264
- * - `"rgb"` - RGB
2265
- *
2266
- * - `"rgba"` - RGBA
2267
- *
2268
- * - `"l"` - LUMINANCE
2269
- *
2050
+ * - `"rgb"` or `image.TYPE_RGB` - RGB
2051
+ * - `"rgba"` or `image.TYPE_RGBA` - RGBA
2052
+ * - `"l"` or `image.TYPE_LUMINANCE` - LUMINANCE
2270
2053
  * - `"astc"` - ASTC compressed format
2271
2054
  * @param buffer - texture data
2272
2055
  * @param flip - flip texture vertically
@@ -2300,7 +2083,7 @@ declare global {
2300
2083
  * });
2301
2084
  * ```
2302
2085
  */
2303
- function set_texture_data(texture: string | Hash, width: number, height: number, type: string | Opaque<"constant">, buffer: string, flip?: boolean): boolean;
2086
+ function set_texture_data(texture: string | Hash, width: number, height: number, type: string | image.TYPE, buffer: string, flip?: boolean): boolean;
2304
2087
  /**
2305
2088
  * Sets the tracking value of a text node. This value is used to
2306
2089
  * adjust the vertical spacing of characters in the text.
@@ -2323,12 +2106,10 @@ declare global {
2323
2106
  * @param anchor - anchor constant
2324
2107
  *
2325
2108
  * - `gui.ANCHOR_NONE`
2326
- *
2327
2109
  * - `gui.ANCHOR_LEFT`
2328
- *
2329
2110
  * - `gui.ANCHOR_RIGHT`
2330
2111
  */
2331
- function set_xanchor(node: Opaque<"node">, anchor: gui.XAnchor): void;
2112
+ function set_xanchor(node: Opaque<"node">, anchor: gui.ANCHOR): void;
2332
2113
  /**
2333
2114
  * The y-anchor specifies how the node is moved when the game is run in a different resolution.
2334
2115
  *
@@ -2336,12 +2117,10 @@ declare global {
2336
2117
  * @param anchor - anchor constant
2337
2118
  *
2338
2119
  * - `gui.ANCHOR_NONE`
2339
- *
2340
2120
  * - `gui.ANCHOR_TOP`
2341
- *
2342
2121
  * - `gui.ANCHOR_BOTTOM`
2343
2122
  */
2344
- function set_yanchor(node: Opaque<"node">, anchor: gui.YAnchor): void;
2123
+ function set_yanchor(node: Opaque<"node">, anchor: gui.ANCHOR): void;
2345
2124
  /**
2346
2125
  * Shows the on-display touch keyboard.
2347
2126
  * The specified type of keyboard is displayed if it is available on
@@ -2349,31 +2128,21 @@ declare global {
2349
2128
  * This function is only available on iOS and Android. .
2350
2129
  *
2351
2130
  * @param type - keyboard type
2352
- *
2353
- * - `gui.KEYBOARD_TYPE_DEFAULT`
2354
- *
2355
- * - `gui.KEYBOARD_TYPE_EMAIL`
2356
- *
2357
- * - `gui.KEYBOARD_TYPE_NUMBER_PAD`
2358
- *
2359
- * - `gui.KEYBOARD_TYPE_PASSWORD`
2360
2131
  * @param autoclose - if the keyboard should automatically close when clicking outside
2361
2132
  */
2362
- function show_keyboard(type: gui.KeyboardType, autoclose: boolean): void;
2133
+ function show_keyboard(type: gui.KEYBOARD_TYPE, autoclose: boolean): void;
2363
2134
  /**
2364
2135
  * Stops the particle fx for a gui node
2365
2136
  *
2366
2137
  * @param node - node to stop particle fx for
2367
- * @param options - options when stopping the particle fx. Supported options:
2368
- *
2369
- * - boolean `clear`: instantly clear spawned particles
2138
+ * @param options - options used when stopping the particle fx
2370
2139
  */
2371
- function stop_particlefx(node: Opaque<"node">, options?: { clear?: boolean }): void;
2140
+ function stop_particlefx(node: Opaque<"node">, options?: particlefx.stop_options): void;
2372
2141
  /**
2373
2142
  * This is a callback-function, which is called by the engine every frame to update the state of a gui component.
2374
2143
  * It can be used to perform any kind of gui related tasks, e.g. animating nodes.
2375
2144
  *
2376
- * @param self - reference to the script state to be used for storing data
2145
+ * @param self - script instance used for storing state
2377
2146
  * @param dt - the time-step of the frame update
2378
2147
  * @example
2379
2148
  * ```ts
@@ -2417,7 +2186,7 @@ declare global {
2417
2186
  * });
2418
2187
  * ```
2419
2188
  */
2420
- function update(self: Opaque<"userdata">, dt: number): void;
2189
+ function update(self: unknown, dt: number): void;
2421
2190
  interface properties {
2422
2191
  /**
2423
2192
  * The fonts used in the gui. The type of the property is hash.