@defold-typescript/types 0.51.0 → 0.53.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 (228) hide show
  1. package/api-availability.json +4 -58
  2. package/api-signatures.json +2804 -3172
  3. package/api-targets.json +15 -5
  4. package/examples/translations.json +19 -71
  5. package/generated/b2d.d.ts +39 -39
  6. package/generated/b2d_body.d.ts +11 -11
  7. package/generated/b2d_chain.d.ts +3 -3
  8. package/generated/b2d_fixture.d.ts +5 -5
  9. package/generated/b2d_joint.d.ts +29 -29
  10. package/generated/b2d_shape.d.ts +13 -13
  11. package/generated/b2d_world.d.ts +15 -15
  12. package/generated/buffer.d.ts +10 -11
  13. package/generated/bullet3d.d.ts +6 -6
  14. package/generated/bullet3d_collision_object.d.ts +10 -10
  15. package/generated/bullet3d_constraint.d.ts +173 -71
  16. package/generated/bullet3d_rigid_body.d.ts +3 -3
  17. package/generated/bullet3d_shape.d.ts +11 -11
  18. package/generated/bullet3d_world.d.ts +20 -20
  19. package/generated/camera.d.ts +4 -4
  20. package/generated/collectionfactory.d.ts +2 -3
  21. package/generated/collectionproxy.d.ts +5 -5
  22. package/generated/compute.d.ts +5 -5
  23. package/generated/crash.d.ts +7 -7
  24. package/generated/editor-vm/http.d.ts +13 -13
  25. package/generated/editor-vm/image.d.ts +4 -4
  26. package/generated/editor-vm/json.d.ts +1 -1
  27. package/generated/editor-vm/tilemap_tiles.d.ts +9 -9
  28. package/generated/editor-vm/zip.d.ts +4 -4
  29. package/generated/editor.d.ts +183 -183
  30. package/generated/factory.d.ts +2 -3
  31. package/generated/font.d.ts +4 -4
  32. package/generated/go.d.ts +122 -230
  33. package/generated/graphics.d.ts +23 -25
  34. package/generated/gui.d.ts +186 -423
  35. package/generated/http.d.ts +3 -3
  36. package/generated/image.d.ts +63 -11
  37. package/generated/json.d.ts +4 -4
  38. package/generated/kinds/gui-script.d.ts +2 -0
  39. package/generated/kinds/render-script.d.ts +14 -15
  40. package/generated/label.d.ts +5 -5
  41. package/generated/liveupdate.d.ts +7 -3
  42. package/generated/material.d.ts +49 -49
  43. package/generated/model.d.ts +46 -14
  44. package/generated/particlefx.d.ts +24 -5
  45. package/generated/physics.d.ts +64 -20
  46. package/generated/profiler.d.ts +3 -5
  47. package/generated/render-script-modules/b2d.d.ts +711 -0
  48. package/generated/render-script-modules/bullet3d.d.ts +73 -0
  49. package/generated/render-script-modules/collectionfactory.d.ts +24 -0
  50. package/generated/render-script-modules/collectionproxy.d.ts +39 -0
  51. package/generated/render-script-modules/factory.d.ts +24 -0
  52. package/generated/render-script-modules/go.d.ts +434 -0
  53. package/generated/render-script-modules/label.d.ts +105 -0
  54. package/generated/render-script-modules/model.d.ts +121 -0
  55. package/generated/render-script-modules/particlefx.d.ts +59 -0
  56. package/generated/render-script-modules/physics.d.ts +333 -0
  57. package/generated/render-script-modules/resource.d.ts +1232 -0
  58. package/generated/render-script-modules/sound.d.ts +227 -0
  59. package/generated/render-script-modules/sprite.d.ts +68 -0
  60. package/generated/render-script-modules/tilemap.d.ts +43 -0
  61. package/generated/render.d.ts +172 -47
  62. package/generated/resource.d.ts +81 -61
  63. package/generated/socket.d.ts +18 -23
  64. package/generated/sound.d.ts +6 -6
  65. package/generated/sprite.d.ts +51 -3
  66. package/generated/sys.d.ts +87 -24
  67. package/generated/tilemap.d.ts +3 -3
  68. package/generated/timer.d.ts +3 -3
  69. package/generated/versions/defold-1.12.4/b2d.d.ts +2 -2
  70. package/generated/versions/defold-1.12.4/b2d_body.d.ts +2 -2
  71. package/generated/versions/defold-1.12.4/buffer.d.ts +8 -8
  72. package/generated/versions/defold-1.12.4/go.d.ts +117 -345
  73. package/generated/versions/defold-1.12.4/graphics.d.ts +2 -1
  74. package/generated/versions/defold-1.12.4/gui.d.ts +169 -532
  75. package/generated/versions/defold-1.12.4/http.d.ts +2 -2
  76. package/generated/versions/defold-1.12.4/image.d.ts +82 -2
  77. package/generated/versions/defold-1.12.4/index.d.ts +1 -0
  78. package/generated/versions/defold-1.12.4/label.d.ts +1 -1
  79. package/generated/versions/defold-1.12.4/liveupdate.d.ts +4 -0
  80. package/generated/versions/defold-1.12.4/model.d.ts +42 -10
  81. package/generated/versions/defold-1.12.4/particlefx.d.ts +23 -2
  82. package/generated/versions/defold-1.12.4/physics.d.ts +46 -2
  83. package/generated/versions/defold-1.12.4/render.d.ts +83 -7
  84. package/generated/versions/defold-1.12.4/resource.d.ts +50 -17
  85. package/generated/versions/defold-1.12.4/socket.d.ts +12 -12
  86. package/generated/versions/defold-1.12.4/sound.d.ts +1 -1
  87. package/generated/versions/defold-1.12.4/sprite.d.ts +59 -2
  88. package/generated/versions/defold-1.12.4/sys.d.ts +103 -8
  89. package/generated/versions/defold-1.12.4/tilemap.d.ts +1 -1
  90. package/generated/versions/defold-1.12.4/vmath.d.ts +0 -24
  91. package/generated/versions/defold-1.12.4/window.d.ts +3 -4
  92. package/generated/versions/defold-1.13.0/b2d.d.ts +2 -2
  93. package/generated/versions/defold-1.13.0/b2d_body.d.ts +2 -2
  94. package/generated/versions/defold-1.13.0/b2d_chain.d.ts +1 -1
  95. package/generated/versions/defold-1.13.0/b2d_joint.d.ts +1 -1
  96. package/generated/versions/defold-1.13.0/b2d_shape.d.ts +1 -1
  97. package/generated/versions/defold-1.13.0/buffer.d.ts +8 -8
  98. package/generated/versions/defold-1.13.0/camera.d.ts +1 -1
  99. package/generated/versions/defold-1.13.0/go.d.ts +117 -372
  100. package/generated/versions/defold-1.13.0/graphics.d.ts +2 -1
  101. package/generated/versions/defold-1.13.0/gui.d.ts +169 -532
  102. package/generated/versions/defold-1.13.0/http.d.ts +2 -2
  103. package/generated/versions/defold-1.13.0/image.d.ts +82 -2
  104. package/generated/versions/defold-1.13.0/index.d.ts +1 -0
  105. package/generated/versions/defold-1.13.0/label.d.ts +1 -1
  106. package/generated/versions/defold-1.13.0/liveupdate.d.ts +4 -0
  107. package/generated/versions/defold-1.13.0/material.d.ts +3 -1
  108. package/generated/versions/defold-1.13.0/model.d.ts +42 -10
  109. package/generated/versions/defold-1.13.0/particlefx.d.ts +23 -2
  110. package/generated/versions/defold-1.13.0/physics.d.ts +46 -2
  111. package/generated/versions/defold-1.13.0/render.d.ts +147 -9
  112. package/generated/versions/defold-1.13.0/resource.d.ts +50 -17
  113. package/generated/versions/defold-1.13.0/socket.d.ts +12 -12
  114. package/generated/versions/defold-1.13.0/sound.d.ts +1 -1
  115. package/generated/versions/defold-1.13.0/sprite.d.ts +59 -2
  116. package/generated/versions/defold-1.13.0/sys.d.ts +103 -8
  117. package/generated/versions/defold-1.13.0/tilemap.d.ts +1 -1
  118. package/generated/versions/defold-1.13.0/vmath.d.ts +0 -24
  119. package/generated/versions/defold-1.13.0/window.d.ts +3 -4
  120. package/generated/versions/defold-1.13.1/b2d.d.ts +2 -2
  121. package/generated/versions/defold-1.13.1/b2d_body.d.ts +2 -2
  122. package/generated/versions/defold-1.13.1/b2d_chain.d.ts +1 -1
  123. package/generated/versions/defold-1.13.1/b2d_joint.d.ts +1 -1
  124. package/generated/versions/defold-1.13.1/b2d_shape.d.ts +1 -1
  125. package/generated/versions/defold-1.13.1/buffer.d.ts +8 -8
  126. package/generated/versions/defold-1.13.1/camera.d.ts +1 -1
  127. package/generated/versions/defold-1.13.1/go.d.ts +117 -372
  128. package/generated/versions/defold-1.13.1/graphics.d.ts +2 -1
  129. package/generated/versions/defold-1.13.1/gui.d.ts +169 -548
  130. package/generated/versions/defold-1.13.1/http.d.ts +2 -2
  131. package/generated/versions/defold-1.13.1/image.d.ts +82 -2
  132. package/generated/versions/defold-1.13.1/index.d.ts +2 -0
  133. package/generated/versions/defold-1.13.1/label.d.ts +1 -1
  134. package/generated/versions/defold-1.13.1/liveupdate.d.ts +4 -0
  135. package/generated/versions/defold-1.13.1/material.d.ts +3 -1
  136. package/generated/versions/defold-1.13.1/model.d.ts +42 -10
  137. package/generated/versions/defold-1.13.1/particlefx.d.ts +23 -2
  138. package/generated/versions/defold-1.13.1/physics.d.ts +46 -2
  139. package/generated/versions/defold-1.13.1/render.d.ts +147 -9
  140. package/generated/versions/defold-1.13.1/resource.d.ts +50 -17
  141. package/generated/versions/defold-1.13.1/socket.d.ts +12 -12
  142. package/generated/versions/defold-1.13.1/sound.d.ts +1 -1
  143. package/generated/versions/defold-1.13.1/sprite.d.ts +59 -2
  144. package/generated/versions/defold-1.13.1/sys.d.ts +103 -8
  145. package/generated/versions/defold-1.13.1/tilemap.d.ts +1 -1
  146. package/generated/versions/defold-1.13.1/vmath.d.ts +0 -24
  147. package/generated/versions/defold-1.13.1/window.d.ts +3 -4
  148. package/generated/versions/defold-1.13.2/b2d.d.ts +39 -39
  149. package/generated/versions/defold-1.13.2/b2d_body.d.ts +11 -11
  150. package/generated/versions/defold-1.13.2/b2d_chain.d.ts +3 -3
  151. package/generated/versions/defold-1.13.2/b2d_fixture.d.ts +5 -5
  152. package/generated/versions/defold-1.13.2/b2d_joint.d.ts +29 -29
  153. package/generated/versions/defold-1.13.2/b2d_shape.d.ts +13 -13
  154. package/generated/versions/defold-1.13.2/b2d_world.d.ts +15 -15
  155. package/generated/versions/defold-1.13.2/buffer.d.ts +10 -11
  156. package/generated/versions/defold-1.13.2/bullet3d.d.ts +6 -6
  157. package/generated/versions/defold-1.13.2/bullet3d_collision_object.d.ts +10 -10
  158. package/generated/versions/defold-1.13.2/bullet3d_constraint.d.ts +173 -71
  159. package/generated/versions/defold-1.13.2/bullet3d_rigid_body.d.ts +3 -3
  160. package/generated/versions/defold-1.13.2/bullet3d_shape.d.ts +11 -11
  161. package/generated/versions/defold-1.13.2/bullet3d_world.d.ts +20 -20
  162. package/generated/versions/defold-1.13.2/camera.d.ts +4 -4
  163. package/generated/versions/defold-1.13.2/collectionfactory.d.ts +2 -3
  164. package/generated/versions/defold-1.13.2/collectionproxy.d.ts +5 -5
  165. package/generated/versions/defold-1.13.2/compute.d.ts +5 -5
  166. package/generated/versions/defold-1.13.2/crash.d.ts +7 -7
  167. package/generated/versions/defold-1.13.2/editor-vm/http.d.ts +13 -13
  168. package/generated/versions/defold-1.13.2/editor-vm/image.d.ts +4 -4
  169. package/generated/versions/defold-1.13.2/editor-vm/json.d.ts +1 -1
  170. package/generated/versions/defold-1.13.2/editor-vm/tilemap_tiles.d.ts +9 -9
  171. package/generated/versions/defold-1.13.2/editor-vm/zip.d.ts +4 -4
  172. package/generated/versions/defold-1.13.2/editor.d.ts +183 -183
  173. package/generated/versions/defold-1.13.2/factory.d.ts +2 -3
  174. package/generated/versions/defold-1.13.2/font.d.ts +4 -4
  175. package/generated/versions/defold-1.13.2/go.d.ts +122 -230
  176. package/generated/versions/defold-1.13.2/graphics.d.ts +22 -24
  177. package/generated/versions/defold-1.13.2/gui.d.ts +186 -423
  178. package/generated/versions/defold-1.13.2/http.d.ts +3 -3
  179. package/generated/versions/defold-1.13.2/image.d.ts +63 -11
  180. package/generated/versions/defold-1.13.2/index.d.ts +2 -0
  181. package/generated/versions/defold-1.13.2/json.d.ts +4 -4
  182. package/generated/versions/defold-1.13.2/label.d.ts +5 -5
  183. package/generated/versions/defold-1.13.2/liveupdate.d.ts +7 -3
  184. package/generated/versions/defold-1.13.2/material.d.ts +49 -49
  185. package/generated/versions/defold-1.13.2/model.d.ts +46 -14
  186. package/generated/versions/defold-1.13.2/particlefx.d.ts +24 -5
  187. package/generated/versions/defold-1.13.2/physics.d.ts +64 -20
  188. package/generated/versions/defold-1.13.2/profiler.d.ts +3 -5
  189. package/generated/versions/defold-1.13.2/render.d.ts +161 -46
  190. package/generated/versions/defold-1.13.2/resource.d.ts +81 -61
  191. package/generated/versions/defold-1.13.2/socket.d.ts +18 -23
  192. package/generated/versions/defold-1.13.2/sound.d.ts +6 -6
  193. package/generated/versions/defold-1.13.2/sprite.d.ts +51 -3
  194. package/generated/versions/defold-1.13.2/sys.d.ts +87 -24
  195. package/generated/versions/defold-1.13.2/tilemap.d.ts +3 -3
  196. package/generated/versions/defold-1.13.2/timer.d.ts +3 -3
  197. package/generated/versions/defold-1.13.2/vmath.d.ts +0 -25
  198. package/generated/versions/defold-1.13.2/window.d.ts +8 -10
  199. package/generated/vmath.d.ts +0 -25
  200. package/generated/window.d.ts +8 -10
  201. package/identity-vocabulary.json +86 -34
  202. package/index.d.ts +2 -0
  203. package/package.json +3 -1
  204. package/scripts/generate-api-availability.ts +10 -24
  205. package/scripts/generate-api-signatures.ts +75 -14
  206. package/scripts/materialize-version.ts +48 -7
  207. package/scripts/regen.ts +214 -19
  208. package/scripts/shared-handle-methods.ts +3 -2
  209. package/scripts/signature-store-fs.ts +1 -0
  210. package/scripts/target-version.ts +26 -0
  211. package/src/api-doc.ts +34 -0
  212. package/src/api-identity.ts +32 -1
  213. package/src/component-properties.d.ts +96 -7
  214. package/src/core-types.ts +71 -28
  215. package/src/doc-corrections.ts +62 -5
  216. package/src/emit-dts.ts +1423 -401
  217. package/src/engine-globals.d.ts +5 -1
  218. package/src/engine-type-name.ts +33 -0
  219. package/src/go-overloads.d.ts +74 -19
  220. package/src/gui-overloads.d.ts +489 -0
  221. package/src/gui-texture-removal.d.ts +41 -0
  222. package/src/index.ts +3 -0
  223. package/src/lifecycle.ts +32 -23
  224. package/src/msg-overloads.d.ts +25 -13
  225. package/src/signature-store.ts +50 -0
  226. package/src/socket-types.d.ts +3 -3
  227. package/src/timers.d.ts +2 -1
  228. package/src/vmath-overloads.d.ts +26 -0
