@@ -18,6 +18,10 @@ export declare class Vec2 {
18
18
constructor ( x : number , y : number ) ;
19
19
constructor ( obj : Vec2Value ) ;
20
20
constructor ( ) ;
21
+ /** @hidden */
22
+ _serialize ( ) : object ;
23
+ /** @hidden */
24
+ static _deserialize ( data : any ) : Vec2 ;
21
25
static zero ( ) : Vec2 ;
22
26
/** @hidden */
23
27
static neo ( x : number , y : number ) : Vec2 ;
@@ -585,24 +589,25 @@ export interface Style {
585
589
fill ?: string ;
586
590
lineWidth ?: number ;
587
591
}
588
- export type KEY = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" | "right" | "left" | "up" | "down" | "fire" ;
589
592
export type ActiveKeys = {
590
593
[ key in KEY ] ?: boolean ;
591
594
} ;
592
595
export type TestbedMountOptions = {
593
596
[ key : string ] : any ;
594
597
} ;
595
- export declare abstract class Testbed {
598
+ export declare class Testbed {
596
599
/**
597
600
* Mounts testbed. Call start with a world to start simulation and rendering.
598
601
*/
599
- static mount ( options ?: TestbedMountOptions ) : Testbed ;
602
+ static mount ( options ?: TestbedMountOptions ) : TestbedInterface ;
600
603
/**
601
604
* Mounts testbed if needed, then starts simulation and rendering.
602
605
*
603
606
* If you need to customize testbed before starting, first run `const testbed = Testbed.mount()` and then `testbed.start()`.
604
607
*/
605
- static start ( world : World ) : Testbed ;
608
+ static start ( world : World ) : TestbedInterface ;
609
+ }
610
+ export interface TestbedInterface {
606
611
/** World viewbox width. */
607
612
width : number ;
608
613
/** World viewbox height. */
@@ -621,53 +626,34 @@ export declare abstract class Testbed {
621
626
mouseForce ?: number ;
622
627
activeKeys : ActiveKeys ;
623
628
/** callback, to be implemented by user */
624
- step : ( dt : number , t : number ) => void ;
629
+ step ? : ( dt : number , t : number ) => void ;
625
630
/** callback, to be implemented by user */
626
- keydown : ( keyCode : number , label : string ) => void ;
631
+ keydown ? : ( keyCode : number , label : string ) => void ;
627
632
/** callback, to be implemented by user */
628
- keyup : ( keyCode : number , label : string ) => void ;
629
- abstract status ( name : string , value : any ) : void ;
630
- abstract status ( value : object | string ) : void ;
631
- abstract info ( text : string ) : void ;
633
+ keyup ? : ( keyCode : number , label : string ) => void ;
634
+ status ( name : string , value : any ) : void ;
635
+ status ( value : object | string ) : void ;
636
+ info ( text : string ) : void ;
632
637
color ( r : number , g : number , b : number ) : string ;
633
- abstract drawPoint ( p : {
634
- x : number ;
635
- y : number ;
636
- } , r : any , color : string ) : void ;
637
- abstract drawCircle ( p : {
638
- x : number ;
639
- y : number ;
640
- } , r : number , color : string ) : void ;
641
- abstract drawEdge ( a : {
642
- x : number ;
643
- y : number ;
644
- } , b : {
645
- x : number ;
646
- y : number ;
647
- } , color : string ) : void ;
648
- abstract drawSegment ( a : {
649
- x : number ;
650
- y : number ;
651
- } , b : {
652
- x : number ;
653
- y : number ;
654
- } , color : string ) : void ;
655
- abstract drawPolygon ( points : Array < {
656
- x : number ;
657
- y : number ;
658
- } > , color : string ) : void ;
659
- abstract drawAABB ( aabb : AABBValue , color : string ) : void ;
660
- abstract start ( world : World ) : void ;
661
- abstract findOne ( query : string ) : ( Body$1 | Joint | Fixture | null ) ;
662
- abstract findAll ( query : string ) : ( Body$1 | Joint | Fixture ) [ ] ;
638
+ drawPoint ( p : Vec2Value , r : any , color : string ) : void ;
639
+ drawCircle ( p : Vec2Value , r : number , color : string ) : void ;
640
+ drawEdge ( a : Vec2Value , b : Vec2Value , color : string ) : void ;
641
+ drawSegment ( a : Vec2Value , b : Vec2Value , color : string ) : void ;
642
+ drawPolygon ( points : Array < Vec2Value > , color : string ) : void ;
643
+ drawChain ( points : Array < Vec2Value > , color : string ) : void ;
644
+ drawAABB ( aabb : AABBValue , color : string ) : void ;
645
+ start ( world : World ) : void ;
646
+ findOne ( query : string ) : Body$1 | Joint | Fixture | null ;
647
+ findAll ( query : string ) : ( Body$1 | Joint | Fixture ) [ ] ;
663
648
}
664
649
export type TestbedFactoryOptions = string | TestbedMountOptions ;
665
650
/** @deprecated */
666
- export type TestbedCallback = ( testbed : Testbed ) => ( World | undefined ) ;
651
+ export type TestbedCallback = ( testbed : TestbedInterface ) => World | undefined ;
667
652
/** @deprecated */
668
653
export declare function testbed ( callback : TestbedCallback ) : void ;
669
654
/** @deprecated */
670
655
export declare function testbed ( options : TestbedFactoryOptions , callback : TestbedCallback ) : void ;
656
+ export type KEY = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" | "right" | "left" | "up" | "down" | "fire" ;
671
657
/**
672
658
* A shape is used for collision detection. You can create a shape however you
673
659
* like. Shapes used for simulation in World are created automatically when a
@@ -1025,6 +1011,10 @@ export declare class Fixture {
1025
1011
constructor ( body : Body$1 , shape : Shape , density ?: number ) ;
1026
1012
/** @hidden Re-setup fixture. */
1027
1013
_reset ( ) : void ;
1014
+ /** @hidden */
1015
+ _serialize ( ) : object ;
1016
+ /** @hidden */
1017
+ static _deserialize ( data : any , body : any , restore : any ) : Fixture ;
1028
1018
/**
1029
1019
* Get the type of the child shape. You can use this to down cast to the
1030
1020
* concrete shape.
@@ -1568,6 +1558,10 @@ declare class Body$1 {
1568
1558
style : Style ;
1569
1559
/** @hidden @experimental Similar to userData, but used by dev-tools or runtime environment. */
1570
1560
appData : Record < string , any > ;
1561
+ /** @hidden */
1562
+ _serialize ( ) : object ;
1563
+ /** @hidden */
1564
+ static _deserialize ( data : any , world : any , restore : any ) : Body$1 ;
1571
1565
isWorldLocked ( ) : boolean ;
1572
1566
getWorld ( ) : World ;
1573
1567
getNext ( ) : Body$1 | null ;
@@ -1962,6 +1956,10 @@ export declare class World {
1962
1956
* @param def World definition or gravity vector.
1963
1957
*/
1964
1958
constructor ( def ?: WorldDef | Vec2Value ) ;
1959
+ /** @hidden */
1960
+ _serialize ( ) : object ;
1961
+ /** @hidden */
1962
+ static _deserialize ( data : any , context : any , restore : any ) : World ;
1965
1963
/**
1966
1964
* Get the world body list. With the returned body, use Body.getNext to get the
1967
1965
* next body in the world list. A null body indicates the end of the list.
@@ -2244,6 +2242,10 @@ export declare class Vec3 {
2244
2242
constructor ( obj : Vec3Value ) ;
2245
2243
constructor ( ) ;
2246
2244
/** @hidden */
2245
+ _serialize ( ) : object ;
2246
+ /** @hidden */
2247
+ static _deserialize ( data : any ) : Vec3 ;
2248
+ /** @hidden */
2247
2249
static neo ( x : number , y : number , z : number ) : Vec3 ;
2248
2250
static zero ( ) : Vec3 ;
2249
2251
static clone ( v : Vec3Value ) : Vec3 ;
@@ -2378,6 +2380,10 @@ export declare class CircleShape extends Shape {
2378
2380
constructor ( position : Vec2Value , radius ?: number ) ;
2379
2381
constructor ( radius ?: number ) ;
2380
2382
/** @hidden */
2383
+ _serialize ( ) : object ;
2384
+ /** @hidden */
2385
+ static _deserialize ( data : any ) : CircleShape ;
2386
+ /** @hidden */
2381
2387
_reset ( ) : void ;
2382
2388
getType ( ) : "circle" ;
2383
2389
getRadius ( ) : number ;
@@ -2442,6 +2448,10 @@ export declare class EdgeShape extends Shape {
2442
2448
/** @hidden */ m_hasVertex3 : boolean ;
2443
2449
constructor ( v1 ?: Vec2Value , v2 ?: Vec2Value ) ;
2444
2450
/** @hidden */
2451
+ _serialize ( ) : object ;
2452
+ /** @hidden */
2453
+ static _deserialize ( data : any ) : EdgeShape ;
2454
+ /** @hidden */
2445
2455
_reset ( ) : void ;
2446
2456
getRadius ( ) : number ;
2447
2457
getType ( ) : "edge" ;
@@ -2523,6 +2533,10 @@ export declare class PolygonShape extends Shape {
2523
2533
/** @hidden */ m_count : number ;
2524
2534
/** @hidden */ m_radius : number ;
2525
2535
constructor ( vertices ?: Vec2Value [ ] ) ;
2536
+ /** @hidden */
2537
+ _serialize ( ) : object ;
2538
+ /** @hidden */
2539
+ static _deserialize ( data : any , fixture : any , restore : any ) : PolygonShape ;
2526
2540
getType ( ) : "polygon" ;
2527
2541
getRadius ( ) : number ;
2528
2542
/**
@@ -2595,6 +2609,10 @@ export declare class ChainShape extends Shape {
2595
2609
/** @hidden */ m_hasNextVertex : boolean ;
2596
2610
/** @hidden */ m_isLoop : boolean ;
2597
2611
constructor ( vertices ?: Vec2Value [ ] , loop ?: boolean ) ;
2612
+ /** @hidden */
2613
+ _serialize ( ) : object ;
2614
+ /** @hidden */
2615
+ static _deserialize ( data : any , fixture : any , restore : any ) : ChainShape ;
2598
2616
getType ( ) : "chain" ;
2599
2617
getRadius ( ) : number ;
2600
2618
/** @hidden */
@@ -2680,10 +2698,10 @@ export declare const CollideCircles: (manifold: Manifold, circleA: CircleShape,
2680
2698
export declare const CollideEdgeCircle : ( manifold : Manifold , edgeA : EdgeShape , xfA : TransformValue , circleB : CircleShape , xfB : TransformValue ) => void ;
2681
2699
/**
2682
2700
*
2683
- * Find edge normal of max separation on A - return if separating axis is found<br>
2684
- * Find edge normal of max separation on B - return if separation axis is found<br>
2685
- * Choose reference edge as min(minA, minB)<br>
2686
- * Find incident edge<br>
2701
+ * Find edge normal of max separation on A - return if separating axis is found
2702
+ * Find edge normal of max separation on B - return if separation axis is found
2703
+ * Choose reference edge as min(minA, minB)
2704
+ * Find incident edge
2687
2705
* Clip
2688
2706
*
2689
2707
* The normal points from 1 to 2
@@ -2753,6 +2771,10 @@ export declare class DistanceJoint extends Joint {
2753
2771
*/
2754
2772
constructor ( def : DistanceJointOpt , bodyA : Body$1 , bodyB : Body$1 , anchorA ?: Vec2Value , anchorB ?: Vec2Value ) ;
2755
2773
/** @hidden */
2774
+ _serialize ( ) : object ;
2775
+ /** @hidden */
2776
+ static _deserialize ( data : any , world : any , restore : any ) : DistanceJoint ;
2777
+ /** @hidden */
2756
2778
_reset ( def : Partial < DistanceJointDef > ) : void ;
2757
2779
/**
2758
2780
* The local anchor point relative to bodyA's origin.
@@ -2840,6 +2862,10 @@ export declare class FrictionJoint extends Joint {
2840
2862
*/
2841
2863
constructor ( def : FrictionJointOpt , bodyA : Body$1 , bodyB : Body$1 , anchor ?: Vec2Value ) ;
2842
2864
/** @hidden */
2865
+ _serialize ( ) : object ;
2866
+ /** @hidden */
2867
+ static _deserialize ( data : any , world : any , restore : any ) : FrictionJoint ;
2868
+ /** @hidden */
2843
2869
_reset ( def : Partial < FrictionJointDef > ) : void ;
2844
2870
/**
2845
2871
* The local anchor point relative to bodyA's origin.
@@ -2970,6 +2996,10 @@ export declare class RevoluteJoint extends Joint {
2970
2996
constructor ( def : RevoluteJointDef ) ;
2971
2997
constructor ( def : RevoluteJointOpt , bodyA : Body$1 , bodyB : Body$1 , anchor ?: Vec2Value ) ;
2972
2998
/** @hidden */
2999
+ _serialize ( ) : object ;
3000
+ /** @hidden */
3001
+ static _deserialize ( data : any , world : any , restore : any ) : RevoluteJoint ;
3002
+ /** @hidden */
2973
3003
_reset ( def : Partial < RevoluteJointDef > ) : void ;
2974
3004
/**
2975
3005
* The local anchor point relative to bodyA's origin.
@@ -3136,6 +3166,10 @@ export declare class PrismaticJoint extends Joint {
3136
3166
constructor ( def : PrismaticJointDef ) ;
3137
3167
constructor ( def : PrismaticJointOpt , bodyA : Body$1 , bodyB : Body$1 , anchor ?: Vec2Value , axis ?: Vec2Value ) ;
3138
3168
/** @hidden */
3169
+ _serialize ( ) : object ;
3170
+ /** @hidden */
3171
+ static _deserialize ( data : any , world : any , restore : any ) : PrismaticJoint ;
3172
+ /** @hidden */
3139
3173
_reset ( def : Partial < PrismaticJointDef > ) : void ;
3140
3174
/**
3141
3175
* The local anchor point relative to bodyA's origin.
@@ -3273,6 +3307,10 @@ export declare class GearJoint extends Joint {
3273
3307
constructor ( def : GearJointDef ) ;
3274
3308
constructor ( def : GearJointOpt , bodyA : Body$1 , bodyB : Body$1 , joint1 : RevoluteJoint | PrismaticJoint , joint2 : RevoluteJoint | PrismaticJoint , ratio ?: number ) ;
3275
3309
/** @hidden */
3310
+ _serialize ( ) : object ;
3311
+ /** @hidden */
3312
+ static _deserialize ( data : any , world : any , restore : any ) : GearJoint ;
3313
+ /** @hidden */
3276
3314
_reset ( def : Partial < GearJointDef > ) : void ;
3277
3315
/**
3278
3316
* Get the first joint.
@@ -3357,6 +3395,10 @@ export declare class MotorJoint extends Joint {
3357
3395
constructor ( def : MotorJointDef ) ;
3358
3396
constructor ( def : MotorJointOpt , bodyA : Body$1 , bodyB : Body$1 ) ;
3359
3397
/** @hidden */
3398
+ _serialize ( ) : object ;
3399
+ /** @hidden */
3400
+ static _deserialize ( data : any , world : any , restore : any ) : MotorJoint ;
3401
+ /** @hidden */
3360
3402
_reset ( def : Partial < MotorJointDef > ) : void ;
3361
3403
/**
3362
3404
* Set the maximum friction force in N.
@@ -3468,6 +3510,10 @@ export declare class MouseJoint extends Joint {
3468
3510
constructor ( def : MouseJointDef ) ;
3469
3511
constructor ( def : MouseJointOpt , bodyA : Body$1 , bodyB : Body$1 , target ?: Vec2Value ) ;
3470
3512
/** @hidden */
3513
+ _serialize ( ) : object ;
3514
+ /** @hidden */
3515
+ static _deserialize ( data : any , world : any , restore : any ) : MouseJoint ;
3516
+ /** @hidden */
3471
3517
_reset ( def : Partial < MouseJointDef > ) : void ;
3472
3518
/**
3473
3519
* Use this to update the target point.
@@ -3587,6 +3633,10 @@ export declare class PulleyJoint extends Joint {
3587
3633
constructor ( def : PulleyJointDef ) ;
3588
3634
constructor ( def : PulleyJointOpt , bodyA : Body$1 , bodyB : Body$1 , groundA ?: Vec2Value , groundB ?: Vec2Value , anchorA ?: Vec2Value , anchorB ?: Vec2Value , ratio ?: number ) ;
3589
3635
/** @hidden */
3636
+ _serialize ( ) : object ;
3637
+ /** @hidden */
3638
+ static _deserialize ( data : any , world : any , restore : any ) : PulleyJoint ;
3639
+ /** @hidden */
3590
3640
_reset ( def : Partial < PulleyJointDef > ) : void ;
3591
3641
/**
3592
3642
* Get the first ground anchor.
@@ -3692,6 +3742,10 @@ export declare class RopeJoint extends Joint {
3692
3742
constructor ( def : RopeJointDef ) ;
3693
3743
constructor ( def : RopeJointOpt , bodyA : Body$1 , bodyB : Body$1 , anchor ?: Vec2Value ) ;
3694
3744
/** @hidden */
3745
+ _serialize ( ) : object ;
3746
+ /** @hidden */
3747
+ static _deserialize ( data : any , world : any , restore : any ) : RopeJoint ;
3748
+ /** @hidden */
3695
3749
_reset ( def : Partial < RopeJointDef > ) : void ;
3696
3750
/**
3697
3751
* The local anchor point relative to bodyA's origin.
@@ -3781,6 +3835,10 @@ export declare class WeldJoint extends Joint {
3781
3835
constructor ( def : WeldJointDef ) ;
3782
3836
constructor ( def : WeldJointOpt , bodyA : Body$1 , bodyB : Body$1 , anchor ?: Vec2Value ) ;
3783
3837
/** @hidden */
3838
+ _serialize ( ) : object ;
3839
+ /** @hidden */
3840
+ static _deserialize ( data : any , world : any , restore : any ) : WeldJoint ;
3841
+ /** @hidden */
3784
3842
_reset ( def : Partial < WeldJointDef > ) : void ;
3785
3843
/**
3786
3844
* The local anchor point relative to bodyA's origin.
@@ -3900,6 +3958,10 @@ export declare class WheelJoint extends Joint {
3900
3958
constructor ( def : WheelJointDef ) ;
3901
3959
constructor ( def : WheelJointOpt , bodyA : Body$1 , bodyB : Body$1 , anchor ?: Vec2Value , axis ?: Vec2Value ) ;
3902
3960
/** @hidden */
3961
+ _serialize ( ) : object ;
3962
+ /** @hidden */
3963
+ static _deserialize ( data : any , world : any , restore : any ) : WheelJoint ;
3964
+ /** @hidden */
3903
3965
_reset ( def : Partial < WheelJointDef > ) : void ;
3904
3966
/**
3905
3967
* The local anchor point relative to bodyA's origin.
@@ -4223,13 +4285,14 @@ export declare const internal: {
4223
4285
toString ( newline ?: string ) : string ;
4224
4286
} ;
4225
4287
} ;
4288
+ /** @hidden */
4226
4289
export interface DataDriverListener < D , R > {
4227
4290
enter : ( d : D ) => R | null ;
4228
4291
exit : ( d : D , ref : R ) => void ;
4229
4292
update : ( d : D , ref : R ) => void ;
4230
4293
}
4231
4294
/**
4232
- * @experimental
4295
+ * @experimental @hidden
4233
4296
*
4234
4297
* DataDriver is used it to create, update and destroy physics entities based on game objects.
4235
4298
*/
0 commit comments