@ts-defold/types 1.2.40 → 1.2.42

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 (2) hide show
  1. package/index.d.ts +639 -32
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  /// <reference types="lua-types/5.1" />
3
3
  /// <reference types="@typescript-to-lua/language-extensions" />
4
4
 
5
- // DEFOLD. stable version 1.6.4 (fcec9500fd438e365d4e4f6cec24b99afb907247)
5
+ // DEFOLD. stable version 1.8.0 (ef07c036b8f7d34f4b1d7fcc355ce46a92d2dcc8)
6
6
  // =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
7
7
 
8
8
 
@@ -223,6 +223,338 @@ declare namespace socket {
223
223
  // =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
224
224
 
225
225
 
226
+ declare namespace b2d {
227
+
228
+ /**
229
+ * Get the Box2D body from a collision object
230
+ * @param url the url to the game object collision component
231
+ * @return body the body if successful. Otherwise `nil`.
232
+ */
233
+ export function get_body(url: url): any
234
+
235
+ /**
236
+ * Get the Box2D world from the current collection
237
+ * @return world the world if successful. Otherwise `nil`.
238
+ */
239
+ export function get_world(): any
240
+
241
+ }
242
+ // =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
243
+
244
+
245
+ declare namespace b2d.body {
246
+
247
+ /**
248
+ * Dynamic body
249
+ */
250
+ export let B2_DYNAMIC_BODY: any
251
+
252
+ /**
253
+ * Kinematic body
254
+ */
255
+ export let B2_KINEMATIC_BODY: any
256
+
257
+ /**
258
+ * Static (immovable) body
259
+ */
260
+ export let B2_STATIC_BODY: any
261
+
262
+ /**
263
+ * Apply an angular impulse.
264
+ * @param impulse impulse the angular impulse in units of kg*m*m/s
265
+ */
266
+ export function apply_angular_impulse(impulse: number): void
267
+
268
+ /**
269
+ * Apply a force at a world point. If the force is not
270
+ * applied at the center of mass, it will generate a torque and
271
+ * affect the angular velocity. This wakes up the body.
272
+ * @param force the world force vector, usually in Newtons (N).
273
+ * @param point the world position of the point of application.
274
+ */
275
+ export function apply_force(force: vmath.vector3, point: vmath.vector3): void
276
+
277
+ /**
278
+ * Apply a force to the center of mass. This wakes up the body.
279
+ * @param force the world force vector, usually in Newtons (N).
280
+ */
281
+ export function apply_force_to_center(force: vmath.vector3): void
282
+
283
+ /**
284
+ * Apply an impulse at a point. This immediately modifies the velocity.
285
+ * It also modifies the angular velocity if the point of application
286
+ * is not at the center of mass. This wakes up the body.
287
+ * @param impulse the world impulse vector, usually in N-seconds or kg-m/s.
288
+ * @param point the world position of the point of application.
289
+ */
290
+ export function apply_linear_impulse(impulse: vmath.vector3, point: vmath.vector3): void
291
+
292
+ /**
293
+ * Apply a torque. This affects the angular velocity
294
+ * without affecting the linear velocity of the center of mass.
295
+ * This wakes up the body.
296
+ * @param torque torque about the z-axis (out of the screen), usually in N-m.
297
+ */
298
+ export function apply_torque(torque: number): void
299
+
300
+ /**
301
+ * Print the body representation to the log output
302
+ */
303
+ export function dump(): void
304
+
305
+ /**
306
+ * Get the angular damping of the body.
307
+ * @return damping the damping
308
+ */
309
+ export function get_angular_damping(): number
310
+
311
+ /**
312
+ * Set the angular velocity.
313
+ * @param omega the new angular velocity in radians/second.
314
+ */
315
+ export function get_angular_velocity(omega: number): void
316
+
317
+ /**
318
+ * Get the angular velocity.
319
+ * @return velocity the angular velocity in radians/second.
320
+ */
321
+ export function get_angular_velocity(): number
322
+
323
+ /**
324
+ * Get the gravity scale of the body.
325
+ * @return scale the scale
326
+ */
327
+ export function get_gravity_scale(): number
328
+
329
+ /**
330
+ * Get the rotational inertia of the body about the local origin.
331
+ * @return inertia the rotational inertia, usually in kg-m^2.
332
+ */
333
+ export function get_inertia(): number
334
+
335
+ /**
336
+ * Get the linear damping of the body.
337
+ * @return damping the damping
338
+ */
339
+ export function get_linear_damping(): number
340
+
341
+ /**
342
+ * Get the linear velocity of the center of mass.
343
+ * @return velocity the linear velocity of the center of mass.
344
+ */
345
+ export function get_linear_velocity(): vmath.vector3
346
+
347
+ /**
348
+ * Get the world linear velocity of a world point attached to this body.
349
+ * @param world_point a point in world coordinates.
350
+ * @return velocity the world velocity of a point.
351
+ */
352
+ export function get_linear_velocity_from_world_point(world_point: vmath.vector3): vmath.vector3
353
+
354
+ /**
355
+ * Get the world velocity of a local point.
356
+ * @param world_point a point in local coordinates.
357
+ * @return velocity the world velocity of a point.
358
+ */
359
+ export function get_linear_velocity_from_world_point(world_point: vmath.vector3): vmath.vector3
360
+
361
+ /**
362
+ * Get the local position of the center of mass.
363
+ * @return center Get the local position of the center of mass.
364
+ */
365
+ export function get_local_center(): vmath.vector3
366
+
367
+ /**
368
+ * Gets a local point relative to the body's origin given a world point.
369
+ * @param world_point a point in world coordinates.
370
+ * @return vector the corresponding local point relative to the body's origin.
371
+ */
372
+ export function get_local_point(world_point: vmath.vector3): vmath.vector3
373
+
374
+ /**
375
+ * Gets a local vector given a world vector.
376
+ * @param world_vector a vector in world coordinates.
377
+ * @return vector the corresponding local vector.
378
+ */
379
+ export function get_local_vector(world_vector: vmath.vector3): vmath.vector3
380
+
381
+ /**
382
+ * Get the total mass of the body.
383
+ * @return mass the mass, usually in kilograms (kg).
384
+ */
385
+ export function get_mass(): number
386
+
387
+ /**
388
+ * Get the next body in the world's body list.
389
+ * @return body the next body
390
+ */
391
+ export function get_next(): any
392
+
393
+ /**
394
+ * Get the world body origin position.
395
+ * @return position the world position of the body's origin.
396
+ */
397
+ export function get_position(): vmath.vector3
398
+
399
+ /**
400
+ * Get the type of this body.
401
+ * @return type the body type
402
+ */
403
+ export function get_type(): any
404
+
405
+ /**
406
+ * Get the parent world of this body.
407
+ * @return world
408
+ */
409
+ export function get_world(): any
410
+
411
+ /**
412
+ * Get the angle in radians.
413
+ * @return angle the current world rotation angle in radians.
414
+ */
415
+ export function get_world_center(): number
416
+
417
+ /**
418
+ * Get the world position of the center of mass.
419
+ * @return center Get the world position of the center of mass.
420
+ */
421
+ export function get_world_center(): vmath.vector3
422
+
423
+ /**
424
+ * Get the world coordinates of a point given the local coordinates.
425
+ * @param local_vector localPoint a point on the body measured relative the the body's origin.
426
+ * @return vector the same point expressed in world coordinates.
427
+ */
428
+ export function get_world_point(local_vector: vmath.vector3): vmath.vector3
429
+
430
+ /**
431
+ * Get the world coordinates of a vector given the local coordinates.
432
+ * @param local_vector a vector fixed in the body.
433
+ * @return vector the same vector expressed in world coordinates.
434
+ */
435
+ export function get_world_vector(local_vector: vmath.vector3): vmath.vector3
436
+
437
+ /**
438
+ * Get the active state of the body.
439
+ * @return enabled is the body active
440
+ */
441
+ export function is_active(): any
442
+
443
+ /**
444
+ * Get the sleeping state of this body.
445
+ * @return enabled true if the body is awake, false if it's sleeping.
446
+ */
447
+ export function is_awake(): any
448
+
449
+ /**
450
+ * Is this body in bullet mode
451
+ * @return enabled true if the body is in bullet mode
452
+ */
453
+ export function is_bullet(): any
454
+
455
+ /**
456
+ * Does this body have fixed rotation?
457
+ * @return enabled is the rotation fixed
458
+ */
459
+ export function is_fixed_rotation(): any
460
+
461
+ /**
462
+ * Is this body allowed to sleep
463
+ * @return enabled true if the body is allowed to sleep
464
+ */
465
+ export function is_sleeping_allowed(): any
466
+
467
+ /**
468
+ * This resets the mass properties to the sum of the mass properties of the fixtures.
469
+ * This normally does not need to be called unless you called SetMassData to override
470
+ */
471
+ export function reset_mass_data(): void
472
+
473
+ /**
474
+ * Set the active state of the body. An inactive body is not
475
+ * simulated and cannot be collided with or woken up.
476
+ * If you pass a flag of true, all fixtures will be added to the
477
+ * broad-phase.
478
+ * If you pass a flag of false, all fixtures will be removed from
479
+ * the broad-phase and all contacts will be destroyed.
480
+ * Fixtures and joints are otherwise unaffected. You may continue
481
+ * to create/destroy fixtures and joints on inactive bodies.
482
+ * Fixtures on an inactive body are implicitly inactive and will
483
+ * not participate in collisions, ray-casts, or queries.
484
+ * Joints connected to an inactive body are implicitly inactive.
485
+ * An inactive body is still owned by a b2World object and remains
486
+ * in the body list.
487
+ * @param enable true if the body should be active
488
+ */
489
+ export function set_active(enable: any): void
490
+
491
+ /**
492
+ * Set the angular damping of the body.
493
+ * @param damping the damping
494
+ */
495
+ export function set_angular_damping(damping: number): void
496
+
497
+ /**
498
+ * Set the sleep state of the body. A sleeping body has very low CPU cost.
499
+ * @param enable flag set to false to put body to sleep, true to wake it.
500
+ */
501
+ export function set_awake(enable: any): void
502
+
503
+ /**
504
+ * Should this body be treated like a bullet for continuous collision detection?
505
+ * @param enable if true, the body will be in bullet mode
506
+ */
507
+ export function set_bullet(enable: any): void
508
+
509
+ /**
510
+ * Set this body to have fixed rotation. This causes the mass to be reset.
511
+ * @param enable true if the rotation should be fixed
512
+ */
513
+ export function set_fixed_rotation(enable: any): void
514
+
515
+ /**
516
+ * Set the gravity scale of the body.
517
+ * @param scale the scale
518
+ */
519
+ export function set_gravity_scale(scale: number): void
520
+
521
+ /**
522
+ * Set the linear damping of the body.
523
+ * @param damping the damping
524
+ */
525
+ export function set_linear_damping(damping: number): void
526
+
527
+ /**
528
+ * Set the linear velocity of the center of mass.
529
+ * @param velocity the new linear velocity of the center of mass.
530
+ */
531
+ export function set_linear_velocity(velocity: vmath.vector3): void
532
+
533
+ /**
534
+ * You can disable sleeping on this body. If you disable sleeping, the body will be woken.
535
+ * @param enable if false, the body will never sleep, and consume more CPU
536
+ */
537
+ export function set_sleeping_allowed(enable: any): void
538
+
539
+ /**
540
+ * Set the position of the body's origin and rotation.
541
+ * This breaks any contacts and wakes the other bodies.
542
+ * Manipulating a body's transform may cause non-physical behavior.
543
+ * @param position the world position of the body's local origin.
544
+ * @param angle the world position of the body's local origin.
545
+ */
546
+ export function set_transform(position: vmath.vector3, angle: number): void
547
+
548
+ /**
549
+ * Set the type of this body. This may alter the mass and velocity.
550
+ * @param type the body type
551
+ */
552
+ export function set_type(type: any): void
553
+
554
+ }
555
+ // =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
556
+
557
+
226
558
  declare namespace crash {
227
559
 
228
560
  /**
@@ -912,6 +1244,22 @@ name of internal property
912
1244
  */
913
1245
  export function set_scale(scale: number | vmath.vector3, id?: string | hash | url): void
914
1246
 
1247
+ /**
1248
+ * ⚠ The function uses world transformation calculated at the end of previous frame.
1249
+ * @param position position which need to be converted
1250
+ * @param url url of the game object which coordinate system convert to
1251
+ * @return converted_postion converted position
1252
+ */
1253
+ export function world_to_local_position(position: vmath.vector3, url: string | hash | url): vmath.vector3
1254
+
1255
+ /**
1256
+ * ⚠ The function uses world transformation calculated at the end of previous frame.
1257
+ * @param transformation transformation which need to be converted
1258
+ * @param url url of the game object which coordinate system convert to
1259
+ * @return converted_transform converted transformation
1260
+ */
1261
+ export function world_to_local_transform(transformation: vmath.matrix4, url: string | hash | url): vmath.matrix4
1262
+
915
1263
 
916
1264
 
917
1265
 
@@ -1022,6 +1370,11 @@ declare namespace gui {
1022
1370
  */
1023
1371
  export let BLEND_MULT: any
1024
1372
 
1373
+ /**
1374
+ * screen blending
1375
+ */
1376
+ export let BLEND_SCREEN: any
1377
+
1025
1378
  /**
1026
1379
  * clipping mode none
1027
1380
  */
@@ -1347,6 +1700,11 @@ declare namespace gui {
1347
1700
  */
1348
1701
  export let PROP_COLOR: any
1349
1702
 
1703
+ /**
1704
+ * euler property
1705
+ */
1706
+ export let PROP_EULER: any
1707
+
1350
1708
  /**
1351
1709
  * fill_angle property
1352
1710
  */
@@ -1438,6 +1796,7 @@ declare namespace gui {
1438
1796
 
1439
1797
  - `"position"`
1440
1798
  - `"rotation"`
1799
+ - `"euler"`
1441
1800
  - `"scale"`
1442
1801
  - `"color"`
1443
1802
  - `"outline"`
@@ -1451,6 +1810,7 @@ The following property constants are defined equaling the corresponding property
1451
1810
 
1452
1811
  - `gui.PROP_POSITION`
1453
1812
  - `gui.PROP_ROTATION`
1813
+ - `gui.PROP_EULER`
1454
1814
  - `gui.PROP_SCALE`
1455
1815
  - `gui.PROP_COLOR`
1456
1816
  - `gui.PROP_OUTLINE`
@@ -1487,6 +1847,7 @@ with a custom curve. See the animation guide for more information.
1487
1847
 
1488
1848
  - `"position"`
1489
1849
  - `"rotation"`
1850
+ - `"euler"`
1490
1851
  - `"scale"`
1491
1852
  - `"color"`
1492
1853
  - `"outline"`
@@ -1537,6 +1898,31 @@ with a custom curve. See the animation guide for more information.
1537
1898
  */
1538
1899
  export function delete_texture(texture: string | hash): void
1539
1900
 
1901
+ /**
1902
+ * Instead of using specific getters such as gui.get_position or gui.get_scale,
1903
+ * you can use gui.get instead and supply the property as a string or a hash.
1904
+ * While this function is similar to go.get, there are a few more restrictions
1905
+ * when operating in the gui namespace. Most notably, only these propertie identifiers are supported:
1906
+ *
1907
+ * - `"position"`
1908
+ * - `"rotation"`
1909
+ * - `"euler"`
1910
+ * - `"scale"`
1911
+ * - `"color"`
1912
+ * - `"outline"`
1913
+ * - `"shadow"`
1914
+ * - `"size"`
1915
+ * - `"fill_angle"` (pie)
1916
+ * - `"inner_radius"` (pie)
1917
+ * - `"slice9"` (slice9)
1918
+ *
1919
+ * The value returned will either be a vmath.vector4 or a single number, i.e getting the "position"
1920
+ * property will return a vec4 while getting the "position.x" property will return a single value.
1921
+ * @param node node to get the property for
1922
+ * @param property the property to retrieve
1923
+ */
1924
+ export function get(node: node, property: any): void
1925
+
1540
1926
  /**
1541
1927
  * Returns the adjust mode of a node.
1542
1928
  * The adjust mode defines how the node will adjust itself to screen
@@ -1567,6 +1953,7 @@ with a custom curve. See the animation guide for more information.
1567
1953
  - `gui.BLEND_ADD`
1568
1954
  - `gui.BLEND_ADD_ALPHA`
1569
1955
  - `gui.BLEND_MULT`
1956
+ - `gui.BLEND_SCREEN`
1570
1957
 
1571
1958
  */
1572
1959
  export function get_blend_mode(node: node): any
@@ -1630,6 +2017,14 @@ with a custom curve. See the animation guide for more information.
1630
2017
  */
1631
2018
  export function get_color(node: node): vmath.vector4
1632
2019
 
2020
+ /**
2021
+ * Returns the rotation of the supplied node.
2022
+ * The rotation is expressed in degree Euler angles.
2023
+ * @param node node to get the rotation from
2024
+ * @return rotation node rotation
2025
+ */
2026
+ export function get_euler(node: node): vmath.vector3
2027
+
1633
2028
  /**
1634
2029
  * Returns the sector angle of a pie node.
1635
2030
  * @param node node from which to get the fill angle
@@ -1819,11 +2214,11 @@ with a custom curve. See the animation guide for more information.
1819
2214
 
1820
2215
  /**
1821
2216
  * Returns the rotation of the supplied node.
1822
- * The rotation is expressed in degree Euler angles.
2217
+ * The rotation is expressed as a quaternion
1823
2218
  * @param node node to get the rotation from
1824
2219
  * @return rotation node rotation
1825
2220
  */
1826
- export function get_rotation(node: node): vmath.vector3
2221
+ export function get_rotation(node: node): vmath.quaternion
1827
2222
 
1828
2223
  /**
1829
2224
  * Returns the scale of the supplied node.
@@ -2013,7 +2408,7 @@ with a custom curve. See the animation guide for more information.
2013
2408
 
2014
2409
  /**
2015
2410
  * Dynamically create a new texture.
2016
- * @param texture texture id
2411
+ * @param texture_id texture id
2017
2412
  * @param width texture width
2018
2413
  * @param height texture height
2019
2414
  * @param type texture type
@@ -2027,7 +2422,7 @@ with a custom curve. See the animation guide for more information.
2027
2422
  * @return success texture creation was successful
2028
2423
  * @return code one of the gui.RESULT_* codes if unsuccessful
2029
2424
  */
2030
- export function new_texture(texture: string | hash, width: number, height: number, type: any, buffer: string, flip: boolean): LuaMultiReturn<[boolean, number]>
2425
+ export function new_texture(texture_id: string | hash, width: number, height: number, type: any, buffer: string, flip: boolean): LuaMultiReturn<[boolean, number]>
2031
2426
 
2032
2427
  /**
2033
2428
  * Tests whether a coordinate is within the bounding box of a
@@ -2115,6 +2510,36 @@ the new state of the emitter:
2115
2510
  */
2116
2511
  export function screen_to_local(node: node, screen_position: vmath.vector3): vmath.vector3
2117
2512
 
2513
+ /**
2514
+ * Instead of using specific setteres such as gui.set_position or gui.set_scale,
2515
+ * you can use gui.set instead and supply the property as a string or a hash.
2516
+ * While this function is similar to go.get and go.set, there are a few more restrictions
2517
+ * when operating in the gui namespace. Most notably, only these propertie identifiers are supported:
2518
+ *
2519
+ * - `"position"`
2520
+ * - `"rotation"`
2521
+ * - `"euler"`
2522
+ * - `"scale"`
2523
+ * - `"color"`
2524
+ * - `"outline"`
2525
+ * - `"shadow"`
2526
+ * - `"size"`
2527
+ * - `"fill_angle"` (pie)
2528
+ * - `"inner_radius"` (pie)
2529
+ * - `"slice9"` (slice9)
2530
+ *
2531
+ * 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.
2532
+ * I.e when setting the "position" property, you need to use a vmath.vector4 and when setting a single component of the property,
2533
+ * such as "position.x", you need to use a single value.
2534
+ * 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,
2535
+ * 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,
2536
+ * use the "euler" property instead. The rotation and euler properties are linked, changing one of them will change the backing data of the other.
2537
+ * @param node node to set the property for
2538
+ * @param property the property to set
2539
+ * @param value the property to set
2540
+ */
2541
+ export function set(node: node, property: any, value: number | vmath.vector4 | vmath.vector3 | vmath.quaternion): void
2542
+
2118
2543
  /**
2119
2544
  * Sets the adjust mode on a node.
2120
2545
  * The adjust mode defines how the node will adjust itself to screen
@@ -2146,6 +2571,7 @@ the new state of the emitter:
2146
2571
  - `gui.BLEND_ADD`
2147
2572
  - `gui.BLEND_ADD_ALPHA`
2148
2573
  - `gui.BLEND_MULT`
2574
+ - `gui.BLEND_SCREEN`
2149
2575
 
2150
2576
  */
2151
2577
  export function set_blend_mode(node: node, blend_mode: any): void
@@ -2217,6 +2643,14 @@ the new state of the emitter:
2217
2643
  */
2218
2644
  export function set_enabled(node: node, enabled: boolean): void
2219
2645
 
2646
+ /**
2647
+ * Sets the rotation of the supplied node.
2648
+ * The rotation is expressed in degree Euler angles.
2649
+ * @param node node to set the rotation for
2650
+ * @param rotation new rotation
2651
+ */
2652
+ export function set_euler(node: node, rotation: vmath.vector3 | vmath.vector4): void
2653
+
2220
2654
  /**
2221
2655
  * Set the sector angle of a pie node.
2222
2656
  * @param node node to set the fill angle for
@@ -2383,11 +2817,11 @@ the new state of the emitter:
2383
2817
 
2384
2818
  /**
2385
2819
  * Sets the rotation of the supplied node.
2386
- * The rotation is expressed in degree Euler angles.
2820
+ * The rotation is expressed as a quaternion
2387
2821
  * @param node node to set the rotation for
2388
2822
  * @param rotation new rotation
2389
2823
  */
2390
- export function set_rotation(node: node, rotation: vmath.vector3 | vmath.vector4): void
2824
+ export function set_rotation(node: node, rotation: vmath.quaternion | vmath.vector4): void
2391
2825
 
2392
2826
  /**
2393
2827
  * Sets the scaling of the supplied node.
@@ -3562,7 +3996,8 @@ declare namespace render {
3562
3996
  export function constant_buffer(): any
3563
3997
 
3564
3998
  /**
3565
- * Deletes a previously created render target.
3999
+ * Deletes a render target created by a render script.
4000
+ * You cannot delete a render target resource.
3566
4001
  * @param render_target render target to delete
3567
4002
  */
3568
4003
  export function delete_render_target(render_target: any): void
@@ -3589,10 +4024,10 @@ declare namespace render {
3589
4024
  export function disable_state(state: any): void
3590
4025
 
3591
4026
  /**
3592
- * Disables a texture unit for a render target that has previourly been enabled.
3593
- * @param unit texture unit to disable
4027
+ * Disables a texture that has previourly been enabled.
4028
+ * @param binding texture binding, either by texture unit, string or hash that should be disabled
3594
4029
  */
3595
- export function disable_texture(unit: number): void
4030
+ export function disable_texture(binding: number | string | hash): void
3596
4031
 
3597
4032
  /**
3598
4033
  * Draws all objects that match a specified predicate. An optional constant buffer can be
@@ -3658,11 +4093,19 @@ Determines which sides of the frustum will be used. Default is render.FRUSTUM_PL
3658
4093
  export function enable_state(state: any): void
3659
4094
 
3660
4095
  /**
3661
- * Sets the specified render target's specified buffer to be
3662
- * used as texture with the specified unit.
3663
- * A material shader can then use the texture to sample from.
3664
- * @param unit texture unit to enable texture for
3665
- * @param render_target render target or texture from which to enable the specified texture unit
4096
+ * Sets the specified texture handle for a render target attachment or a regular texture
4097
+ * that should be used for rendering. The texture can be bound to either a texture unit
4098
+ * or to a sampler name by a hash or a string.
4099
+ * A texture can be bound to multiple units and sampler names at the same time,
4100
+ * the actual binding will be applied to the shaders when a shader program is bound.
4101
+ * When mixing binding using both units and sampler names, you might end up in situations
4102
+ * where two different textures will be applied to the same bind location in the shader.
4103
+ * In this case, the texture set to the named sampler will take precedence over the unit.
4104
+ * Note that you can bind multiple sampler names to the same texture, in case you want to reuse
4105
+ * the same texture for differnt use-cases. It is however recommended that you use the same name
4106
+ * everywhere for the textures that should be shared across different materials.
4107
+ * @param binding texture binding, either by texture unit, string or hash for the sampler name that the texture should be bound to
4108
+ * @param handle_or_name render target or texture handle that should be bound, or a named resource in the "Render Resource" table in the currently assigned .render file
3666
4109
  * @param buffer_type optional buffer type from which to enable the texture. Note that this argument only applies to render targets. Defaults to `render.BUFFER_COLOR_BIT`. These values are supported:
3667
4110
 
3668
4111
  - `render.BUFFER_COLOR_BIT`
@@ -3681,7 +4124,7 @@ to enable those textures as well. Currently 4 color attachments are supported:
3681
4124
  - `render.BUFFER_COLOR3_BIT`
3682
4125
 
3683
4126
  */
3684
- export function enable_texture(unit: number, render_target: any, buffer_type?: any): void
4127
+ export function enable_texture(binding: number | string | hash, handle_or_name: any, buffer_type?: any): void
3685
4128
 
3686
4129
  /**
3687
4130
  * Returns the logical window height that is set in the "game.project" settings.
@@ -4004,6 +4447,7 @@ to enable those textures as well. Currently 4 color attachments are supported:
4004
4447
  /**
4005
4448
  * Sets a render target. Subsequent draw operations will be to the
4006
4449
  * render target until it is replaced by a subsequent call to set_render_target.
4450
+ * This function supports render targets created by a render script, or a render target resource.
4007
4451
  * @param render_target render target to set. render.RENDER_TARGET_DEFAULT to set the default render target
4008
4452
  * @param options optional table with behaviour parameters
4009
4453
 
@@ -4021,7 +4465,8 @@ Transient frame buffer types are only valid while the render target is active, i
4021
4465
  export function set_render_target(render_target: any, options?: any): void
4022
4466
 
4023
4467
  /**
4024
- * sets the render target size
4468
+ * Sets the render target size for a render target created from
4469
+ * either a render script, or from a render target resource.
4025
4470
  * @param render_target render target to set size for
4026
4471
  * @param width new render target width
4027
4472
  * @param height new render target height
@@ -4307,7 +4752,7 @@ declare namespace resource {
4307
4752
  * Note that releasing a resource essentially means decreasing the reference count of that resource,
4308
4753
  * and not necessarily that it will be deleted.
4309
4754
  * @param path The path to the resource.
4310
- * @param table A table containing info about how to create the texture. Supported entries:
4755
+ * @param table A table containing info about how to create the atlas. Supported entries:
4311
4756
 
4312
4757
 
4313
4758
 
@@ -4383,6 +4828,12 @@ A list of the geometries that should map to the texture data. Supports the follo
4383
4828
 
4384
4829
 
4385
4830
 
4831
+ `id`
4832
+ The name of the geometry. Used when matching animations between multiple atlases
4833
+
4834
+
4835
+
4836
+
4386
4837
  `vertices`
4387
4838
  a list of the vertices in texture space of the geometry in the form {px0, py0, px1, py1, ..., pxn, pyn}
4388
4839
 
@@ -4439,6 +4890,7 @@ optional flag to determine wether or not the resource should take over ownership
4439
4890
  * registered will trigger an error. If the intention is to instead modify an existing texture, use the resource.set_texture
4440
4891
  * function. Also note that the path to the new texture resource must have a '.texturec' extension,
4441
4892
  * meaning "/path/my_texture" is not a valid path but "/path/my_texture.texturec" is.
4893
+ * If the texture is created without a buffer, the pixel data will be blank.
4442
4894
  * @param path The path to the resource.
4443
4895
  * @param table A table containing info about how to create the texture. Supported entries:
4444
4896
 
@@ -4451,9 +4903,9 @@ The texture type. Supported values:
4451
4903
 
4452
4904
 
4453
4905
  `width`
4454
- The width of the texture (in pixels)
4906
+ The width of the texture (in pixels). Must be larger than 0.
4455
4907
  `height`
4456
- The width of the texture (in pixels)
4908
+ The width of the texture (in pixels). Must be larger than 0.
4457
4909
  `format`
4458
4910
  The texture format, note that some of these formats might not be supported by the running device. Supported values:
4459
4911
 
@@ -4463,6 +4915,7 @@ The texture format, note that some of these formats might not be supported by th
4463
4915
  - `resource.TEXTURE_FORMAT_RGBA`
4464
4916
 
4465
4917
  These constants might not be available on the device:
4918
+
4466
4919
  - `resource.TEXTURE_FORMAT_RGB_PVRTC_2BPPV1`
4467
4920
  - `resource.TEXTURE_FORMAT_RGB_PVRTC_4BPPV1`
4468
4921
  - `resource.TEXTURE_FORMAT_RGBA_PVRTC_2BPPV1`
@@ -4483,6 +4936,7 @@ These constants might not be available on the device:
4483
4936
  - `resource.TEXTURE_FORMAT_RG16F`
4484
4937
  - `resource.TEXTURE_FORMAT_R32F`
4485
4938
  - `resource.TEXTURE_FORMAT_RG32F`
4939
+
4486
4940
  You can test if the device supports these values by checking if a specific enum is nil or not:
4487
4941
  `if resource.TEXTURE_FORMAT_RGBA16F ~= nil then
4488
4942
  -- it is safe to use this format
@@ -4505,6 +4959,85 @@ Creating an empty texture with no buffer data is not supported as a core feature
4505
4959
  */
4506
4960
  export function create_texture(path: string, table: any, buffer?: buffer): hash
4507
4961
 
4962
+ /**
4963
+ * Creates a new texture resource that can be used in the same way as any texture created during build time.
4964
+ * The path used for creating the texture must be unique, trying to create a resource at a path that is already
4965
+ * registered will trigger an error. If the intention is to instead modify an existing texture, use the resource.set_texture
4966
+ * function. Also note that the path to the new texture resource must have a '.texturec' extension,
4967
+ * meaning "/path/my_texture" is not a valid path but "/path/my_texture.texturec" is.
4968
+ * If the texture is created without a buffer, the pixel data will be blank.
4969
+ * The difference between the async version and resource.create_texture is that the texture data will be uploaded
4970
+ * in a graphics worker thread. The function will return a resource immediately that contains a 1x1 blank texture which can be used
4971
+ * immediately after the function call. When the new texture has been uploaded, the initial blank texture will be deleted and replaced with the
4972
+ * new texture. Be careful when using the initial texture handle handle as it will not be valid after the upload has finished.
4973
+ * @param path The path to the resource.
4974
+ * @param table
4975
+ A table containing info about how to create the texture. Supported entries:
4976
+ `type`
4977
+ The texture type. Supported values:
4978
+
4979
+
4980
+ - `resource.TEXTURE_TYPE_2D`
4981
+ - `resource.TEXTURE_TYPE_CUBE_MAP`
4982
+
4983
+
4984
+ `width`
4985
+ The width of the texture (in pixels). Must be larger than 0.
4986
+ `height`
4987
+ The width of the texture (in pixels). Must be larger than 0.
4988
+ `format`
4989
+ The texture format, note that some of these formats might not be supported by the running device. Supported values:
4990
+
4991
+
4992
+ - `resource.TEXTURE_FORMAT_LUMINANCE`
4993
+ - `resource.TEXTURE_FORMAT_RGB`
4994
+ - `resource.TEXTURE_FORMAT_RGBA`
4995
+
4996
+ These constants might not be available on the device:
4997
+
4998
+ - `resource.TEXTURE_FORMAT_RGB_PVRTC_2BPPV1`
4999
+ - `resource.TEXTURE_FORMAT_RGB_PVRTC_4BPPV1`
5000
+ - `resource.TEXTURE_FORMAT_RGBA_PVRTC_2BPPV1`
5001
+ - `resource.TEXTURE_FORMAT_RGBA_PVRTC_4BPPV1`
5002
+ - `resource.TEXTURE_FORMAT_RGB_ETC1`
5003
+ - `resource.TEXTURE_FORMAT_RGBA_ETC2`
5004
+ - `resource.TEXTURE_FORMAT_RGBA_ASTC_4x4`
5005
+ - `resource.TEXTURE_FORMAT_RGB_BC1`
5006
+ - `resource.TEXTURE_FORMAT_RGBA_BC3`
5007
+ - `resource.TEXTURE_FORMAT_R_BC4`
5008
+ - `resource.TEXTURE_FORMAT_RG_BC5`
5009
+ - `resource.TEXTURE_FORMAT_RGBA_BC7`
5010
+ - `resource.TEXTURE_FORMAT_RGB16F`
5011
+ - `resource.TEXTURE_FORMAT_RGB32F`
5012
+ - `resource.TEXTURE_FORMAT_RGBA16F`
5013
+ - `resource.TEXTURE_FORMAT_RGBA32F`
5014
+ - `resource.TEXTURE_FORMAT_R16F`
5015
+ - `resource.TEXTURE_FORMAT_RG16F`
5016
+ - `resource.TEXTURE_FORMAT_R32F`
5017
+ - `resource.TEXTURE_FORMAT_RG32F`
5018
+
5019
+ You can test if the device supports these values by checking if a specific enum is nil or not:
5020
+ `if resource.TEXTURE_FORMAT_RGBA16F ~= nil then
5021
+ -- it is safe to use this format
5022
+ end
5023
+ `
5024
+
5025
+
5026
+ `max_mipmaps`
5027
+ optional max number of mipmaps. Defaults to zero, i.e no mipmap support
5028
+ `compression_type`
5029
+ optional specify the compression type for the data in the buffer object that holds the texture data. Will only be used when a compressed buffer has been passed into the function.
5030
+ Creating an empty texture with no buffer data is not supported as a core feature. Defaults to resource.COMPRESSION_TYPE_DEFAULT, i.e no compression. Supported values:
5031
+
5032
+
5033
+ - `COMPRESSION_TYPE_DEFAULT`
5034
+ - `COMPRESSION_TYPE_BASIS_UASTC`
5035
+
5036
+ * @param buffer optional buffer of precreated pixel data
5037
+ * @return path_ The path to the resource and the request id for the async request.
5038
+ */
5039
+ export function create_texture_async(path: string, table: any, buffer?: buffer): any
5040
+
4508
5041
  /**
4509
5042
  * Constructor-like function with two purposes:
4510
5043
  *
@@ -4537,6 +5070,48 @@ See resource.set_atlas for a detailed description of each field
4537
5070
  */
4538
5071
  export function get_buffer(path: hash | string): buffer
4539
5072
 
5073
+ /**
5074
+ * Gets render target info from a render target resource path or a render target handle
5075
+ * @param path The path to the resource or a render target handle
5076
+ * @return table A table containing info about the render target:
5077
+
5078
+ `handle`
5079
+ the opaque handle to the texture resource
5080
+ 'attachments'
5081
+ a table of attachments, where each attachment contains the following entries:
5082
+ `handle`
5083
+ the opaque handle to the texture resource
5084
+ `width`
5085
+ width of the texture
5086
+ `height`
5087
+ height of the texture
5088
+ `depth`
5089
+ depth of the texture (i.e 1 for a 2D texture and 6 for a cube map)
5090
+ `mipmaps`
5091
+ number of mipmaps of the texture
5092
+ `type`
5093
+ The texture type. Supported values:
5094
+
5095
+
5096
+ - `resource.TEXTURE_TYPE_2D`
5097
+ - `resource.TEXTURE_TYPE_CUBE_MAP`
5098
+ - `resource.TEXTURE_TYPE_2D_ARRAY`
5099
+
5100
+
5101
+ `buffer_type`
5102
+ The attachment buffer type. Supported values:
5103
+
5104
+
5105
+ - `resource.BUFFER_TYPE_COLOR0`
5106
+ - `resource.BUFFER_TYPE_COLOR1`
5107
+ - `resource.BUFFER_TYPE_COLOR2`
5108
+ - `resource.BUFFER_TYPE_COLOR3`
5109
+ - `resource.BUFFER_TYPE_DEPTH`
5110
+ - `resource.BUFFER_TYPE_STENCIL`
5111
+
5112
+ */
5113
+ export function get_render_target_info(path: any): any
5114
+
4540
5115
  /**
4541
5116
  * Gets the text metrics from a font
4542
5117
  * @param url the font to get the (unscaled) metrics from
@@ -5609,9 +6184,9 @@ The response data. Contains the fields:
5609
6184
  * @param options optional table with request parameters. Supported entries:
5610
6185
 
5611
6186
  `timeout`: timeout in seconds
5612
- `path`: path on disc where to download the file. Only overwrites the path if status is 200
5613
- `ignore_cache`: don't return cached data if we get a 304
5614
- `chunked_transfer`: use chunked transfer encoding for https requests larger than 16kb. Defaults to true.
6187
+ Not available in HTML5 build
6188
+ Not available in HTML5 build
6189
+ Not available in HTML5 build
5615
6190
 
5616
6191
  */
5617
6192
  export function request(url: string, method: string, callback: any, headers?: any, post_data?: string, options?: any): void
@@ -5645,7 +6220,13 @@ declare namespace image {
5645
6220
  /**
5646
6221
  * Load image (PNG or JPEG) from buffer.
5647
6222
  * @param buffer image data buffer
5648
- * @param premult optional flag if alpha should be premultiplied. Defaults to `false`
6223
+ * @param options An optional table containing parameters for loading the image. Supported entries:
6224
+
6225
+ `premultiply_alpha`
6226
+ True if alpha should be premultiplied into the color components. Defaults to `false`.
6227
+ `flip_vertically`
6228
+ True if the image contents should be flipped vertically. Defaults to `false`.
6229
+
5649
6230
  * @return image object or `nil` if loading fails. The object is a table with the following fields:
5650
6231
 
5651
6232
  `width`: image width
@@ -5660,12 +6241,18 @@ declare namespace image {
5660
6241
  `buffer`: the raw image data
5661
6242
 
5662
6243
  */
5663
- export function load(buffer: string, premult?: boolean): LuaMultiReturn<[any, any]>
6244
+ export function load(buffer: string, options?: any): LuaMultiReturn<[any, any]>
5664
6245
 
5665
6246
  /**
5666
6247
  * Load image (PNG or JPEG) from a string buffer.
5667
6248
  * @param buffer image data buffer
5668
- * @param premult optional flag if alpha should be premultiplied. Defaults to `false`
6249
+ * @param options An optional table containing parameters for loading the image. Supported entries:
6250
+
6251
+ `premultiply_alpha`
6252
+ True if alpha should be premultiplied into the color components. Defaults to `false`.
6253
+ `flip_vertically`
6254
+ True if the image contents should be flipped vertically. Defaults to `false`.
6255
+
5669
6256
  * @return image object or `nil` if loading fails. The object is a table with the following fields:
5670
6257
 
5671
6258
  `width`: image width
@@ -5680,7 +6267,7 @@ declare namespace image {
5680
6267
  `buffer`: the script buffer that holds the decompressed image data. See buffer.create how to use the buffer.
5681
6268
 
5682
6269
  */
5683
- export function load_buffer(buffer: string, premult?: boolean): LuaMultiReturn<[any, any]>
6270
+ export function load_buffer(buffer: string, options?: any): LuaMultiReturn<[any, any]>
5684
6271
 
5685
6272
  }
5686
6273
  // =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
@@ -6350,6 +6937,18 @@ declare namespace camera {
6350
6937
  */
6351
6938
  export let aspect_ratio: any
6352
6939
 
6940
+ /**
6941
+ * makes camera active
6942
+ * @param url url of camera component
6943
+ */
6944
+ export function acquire_focus(url: string | hash | url): void
6945
+
6946
+ /**
6947
+ * deactivate camera
6948
+ * @param url url of camera component
6949
+ */
6950
+ export function release_focus(url: string | hash | url): void
6951
+
6353
6952
  /**
6354
6953
  * Camera frustum far plane.
6355
6954
  * The type of the property is float.
@@ -6996,6 +7595,7 @@ declare namespace sound {
6996
7595
  * Inversely, to find the linear value from a dB value, use the formula
6997
7596
  * `10db/20`.
6998
7597
  * ⚠ A sound will continue to play even if the game object the sound component belonged to is deleted. You can send a `stop_sound` to stop the sound.
7598
+ * ⚠ `play_id` should be specified in case you want to receive `sound_done` or `sound_stopped` in `on_message()`.
6999
7599
  */
7000
7600
  export type play_sound = "play_sound"
7001
7601
 
@@ -7140,7 +7740,7 @@ Information about the completion:
7140
7740
  `sender`
7141
7741
  The invoker of the callback: the sound component.
7142
7742
 
7143
- * @return id The identifier for the sound voice
7743
+ * @return play_id The identifier for the sound voice
7144
7744
  */
7145
7745
  export function play(url: string | hash | url, play_properties?: any, complete_function?: any): number
7146
7746
 
@@ -7186,14 +7786,14 @@ the sequential play identifier that should be stopped (was given by the sound.pl
7186
7786
  export function stop(url: string | hash | url, stop_properties?: any): void
7187
7787
 
7188
7788
  /**
7189
- * This message is sent back to the sender of a `play_sound` message, if the sound
7190
- * could be played to completion.
7789
+ * This message is sent back to the sender of a `play_sound` message
7790
+ * if the sound could be played to completion and a `play_id` was provided with the `play_sound` message.
7191
7791
  */
7192
7792
  export type sound_done = "sound_done"
7193
7793
 
7194
7794
  /**
7195
7795
  * This message is sent back to the sender of a `play_sound` message, if the sound
7196
- * has been manually stopped.
7796
+ * has been manually stopped and a `play_id` was provided with the `play_sound` message.
7197
7797
  */
7198
7798
  export type sound_stopped = "sound_stopped"
7199
7799
 
@@ -7277,6 +7877,13 @@ declare namespace sprite {
7277
7877
  */
7278
7878
  export let size: any
7279
7879
 
7880
+ /**
7881
+ * The slice values of the sprite. The type of the property is a vector4 that corresponds to
7882
+ * the left, top, right, bottom values of the sprite in the editor.
7883
+ * It is not possible to set the slice property if the size mode of the sprite is set to auto.
7884
+ */
7885
+ export let slice: any
7886
+
7280
7887
  /**
7281
7888
  * Play an animation on a sprite component from its tile set
7282
7889
  * An optional completion callback function can be provided that will be called when
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ts-defold/types",
3
- "version": "1.2.40",
3
+ "version": "1.2.42",
4
4
  "description": "TypeScript definitions for Defold",
5
5
  "repository": "github:ts-defold/types",
6
6
  "keywords": [