melonjs 10.11.0 → 12.0.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/README.md +2 -0
- package/dist/melonjs.js +2949 -2795
- package/dist/melonjs.min.js +4 -4
- package/dist/melonjs.module.d.ts +208 -135
- package/dist/melonjs.module.js +2917 -2772
- package/package.json +11 -10
- package/src/audio/audio.js +5 -5
- 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/loader/loadingscreen.js +17 -103
- package/src/loader/melonjs_logo.png +0 -0
- 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/polyfill/index.js +4 -0
- 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 +47 -14
- 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/device.js +3 -67
- package/src/system/dom.js +69 -0
- package/src/system/event.js +11 -0
- package/src/system/pooling.js +1 -1
- package/src/text/bitmaptext.js +1 -2
- package/src/text/text.js +7 -5
- package/src/text/textmetrics.js +1 -2
- package/src/utils/string.js +0 -24
- 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
|
|
@@ -2838,11 +2806,12 @@ export class Light2d extends Renderable {
|
|
|
2838
2806
|
/**
|
|
2839
2807
|
* @param {number} x - The horizontal position of the light.
|
|
2840
2808
|
* @param {number} y - The vertical position of the light.
|
|
2841
|
-
* @param {number}
|
|
2809
|
+
* @param {number} radiusX - The horizontal radius of the light.
|
|
2810
|
+
* @param {number} [radiusY=radiusX] - The vertical radius of the light.
|
|
2842
2811
|
* @param {Color|string} [color="#FFF"] the color of the light
|
|
2843
2812
|
* @param {number} [intensity=0.7] - The intensity of the light.
|
|
2844
2813
|
*/
|
|
2845
|
-
constructor(x: number, y: number,
|
|
2814
|
+
constructor(x: number, y: number, radiusX: number, radiusY?: number, color?: Color | string, intensity?: number);
|
|
2846
2815
|
/**
|
|
2847
2816
|
* the color of the light
|
|
2848
2817
|
* @type {Color}
|
|
@@ -2850,10 +2819,15 @@ export class Light2d extends Renderable {
|
|
|
2850
2819
|
*/
|
|
2851
2820
|
color: Color;
|
|
2852
2821
|
/**
|
|
2853
|
-
* The radius of the light
|
|
2822
|
+
* The horizontal radius of the light
|
|
2854
2823
|
* @type {number}
|
|
2855
2824
|
*/
|
|
2856
|
-
|
|
2825
|
+
radiusX: number;
|
|
2826
|
+
/**
|
|
2827
|
+
* The vertical radius of the light
|
|
2828
|
+
* @type {number}
|
|
2829
|
+
*/
|
|
2830
|
+
radiusY: number;
|
|
2857
2831
|
/**
|
|
2858
2832
|
* The intensity of the light
|
|
2859
2833
|
* @type {number}
|
|
@@ -2871,11 +2845,6 @@ export class Light2d extends Renderable {
|
|
|
2871
2845
|
* @returns {Ellipse} the light visible mask
|
|
2872
2846
|
*/
|
|
2873
2847
|
getVisibleArea(): Ellipse;
|
|
2874
|
-
/**
|
|
2875
|
-
* object draw (Called internally by the engine).
|
|
2876
|
-
* @ignore
|
|
2877
|
-
*/
|
|
2878
|
-
draw(renderer: any): void;
|
|
2879
2848
|
/**
|
|
2880
2849
|
* Destroy function<br>
|
|
2881
2850
|
* @ignore
|
|
@@ -5220,7 +5189,7 @@ export class Pointer extends Bounds {
|
|
|
5220
5189
|
* (which means that all angles are less than 180 degrees), as described here below : <br>
|
|
5221
5190
|
* <center><img src="images/convex_polygon.png"/></center><br>
|
|
5222
5191
|
*
|
|
5223
|
-
* A polygon's `winding` is clockwise
|
|
5192
|
+
* A polygon's `winding` is clockwise if its vertices (points) are declared turning to the right. The image above shows COUNTERCLOCKWISE winding.
|
|
5224
5193
|
*/
|
|
5225
5194
|
export class Polygon {
|
|
5226
5195
|
/**
|
|
@@ -5609,10 +5578,10 @@ export class Rect extends Polygon {
|
|
|
5609
5578
|
* @name centerOn
|
|
5610
5579
|
* @memberof Rect
|
|
5611
5580
|
* @param {number} x the x coordinate around which to center this rectangle
|
|
5612
|
-
* @param {number}
|
|
5581
|
+
* @param {number} y the y coordinate around which to center this rectangle
|
|
5613
5582
|
* @returns {Rect} this rectangle
|
|
5614
5583
|
*/
|
|
5615
|
-
centerOn(x: number, y:
|
|
5584
|
+
centerOn(x: number, y: number): Rect;
|
|
5616
5585
|
/**
|
|
5617
5586
|
* resize the rectangle
|
|
5618
5587
|
* @name resize
|
|
@@ -6127,14 +6096,14 @@ export class Renderable extends Rect {
|
|
|
6127
6096
|
*/
|
|
6128
6097
|
protected preDraw(renderer: CanvasRenderer | WebGLRenderer): void;
|
|
6129
6098
|
/**
|
|
6130
|
-
*
|
|
6131
|
-
* automatically called by the game manager {@link game}
|
|
6099
|
+
* draw this renderable (automatically called by melonJS)
|
|
6132
6100
|
* @name draw
|
|
6133
6101
|
* @memberof Renderable
|
|
6134
6102
|
* @protected
|
|
6135
|
-
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer
|
|
6103
|
+
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer instance
|
|
6104
|
+
* @param {Camera2d} [viewport] the viewport to (re)draw
|
|
6136
6105
|
*/
|
|
6137
|
-
protected draw(renderer: CanvasRenderer | WebGLRenderer): void;
|
|
6106
|
+
protected draw(renderer: CanvasRenderer | WebGLRenderer, viewport?: Camera2d): void;
|
|
6138
6107
|
/**
|
|
6139
6108
|
* restore the rendering context after drawing. <br>
|
|
6140
6109
|
* automatically called by the game manager {@link game}
|
|
@@ -6149,7 +6118,7 @@ export class Renderable extends Rect {
|
|
|
6149
6118
|
* when this renderable body is colliding with another one
|
|
6150
6119
|
* @name onCollision
|
|
6151
6120
|
* @memberof Renderable
|
|
6152
|
-
* @param {
|
|
6121
|
+
* @param {ResponseObject} response the collision response object
|
|
6153
6122
|
* @param {Renderable} other the other renderable touching this one (a reference to response.a or response.b)
|
|
6154
6123
|
* @returns {boolean} true if the object should respond to the collision (its position and velocity will be corrected)
|
|
6155
6124
|
* @example
|
|
@@ -6166,7 +6135,7 @@ export class Renderable extends Rect {
|
|
|
6166
6135
|
* return true;
|
|
6167
6136
|
* },
|
|
6168
6137
|
*/
|
|
6169
|
-
onCollision(): boolean;
|
|
6138
|
+
onCollision(response: ResponseObject, other: Renderable): boolean;
|
|
6170
6139
|
/**
|
|
6171
6140
|
* Destroy function<br>
|
|
6172
6141
|
* @ignore
|
|
@@ -7693,11 +7662,11 @@ export class Text extends Renderable {
|
|
|
7693
7662
|
setText(value?: number | string | string[]): Text;
|
|
7694
7663
|
/**
|
|
7695
7664
|
* measure the given text size in pixels
|
|
7696
|
-
* @param {CanvasRenderer|WebGLRenderer}
|
|
7665
|
+
* @param {CanvasRenderer|WebGLRenderer} renderer reference to the active renderer
|
|
7697
7666
|
* @param {string} [text] the text to be measured
|
|
7698
7667
|
* @returns {TextMetrics} a TextMetrics object defining the dimensions of the given piece of text
|
|
7699
7668
|
*/
|
|
7700
|
-
measureText(renderer
|
|
7669
|
+
measureText(renderer: CanvasRenderer | WebGLRenderer, text?: string): TextMetrics;
|
|
7701
7670
|
/**
|
|
7702
7671
|
* draw a text at the specified coord
|
|
7703
7672
|
* @param {CanvasRenderer|WebGLRenderer} renderer Reference to the destination renderer instance
|
|
@@ -7837,9 +7806,11 @@ export class TextureAtlas {
|
|
|
7837
7806
|
* add uvs mapping for the given region
|
|
7838
7807
|
* @param {object} atlas the atlas dictionnary where the region is define
|
|
7839
7808
|
* @param {object} name region (or frame) name
|
|
7809
|
+
* @param {number} w the width of the region
|
|
7810
|
+
* @param {number} h the height of the region
|
|
7840
7811
|
* @returns {Float32Array} the created region UVs
|
|
7841
7812
|
*/
|
|
7842
|
-
addUVs(atlas: object, name: object, w:
|
|
7813
|
+
addUVs(atlas: object, name: object, w: number, h: number): Float32Array;
|
|
7843
7814
|
/**
|
|
7844
7815
|
* Create a sprite object using the first region found using the specified name
|
|
7845
7816
|
* @param {string} name name of the sprite
|
|
@@ -9699,12 +9670,76 @@ export var audio: Readonly<{
|
|
|
9699
9670
|
* @public
|
|
9700
9671
|
*/
|
|
9701
9672
|
export function boot(): void;
|
|
9702
|
-
|
|
9703
|
-
|
|
9704
|
-
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
|
|
9673
|
+
export namespace collision {
|
|
9674
|
+
const maxChildren: number;
|
|
9675
|
+
const maxDepth: number;
|
|
9676
|
+
namespace types {
|
|
9677
|
+
const NO_OBJECT: number;
|
|
9678
|
+
const PLAYER_OBJECT: number;
|
|
9679
|
+
const NPC_OBJECT: number;
|
|
9680
|
+
const ENEMY_OBJECT: number;
|
|
9681
|
+
const COLLECTABLE_OBJECT: number;
|
|
9682
|
+
const ACTION_OBJECT: number;
|
|
9683
|
+
const PROJECTILE_OBJECT: number;
|
|
9684
|
+
const WORLD_SHAPE: number;
|
|
9685
|
+
const USER: number;
|
|
9686
|
+
const ALL_OBJECT: number;
|
|
9687
|
+
}
|
|
9688
|
+
/**
|
|
9689
|
+
* Checks for object colliding with the given line
|
|
9690
|
+
* @name rayCast
|
|
9691
|
+
* @memberof collision
|
|
9692
|
+
* @public
|
|
9693
|
+
* @param {Line} line line to be tested for collision
|
|
9694
|
+
* @param {Array.<Renderable>} [result] a user defined array that will be populated with intersecting physic objects.
|
|
9695
|
+
* @returns {Array.<Renderable>} an array of intersecting physic objects
|
|
9696
|
+
* @example
|
|
9697
|
+
* // define a line accross the viewport
|
|
9698
|
+
* var ray = new me.Line(
|
|
9699
|
+
* // absolute position of the line
|
|
9700
|
+
* 0, 0, [
|
|
9701
|
+
* // starting point relative to the initial position
|
|
9702
|
+
* new me.Vector2d(0, 0),
|
|
9703
|
+
* // ending point
|
|
9704
|
+
* new me.Vector2d(me.game.viewport.width, me.game.viewport.height)
|
|
9705
|
+
* ]);
|
|
9706
|
+
*
|
|
9707
|
+
* // check for collition
|
|
9708
|
+
* result = me.collision.rayCast(ray);
|
|
9709
|
+
*
|
|
9710
|
+
* if (result.length > 0) {
|
|
9711
|
+
* // ...
|
|
9712
|
+
* }
|
|
9713
|
+
*/
|
|
9714
|
+
function rayCast(line: Line, result?: Renderable[]): Renderable[];
|
|
9715
|
+
/**
|
|
9716
|
+
* Checks for object colliding with the given line
|
|
9717
|
+
* @name rayCast
|
|
9718
|
+
* @memberof collision
|
|
9719
|
+
* @public
|
|
9720
|
+
* @param {Line} line line to be tested for collision
|
|
9721
|
+
* @param {Array.<Renderable>} [result] a user defined array that will be populated with intersecting physic objects.
|
|
9722
|
+
* @returns {Array.<Renderable>} an array of intersecting physic objects
|
|
9723
|
+
* @example
|
|
9724
|
+
* // define a line accross the viewport
|
|
9725
|
+
* var ray = new me.Line(
|
|
9726
|
+
* // absolute position of the line
|
|
9727
|
+
* 0, 0, [
|
|
9728
|
+
* // starting point relative to the initial position
|
|
9729
|
+
* new me.Vector2d(0, 0),
|
|
9730
|
+
* // ending point
|
|
9731
|
+
* new me.Vector2d(me.game.viewport.width, me.game.viewport.height)
|
|
9732
|
+
* ]);
|
|
9733
|
+
*
|
|
9734
|
+
* // check for collition
|
|
9735
|
+
* result = me.collision.rayCast(ray);
|
|
9736
|
+
*
|
|
9737
|
+
* if (result.length > 0) {
|
|
9738
|
+
* // ...
|
|
9739
|
+
* }
|
|
9740
|
+
*/
|
|
9741
|
+
function rayCast(line: Line, result?: Renderable[]): Renderable[];
|
|
9742
|
+
}
|
|
9708
9743
|
export namespace device {
|
|
9709
9744
|
const devicePixelRatio: number;
|
|
9710
9745
|
const isFullscreen: boolean;
|
|
@@ -9730,6 +9765,7 @@ export namespace device {
|
|
|
9730
9765
|
}
|
|
9731
9766
|
export var event: Readonly<{
|
|
9732
9767
|
__proto__: any;
|
|
9768
|
+
DOM_READY: string;
|
|
9733
9769
|
BOOT: string;
|
|
9734
9770
|
STATE_PAUSE: string;
|
|
9735
9771
|
STATE_RESUME: string;
|
|
@@ -10756,17 +10792,18 @@ export namespace save {
|
|
|
10756
10792
|
*/
|
|
10757
10793
|
export var skipAutoInit: boolean;
|
|
10758
10794
|
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
|
|
10795
|
+
export const LOADING: number;
|
|
10796
|
+
export const MENU: number;
|
|
10797
|
+
export const READY: number;
|
|
10798
|
+
export const PLAY: number;
|
|
10799
|
+
export const GAMEOVER: number;
|
|
10800
|
+
export const GAME_END: number;
|
|
10801
|
+
export const SCORE: number;
|
|
10802
|
+
export const CREDITS: number;
|
|
10803
|
+
export const SETTINGS: number;
|
|
10804
|
+
export const DEFAULT: number;
|
|
10805
|
+
const USER_1: number;
|
|
10806
|
+
export { USER_1 as USER };
|
|
10770
10807
|
/**
|
|
10771
10808
|
* Stop the current stage.
|
|
10772
10809
|
* @name stop
|
|
@@ -10774,7 +10811,7 @@ export namespace state {
|
|
|
10774
10811
|
* @public
|
|
10775
10812
|
* @param {boolean} [pauseTrack=false] pause current track on screen stop.
|
|
10776
10813
|
*/
|
|
10777
|
-
function stop(pauseTrack?: boolean): void;
|
|
10814
|
+
export function stop(pauseTrack?: boolean): void;
|
|
10778
10815
|
/**
|
|
10779
10816
|
* Stop the current stage.
|
|
10780
10817
|
* @name stop
|
|
@@ -10782,7 +10819,7 @@ export namespace state {
|
|
|
10782
10819
|
* @public
|
|
10783
10820
|
* @param {boolean} [pauseTrack=false] pause current track on screen stop.
|
|
10784
10821
|
*/
|
|
10785
|
-
function stop(pauseTrack?: boolean): void;
|
|
10822
|
+
export function stop(pauseTrack?: boolean): void;
|
|
10786
10823
|
/**
|
|
10787
10824
|
* pause the current stage
|
|
10788
10825
|
* @name pause
|
|
@@ -10790,7 +10827,7 @@ export namespace state {
|
|
|
10790
10827
|
* @public
|
|
10791
10828
|
* @param {boolean} [music=false] pause current music track on screen pause
|
|
10792
10829
|
*/
|
|
10793
|
-
function pause(music?: boolean): void;
|
|
10830
|
+
export function pause(music?: boolean): void;
|
|
10794
10831
|
/**
|
|
10795
10832
|
* pause the current stage
|
|
10796
10833
|
* @name pause
|
|
@@ -10798,7 +10835,7 @@ export namespace state {
|
|
|
10798
10835
|
* @public
|
|
10799
10836
|
* @param {boolean} [music=false] pause current music track on screen pause
|
|
10800
10837
|
*/
|
|
10801
|
-
function pause(music?: boolean): void;
|
|
10838
|
+
export function pause(music?: boolean): void;
|
|
10802
10839
|
/**
|
|
10803
10840
|
* Restart the current stage from a full stop.
|
|
10804
10841
|
* @name restart
|
|
@@ -10806,7 +10843,7 @@ export namespace state {
|
|
|
10806
10843
|
* @public
|
|
10807
10844
|
* @param {boolean} [music=false] resume current music track on screen resume
|
|
10808
10845
|
*/
|
|
10809
|
-
function restart(music?: boolean): void;
|
|
10846
|
+
export function restart(music?: boolean): void;
|
|
10810
10847
|
/**
|
|
10811
10848
|
* Restart the current stage from a full stop.
|
|
10812
10849
|
* @name restart
|
|
@@ -10814,7 +10851,7 @@ export namespace state {
|
|
|
10814
10851
|
* @public
|
|
10815
10852
|
* @param {boolean} [music=false] resume current music track on screen resume
|
|
10816
10853
|
*/
|
|
10817
|
-
function restart(music?: boolean): void;
|
|
10854
|
+
export function restart(music?: boolean): void;
|
|
10818
10855
|
/**
|
|
10819
10856
|
* resume the current stage
|
|
10820
10857
|
* @name resume
|
|
@@ -10822,7 +10859,7 @@ export namespace state {
|
|
|
10822
10859
|
* @public
|
|
10823
10860
|
* @param {boolean} [music=false] resume current music track on screen resume
|
|
10824
10861
|
*/
|
|
10825
|
-
function resume(music?: boolean): void;
|
|
10862
|
+
export function resume(music?: boolean): void;
|
|
10826
10863
|
/**
|
|
10827
10864
|
* resume the current stage
|
|
10828
10865
|
* @name resume
|
|
@@ -10830,7 +10867,7 @@ export namespace state {
|
|
|
10830
10867
|
* @public
|
|
10831
10868
|
* @param {boolean} [music=false] resume current music track on screen resume
|
|
10832
10869
|
*/
|
|
10833
|
-
function resume(music?: boolean): void;
|
|
10870
|
+
export function resume(music?: boolean): void;
|
|
10834
10871
|
/**
|
|
10835
10872
|
* return the running state of the state manager
|
|
10836
10873
|
* @name isRunning
|
|
@@ -10838,7 +10875,7 @@ export namespace state {
|
|
|
10838
10875
|
* @public
|
|
10839
10876
|
* @returns {boolean} true if a "process is running"
|
|
10840
10877
|
*/
|
|
10841
|
-
function isRunning(): boolean;
|
|
10878
|
+
export function isRunning(): boolean;
|
|
10842
10879
|
/**
|
|
10843
10880
|
* return the running state of the state manager
|
|
10844
10881
|
* @name isRunning
|
|
@@ -10846,7 +10883,7 @@ export namespace state {
|
|
|
10846
10883
|
* @public
|
|
10847
10884
|
* @returns {boolean} true if a "process is running"
|
|
10848
10885
|
*/
|
|
10849
|
-
function isRunning(): boolean;
|
|
10886
|
+
export function isRunning(): boolean;
|
|
10850
10887
|
/**
|
|
10851
10888
|
* Return the pause state of the state manager
|
|
10852
10889
|
* @name isPaused
|
|
@@ -10854,7 +10891,7 @@ export namespace state {
|
|
|
10854
10891
|
* @public
|
|
10855
10892
|
* @returns {boolean} true if the game is paused
|
|
10856
10893
|
*/
|
|
10857
|
-
function isPaused(): boolean;
|
|
10894
|
+
export function isPaused(): boolean;
|
|
10858
10895
|
/**
|
|
10859
10896
|
* Return the pause state of the state manager
|
|
10860
10897
|
* @name isPaused
|
|
@@ -10862,7 +10899,7 @@ export namespace state {
|
|
|
10862
10899
|
* @public
|
|
10863
10900
|
* @returns {boolean} true if the game is paused
|
|
10864
10901
|
*/
|
|
10865
|
-
function isPaused(): boolean;
|
|
10902
|
+
export function isPaused(): boolean;
|
|
10866
10903
|
/**
|
|
10867
10904
|
* associate the specified state with a Stage
|
|
10868
10905
|
* @name set
|
|
@@ -10908,7 +10945,7 @@ export namespace state {
|
|
|
10908
10945
|
*
|
|
10909
10946
|
* me.state.set(me.state.MENU, new MenuScreen());
|
|
10910
10947
|
*/
|
|
10911
|
-
function set(state: number, stage: Stage, start?: boolean): void;
|
|
10948
|
+
export function set(state: number, stage: Stage, start?: boolean): void;
|
|
10912
10949
|
/**
|
|
10913
10950
|
* associate the specified state with a Stage
|
|
10914
10951
|
* @name set
|
|
@@ -10954,7 +10991,27 @@ export namespace state {
|
|
|
10954
10991
|
*
|
|
10955
10992
|
* me.state.set(me.state.MENU, new MenuScreen());
|
|
10956
10993
|
*/
|
|
10957
|
-
function set(state: number, stage: Stage, start?: boolean): void;
|
|
10994
|
+
export function set(state: number, stage: Stage, start?: boolean): void;
|
|
10995
|
+
/**
|
|
10996
|
+
* returns the stage associated with the specified state
|
|
10997
|
+
* (or the current one if none is specified)
|
|
10998
|
+
* @name set
|
|
10999
|
+
* @memberof state
|
|
11000
|
+
* @public
|
|
11001
|
+
* @param {number} [state] State ID (see constants)
|
|
11002
|
+
* @returns {Stage}
|
|
11003
|
+
*/
|
|
11004
|
+
export function get(state?: number): Stage;
|
|
11005
|
+
/**
|
|
11006
|
+
* returns the stage associated with the specified state
|
|
11007
|
+
* (or the current one if none is specified)
|
|
11008
|
+
* @name set
|
|
11009
|
+
* @memberof state
|
|
11010
|
+
* @public
|
|
11011
|
+
* @param {number} [state] State ID (see constants)
|
|
11012
|
+
* @returns {Stage}
|
|
11013
|
+
*/
|
|
11014
|
+
export function get(state?: number): Stage;
|
|
10958
11015
|
/**
|
|
10959
11016
|
* return a reference to the current stage<br>
|
|
10960
11017
|
* useful to call a object specific method
|
|
@@ -10963,7 +11020,7 @@ export namespace state {
|
|
|
10963
11020
|
* @public
|
|
10964
11021
|
* @returns {Stage}
|
|
10965
11022
|
*/
|
|
10966
|
-
function current(): Stage;
|
|
11023
|
+
export function current(): Stage;
|
|
10967
11024
|
/**
|
|
10968
11025
|
* return a reference to the current stage<br>
|
|
10969
11026
|
* useful to call a object specific method
|
|
@@ -10972,7 +11029,7 @@ export namespace state {
|
|
|
10972
11029
|
* @public
|
|
10973
11030
|
* @returns {Stage}
|
|
10974
11031
|
*/
|
|
10975
|
-
function current(): Stage;
|
|
11032
|
+
export function current(): Stage;
|
|
10976
11033
|
/**
|
|
10977
11034
|
* specify a global transition effect
|
|
10978
11035
|
* @name transition
|
|
@@ -10982,7 +11039,7 @@ export namespace state {
|
|
|
10982
11039
|
* @param {Color|string} color a CSS color value
|
|
10983
11040
|
* @param {number} [duration=1000] expressed in milliseconds
|
|
10984
11041
|
*/
|
|
10985
|
-
function transition(effect: string, color: string | Color, duration?: number): void;
|
|
11042
|
+
export function transition(effect: string, color: string | Color, duration?: number): void;
|
|
10986
11043
|
/**
|
|
10987
11044
|
* specify a global transition effect
|
|
10988
11045
|
* @name transition
|
|
@@ -10992,7 +11049,7 @@ export namespace state {
|
|
|
10992
11049
|
* @param {Color|string} color a CSS color value
|
|
10993
11050
|
* @param {number} [duration=1000] expressed in milliseconds
|
|
10994
11051
|
*/
|
|
10995
|
-
function transition(effect: string, color: string | Color, duration?: number): void;
|
|
11052
|
+
export function transition(effect: string, color: string | Color, duration?: number): void;
|
|
10996
11053
|
/**
|
|
10997
11054
|
* enable/disable transition for a specific state (by default enabled for all)
|
|
10998
11055
|
* @name setTransition
|
|
@@ -11001,7 +11058,7 @@ export namespace state {
|
|
|
11001
11058
|
* @param {number} state State ID (see constants)
|
|
11002
11059
|
* @param {boolean} enable
|
|
11003
11060
|
*/
|
|
11004
|
-
function setTransition(state: number, enable: boolean): void;
|
|
11061
|
+
export function setTransition(state: number, enable: boolean): void;
|
|
11005
11062
|
/**
|
|
11006
11063
|
* enable/disable transition for a specific state (by default enabled for all)
|
|
11007
11064
|
* @name setTransition
|
|
@@ -11010,7 +11067,7 @@ export namespace state {
|
|
|
11010
11067
|
* @param {number} state State ID (see constants)
|
|
11011
11068
|
* @param {boolean} enable
|
|
11012
11069
|
*/
|
|
11013
|
-
function setTransition(state: number, enable: boolean): void;
|
|
11070
|
+
export function setTransition(state: number, enable: boolean): void;
|
|
11014
11071
|
/**
|
|
11015
11072
|
* change the game/app state
|
|
11016
11073
|
* @name change
|
|
@@ -11024,7 +11081,7 @@ export namespace state {
|
|
|
11024
11081
|
* // "level_1" and the number 3
|
|
11025
11082
|
* me.state.change(me.state.PLAY, "level_1", 3);
|
|
11026
11083
|
*/
|
|
11027
|
-
function change(state: number, forceChange: boolean, ...args: any[]): void;
|
|
11084
|
+
export function change(state: number, forceChange: boolean, ...args: any[]): void;
|
|
11028
11085
|
/**
|
|
11029
11086
|
* change the game/app state
|
|
11030
11087
|
* @name change
|
|
@@ -11038,7 +11095,7 @@ export namespace state {
|
|
|
11038
11095
|
* // "level_1" and the number 3
|
|
11039
11096
|
* me.state.change(me.state.PLAY, "level_1", 3);
|
|
11040
11097
|
*/
|
|
11041
|
-
function change(state: number, forceChange: boolean, ...args: any[]): void;
|
|
11098
|
+
export function change(state: number, forceChange: boolean, ...args: any[]): void;
|
|
11042
11099
|
/**
|
|
11043
11100
|
* return true if the specified state is the current one
|
|
11044
11101
|
* @name isCurrent
|
|
@@ -11047,7 +11104,7 @@ export namespace state {
|
|
|
11047
11104
|
* @param {number} state State ID (see constants)
|
|
11048
11105
|
* @returns {boolean} true if the specified state is the current one
|
|
11049
11106
|
*/
|
|
11050
|
-
function isCurrent(state: number): boolean;
|
|
11107
|
+
export function isCurrent(state: number): boolean;
|
|
11051
11108
|
/**
|
|
11052
11109
|
* return true if the specified state is the current one
|
|
11053
11110
|
* @name isCurrent
|
|
@@ -11056,7 +11113,7 @@ export namespace state {
|
|
|
11056
11113
|
* @param {number} state State ID (see constants)
|
|
11057
11114
|
* @returns {boolean} true if the specified state is the current one
|
|
11058
11115
|
*/
|
|
11059
|
-
function isCurrent(state: number): boolean;
|
|
11116
|
+
export function isCurrent(state: number): boolean;
|
|
11060
11117
|
}
|
|
11061
11118
|
/**
|
|
11062
11119
|
* the default global Timer instance
|
|
@@ -11323,6 +11380,42 @@ declare function round(num: number, dec?: number): number;
|
|
|
11323
11380
|
* }
|
|
11324
11381
|
*/
|
|
11325
11382
|
declare function toBeCloseTo(expected: number, actual: number, precision?: number): boolean;
|
|
11383
|
+
/**
|
|
11384
|
+
* @classdesc
|
|
11385
|
+
* An object representing the result of an intersection.
|
|
11386
|
+
* @property {Renderable} a The first object participating in the intersection
|
|
11387
|
+
* @property {Renderable} b The second object participating in the intersection
|
|
11388
|
+
* @property {number} overlap Magnitude of the overlap on the shortest colliding axis
|
|
11389
|
+
* @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
|
|
11390
|
+
* @property {Vector2d} overlapN The shortest colliding axis (unit-vector)
|
|
11391
|
+
* @property {boolean} aInB Whether the first object is entirely inside the second
|
|
11392
|
+
* @property {boolean} bInA Whether the second object is entirely inside the first
|
|
11393
|
+
* @property {number} indexShapeA The index of the colliding shape for the object a body
|
|
11394
|
+
* @property {number} indexShapeB The index of the colliding shape for the object b body
|
|
11395
|
+
* @name ResponseObject
|
|
11396
|
+
* @public
|
|
11397
|
+
*/
|
|
11398
|
+
declare class ResponseObject {
|
|
11399
|
+
a: any;
|
|
11400
|
+
b: any;
|
|
11401
|
+
overlapN: Vector2d;
|
|
11402
|
+
overlapV: Vector2d;
|
|
11403
|
+
aInB: boolean;
|
|
11404
|
+
bInA: boolean;
|
|
11405
|
+
indexShapeA: number;
|
|
11406
|
+
indexShapeB: number;
|
|
11407
|
+
overlap: number;
|
|
11408
|
+
/**
|
|
11409
|
+
* Set some values of the response back to their defaults. <br>
|
|
11410
|
+
* Call this between tests if you are going to reuse a single <br>
|
|
11411
|
+
* Response object for multiple intersection tests <br>
|
|
11412
|
+
* (recommended as it will avoid allocating extra memory) <br>
|
|
11413
|
+
* @name clear
|
|
11414
|
+
* @public
|
|
11415
|
+
* @returns {object} this object for chaining
|
|
11416
|
+
*/
|
|
11417
|
+
public clear(): object;
|
|
11418
|
+
}
|
|
11326
11419
|
/**
|
|
11327
11420
|
* @classdesc
|
|
11328
11421
|
* a simplified path2d implementation, supporting only one path
|
|
@@ -11400,13 +11493,13 @@ declare class Path2D {
|
|
|
11400
11493
|
* adds a circular arc to the path with the given control points and radius, connected to the previous point by a straight line.
|
|
11401
11494
|
* @name arcTo
|
|
11402
11495
|
* @memberof Path2D
|
|
11403
|
-
* @param {number}
|
|
11404
|
-
* @param {number}
|
|
11405
|
-
* @param {number}
|
|
11406
|
-
* @param {number}
|
|
11496
|
+
* @param {number} x1 the x-axis coordinate of the first control point.
|
|
11497
|
+
* @param {number} y1 the y-axis coordinate of the first control point.
|
|
11498
|
+
* @param {number} x2 the x-axis coordinate of the second control point.
|
|
11499
|
+
* @param {number} y2 the y-axis coordinate of the second control point.
|
|
11407
11500
|
* @param {number} radius the arc's radius. Must be positive.
|
|
11408
11501
|
*/
|
|
11409
|
-
arcTo(x1:
|
|
11502
|
+
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;
|
|
11410
11503
|
/**
|
|
11411
11504
|
* adds an elliptical arc to the path which is centered at (x, y) position with the radii radiusX and radiusY
|
|
11412
11505
|
* starting at startAngle and ending at endAngle going in the given direction by counterclockwise.
|
|
@@ -12407,8 +12500,6 @@ declare var fileUtils: Readonly<{
|
|
|
12407
12500
|
declare var stringUtils: Readonly<{
|
|
12408
12501
|
__proto__: any;
|
|
12409
12502
|
capitalize: typeof capitalize;
|
|
12410
|
-
trimLeft: typeof trimLeft;
|
|
12411
|
-
trimRight: typeof trimRight;
|
|
12412
12503
|
isNumeric: typeof isNumeric;
|
|
12413
12504
|
isBoolean: typeof isBoolean;
|
|
12414
12505
|
toHex: typeof toHex$1;
|
|
@@ -12588,24 +12679,6 @@ declare function getExtension(path: string): string;
|
|
|
12588
12679
|
* @returns {string} the capitalized string
|
|
12589
12680
|
*/
|
|
12590
12681
|
declare function capitalize(str: string): string;
|
|
12591
|
-
/**
|
|
12592
|
-
* returns the string stripped of whitespace from the left.
|
|
12593
|
-
* @public
|
|
12594
|
-
* @memberof utils.string
|
|
12595
|
-
* @name trimLeft
|
|
12596
|
-
* @param {string} str the string to be trimmed
|
|
12597
|
-
* @returns {string} trimmed string
|
|
12598
|
-
*/
|
|
12599
|
-
declare function trimLeft(str: string): string;
|
|
12600
|
-
/**
|
|
12601
|
-
* returns the string stripped of whitespace from the right.
|
|
12602
|
-
* @public
|
|
12603
|
-
* @memberof utils.string
|
|
12604
|
-
* @name trimRight
|
|
12605
|
-
* @param {string} str the string to be trimmed
|
|
12606
|
-
* @returns {string} trimmed string
|
|
12607
|
-
*/
|
|
12608
|
-
declare function trimRight(str: string): string;
|
|
12609
12682
|
/**
|
|
12610
12683
|
* returns true if the given string contains a numeric integer or float value
|
|
12611
12684
|
* @public
|