@ts-defold/types 1.2.41 → 1.2.43
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.
- package/index.d.ts +554 -6
- 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.
|
|
5
|
+
// DEFOLD. stable version 1.8.0 (fd3b8c652df601220d8651f581fa2fada8205237)
|
|
6
6
|
// =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
|
|
7
7
|
|
|
8
8
|
|
|
@@ -223,6 +223,382 @@ 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: string | hash | 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 body body
|
|
265
|
+
* @param impulse impulse the angular impulse in units of kg*m*m/s
|
|
266
|
+
*/
|
|
267
|
+
export function apply_angular_impulse(body: any, impulse: number): void
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Apply a force at a world point. If the force is not
|
|
271
|
+
* applied at the center of mass, it will generate a torque and
|
|
272
|
+
* affect the angular velocity. This wakes up the body.
|
|
273
|
+
* @param body body
|
|
274
|
+
* @param force the world force vector, usually in Newtons (N).
|
|
275
|
+
* @param point the world position of the point of application.
|
|
276
|
+
*/
|
|
277
|
+
export function apply_force(body: any, force: vmath.vector3, point: vmath.vector3): void
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Apply a force to the center of mass. This wakes up the body.
|
|
281
|
+
* @param body body
|
|
282
|
+
* @param force the world force vector, usually in Newtons (N).
|
|
283
|
+
*/
|
|
284
|
+
export function apply_force_to_center(body: any, force: vmath.vector3): void
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Apply an impulse at a point. This immediately modifies the velocity.
|
|
288
|
+
* It also modifies the angular velocity if the point of application
|
|
289
|
+
* is not at the center of mass. This wakes up the body.
|
|
290
|
+
* @param body body
|
|
291
|
+
* @param impulse the world impulse vector, usually in N-seconds or kg-m/s.
|
|
292
|
+
* @param point the world position of the point of application.
|
|
293
|
+
*/
|
|
294
|
+
export function apply_linear_impulse(body: any, impulse: vmath.vector3, point: vmath.vector3): void
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Apply a torque. This affects the angular velocity
|
|
298
|
+
* without affecting the linear velocity of the center of mass.
|
|
299
|
+
* This wakes up the body.
|
|
300
|
+
* @param body body
|
|
301
|
+
* @param torque torque about the z-axis (out of the screen), usually in N-m.
|
|
302
|
+
*/
|
|
303
|
+
export function apply_torque(body: any, torque: number): void
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Print the body representation to the log output
|
|
307
|
+
* @param body body
|
|
308
|
+
*/
|
|
309
|
+
export function dump(body: any): void
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Get the angular damping of the body.
|
|
313
|
+
* @param body body
|
|
314
|
+
* @return damping the damping
|
|
315
|
+
*/
|
|
316
|
+
export function get_angular_damping(body: any): number
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Set the angular velocity.
|
|
320
|
+
* @param body body
|
|
321
|
+
* @param omega the new angular velocity in radians/second.
|
|
322
|
+
*/
|
|
323
|
+
export function get_angular_velocity(body: any, omega: number): void
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Get the angular velocity.
|
|
327
|
+
* @param body body
|
|
328
|
+
* @return velocity the angular velocity in radians/second.
|
|
329
|
+
*/
|
|
330
|
+
export function get_angular_velocity(body: any): number
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Get the gravity scale of the body.
|
|
334
|
+
* @param body body
|
|
335
|
+
* @return scale the scale
|
|
336
|
+
*/
|
|
337
|
+
export function get_gravity_scale(body: any): number
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Get the rotational inertia of the body about the local origin.
|
|
341
|
+
* @param body body
|
|
342
|
+
* @return inertia the rotational inertia, usually in kg-m^2.
|
|
343
|
+
*/
|
|
344
|
+
export function get_inertia(body: any): number
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Get the linear damping of the body.
|
|
348
|
+
* @param body body
|
|
349
|
+
* @return damping the damping
|
|
350
|
+
*/
|
|
351
|
+
export function get_linear_damping(body: any): number
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Get the linear velocity of the center of mass.
|
|
355
|
+
* @param body body
|
|
356
|
+
* @return velocity the linear velocity of the center of mass.
|
|
357
|
+
*/
|
|
358
|
+
export function get_linear_velocity(body: any): vmath.vector3
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Get the world linear velocity of a world point attached to this body.
|
|
362
|
+
* @param body body
|
|
363
|
+
* @param world_point a point in world coordinates.
|
|
364
|
+
* @return velocity the world velocity of a point.
|
|
365
|
+
*/
|
|
366
|
+
export function get_linear_velocity_from_world_point(body: any, world_point: vmath.vector3): vmath.vector3
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Get the world velocity of a local point.
|
|
370
|
+
* @param body body
|
|
371
|
+
* @param world_point a point in local coordinates.
|
|
372
|
+
* @return velocity the world velocity of a point.
|
|
373
|
+
*/
|
|
374
|
+
export function get_linear_velocity_from_world_point(body: any, world_point: vmath.vector3): vmath.vector3
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Get the local position of the center of mass.
|
|
378
|
+
* @param body body
|
|
379
|
+
* @return center Get the local position of the center of mass.
|
|
380
|
+
*/
|
|
381
|
+
export function get_local_center(body: any): vmath.vector3
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Gets a local point relative to the body's origin given a world point.
|
|
385
|
+
* @param body body
|
|
386
|
+
* @param world_point a point in world coordinates.
|
|
387
|
+
* @return vector the corresponding local point relative to the body's origin.
|
|
388
|
+
*/
|
|
389
|
+
export function get_local_point(body: any, world_point: vmath.vector3): vmath.vector3
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Gets a local vector given a world vector.
|
|
393
|
+
* @param body body
|
|
394
|
+
* @param world_vector a vector in world coordinates.
|
|
395
|
+
* @return vector the corresponding local vector.
|
|
396
|
+
*/
|
|
397
|
+
export function get_local_vector(body: any, world_vector: vmath.vector3): vmath.vector3
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Get the total mass of the body.
|
|
401
|
+
* @param body body
|
|
402
|
+
* @return mass the mass, usually in kilograms (kg).
|
|
403
|
+
*/
|
|
404
|
+
export function get_mass(body: any): number
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Get the next body in the world's body list.
|
|
408
|
+
* @param body body
|
|
409
|
+
* @return body the next body
|
|
410
|
+
*/
|
|
411
|
+
export function get_next(body: any): any
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Get the world body origin position.
|
|
415
|
+
* @param body body
|
|
416
|
+
* @return position the world position of the body's origin.
|
|
417
|
+
*/
|
|
418
|
+
export function get_position(body: any): vmath.vector3
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Get the type of this body.
|
|
422
|
+
* @param body body
|
|
423
|
+
* @return type the body type
|
|
424
|
+
*/
|
|
425
|
+
export function get_type(body: any): any
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Get the parent world of this body.
|
|
429
|
+
* @param body body
|
|
430
|
+
* @return world
|
|
431
|
+
*/
|
|
432
|
+
export function get_world(body: any): any
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Get the angle in radians.
|
|
436
|
+
* @param body body
|
|
437
|
+
* @return angle the current world rotation angle in radians.
|
|
438
|
+
*/
|
|
439
|
+
export function get_world_center(body: any): number
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Get the world position of the center of mass.
|
|
443
|
+
* @param body body
|
|
444
|
+
* @return center Get the world position of the center of mass.
|
|
445
|
+
*/
|
|
446
|
+
export function get_world_center(body: any): vmath.vector3
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Get the world coordinates of a point given the local coordinates.
|
|
450
|
+
* @param body body
|
|
451
|
+
* @param local_vector localPoint a point on the body measured relative the the body's origin.
|
|
452
|
+
* @return vector the same point expressed in world coordinates.
|
|
453
|
+
*/
|
|
454
|
+
export function get_world_point(body: any, local_vector: vmath.vector3): vmath.vector3
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Get the world coordinates of a vector given the local coordinates.
|
|
458
|
+
* @param body body
|
|
459
|
+
* @param local_vector a vector fixed in the body.
|
|
460
|
+
* @return vector the same vector expressed in world coordinates.
|
|
461
|
+
*/
|
|
462
|
+
export function get_world_vector(body: any, local_vector: vmath.vector3): vmath.vector3
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Get the active state of the body.
|
|
466
|
+
* @param body body
|
|
467
|
+
* @return enabled is the body active
|
|
468
|
+
*/
|
|
469
|
+
export function is_active(body: any): any
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Get the sleeping state of this body.
|
|
473
|
+
* @param body body
|
|
474
|
+
* @return enabled true if the body is awake, false if it's sleeping.
|
|
475
|
+
*/
|
|
476
|
+
export function is_awake(body: any): any
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Is this body in bullet mode
|
|
480
|
+
* @param body body
|
|
481
|
+
* @return enabled true if the body is in bullet mode
|
|
482
|
+
*/
|
|
483
|
+
export function is_bullet(body: any): any
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Does this body have fixed rotation?
|
|
487
|
+
* @param body body
|
|
488
|
+
* @return enabled is the rotation fixed
|
|
489
|
+
*/
|
|
490
|
+
export function is_fixed_rotation(body: any): any
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Is this body allowed to sleep
|
|
494
|
+
* @param body body
|
|
495
|
+
* @return enabled true if the body is allowed to sleep
|
|
496
|
+
*/
|
|
497
|
+
export function is_sleeping_allowed(body: any): any
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* This resets the mass properties to the sum of the mass properties of the fixtures.
|
|
501
|
+
* This normally does not need to be called unless you called SetMassData to override
|
|
502
|
+
* @param body body
|
|
503
|
+
*/
|
|
504
|
+
export function reset_mass_data(body: any): void
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Set the active state of the body. An inactive body is not
|
|
508
|
+
* simulated and cannot be collided with or woken up.
|
|
509
|
+
* If you pass a flag of true, all fixtures will be added to the
|
|
510
|
+
* broad-phase.
|
|
511
|
+
* If you pass a flag of false, all fixtures will be removed from
|
|
512
|
+
* the broad-phase and all contacts will be destroyed.
|
|
513
|
+
* Fixtures and joints are otherwise unaffected. You may continue
|
|
514
|
+
* to create/destroy fixtures and joints on inactive bodies.
|
|
515
|
+
* Fixtures on an inactive body are implicitly inactive and will
|
|
516
|
+
* not participate in collisions, ray-casts, or queries.
|
|
517
|
+
* Joints connected to an inactive body are implicitly inactive.
|
|
518
|
+
* An inactive body is still owned by a b2World object and remains
|
|
519
|
+
* in the body list.
|
|
520
|
+
* @param body body
|
|
521
|
+
* @param enable true if the body should be active
|
|
522
|
+
*/
|
|
523
|
+
export function set_active(body: any, enable: any): void
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Set the angular damping of the body.
|
|
527
|
+
* @param body body
|
|
528
|
+
* @param damping the damping
|
|
529
|
+
*/
|
|
530
|
+
export function set_angular_damping(body: any, damping: number): void
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Set the sleep state of the body. A sleeping body has very low CPU cost.
|
|
534
|
+
* @param body body
|
|
535
|
+
* @param enable flag set to false to put body to sleep, true to wake it.
|
|
536
|
+
*/
|
|
537
|
+
export function set_awake(body: any, enable: any): void
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* Should this body be treated like a bullet for continuous collision detection?
|
|
541
|
+
* @param body body
|
|
542
|
+
* @param enable if true, the body will be in bullet mode
|
|
543
|
+
*/
|
|
544
|
+
export function set_bullet(body: any, enable: any): void
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Set this body to have fixed rotation. This causes the mass to be reset.
|
|
548
|
+
* @param body body
|
|
549
|
+
* @param enable true if the rotation should be fixed
|
|
550
|
+
*/
|
|
551
|
+
export function set_fixed_rotation(body: any, enable: any): void
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Set the gravity scale of the body.
|
|
555
|
+
* @param body body
|
|
556
|
+
* @param scale the scale
|
|
557
|
+
*/
|
|
558
|
+
export function set_gravity_scale(body: any, scale: number): void
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Set the linear damping of the body.
|
|
562
|
+
* @param body body
|
|
563
|
+
* @param damping the damping
|
|
564
|
+
*/
|
|
565
|
+
export function set_linear_damping(body: any, damping: number): void
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Set the linear velocity of the center of mass.
|
|
569
|
+
* @param body body
|
|
570
|
+
* @param velocity the new linear velocity of the center of mass.
|
|
571
|
+
*/
|
|
572
|
+
export function set_linear_velocity(body: any, velocity: vmath.vector3): void
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* You can disable sleeping on this body. If you disable sleeping, the body will be woken.
|
|
576
|
+
* @param body body
|
|
577
|
+
* @param enable if false, the body will never sleep, and consume more CPU
|
|
578
|
+
*/
|
|
579
|
+
export function set_sleeping_allowed(body: any, enable: any): void
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* Set the position of the body's origin and rotation.
|
|
583
|
+
* This breaks any contacts and wakes the other bodies.
|
|
584
|
+
* Manipulating a body's transform may cause non-physical behavior.
|
|
585
|
+
* @param body body
|
|
586
|
+
* @param position the world position of the body's local origin.
|
|
587
|
+
* @param angle the world position of the body's local origin.
|
|
588
|
+
*/
|
|
589
|
+
export function set_transform(body: any, position: vmath.vector3, angle: number): void
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* Set the type of this body. This may alter the mass and velocity.
|
|
593
|
+
* @param body body
|
|
594
|
+
* @param type the body type
|
|
595
|
+
*/
|
|
596
|
+
export function set_type(body: any, type: any): void
|
|
597
|
+
|
|
598
|
+
}
|
|
599
|
+
// =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
|
|
600
|
+
|
|
601
|
+
|
|
226
602
|
declare namespace crash {
|
|
227
603
|
|
|
228
604
|
/**
|
|
@@ -1368,6 +1744,11 @@ declare namespace gui {
|
|
|
1368
1744
|
*/
|
|
1369
1745
|
export let PROP_COLOR: any
|
|
1370
1746
|
|
|
1747
|
+
/**
|
|
1748
|
+
* euler property
|
|
1749
|
+
*/
|
|
1750
|
+
export let PROP_EULER: any
|
|
1751
|
+
|
|
1371
1752
|
/**
|
|
1372
1753
|
* fill_angle property
|
|
1373
1754
|
*/
|
|
@@ -1459,6 +1840,7 @@ declare namespace gui {
|
|
|
1459
1840
|
|
|
1460
1841
|
- `"position"`
|
|
1461
1842
|
- `"rotation"`
|
|
1843
|
+
- `"euler"`
|
|
1462
1844
|
- `"scale"`
|
|
1463
1845
|
- `"color"`
|
|
1464
1846
|
- `"outline"`
|
|
@@ -1472,6 +1854,7 @@ The following property constants are defined equaling the corresponding property
|
|
|
1472
1854
|
|
|
1473
1855
|
- `gui.PROP_POSITION`
|
|
1474
1856
|
- `gui.PROP_ROTATION`
|
|
1857
|
+
- `gui.PROP_EULER`
|
|
1475
1858
|
- `gui.PROP_SCALE`
|
|
1476
1859
|
- `gui.PROP_COLOR`
|
|
1477
1860
|
- `gui.PROP_OUTLINE`
|
|
@@ -1508,6 +1891,7 @@ with a custom curve. See the animation guide for more information.
|
|
|
1508
1891
|
|
|
1509
1892
|
- `"position"`
|
|
1510
1893
|
- `"rotation"`
|
|
1894
|
+
- `"euler"`
|
|
1511
1895
|
- `"scale"`
|
|
1512
1896
|
- `"color"`
|
|
1513
1897
|
- `"outline"`
|
|
@@ -1558,6 +1942,31 @@ with a custom curve. See the animation guide for more information.
|
|
|
1558
1942
|
*/
|
|
1559
1943
|
export function delete_texture(texture: string | hash): void
|
|
1560
1944
|
|
|
1945
|
+
/**
|
|
1946
|
+
* Instead of using specific getters such as gui.get_position or gui.get_scale,
|
|
1947
|
+
* you can use gui.get instead and supply the property as a string or a hash.
|
|
1948
|
+
* While this function is similar to go.get, there are a few more restrictions
|
|
1949
|
+
* when operating in the gui namespace. Most notably, only these propertie identifiers are supported:
|
|
1950
|
+
*
|
|
1951
|
+
* - `"position"`
|
|
1952
|
+
* - `"rotation"`
|
|
1953
|
+
* - `"euler"`
|
|
1954
|
+
* - `"scale"`
|
|
1955
|
+
* - `"color"`
|
|
1956
|
+
* - `"outline"`
|
|
1957
|
+
* - `"shadow"`
|
|
1958
|
+
* - `"size"`
|
|
1959
|
+
* - `"fill_angle"` (pie)
|
|
1960
|
+
* - `"inner_radius"` (pie)
|
|
1961
|
+
* - `"slice9"` (slice9)
|
|
1962
|
+
*
|
|
1963
|
+
* The value returned will either be a vmath.vector4 or a single number, i.e getting the "position"
|
|
1964
|
+
* property will return a vec4 while getting the "position.x" property will return a single value.
|
|
1965
|
+
* @param node node to get the property for
|
|
1966
|
+
* @param property the property to retrieve
|
|
1967
|
+
*/
|
|
1968
|
+
export function get(node: node, property: any): void
|
|
1969
|
+
|
|
1561
1970
|
/**
|
|
1562
1971
|
* Returns the adjust mode of a node.
|
|
1563
1972
|
* The adjust mode defines how the node will adjust itself to screen
|
|
@@ -1652,6 +2061,14 @@ with a custom curve. See the animation guide for more information.
|
|
|
1652
2061
|
*/
|
|
1653
2062
|
export function get_color(node: node): vmath.vector4
|
|
1654
2063
|
|
|
2064
|
+
/**
|
|
2065
|
+
* Returns the rotation of the supplied node.
|
|
2066
|
+
* The rotation is expressed in degree Euler angles.
|
|
2067
|
+
* @param node node to get the rotation from
|
|
2068
|
+
* @return rotation node rotation
|
|
2069
|
+
*/
|
|
2070
|
+
export function get_euler(node: node): vmath.vector3
|
|
2071
|
+
|
|
1655
2072
|
/**
|
|
1656
2073
|
* Returns the sector angle of a pie node.
|
|
1657
2074
|
* @param node node from which to get the fill angle
|
|
@@ -1841,11 +2258,11 @@ with a custom curve. See the animation guide for more information.
|
|
|
1841
2258
|
|
|
1842
2259
|
/**
|
|
1843
2260
|
* Returns the rotation of the supplied node.
|
|
1844
|
-
* The rotation is expressed
|
|
2261
|
+
* The rotation is expressed as a quaternion
|
|
1845
2262
|
* @param node node to get the rotation from
|
|
1846
2263
|
* @return rotation node rotation
|
|
1847
2264
|
*/
|
|
1848
|
-
export function get_rotation(node: node): vmath.
|
|
2265
|
+
export function get_rotation(node: node): vmath.quaternion
|
|
1849
2266
|
|
|
1850
2267
|
/**
|
|
1851
2268
|
* Returns the scale of the supplied node.
|
|
@@ -2137,6 +2554,36 @@ the new state of the emitter:
|
|
|
2137
2554
|
*/
|
|
2138
2555
|
export function screen_to_local(node: node, screen_position: vmath.vector3): vmath.vector3
|
|
2139
2556
|
|
|
2557
|
+
/**
|
|
2558
|
+
* Instead of using specific setteres such as gui.set_position or gui.set_scale,
|
|
2559
|
+
* you can use gui.set instead and supply the property as a string or a hash.
|
|
2560
|
+
* While this function is similar to go.get and go.set, there are a few more restrictions
|
|
2561
|
+
* when operating in the gui namespace. Most notably, only these propertie identifiers are supported:
|
|
2562
|
+
*
|
|
2563
|
+
* - `"position"`
|
|
2564
|
+
* - `"rotation"`
|
|
2565
|
+
* - `"euler"`
|
|
2566
|
+
* - `"scale"`
|
|
2567
|
+
* - `"color"`
|
|
2568
|
+
* - `"outline"`
|
|
2569
|
+
* - `"shadow"`
|
|
2570
|
+
* - `"size"`
|
|
2571
|
+
* - `"fill_angle"` (pie)
|
|
2572
|
+
* - `"inner_radius"` (pie)
|
|
2573
|
+
* - `"slice9"` (slice9)
|
|
2574
|
+
*
|
|
2575
|
+
* 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.
|
|
2576
|
+
* I.e when setting the "position" property, you need to use a vmath.vector4 and when setting a single component of the property,
|
|
2577
|
+
* such as "position.x", you need to use a single value.
|
|
2578
|
+
* 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,
|
|
2579
|
+
* 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,
|
|
2580
|
+
* use the "euler" property instead. The rotation and euler properties are linked, changing one of them will change the backing data of the other.
|
|
2581
|
+
* @param node node to set the property for
|
|
2582
|
+
* @param property the property to set
|
|
2583
|
+
* @param value the property to set
|
|
2584
|
+
*/
|
|
2585
|
+
export function set(node: node, property: any, value: number | vmath.vector4 | vmath.vector3 | vmath.quaternion): void
|
|
2586
|
+
|
|
2140
2587
|
/**
|
|
2141
2588
|
* Sets the adjust mode on a node.
|
|
2142
2589
|
* The adjust mode defines how the node will adjust itself to screen
|
|
@@ -2240,6 +2687,14 @@ the new state of the emitter:
|
|
|
2240
2687
|
*/
|
|
2241
2688
|
export function set_enabled(node: node, enabled: boolean): void
|
|
2242
2689
|
|
|
2690
|
+
/**
|
|
2691
|
+
* Sets the rotation of the supplied node.
|
|
2692
|
+
* The rotation is expressed in degree Euler angles.
|
|
2693
|
+
* @param node node to set the rotation for
|
|
2694
|
+
* @param rotation new rotation
|
|
2695
|
+
*/
|
|
2696
|
+
export function set_euler(node: node, rotation: vmath.vector3 | vmath.vector4): void
|
|
2697
|
+
|
|
2243
2698
|
/**
|
|
2244
2699
|
* Set the sector angle of a pie node.
|
|
2245
2700
|
* @param node node to set the fill angle for
|
|
@@ -2406,11 +2861,11 @@ the new state of the emitter:
|
|
|
2406
2861
|
|
|
2407
2862
|
/**
|
|
2408
2863
|
* Sets the rotation of the supplied node.
|
|
2409
|
-
* The rotation is expressed
|
|
2864
|
+
* The rotation is expressed as a quaternion
|
|
2410
2865
|
* @param node node to set the rotation for
|
|
2411
2866
|
* @param rotation new rotation
|
|
2412
2867
|
*/
|
|
2413
|
-
export function set_rotation(node: node, rotation: vmath.
|
|
2868
|
+
export function set_rotation(node: node, rotation: vmath.quaternion | vmath.vector4): void
|
|
2414
2869
|
|
|
2415
2870
|
/**
|
|
2416
2871
|
* Sets the scaling of the supplied node.
|
|
@@ -4341,7 +4796,7 @@ declare namespace resource {
|
|
|
4341
4796
|
* Note that releasing a resource essentially means decreasing the reference count of that resource,
|
|
4342
4797
|
* and not necessarily that it will be deleted.
|
|
4343
4798
|
* @param path The path to the resource.
|
|
4344
|
-
* @param table A table containing info about how to create the
|
|
4799
|
+
* @param table A table containing info about how to create the atlas. Supported entries:
|
|
4345
4800
|
|
|
4346
4801
|
|
|
4347
4802
|
|
|
@@ -4417,6 +4872,12 @@ A list of the geometries that should map to the texture data. Supports the follo
|
|
|
4417
4872
|
|
|
4418
4873
|
|
|
4419
4874
|
|
|
4875
|
+
`id`
|
|
4876
|
+
The name of the geometry. Used when matching animations between multiple atlases
|
|
4877
|
+
|
|
4878
|
+
|
|
4879
|
+
|
|
4880
|
+
|
|
4420
4881
|
`vertices`
|
|
4421
4882
|
a list of the vertices in texture space of the geometry in the form {px0, py0, px1, py1, ..., pxn, pyn}
|
|
4422
4883
|
|
|
@@ -4542,6 +5003,86 @@ Creating an empty texture with no buffer data is not supported as a core feature
|
|
|
4542
5003
|
*/
|
|
4543
5004
|
export function create_texture(path: string, table: any, buffer?: buffer): hash
|
|
4544
5005
|
|
|
5006
|
+
/**
|
|
5007
|
+
* Creates a new texture resource that can be used in the same way as any texture created during build time.
|
|
5008
|
+
* The path used for creating the texture must be unique, trying to create a resource at a path that is already
|
|
5009
|
+
* registered will trigger an error. If the intention is to instead modify an existing texture, use the resource.set_texture
|
|
5010
|
+
* function. Also note that the path to the new texture resource must have a '.texturec' extension,
|
|
5011
|
+
* meaning "/path/my_texture" is not a valid path but "/path/my_texture.texturec" is.
|
|
5012
|
+
* If the texture is created without a buffer, the pixel data will be blank.
|
|
5013
|
+
* The difference between the async version and resource.create_texture is that the texture data will be uploaded
|
|
5014
|
+
* in a graphics worker thread. The function will return a resource immediately that contains a 1x1 blank texture which can be used
|
|
5015
|
+
* immediately after the function call. When the new texture has been uploaded, the initial blank texture will be deleted and replaced with the
|
|
5016
|
+
* new texture. Be careful when using the initial texture handle handle as it will not be valid after the upload has finished.
|
|
5017
|
+
* @param path The path to the resource.
|
|
5018
|
+
* @param table
|
|
5019
|
+
A table containing info about how to create the texture. Supported entries:
|
|
5020
|
+
`type`
|
|
5021
|
+
The texture type. Supported values:
|
|
5022
|
+
|
|
5023
|
+
|
|
5024
|
+
- `resource.TEXTURE_TYPE_2D`
|
|
5025
|
+
- `resource.TEXTURE_TYPE_CUBE_MAP`
|
|
5026
|
+
|
|
5027
|
+
|
|
5028
|
+
`width`
|
|
5029
|
+
The width of the texture (in pixels). Must be larger than 0.
|
|
5030
|
+
`height`
|
|
5031
|
+
The width of the texture (in pixels). Must be larger than 0.
|
|
5032
|
+
`format`
|
|
5033
|
+
The texture format, note that some of these formats might not be supported by the running device. Supported values:
|
|
5034
|
+
|
|
5035
|
+
|
|
5036
|
+
- `resource.TEXTURE_FORMAT_LUMINANCE`
|
|
5037
|
+
- `resource.TEXTURE_FORMAT_RGB`
|
|
5038
|
+
- `resource.TEXTURE_FORMAT_RGBA`
|
|
5039
|
+
|
|
5040
|
+
These constants might not be available on the device:
|
|
5041
|
+
|
|
5042
|
+
- `resource.TEXTURE_FORMAT_RGB_PVRTC_2BPPV1`
|
|
5043
|
+
- `resource.TEXTURE_FORMAT_RGB_PVRTC_4BPPV1`
|
|
5044
|
+
- `resource.TEXTURE_FORMAT_RGBA_PVRTC_2BPPV1`
|
|
5045
|
+
- `resource.TEXTURE_FORMAT_RGBA_PVRTC_4BPPV1`
|
|
5046
|
+
- `resource.TEXTURE_FORMAT_RGB_ETC1`
|
|
5047
|
+
- `resource.TEXTURE_FORMAT_RGBA_ETC2`
|
|
5048
|
+
- `resource.TEXTURE_FORMAT_RGBA_ASTC_4x4`
|
|
5049
|
+
- `resource.TEXTURE_FORMAT_RGB_BC1`
|
|
5050
|
+
- `resource.TEXTURE_FORMAT_RGBA_BC3`
|
|
5051
|
+
- `resource.TEXTURE_FORMAT_R_BC4`
|
|
5052
|
+
- `resource.TEXTURE_FORMAT_RG_BC5`
|
|
5053
|
+
- `resource.TEXTURE_FORMAT_RGBA_BC7`
|
|
5054
|
+
- `resource.TEXTURE_FORMAT_RGB16F`
|
|
5055
|
+
- `resource.TEXTURE_FORMAT_RGB32F`
|
|
5056
|
+
- `resource.TEXTURE_FORMAT_RGBA16F`
|
|
5057
|
+
- `resource.TEXTURE_FORMAT_RGBA32F`
|
|
5058
|
+
- `resource.TEXTURE_FORMAT_R16F`
|
|
5059
|
+
- `resource.TEXTURE_FORMAT_RG16F`
|
|
5060
|
+
- `resource.TEXTURE_FORMAT_R32F`
|
|
5061
|
+
- `resource.TEXTURE_FORMAT_RG32F`
|
|
5062
|
+
|
|
5063
|
+
You can test if the device supports these values by checking if a specific enum is nil or not:
|
|
5064
|
+
`if resource.TEXTURE_FORMAT_RGBA16F ~= nil then
|
|
5065
|
+
-- it is safe to use this format
|
|
5066
|
+
end
|
|
5067
|
+
`
|
|
5068
|
+
|
|
5069
|
+
|
|
5070
|
+
`max_mipmaps`
|
|
5071
|
+
optional max number of mipmaps. Defaults to zero, i.e no mipmap support
|
|
5072
|
+
`compression_type`
|
|
5073
|
+
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.
|
|
5074
|
+
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:
|
|
5075
|
+
|
|
5076
|
+
|
|
5077
|
+
- `COMPRESSION_TYPE_DEFAULT`
|
|
5078
|
+
- `COMPRESSION_TYPE_BASIS_UASTC`
|
|
5079
|
+
|
|
5080
|
+
* @param buffer optional buffer of precreated pixel data
|
|
5081
|
+
* @return path The path to the resource.
|
|
5082
|
+
* @return request_id The request id for the async request.
|
|
5083
|
+
*/
|
|
5084
|
+
export function create_texture_async(path: string, table: any, buffer?: buffer): LuaMultiReturn<[hash, any]>
|
|
5085
|
+
|
|
4545
5086
|
/**
|
|
4546
5087
|
* Constructor-like function with two purposes:
|
|
4547
5088
|
*
|
|
@@ -7381,6 +7922,13 @@ declare namespace sprite {
|
|
|
7381
7922
|
*/
|
|
7382
7923
|
export let size: any
|
|
7383
7924
|
|
|
7925
|
+
/**
|
|
7926
|
+
* The slice values of the sprite. The type of the property is a vector4 that corresponds to
|
|
7927
|
+
* the left, top, right, bottom values of the sprite in the editor.
|
|
7928
|
+
* It is not possible to set the slice property if the size mode of the sprite is set to auto.
|
|
7929
|
+
*/
|
|
7930
|
+
export let slice: any
|
|
7931
|
+
|
|
7384
7932
|
/**
|
|
7385
7933
|
* Play an animation on a sprite component from its tile set
|
|
7386
7934
|
* An optional completion callback function can be provided that will be called when
|