melonjs 10.2.0 → 10.3.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 +1 -1
- package/dist/melonjs.js +4435 -4283
- package/dist/melonjs.min.js +4 -4
- package/dist/melonjs.module.d.ts +3348 -3833
- package/dist/melonjs.module.js +4025 -3920
- package/package.json +13 -14
- package/src/audio/audio.js +45 -45
- package/src/camera/camera2d.js +78 -101
- package/src/entity/draggable.js +21 -29
- package/src/entity/droptarget.js +24 -31
- package/src/entity/entity.js +34 -38
- package/src/game.js +8 -8
- package/src/{shapes → geometries}/ellipse.js +46 -46
- package/src/{shapes → geometries}/line.js +14 -14
- package/src/{shapes → geometries}/poly.js +103 -54
- package/src/{shapes → geometries}/rectangle.js +73 -120
- package/src/index.js +18 -19
- package/src/input/gamepad.js +20 -20
- package/src/input/input.js +3 -3
- package/src/input/keyboard.js +122 -124
- package/src/input/pointer.js +102 -62
- package/src/input/pointerevent.js +97 -42
- package/src/lang/deprecated.js +29 -18
- package/src/level/level.js +34 -26
- package/src/level/tiled/TMXGroup.js +12 -13
- package/src/level/tiled/TMXLayer.js +41 -42
- package/src/level/tiled/TMXObject.js +76 -70
- package/src/level/tiled/TMXTile.js +13 -15
- package/src/level/tiled/TMXTileMap.js +26 -25
- package/src/level/tiled/TMXTileset.js +14 -15
- package/src/level/tiled/TMXTilesetGroup.js +5 -6
- package/src/level/tiled/TMXUtils.js +13 -11
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +3 -4
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +3 -4
- package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +2 -3
- package/src/level/tiled/renderer/TMXRenderer.js +18 -19
- package/src/level/tiled/renderer/TMXStaggeredRenderer.js +2 -3
- package/src/loader/loader.js +46 -40
- package/src/loader/loadingscreen.js +7 -7
- package/src/math/color.js +68 -88
- package/src/math/math.js +33 -33
- package/src/math/matrix2.js +70 -71
- package/src/math/matrix3.js +90 -91
- package/src/math/observable_vector2.js +91 -92
- package/src/math/observable_vector3.js +110 -106
- package/src/math/vector2.js +116 -104
- package/src/math/vector3.js +129 -110
- package/src/particles/emitter.js +116 -126
- package/src/particles/particle.js +4 -5
- package/src/particles/particlecontainer.js +2 -3
- package/src/physics/body.js +82 -83
- package/src/physics/bounds.js +64 -66
- package/src/physics/collision.js +21 -22
- package/src/physics/detector.js +13 -13
- package/src/physics/quadtree.js +26 -25
- package/src/physics/sat.js +21 -21
- package/src/physics/world.js +23 -22
- package/src/plugin/plugin.js +12 -13
- package/src/renderable/GUI.js +20 -26
- package/src/renderable/collectable.js +6 -7
- package/src/renderable/colorlayer.js +11 -12
- package/src/renderable/container.js +98 -81
- package/src/renderable/imagelayer.js +33 -35
- package/src/renderable/nineslicesprite.js +15 -16
- package/src/renderable/renderable.js +112 -111
- package/src/renderable/sprite.js +71 -58
- package/src/renderable/trigger.js +17 -19
- package/src/state/stage.js +14 -15
- package/src/state/state.js +78 -78
- package/src/system/device.js +137 -180
- package/src/system/event.js +116 -104
- package/src/system/pooling.js +15 -15
- package/src/system/save.js +9 -6
- package/src/system/timer.js +33 -33
- package/src/text/bitmaptext.js +39 -46
- package/src/text/bitmaptextdata.js +14 -15
- package/src/text/text.js +55 -58
- package/src/tweens/easing.js +5 -5
- package/src/tweens/interpolation.js +5 -5
- package/src/tweens/tween.js +49 -40
- package/src/utils/agent.js +12 -11
- package/src/utils/array.js +8 -8
- package/src/utils/file.js +7 -7
- package/src/utils/function.js +8 -8
- package/src/utils/string.js +19 -19
- package/src/utils/utils.js +23 -23
- package/src/video/canvas/canvas_renderer.js +127 -128
- package/src/video/renderer.js +69 -69
- package/src/video/texture.js +80 -82
- package/src/video/texture_cache.js +2 -4
- package/src/video/video.js +38 -38
- package/src/video/webgl/buffer/vertex.js +11 -3
- package/src/video/webgl/glshader.js +31 -32
- package/src/video/webgl/webgl_compositor.js +145 -127
- package/src/video/webgl/webgl_renderer.js +196 -175
package/src/renderable/sprite.js
CHANGED
|
@@ -10,20 +10,19 @@ import Renderable from "./renderable.js";
|
|
|
10
10
|
* @classdesc
|
|
11
11
|
* An object to display a fixed or animated sprite on screen.
|
|
12
12
|
* @class Sprite
|
|
13
|
-
* @
|
|
14
|
-
* @
|
|
15
|
-
* @
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {
|
|
18
|
-
* @param {
|
|
19
|
-
* @param {
|
|
20
|
-
* @param {
|
|
21
|
-
* @param {
|
|
22
|
-
* @param {
|
|
23
|
-
* @param {
|
|
24
|
-
* @param {
|
|
25
|
-
* @param {
|
|
26
|
-
* @param {Number} [settings.flipY] flip the sprite on the vertical axis
|
|
13
|
+
* @augments me.Renderable
|
|
14
|
+
* @memberof me
|
|
15
|
+
* @param {number} x the x coordinates of the sprite object
|
|
16
|
+
* @param {number} y the y coordinates of the sprite object
|
|
17
|
+
* @param {object} settings Configuration parameters for the Sprite object
|
|
18
|
+
* @param {me.Renderer.Texture|HTMLImageElement|HTMLCanvasElement|string} settings.image reference to a texture, spritesheet image or to a texture atlas
|
|
19
|
+
* @param {string} [settings.name=""] name of this object
|
|
20
|
+
* @param {string} [settings.region] region name of a specific region to use when using a texture atlas, see {@link me.Renderer.Texture}
|
|
21
|
+
* @param {number} [settings.framewidth] Width of a single frame within the spritesheet
|
|
22
|
+
* @param {number} [settings.frameheight] Height of a single frame within the spritesheet
|
|
23
|
+
* @param {string|me.Color} [settings.tint] a tint to be applied to this sprite
|
|
24
|
+
* @param {number} [settings.flipX] flip the sprite on the horizontal axis
|
|
25
|
+
* @param {number} [settings.flipY] flip the sprite on the vertical axis
|
|
27
26
|
* @param {me.Vector2d} [settings.anchorPoint={x:0.5, y:0.5}] Anchor point to draw the frame at (defaults to the center of the frame).
|
|
28
27
|
* @example
|
|
29
28
|
* // create a single sprite from a standalone image, with anchor in the center
|
|
@@ -58,7 +57,7 @@ class Sprite extends Renderable {
|
|
|
58
57
|
/**
|
|
59
58
|
* pause and resume animation
|
|
60
59
|
* @public
|
|
61
|
-
* @type
|
|
60
|
+
* @type {boolean}
|
|
62
61
|
* @default false
|
|
63
62
|
* @name me.Sprite#animationpause
|
|
64
63
|
*/
|
|
@@ -67,7 +66,7 @@ class Sprite extends Renderable {
|
|
|
67
66
|
/**
|
|
68
67
|
* animation cycling speed (delay between frame in ms)
|
|
69
68
|
* @public
|
|
70
|
-
* @type
|
|
69
|
+
* @type {number}
|
|
71
70
|
* @default 100
|
|
72
71
|
* @name me.Sprite#animationspeed
|
|
73
72
|
*/
|
|
@@ -76,19 +75,19 @@ class Sprite extends Renderable {
|
|
|
76
75
|
/**
|
|
77
76
|
* global offset for the position to draw from on the source image.
|
|
78
77
|
* @public
|
|
79
|
-
* @type me.Vector2d
|
|
78
|
+
* @type {me.Vector2d}
|
|
80
79
|
* @default <0.0,0.0>
|
|
81
80
|
* @name offset
|
|
82
|
-
* @
|
|
81
|
+
* @memberof me.Sprite#
|
|
83
82
|
*/
|
|
84
83
|
this.offset = pool.pull("Vector2d", 0, 0);
|
|
85
84
|
|
|
86
85
|
/**
|
|
87
86
|
* The source texture object this sprite object is using
|
|
88
87
|
* @public
|
|
89
|
-
* @type me.Renderer.Texture
|
|
88
|
+
* @type {me.Renderer.Texture}
|
|
90
89
|
* @name source
|
|
91
|
-
* @
|
|
90
|
+
* @memberof me.Sprite#
|
|
92
91
|
*/
|
|
93
92
|
this.source = null;
|
|
94
93
|
|
|
@@ -148,7 +147,7 @@ class Sprite extends Renderable {
|
|
|
148
147
|
}
|
|
149
148
|
}
|
|
150
149
|
} else {
|
|
151
|
-
// HTMLImageElement/Canvas or
|
|
150
|
+
// HTMLImageElement/Canvas or {string}
|
|
152
151
|
this.image = (typeof settings.image === "object") ? settings.image : loader.getImage(settings.image);
|
|
153
152
|
// throw an error if image ends up being null/undefined
|
|
154
153
|
if (!this.image) {
|
|
@@ -217,9 +216,9 @@ class Sprite extends Renderable {
|
|
|
217
216
|
/**
|
|
218
217
|
* return the flickering state of the object
|
|
219
218
|
* @name isFlickering
|
|
220
|
-
* @
|
|
219
|
+
* @memberof me.Sprite.prototype
|
|
221
220
|
* @function
|
|
222
|
-
* @
|
|
221
|
+
* @returns {boolean}
|
|
223
222
|
*/
|
|
224
223
|
isFlickering() {
|
|
225
224
|
return this._flicker.isFlickering;
|
|
@@ -228,11 +227,11 @@ class Sprite extends Renderable {
|
|
|
228
227
|
/**
|
|
229
228
|
* make the object flicker
|
|
230
229
|
* @name flicker
|
|
231
|
-
* @
|
|
230
|
+
* @memberof me.Sprite.prototype
|
|
232
231
|
* @function
|
|
233
|
-
* @param {
|
|
232
|
+
* @param {number} duration expressed in milliseconds
|
|
234
233
|
* @param {Function} callback Function to call when flickering ends
|
|
235
|
-
* @
|
|
234
|
+
* @returns {me.Sprite} Reference to this object for method chaining
|
|
236
235
|
* @example
|
|
237
236
|
* // make the object flicker for 1 second
|
|
238
237
|
* // and then remove it
|
|
@@ -259,13 +258,13 @@ class Sprite extends Renderable {
|
|
|
259
258
|
* logic as per the following example :<br>
|
|
260
259
|
* <img src="images/spritesheet_grid.png"/>
|
|
261
260
|
* @name addAnimation
|
|
262
|
-
* @
|
|
261
|
+
* @memberof me.Sprite.prototype
|
|
263
262
|
* @function
|
|
264
|
-
* @param {
|
|
265
|
-
* @param {
|
|
263
|
+
* @param {string} name animation id
|
|
264
|
+
* @param {number[]|string[]|object[]} index list of sprite index or name
|
|
266
265
|
* defining the animation. Can also use objects to specify delay for each frame, see below
|
|
267
|
-
* @param {
|
|
268
|
-
* @
|
|
266
|
+
* @param {number} [animationspeed] cycling speed for animation in ms
|
|
267
|
+
* @returns {number} frame amount of frame added to the animation (delay between each frame).
|
|
269
268
|
* @see me.Sprite#animationspeed
|
|
270
269
|
* @example
|
|
271
270
|
* // walking animation
|
|
@@ -359,11 +358,12 @@ class Sprite extends Renderable {
|
|
|
359
358
|
* set the current animation
|
|
360
359
|
* this will always change the animation & set the frame to zero
|
|
361
360
|
* @name setCurrentAnimation
|
|
362
|
-
* @
|
|
361
|
+
* @memberof me.Sprite.prototype
|
|
363
362
|
* @function
|
|
364
|
-
* @param {
|
|
365
|
-
* @param {
|
|
366
|
-
* @
|
|
363
|
+
* @param {string} name animation id
|
|
364
|
+
* @param {string|Function} [resetAnim] animation id to switch to when complete, or callback
|
|
365
|
+
* @param {boolean} [preserve_dt=false] if false will reset the elapsed time counter since last frame
|
|
366
|
+
* @returns {me.Sprite} Reference to this object for method chaining
|
|
367
367
|
* @example
|
|
368
368
|
* // set "walk" animation
|
|
369
369
|
* this.setCurrentAnimation("walk");
|
|
@@ -393,8 +393,8 @@ class Sprite extends Renderable {
|
|
|
393
393
|
*
|
|
394
394
|
* return false; // do not reset to first frame
|
|
395
395
|
* }).bind(this));
|
|
396
|
-
|
|
397
|
-
setCurrentAnimation(name, resetAnim,
|
|
396
|
+
*/
|
|
397
|
+
setCurrentAnimation(name, resetAnim, preserve_dt) {
|
|
398
398
|
if (this.anim[name]) {
|
|
399
399
|
this.current.name = name;
|
|
400
400
|
this.current.length = this.anim[this.current.name].length;
|
|
@@ -406,7 +406,7 @@ class Sprite extends Renderable {
|
|
|
406
406
|
this.resetAnim = undefined;
|
|
407
407
|
}
|
|
408
408
|
this.setAnimationFrame(this.current.idx);
|
|
409
|
-
if (!
|
|
409
|
+
if (!preserve_dt) {
|
|
410
410
|
this.dt = 0;
|
|
411
411
|
}
|
|
412
412
|
this.isDirty = true;
|
|
@@ -419,10 +419,10 @@ class Sprite extends Renderable {
|
|
|
419
419
|
/**
|
|
420
420
|
* reverse the given or current animation if none is specified
|
|
421
421
|
* @name reverseAnimation
|
|
422
|
-
* @
|
|
422
|
+
* @memberof me.Sprite.prototype
|
|
423
423
|
* @function
|
|
424
|
-
* @param {
|
|
425
|
-
* @
|
|
424
|
+
* @param {string} [name] animation id
|
|
425
|
+
* @returns {me.Sprite} Reference to this object for method chaining
|
|
426
426
|
* @see me.Sprite#animationspeed
|
|
427
427
|
*/
|
|
428
428
|
reverseAnimation(name) {
|
|
@@ -438,10 +438,10 @@ class Sprite extends Renderable {
|
|
|
438
438
|
/**
|
|
439
439
|
* return true if the specified animation is the current one.
|
|
440
440
|
* @name isCurrentAnimation
|
|
441
|
-
* @
|
|
441
|
+
* @memberof me.Sprite.prototype
|
|
442
442
|
* @function
|
|
443
|
-
* @param {
|
|
444
|
-
* @
|
|
443
|
+
* @param {string} name animation id
|
|
444
|
+
* @returns {boolean}
|
|
445
445
|
* @example
|
|
446
446
|
* if (!this.isCurrentAnimation("walk")) {
|
|
447
447
|
* // do something funny...
|
|
@@ -455,10 +455,10 @@ class Sprite extends Renderable {
|
|
|
455
455
|
* change the current texture atlas region for this sprite
|
|
456
456
|
* @see me.Texture.getRegion
|
|
457
457
|
* @name setRegion
|
|
458
|
-
* @
|
|
458
|
+
* @memberof me.Sprite.prototype
|
|
459
459
|
* @function
|
|
460
|
-
* @param {
|
|
461
|
-
* @
|
|
460
|
+
* @param {object} region typically returned through me.Texture.getRegion()
|
|
461
|
+
* @returns {me.Sprite} Reference to this object for method chaining
|
|
462
462
|
* @example
|
|
463
463
|
* // change the sprite to "shadedDark13.png";
|
|
464
464
|
* mySprite.setRegion(game.texture.getRegion("shadedDark13.png"));
|
|
@@ -487,10 +487,10 @@ class Sprite extends Renderable {
|
|
|
487
487
|
/**
|
|
488
488
|
* force the current animation frame index.
|
|
489
489
|
* @name setAnimationFrame
|
|
490
|
-
* @
|
|
490
|
+
* @memberof me.Sprite.prototype
|
|
491
491
|
* @function
|
|
492
|
-
* @param {
|
|
493
|
-
* @
|
|
492
|
+
* @param {number} [idx=0] animation frame index
|
|
493
|
+
* @returns {me.Sprite} Reference to this object for method chaining
|
|
494
494
|
* @example
|
|
495
495
|
* // reset the current animation to the first frame
|
|
496
496
|
* this.setAnimationFrame();
|
|
@@ -503,9 +503,9 @@ class Sprite extends Renderable {
|
|
|
503
503
|
/**
|
|
504
504
|
* return the current animation frame index.
|
|
505
505
|
* @name getCurrentAnimationFrame
|
|
506
|
-
* @
|
|
506
|
+
* @memberof me.Sprite.prototype
|
|
507
507
|
* @function
|
|
508
|
-
* @
|
|
508
|
+
* @returns {number} current animation frame index
|
|
509
509
|
*/
|
|
510
510
|
getCurrentAnimationFrame() {
|
|
511
511
|
return this.current.idx;
|
|
@@ -514,20 +514,27 @@ class Sprite extends Renderable {
|
|
|
514
514
|
/**
|
|
515
515
|
* Returns the frame object by the index.
|
|
516
516
|
* @name getAnimationFrameObjectByIndex
|
|
517
|
-
* @
|
|
517
|
+
* @memberof me.Sprite.prototype
|
|
518
518
|
* @function
|
|
519
|
-
* @
|
|
520
|
-
* @
|
|
519
|
+
* @ignore
|
|
520
|
+
* @param {number} id the frame id
|
|
521
|
+
* @returns {number} if using number indices. Returns {object} containing frame data if using texture atlas
|
|
521
522
|
*/
|
|
522
523
|
getAnimationFrameObjectByIndex(id) {
|
|
523
524
|
return this.anim[this.current.name].frames[id];
|
|
524
525
|
}
|
|
525
526
|
|
|
526
527
|
/**
|
|
527
|
-
*
|
|
528
|
+
* update function. <br>
|
|
529
|
+
* automatically called by the game manager {@link me.game}
|
|
530
|
+
* @name update
|
|
531
|
+
* @memberof me.Sprite.prototype
|
|
532
|
+
* @function
|
|
533
|
+
* @protected
|
|
534
|
+
* @param {number} dt time since the last update in milliseconds.
|
|
535
|
+
* @returns {boolean} true if the Sprite is dirty
|
|
528
536
|
*/
|
|
529
537
|
update(dt) {
|
|
530
|
-
|
|
531
538
|
// Update animation if necessary
|
|
532
539
|
if (!this.animationpause && this.current && this.current.length > 0) {
|
|
533
540
|
var duration = this.getAnimationFrameObjectByIndex(this.current.idx).delay;
|
|
@@ -597,7 +604,13 @@ class Sprite extends Renderable {
|
|
|
597
604
|
}
|
|
598
605
|
|
|
599
606
|
/**
|
|
600
|
-
*
|
|
607
|
+
* sprite draw. <br>
|
|
608
|
+
* automatically called by the game manager {@link me.game}
|
|
609
|
+
* @name draw
|
|
610
|
+
* @memberof me.Sprite.prototype
|
|
611
|
+
* @function
|
|
612
|
+
* @protected
|
|
613
|
+
* @param {me.CanvasRenderer|me.WebGLRenderer} renderer a renderer object
|
|
601
614
|
*/
|
|
602
615
|
draw(renderer) {
|
|
603
616
|
// do nothing if we are flickering
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Renderable from "./renderable.js";
|
|
2
2
|
import collision from "./../physics/collision.js";
|
|
3
3
|
import Body from "./../physics/body.js";
|
|
4
|
-
import Rect from "./../
|
|
4
|
+
import Rect from "./../geometries/rectangle.js";
|
|
5
5
|
import level from "./../level/level.js";
|
|
6
6
|
import { world, viewport } from "./../game.js";
|
|
7
7
|
|
|
@@ -9,22 +9,21 @@ import { world, viewport } from "./../game.js";
|
|
|
9
9
|
* @classdesc
|
|
10
10
|
* trigger an event when colliding with another object
|
|
11
11
|
* @class Trigger
|
|
12
|
-
* @
|
|
13
|
-
* @
|
|
14
|
-
* @
|
|
15
|
-
* @param {
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {
|
|
18
|
-
* @param {Number} [settings.height] height of the trigger area
|
|
12
|
+
* @augments me.Renderable
|
|
13
|
+
* @memberof me
|
|
14
|
+
* @param {number} x the x coordinates of the trigger area
|
|
15
|
+
* @param {number} y the y coordinates of the trigger area
|
|
16
|
+
* @param {number} [settings.width] width of the trigger area
|
|
17
|
+
* @param {number} [settings.height] height of the trigger area
|
|
19
18
|
* @param {me.Rect[]|me.Polygon[]|me.Line[]|me.Ellipse[]} [settings.shapes] collision shape(s) that will trigger the event
|
|
20
|
-
* @param {
|
|
21
|
-
* @param {
|
|
22
|
-
* @param {
|
|
23
|
-
* @param {
|
|
24
|
-
* @param {
|
|
19
|
+
* @param {string} [settings.duration] Fade duration (in ms)
|
|
20
|
+
* @param {string|me.Color} [settings.color] Fade color
|
|
21
|
+
* @param {string} [settings.event="level"] the type of event to trigger (only "level" supported for now)
|
|
22
|
+
* @param {string} [settings.to] level to load if level trigger
|
|
23
|
+
* @param {string|me.Container} [settings.container] Target container. See {@link me.level.load}
|
|
25
24
|
* @param {Function} [settings.onLoaded] Level loaded callback. See {@link me.level.load}
|
|
26
|
-
* @param {
|
|
27
|
-
* @param {
|
|
25
|
+
* @param {boolean} [settings.flatten] Flatten all objects into the target container. See {@link me.level.load}
|
|
26
|
+
* @param {boolean} [settings.setViewportBounds] Resize the viewport to match the level. See {@link me.level.load}
|
|
28
27
|
* @example
|
|
29
28
|
* me.game.world.addChild(new me.Trigger(
|
|
30
29
|
* x, y, {
|
|
@@ -102,11 +101,10 @@ class Trigger extends Renderable {
|
|
|
102
101
|
}
|
|
103
102
|
|
|
104
103
|
/**
|
|
105
|
-
*
|
|
106
|
-
* @name
|
|
107
|
-
* @
|
|
104
|
+
* trigger this event
|
|
105
|
+
* @name triggerEvent
|
|
106
|
+
* @memberof me.Trigger
|
|
108
107
|
* @function
|
|
109
|
-
* @param {String} [level=this.nextlevel] name of the level to load
|
|
110
108
|
* @protected
|
|
111
109
|
*/
|
|
112
110
|
triggerEvent() {
|
package/src/state/stage.js
CHANGED
|
@@ -16,10 +16,9 @@ var default_settings = {
|
|
|
16
16
|
* every "stage" object (title screen, credits, ingame, etc...) to be managed
|
|
17
17
|
* through the state manager must inherit from this base class.
|
|
18
18
|
* @class Stage
|
|
19
|
-
* @
|
|
20
|
-
* @
|
|
21
|
-
* @
|
|
22
|
-
* @param {Object} [options] The stage` parameters
|
|
19
|
+
* @augments me.Object
|
|
20
|
+
* @memberof me
|
|
21
|
+
* @param {object} [options] The stage` parameters
|
|
23
22
|
* @param {me.Camera2d[]} [options.cameras=[new me.Camera2d()]] a list of cameras (experimental)
|
|
24
23
|
* @param {Function} [options.onResetEvent] called by the state manager when reseting the object
|
|
25
24
|
* @param {Function} [options.onDestroyEvent] called by the state manager before switching to another state
|
|
@@ -38,7 +37,7 @@ class Stage {
|
|
|
38
37
|
* @public
|
|
39
38
|
* @type {Map}
|
|
40
39
|
* @name cameras
|
|
41
|
-
* @
|
|
40
|
+
* @memberof me.Stage
|
|
42
41
|
*/
|
|
43
42
|
this.cameras = new Map();
|
|
44
43
|
|
|
@@ -46,8 +45,8 @@ class Stage {
|
|
|
46
45
|
* The given constructor options
|
|
47
46
|
* @public
|
|
48
47
|
* @name settings
|
|
49
|
-
* @
|
|
50
|
-
* @
|
|
48
|
+
* @memberof me.Stage
|
|
49
|
+
* @type {object}
|
|
51
50
|
*/
|
|
52
51
|
this.settings = Object.assign(default_settings, settings || {});
|
|
53
52
|
}
|
|
@@ -84,12 +83,12 @@ class Stage {
|
|
|
84
83
|
/**
|
|
85
84
|
* update function
|
|
86
85
|
* @name update
|
|
87
|
-
* @
|
|
86
|
+
* @memberof me.Stage
|
|
88
87
|
* @ignore
|
|
89
88
|
* @function
|
|
90
|
-
* @param {
|
|
91
|
-
* @
|
|
92
|
-
|
|
89
|
+
* @param {number} dt time since the last update in milliseconds.
|
|
90
|
+
* @returns {boolean}
|
|
91
|
+
*/
|
|
93
92
|
update(dt) {
|
|
94
93
|
// update all objects (and pass the elapsed time since last frame)
|
|
95
94
|
var isDirty = game.world.update(dt);
|
|
@@ -108,7 +107,7 @@ class Stage {
|
|
|
108
107
|
/**
|
|
109
108
|
* draw the current stage
|
|
110
109
|
* @name draw
|
|
111
|
-
* @
|
|
110
|
+
* @memberof me.Stage
|
|
112
111
|
* @ignore
|
|
113
112
|
* @function
|
|
114
113
|
* @param {me.CanvasRenderer|me.WebGLRenderer} renderer a renderer object
|
|
@@ -137,9 +136,9 @@ class Stage {
|
|
|
137
136
|
* called by the state manager when reseting the object
|
|
138
137
|
* this is typically where you will load a level, add renderables, etc...
|
|
139
138
|
* @name onResetEvent
|
|
140
|
-
* @
|
|
139
|
+
* @memberof me.Stage
|
|
141
140
|
* @function
|
|
142
|
-
* @param {} [arguments
|
|
141
|
+
* @param {object} [...arguments] optional arguments passed when switching state
|
|
143
142
|
* @see me.state#change
|
|
144
143
|
*/
|
|
145
144
|
onResetEvent() {
|
|
@@ -154,7 +153,7 @@ class Stage {
|
|
|
154
153
|
* onDestroyEvent function<br>
|
|
155
154
|
* called by the state manager before switching to another state
|
|
156
155
|
* @name onDestroyEvent
|
|
157
|
-
* @
|
|
156
|
+
* @memberof me.Stage
|
|
158
157
|
* @function
|
|
159
158
|
*/
|
|
160
159
|
onDestroyEvent() {
|