@@ -1,25 +1,24 @@
1
1
  /** @noSelfInFile */
2
- import type { Hash, Matrix4, Opaque, Quaternion, Url, Vector, Vector3, Vector4 } from "../../../src/core-types";
2
+ import type { Hash, Opaque, Quaternion, Vector3, Vector4 } from "../../../src/core-types";
3
3
 
4
4
  declare global {
5
5
  /**
6
6
  * GUI API documentation
7
7
  */
8
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;
9
+ type Adjust = typeof gui.ADJUST_FIT | typeof gui.ADJUST_ZOOM | typeof gui.ADJUST_STRETCH;
10
+ type Anchor = typeof gui.ANCHOR_BOTTOM | typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_NONE | typeof gui.ANCHOR_RIGHT | typeof gui.ANCHOR_TOP;
11
+ type Blend = typeof gui.BLEND_ALPHA | typeof gui.BLEND_ADD | typeof gui.BLEND_ADD_ALPHA | typeof gui.BLEND_MULT | typeof gui.BLEND_SCREEN;
11
12
  type ClippingMode = typeof gui.CLIPPING_MODE_NONE | typeof gui.CLIPPING_MODE_STENCIL;
12
13
  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
14
  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
15
  type PieBounds = typeof gui.PIEBOUNDS_RECTANGLE | typeof gui.PIEBOUNDS_ELLIPSE;
16
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
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;
18
+ type Prop = 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 SafeArea = typeof gui.SAFE_AREA_NONE | typeof gui.SAFE_AREA_LONG | typeof gui.SAFE_AREA_SHORT | typeof gui.SAFE_AREA_BOTH;
20
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;
21
+ type Type = typeof gui.TYPE_BOX | typeof gui.TYPE_TEXT | typeof gui.TYPE_PIE | typeof gui.TYPE_PARTICLEFX | typeof gui.TYPE_CUSTOM;
23
22
  /**
24
23
  * Adjust mode is used when the screen resolution differs from the project settings.
25
24
  * The fit mode ensures that the entire node is visible in the adjusted gui scene.
@@ -441,120 +440,6 @@ declare global {
441
440
  * text type
442
441
  */
443
442
  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
443
  /**
559
444
  * If one or more animations of the specified node is currently running (started by `gui.animate`), they will immediately be canceled.
560
445
  *
@@ -598,7 +483,7 @@ declare global {
598
483
  * gui.cancel_animations(node);
599
484
  * ```
600
485
  */
601
- function cancel_animations(node: Opaque<"node">, property?: string | gui.Property | Hash): void;
486
+ function cancel_animations(node: Opaque<"node">, property?: string | gui.Prop | Hash): void;
602
487
  /**
603
488
  * Cancels any running flipbook animation on the specified node.
604
489
  *
@@ -625,10 +510,10 @@ declare global {
625
510
  * Make a clone instance of a node and all its children.
626
511
  * Use gui.clone to clone a node excluding its children.
627
512
  *
628
- * @param node - root node to clone
513
+ * @param node - root node to clone, or `nil` to clone the whole scene; leaving the argument out raises an error
629
514
  * @returns a table mapping node ids to the corresponding cloned nodes
630
515
  */
631
- function clone_tree(node: Opaque<"node">): LuaTable<Hash, Opaque<"node">> & { get: LuaTableGetMethod<string, Opaque<"node">> };
516
+ function clone_tree(node: Opaque<"node"> | undefined): LuaTable<Hash, Opaque<"node">> & { get: LuaTableGetMethod<string, Opaque<"node">> };
632
517
  /**
633
518
  * Deletes the specified node. Any child nodes of the specified node will be
634
519
  * recursively deleted.
@@ -663,66 +548,6 @@ declare global {
663
548
  * ```
664
549
  */
665
550
  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
551
  /**
727
552
  * Returns the adjust mode of a node.
728
553
  * The adjust mode defines how the node will adjust itself to screen
@@ -735,7 +560,7 @@ declare global {
735
560
  * - `gui.ADJUST_ZOOM`
736
561
  * - `gui.ADJUST_STRETCH`
737
562
  */
738
- function get_adjust_mode(node: Opaque<"node">): gui.AdjustMode;
563
+ function get_adjust_mode(node: Opaque<"node">): gui.Adjust;
739
564
  /**
740
565
  * gets the node alpha
741
566
  *
@@ -756,7 +581,7 @@ declare global {
756
581
  * - `gui.BLEND_MULT`
757
582
  * - `gui.BLEND_SCREEN`
758
583
  */
759
- function get_blend_mode(node: Opaque<"node">): gui.BlendMode;
584
+ function get_blend_mode(node: Opaque<"node">): gui.Blend;
760
585
  /**
761
586
  * If node is set as an inverted clipping node, it will clip anything inside as opposed to outside.
762
587
  *
@@ -1141,16 +966,16 @@ declare global {
1141
966
  /**
1142
967
  * Get a node and all its children as a Lua table.
1143
968
  *
1144
- * @param node - root node to get node tree from
969
+ * @param node - root node to get node tree from, or `nil` to get the whole scene; leaving the argument out raises an error
1145
970
  * @returns a table mapping node ids to the corresponding nodes
1146
971
  */
1147
- function get_tree(node: Opaque<"node">): LuaTable<Hash, Opaque<"node">> & { get: LuaTableGetMethod<string, Opaque<"node">> };
972
+ function get_tree(node: Opaque<"node"> | undefined): LuaTable<Hash, Opaque<"node">> & { get: LuaTableGetMethod<string, Opaque<"node">> };
1148
973
  /**
1149
974
  * gets the node type
1150
975
  *
1151
976
  * @param node - node from which to get the type
1152
977
  */
1153
- function get_type(node: Opaque<"node">): LuaMultiReturn<[gui.NodeType, number | undefined]>;
978
+ function get_type(node: Opaque<"node">): LuaMultiReturn<[gui.Type, number | undefined]>;
1154
979
  /**
1155
980
  * Returns `true` if a node is visible and `false` if it's not.
1156
981
  * Invisible nodes are not rendered.
@@ -1175,7 +1000,7 @@ declare global {
1175
1000
  * - `gui.ANCHOR_LEFT`
1176
1001
  * - `gui.ANCHOR_RIGHT`
1177
1002
  */
1178
- function get_xanchor(node: Opaque<"node">): gui.XAnchor;
1003
+ function get_xanchor(node: Opaque<"node">): Exclude<gui.Anchor, typeof gui.ANCHOR_BOTTOM | typeof gui.ANCHOR_TOP>;
1179
1004
  /**
1180
1005
  * The y-anchor specifies how the node is moved when the game is run in a different resolution.
1181
1006
  *
@@ -1186,27 +1011,11 @@ declare global {
1186
1011
  * - `gui.ANCHOR_TOP`
1187
1012
  * - `gui.ANCHOR_BOTTOM`
1188
1013
  */
1189
- function get_yanchor(node: Opaque<"node">): gui.YAnchor;
1014
+ function get_yanchor(node: Opaque<"node">): Exclude<gui.Anchor, typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_RIGHT>;
1190
1015
  /**
1191
1016
  * Hides the on-display touch keyboard on the device.
1192
1017
  */
1193
1018
  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
1019
  /**
1211
1020
  * Returns `true` if a node is enabled and `false` if it's not.
1212
1021
  * Disabled nodes are not rendered and animations acting on them are not evaluated.
@@ -1324,197 +1133,66 @@ declare global {
1324
1133
  * }
1325
1134
  * ```
1326
1135
  */
1327
- function new_texture(texture_id: string | Hash, width: number, height: number, type: string | Opaque<"constant">, buffer: string, flip?: boolean): LuaMultiReturn<[boolean, number | undefined]>;
1136
+ function new_texture(texture_id: string | Hash, width: number, height: number, type: string | Opaque<"constant">, buffer: string): LuaMultiReturn<[boolean, number | undefined]>;
1328
1137
  /**
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).
1138
+ * Dynamically create a new texture.
1458
1139
  *
1459
- * `acc_z`
1460
- * Accelerometer z value (if present).
1140
+ * @param texture_id - texture id
1141
+ * @param width - texture width
1142
+ * @param height - texture height
1143
+ * @param type - texture type
1461
1144
  *
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
1145
+ * - `"rgb"` - RGB
1146
+ * - `"rgba"` - RGBA
1147
+ * - `"l"` - LUMINANCE
1148
+ * - `"astc"` - ASTC compressed format
1149
+ * @param buffer - texture data
1150
+ * @param flip - flip texture vertically
1466
1151
  * @example
1152
+ * How to create a texture and apply it to a new box node:
1467
1153
  * ```ts
1468
1154
  * export default defineGuiScript({
1469
- * init(): { my_value: number | undefined } {
1470
- * return { my_value: undefined };
1471
- * },
1155
+ * init(self) {
1156
+ * const w = 200;
1157
+ * const h = 300;
1472
1158
  *
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;
1159
+ * // A nice orange. String with the RGB values.
1160
+ * const orange = String.fromCharCode(0xff, 0x80, 0x10);
1161
+ *
1162
+ * // Create the texture. Repeat the color string for each pixel.
1163
+ * const [ok, reason] = gui.new_texture("orange_tx", w, h, "rgb", orange.repeat(w * h));
1164
+ * if (ok) {
1165
+ * // Create a box node and apply the texture to it.
1166
+ * const n = gui.new_box_node(vmath.vector3(200, 200, 0), vmath.vector3(w, h, 0));
1167
+ * gui.set_texture(n, "orange_tx");
1168
+ * } else {
1169
+ * // Could not create texture for some reason...
1170
+ * if (reason === gui.RESULT_TEXTURE_ALREADY_EXISTS) {
1171
+ * // ...
1172
+ * } else {
1173
+ * // ...
1174
+ * }
1478
1175
  * }
1479
- * // consume input
1480
- * return true;
1481
1176
  * },
1482
1177
  * });
1483
1178
  * ```
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
1179
  * @example
1180
+ * How to create a texture using .astc format
1504
1181
  * ```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
- * });
1182
+ * const size = 4;
1183
+ * const pos = vmath.vector3(200, 200, 0);
1184
+ * const path = "/assets/images/logo_4x4.astc";
1185
+ * const [data] = sys.load_resource(path);
1186
+ * if (data !== undefined) {
1187
+ * const n = gui.new_box_node(pos, vmath.vector3(size, size, 0));
1188
+ * // size is read from the .astc buffer
1189
+ * // flip is not supported
1190
+ * gui.new_texture(path, 0, 0, "astc", data, false);
1191
+ * gui.set_texture(n, path);
1192
+ * }
1515
1193
  * ```
1516
1194
  */
1517
- function on_reload(self: Opaque<"userdata">): void;
1195
+ function new_texture(texture_id: string | Hash, width: number, height: number, type: string | Opaque<"constant">, buffer: string, flip: boolean): LuaMultiReturn<[boolean, number | undefined]>;
1518
1196
  /**
1519
1197
  * Tests whether a coordinate is within the bounding box of a
1520
1198
  * node.
@@ -1572,7 +1250,55 @@ declare global {
1572
1250
  * gui.play_flipbook(node, "button");
1573
1251
  * ```
1574
1252
  */
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;
1253
+ function play_flipbook(node: Opaque<"node">, animation: string | Hash, complete_function?: (self: unknown, node: unknown) => void): void;
1254
+ /**
1255
+ * Play flipbook animation on a box or pie node.
1256
+ * The current node texture must contain the animation.
1257
+ * Use this function to set one-frame still images on the node.
1258
+ *
1259
+ * @param node - node to set animation for
1260
+ * @param animation - animation id
1261
+ * @param complete_function - optional function to call when the animation has completed
1262
+ *
1263
+ * `self`
1264
+ *
1265
+ * object The current object.
1266
+ *
1267
+ * `node`
1268
+ *
1269
+ * node The node that is animated.
1270
+ * @param play_properties - optional table with properties
1271
+ *
1272
+ * `offset`
1273
+ * number The normalized initial value of the animation cursor when the animation starts playing
1274
+ * `playback_rate`
1275
+ * number The rate with which the animation will be played. Must be positive
1276
+ * @example
1277
+ * Set the texture of a node to a flipbook animation from an atlas:
1278
+ * ```ts
1279
+ * function anim_callback(self: unknown, node: unknown) {
1280
+ * // Take action after animation has played.
1281
+ * }
1282
+ *
1283
+ * export default defineGuiScript({
1284
+ * init(self) {
1285
+ * // Create a new node and set the texture to a flipbook animation
1286
+ * const node = gui.get_node("button_node");
1287
+ * gui.set_texture(node, "gui_sprites");
1288
+ * gui.play_flipbook(node, "animated_button");
1289
+ * },
1290
+ * });
1291
+ * ```
1292
+ * @example
1293
+ * Set the texture of a node to an image from an atlas:
1294
+ * ```ts
1295
+ * // Create a new node and set the texture to a "button.png" from atlas
1296
+ * const node = gui.get_node("button_node");
1297
+ * gui.set_texture(node, "gui_sprites");
1298
+ * gui.play_flipbook(node, "button");
1299
+ * ```
1300
+ */
1301
+ function play_flipbook(node: Opaque<"node">, animation: string | Hash, complete_function: ((self: unknown, node: unknown) => void) | undefined, play_properties: { offset?: number; playback_rate?: number }): void;
1576
1302
  /**
1577
1303
  * Plays the paricle fx for a gui node
1578
1304
  *
@@ -1639,100 +1365,6 @@ declare global {
1639
1365
  * @returns local position
1640
1366
  */
1641
1367
  function screen_to_local(node: Opaque<"node">, screen_position: Vector3 | Vector4): Vector3;
1642
- /**
1643
- * Instead of using specific setteres such as gui.set_position or gui.set_scale,
1644
- * you can use gui.set instead and supply the property as a string or a hash.
1645
- * While this function is similar to go.get and go.set, there are a few more restrictions
1646
- * when operating in the gui namespace. Most notably, only these named properties identifiers are supported:
1647
- *
1648
- * - `"position"`
1649
- * - `"rotation"`
1650
- * - `"euler"`
1651
- * - `"scale"`
1652
- * - `"color"`
1653
- * - `"outline"`
1654
- * - `"shadow"`
1655
- * - `"size"`
1656
- * - `"fill_angle"` (pie)
1657
- * - `"inner_radius"` (pie)
1658
- * - `"leading"` (text)
1659
- * - `"tracking"` (text)
1660
- * - `"slice9"` (slice9)
1661
- *
1662
- * 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.
1663
- * I.e when setting the "position" property, you need to use a vmath.vector4 and when setting a single component of the property,
1664
- * such as "position.x", you need to use a single value.
1665
- * 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,
1666
- * 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,
1667
- * use the "euler" property instead. The rotation and euler properties are linked, changing one of them will change the backing data of the other.
1668
- * 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
1669
- * 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())`
1670
- * 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.
1671
- * 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.
1672
- *
1673
- * @param node - node to set the property for, or msg.url() to the gui itself
1674
- * @param property - the property to set
1675
- * @param value - the property to set
1676
- * @param options - optional options table (only applicable for material constants)
1677
- * - `index` number index into array property (1 based)
1678
- * - `key` hash name of internal property
1679
- *
1680
- * **⚠️ `index` is 1-based; passed to Defold unchanged.**
1681
- * @example
1682
- * Updates the position property on an existing node:
1683
- * ```ts
1684
- * const node = gui.get_node("my_box_node");
1685
- * const node_position = gui.get(node, "position") as Vector3;
1686
- * gui.set(node, "position.x", node_position.x + 128);
1687
- * ```
1688
- * @example
1689
- * Updates the rotation property on an existing node:
1690
- * ```ts
1691
- * const node = gui.get_node("my_box_node");
1692
- * gui.set(node, "rotation", vmath.quat_rotation_z(math.rad(45)));
1693
- * // this is equivalent to:
1694
- * gui.set(node, "euler.z", 45);
1695
- * // or using the entire vector:
1696
- * gui.set(node, "euler", vmath.vector3(0, 0, 45));
1697
- * // or using the set_rotation
1698
- * gui.set_rotation(node, vmath.vector3(0, 0, 45));
1699
- * ```
1700
- * @example
1701
- * Sets various material constants for a node:
1702
- * ```ts
1703
- * const node = gui.get_node("my_box_node");
1704
- * gui.set(node, "tint", vmath.vector4(1, 0, 0, 1));
1705
- * // matrix4 is also supported
1706
- * gui.set(node, "light_matrix", vmath.matrix4());
1707
- * // update a constant in an array at position 4. the array is specified in the shader as:
1708
- * // uniform vec4 tint_array[4]; // lua is 1 based, shader is 0 based
1709
- * gui.set(node, "tint_array", vmath.vector4(1, 0, 0, 1), { index: 4 });
1710
- * // update a matrix constant in an array at position 4. the array is specified in the shader as:
1711
- * // uniform mat4 light_matrix_array[4];
1712
- * gui.set(node, "light_matrix_array", vmath.matrix4(), { index: 4 });
1713
- * // update a sub-element in a constant
1714
- * gui.set(node, "tint.x", 1);
1715
- * // update a sub-element in an array constant at position 4
1716
- * gui.set(node, "tint_array.x", 1, { index: 4 });
1717
- * ```
1718
- * @example
1719
- * Set a named property
1720
- * ```ts
1721
- * export default defineGuiScript({
1722
- * on_message(self, message_id, message) {
1723
- * if (message_id === hash("set_font") && types.is_hash(message.font)) {
1724
- * gui.set(msg.url(), "fonts", message.font, { key: "my_font_name" });
1725
- * gui.set_font(gui.get_node("text"), "my_font_name");
1726
- * } else if (message_id === hash("set_texture") && types.is_hash(message.texture)) {
1727
- * gui.set(msg.url(), "textures", message.texture, { key: "my_texture" });
1728
- * gui.set_texture(gui.get_node("box"), "my_texture");
1729
- * gui.play_flipbook(gui.get_node("box"), "logo_256");
1730
- * }
1731
- * },
1732
- * });
1733
- * ```
1734
- */
1735
- function set(node: Opaque<"node"> | Url, property: string | Hash | gui.Property, value: number | Vector4 | Vector3 | Quaternion | Matrix4 | Hash, options?: { index?: number; key?: string | Hash; keys?: (Hash | string)[] }): void;
1736
1368
  /**
1737
1369
  * Sets the adjust mode on a node.
1738
1370
  * The adjust mode defines how the node will adjust itself to screen
@@ -1745,7 +1377,7 @@ declare global {
1745
1377
  * - `gui.ADJUST_ZOOM`
1746
1378
  * - `gui.ADJUST_STRETCH`
1747
1379
  */
1748
- function set_adjust_mode(node: Opaque<"node">, adjust_mode: gui.AdjustMode): void;
1380
+ function set_adjust_mode(node: Opaque<"node">, adjust_mode: gui.Adjust): void;
1749
1381
  /**
1750
1382
  * sets the node alpha
1751
1383
  *
@@ -1766,7 +1398,7 @@ declare global {
1766
1398
  * - `gui.BLEND_MULT`
1767
1399
  * - `gui.BLEND_SCREEN`
1768
1400
  */
1769
- function set_blend_mode(node: Opaque<"node">, blend_mode: gui.BlendMode): void;
1401
+ function set_blend_mode(node: Opaque<"node">, blend_mode: gui.Blend): void;
1770
1402
  /**
1771
1403
  * If node is set as an inverted clipping node, it will clip anything inside as opposed to outside.
1772
1404
  *
@@ -2033,7 +1665,7 @@ declare global {
2033
1665
  * - `gui.SAFE_AREA_SHORT`
2034
1666
  * - `gui.SAFE_AREA_BOTH`
2035
1667
  */
2036
- function set_safe_area_mode(mode: gui.SafeAreaMode): void;
1668
+ function set_safe_area_mode(mode: gui.SafeArea): void;
2037
1669
  /**
2038
1670
  * Sets the scaling of the supplied node.
2039
1671
  *
@@ -2172,7 +1804,52 @@ declare global {
2172
1804
  * });
2173
1805
  * ```
2174
1806
  */
2175
- function set_texture_data(texture: string | Hash, width: number, height: number, type: string | Opaque<"constant">, buffer: string, flip?: boolean): boolean;
1807
+ function set_texture_data(texture: string | Hash, width: number, height: number, type: string | Opaque<"constant">, buffer: string): boolean;
1808
+ /**
1809
+ * Set the texture buffer data for a dynamically created texture.
1810
+ *
1811
+ * @param texture - texture id
1812
+ * @param width - texture width
1813
+ * @param height - texture height
1814
+ * @param type - texture type
1815
+ *
1816
+ * - `"rgb"` - RGB
1817
+ * - `"rgba"` - RGBA
1818
+ * - `"l"` - LUMINANCE
1819
+ * - `"astc"` - ASTC compressed format
1820
+ * @param buffer - texture data
1821
+ * @param flip - flip texture vertically
1822
+ * @returns setting the data was successful
1823
+ * @example
1824
+ * ```ts
1825
+ * export default defineGuiScript({
1826
+ * init(self) {
1827
+ * const w = 200;
1828
+ * const h = 300;
1829
+ *
1830
+ * // Create a dynamic texture, all white.
1831
+ * if (gui.new_texture("dynamic_tx", w, h, "rgb", String.fromCharCode(0xff).repeat(w * h * 3))) {
1832
+ * // Create a box node and apply the texture to it.
1833
+ * const n = gui.new_box_node(vmath.vector3(200, 200, 0), vmath.vector3(w, h, 0));
1834
+ * gui.set_texture(n, "dynamic_tx");
1835
+ *
1836
+ * // ...
1837
+ *
1838
+ * // Change the data in the texture to a nice orange.
1839
+ * const orange = String.fromCharCode(0xff, 0x80, 0x10);
1840
+ * if (gui.set_texture_data("dynamic_tx", w, h, "rgb", orange.repeat(w * h))) {
1841
+ * // Go on and to more stuff
1842
+ * // ...
1843
+ * }
1844
+ * } else {
1845
+ * // Something went wrong
1846
+ * // ...
1847
+ * }
1848
+ * },
1849
+ * });
1850
+ * ```
1851
+ */
1852
+ function set_texture_data(texture: string | Hash, width: number, height: number, type: string | Opaque<"constant">, buffer: string, flip: boolean): boolean;
2176
1853
  /**
2177
1854
  * Sets the tracking value of a text node. This value is used to
2178
1855
  * adjust the vertical spacing of characters in the text.
@@ -2198,7 +1875,7 @@ declare global {
2198
1875
  * - `gui.ANCHOR_LEFT`
2199
1876
  * - `gui.ANCHOR_RIGHT`
2200
1877
  */
2201
- function set_xanchor(node: Opaque<"node">, anchor: gui.XAnchor): void;
1878
+ function set_xanchor(node: Opaque<"node">, anchor: Exclude<gui.Anchor, typeof gui.ANCHOR_BOTTOM | typeof gui.ANCHOR_TOP>): void;
2202
1879
  /**
2203
1880
  * The y-anchor specifies how the node is moved when the game is run in a different resolution.
2204
1881
  *
@@ -2209,7 +1886,7 @@ declare global {
2209
1886
  * - `gui.ANCHOR_TOP`
2210
1887
  * - `gui.ANCHOR_BOTTOM`
2211
1888
  */
2212
- function set_yanchor(node: Opaque<"node">, anchor: gui.YAnchor): void;
1889
+ function set_yanchor(node: Opaque<"node">, anchor: Exclude<gui.Anchor, typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_RIGHT>): void;
2213
1890
  /**
2214
1891
  * Shows the on-display touch keyboard.
2215
1892
  * The specified type of keyboard is displayed if it is available on
@@ -2233,57 +1910,17 @@ declare global {
2233
1910
  *
2234
1911
  * - boolean `clear`: instantly clear spawned particles
2235
1912
  */
2236
- function stop_particlefx(node: Opaque<"node">, options?: { clear?: boolean }): void;
1913
+ function stop_particlefx(node: Opaque<"node">): void;
2237
1914
  /**
2238
- * This is a callback-function, which is called by the engine every frame to update the state of a gui component.
2239
- * It can be used to perform any kind of gui related tasks, e.g. animating nodes.
2240
- *
2241
- * @param self - reference to the script state to be used for storing data
2242
- * @param dt - the time-step of the frame update
2243
- * @example
2244
- * ```ts
2245
- * // This example demonstrates how to update a text node that displays game score
2246
- * // in a counting fashion. It is assumed that the gui component receives messages
2247
- * // from the game when a new score is to be shown.
2248
- * export default defineGuiScript({
2249
- * init() {
2250
- * return {
2251
- * // fetch the score text node for later use (assumes it is called "score")
2252
- * score_node: gui.get_node("score"),
2253
- * // keep track of the current score counted up so far
2254
- * current_score: 0,
2255
- * // keep track of the target score we should count up to
2256
- * target_score: 0,
2257
- * // how fast we will update the score, in score/second
2258
- * score_update_speed: 1,
2259
- * };
2260
- * },
1915
+ * Stops the particle fx for a gui node
2261
1916
  *
2262
- * update(self, dt) {
2263
- * // check if target score is more than current score
2264
- * if (self.current_score < self.target_score) {
2265
- * // increment current score according to the speed
2266
- * self.current_score = self.current_score + dt * self.score_update_speed;
2267
- * // check if we went past the target score, clamp current score in that case
2268
- * if (self.current_score > self.target_score) {
2269
- * self.current_score = self.target_score;
2270
- * }
2271
- * // update the score text node
2272
- * gui.set_text(self.score_node, "" + math.floor(self.current_score));
2273
- * }
2274
- * },
1917
+ * @param node - node to stop particle fx for
1918
+ * @param options - options when stopping the particle fx. Supported options:
2275
1919
  *
2276
- * on_message(self, message_id, message) {
2277
- * // check the message
2278
- * if (message_id === hash("set_score") && typeof message.score === "number") {
2279
- * self.target_score = message.score;
2280
- * }
2281
- * },
2282
- * });
2283
- * ```
1920
+ * - boolean `clear`: instantly clear spawned particles
2284
1921
  */
2285
- function update(self: Opaque<"userdata">, dt: number): void;
2286
- interface properties {
1922
+ function stop_particlefx(node: Opaque<"node">, options: { clear?: boolean }): void;
1923
+ interface Properties {
2287
1924
  /**
2288
1925
  * The fonts used in the gui. The type of the property is hash.
2289
1926
  * Key must be specified in options table.