melonjs 10.11.0 → 10.12.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.
- package/dist/melonjs.js +151 -121
- package/dist/melonjs.min.js +3 -3
- package/dist/melonjs.module.d.ts +197 -111
- package/dist/melonjs.module.js +147 -123
- package/package.json +7 -7
- package/src/entity/entity.js +5 -7
- package/src/geometries/ellipse.js +1 -1
- package/src/geometries/path2d.js +4 -4
- package/src/geometries/poly.js +1 -2
- package/src/geometries/rectangle.js +1 -1
- package/src/physics/body.js +3 -4
- package/src/physics/collision.js +1 -12
- package/src/physics/detector.js +6 -52
- package/src/physics/response.js +48 -0
- package/src/physics/sat.js +1 -1
- package/src/renderable/GUI.js +6 -4
- package/src/renderable/colorlayer.js +9 -7
- package/src/renderable/container.js +12 -10
- package/src/renderable/dragndrop.js +1 -1
- package/src/renderable/imagelayer.js +5 -5
- package/src/renderable/light2d.js +7 -3
- package/src/renderable/renderable.js +6 -6
- package/src/renderable/sprite.js +4 -4
- package/src/renderable/trigger.js +9 -2
- package/src/state/state.js +19 -3
- package/src/system/pooling.js +1 -1
- package/src/text/text.js +6 -3
- package/src/video/texture/atlas.js +2 -0
package/dist/melonjs.module.d.ts
CHANGED
|
@@ -184,6 +184,7 @@ export class BitmapTextData {
|
|
|
184
184
|
/**
|
|
185
185
|
* @classdesc
|
|
186
186
|
* a Generic Physic Body Object with some physic properties and behavior functionality, to as a member of a Renderable.
|
|
187
|
+
* @see Renderable.body
|
|
187
188
|
*/
|
|
188
189
|
export class Body {
|
|
189
190
|
/**
|
|
@@ -431,7 +432,7 @@ export class Body {
|
|
|
431
432
|
setCollisionType(type: number): void;
|
|
432
433
|
/**
|
|
433
434
|
* the built-in function to solve the collision response
|
|
434
|
-
* @param {object} response the collision response object (see {@link
|
|
435
|
+
* @param {object} response the collision response object (see {@link ResponseObject})
|
|
435
436
|
*/
|
|
436
437
|
respondToCollision(response: object): void;
|
|
437
438
|
/**
|
|
@@ -477,16 +478,14 @@ export class Body {
|
|
|
477
478
|
* cap the body velocity (body.maxVel property) to the specified value<br>
|
|
478
479
|
* @param {number} x max velocity on x axis
|
|
479
480
|
* @param {number} y max velocity on y axis
|
|
480
|
-
* @protected
|
|
481
481
|
*/
|
|
482
|
-
|
|
482
|
+
setMaxVelocity(x: number, y: number): void;
|
|
483
483
|
/**
|
|
484
484
|
* set the body default friction
|
|
485
485
|
* @param {number} x horizontal friction
|
|
486
486
|
* @param {number} y vertical friction
|
|
487
|
-
* @protected
|
|
488
487
|
*/
|
|
489
|
-
|
|
488
|
+
setFriction(x?: number, y?: number): void;
|
|
490
489
|
/**
|
|
491
490
|
* compute the new velocity value
|
|
492
491
|
* @ignore
|
|
@@ -1653,11 +1652,6 @@ export class ColorLayer extends Renderable {
|
|
|
1653
1652
|
*/
|
|
1654
1653
|
public color: Color;
|
|
1655
1654
|
onResetEvent(name: any, color: any, z?: number): void;
|
|
1656
|
-
/**
|
|
1657
|
-
* draw the color layer
|
|
1658
|
-
* @ignore
|
|
1659
|
-
*/
|
|
1660
|
-
draw(renderer: any, rect: any): void;
|
|
1661
1655
|
/**
|
|
1662
1656
|
* Destroy function
|
|
1663
1657
|
* @ignore
|
|
@@ -1739,7 +1733,7 @@ export class Container extends Renderable {
|
|
|
1739
1733
|
* @memberof Container#
|
|
1740
1734
|
* @param {number} index added or removed child index
|
|
1741
1735
|
*/
|
|
1742
|
-
onChildChange: () => void;
|
|
1736
|
+
onChildChange: (index: number) => void;
|
|
1743
1737
|
/**
|
|
1744
1738
|
* Specify if the container bounds should automatically take in account
|
|
1745
1739
|
* all child bounds when updated (this is expensive and disabled by default,
|
|
@@ -1780,8 +1774,10 @@ export class Container extends Renderable {
|
|
|
1780
1774
|
* Adding a child to the container will automatically remove it from its other container.
|
|
1781
1775
|
* Meaning a child can only have one parent. This is important if you add a renderable
|
|
1782
1776
|
* to a container then add it to the me.game.world container it will move it out of the
|
|
1783
|
-
* orginal container.
|
|
1784
|
-
* will not be in any container.
|
|
1777
|
+
* orginal container. Then when the me.game.world.reset() is called the renderable
|
|
1778
|
+
* will not be in any container. <br>
|
|
1779
|
+
* if the given child implements a onActivateEvent method, that method will be called
|
|
1780
|
+
* once the child is added to this container.
|
|
1785
1781
|
* @name addChild
|
|
1786
1782
|
* @memberof Container
|
|
1787
1783
|
* @param {Renderable} child
|
|
@@ -1954,7 +1950,8 @@ export class Container extends Renderable {
|
|
|
1954
1950
|
*/
|
|
1955
1951
|
onActivateEvent(): void;
|
|
1956
1952
|
/**
|
|
1957
|
-
* Invokes the removeChildNow in a defer, to ensure the child is removed safely after the update & draw stack has completed
|
|
1953
|
+
* Invokes the removeChildNow in a defer, to ensure the child is removed safely after the update & draw stack has completed. <br>
|
|
1954
|
+
* if the given child implements a onDeactivateEvent() method, that method will be called once the child is removed from this container.
|
|
1958
1955
|
* @name removeChild
|
|
1959
1956
|
* @memberof Container
|
|
1960
1957
|
* @public
|
|
@@ -2041,16 +2038,6 @@ export class Container extends Renderable {
|
|
|
2041
2038
|
* @ignore
|
|
2042
2039
|
*/
|
|
2043
2040
|
_sortY(a: any, b: any): number;
|
|
2044
|
-
/**
|
|
2045
|
-
* draw the container. <br>
|
|
2046
|
-
* automatically called by the game manager {@link game}
|
|
2047
|
-
* @name draw
|
|
2048
|
-
* @memberof Container
|
|
2049
|
-
* @protected
|
|
2050
|
-
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
2051
|
-
* @param {Rect|Bounds} [rect] the area or viewport to (re)draw
|
|
2052
|
-
*/
|
|
2053
|
-
protected draw(renderer: CanvasRenderer | WebGLRenderer, rect?: Rect | Bounds): void;
|
|
2054
2041
|
}
|
|
2055
2042
|
/**
|
|
2056
2043
|
* @classdesc
|
|
@@ -2174,7 +2161,7 @@ export class DropTarget extends Renderable {
|
|
|
2174
2161
|
* @memberof DropTarget
|
|
2175
2162
|
* @param {Draggable} draggable the draggable object that is dropped
|
|
2176
2163
|
*/
|
|
2177
|
-
drop(): void;
|
|
2164
|
+
drop(draggable: Draggable): void;
|
|
2178
2165
|
/**
|
|
2179
2166
|
* Destructor
|
|
2180
2167
|
* @name destroy
|
|
@@ -2302,7 +2289,7 @@ export class Ellipse {
|
|
|
2302
2289
|
* @param {Matrix2d} matrix the transformation matrix
|
|
2303
2290
|
* @returns {Polygon} Reference to this object for method chaining
|
|
2304
2291
|
*/
|
|
2305
|
-
transform(): Polygon;
|
|
2292
|
+
transform(matrix: Matrix2d): Polygon;
|
|
2306
2293
|
/**
|
|
2307
2294
|
* translate the circle/ellipse by the specified offset
|
|
2308
2295
|
* @name translate
|
|
@@ -2440,17 +2427,6 @@ export class Entity extends Renderable {
|
|
|
2440
2427
|
*/
|
|
2441
2428
|
onBodyUpdate(body: Body): void;
|
|
2442
2429
|
preDraw(renderer: any): void;
|
|
2443
|
-
/**
|
|
2444
|
-
* object draw<br>
|
|
2445
|
-
* not to be called by the end user<br>
|
|
2446
|
-
* called by the game manager on each game loop
|
|
2447
|
-
* @name draw
|
|
2448
|
-
* @memberof Entity
|
|
2449
|
-
* @protected
|
|
2450
|
-
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
2451
|
-
* @param {Rect} rect region to draw
|
|
2452
|
-
*/
|
|
2453
|
-
protected draw(renderer: CanvasRenderer | WebGLRenderer, rect: Rect): void;
|
|
2454
2430
|
/**
|
|
2455
2431
|
* onDeactivateEvent Notification function<br>
|
|
2456
2432
|
* Called by engine before deleting the object
|
|
@@ -2667,7 +2643,7 @@ export class GUI_Object extends Sprite {
|
|
|
2667
2643
|
* @param {Pointer} event the event object
|
|
2668
2644
|
* @returns {boolean} return false if we need to stop propagating the event
|
|
2669
2645
|
*/
|
|
2670
|
-
public onClick(): boolean;
|
|
2646
|
+
public onClick(event: Pointer): boolean;
|
|
2671
2647
|
/**
|
|
2672
2648
|
* function callback for the pointerEnter event
|
|
2673
2649
|
* @ignore
|
|
@@ -2680,7 +2656,7 @@ export class GUI_Object extends Sprite {
|
|
|
2680
2656
|
* @public
|
|
2681
2657
|
* @param {Pointer} event the event object
|
|
2682
2658
|
*/
|
|
2683
|
-
public onOver(): void;
|
|
2659
|
+
public onOver(event: Pointer): void;
|
|
2684
2660
|
/**
|
|
2685
2661
|
* function callback for the pointerLeave event
|
|
2686
2662
|
* @ignore
|
|
@@ -2693,7 +2669,7 @@ export class GUI_Object extends Sprite {
|
|
|
2693
2669
|
* @public
|
|
2694
2670
|
* @param {Pointer} event the event object
|
|
2695
2671
|
*/
|
|
2696
|
-
public onOut(): void;
|
|
2672
|
+
public onOut(event: Pointer): void;
|
|
2697
2673
|
/**
|
|
2698
2674
|
* function callback for the pointerup event
|
|
2699
2675
|
* @ignore
|
|
@@ -2794,14 +2770,6 @@ export class ImageLayer extends Renderable {
|
|
|
2794
2770
|
repeatX: boolean;
|
|
2795
2771
|
repeatY: boolean;
|
|
2796
2772
|
onActivateEvent(): void;
|
|
2797
|
-
/**
|
|
2798
|
-
* resize the Image Layer to match the given size
|
|
2799
|
-
* @name resize
|
|
2800
|
-
* @memberof ImageLayer
|
|
2801
|
-
* @param {number} w new width
|
|
2802
|
-
* @param {number} h new height
|
|
2803
|
-
*/
|
|
2804
|
-
resize(w: number, h: number): void;
|
|
2805
2773
|
/**
|
|
2806
2774
|
* createPattern function
|
|
2807
2775
|
* @ignore
|
|
@@ -2871,11 +2839,6 @@ export class Light2d extends Renderable {
|
|
|
2871
2839
|
* @returns {Ellipse} the light visible mask
|
|
2872
2840
|
*/
|
|
2873
2841
|
getVisibleArea(): Ellipse;
|
|
2874
|
-
/**
|
|
2875
|
-
* object draw (Called internally by the engine).
|
|
2876
|
-
* @ignore
|
|
2877
|
-
*/
|
|
2878
|
-
draw(renderer: any): void;
|
|
2879
2842
|
/**
|
|
2880
2843
|
* Destroy function<br>
|
|
2881
2844
|
* @ignore
|
|
@@ -5220,7 +5183,7 @@ export class Pointer extends Bounds {
|
|
|
5220
5183
|
* (which means that all angles are less than 180 degrees), as described here below : <br>
|
|
5221
5184
|
* <center><img src="images/convex_polygon.png"/></center><br>
|
|
5222
5185
|
*
|
|
5223
|
-
* A polygon's `winding` is clockwise
|
|
5186
|
+
* A polygon's `winding` is clockwise if its vertices (points) are declared turning to the right. The image above shows COUNTERCLOCKWISE winding.
|
|
5224
5187
|
*/
|
|
5225
5188
|
export class Polygon {
|
|
5226
5189
|
/**
|
|
@@ -5609,10 +5572,10 @@ export class Rect extends Polygon {
|
|
|
5609
5572
|
* @name centerOn
|
|
5610
5573
|
* @memberof Rect
|
|
5611
5574
|
* @param {number} x the x coordinate around which to center this rectangle
|
|
5612
|
-
* @param {number}
|
|
5575
|
+
* @param {number} y the y coordinate around which to center this rectangle
|
|
5613
5576
|
* @returns {Rect} this rectangle
|
|
5614
5577
|
*/
|
|
5615
|
-
centerOn(x: number, y:
|
|
5578
|
+
centerOn(x: number, y: number): Rect;
|
|
5616
5579
|
/**
|
|
5617
5580
|
* resize the rectangle
|
|
5618
5581
|
* @name resize
|
|
@@ -6127,14 +6090,14 @@ export class Renderable extends Rect {
|
|
|
6127
6090
|
*/
|
|
6128
6091
|
protected preDraw(renderer: CanvasRenderer | WebGLRenderer): void;
|
|
6129
6092
|
/**
|
|
6130
|
-
*
|
|
6131
|
-
* automatically called by the game manager {@link game}
|
|
6093
|
+
* draw this renderable (automatically called by melonJS)
|
|
6132
6094
|
* @name draw
|
|
6133
6095
|
* @memberof Renderable
|
|
6134
6096
|
* @protected
|
|
6135
|
-
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer
|
|
6097
|
+
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer instance
|
|
6098
|
+
* @param {Camera2d} [viewport] the viewport to (re)draw
|
|
6136
6099
|
*/
|
|
6137
|
-
protected draw(renderer: CanvasRenderer | WebGLRenderer): void;
|
|
6100
|
+
protected draw(renderer: CanvasRenderer | WebGLRenderer, viewport?: Camera2d): void;
|
|
6138
6101
|
/**
|
|
6139
6102
|
* restore the rendering context after drawing. <br>
|
|
6140
6103
|
* automatically called by the game manager {@link game}
|
|
@@ -6149,7 +6112,7 @@ export class Renderable extends Rect {
|
|
|
6149
6112
|
* when this renderable body is colliding with another one
|
|
6150
6113
|
* @name onCollision
|
|
6151
6114
|
* @memberof Renderable
|
|
6152
|
-
* @param {
|
|
6115
|
+
* @param {ResponseObject} response the collision response object
|
|
6153
6116
|
* @param {Renderable} other the other renderable touching this one (a reference to response.a or response.b)
|
|
6154
6117
|
* @returns {boolean} true if the object should respond to the collision (its position and velocity will be corrected)
|
|
6155
6118
|
* @example
|
|
@@ -6166,7 +6129,7 @@ export class Renderable extends Rect {
|
|
|
6166
6129
|
* return true;
|
|
6167
6130
|
* },
|
|
6168
6131
|
*/
|
|
6169
|
-
onCollision(): boolean;
|
|
6132
|
+
onCollision(response: ResponseObject, other: Renderable): boolean;
|
|
6170
6133
|
/**
|
|
6171
6134
|
* Destroy function<br>
|
|
6172
6135
|
* @ignore
|
|
@@ -7693,11 +7656,11 @@ export class Text extends Renderable {
|
|
|
7693
7656
|
setText(value?: number | string | string[]): Text;
|
|
7694
7657
|
/**
|
|
7695
7658
|
* measure the given text size in pixels
|
|
7696
|
-
* @param {CanvasRenderer|WebGLRenderer}
|
|
7659
|
+
* @param {CanvasRenderer|WebGLRenderer} renderer reference to the active renderer
|
|
7697
7660
|
* @param {string} [text] the text to be measured
|
|
7698
7661
|
* @returns {TextMetrics} a TextMetrics object defining the dimensions of the given piece of text
|
|
7699
7662
|
*/
|
|
7700
|
-
measureText(renderer
|
|
7663
|
+
measureText(renderer: CanvasRenderer | WebGLRenderer, text?: string): TextMetrics;
|
|
7701
7664
|
/**
|
|
7702
7665
|
* draw a text at the specified coord
|
|
7703
7666
|
* @param {CanvasRenderer|WebGLRenderer} renderer Reference to the destination renderer instance
|
|
@@ -7837,9 +7800,11 @@ export class TextureAtlas {
|
|
|
7837
7800
|
* add uvs mapping for the given region
|
|
7838
7801
|
* @param {object} atlas the atlas dictionnary where the region is define
|
|
7839
7802
|
* @param {object} name region (or frame) name
|
|
7803
|
+
* @param {number} w the width of the region
|
|
7804
|
+
* @param {number} h the height of the region
|
|
7840
7805
|
* @returns {Float32Array} the created region UVs
|
|
7841
7806
|
*/
|
|
7842
|
-
addUVs(atlas: object, name: object, w:
|
|
7807
|
+
addUVs(atlas: object, name: object, w: number, h: number): Float32Array;
|
|
7843
7808
|
/**
|
|
7844
7809
|
* Create a sprite object using the first region found using the specified name
|
|
7845
7810
|
* @param {string} name name of the sprite
|
|
@@ -9699,12 +9664,76 @@ export var audio: Readonly<{
|
|
|
9699
9664
|
* @public
|
|
9700
9665
|
*/
|
|
9701
9666
|
export function boot(): void;
|
|
9702
|
-
|
|
9703
|
-
|
|
9704
|
-
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
|
|
9667
|
+
export namespace collision {
|
|
9668
|
+
const maxChildren: number;
|
|
9669
|
+
const maxDepth: number;
|
|
9670
|
+
namespace types {
|
|
9671
|
+
const NO_OBJECT: number;
|
|
9672
|
+
const PLAYER_OBJECT: number;
|
|
9673
|
+
const NPC_OBJECT: number;
|
|
9674
|
+
const ENEMY_OBJECT: number;
|
|
9675
|
+
const COLLECTABLE_OBJECT: number;
|
|
9676
|
+
const ACTION_OBJECT: number;
|
|
9677
|
+
const PROJECTILE_OBJECT: number;
|
|
9678
|
+
const WORLD_SHAPE: number;
|
|
9679
|
+
const USER: number;
|
|
9680
|
+
const ALL_OBJECT: number;
|
|
9681
|
+
}
|
|
9682
|
+
/**
|
|
9683
|
+
* Checks for object colliding with the given line
|
|
9684
|
+
* @name rayCast
|
|
9685
|
+
* @memberof collision
|
|
9686
|
+
* @public
|
|
9687
|
+
* @param {Line} line line to be tested for collision
|
|
9688
|
+
* @param {Array.<Renderable>} [result] a user defined array that will be populated with intersecting physic objects.
|
|
9689
|
+
* @returns {Array.<Renderable>} an array of intersecting physic objects
|
|
9690
|
+
* @example
|
|
9691
|
+
* // define a line accross the viewport
|
|
9692
|
+
* var ray = new me.Line(
|
|
9693
|
+
* // absolute position of the line
|
|
9694
|
+
* 0, 0, [
|
|
9695
|
+
* // starting point relative to the initial position
|
|
9696
|
+
* new me.Vector2d(0, 0),
|
|
9697
|
+
* // ending point
|
|
9698
|
+
* new me.Vector2d(me.game.viewport.width, me.game.viewport.height)
|
|
9699
|
+
* ]);
|
|
9700
|
+
*
|
|
9701
|
+
* // check for collition
|
|
9702
|
+
* result = me.collision.rayCast(ray);
|
|
9703
|
+
*
|
|
9704
|
+
* if (result.length > 0) {
|
|
9705
|
+
* // ...
|
|
9706
|
+
* }
|
|
9707
|
+
*/
|
|
9708
|
+
function rayCast(line: Line, result?: Renderable[]): Renderable[];
|
|
9709
|
+
/**
|
|
9710
|
+
* Checks for object colliding with the given line
|
|
9711
|
+
* @name rayCast
|
|
9712
|
+
* @memberof collision
|
|
9713
|
+
* @public
|
|
9714
|
+
* @param {Line} line line to be tested for collision
|
|
9715
|
+
* @param {Array.<Renderable>} [result] a user defined array that will be populated with intersecting physic objects.
|
|
9716
|
+
* @returns {Array.<Renderable>} an array of intersecting physic objects
|
|
9717
|
+
* @example
|
|
9718
|
+
* // define a line accross the viewport
|
|
9719
|
+
* var ray = new me.Line(
|
|
9720
|
+
* // absolute position of the line
|
|
9721
|
+
* 0, 0, [
|
|
9722
|
+
* // starting point relative to the initial position
|
|
9723
|
+
* new me.Vector2d(0, 0),
|
|
9724
|
+
* // ending point
|
|
9725
|
+
* new me.Vector2d(me.game.viewport.width, me.game.viewport.height)
|
|
9726
|
+
* ]);
|
|
9727
|
+
*
|
|
9728
|
+
* // check for collition
|
|
9729
|
+
* result = me.collision.rayCast(ray);
|
|
9730
|
+
*
|
|
9731
|
+
* if (result.length > 0) {
|
|
9732
|
+
* // ...
|
|
9733
|
+
* }
|
|
9734
|
+
*/
|
|
9735
|
+
function rayCast(line: Line, result?: Renderable[]): Renderable[];
|
|
9736
|
+
}
|
|
9708
9737
|
export namespace device {
|
|
9709
9738
|
const devicePixelRatio: number;
|
|
9710
9739
|
const isFullscreen: boolean;
|
|
@@ -10756,17 +10785,18 @@ export namespace save {
|
|
|
10756
10785
|
*/
|
|
10757
10786
|
export var skipAutoInit: boolean;
|
|
10758
10787
|
export namespace state {
|
|
10759
|
-
const LOADING: number;
|
|
10760
|
-
const MENU: number;
|
|
10761
|
-
const READY: number;
|
|
10762
|
-
const PLAY: number;
|
|
10763
|
-
const GAMEOVER: number;
|
|
10764
|
-
const GAME_END: number;
|
|
10765
|
-
const SCORE: number;
|
|
10766
|
-
const CREDITS: number;
|
|
10767
|
-
const SETTINGS: number;
|
|
10768
|
-
const DEFAULT: number;
|
|
10769
|
-
const
|
|
10788
|
+
export const LOADING: number;
|
|
10789
|
+
export const MENU: number;
|
|
10790
|
+
export const READY: number;
|
|
10791
|
+
export const PLAY: number;
|
|
10792
|
+
export const GAMEOVER: number;
|
|
10793
|
+
export const GAME_END: number;
|
|
10794
|
+
export const SCORE: number;
|
|
10795
|
+
export const CREDITS: number;
|
|
10796
|
+
export const SETTINGS: number;
|
|
10797
|
+
export const DEFAULT: number;
|
|
10798
|
+
const USER_1: number;
|
|
10799
|
+
export { USER_1 as USER };
|
|
10770
10800
|
/**
|
|
10771
10801
|
* Stop the current stage.
|
|
10772
10802
|
* @name stop
|
|
@@ -10774,7 +10804,7 @@ export namespace state {
|
|
|
10774
10804
|
* @public
|
|
10775
10805
|
* @param {boolean} [pauseTrack=false] pause current track on screen stop.
|
|
10776
10806
|
*/
|
|
10777
|
-
function stop(pauseTrack?: boolean): void;
|
|
10807
|
+
export function stop(pauseTrack?: boolean): void;
|
|
10778
10808
|
/**
|
|
10779
10809
|
* Stop the current stage.
|
|
10780
10810
|
* @name stop
|
|
@@ -10782,7 +10812,7 @@ export namespace state {
|
|
|
10782
10812
|
* @public
|
|
10783
10813
|
* @param {boolean} [pauseTrack=false] pause current track on screen stop.
|
|
10784
10814
|
*/
|
|
10785
|
-
function stop(pauseTrack?: boolean): void;
|
|
10815
|
+
export function stop(pauseTrack?: boolean): void;
|
|
10786
10816
|
/**
|
|
10787
10817
|
* pause the current stage
|
|
10788
10818
|
* @name pause
|
|
@@ -10790,7 +10820,7 @@ export namespace state {
|
|
|
10790
10820
|
* @public
|
|
10791
10821
|
* @param {boolean} [music=false] pause current music track on screen pause
|
|
10792
10822
|
*/
|
|
10793
|
-
function pause(music?: boolean): void;
|
|
10823
|
+
export function pause(music?: boolean): void;
|
|
10794
10824
|
/**
|
|
10795
10825
|
* pause the current stage
|
|
10796
10826
|
* @name pause
|
|
@@ -10798,7 +10828,7 @@ export namespace state {
|
|
|
10798
10828
|
* @public
|
|
10799
10829
|
* @param {boolean} [music=false] pause current music track on screen pause
|
|
10800
10830
|
*/
|
|
10801
|
-
function pause(music?: boolean): void;
|
|
10831
|
+
export function pause(music?: boolean): void;
|
|
10802
10832
|
/**
|
|
10803
10833
|
* Restart the current stage from a full stop.
|
|
10804
10834
|
* @name restart
|
|
@@ -10806,7 +10836,7 @@ export namespace state {
|
|
|
10806
10836
|
* @public
|
|
10807
10837
|
* @param {boolean} [music=false] resume current music track on screen resume
|
|
10808
10838
|
*/
|
|
10809
|
-
function restart(music?: boolean): void;
|
|
10839
|
+
export function restart(music?: boolean): void;
|
|
10810
10840
|
/**
|
|
10811
10841
|
* Restart the current stage from a full stop.
|
|
10812
10842
|
* @name restart
|
|
@@ -10814,7 +10844,7 @@ export namespace state {
|
|
|
10814
10844
|
* @public
|
|
10815
10845
|
* @param {boolean} [music=false] resume current music track on screen resume
|
|
10816
10846
|
*/
|
|
10817
|
-
function restart(music?: boolean): void;
|
|
10847
|
+
export function restart(music?: boolean): void;
|
|
10818
10848
|
/**
|
|
10819
10849
|
* resume the current stage
|
|
10820
10850
|
* @name resume
|
|
@@ -10822,7 +10852,7 @@ export namespace state {
|
|
|
10822
10852
|
* @public
|
|
10823
10853
|
* @param {boolean} [music=false] resume current music track on screen resume
|
|
10824
10854
|
*/
|
|
10825
|
-
function resume(music?: boolean): void;
|
|
10855
|
+
export function resume(music?: boolean): void;
|
|
10826
10856
|
/**
|
|
10827
10857
|
* resume the current stage
|
|
10828
10858
|
* @name resume
|
|
@@ -10830,7 +10860,7 @@ export namespace state {
|
|
|
10830
10860
|
* @public
|
|
10831
10861
|
* @param {boolean} [music=false] resume current music track on screen resume
|
|
10832
10862
|
*/
|
|
10833
|
-
function resume(music?: boolean): void;
|
|
10863
|
+
export function resume(music?: boolean): void;
|
|
10834
10864
|
/**
|
|
10835
10865
|
* return the running state of the state manager
|
|
10836
10866
|
* @name isRunning
|
|
@@ -10838,7 +10868,7 @@ export namespace state {
|
|
|
10838
10868
|
* @public
|
|
10839
10869
|
* @returns {boolean} true if a "process is running"
|
|
10840
10870
|
*/
|
|
10841
|
-
function isRunning(): boolean;
|
|
10871
|
+
export function isRunning(): boolean;
|
|
10842
10872
|
/**
|
|
10843
10873
|
* return the running state of the state manager
|
|
10844
10874
|
* @name isRunning
|
|
@@ -10846,7 +10876,7 @@ export namespace state {
|
|
|
10846
10876
|
* @public
|
|
10847
10877
|
* @returns {boolean} true if a "process is running"
|
|
10848
10878
|
*/
|
|
10849
|
-
function isRunning(): boolean;
|
|
10879
|
+
export function isRunning(): boolean;
|
|
10850
10880
|
/**
|
|
10851
10881
|
* Return the pause state of the state manager
|
|
10852
10882
|
* @name isPaused
|
|
@@ -10854,7 +10884,7 @@ export namespace state {
|
|
|
10854
10884
|
* @public
|
|
10855
10885
|
* @returns {boolean} true if the game is paused
|
|
10856
10886
|
*/
|
|
10857
|
-
function isPaused(): boolean;
|
|
10887
|
+
export function isPaused(): boolean;
|
|
10858
10888
|
/**
|
|
10859
10889
|
* Return the pause state of the state manager
|
|
10860
10890
|
* @name isPaused
|
|
@@ -10862,7 +10892,7 @@ export namespace state {
|
|
|
10862
10892
|
* @public
|
|
10863
10893
|
* @returns {boolean} true if the game is paused
|
|
10864
10894
|
*/
|
|
10865
|
-
function isPaused(): boolean;
|
|
10895
|
+
export function isPaused(): boolean;
|
|
10866
10896
|
/**
|
|
10867
10897
|
* associate the specified state with a Stage
|
|
10868
10898
|
* @name set
|
|
@@ -10908,7 +10938,7 @@ export namespace state {
|
|
|
10908
10938
|
*
|
|
10909
10939
|
* me.state.set(me.state.MENU, new MenuScreen());
|
|
10910
10940
|
*/
|
|
10911
|
-
function set(state: number, stage: Stage, start?: boolean): void;
|
|
10941
|
+
export function set(state: number, stage: Stage, start?: boolean): void;
|
|
10912
10942
|
/**
|
|
10913
10943
|
* associate the specified state with a Stage
|
|
10914
10944
|
* @name set
|
|
@@ -10954,7 +10984,27 @@ export namespace state {
|
|
|
10954
10984
|
*
|
|
10955
10985
|
* me.state.set(me.state.MENU, new MenuScreen());
|
|
10956
10986
|
*/
|
|
10957
|
-
function set(state: number, stage: Stage, start?: boolean): void;
|
|
10987
|
+
export function set(state: number, stage: Stage, start?: boolean): void;
|
|
10988
|
+
/**
|
|
10989
|
+
* returns the stage associated with the specified state
|
|
10990
|
+
* (or the current one if none is specified)
|
|
10991
|
+
* @name set
|
|
10992
|
+
* @memberof state
|
|
10993
|
+
* @public
|
|
10994
|
+
* @param {number} [state] State ID (see constants)
|
|
10995
|
+
* @returns {Stage}
|
|
10996
|
+
*/
|
|
10997
|
+
export function get(state?: number): Stage;
|
|
10998
|
+
/**
|
|
10999
|
+
* returns the stage associated with the specified state
|
|
11000
|
+
* (or the current one if none is specified)
|
|
11001
|
+
* @name set
|
|
11002
|
+
* @memberof state
|
|
11003
|
+
* @public
|
|
11004
|
+
* @param {number} [state] State ID (see constants)
|
|
11005
|
+
* @returns {Stage}
|
|
11006
|
+
*/
|
|
11007
|
+
export function get(state?: number): Stage;
|
|
10958
11008
|
/**
|
|
10959
11009
|
* return a reference to the current stage<br>
|
|
10960
11010
|
* useful to call a object specific method
|
|
@@ -10963,7 +11013,7 @@ export namespace state {
|
|
|
10963
11013
|
* @public
|
|
10964
11014
|
* @returns {Stage}
|
|
10965
11015
|
*/
|
|
10966
|
-
function current(): Stage;
|
|
11016
|
+
export function current(): Stage;
|
|
10967
11017
|
/**
|
|
10968
11018
|
* return a reference to the current stage<br>
|
|
10969
11019
|
* useful to call a object specific method
|
|
@@ -10972,7 +11022,7 @@ export namespace state {
|
|
|
10972
11022
|
* @public
|
|
10973
11023
|
* @returns {Stage}
|
|
10974
11024
|
*/
|
|
10975
|
-
function current(): Stage;
|
|
11025
|
+
export function current(): Stage;
|
|
10976
11026
|
/**
|
|
10977
11027
|
* specify a global transition effect
|
|
10978
11028
|
* @name transition
|
|
@@ -10982,7 +11032,7 @@ export namespace state {
|
|
|
10982
11032
|
* @param {Color|string} color a CSS color value
|
|
10983
11033
|
* @param {number} [duration=1000] expressed in milliseconds
|
|
10984
11034
|
*/
|
|
10985
|
-
function transition(effect: string, color: string | Color, duration?: number): void;
|
|
11035
|
+
export function transition(effect: string, color: string | Color, duration?: number): void;
|
|
10986
11036
|
/**
|
|
10987
11037
|
* specify a global transition effect
|
|
10988
11038
|
* @name transition
|
|
@@ -10992,7 +11042,7 @@ export namespace state {
|
|
|
10992
11042
|
* @param {Color|string} color a CSS color value
|
|
10993
11043
|
* @param {number} [duration=1000] expressed in milliseconds
|
|
10994
11044
|
*/
|
|
10995
|
-
function transition(effect: string, color: string | Color, duration?: number): void;
|
|
11045
|
+
export function transition(effect: string, color: string | Color, duration?: number): void;
|
|
10996
11046
|
/**
|
|
10997
11047
|
* enable/disable transition for a specific state (by default enabled for all)
|
|
10998
11048
|
* @name setTransition
|
|
@@ -11001,7 +11051,7 @@ export namespace state {
|
|
|
11001
11051
|
* @param {number} state State ID (see constants)
|
|
11002
11052
|
* @param {boolean} enable
|
|
11003
11053
|
*/
|
|
11004
|
-
function setTransition(state: number, enable: boolean): void;
|
|
11054
|
+
export function setTransition(state: number, enable: boolean): void;
|
|
11005
11055
|
/**
|
|
11006
11056
|
* enable/disable transition for a specific state (by default enabled for all)
|
|
11007
11057
|
* @name setTransition
|
|
@@ -11010,7 +11060,7 @@ export namespace state {
|
|
|
11010
11060
|
* @param {number} state State ID (see constants)
|
|
11011
11061
|
* @param {boolean} enable
|
|
11012
11062
|
*/
|
|
11013
|
-
function setTransition(state: number, enable: boolean): void;
|
|
11063
|
+
export function setTransition(state: number, enable: boolean): void;
|
|
11014
11064
|
/**
|
|
11015
11065
|
* change the game/app state
|
|
11016
11066
|
* @name change
|
|
@@ -11024,7 +11074,7 @@ export namespace state {
|
|
|
11024
11074
|
* // "level_1" and the number 3
|
|
11025
11075
|
* me.state.change(me.state.PLAY, "level_1", 3);
|
|
11026
11076
|
*/
|
|
11027
|
-
function change(state: number, forceChange: boolean, ...args: any[]): void;
|
|
11077
|
+
export function change(state: number, forceChange: boolean, ...args: any[]): void;
|
|
11028
11078
|
/**
|
|
11029
11079
|
* change the game/app state
|
|
11030
11080
|
* @name change
|
|
@@ -11038,7 +11088,7 @@ export namespace state {
|
|
|
11038
11088
|
* // "level_1" and the number 3
|
|
11039
11089
|
* me.state.change(me.state.PLAY, "level_1", 3);
|
|
11040
11090
|
*/
|
|
11041
|
-
function change(state: number, forceChange: boolean, ...args: any[]): void;
|
|
11091
|
+
export function change(state: number, forceChange: boolean, ...args: any[]): void;
|
|
11042
11092
|
/**
|
|
11043
11093
|
* return true if the specified state is the current one
|
|
11044
11094
|
* @name isCurrent
|
|
@@ -11047,7 +11097,7 @@ export namespace state {
|
|
|
11047
11097
|
* @param {number} state State ID (see constants)
|
|
11048
11098
|
* @returns {boolean} true if the specified state is the current one
|
|
11049
11099
|
*/
|
|
11050
|
-
function isCurrent(state: number): boolean;
|
|
11100
|
+
export function isCurrent(state: number): boolean;
|
|
11051
11101
|
/**
|
|
11052
11102
|
* return true if the specified state is the current one
|
|
11053
11103
|
* @name isCurrent
|
|
@@ -11056,7 +11106,7 @@ export namespace state {
|
|
|
11056
11106
|
* @param {number} state State ID (see constants)
|
|
11057
11107
|
* @returns {boolean} true if the specified state is the current one
|
|
11058
11108
|
*/
|
|
11059
|
-
function isCurrent(state: number): boolean;
|
|
11109
|
+
export function isCurrent(state: number): boolean;
|
|
11060
11110
|
}
|
|
11061
11111
|
/**
|
|
11062
11112
|
* the default global Timer instance
|
|
@@ -11323,6 +11373,42 @@ declare function round(num: number, dec?: number): number;
|
|
|
11323
11373
|
* }
|
|
11324
11374
|
*/
|
|
11325
11375
|
declare function toBeCloseTo(expected: number, actual: number, precision?: number): boolean;
|
|
11376
|
+
/**
|
|
11377
|
+
* @classdesc
|
|
11378
|
+
* An object representing the result of an intersection.
|
|
11379
|
+
* @property {Renderable} a The first object participating in the intersection
|
|
11380
|
+
* @property {Renderable} b The second object participating in the intersection
|
|
11381
|
+
* @property {number} overlap Magnitude of the overlap on the shortest colliding axis
|
|
11382
|
+
* @property {Vector2d} overlapV The overlap vector (i.e. `overlapN.scale(overlap, overlap)`). If this vector is subtracted from the position of a, a and b will no longer be colliding
|
|
11383
|
+
* @property {Vector2d} overlapN The shortest colliding axis (unit-vector)
|
|
11384
|
+
* @property {boolean} aInB Whether the first object is entirely inside the second
|
|
11385
|
+
* @property {boolean} bInA Whether the second object is entirely inside the first
|
|
11386
|
+
* @property {number} indexShapeA The index of the colliding shape for the object a body
|
|
11387
|
+
* @property {number} indexShapeB The index of the colliding shape for the object b body
|
|
11388
|
+
* @name ResponseObject
|
|
11389
|
+
* @public
|
|
11390
|
+
*/
|
|
11391
|
+
declare class ResponseObject {
|
|
11392
|
+
a: any;
|
|
11393
|
+
b: any;
|
|
11394
|
+
overlapN: Vector2d;
|
|
11395
|
+
overlapV: Vector2d;
|
|
11396
|
+
aInB: boolean;
|
|
11397
|
+
bInA: boolean;
|
|
11398
|
+
indexShapeA: number;
|
|
11399
|
+
indexShapeB: number;
|
|
11400
|
+
overlap: number;
|
|
11401
|
+
/**
|
|
11402
|
+
* Set some values of the response back to their defaults. <br>
|
|
11403
|
+
* Call this between tests if you are going to reuse a single <br>
|
|
11404
|
+
* Response object for multiple intersection tests <br>
|
|
11405
|
+
* (recommended as it will avoid allocating extra memory) <br>
|
|
11406
|
+
* @name clear
|
|
11407
|
+
* @public
|
|
11408
|
+
* @returns {object} this object for chaining
|
|
11409
|
+
*/
|
|
11410
|
+
public clear(): object;
|
|
11411
|
+
}
|
|
11326
11412
|
/**
|
|
11327
11413
|
* @classdesc
|
|
11328
11414
|
* a simplified path2d implementation, supporting only one path
|
|
@@ -11400,13 +11486,13 @@ declare class Path2D {
|
|
|
11400
11486
|
* adds a circular arc to the path with the given control points and radius, connected to the previous point by a straight line.
|
|
11401
11487
|
* @name arcTo
|
|
11402
11488
|
* @memberof Path2D
|
|
11403
|
-
* @param {number}
|
|
11404
|
-
* @param {number}
|
|
11405
|
-
* @param {number}
|
|
11406
|
-
* @param {number}
|
|
11489
|
+
* @param {number} x1 the x-axis coordinate of the first control point.
|
|
11490
|
+
* @param {number} y1 the y-axis coordinate of the first control point.
|
|
11491
|
+
* @param {number} x2 the x-axis coordinate of the second control point.
|
|
11492
|
+
* @param {number} y2 the y-axis coordinate of the second control point.
|
|
11407
11493
|
* @param {number} radius the arc's radius. Must be positive.
|
|
11408
11494
|
*/
|
|
11409
|
-
arcTo(x1:
|
|
11495
|
+
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;
|
|
11410
11496
|
/**
|
|
11411
11497
|
* adds an elliptical arc to the path which is centered at (x, y) position with the radii radiusX and radiusY
|
|
11412
11498
|
* starting at startAngle and ending at endAngle going in the given direction by counterclockwise.
|