melonjs 10.9.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.
Files changed (96) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +32 -25
  3. package/dist/melonjs.js +1635 -2383
  4. package/dist/melonjs.min.js +4 -4
  5. package/dist/melonjs.module.d.ts +929 -1504
  6. package/dist/melonjs.module.js +1581 -2344
  7. package/package.json +18 -18
  8. package/src/audio/audio.js +0 -1
  9. package/src/camera/camera2d.js +1 -16
  10. package/src/entity/entity.js +6 -11
  11. package/src/game.js +2 -2
  12. package/src/geometries/ellipse.js +19 -28
  13. package/src/geometries/line.js +5 -8
  14. package/src/geometries/path2d.js +14 -24
  15. package/src/geometries/poly.js +29 -47
  16. package/src/geometries/rectangle.js +25 -37
  17. package/src/geometries/roundrect.js +8 -12
  18. package/src/index.js +7 -2
  19. package/src/input/gamepad.js +3 -14
  20. package/src/input/keyboard.js +1 -9
  21. package/src/input/pointer.js +0 -1
  22. package/src/input/pointerevent.js +14 -23
  23. package/src/lang/deprecated.js +9 -6
  24. package/src/level/level.js +0 -9
  25. package/src/level/tiled/TMXGroup.js +0 -4
  26. package/src/level/tiled/TMXLayer.js +0 -8
  27. package/src/level/tiled/TMXObject.js +0 -3
  28. package/src/level/tiled/TMXTile.js +4 -5
  29. package/src/level/tiled/TMXTileMap.js +1 -7
  30. package/src/level/tiled/TMXTileset.js +0 -5
  31. package/src/level/tiled/TMXTilesetGroup.js +1 -4
  32. package/src/level/tiled/TMXUtils.js +1 -4
  33. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +2 -3
  34. package/src/level/tiled/renderer/TMXIsometricRenderer.js +0 -1
  35. package/src/level/tiled/renderer/TMXRenderer.js +1 -7
  36. package/src/loader/loader.js +0 -11
  37. package/src/loader/loadingscreen.js +16 -5
  38. package/src/math/color.js +10 -30
  39. package/src/math/math.js +0 -10
  40. package/src/math/matrix2.js +12 -27
  41. package/src/math/matrix3.js +1 -22
  42. package/src/math/observable_vector2.js +0 -29
  43. package/src/math/observable_vector3.js +0 -29
  44. package/src/math/vector2.js +3 -40
  45. package/src/math/vector3.js +4 -41
  46. package/src/particles/emitter.js +11 -12
  47. package/src/physics/body.js +4 -5
  48. package/src/physics/bounds.js +5 -19
  49. package/src/physics/collision.js +1 -13
  50. package/src/physics/detector.js +6 -56
  51. package/src/physics/quadtree.js +0 -7
  52. package/src/physics/response.js +48 -0
  53. package/src/physics/sat.js +4 -4
  54. package/src/physics/world.js +0 -4
  55. package/src/plugin/plugin.js +0 -2
  56. package/src/polyfill/roundrect.js +4 -2
  57. package/src/renderable/GUI.js +11 -14
  58. package/src/renderable/collectable.js +1 -0
  59. package/src/renderable/colorlayer.js +9 -7
  60. package/src/renderable/container.js +38 -64
  61. package/src/renderable/dragndrop.js +1 -10
  62. package/src/renderable/imagelayer.js +8 -12
  63. package/src/renderable/light2d.js +118 -0
  64. package/src/renderable/renderable.js +27 -48
  65. package/src/renderable/sprite.js +17 -29
  66. package/src/renderable/trigger.js +10 -3
  67. package/src/state/stage.js +72 -6
  68. package/src/state/state.js +22 -23
  69. package/src/system/device.js +14 -53
  70. package/src/system/event.js +11 -0
  71. package/src/system/pooling.js +20 -9
  72. package/src/system/save.js +9 -11
  73. package/src/system/timer.js +239 -218
  74. package/src/text/bitmaptextdata.js +1 -4
  75. package/src/text/glyph.js +2 -2
  76. package/src/text/text.js +25 -24
  77. package/src/text/textmetrics.js +0 -2
  78. package/src/tweens/easing.js +1 -1
  79. package/src/tweens/interpolation.js +2 -2
  80. package/src/tweens/tween.js +1 -13
  81. package/src/utils/agent.js +1 -3
  82. package/src/utils/array.js +0 -3
  83. package/src/utils/file.js +0 -2
  84. package/src/utils/function.js +0 -2
  85. package/src/utils/string.js +0 -6
  86. package/src/utils/utils.js +0 -3
  87. package/src/video/canvas/canvas_renderer.js +73 -90
  88. package/src/video/renderer.js +34 -49
  89. package/src/video/{texture.js → texture/atlas.js} +10 -8
  90. package/src/video/{texture_cache.js → texture/cache.js} +4 -5
  91. package/src/video/texture/canvas_texture.js +99 -0
  92. package/src/video/video.js +3 -3
  93. package/src/video/webgl/glshader.js +0 -5
  94. package/src/video/webgl/utils/uniforms.js +3 -6
  95. package/src/video/webgl/webgl_compositor.js +0 -14
  96. package/src/video/webgl/webgl_renderer.js +73 -97
