@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,5 +1,5 @@
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
  /**
@@ -9,7 +9,7 @@ declare global {
9
9
  /**
10
10
  * Rich-text layout object
11
11
  */
12
- interface layout_object {
12
+ interface LayoutObject {
13
13
  /**
14
14
  * object type, currently `link` or `sprite`
15
15
  */
@@ -47,11 +47,11 @@ declare global {
47
47
  */
48
48
  attributes: LuaTable<string, string>;
49
49
  }
50
- type node = Opaque<"node">;
50
+ type Node = Opaque<"node">;
51
51
  /**
52
52
  * GUI flipbook playback properties
53
53
  */
54
- interface play_properties {
54
+ interface PlayProperties {
55
55
  /**
56
56
  * Normalized initial animation cursor.
57
57
  */
@@ -64,7 +64,7 @@ declare global {
64
64
  /**
65
65
  * Generic GUI property options
66
66
  */
67
- interface set_options {
67
+ interface SetOptions {
68
68
  /**
69
69
  * One-based material-constant array index.
70
70
  */
@@ -74,34 +74,20 @@ declare global {
74
74
  */
75
75
  key?: string | Hash;
76
76
  }
77
- type AdjustMode = typeof gui.ADJUST_FIT | typeof gui.ADJUST_ZOOM | typeof gui.ADJUST_STRETCH;
78
- type BlendMode = typeof gui.BLEND_ALPHA | typeof gui.BLEND_ADD | typeof gui.BLEND_ADD_ALPHA | typeof gui.BLEND_MULT | typeof gui.BLEND_SCREEN;
77
+ type Adjust = typeof gui.ADJUST_FIT | typeof gui.ADJUST_STRETCH | typeof gui.ADJUST_ZOOM;
78
+ type Anchor = typeof gui.ANCHOR_BOTTOM | typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_NONE | typeof gui.ANCHOR_RIGHT | typeof gui.ANCHOR_TOP;
79
+ type Blend = typeof gui.BLEND_ADD | typeof gui.BLEND_ADD_ALPHA | typeof gui.BLEND_ALPHA | typeof gui.BLEND_MULT | typeof gui.BLEND_SCREEN;
79
80
  type ClippingMode = typeof gui.CLIPPING_MODE_NONE | typeof gui.CLIPPING_MODE_STENCIL;
80
81
  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;
81
82
  type KeyboardType = typeof gui.KEYBOARD_TYPE_DEFAULT | typeof gui.KEYBOARD_TYPE_EMAIL | typeof gui.KEYBOARD_TYPE_NUMBER_PAD | typeof gui.KEYBOARD_TYPE_PASSWORD;
82
- type NodeType = typeof gui.TYPE_BOX | typeof gui.TYPE_TEXT | typeof gui.TYPE_PIE | typeof gui.TYPE_PARTICLEFX | typeof gui.TYPE_CUSTOM;
83
- type PieBounds = typeof gui.PIEBOUNDS_RECTANGLE | typeof gui.PIEBOUNDS_ELLIPSE;
84
- 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;
85
- 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;
86
- 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;
87
- type SafeAreaMode = typeof gui.SAFE_AREA_NONE | typeof gui.SAFE_AREA_LONG | typeof gui.SAFE_AREA_SHORT | typeof gui.SAFE_AREA_BOTH;
88
- type SizeMode = typeof gui.SIZE_MODE_MANUAL | typeof gui.SIZE_MODE_AUTO;
89
- type XAnchor = typeof gui.ANCHOR_NONE | typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_RIGHT;
90
- type YAnchor = typeof gui.ANCHOR_NONE | typeof gui.ANCHOR_TOP | typeof gui.ANCHOR_BOTTOM;
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;
83
+ type PieBounds = typeof gui.PIEBOUNDS_ELLIPSE | typeof gui.PIEBOUNDS_RECTANGLE;
84
+ 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;
85
+ 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;
86
+ 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;
87
+ type Result = typeof gui.RESULT_DATA_ERROR | typeof gui.RESULT_OUT_OF_RESOURCES | typeof gui.RESULT_TEXTURE_ALREADY_EXISTS;
88
+ type SafeArea = typeof gui.SAFE_AREA_BOTH | typeof gui.SAFE_AREA_LONG | typeof gui.SAFE_AREA_NONE | typeof gui.SAFE_AREA_SHORT;
89
+ type SizeMode = typeof gui.SIZE_MODE_AUTO | typeof gui.SIZE_MODE_MANUAL;
90
+ type Type = typeof gui.TYPE_BOX | typeof gui.TYPE_CUSTOM | typeof gui.TYPE_PARTICLEFX | typeof gui.TYPE_PIE | typeof gui.TYPE_TEXT;
105
91
  /**
106
92
  * 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.
107
93
  */
@@ -518,83 +504,6 @@ declare global {
518
504
  * text type
519
505
  */
520
506
  const TYPE_TEXT: number & { readonly __brand: "gui.TYPE_TEXT" };
521
- /**
522
- * This starts an animation of a node property according to the specified parameters.
523
- * If the node property is already being animated, that animation will be canceled and
524
- * replaced by the new one. Note however that several different node properties
525
- * can be animated simultaneously. Use `gui.cancel_animations` to stop the animation
526
- * before it has completed.
527
- * Composite properties of type vector3, vector4 or quaternion
528
- * also expose their sub-components (x, y, z and w).
529
- * You can address the components individually by suffixing the name with a dot '.'
530
- * and the name of the component.
531
- * For instance, `"position.x"` (the position x coordinate) or `"color.w"`
532
- * (the color alpha value).
533
- * If a `complete_function` (Lua function) is specified, that function will be called
534
- * when the animation has completed.
535
- * By starting a new animation in that function, several animations can be sequenced
536
- * together. See the examples below for more information.
537
- *
538
- * @param node - node to animate
539
- * @param property - property to animate; each gui.PROP member equals its corresponding property name string
540
- * @param to - target property value
541
- * @param easing - easing to use during animation.
542
- * Either specify one of the `gui.EASING_*` constants or provide a
543
- * vector with a custom curve. See the animation guide for more information.
544
- * @param duration - duration of the animation in seconds.
545
- * @param delay - delay before the animation starts in seconds.
546
- * @param complete_function - function to call when the
547
- * animation has completed
548
- * @param playback - playback mode
549
- * @example
550
- * How to start a simple color animation, where the node fades in to white during 0.5 seconds:
551
- * ```ts
552
- * // How to start a simple color animation, where the node fades in to white during 0.5 seconds:
553
- * const node = gui.get_node("my_node");
554
- * gui.set_color(node, vmath.vector4(0, 0, 0, 0)); // node is fully transparent
555
- * gui.animate(node, gui.PROP_COLOR, vmath.vector4(1, 1, 1, 1), gui.EASING_INOUTQUAD, 0.5); // start animation
556
- * ```
557
- * @example
558
- * 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:
559
- * ```ts
560
- * // How to start a sequenced animation where the node fades in to white during 0.5
561
- * // seconds, stays visible for 2 seconds and then fades out:
562
- * function on_animation_done(self: unknown, node: unknown) {
563
- * // fade out node, but wait 2 seconds before the animation starts
564
- * gui.animate(node as Opaque<"node">, gui.PROP_COLOR, vmath.vector4(0, 0, 0, 0), gui.EASING_OUTQUAD, 0.5, 2.0);
565
- * }
566
- *
567
- * export default defineGuiScript({
568
- * init(self) {
569
- * // fetch the node we want to animate
570
- * const my_node = gui.get_node("my_node");
571
- * // node is initially set to fully transparent
572
- * gui.set_color(my_node, vmath.vector4(0, 0, 0, 0));
573
- * // animate the node immediately and call on_animation_done when the animation has completed
574
- * gui.animate(my_node, gui.PROP_COLOR, vmath.vector4(1, 1, 1, 1), gui.EASING_INOUTQUAD, 0.5, 0.0, on_animation_done);
575
- * },
576
- * });
577
- * ```
578
- * @example
579
- * How to animate a node's y position using a crazy custom easing curve:
580
- * ```ts
581
- * // How to animate a node's y position using a crazy custom easing curve:
582
- * export default defineGuiScript({
583
- * init(self) {
584
- * const values = [
585
- * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
586
- * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
587
- * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
588
- * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
589
- * ];
590
- * const vec = vmath.vector(values);
591
- * const node = gui.get_node("box");
592
- * gui.animate(node, "position.y", 100, vec, 4.0, 0, undefined, gui.PLAYBACK_LOOP_PINGPONG);
593
- * },
594
- * });
595
- * ```
596
- */
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;
598
507
  /**
599
508
  * If one or more animations of the specified node is currently running (started by `gui.animate`), they will immediately be canceled.
600
509
  *
@@ -638,7 +547,7 @@ declare global {
638
547
  * gui.cancel_animations(node);
639
548
  * ```
640
549
  */
641
- function cancel_animations(node: Opaque<"node">, property?: string | Hash | gui.PROP): void;
550
+ function cancel_animations(node: Opaque<"node">, property?: string | Hash | gui.Prop): void;
642
551
  /**
643
552
  * Cancels any running flipbook animation on the specified node.
644
553
  *
@@ -665,10 +574,10 @@ declare global {
665
574
  * Make a clone instance of a node and all its children.
666
575
  * Use gui.clone to clone a node excluding its children.
667
576
  *
668
- * @param node - root node to clone
577
+ * @param node - root node to clone, or `nil` to clone the whole scene; leaving the argument out raises an error
669
578
  * @returns a table mapping node ids to the corresponding cloned nodes
670
579
  */
671
- function clone_tree(node: Opaque<"node">): LuaTable<Hash, Opaque<"node">> & { get: LuaTableGetMethod<string, Opaque<"node">> };
580
+ function clone_tree(node: Opaque<"node"> | undefined): LuaTable<Hash, Opaque<"node">> & { get: LuaTableGetMethod<string, Opaque<"node">> };
672
581
  /**
673
582
  * Deletes the specified node. Any child nodes of the specified node will be
674
583
  * recursively deleted.
@@ -703,66 +612,6 @@ declare global {
703
612
  * ```
704
613
  */
705
614
  function delete_texture(texture: string | Hash): void;
706
- /**
707
- * This is a callback-function, which is called by the engine when a gui component is finalized (destroyed). It can
708
- * be used to e.g. take some last action, report the finalization to other game object instances
709
- * or release user input focus (see `release_input_focus`). There is no use in starting any animations or similar
710
- * from this function since the gui component is about to be destroyed.
711
- *
712
- * @param self - script instance used for storing state
713
- * @example
714
- * ```ts
715
- * export default defineScript({
716
- * init() {
717
- * return { some_value: 0 };
718
- * },
719
- *
720
- * final(self) {
721
- * // report finalization
722
- * msg.post("my_friend_instance", "im_dead", { my_stats: self.some_value });
723
- * },
724
- * });
725
- * ```
726
- */
727
- function final(self: unknown): void;
728
- /**
729
- * Instead of using specific getters such as gui.get_position or gui.get_scale,
730
- * you can use gui.get instead and supply the property as a string or a hash.
731
- * While this function is similar to go.get, there are a few more restrictions
732
- * when operating in the gui namespace. Most notably, only these explicitly named properties are supported:
733
- *
734
- * - `"position"`
735
- * - `"rotation"`
736
- * - `"euler"`
737
- * - `"scale"`
738
- * - `"color"`
739
- * - `"outline"`
740
- * - `"shadow"`
741
- * - `"size"`
742
- * - `"fill_angle"` (pie)
743
- * - `"inner_radius"` (pie)
744
- * - `"leading"` (text)
745
- * - `"tracking"` (text)
746
- * - `"slice9"` (slice9)
747
- *
748
- * The value returned will either be a vmath.vector4 or a single number, i.e getting the "position"
749
- * property will return a vec4 while getting the "position.x" property will return a single value.
750
- * You can also use this function to get material constants.
751
- *
752
- * @param node - node to get the property for
753
- * @param property - the property to retrieve
754
- * @param options - optional options table (only applicable for material constants)
755
- * - `index` integer index into array property (1 based)
756
- *
757
- * **⚠️ `index` is 1-based; passed to Defold unchanged.**
758
- * @example
759
- * ```ts
760
- * // Get properties on existing nodes:
761
- * const node = gui.get_node("my_box_node");
762
- * const node_position = gui.get(node, "position");
763
- * ```
764
- */
765
- function get(node: Opaque<"node">, property: string | Hash | gui.PROP, options?: { index?: number; key?: string | Hash; keys?: (Hash | string)[] }): unknown;
766
615
  /**
767
616
  * Returns the adjust mode of a node.
768
617
  * The adjust mode defines how the node will adjust itself to screen
@@ -771,7 +620,7 @@ declare global {
771
620
  * @param node - node from which to get the adjust mode (node)
772
621
  * @returns the current adjust mode
773
622
  */
774
- function get_adjust_mode(node: Opaque<"node">): gui.ADJUST;
623
+ function get_adjust_mode(node: Opaque<"node">): gui.Adjust;
775
624
  /**
776
625
  * gets the node alpha
777
626
  *
@@ -786,7 +635,7 @@ declare global {
786
635
  * @param node - node from which to get the blend mode
787
636
  * @returns blend mode
788
637
  */
789
- function get_blend_mode(node: Opaque<"node">): gui.BLEND;
638
+ function get_blend_mode(node: Opaque<"node">): gui.Blend;
790
639
  /**
791
640
  * If node is set as an inverted clipping node, it will clip anything inside as opposed to outside.
792
641
  *
@@ -803,7 +652,7 @@ declare global {
803
652
  * - `gui.CLIPPING_MODE_NONE`
804
653
  * - `gui.CLIPPING_MODE_STENCIL`
805
654
  */
806
- function get_clipping_mode(node: Opaque<"node">): gui.CLIPPING_MODE;
655
+ function get_clipping_mode(node: Opaque<"node">): gui.ClippingMode;
807
656
  /**
808
657
  * 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.
809
658
  *
@@ -974,7 +823,7 @@ declare global {
974
823
  * @param node - text node to inspect
975
824
  * @returns layout objects in source order. **0️⃣ `text_offset` is 0-based; passed to Defold unchanged.**
976
825
  */
977
- function get_layout_objects(node: Opaque<"node">): gui.layout_object[];
826
+ function get_layout_objects(node: Opaque<"node">): gui.LayoutObject[];
978
827
  /**
979
828
  * Returns a table mapping each layout id hash to a vector3(width, height, 0). For the default layout,
980
829
  * the current scene resolution is returned. If a layout name is not present in the Display Profiles (or when
@@ -1034,7 +883,7 @@ declare global {
1034
883
  * @param node - node from where to get the outer bounds mode
1035
884
  * @returns the outer bounds mode of the pie node
1036
885
  */
1037
- function get_outer_bounds(node: Opaque<"node">): gui.PIEBOUNDS;
886
+ function get_outer_bounds(node: Opaque<"node">): gui.PieBounds;
1038
887
  /**
1039
888
  * Returns the outline color of the supplied node.
1040
889
  * See gui.get_color for info how vectors encode color values.
@@ -1082,7 +931,7 @@ declare global {
1082
931
  * - `gui.PIVOT_W`
1083
932
  * - `gui.PIVOT_NW`
1084
933
  */
1085
- function get_pivot(node: Opaque<"node">): gui.PIVOT;
934
+ function get_pivot(node: Opaque<"node">): gui.Pivot;
1086
935
  /**
1087
936
  * Returns the position of the supplied node.
1088
937
  *
@@ -1140,7 +989,7 @@ declare global {
1140
989
  * @param node - node from which to get the size mode (node)
1141
990
  * @returns the current size mode
1142
991
  */
1143
- function get_size_mode(node: Opaque<"node">): gui.SIZE_MODE;
992
+ function get_size_mode(node: Opaque<"node">): gui.SizeMode;
1144
993
  /**
1145
994
  * Returns the slice9 configuration values for the node.
1146
995
  *
@@ -1174,16 +1023,16 @@ declare global {
1174
1023
  /**
1175
1024
  * Get a node and all its children as a Lua table.
1176
1025
  *
1177
- * @param node - root node to get node tree from
1026
+ * @param node - root node to get node tree from, or `nil` to get the whole scene; leaving the argument out raises an error
1178
1027
  * @returns a table mapping node ids to the corresponding nodes
1179
1028
  */
1180
- function get_tree(node: Opaque<"node">): LuaTable<Hash, Opaque<"node">> & { get: LuaTableGetMethod<string, Opaque<"node">> };
1029
+ function get_tree(node: Opaque<"node"> | undefined): LuaTable<Hash, Opaque<"node">> & { get: LuaTableGetMethod<string, Opaque<"node">> };
1181
1030
  /**
1182
1031
  * gets the node type
1183
1032
  *
1184
1033
  * @param node - node from which to get the type
1185
1034
  */
1186
- function get_type(node: Opaque<"node">): LuaMultiReturn<[gui.TYPE, number | undefined]>;
1035
+ function get_type(node: Opaque<"node">): LuaMultiReturn<[gui.Type, number | undefined]>;
1187
1036
  /**
1188
1037
  * Returns `true` if a node is visible and `false` if it's not.
1189
1038
  * Invisible nodes are not rendered.
@@ -1208,7 +1057,7 @@ declare global {
1208
1057
  * - `gui.ANCHOR_LEFT`
1209
1058
  * - `gui.ANCHOR_RIGHT`
1210
1059
  */
1211
- function get_xanchor(node: Opaque<"node">): gui.ANCHOR;
1060
+ function get_xanchor(node: Opaque<"node">): Exclude<gui.Anchor, typeof gui.ANCHOR_BOTTOM | typeof gui.ANCHOR_TOP>;
1212
1061
  /**
1213
1062
  * The y-anchor specifies how the node is moved when the game is run in a different resolution.
1214
1063
  *
@@ -1219,27 +1068,11 @@ declare global {
1219
1068
  * - `gui.ANCHOR_TOP`
1220
1069
  * - `gui.ANCHOR_BOTTOM`
1221
1070
  */
1222
- function get_yanchor(node: Opaque<"node">): gui.ANCHOR;
1071
+ function get_yanchor(node: Opaque<"node">): Exclude<gui.Anchor, typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_RIGHT>;
1223
1072
  /**
1224
1073
  * Hides the on-display touch keyboard on the device.
1225
1074
  */
1226
1075
  function hide_keyboard(): void;
1227
- /**
1228
- * This is a callback-function, which is called by the engine when a gui component is initialized. It can be used
1229
- * to set the initial state of the script and gui scene.
1230
- *
1231
- * @param self - script instance used for storing state
1232
- * @example
1233
- * ```ts
1234
- * export default defineScript({
1235
- * init() {
1236
- * // set up useful data
1237
- * return { my_value: 1 };
1238
- * },
1239
- * });
1240
- * ```
1241
- */
1242
- function init(self: unknown): void;
1243
1076
  /**
1244
1077
  * Returns `true` if a node is enabled and `false` if it's not.
1245
1078
  * Disabled nodes are not rendered and animations acting on them are not evaluated.
@@ -1357,76 +1190,66 @@ declare global {
1357
1190
  * }
1358
1191
  * ```
1359
1192
  */
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]>;
1361
- /**
1362
- * This is a callback-function, which is called by the engine when user input is sent to the instance of the gui component.
1363
- * It can be used to take action on the input, e.g. modify the gui according to the input.
1364
- * For an instance to obtain user input, it must first acquire input
1365
- * focus through the message `acquire_input_focus`.
1366
- * Any instance that has obtained input will be put on top of an
1367
- * input stack. Input is sent to all listeners on the stack until the
1368
- * end of stack is reached, or a listener returns `true`
1369
- * to signal that it wants input to be consumed.
1370
- * See the documentation of acquire_input_focus for more
1371
- * information.
1372
- *
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.**
1376
- * @returns optional boolean to signal if the input should be consumed (not passed on to others) or not, default is false
1193
+ function new_texture(texture_id: string | Hash, width: number, height: number, type: string | image.Type, buffer: string): LuaMultiReturn<[boolean, gui.Result | undefined]>;
1194
+ /**
1195
+ * Dynamically create a new texture.
1196
+ *
1197
+ * @param texture_id - texture id
1198
+ * @param width - texture width
1199
+ * @param height - texture height
1200
+ * @param type - texture type
1201
+ *
1202
+ * - `"rgb"` or `image.TYPE_RGB` - RGB
1203
+ * - `"rgba"` or `image.TYPE_RGBA` - RGBA
1204
+ * - `"l"` or `image.TYPE_LUMINANCE` - LUMINANCE
1205
+ * - `"astc"` - ASTC compressed format
1206
+ * @param buffer - texture data
1207
+ * @param flip - flip texture vertically
1377
1208
  * @example
1209
+ * How to create a texture and apply it to a new box node:
1378
1210
  * ```ts
1379
1211
  * export default defineGuiScript({
1380
- * init(): { my_value: number | undefined } {
1381
- * return { my_value: undefined };
1382
- * },
1212
+ * init(self) {
1213
+ * const w = 200;
1214
+ * const h = 300;
1383
1215
  *
1384
- * on_input(self, action_id, action) {
1385
- * // check for input
1386
- * if (action_id === hash("my_action")) {
1387
- * // take appropriate action
1388
- * self.my_value = action.value;
1216
+ * // A nice orange. String with the RGB values.
1217
+ * const orange = String.fromCharCode(0xff, 0x80, 0x10);
1218
+ *
1219
+ * // Create the texture. Repeat the color string for each pixel.
1220
+ * const [ok, reason] = gui.new_texture("orange_tx", w, h, "rgb", orange.repeat(w * h));
1221
+ * if (ok) {
1222
+ * // Create a box node and apply the texture to it.
1223
+ * const n = gui.new_box_node(vmath.vector3(200, 200, 0), vmath.vector3(w, h, 0));
1224
+ * gui.set_texture(n, "orange_tx");
1225
+ * } else {
1226
+ * // Could not create texture for some reason...
1227
+ * if (reason === gui.RESULT_TEXTURE_ALREADY_EXISTS) {
1228
+ * // ...
1229
+ * } else {
1230
+ * // ...
1231
+ * }
1389
1232
  * }
1390
- * // consume input
1391
- * return true;
1392
1233
  * },
1393
1234
  * });
1394
1235
  * ```
1395
- */
1396
- function on_input(self: unknown, action_id: Hash | undefined, action: go.on_input.action): boolean | undefined;
1397
- /**
1398
- * This is a callback-function, which is called by the engine whenever a message has been sent to the gui component.
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.
1400
- * The `message` parameter is a table containing the message data. If the message is sent from the engine, the
1401
- * documentation of the message specifies which data is supplied.
1402
- * See the update function for examples on how to use this callback-function.
1403
- *
1404
- * @param self - script instance used for storing state
1405
- * @param message_id - id of the received message
1406
- * @param message - a table containing the message data
1407
- * @param sender - address of the sender
1408
- */
1409
- function on_message(self: unknown, message_id: Hash, message: LuaMap<AnyNotNil, unknown> | Record<string, unknown>, sender: Url): void;
1410
- /**
1411
- * This is a callback-function, which is called by the engine when the gui script is reloaded, e.g. from the editor.
1412
- * It can be used for live development, e.g. to tweak constants or set up the state properly for the script.
1413
- *
1414
- * @param self - script instance used for storing state
1415
1236
  * @example
1237
+ * How to create a texture using .astc format
1416
1238
  * ```ts
1417
- * export default defineGuiScript({
1418
- * init() {
1419
- * return { my_original_color: gui.get_color(gui.get_node("my_node")) };
1420
- * },
1421
- *
1422
- * on_reload(self) {
1423
- * // restore some color (or similar)
1424
- * gui.set_color(gui.get_node("my_node"), self.my_original_color);
1425
- * },
1426
- * });
1239
+ * const size = 4;
1240
+ * const pos = vmath.vector3(200, 200, 0);
1241
+ * const path = "/assets/images/logo_4x4.astc";
1242
+ * const [data] = sys.load_resource(path);
1243
+ * if (data !== undefined) {
1244
+ * const n = gui.new_box_node(pos, vmath.vector3(size, size, 0));
1245
+ * // size is read from the .astc buffer
1246
+ * // flip is not supported
1247
+ * gui.new_texture(path, 0, 0, "astc", data, false);
1248
+ * gui.set_texture(n, path);
1249
+ * }
1427
1250
  * ```
1428
1251
  */
1429
- function on_reload(self: unknown): void;
1252
+ function new_texture(texture_id: string | Hash, width: number, height: number, type: string | image.Type, buffer: string, flip: boolean): LuaMultiReturn<[boolean, gui.Result | undefined]>;
1430
1253
  /**
1431
1254
  * Tests whether a coordinate is within the bounding box of a
1432
1255
  * node.
@@ -1479,7 +1302,50 @@ declare global {
1479
1302
  * gui.play_flipbook(node, "button");
1480
1303
  * ```
1481
1304
  */
1482
- function play_flipbook(node: Opaque<"node">, animation: string | Hash, complete_function?: (self: unknown, node: Opaque<"node">) => void, play_properties?: gui.play_properties): void;
1305
+ function play_flipbook(node: Opaque<"node">, animation: string | Hash, complete_function?: (self: unknown, node: Opaque<"node">) => void): void;
1306
+ /**
1307
+ * Play flipbook animation on a box or pie node.
1308
+ * The current node texture must contain the animation.
1309
+ * Use this function to set one-frame still images on the node.
1310
+ *
1311
+ * @param node - node to set animation for
1312
+ * @param animation - animation id
1313
+ * @param complete_function - optional function to call when the animation has completed
1314
+ *
1315
+ * `self`
1316
+ *
1317
+ * script_instance The current script instance.
1318
+ *
1319
+ * `node`
1320
+ *
1321
+ * node The node that is animated.
1322
+ * @param play_properties - optional playback properties
1323
+ * @example
1324
+ * Set the texture of a node to a flipbook animation from an atlas:
1325
+ * ```ts
1326
+ * function anim_callback(self: unknown, node: unknown) {
1327
+ * // Take action after animation has played.
1328
+ * }
1329
+ *
1330
+ * export default defineGuiScript({
1331
+ * init(self) {
1332
+ * // Create a new node and set the texture to a flipbook animation
1333
+ * const node = gui.get_node("button_node");
1334
+ * gui.set_texture(node, "gui_sprites");
1335
+ * gui.play_flipbook(node, "animated_button");
1336
+ * },
1337
+ * });
1338
+ * ```
1339
+ * @example
1340
+ * Set the texture of a node to an image from an atlas:
1341
+ * ```ts
1342
+ * // Create a new node and set the texture to a "button.png" from atlas
1343
+ * const node = gui.get_node("button_node");
1344
+ * gui.set_texture(node, "gui_sprites");
1345
+ * gui.play_flipbook(node, "button");
1346
+ * ```
1347
+ */
1348
+ function play_flipbook(node: Opaque<"node">, animation: string | Hash, complete_function: ((self: unknown, node: Opaque<"node">) => void) | undefined, play_properties: gui.PlayProperties): void;
1483
1349
  /**
1484
1350
  * Plays the paricle fx for a gui node
1485
1351
  *
@@ -1501,7 +1367,7 @@ declare global {
1501
1367
  * });
1502
1368
  * ```
1503
1369
  */
1504
- function play_particlefx(node: Opaque<"node">, emitter_state_function?: (self: unknown, node: Opaque<"node"> | undefined, emitter: Hash, state: particlefx.EMITTER_STATE) => void): void;
1370
+ function play_particlefx(node: Opaque<"node">, emitter_state_function?: (self: unknown, node: Opaque<"node"> | undefined, emitter: Hash, state: particlefx.EmitterState) => void): void;
1505
1371
  /**
1506
1372
  * Resets the input context of keyboard. This will clear marked text.
1507
1373
  */
@@ -1557,112 +1423,6 @@ declare global {
1557
1423
  * ```
1558
1424
  */
1559
1425
  function screen_to_local(node: Opaque<"node">, screen_position: Vector3 | Vector4): Vector3;
1560
- /**
1561
- * Instead of using specific setteres such as gui.set_position or gui.set_scale,
1562
- * you can use gui.set instead and supply the property as a string or a hash.
1563
- * While this function is similar to go.get and go.set, there are a few more restrictions
1564
- * when operating in the gui namespace. Most notably, only these named properties identifiers are supported:
1565
- *
1566
- * - `"position"`
1567
- * - `"rotation"`
1568
- * - `"euler"`
1569
- * - `"scale"`
1570
- * - `"color"`
1571
- * - `"outline"`
1572
- * - `"shadow"`
1573
- * - `"size"`
1574
- * - `"fill_angle"` (pie)
1575
- * - `"inner_radius"` (pie)
1576
- * - `"leading"` (text)
1577
- * - `"tracking"` (text)
1578
- * - `"slice9"` (slice9)
1579
- *
1580
- * 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.
1581
- * I.e when setting the "position" property, you need to use a vmath.vector4 and when setting a single component of the property,
1582
- * such as "position.x", you need to use a single value.
1583
- * 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,
1584
- * 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,
1585
- * use the "euler" property instead. The rotation and euler properties are linked, changing one of them will change the backing data of the other.
1586
- * 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
1587
- * 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())`
1588
- * 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.
1589
- * 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.
1590
- *
1591
- * @param node - node to set the property for, or msg.url() to the gui itself
1592
- * @param property - the property to set
1593
- * @param value - the property to set. `nil` is only supported for removing runtime texture mappings with `gui.set(msg.url(), "textures", nil, {key = ...})`.
1594
- * @param options - optional material-constant options. **⚠️ `index` is 1-based; passed to Defold unchanged.**
1595
- * @example
1596
- * Updates the position property on an existing node:
1597
- * ```ts
1598
- * const node = gui.get_node("my_box_node");
1599
- * const node_position = gui.get(node, "position") as Vector3;
1600
- * gui.set(node, "position.x", node_position.x + 128);
1601
- * ```
1602
- * @example
1603
- * Updates the rotation property on an existing node:
1604
- * ```ts
1605
- * const node = gui.get_node("my_box_node");
1606
- * gui.set(node, "rotation", vmath.quat_rotation_z(math.rad(45)));
1607
- * // this is equivalent to:
1608
- * gui.set(node, "euler.z", 45);
1609
- * // or using the entire vector:
1610
- * gui.set(node, "euler", vmath.vector3(0, 0, 45));
1611
- * // or using the set_rotation
1612
- * gui.set_rotation(node, vmath.vector3(0, 0, 45));
1613
- * ```
1614
- * @example
1615
- * Sets various material constants for a node:
1616
- * ```ts
1617
- * const node = gui.get_node("my_box_node");
1618
- * gui.set(node, "tint", vmath.vector4(1, 0, 0, 1));
1619
- * // matrix4 is also supported
1620
- * gui.set(node, "light_matrix", vmath.matrix4());
1621
- * // update a constant in an array at position 4. the array is specified in the shader as:
1622
- * // uniform vec4 tint_array[4]; // lua is 1 based, shader is 0 based
1623
- * gui.set(node, "tint_array", vmath.vector4(1, 0, 0, 1), { index: 4 });
1624
- * // update a matrix constant in an array at position 4. the array is specified in the shader as:
1625
- * // uniform mat4 light_matrix_array[4];
1626
- * gui.set(node, "light_matrix_array", vmath.matrix4(), { index: 4 });
1627
- * // update a sub-element in a constant
1628
- * gui.set(node, "tint.x", 1);
1629
- * // update a sub-element in an array constant at position 4
1630
- * gui.set(node, "tint_array.x", 1, { index: 4 });
1631
- * ```
1632
- * @example
1633
- * Set a named property
1634
- * ```ts
1635
- * export default defineGuiScript({
1636
- * on_message(self, message_id, message) {
1637
- * if (message_id === hash("set_font") && types.is_hash(message.font)) {
1638
- * gui.set(msg.url(), "fonts", message.font, { key: "my_font_name" });
1639
- * gui.set_font(gui.get_node("text"), "my_font_name");
1640
- * } else if (message_id === hash("set_texture") && types.is_hash(message.texture)) {
1641
- * gui.set(msg.url(), "textures", message.texture, { key: "my_texture" });
1642
- * gui.set_texture(gui.get_node("box"), "my_texture");
1643
- * gui.play_flipbook(gui.get_node("box"), "logo_256");
1644
- * }
1645
- * },
1646
- * });
1647
- * ```
1648
- * @example
1649
- * Remove a named runtime texture resource mapping:
1650
- * ```ts
1651
- * const atlas_params = {
1652
- * texture: "/runtime.texturec",
1653
- * animations: [{ id: "runtime", width: 1, height: 1, frames: [1] }],
1654
- * 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] }],
1655
- * } satisfies Parameters<typeof resource.create_atlas>[1];
1656
- * const atlas_id = resource.create_atlas("/runtime.texturesetc", atlas_params);
1657
- * gui.set(msg.url(), "textures", atlas_id, { key: "runtime_texture" });
1658
- * gui.set_texture(gui.get_node("box"), "runtime_texture");
1659
- *
1660
- * // Later, remove the GUI mapping before releasing the atlas resource.
1661
- * gui.set(msg.url(), "textures", undefined, { key: "runtime_texture" });
1662
- * resource.release(atlas_id);
1663
- * ```
1664
- */
1665
- 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;
1666
1426
  /**
1667
1427
  * Sets the adjust mode on a node.
1668
1428
  * The adjust mode defines how the node will adjust itself to screen
@@ -1671,7 +1431,7 @@ declare global {
1671
1431
  * @param node - node to set adjust mode for
1672
1432
  * @param adjust_mode - adjust mode to set
1673
1433
  */
1674
- function set_adjust_mode(node: Opaque<"node">, adjust_mode: gui.ADJUST): void;
1434
+ function set_adjust_mode(node: Opaque<"node">, adjust_mode: gui.Adjust): void;
1675
1435
  /**
1676
1436
  * sets the node alpha
1677
1437
  *
@@ -1686,7 +1446,7 @@ declare global {
1686
1446
  * @param node - node to set blend mode for
1687
1447
  * @param blend_mode - blend mode to set
1688
1448
  */
1689
- function set_blend_mode(node: Opaque<"node">, blend_mode: gui.BLEND): void;
1449
+ function set_blend_mode(node: Opaque<"node">, blend_mode: gui.Blend): void;
1690
1450
  /**
1691
1451
  * If node is set as an inverted clipping node, it will clip anything inside as opposed to outside.
1692
1452
  *
@@ -1703,7 +1463,7 @@ declare global {
1703
1463
  * - `gui.CLIPPING_MODE_NONE`
1704
1464
  * - `gui.CLIPPING_MODE_STENCIL`
1705
1465
  */
1706
- function set_clipping_mode(node: Opaque<"node">, clipping_mode: gui.CLIPPING_MODE): void;
1466
+ function set_clipping_mode(node: Opaque<"node">, clipping_mode: gui.ClippingMode): void;
1707
1467
  /**
1708
1468
  * 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.
1709
1469
  *
@@ -1868,7 +1628,7 @@ declare global {
1868
1628
  * @param node - node for which to set the outer bounds mode
1869
1629
  * @param bounds_mode - the outer bounds mode of the pie node
1870
1630
  */
1871
- function set_outer_bounds(node: Opaque<"node">, bounds_mode: gui.PIEBOUNDS): void;
1631
+ function set_outer_bounds(node: Opaque<"node">, bounds_mode: gui.PieBounds): void;
1872
1632
  /**
1873
1633
  * Sets the outline color of the supplied node.
1874
1634
  * See gui.set_color for info how vectors encode color values.
@@ -1915,7 +1675,7 @@ declare global {
1915
1675
  * - `gui.PIVOT_W`
1916
1676
  * - `gui.PIVOT_NW`
1917
1677
  */
1918
- function set_pivot(node: Opaque<"node">, pivot: gui.PIVOT): void;
1678
+ function set_pivot(node: Opaque<"node">, pivot: gui.Pivot): void;
1919
1679
  /**
1920
1680
  * Sets the position of the supplied node.
1921
1681
  *
@@ -1946,7 +1706,7 @@ declare global {
1946
1706
  *
1947
1707
  * @param mode - safe area mode
1948
1708
  */
1949
- function set_safe_area_mode(mode: gui.SAFE_AREA): void;
1709
+ function set_safe_area_mode(mode: gui.SafeArea): void;
1950
1710
  /**
1951
1711
  * Sets the scaling of the supplied node.
1952
1712
  *
@@ -1988,7 +1748,7 @@ declare global {
1988
1748
  * @param node - node to set size mode for
1989
1749
  * @param size_mode - size mode to set
1990
1750
  */
1991
- function set_size_mode(node: Opaque<"node">, size_mode: gui.SIZE_MODE): void;
1751
+ function set_size_mode(node: Opaque<"node">, size_mode: gui.SizeMode): void;
1992
1752
  /**
1993
1753
  * Set the slice9 configuration values for the node.
1994
1754
  *
@@ -2082,7 +1842,52 @@ declare global {
2082
1842
  * });
2083
1843
  * ```
2084
1844
  */
2085
- function set_texture_data(texture: string | Hash, width: number, height: number, type: string | image.TYPE, buffer: string, flip?: boolean): boolean;
1845
+ function set_texture_data(texture: string | Hash, width: number, height: number, type: string | image.Type, buffer: string): boolean;
1846
+ /**
1847
+ * Set the texture buffer data for a dynamically created texture.
1848
+ *
1849
+ * @param texture - texture id
1850
+ * @param width - texture width
1851
+ * @param height - texture height
1852
+ * @param type - texture type
1853
+ *
1854
+ * - `"rgb"` or `image.TYPE_RGB` - RGB
1855
+ * - `"rgba"` or `image.TYPE_RGBA` - RGBA
1856
+ * - `"l"` or `image.TYPE_LUMINANCE` - LUMINANCE
1857
+ * - `"astc"` - ASTC compressed format
1858
+ * @param buffer - texture data
1859
+ * @param flip - flip texture vertically
1860
+ * @returns setting the data was successful
1861
+ * @example
1862
+ * ```ts
1863
+ * export default defineGuiScript({
1864
+ * init(self) {
1865
+ * const w = 200;
1866
+ * const h = 300;
1867
+ *
1868
+ * // Create a dynamic texture, all white.
1869
+ * if (gui.new_texture("dynamic_tx", w, h, "rgb", String.fromCharCode(0xff).repeat(w * h * 3))) {
1870
+ * // Create a box node and apply the texture to it.
1871
+ * const n = gui.new_box_node(vmath.vector3(200, 200, 0), vmath.vector3(w, h, 0));
1872
+ * gui.set_texture(n, "dynamic_tx");
1873
+ *
1874
+ * // ...
1875
+ *
1876
+ * // Change the data in the texture to a nice orange.
1877
+ * const orange = String.fromCharCode(0xff, 0x80, 0x10);
1878
+ * if (gui.set_texture_data("dynamic_tx", w, h, "rgb", orange.repeat(w * h))) {
1879
+ * // Go on and to more stuff
1880
+ * // ...
1881
+ * }
1882
+ * } else {
1883
+ * // Something went wrong
1884
+ * // ...
1885
+ * }
1886
+ * },
1887
+ * });
1888
+ * ```
1889
+ */
1890
+ function set_texture_data(texture: string | Hash, width: number, height: number, type: string | image.Type, buffer: string, flip: boolean): boolean;
2086
1891
  /**
2087
1892
  * Sets the tracking value of a text node. This value is used to
2088
1893
  * adjust the vertical spacing of characters in the text.
@@ -2108,7 +1913,7 @@ declare global {
2108
1913
  * - `gui.ANCHOR_LEFT`
2109
1914
  * - `gui.ANCHOR_RIGHT`
2110
1915
  */
2111
- function set_xanchor(node: Opaque<"node">, anchor: gui.ANCHOR): void;
1916
+ function set_xanchor(node: Opaque<"node">, anchor: Exclude<gui.Anchor, typeof gui.ANCHOR_BOTTOM | typeof gui.ANCHOR_TOP>): void;
2112
1917
  /**
2113
1918
  * The y-anchor specifies how the node is moved when the game is run in a different resolution.
2114
1919
  *
@@ -2119,7 +1924,7 @@ declare global {
2119
1924
  * - `gui.ANCHOR_TOP`
2120
1925
  * - `gui.ANCHOR_BOTTOM`
2121
1926
  */
2122
- function set_yanchor(node: Opaque<"node">, anchor: gui.ANCHOR): void;
1927
+ function set_yanchor(node: Opaque<"node">, anchor: Exclude<gui.Anchor, typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_RIGHT>): void;
2123
1928
  /**
2124
1929
  * Shows the on-display touch keyboard.
2125
1930
  * The specified type of keyboard is displayed if it is available on
@@ -2129,64 +1934,22 @@ declare global {
2129
1934
  * @param type - keyboard type
2130
1935
  * @param autoclose - if the keyboard should automatically close when clicking outside
2131
1936
  */
2132
- function show_keyboard(type: gui.KEYBOARD_TYPE, autoclose: boolean): void;
1937
+ function show_keyboard(type: gui.KeyboardType, autoclose: boolean): void;
2133
1938
  /**
2134
1939
  * Stops the particle fx for a gui node
2135
1940
  *
2136
1941
  * @param node - node to stop particle fx for
2137
1942
  * @param options - options used when stopping the particle fx
2138
1943
  */
2139
- function stop_particlefx(node: Opaque<"node">, options?: particlefx.stop_options): void;
1944
+ function stop_particlefx(node: Opaque<"node">): void;
2140
1945
  /**
2141
- * This is a callback-function, which is called by the engine every frame to update the state of a gui component.
2142
- * It can be used to perform any kind of gui related tasks, e.g. animating nodes.
2143
- *
2144
- * @param self - script instance used for storing state
2145
- * @param dt - the time-step of the frame update
2146
- * @example
2147
- * ```ts
2148
- * // This example demonstrates how to update a text node that displays game score
2149
- * // in a counting fashion. It is assumed that the gui component receives messages
2150
- * // from the game when a new score is to be shown.
2151
- * export default defineGuiScript({
2152
- * init() {
2153
- * return {
2154
- * // fetch the score text node for later use (assumes it is called "score")
2155
- * score_node: gui.get_node("score"),
2156
- * // keep track of the current score counted up so far
2157
- * current_score: 0,
2158
- * // keep track of the target score we should count up to
2159
- * target_score: 0,
2160
- * // how fast we will update the score, in score/second
2161
- * score_update_speed: 1,
2162
- * };
2163
- * },
2164
- *
2165
- * update(self, dt) {
2166
- * // check if target score is more than current score
2167
- * if (self.current_score < self.target_score) {
2168
- * // increment current score according to the speed
2169
- * self.current_score = self.current_score + dt * self.score_update_speed;
2170
- * // check if we went past the target score, clamp current score in that case
2171
- * if (self.current_score > self.target_score) {
2172
- * self.current_score = self.target_score;
2173
- * }
2174
- * // update the score text node
2175
- * gui.set_text(self.score_node, "" + math.floor(self.current_score));
2176
- * }
2177
- * },
1946
+ * Stops the particle fx for a gui node
2178
1947
  *
2179
- * on_message(self, message_id, message) {
2180
- * // check the message
2181
- * if (message_id === hash("set_score") && typeof message.score === "number") {
2182
- * self.target_score = message.score;
2183
- * }
2184
- * },
2185
- * });
2186
- * ```
1948
+ * @param node - node to stop particle fx for
1949
+ * @param options - options used when stopping the particle fx
2187
1950
  */
2188
- function update(self: unknown, dt: number): void;
2189
- interface properties {
1951
+ function stop_particlefx(node: Opaque<"node">, options: particlefx.StopOptions): void;
1952
+ interface Properties {
2190
1953
  /**
2191
1954
  * The fonts used in the gui. The type of the property is hash.
2192
1955
  * Key must be specified in options table.