melonjs 10.10.0 → 10.11.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 +4 -3
- package/dist/melonjs.js +817 -1922
- package/dist/melonjs.min.js +4 -4
- package/dist/melonjs.module.d.ts +339 -1183
- package/dist/melonjs.module.js +745 -1846
- package/package.json +12 -15
- package/src/audio/audio.js +0 -1
- package/src/camera/camera2d.js +1 -16
- package/src/entity/entity.js +1 -4
- package/src/geometries/ellipse.js +2 -11
- package/src/geometries/line.js +1 -4
- package/src/geometries/path2d.js +0 -10
- package/src/geometries/poly.js +5 -22
- package/src/geometries/rectangle.js +2 -14
- package/src/geometries/roundrect.js +2 -6
- package/src/index.js +0 -1
- package/src/input/gamepad.js +3 -14
- package/src/input/keyboard.js +1 -9
- package/src/input/pointer.js +0 -1
- package/src/input/pointerevent.js +14 -23
- package/src/lang/deprecated.js +4 -3
- package/src/level/level.js +0 -9
- package/src/level/tiled/TMXGroup.js +0 -4
- package/src/level/tiled/TMXLayer.js +0 -8
- package/src/level/tiled/TMXObject.js +0 -3
- package/src/level/tiled/TMXTile.js +4 -5
- package/src/level/tiled/TMXTileMap.js +1 -7
- package/src/level/tiled/TMXTileset.js +0 -5
- package/src/level/tiled/TMXTilesetGroup.js +1 -4
- package/src/level/tiled/TMXUtils.js +0 -3
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +2 -3
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +0 -1
- package/src/level/tiled/renderer/TMXRenderer.js +1 -7
- package/src/loader/loader.js +0 -11
- package/src/loader/loadingscreen.js +1 -1
- package/src/math/color.js +5 -26
- package/src/math/math.js +0 -10
- package/src/math/matrix2.js +12 -27
- package/src/math/matrix3.js +1 -22
- package/src/math/observable_vector2.js +0 -29
- package/src/math/observable_vector3.js +0 -29
- package/src/math/vector2.js +3 -40
- package/src/math/vector3.js +4 -41
- package/src/particles/emitter.js +1 -1
- package/src/physics/body.js +1 -1
- package/src/physics/bounds.js +5 -19
- package/src/physics/collision.js +0 -1
- package/src/physics/detector.js +0 -4
- package/src/physics/quadtree.js +0 -7
- package/src/physics/sat.js +3 -3
- package/src/physics/world.js +0 -4
- package/src/plugin/plugin.js +0 -2
- package/src/polyfill/roundrect.js +4 -2
- package/src/renderable/GUI.js +0 -5
- package/src/renderable/collectable.js +1 -0
- package/src/renderable/container.js +0 -28
- package/src/renderable/dragndrop.js +0 -9
- package/src/renderable/imagelayer.js +1 -5
- package/src/renderable/light2d.js +1 -2
- package/src/renderable/renderable.js +0 -22
- package/src/renderable/sprite.js +0 -12
- package/src/renderable/trigger.js +1 -1
- package/src/state/stage.js +0 -4
- package/src/state/state.js +3 -20
- package/src/system/device.js +14 -53
- package/src/system/event.js +11 -0
- package/src/system/pooling.js +19 -8
- package/src/system/save.js +9 -11
- package/src/system/timer.js +239 -218
- package/src/text/bitmaptextdata.js +1 -4
- package/src/text/glyph.js +2 -2
- package/src/text/text.js +7 -5
- package/src/text/textmetrics.js +0 -2
- package/src/tweens/easing.js +1 -1
- package/src/tweens/interpolation.js +2 -2
- package/src/tweens/tween.js +1 -13
- package/src/utils/agent.js +1 -3
- package/src/utils/array.js +0 -3
- package/src/utils/file.js +0 -2
- package/src/utils/function.js +0 -2
- package/src/utils/string.js +0 -6
- package/src/utils/utils.js +0 -3
- package/src/video/canvas/canvas_renderer.js +4 -39
- package/src/video/renderer.js +1 -23
- package/src/video/texture/cache.js +0 -1
- package/src/video/texture/canvas_texture.js +16 -4
- package/src/video/video.js +3 -3
- package/src/video/webgl/glshader.js +0 -5
- package/src/video/webgl/utils/uniforms.js +3 -6
- package/src/video/webgl/webgl_compositor.js +0 -14
- package/src/video/webgl/webgl_renderer.js +0 -42
package/src/math/vector3.js
CHANGED
|
@@ -40,7 +40,6 @@ class Vector3d {
|
|
|
40
40
|
* set the Vector x and y properties to the given values<br>
|
|
41
41
|
* @name set
|
|
42
42
|
* @memberof Vector3d
|
|
43
|
-
* @function
|
|
44
43
|
* @param {number} x
|
|
45
44
|
* @param {number} y
|
|
46
45
|
* @param {number} [z=0]
|
|
@@ -56,7 +55,7 @@ class Vector3d {
|
|
|
56
55
|
/**
|
|
57
56
|
* x value of the vector
|
|
58
57
|
* @public
|
|
59
|
-
* @
|
|
58
|
+
* @member {number}
|
|
60
59
|
* @name x
|
|
61
60
|
* @memberof Vector3d
|
|
62
61
|
*/
|
|
@@ -65,7 +64,7 @@ class Vector3d {
|
|
|
65
64
|
/**
|
|
66
65
|
* y value of the vector
|
|
67
66
|
* @public
|
|
68
|
-
* @
|
|
67
|
+
* @member {number}
|
|
69
68
|
* @name y
|
|
70
69
|
* @memberof Vector3d
|
|
71
70
|
*/
|
|
@@ -74,7 +73,7 @@ class Vector3d {
|
|
|
74
73
|
/**
|
|
75
74
|
* z value of the vector
|
|
76
75
|
* @public
|
|
77
|
-
* @
|
|
76
|
+
* @member {number}
|
|
78
77
|
* @name z
|
|
79
78
|
* @memberof Vector3d
|
|
80
79
|
*/
|
|
@@ -87,7 +86,6 @@ class Vector3d {
|
|
|
87
86
|
* set the Vector x and y properties to 0
|
|
88
87
|
* @name setZero
|
|
89
88
|
* @memberof Vector3d
|
|
90
|
-
* @function
|
|
91
89
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
92
90
|
*/
|
|
93
91
|
setZero() {
|
|
@@ -98,7 +96,6 @@ class Vector3d {
|
|
|
98
96
|
* set the Vector x and y properties using the passed vector
|
|
99
97
|
* @name setV
|
|
100
98
|
* @memberof Vector3d
|
|
101
|
-
* @function
|
|
102
99
|
* @param {Vector2d|Vector3d} v
|
|
103
100
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
104
101
|
*/
|
|
@@ -110,7 +107,6 @@ class Vector3d {
|
|
|
110
107
|
* Add the passed vector to this vector
|
|
111
108
|
* @name add
|
|
112
109
|
* @memberof Vector3d
|
|
113
|
-
* @function
|
|
114
110
|
* @param {Vector2d|Vector3d} v
|
|
115
111
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
116
112
|
*/
|
|
@@ -122,7 +118,6 @@ class Vector3d {
|
|
|
122
118
|
* Substract the passed vector to this vector
|
|
123
119
|
* @name sub
|
|
124
120
|
* @memberof Vector3d
|
|
125
|
-
* @function
|
|
126
121
|
* @param {Vector2d|Vector3d} v
|
|
127
122
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
128
123
|
*/
|
|
@@ -134,7 +129,6 @@ class Vector3d {
|
|
|
134
129
|
* Multiply this vector values by the given scalar
|
|
135
130
|
* @name scale
|
|
136
131
|
* @memberof Vector3d
|
|
137
|
-
* @function
|
|
138
132
|
* @param {number} x
|
|
139
133
|
* @param {number} [y=x]
|
|
140
134
|
* @param {number} [z=1]
|
|
@@ -149,7 +143,6 @@ class Vector3d {
|
|
|
149
143
|
* Multiply this vector values by the passed vector
|
|
150
144
|
* @name scaleV
|
|
151
145
|
* @memberof Vector3d
|
|
152
|
-
* @function
|
|
153
146
|
* @param {Vector2d|Vector3d} v
|
|
154
147
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
155
148
|
*/
|
|
@@ -161,7 +154,6 @@ class Vector3d {
|
|
|
161
154
|
* Convert this vector into isometric coordinate space
|
|
162
155
|
* @name toIso
|
|
163
156
|
* @memberof Vector3d
|
|
164
|
-
* @function
|
|
165
157
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
166
158
|
*/
|
|
167
159
|
toIso() {
|
|
@@ -172,7 +164,6 @@ class Vector3d {
|
|
|
172
164
|
* Convert this vector into 2d coordinate space
|
|
173
165
|
* @name to2d
|
|
174
166
|
* @memberof Vector3d
|
|
175
|
-
* @function
|
|
176
167
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
177
168
|
*/
|
|
178
169
|
to2d() {
|
|
@@ -183,7 +174,6 @@ class Vector3d {
|
|
|
183
174
|
* Divide this vector values by the passed value
|
|
184
175
|
* @name div
|
|
185
176
|
* @memberof Vector3d
|
|
186
|
-
* @function
|
|
187
177
|
* @param {number} n the value to divide the vector by
|
|
188
178
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
189
179
|
*/
|
|
@@ -195,7 +185,6 @@ class Vector3d {
|
|
|
195
185
|
* Update this vector values to absolute values
|
|
196
186
|
* @name abs
|
|
197
187
|
* @memberof Vector3d
|
|
198
|
-
* @function
|
|
199
188
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
200
189
|
*/
|
|
201
190
|
abs() {
|
|
@@ -206,7 +195,6 @@ class Vector3d {
|
|
|
206
195
|
* Clamp the vector value within the specified value range
|
|
207
196
|
* @name clamp
|
|
208
197
|
* @memberof Vector3d
|
|
209
|
-
* @function
|
|
210
198
|
* @param {number} low
|
|
211
199
|
* @param {number} high
|
|
212
200
|
* @returns {Vector3d} new me.Vector3d
|
|
@@ -219,7 +207,6 @@ class Vector3d {
|
|
|
219
207
|
* Clamp this vector value within the specified value range
|
|
220
208
|
* @name clampSelf
|
|
221
209
|
* @memberof Vector3d
|
|
222
|
-
* @function
|
|
223
210
|
* @param {number} low
|
|
224
211
|
* @param {number} high
|
|
225
212
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
@@ -232,7 +219,6 @@ class Vector3d {
|
|
|
232
219
|
* Update this vector with the minimum value between this and the passed vector
|
|
233
220
|
* @name minV
|
|
234
221
|
* @memberof Vector3d
|
|
235
|
-
* @function
|
|
236
222
|
* @param {Vector2d|Vector3d} v
|
|
237
223
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
238
224
|
*/
|
|
@@ -245,7 +231,6 @@ class Vector3d {
|
|
|
245
231
|
* Update this vector with the maximum value between this and the passed vector
|
|
246
232
|
* @name maxV
|
|
247
233
|
* @memberof Vector3d
|
|
248
|
-
* @function
|
|
249
234
|
* @param {Vector2d|Vector3d} v
|
|
250
235
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
251
236
|
*/
|
|
@@ -258,7 +243,6 @@ class Vector3d {
|
|
|
258
243
|
* Floor the vector values
|
|
259
244
|
* @name floor
|
|
260
245
|
* @memberof Vector3d
|
|
261
|
-
* @function
|
|
262
246
|
* @returns {Vector3d} new me.Vector3d
|
|
263
247
|
*/
|
|
264
248
|
floor() {
|
|
@@ -269,7 +253,6 @@ class Vector3d {
|
|
|
269
253
|
* Floor this vector values
|
|
270
254
|
* @name floorSelf
|
|
271
255
|
* @memberof Vector3d
|
|
272
|
-
* @function
|
|
273
256
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
274
257
|
*/
|
|
275
258
|
floorSelf() {
|
|
@@ -280,7 +263,6 @@ class Vector3d {
|
|
|
280
263
|
* Ceil the vector values
|
|
281
264
|
* @name ceil
|
|
282
265
|
* @memberof Vector3d
|
|
283
|
-
* @function
|
|
284
266
|
* @returns {Vector3d} new me.Vector3d
|
|
285
267
|
*/
|
|
286
268
|
ceil() {
|
|
@@ -291,7 +273,6 @@ class Vector3d {
|
|
|
291
273
|
* Ceil this vector values
|
|
292
274
|
* @name ceilSelf
|
|
293
275
|
* @memberof Vector3d
|
|
294
|
-
* @function
|
|
295
276
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
296
277
|
*/
|
|
297
278
|
ceilSelf() {
|
|
@@ -302,7 +283,6 @@ class Vector3d {
|
|
|
302
283
|
* Negate the vector values
|
|
303
284
|
* @name negate
|
|
304
285
|
* @memberof Vector3d
|
|
305
|
-
* @function
|
|
306
286
|
* @returns {Vector3d} new me.Vector3d
|
|
307
287
|
*/
|
|
308
288
|
negate() {
|
|
@@ -313,7 +293,6 @@ class Vector3d {
|
|
|
313
293
|
* Negate this vector values
|
|
314
294
|
* @name negateSelf
|
|
315
295
|
* @memberof Vector3d
|
|
316
|
-
* @function
|
|
317
296
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
318
297
|
*/
|
|
319
298
|
negateSelf() {
|
|
@@ -324,7 +303,6 @@ class Vector3d {
|
|
|
324
303
|
* Copy the components of the given vector into this one
|
|
325
304
|
* @name copy
|
|
326
305
|
* @memberof Vector3d
|
|
327
|
-
* @function
|
|
328
306
|
* @param {Vector2d|Vector3d} v
|
|
329
307
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
330
308
|
*/
|
|
@@ -336,7 +314,7 @@ class Vector3d {
|
|
|
336
314
|
* return true if the two vectors are the same
|
|
337
315
|
* @name equals
|
|
338
316
|
* @memberof Vector3d
|
|
339
|
-
* @
|
|
317
|
+
* @method
|
|
340
318
|
* @param {Vector2d|Vector3d} v
|
|
341
319
|
* @returns {boolean}
|
|
342
320
|
*/
|
|
@@ -344,7 +322,6 @@ class Vector3d {
|
|
|
344
322
|
* return true if this vector is equal to the given values
|
|
345
323
|
* @name equals
|
|
346
324
|
* @memberof Vector3d
|
|
347
|
-
* @function
|
|
348
325
|
* @param {number} x
|
|
349
326
|
* @param {number} y
|
|
350
327
|
* @param {number} [z]
|
|
@@ -375,7 +352,6 @@ class Vector3d {
|
|
|
375
352
|
* normalize this vector (scale the vector so that its magnitude is 1)
|
|
376
353
|
* @name normalize
|
|
377
354
|
* @memberof Vector3d
|
|
378
|
-
* @function
|
|
379
355
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
380
356
|
*/
|
|
381
357
|
normalize() {
|
|
@@ -387,7 +363,6 @@ class Vector3d {
|
|
|
387
363
|
* (Effectively rotates it 90 degrees in a clockwise direction around the z axis)
|
|
388
364
|
* @name perp
|
|
389
365
|
* @memberof Vector3d
|
|
390
|
-
* @function
|
|
391
366
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
392
367
|
*/
|
|
393
368
|
perp() {
|
|
@@ -398,7 +373,6 @@ class Vector3d {
|
|
|
398
373
|
* Rotate this vector (counter-clockwise) by the specified angle (in radians) around the z axis
|
|
399
374
|
* @name rotate
|
|
400
375
|
* @memberof Vector3d
|
|
401
|
-
* @function
|
|
402
376
|
* @param {number} angle The angle to rotate (in radians)
|
|
403
377
|
* @param {Vector2d|ObservableVector2d} [v] an optional point to rotate around (on the same z axis)
|
|
404
378
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
@@ -426,7 +400,6 @@ class Vector3d {
|
|
|
426
400
|
* return the dot product of this vector and the passed one
|
|
427
401
|
* @name dot
|
|
428
402
|
* @memberof Vector3d
|
|
429
|
-
* @function
|
|
430
403
|
* @param {Vector2d|Vector3d} v
|
|
431
404
|
* @returns {number} The dot product.
|
|
432
405
|
*/
|
|
@@ -438,7 +411,6 @@ class Vector3d {
|
|
|
438
411
|
* calculate the cross product of this vector and the passed one
|
|
439
412
|
* @name cross
|
|
440
413
|
* @memberof Vector3d
|
|
441
|
-
* @function
|
|
442
414
|
* @param {Vector3d} v
|
|
443
415
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
444
416
|
*/
|
|
@@ -457,7 +429,6 @@ class Vector3d {
|
|
|
457
429
|
* return the square length of this vector
|
|
458
430
|
* @name length2
|
|
459
431
|
* @memberof Vector3d
|
|
460
|
-
* @function
|
|
461
432
|
* @returns {number} The length^2 of this vector.
|
|
462
433
|
*/
|
|
463
434
|
length2() {
|
|
@@ -468,7 +439,6 @@ class Vector3d {
|
|
|
468
439
|
* return the length (magnitude) of this vector
|
|
469
440
|
* @name length
|
|
470
441
|
* @memberof Vector3d
|
|
471
|
-
* @function
|
|
472
442
|
* @returns {number} the length of this vector
|
|
473
443
|
*/
|
|
474
444
|
length() {
|
|
@@ -479,7 +449,6 @@ class Vector3d {
|
|
|
479
449
|
* Linearly interpolate between this vector and the given one.
|
|
480
450
|
* @name lerp
|
|
481
451
|
* @memberof Vector3d
|
|
482
|
-
* @function
|
|
483
452
|
* @param {Vector3d} v
|
|
484
453
|
* @param {number} alpha distance along the line (alpha = 0 will be this vector, and alpha = 1 will be the given one).
|
|
485
454
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
@@ -495,7 +464,6 @@ class Vector3d {
|
|
|
495
464
|
* return the distance between this vector and the passed one
|
|
496
465
|
* @name distance
|
|
497
466
|
* @memberof Vector3d
|
|
498
|
-
* @function
|
|
499
467
|
* @param {Vector2d|Vector3d} v
|
|
500
468
|
* @returns {number}
|
|
501
469
|
*/
|
|
@@ -510,7 +478,6 @@ class Vector3d {
|
|
|
510
478
|
* return the angle between this vector and the passed one
|
|
511
479
|
* @name angle
|
|
512
480
|
* @memberof Vector3d
|
|
513
|
-
* @function
|
|
514
481
|
* @param {Vector2d|Vector3d} v
|
|
515
482
|
* @returns {number} angle in radians
|
|
516
483
|
*/
|
|
@@ -522,7 +489,6 @@ class Vector3d {
|
|
|
522
489
|
* project this vector on to another vector.
|
|
523
490
|
* @name project
|
|
524
491
|
* @memberof Vector3d
|
|
525
|
-
* @function
|
|
526
492
|
* @param {Vector2d|Vector3d} v The vector to project onto.
|
|
527
493
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
528
494
|
*/
|
|
@@ -536,7 +502,6 @@ class Vector3d {
|
|
|
536
502
|
* This is slightly more efficient than `project` when dealing with unit vectors.
|
|
537
503
|
* @name projectN
|
|
538
504
|
* @memberof Vector3d
|
|
539
|
-
* @function
|
|
540
505
|
* @param {Vector2d|Vector3d} v The unit vector to project onto.
|
|
541
506
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
542
507
|
*/
|
|
@@ -549,7 +514,6 @@ class Vector3d {
|
|
|
549
514
|
* return a clone copy of this vector
|
|
550
515
|
* @name clone
|
|
551
516
|
* @memberof Vector3d
|
|
552
|
-
* @function
|
|
553
517
|
* @returns {Vector3d} new me.Vector3d
|
|
554
518
|
*/
|
|
555
519
|
clone() {
|
|
@@ -560,7 +524,6 @@ class Vector3d {
|
|
|
560
524
|
* convert the object to a string representation
|
|
561
525
|
* @name toString
|
|
562
526
|
* @memberof Vector3d
|
|
563
|
-
* @function
|
|
564
527
|
* @returns {string}
|
|
565
528
|
*/
|
|
566
529
|
toString() {
|
package/src/particles/emitter.js
CHANGED
|
@@ -8,7 +8,7 @@ import Container from "./../renderable/container.js";
|
|
|
8
8
|
* @ignore
|
|
9
9
|
*/
|
|
10
10
|
function createDefaultParticleTexture(w = 8, h = 8) {
|
|
11
|
-
var defaultParticleTexture = pool.pull("CanvasTexture", w, h, true);
|
|
11
|
+
var defaultParticleTexture = pool.pull("CanvasTexture", w, h, { offscreenCanvas: true });
|
|
12
12
|
|
|
13
13
|
defaultParticleTexture.context.fillStyle = "#fff";
|
|
14
14
|
defaultParticleTexture.context.fillRect(0, 0, w, h);
|
package/src/physics/body.js
CHANGED
|
@@ -368,7 +368,6 @@ class Body {
|
|
|
368
368
|
|
|
369
369
|
/**
|
|
370
370
|
* returns the AABB bounding box for this body
|
|
371
|
-
* @function
|
|
372
371
|
* @returns {Bounds} bounding box Rectangle object
|
|
373
372
|
*/
|
|
374
373
|
getBounds() {
|
|
@@ -510,6 +509,7 @@ class Body {
|
|
|
510
509
|
|
|
511
510
|
/**
|
|
512
511
|
* Returns true if the any of the shape composing the body contains the given point.
|
|
512
|
+
* @method Body#contains
|
|
513
513
|
* @param {Vector2d} point
|
|
514
514
|
* @returns {boolean} true if contains
|
|
515
515
|
*/
|
package/src/physics/bounds.js
CHANGED
|
@@ -34,7 +34,6 @@ class Bounds {
|
|
|
34
34
|
* reset the bound
|
|
35
35
|
* @name clear
|
|
36
36
|
* @memberof Bounds
|
|
37
|
-
* @function
|
|
38
37
|
*/
|
|
39
38
|
clear() {
|
|
40
39
|
this.setMinMax(Infinity, Infinity, -Infinity, -Infinity);
|
|
@@ -45,7 +44,6 @@ class Bounds {
|
|
|
45
44
|
* sets the bounds to the given min and max value
|
|
46
45
|
* @name setMinMax
|
|
47
46
|
* @memberof Bounds
|
|
48
|
-
* @function
|
|
49
47
|
* @param {number} minX
|
|
50
48
|
* @param {number} minY
|
|
51
49
|
* @param {number} maxX
|
|
@@ -205,7 +203,6 @@ class Bounds {
|
|
|
205
203
|
* Updates bounds using the given vertices
|
|
206
204
|
* @name update
|
|
207
205
|
* @memberof Bounds
|
|
208
|
-
* @function
|
|
209
206
|
* @param {Vector2d[]} vertices an array of me.Vector2d points
|
|
210
207
|
*/
|
|
211
208
|
update(vertices) {
|
|
@@ -216,7 +213,6 @@ class Bounds {
|
|
|
216
213
|
* add the given vertices to the bounds definition.
|
|
217
214
|
* @name add
|
|
218
215
|
* @memberof Bounds
|
|
219
|
-
* @function
|
|
220
216
|
* @param {Vector2d[]} vertices an array of me.Vector2d points
|
|
221
217
|
* @param {boolean} [clear=false] either to reset the bounds before adding the new vertices
|
|
222
218
|
*/
|
|
@@ -237,7 +233,6 @@ class Bounds {
|
|
|
237
233
|
* add the given bounds to the bounds definition.
|
|
238
234
|
* @name addBounds
|
|
239
235
|
* @memberof Bounds
|
|
240
|
-
* @function
|
|
241
236
|
* @param {Bounds} bounds
|
|
242
237
|
* @param {boolean} [clear=false] either to reset the bounds before adding the new vertices
|
|
243
238
|
*/
|
|
@@ -256,7 +251,6 @@ class Bounds {
|
|
|
256
251
|
* add the given point to the bounds definition.
|
|
257
252
|
* @name addPoint
|
|
258
253
|
* @memberof Bounds
|
|
259
|
-
* @function
|
|
260
254
|
* @param {Vector2d} v
|
|
261
255
|
* @param {Matrix2d} [m] an optional transform to apply to the given point
|
|
262
256
|
*/
|
|
@@ -274,7 +268,6 @@ class Bounds {
|
|
|
274
268
|
* add the given quad coordinates to this bound definition, multiplied by the given matrix
|
|
275
269
|
* @name addFrame
|
|
276
270
|
* @memberof Bounds
|
|
277
|
-
* @function
|
|
278
271
|
* @param {number} x0 - left X coordinates of the quad
|
|
279
272
|
* @param {number} y0 - top Y coordinates of the quad
|
|
280
273
|
* @param {number} x1 - right X coordinates of the quad
|
|
@@ -282,7 +275,7 @@ class Bounds {
|
|
|
282
275
|
* @param {Matrix2d} [m] an optional transform to apply to the given frame coordinates
|
|
283
276
|
*/
|
|
284
277
|
addFrame(x0, y0, x1, y1, m) {
|
|
285
|
-
var v =
|
|
278
|
+
var v = pool.pull("Vector2d");
|
|
286
279
|
|
|
287
280
|
// transform all points and add to the bound definition
|
|
288
281
|
this.addPoint(v.set(x0, y0), m);
|
|
@@ -290,14 +283,14 @@ class Bounds {
|
|
|
290
283
|
this.addPoint(v.set(x0, y1), m);
|
|
291
284
|
this.addPoint(v.set(x1, y1), m);
|
|
292
285
|
|
|
293
|
-
|
|
286
|
+
pool.push(v);
|
|
294
287
|
}
|
|
295
288
|
|
|
296
289
|
/**
|
|
297
290
|
* Returns true if the bounds contains the given point.
|
|
298
291
|
* @name contains
|
|
299
292
|
* @memberof Bounds
|
|
300
|
-
* @
|
|
293
|
+
* @method
|
|
301
294
|
* @param {Vector2d} point
|
|
302
295
|
* @returns {boolean} True if the bounds contain the point, otherwise false
|
|
303
296
|
*/
|
|
@@ -305,7 +298,6 @@ class Bounds {
|
|
|
305
298
|
* Returns true if the bounds contains the given point.
|
|
306
299
|
* @name contains
|
|
307
300
|
* @memberof Bounds
|
|
308
|
-
* @function
|
|
309
301
|
* @param {number} x
|
|
310
302
|
* @param {number} y
|
|
311
303
|
* @returns {boolean} True if the bounds contain the point, otherwise false
|
|
@@ -339,7 +331,6 @@ class Bounds {
|
|
|
339
331
|
* Returns true if the two bounds intersect.
|
|
340
332
|
* @name overlaps
|
|
341
333
|
* @memberof Bounds
|
|
342
|
-
* @function
|
|
343
334
|
* @param {Bounds|Rect} bounds
|
|
344
335
|
* @returns {boolean} True if the bounds overlap, otherwise false
|
|
345
336
|
*/
|
|
@@ -352,7 +343,6 @@ class Bounds {
|
|
|
352
343
|
* determines whether all coordinates of this bounds are finite numbers.
|
|
353
344
|
* @name isFinite
|
|
354
345
|
* @memberof Bounds
|
|
355
|
-
* @function
|
|
356
346
|
* @returns {boolean} false if all coordinates are positive or negative Infinity or NaN; otherwise, true.
|
|
357
347
|
*/
|
|
358
348
|
isFinite() {
|
|
@@ -363,14 +353,13 @@ class Bounds {
|
|
|
363
353
|
* Translates the bounds by the given vector.
|
|
364
354
|
* @name translate
|
|
365
355
|
* @memberof Bounds
|
|
366
|
-
* @
|
|
356
|
+
* @method
|
|
367
357
|
* @param {Vector2d} vector
|
|
368
358
|
*/
|
|
369
359
|
/**
|
|
370
360
|
* Translates the bounds by x on the x axis, and y on the y axis
|
|
371
361
|
* @name translate
|
|
372
362
|
* @memberof Bounds
|
|
373
|
-
* @function
|
|
374
363
|
* @param {number} x
|
|
375
364
|
* @param {number} y
|
|
376
365
|
*/
|
|
@@ -395,14 +384,13 @@ class Bounds {
|
|
|
395
384
|
* Shifts the bounds to the given position vector.
|
|
396
385
|
* @name shift
|
|
397
386
|
* @memberof Bounds
|
|
398
|
-
* @
|
|
387
|
+
* @method
|
|
399
388
|
* @param {Vector2d} position
|
|
400
389
|
*/
|
|
401
390
|
/**
|
|
402
391
|
* Shifts the bounds to the given x, y position.
|
|
403
392
|
* @name shift
|
|
404
393
|
* @memberof Bounds
|
|
405
|
-
* @function
|
|
406
394
|
* @param {number} x
|
|
407
395
|
* @param {number} y
|
|
408
396
|
*/
|
|
@@ -432,7 +420,6 @@ class Bounds {
|
|
|
432
420
|
* clone this bounds
|
|
433
421
|
* @name clone
|
|
434
422
|
* @memberof Bounds
|
|
435
|
-
* @function
|
|
436
423
|
* @returns {Bounds}
|
|
437
424
|
*/
|
|
438
425
|
clone() {
|
|
@@ -445,7 +432,6 @@ class Bounds {
|
|
|
445
432
|
* Returns a polygon whose edges are the same as this bounds.
|
|
446
433
|
* @name toPolygon
|
|
447
434
|
* @memberof Bounds
|
|
448
|
-
* @function
|
|
449
435
|
* @returns {Polygon} a new Polygon that represents this bounds.
|
|
450
436
|
*/
|
|
451
437
|
toPolygon () {
|
package/src/physics/collision.js
CHANGED
|
@@ -107,7 +107,6 @@ var collision = {
|
|
|
107
107
|
* @name rayCast
|
|
108
108
|
* @memberof collision
|
|
109
109
|
* @public
|
|
110
|
-
* @function
|
|
111
110
|
* @param {Line} line line to be tested for collision
|
|
112
111
|
* @param {Array.<Renderable>} [result] a user defined array that will be populated with intersecting physic objects.
|
|
113
112
|
* @returns {Array.<Renderable>} an array of intersecting physic objects
|
package/src/physics/detector.js
CHANGED
|
@@ -19,7 +19,6 @@ var dummyObj = {
|
|
|
19
19
|
* @name shouldCollide
|
|
20
20
|
* @memberof collision
|
|
21
21
|
* @ignore
|
|
22
|
-
* @function
|
|
23
22
|
* @param {Renderable} a a reference to the object A.
|
|
24
23
|
* @param {Renderable} b a reference to the object B.
|
|
25
24
|
* @returns {boolean} true if they should collide, false otherwise
|
|
@@ -71,7 +70,6 @@ class ResponseObject {
|
|
|
71
70
|
* @name clear
|
|
72
71
|
* @memberof collision.ResponseObject
|
|
73
72
|
* @public
|
|
74
|
-
* @function
|
|
75
73
|
* @returns {object} this object for chaining
|
|
76
74
|
*/
|
|
77
75
|
clear () {
|
|
@@ -91,7 +89,6 @@ export var globalResponse = new ResponseObject();
|
|
|
91
89
|
* find all the collisions for the specified object
|
|
92
90
|
* @name collisionCheck
|
|
93
91
|
* @ignore
|
|
94
|
-
* @function
|
|
95
92
|
* @param {Renderable} objA object to be tested for collision
|
|
96
93
|
* @param {collision.ResponseObject} [response=collision.response] a user defined response object that will be populated if they intersect.
|
|
97
94
|
* @returns {boolean} in case of collision, false otherwise
|
|
@@ -163,7 +160,6 @@ export function collisionCheck(objA, response = globalResponse) {
|
|
|
163
160
|
* Checks for object colliding with the given line
|
|
164
161
|
* @name rayCast
|
|
165
162
|
* @ignore
|
|
166
|
-
* @function
|
|
167
163
|
* @param {Line} line line to be tested for collision
|
|
168
164
|
* @param {Array.<Renderable>} [result] a user defined array that will be populated with intersecting physic objects.
|
|
169
165
|
* @returns {Array.<Renderable>} an array of intersecting physic objects
|
package/src/physics/quadtree.js
CHANGED
|
@@ -165,7 +165,6 @@ class QuadTree {
|
|
|
165
165
|
* Insert the given object container into the node.
|
|
166
166
|
* @name insertContainer
|
|
167
167
|
* @memberof QuadTree
|
|
168
|
-
* @function
|
|
169
168
|
* @param {Container} container group of objects to be added
|
|
170
169
|
*/
|
|
171
170
|
insertContainer(container) {
|
|
@@ -194,7 +193,6 @@ class QuadTree {
|
|
|
194
193
|
* objects to their corresponding subnodes.
|
|
195
194
|
* @name insert
|
|
196
195
|
* @memberof QuadTree
|
|
197
|
-
* @function
|
|
198
196
|
* @param {object} item object to be added
|
|
199
197
|
*/
|
|
200
198
|
insert(item) {
|
|
@@ -239,7 +237,6 @@ class QuadTree {
|
|
|
239
237
|
* Return all objects that could collide with the given object
|
|
240
238
|
* @name retrieve
|
|
241
239
|
* @memberof QuadTree
|
|
242
|
-
* @function
|
|
243
240
|
* @param {object} item object to be checked against
|
|
244
241
|
* @param {object} [fn] a sorting function for the returned array
|
|
245
242
|
* @returns {object[]} array with all detected objects
|
|
@@ -275,7 +272,6 @@ class QuadTree {
|
|
|
275
272
|
* (this function won't recalculate the impacted node)
|
|
276
273
|
* @name remove
|
|
277
274
|
* @memberof QuadTree
|
|
278
|
-
* @function
|
|
279
275
|
* @param {object} item object to be removed
|
|
280
276
|
* @returns {boolean} true if the item was found and removed.
|
|
281
277
|
*/
|
|
@@ -316,7 +312,6 @@ class QuadTree {
|
|
|
316
312
|
* return true if the node is prunable
|
|
317
313
|
* @name isPrunable
|
|
318
314
|
* @memberof QuadTree
|
|
319
|
-
* @function
|
|
320
315
|
* @returns {boolean} true if the node is prunable
|
|
321
316
|
*/
|
|
322
317
|
isPrunable() {
|
|
@@ -327,7 +322,6 @@ class QuadTree {
|
|
|
327
322
|
* return true if the node has any children
|
|
328
323
|
* @name hasChildren
|
|
329
324
|
* @memberof QuadTree
|
|
330
|
-
* @function
|
|
331
325
|
* @returns {boolean} true if the node has any children
|
|
332
326
|
*/
|
|
333
327
|
hasChildren() {
|
|
@@ -344,7 +338,6 @@ class QuadTree {
|
|
|
344
338
|
* clear the quadtree
|
|
345
339
|
* @name clear
|
|
346
340
|
* @memberof QuadTree
|
|
347
|
-
* @function
|
|
348
341
|
* @param {Bounds} [bounds=this.bounds] the bounds to be cleared
|
|
349
342
|
*/
|
|
350
343
|
clear(bounds) {
|
package/src/physics/sat.js
CHANGED
|
@@ -9,19 +9,19 @@ import Vector2d from "./../math/vector2.js";
|
|
|
9
9
|
* Constants for Vornoi regions
|
|
10
10
|
* @ignore
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
const LEFT_VORNOI_REGION = -1;
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Constants for Vornoi regions
|
|
16
16
|
* @ignore
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
const MIDDLE_VORNOI_REGION = 0;
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Constants for Vornoi regions
|
|
22
22
|
* @ignore
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
const RIGHT_VORNOI_REGION = 1;
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
/**
|
package/src/physics/world.js
CHANGED
|
@@ -96,7 +96,6 @@ class World extends Container {
|
|
|
96
96
|
* reset the game world
|
|
97
97
|
* @name reset
|
|
98
98
|
* @memberof World
|
|
99
|
-
* @function
|
|
100
99
|
*/
|
|
101
100
|
reset() {
|
|
102
101
|
// clear the quadtree
|
|
@@ -118,7 +117,6 @@ class World extends Container {
|
|
|
118
117
|
* @name addBody
|
|
119
118
|
* @memberof World
|
|
120
119
|
* @see Container.addChild
|
|
121
|
-
* @function
|
|
122
120
|
* @param {Body} body
|
|
123
121
|
* @returns {World} this game world
|
|
124
122
|
*/
|
|
@@ -133,7 +131,6 @@ class World extends Container {
|
|
|
133
131
|
* @name removeBody
|
|
134
132
|
* @memberof World
|
|
135
133
|
* @see Container.removeChild
|
|
136
|
-
* @function
|
|
137
134
|
* @param {Body} body
|
|
138
135
|
* @returns {World} this game world
|
|
139
136
|
*/
|
|
@@ -147,7 +144,6 @@ class World extends Container {
|
|
|
147
144
|
* update the game world
|
|
148
145
|
* @name reset
|
|
149
146
|
* @memberof World
|
|
150
|
-
* @function
|
|
151
147
|
* @param {number} dt the time passed since the last frame update
|
|
152
148
|
* @returns {boolean} true if the word is dirty
|
|
153
149
|
*/
|
package/src/plugin/plugin.js
CHANGED
|
@@ -44,7 +44,6 @@ export var plugin = {
|
|
|
44
44
|
* @name patch
|
|
45
45
|
* @memberof plugin
|
|
46
46
|
* @public
|
|
47
|
-
* @function
|
|
48
47
|
* @param {object} proto target object
|
|
49
48
|
* @param {string} name target function
|
|
50
49
|
* @param {Function} fn replacement function
|
|
@@ -90,7 +89,6 @@ export var plugin = {
|
|
|
90
89
|
* @memberof plugin
|
|
91
90
|
* @see Base
|
|
92
91
|
* @public
|
|
93
|
-
* @function
|
|
94
92
|
* @param {plugin.Base} pluginObj Plugin object to instantiate and register
|
|
95
93
|
* @param {string} name
|
|
96
94
|
* @param {object} [...arguments] all extra parameters will be passed to the plugin constructor
|
|
@@ -218,8 +218,10 @@
|
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
if (
|
|
222
|
-
|
|
221
|
+
if (globalThis.CanvasRenderingContext2D) {
|
|
222
|
+
if (typeof globalThis.Path2D.prototype.roundRect === "undefined") {
|
|
223
|
+
globalThis.Path2D.prototype.roundRect = roundRect;
|
|
224
|
+
}
|
|
223
225
|
}
|
|
224
226
|
if (globalThis.CanvasRenderingContext2D) {
|
|
225
227
|
if (typeof globalThis.CanvasRenderingContext2D.prototype.roundRect === "undefined") {
|