@@ -9,11 +9,10 @@ import pool from "./../system/pooling.js";
9
9
  * A polygon is convex when all line segments connecting two points in the interior do not cross any edge of the polygon
10
10
  * (which means that all angles are less than 180 degrees), as described here below : <br>
11
11
  * <center><img src="images/convex_polygon.png"/></center><br>
12
- * A polygon's `winding` is clockwise iff its vertices (points) are declared turning to the right. The image above shows COUNTERCLOCKWISE winding.
12
+ *
13
+ * A polygon's `winding` is clockwise if its vertices (points) are declared turning to the right. The image above shows COUNTERCLOCKWISE winding.
13
14
  */
14
-
15
15
  class Polygon {
16
-
17
16
  /**
18
17
  * @param {number} x origin point of the Polygon
19
18
  * @param {number} y origin point of the Polygon
@@ -25,16 +24,16 @@ class Polygon {
25
24
  * @public
26
25
  * @type {Vector2d}
27
26
  * @name pos
28
- * @memberof Polygon.prototype
27
+ * @memberof Polygon
29
28
  */
30
29
  this.pos = pool.pull("Vector2d");
31
30
 
32
31
  /**
33
32
  * The bounding rectangle for this shape
34
33
  * @ignore
35
- * @type {Bounds}
34
+ * @member {Bounds}
36
35
  * @name _bounds
37
- * @memberof Polygon.prototype
36
+ * @memberof Polygon
38
37
  */
39
38
  this._bounds;
40
39
 
@@ -44,7 +43,7 @@ class Polygon {
44
43
  * @public
45
44
  * @type {Vector2d[]}
46
45
  * @name points
47
- * @memberof Polygon.prototype
46
+ * @memberof Polygon
48
47
  */
49
48
  this.points = [];
50
49
 
@@ -83,8 +82,7 @@ class Polygon {
83
82
  /**
84
83
  * set new value to the Polygon
85
84
  * @name setShape
86
- * @memberof Polygon.prototype
87
- * @function
85
+ * @memberof Polygon
88
86
  * @param {number} x position of the Polygon
89
87
  * @param {number} y position of the Polygon
90
88
  * @param {Vector2d[]|number[]} points array of vector or vertice defining the Polygon
@@ -99,8 +97,7 @@ class Polygon {
99
97
  /**
100
98
  * set the vertices defining this Polygon
101
99
  * @name setVertices
102
- * @memberof Polygon.prototype
103
- * @function
100
+ * @memberof Polygon
104
101
  * @param {Vector2d[]} vertices array of vector or vertice defining the Polygon
105
102
  * @returns {Polygon} this instance for objecf chaining
106
103
  */
@@ -139,8 +136,7 @@ class Polygon {
139
136
  /**
140
137
  * apply the given transformation matrix to this Polygon
141
138
  * @name transform
142
- * @memberof Polygon.prototype
143
- * @function
139
+ * @memberof Polygon
144
140
  * @param {Matrix2d} m the transformation matrix
145
141
  * @returns {Polygon} Reference to this object for method chaining
146
142
  */
@@ -158,8 +154,7 @@ class Polygon {
158
154
  /**
159
155
  * apply an isometric projection to this shape
160
156
  * @name toIso
161
- * @memberof Polygon.prototype
162
- * @function
157
+ * @memberof Polygon
163
158
  * @returns {Polygon} Reference to this object for method chaining
164
159
  */
165
160
  toIso() {
@@ -169,8 +164,7 @@ class Polygon {
169
164
  /**
170
165
  * apply a 2d projection to this shape
171
166
  * @name to2d
172
- * @memberof Polygon.prototype
173
- * @function
167
+ * @memberof Polygon
174
168
  * @returns {Polygon} Reference to this object for method chaining
175
169
  */
176
170
  to2d() {
@@ -180,8 +174,7 @@ class Polygon {
180
174
  /**
181
175
  * Rotate this Polygon (counter-clockwise) by the specified angle (in radians).
182
176
  * @name rotate
183
- * @memberof Polygon.prototype
184
- * @function
177
+ * @memberof Polygon
185
178
  * @param {number} angle The angle to rotate (in radians)
186
179
  * @param {Vector2d|ObservableVector2d} [v] an optional point to rotate around
187
180
  * @returns {Polygon} Reference to this object for method chaining
@@ -202,8 +195,7 @@ class Polygon {
202
195
  /**
203
196
  * Scale this Polygon by the given scalar.
204
197
  * @name scale
205
- * @memberof Polygon.prototype
206
- * @function
198
+ * @memberof Polygon
207
199
  * @param {number} x
208
200
  * @param {number} [y=x]
209
201
  * @returns {Polygon} Reference to this object for method chaining
@@ -224,8 +216,7 @@ class Polygon {
224
216
  /**
225
217
  * Scale this Polygon by the given vector
226
218
  * @name scaleV
227
- * @memberof Polygon.prototype
228
- * @function
219
+ * @memberof Polygon
229
220
  * @param {Vector2d} v
230
221
  * @returns {Polygon} Reference to this object for method chaining
231
222
  */
@@ -237,8 +228,7 @@ class Polygon {
237
228
  * Computes the calculated collision polygon.
238
229
  * This **must** be called if the `points` array, `angle`, or `offset` is modified manually.
239
230
  * @name recalc
240
- * @memberof Polygon.prototype
241
- * @function
231
+ * @memberof Polygon
242
232
  * @returns {Polygon} Reference to this object for method chaining
243
233
  */
244
234
  recalc() {
@@ -281,8 +271,7 @@ class Polygon {
281
271
  /**
282
272
  * returns a list of indices for all triangles defined in this polygon
283
273
  * @name getIndices
284
- * @memberof Polygon.prototype
285
- * @function
274
+ * @memberof Polygon
286
275
  * @returns {Array} an array of vertex indices for all triangles forming this polygon.
287
276
  */
288
277
  getIndices() {
@@ -295,8 +284,7 @@ class Polygon {
295
284
  /**
296
285
  * Returns true if the vertices composing this polygon form a convex shape (vertices must be in clockwise order).
297
286
  * @name isConvex
298
- * @memberof Polygon.prototype
299
- * @function
287
+ * @memberof Polygon
300
288
  * @returns {boolean} true if the vertices are convex, false if not, null if not computable
301
289
  */
302
290
  isConvex() {
@@ -342,8 +330,8 @@ class Polygon {
342
330
  /**
343
331
  * translate the Polygon by the specified offset
344
332
  * @name translate
345
- * @memberof Polygon.prototype
346
- * @function
333
+ * @memberof Polygon
334
+ * @method
347
335
  * @param {number} x x offset
348
336
  * @param {number} y y offset
349
337
  * @returns {Polygon} this Polygon
@@ -351,8 +339,7 @@ class Polygon {
351
339
  /**
352
340
  * translate the Polygon by the specified vector
353
341
  * @name translate
354
- * @memberof Polygon.prototype
355
- * @function
342
+ * @memberof Polygon
356
343
  * @param {Vector2d} v vector offset
357
344
  * @returns {Polygon} Reference to this object for method chaining
358
345
  */
@@ -379,15 +366,14 @@ class Polygon {
379
366
  /**
380
367
  * Shifts the Polygon to the given position vector.
381
368
  * @name shift
382
- * @memberof Polygon.prototype
383
- * @function
369
+ * @memberof Polygon
370
+ * @method
384
371
  * @param {Vector2d} position
385
372
  */
386
373
  /**
387
374
  * Shifts the Polygon to the given x, y position.
388
375
  * @name shift
389
- * @memberof Polygon.prototype
390
- * @function
376
+ * @memberof Polygon
391
377
  * @param {number} x
392
378
  * @param {number} y
393
379
  */
@@ -412,8 +398,8 @@ class Polygon {
412
398
  * (Note: it is highly recommended to first do a hit test on the corresponding <br>
413
399
  * bounding rect, as the function can be highly consuming with complex shapes)
414
400
  * @name contains
415
- * @memberof Polygon.prototype
416
- * @function
401
+ * @memberof Polygon
402
+ * @method
417
403
  * @param {Vector2d} point
418
404
  * @returns {boolean} true if contains
419
405
  */
@@ -423,8 +409,7 @@ class Polygon {
423
409
  * (Note: it is highly recommended to first do a hit test on the corresponding <br>
424
410
  * bounding rect, as the function can be highly consuming with complex shapes)
425
411
  * @name contains
426
- * @memberof Polygon.prototype
427
- * @function
412
+ * @memberof Polygon
428
413
  * @param {number} x x coordinate
429
414
  * @param {number} y y coordinate
430
415
  * @returns {boolean} true if contains
@@ -461,8 +446,7 @@ class Polygon {
461
446
  /**
462
447
  * returns the bounding box for this shape, the smallest Rectangle object completely containing this shape.
463
448
  * @name getBounds
464
- * @memberof Polygon.prototype
465
- * @function
449
+ * @memberof Polygon
466
450
  * @returns {Bounds} this shape bounding box Rectangle object
467
451
  */
468
452
  getBounds() {
@@ -476,8 +460,7 @@ class Polygon {
476
460
  * update the bounding box for this shape.
477
461
  * @ignore
478
462
  * @name updateBounds
479
- * @memberof Polygon.prototype
480
- * @function
463
+ * @memberof Polygon
481
464
  * @returns {Bounds} this shape bounding box Rectangle object
482
465
  */
483
466
  updateBounds() {
@@ -492,8 +475,7 @@ class Polygon {
492
475
  /**
493
476
  * clone this Polygon
494
477
  * @name clone
495
- * @memberof Polygon.prototype
496
- * @function
478
+ * @memberof Polygon
497
479
  * @returns {Polygon} new Polygon
498
480
  */
499
481
  clone() {
@@ -32,8 +32,7 @@ class Rect extends Polygon {
32
32
  /**
33
33
  * set new value to the rectangle shape
34
34
  * @name setShape
35
- * @memberof Rect.prototype
36
- * @function
35
+ * @memberof Rect
37
36
  * @param {number} x position of the Rectangle
38
37
  * @param {number} y position of the Rectangle
39
38
  * @param {number|Vector2d[]} w width of the rectangle, or an array of vector defining the rectangle
@@ -63,7 +62,7 @@ class Rect extends Polygon {
63
62
  * @public
64
63
  * @type {number}
65
64
  * @name left
66
- * @memberof Rect.prototype
65
+ * @memberof Rect
67
66
  */
68
67
  get left() {
69
68
  return this.pos.x;
@@ -74,7 +73,7 @@ class Rect extends Polygon {
74
73
  * @public
75
74
  * @type {number}
76
75
  * @name right
77
- * @memberof Rect.prototype
76
+ * @memberof Rect
78
77
  */
79
78
  get right() {
80
79
  var w = this.width;
@@ -86,7 +85,7 @@ class Rect extends Polygon {
86
85
  * @public
87
86
  * @type {number}
88
87
  * @name top
89
- * @memberof Rect.prototype
88
+ * @memberof Rect
90
89
  */
91
90
  get top() {
92
91
  return this.pos.y;
@@ -97,7 +96,7 @@ class Rect extends Polygon {
97
96
  * @public
98
97
  * @type {number}
99
98
  * @name bottom
100
- * @memberof Rect.prototype
99
+ * @memberof Rect
101
100
  */
102
101
  get bottom() {
103
102
  var h = this.height;
@@ -109,7 +108,7 @@ class Rect extends Polygon {
109
108
  * @public
110
109
  * @type {number}
111
110
  * @name width
112
- * @memberof Rect.prototype
111
+ * @memberof Rect
113
112
  */
114
113
  get width() {
115
114
  return this.points[2].x;
@@ -125,7 +124,7 @@ class Rect extends Polygon {
125
124
  * @public
126
125
  * @type {number}
127
126
  * @name height
128
- * @memberof Rect.prototype
127
+ * @memberof Rect
129
128
  */
130
129
  get height() {
131
130
  return this.points[2].y;
@@ -141,7 +140,7 @@ class Rect extends Polygon {
141
140
  * @public
142
141
  * @type {number}
143
142
  * @name centerX
144
- * @memberof Rect.prototype
143
+ * @memberof Rect
145
144
  */
146
145
  get centerX() {
147
146
  if (isFinite(this.width)) {
@@ -159,7 +158,7 @@ class Rect extends Polygon {
159
158
  * @public
160
159
  * @type {number}
161
160
  * @name centerY
162
- * @memberof Rect.prototype
161
+ * @memberof Rect
163
162
  */
164
163
  get centerY() {
165
164
  if (isFinite(this.height)) {
@@ -175,10 +174,9 @@ class Rect extends Polygon {
175
174
  /**
176
175
  * center the rectangle position around the given coordinates
177
176
  * @name centerOn
178
- * @memberof Rect.prototype
179
- * @function
177
+ * @memberof Rect
180
178
  * @param {number} x the x coordinate around which to center this rectangle
181
- * @param {number} x the y coordinate around which to center this rectangle
179
+ * @param {number} y the y coordinate around which to center this rectangle
182
180
  * @returns {Rect} this rectangle
183
181
  */
184
182
  centerOn(x, y) {
@@ -190,8 +188,7 @@ class Rect extends Polygon {
190
188
  /**
191
189
  * resize the rectangle
192
190
  * @name resize
193
- * @memberof Rect.prototype
194
- * @function
191
+ * @memberof Rect
195
192
  * @param {number} w new width of the rectangle
196
193
  * @param {number} h new height of the rectangle
197
194
  * @returns {Rect} this rectangle
@@ -205,8 +202,7 @@ class Rect extends Polygon {
205
202
  /**
206
203
  * scale the rectangle
207
204
  * @name scale
208
- * @memberof Rect.prototype
209
- * @function
205
+ * @memberof Rect
210
206
  * @param {number} x a number representing the abscissa of the scaling vector.
211
207
  * @param {number} [y=x] a number representing the ordinate of the scaling vector.
212
208
  * @returns {Rect} this rectangle
@@ -220,8 +216,7 @@ class Rect extends Polygon {
220
216
  /**
221
217
  * clone this rectangle
222
218
  * @name clone
223
- * @memberof Rect.prototype
224
- * @function
219
+ * @memberof Rect
225
220
  * @returns {Rect} new rectangle
226
221
  */
227
222
  clone() {
@@ -231,8 +226,7 @@ class Rect extends Polygon {
231
226
  /**
232
227
  * copy the position and size of the given rectangle into this one
233
228
  * @name copy
234
- * @memberof Rect.prototype
235
- * @function
229
+ * @memberof Rect
236
230
  * @param {Rect} rect Source rectangle
237
231
  * @returns {Rect} new rectangle
238
232
  */
@@ -243,8 +237,7 @@ class Rect extends Polygon {
243
237
  /**
244
238
  * merge this rectangle with another one
245
239
  * @name union
246
- * @memberof Rect.prototype
247
- * @function
240
+ * @memberof Rect
248
241
  * @param {Rect} rect other rectangle to union with
249
242
  * @returns {Rect} the union(ed) rectangle
250
243
  */
@@ -265,8 +258,7 @@ class Rect extends Polygon {
265
258
  /**
266
259
  * check if this rectangle is intersecting with the specified one
267
260
  * @name overlaps
268
- * @memberof Rect.prototype
269
- * @function
261
+ * @memberof Rect
270
262
  * @param {Rect} rect
271
263
  * @returns {boolean} true if overlaps
272
264
  */
@@ -282,8 +274,8 @@ class Rect extends Polygon {
282
274
  /**
283
275
  * Returns true if the rectangle contains the given rectangle
284
276
  * @name contains
285
- * @memberof Rect.prototype
286
- * @function
277
+ * @memberof Rect
278
+ * @method
287
279
  * @param {Rect} rect
288
280
  * @returns {boolean} true if contains
289
281
  */
@@ -291,8 +283,8 @@ class Rect extends Polygon {
291
283
  /**
292
284
  * Returns true if the rectangle contains the given point
293
285
  * @name contains
294
- * @memberof Rect.prototype
295
- * @function
286
+ * @memberof Rect
287
+ * @method
296
288
  * @param {number} x x coordinate
297
289
  * @param {number} y y coordinate
298
290
  * @returns {boolean} true if contains
@@ -301,8 +293,7 @@ class Rect extends Polygon {
301
293
  /**
302
294
  * Returns true if the rectangle contains the given point
303
295
  * @name contains
304
- * @memberof Rect.prototype
305
- * @function
296
+ * @memberof Rect
306
297
  * @param {Vector2d} point
307
298
  * @returns {boolean} true if contains
308
299
  */
@@ -337,8 +328,7 @@ class Rect extends Polygon {
337
328
  /**
338
329
  * check if this rectangle is identical to the specified one
339
330
  * @name equals
340
- * @memberof Rect.prototype
341
- * @function
331
+ * @memberof Rect
342
332
  * @param {Rect} rect
343
333
  * @returns {boolean} true if equals
344
334
  */
@@ -354,8 +344,7 @@ class Rect extends Polygon {
354
344
  /**
355
345
  * determines whether all coordinates of this rectangle are finite numbers.
356
346
  * @name isFinite
357
- * @memberof Rect.prototype
358
- * @function
347
+ * @memberof Rect
359
348
  * @returns {boolean} false if all coordinates are positive or negative Infinity or NaN; otherwise, true.
360
349
  */
361
350
  isFinite() {
@@ -365,8 +354,7 @@ class Rect extends Polygon {
365
354
  /**
366
355
  * Returns a polygon whose edges are the same as this box.
367
356
  * @name toPolygon
368
- * @memberof Rect.prototype
369
- * @function
357
+ * @memberof Rect
370
358
  * @returns {Polygon} a new Polygon that represents this rectangle.
371
359
  */
372
360
  toPolygon() {
@@ -36,7 +36,7 @@ class RoundRect extends Rect {
36
36
  * @type {number}
37
37
  * @default 20
38
38
  * @name radius
39
- * @memberof RoundRect.prototype
39
+ * @memberof RoundRect
40
40
  */
41
41
  get radius() {
42
42
  return this._radius;
@@ -55,8 +55,7 @@ class RoundRect extends Rect {
55
55
  /**
56
56
  * copy the position, size and radius of the given rounded rectangle into this one
57
57
  * @name copy
58
- * @memberof RoundRect.prototype
59
- * @function
58
+ * @memberof RoundRect
60
59
  * @param {RoundRect} rrect source rounded rectangle
61
60
  * @returns {RoundRect} new rectangle
62
61
  */
@@ -69,8 +68,8 @@ class RoundRect extends Rect {
69
68
  /**
70
69
  * Returns true if the rounded rectangle contains the given point
71
70
  * @name contains
72
- * @memberof RoundRect.prototype
73
- * @function
71
+ * @memberof RoundRect
72
+ * @method
74
73
  * @param {number} x x coordinate
75
74
  * @param {number} y y coordinate
76
75
  * @returns {boolean} true if contains
@@ -79,8 +78,7 @@ class RoundRect extends Rect {
79
78
  /**
80
79
  * Returns true if the rounded rectangle contains the given point
81
80
  * @name contains
82
- * @memberof RoundRect.prototype
83
- * @function
81
+ * @memberof RoundRect
84
82
  * @param {Vector2d} point
85
83
  * @returns {boolean} true if contains
86
84
  */
@@ -140,8 +138,7 @@ class RoundRect extends Rect {
140
138
  /**
141
139
  * check if this RoundRect is identical to the specified one
142
140
  * @name equals
143
- * @memberof RoundRect.prototype
144
- * @function
141
+ * @memberof RoundRect
145
142
  * @param {RoundRect} rrect
146
143
  * @returns {boolean} true if equals
147
144
  */
@@ -152,12 +149,11 @@ class RoundRect extends Rect {
152
149
  /**
153
150
  * clone this RoundRect
154
151
  * @name clone
155
- * @memberof RoundRect.prototype
156
- * @function
152
+ * @memberof RoundRect
157
153
  * @returns {RoundRect} new RoundRect
158
154
  */
159
155
  clone() {
160
- return new RoundRect(this.pos.x, this.pos.y, this.width, this.height, radius);
156
+ return new RoundRect(this.pos.x, this.pos.y, this.width, this.height, this.radius);
161
157
  }
162
158
  };
163
159
 
package/src/index.js CHANGED
@@ -41,7 +41,8 @@ import WebGLCompositor from "./video/webgl/webgl_compositor.js";
41
41
  import Renderer from "./video/renderer.js";
42
42
  import WebGLRenderer from "./video/webgl/webgl_renderer.js";
43
43
  import CanvasRenderer from "./video/canvas/canvas_renderer.js";
44
- import { TextureAtlas } from "./video/texture.js";
44
+ import CanvasTexture from "./video/texture/canvas_texture.js";
45
+ import { TextureAtlas } from "./video/texture/atlas.js";
45
46
  import Renderable from "./renderable/renderable.js";
46
47
  import Text from "./text/text.js";
47
48
  import BitmapText from "./text/bitmaptext.js";
@@ -53,6 +54,7 @@ import NineSliceSprite from "./renderable/nineslicesprite.js";
53
54
  import GUI_Object from "./renderable/GUI.js";
54
55
  import Collectable from "./renderable/collectable.js";
55
56
  import Trigger from "./renderable/trigger.js";
57
+ import Light2d from "./renderable/light2d.js";
56
58
  import { Draggable, DropTarget } from "./renderable/dragndrop.js";
57
59
  import TMXRenderer from "./level/tiled/renderer/TMXRenderer.js";
58
60
  import TMXOrthogonalRenderer from "./level/tiled/renderer/TMXOrthogonalRenderer.js";
@@ -140,6 +142,7 @@ export {
140
142
  GUI_Object,
141
143
  Collectable,
142
144
  Trigger,
145
+ Light2d,
143
146
  Draggable,
144
147
  DropTarget,
145
148
  TMXRenderer,
@@ -190,7 +193,6 @@ export var skipAutoInit = false;
190
193
  * @name boot
191
194
  * @see skipAutoInit
192
195
  * @public
193
- * @function
194
196
  */
195
197
  export function boot() {
196
198
  // don't do anything if already initialized (should not happen anyway)
@@ -202,6 +204,7 @@ export function boot() {
202
204
  pool.register("me.Entity", Entity);
203
205
  pool.register("me.Collectable", Collectable);
204
206
  pool.register("me.Trigger", Trigger);
207
+ pool.register("me.Light2d", Light2d);
205
208
  pool.register("me.Tween", Tween, true);
206
209
  pool.register("me.Color", Color, true);
207
210
  pool.register("me.Particle", Particle, true);
@@ -230,6 +233,7 @@ export function boot() {
230
233
  pool.register("Entity", Entity);
231
234
  pool.register("Collectable", Collectable);
232
235
  pool.register("Trigger", Trigger);
236
+ pool.register("Light2d", Light2d);
233
237
  pool.register("Tween", Tween, true);
234
238
  pool.register("Color", Color, true);
235
239
  pool.register("Particle", Particle, true);
@@ -253,6 +257,7 @@ export function boot() {
253
257
  pool.register("Line", Line, true);
254
258
  pool.register("Ellipse", Ellipse, true);
255
259
  pool.register("Bounds", Bounds, true);
260
+ pool.register("CanvasTexture", CanvasTexture, true);
256
261
 
257
262
  // publish Boot notification
258
263
  event.emit(event.BOOT);
@@ -86,10 +86,7 @@ var remap = new Map();
86
86
 
87
87
  var updateEventHandler;
88
88
 
89
- /**
90
- * Default gamepad mappings
91
- * @ignore
92
- */
89
+ // Default gamepad mappings
93
90
  [
94
91
  // Firefox mappings
95
92
  [
@@ -261,18 +258,14 @@ var updateGamepads = function () {
261
258
  });
262
259
  };
263
260
 
264
- /**
265
- * gamepad connected callback
266
- * @ignore
267
- */
261
+ // gamepad connected callback
268
262
  if (globalThis.navigator && typeof globalThis.navigator.getGamepads === "function") {
269
263
  globalThis.addEventListener("gamepadconnected", function (e) {
270
264
  event.emit(event.GAMEPAD_CONNECTED, e.gamepad);
271
265
  }, false);
272
266
 
273
- /**
267
+ /*
274
268
  * gamepad disconnected callback
275
- * @ignore
276
269
  */
277
270
  globalThis.addEventListener("gamepaddisconnected", function (e) {
278
271
  event.emit(event.GAMEPAD_DISCONNECTED, e.gamepad);
@@ -362,7 +355,6 @@ export var GAMEPAD = {
362
355
  * @name bindGamepad
363
356
  * @memberof input
364
357
  * @public
365
- * @function
366
358
  * @param {number} index Gamepad index
367
359
  * @param {object} button Button/Axis definition
368
360
  * @param {string} button.type "buttons" or "axes"
@@ -437,7 +429,6 @@ export function bindGamepad(index, button, keyCode) {
437
429
  * @name unbindGamepad
438
430
  * @memberof input
439
431
  * @public
440
- * @function
441
432
  * @param {number} index Gamepad index
442
433
  * @param {number} button (See {@link input.GAMEPAD.BUTTONS})
443
434
  * @example
@@ -456,7 +447,6 @@ export function unbindGamepad(index, button) {
456
447
  * @name setGamepadDeadzone
457
448
  * @memberof input
458
449
  * @public
459
- * @function
460
450
  * @param {number} value Deadzone value
461
451
  */
462
452
  export function setGamepadDeadzone(value) {
@@ -470,7 +460,6 @@ export function setGamepadDeadzone(value) {
470
460
  * @name setGamepadMapping
471
461
  * @memberof input
472
462
  * @public
473
- * @function
474
463
  * @param {string} id Gamepad id string
475
464
  * @param {object} mapping A hash table
476
465
  * @param {number[]} mapping.axes Standard analog control stick axis locations
@@ -111,8 +111,7 @@ var keyUpEvent = function (e, keyCode, mouseButton) {
111
111
  * @namespace KEY
112
112
  * @memberof input
113
113
  */
114
- export var KEY = {
115
- /** @memberof input.KEY */
114
+ export const KEY = {
116
115
  "BACKSPACE" : 8,
117
116
  /** @memberof input.KEY */
118
117
  "TAB" : 9,
@@ -332,7 +331,6 @@ export function initKeyboardEvent() {
332
331
  * @name isKeyPressed
333
332
  * @memberof input
334
333
  * @public
335
- * @function
336
334
  * @param {string} action user defined corresponding action
337
335
  * @returns {boolean} true if pressed
338
336
  * @example
@@ -358,7 +356,6 @@ export function isKeyPressed(action) {
358
356
  * @name keyStatus
359
357
  * @memberof input
360
358
  * @public
361
- * @function
362
359
  * @param {string} action user defined corresponding action
363
360
  * @returns {boolean} down (true) or up(false)
364
361
  */
@@ -372,7 +369,6 @@ export function keyStatus(action) {
372
369
  * @name triggerKeyEvent
373
370
  * @memberof input
374
371
  * @public
375
- * @function
376
372
  * @param {number} keycode (See {@link input.KEY})
377
373
  * @param {boolean} [status=false] true to trigger a key down event, or false for key up event
378
374
  * @param {number} [mouseButton] the mouse button to trigger
@@ -395,7 +391,6 @@ export function triggerKeyEvent(keycode, status, mouseButton) {
395
391
  * @name bindKey
396
392
  * @memberof input
397
393
  * @public
398
- * @function
399
394
  * @param {number} keycode (See {@link input.KEY})
400
395
  * @param {string} action user defined corresponding action
401
396
  * @param {boolean} [lock=false] cancel the keypress event once read
@@ -422,7 +417,6 @@ export function bindKey(keycode, action, lock, preventDefault = preventDefaultAc
422
417
  * @name getBindingKey
423
418
  * @memberof input
424
419
  * @public
425
- * @function
426
420
  * @param {number} keycode (See {@link input.KEY})
427
421
  * @returns {string} user defined associated action
428
422
  */
@@ -435,7 +429,6 @@ export function getBindingKey(keycode) {
435
429
  * @name unlockKey
436
430
  * @memberof input
437
431
  * @public
438
- * @function
439
432
  * @param {string} action user defined corresponding action
440
433
  * @example
441
434
  * // Unlock jump when touching the ground
@@ -452,7 +445,6 @@ export function unlockKey(action) {
452
445
  * @name unbindKey
453
446
  * @memberof input
454
447
  * @public
455
- * @function
456
448
  * @param {number} keycode (See {@link input.KEY})
457
449
  * @example
458
450
  * me.input.unbindKey(me.input.KEY.LEFT);