melonjs 10.8.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.
Files changed (95) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +32 -25
  3. package/dist/melonjs.js +1833 -2267
  4. package/dist/melonjs.min.js +4 -4
  5. package/dist/melonjs.module.d.ts +642 -1416
  6. package/dist/melonjs.module.js +1778 -2237
  7. package/package.json +16 -16
  8. package/src/audio/audio.js +0 -1
  9. package/src/camera/camera2d.js +1 -16
  10. package/src/entity/entity.js +1 -4
  11. package/src/game.js +2 -2
  12. package/src/geometries/ellipse.js +18 -27
  13. package/src/geometries/line.js +5 -8
  14. package/src/geometries/path2d.js +10 -20
  15. package/src/geometries/poly.js +28 -45
  16. package/src/geometries/rectangle.js +24 -36
  17. package/src/geometries/roundrect.js +96 -3
  18. package/src/index.js +7 -2
  19. package/src/input/gamepad.js +5 -16
  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 +1 -1
  48. package/src/physics/bounds.js +5 -19
  49. package/src/physics/collision.js +0 -1
  50. package/src/physics/detector.js +0 -4
  51. package/src/physics/quadtree.js +0 -7
  52. package/src/physics/sat.js +3 -3
  53. package/src/physics/world.js +0 -4
  54. package/src/plugin/plugin.js +0 -2
  55. package/src/polyfill/index.js +1 -0
  56. package/src/polyfill/roundrect.js +237 -0
  57. package/src/renderable/GUI.js +5 -10
  58. package/src/renderable/collectable.js +1 -0
  59. package/src/renderable/container.js +26 -54
  60. package/src/renderable/dragndrop.js +0 -9
  61. package/src/renderable/imagelayer.js +3 -7
  62. package/src/renderable/light2d.js +114 -0
  63. package/src/renderable/renderable.js +22 -43
  64. package/src/renderable/sprite.js +13 -25
  65. package/src/renderable/trigger.js +1 -1
  66. package/src/state/stage.js +72 -6
  67. package/src/state/state.js +3 -20
  68. package/src/system/device.js +14 -53
  69. package/src/system/event.js +11 -0
  70. package/src/system/pooling.js +19 -8
  71. package/src/system/save.js +9 -11
  72. package/src/system/timer.js +239 -218
  73. package/src/text/bitmaptextdata.js +1 -4
  74. package/src/text/glyph.js +2 -2
  75. package/src/text/text.js +19 -21
  76. package/src/text/textmetrics.js +0 -2
  77. package/src/tweens/easing.js +1 -1
  78. package/src/tweens/interpolation.js +2 -2
  79. package/src/tweens/tween.js +1 -13
  80. package/src/utils/agent.js +1 -3
  81. package/src/utils/array.js +0 -3
  82. package/src/utils/file.js +0 -2
  83. package/src/utils/function.js +0 -2
  84. package/src/utils/string.js +0 -6
  85. package/src/utils/utils.js +2 -5
  86. package/src/video/canvas/canvas_renderer.js +76 -103
  87. package/src/video/renderer.js +43 -50
  88. package/src/video/{texture.js → texture/atlas.js} +8 -8
  89. package/src/video/{texture_cache.js → texture/cache.js} +4 -5
  90. package/src/video/texture/canvas_texture.js +99 -0
  91. package/src/video/video.js +3 -3
  92. package/src/video/webgl/glshader.js +0 -5
  93. package/src/video/webgl/utils/uniforms.js +4 -7
  94. package/src/video/webgl/webgl_compositor.js +0 -14
  95. package/src/video/webgl/webgl_renderer.js +73 -97
@@ -4,7 +4,7 @@ import { world, lastUpdate } from "./../game.js";
4
4
  import { Easing } from "./easing.js";
5
5
  import { Interpolation } from "./interpolation.js";
6
6
 
7
- /**
7
+ /*
8
8
  * Tween.js - Licensed under the MIT license
9
9
  * https://github.com/tweenjs/tween.js
10
10
  */
@@ -121,7 +121,6 @@ class Tween {
121
121
  * @name to
122
122
  * @memberof Tween
123
123
  * @public
124
- * @function
125
124
  * @param {object} properties hash of properties
126
125
  * @param {object|number} [options] object of tween properties, or a duration if a numeric value is passed
127
126
  * @param {number} [options.duration] tween duration
@@ -163,7 +162,6 @@ class Tween {
163
162
  * @name start
164
163
  * @memberof Tween
165
164
  * @public
166
- * @function
167
165
  * @param {number} [time] the current time when the tween was started
168
166
  * @returns {Tween} this instance for object chaining
169
167
  */
@@ -210,7 +208,6 @@ class Tween {
210
208
  * @name stop
211
209
  * @memberof Tween
212
210
  * @public
213
- * @function
214
211
  * @returns {Tween} this instance for object chaining
215
212
  */
216
213
  stop() {
@@ -224,7 +221,6 @@ class Tween {
224
221
  * @name delay
225
222
  * @memberof Tween
226
223
  * @public
227
- * @function
228
224
  * @param {number} amount delay amount expressed in milliseconds
229
225
  * @returns {Tween} this instance for object chaining
230
226
  */
@@ -240,7 +236,6 @@ class Tween {
240
236
  * @name repeat
241
237
  * @memberof Tween
242
238
  * @public
243
- * @function
244
239
  * @param {number} times amount of times the tween should be repeated
245
240
  * @returns {Tween} this instance for object chaining
246
241
  */
@@ -257,7 +252,6 @@ class Tween {
257
252
  * @name yoyo
258
253
  * @memberof Tween
259
254
  * @public
260
- * @function
261
255
  * @see Tween#repeat
262
256
  * @param {boolean} yoyo
263
257
  * @returns {Tween} this instance for object chaining
@@ -274,7 +268,6 @@ class Tween {
274
268
  * @name easing
275
269
  * @memberof Tween
276
270
  * @public
277
- * @function
278
271
  * @param {Tween.Easing} easing easing function
279
272
  * @returns {Tween} this instance for object chaining
280
273
  */
@@ -291,7 +284,6 @@ class Tween {
291
284
  * @name interpolation
292
285
  * @memberof Tween
293
286
  * @public
294
- * @function
295
287
  * @param {Tween.Interpolation} interpolation interpolation function
296
288
  * @returns {Tween} this instance for object chaining
297
289
  */
@@ -305,7 +297,6 @@ class Tween {
305
297
  * @name chain
306
298
  * @memberof Tween
307
299
  * @public
308
- * @function
309
300
  * @param {...Tween} chainedTween Tween(s) to be chained
310
301
  * @returns {Tween} this instance for object chaining
311
302
  */
@@ -319,7 +310,6 @@ class Tween {
319
310
  * @name onStart
320
311
  * @memberof Tween
321
312
  * @public
322
- * @function
323
313
  * @param {Function} onStartCallback callback
324
314
  * @returns {Tween} this instance for object chaining
325
315
  */
@@ -333,7 +323,6 @@ class Tween {
333
323
  * @name onUpdate
334
324
  * @memberof Tween
335
325
  * @public
336
- * @function
337
326
  * @param {Function} onUpdateCallback callback
338
327
  * @returns {Tween} this instance for object chaining
339
328
  */
@@ -347,7 +336,6 @@ class Tween {
347
336
  * @name onComplete
348
337
  * @memberof Tween
349
338
  * @public
350
- * @function
351
339
  * @param {Function} onCompleteCallback callback
352
340
  * @returns {Tween} this instance for object chaining
353
341
  */
@@ -9,13 +9,12 @@ import { capitalize } from "./string.js";
9
9
  * Known agent vendors
10
10
  * @ignore
11
11
  */
12
- var vendors = [ "ms", "MS", "moz", "webkit", "o" ];
12
+ const vendors = [ "ms", "MS", "moz", "webkit", "o" ];
13
13
 
14
14
  /**
15
15
  * Get a vendor-prefixed property
16
16
  * @public
17
17
  * @name prefixed
18
- * @function
19
18
  * @param {string} name Property name
20
19
  * @param {object} [obj=globalThis] Object or element reference to access
21
20
  * @returns {string} Value of property
@@ -41,7 +40,6 @@ export function prefixed(name, obj) {
41
40
  * Set a vendor-prefixed property
42
41
  * @public
43
42
  * @name setPrefixed
44
- * @function
45
43
  * @param {string} name Property name
46
44
  * @param {string} value Property value
47
45
  * @param {object} [obj=globalThis] Object or element reference to access
@@ -8,7 +8,6 @@ import {random as mathRandom, weightedRandom as mathWeightedRandom} from "./../m
8
8
  /**
9
9
  * Remove the specified object from the given Array
10
10
  * @public
11
- * @function
12
11
  * @memberof utils.array
13
12
  * @name remove
14
13
  * @param {Array} arr array from which to remove an object
@@ -29,7 +28,6 @@ export function remove(arr, obj) {
29
28
  /**
30
29
  * return a random array element
31
30
  * @public
32
- * @function
33
31
  * @memberof utils.array
34
32
  * @name random
35
33
  * @param {Array} arr array to pick a element
@@ -46,7 +44,6 @@ export function random(arr) {
46
44
  /**
47
45
  * return a weighted random array element, favoring the earlier entries
48
46
  * @public
49
- * @function
50
47
  * @memberof utils.array
51
48
  * @name weightedRandom
52
49
  * @param {Array} arr array to pick a element
package/src/utils/file.js CHANGED
@@ -12,7 +12,6 @@ const REMOVE_EXT = /\.[^\.]*$/;
12
12
  /**
13
13
  * return the base name of the file without path info
14
14
  * @public
15
- * @function
16
15
  * @memberof utils.file
17
16
  * @name getBasename
18
17
  * @param {string} path path containing the filename
@@ -25,7 +24,6 @@ export function getBasename(path) {
25
24
  /**
26
25
  * return the extension of the file in the given path
27
26
  * @public
28
- * @function
29
27
  * @memberof utils.file
30
28
  * @name getExtension
31
29
  * @param {string} path path containing the filename
@@ -6,7 +6,6 @@
6
6
  /**
7
7
  * Executes a function as soon as the interpreter is idle (stack empty).
8
8
  * @public
9
- * @function
10
9
  * @memberof utils.function
11
10
  * @name defer
12
11
  * @param {Function} func The function to be deferred.
@@ -27,7 +26,6 @@ export function defer(func, thisArg, ...args) {
27
26
  * returns a function that, when invoked will only be triggered at most
28
27
  * once during a given window of time
29
28
  * @public
30
- * @function
31
29
  * @memberof utils.function
32
30
  * @name throttle
33
31
  * @param {Function} fn the function to be throttled.
@@ -6,7 +6,6 @@
6
6
  /**
7
7
  * converts the first character of the given string to uppercase
8
8
  * @public
9
- * @function
10
9
  * @memberof utils.string
11
10
  * @name capitalize
12
11
  * @param {string} str the string to be capitalized
@@ -19,7 +18,6 @@ export function capitalize(str) {
19
18
  /**
20
19
  * returns the string stripped of whitespace from the left.
21
20
  * @public
22
- * @function
23
21
  * @memberof utils.string
24
22
  * @name trimLeft
25
23
  * @param {string} str the string to be trimmed
@@ -32,7 +30,6 @@ export function trimLeft(str) {
32
30
  /**
33
31
  * returns the string stripped of whitespace from the right.
34
32
  * @public
35
- * @function
36
33
  * @memberof utils.string
37
34
  * @name trimRight
38
35
  * @param {string} str the string to be trimmed
@@ -45,7 +42,6 @@ export function trimRight(str) {
45
42
  /**
46
43
  * returns true if the given string contains a numeric integer or float value
47
44
  * @public
48
- * @function
49
45
  * @memberof utils.string
50
46
  * @name isNumeric
51
47
  * @param {string} str the string to be tested
@@ -61,7 +57,6 @@ export function isNumeric(str) {
61
57
  /**
62
58
  * returns true if the given string contains a true or false
63
59
  * @public
64
- * @function
65
60
  * @memberof utils.string
66
61
  * @name isBoolean
67
62
  * @param {string} str the string to be tested
@@ -75,7 +70,6 @@ export function isBoolean(str) {
75
70
  /**
76
71
  * convert a string to the corresponding hexadecimal value
77
72
  * @public
78
- * @function
79
73
  * @memberof utils.string
80
74
  * @name toHex
81
75
  * @param {string} str the string to be converted
@@ -27,7 +27,6 @@ var utils = {
27
27
  /**
28
28
  * Get image pixels
29
29
  * @public
30
- * @function
31
30
  * @memberof utils
32
31
  * @name getPixels
33
32
  * @param {HTMLImageElement|HTMLCanvasElement} image Image to read
@@ -50,7 +49,6 @@ var utils = {
50
49
  /**
51
50
  * Compare two version strings
52
51
  * @public
53
- * @function
54
52
  * @memberof utils
55
53
  * @name checkVersion
56
54
  * @param {string} first First version string to compare
@@ -83,7 +81,6 @@ var utils = {
83
81
  /**
84
82
  * parse the fragment (hash) from a URL and returns them into
85
83
  * @public
86
- * @function
87
84
  * @memberof utils
88
85
  * @name getUriFragment
89
86
  * @param {string} [url=document.location] an optional params string or URL containing fragment (hash) params to be parsed
@@ -120,14 +117,14 @@ var utils = {
120
117
  // never cache if a url is passed as parameter
121
118
  var index = url.indexOf("#");
122
119
  if (index !== -1) {
123
- url = url.substr(index, url.length);
120
+ url = url.slice(index, url.length);
124
121
  } else {
125
122
  return hash;
126
123
  }
127
124
  }
128
125
 
129
126
  // parse the url
130
- url.substr(1).split("&").filter(function (value) {
127
+ url.slice(1).split("&").filter(function (value) {
131
128
  return (value !== "");
132
129
  }).forEach(function (value) {
133
130
  var kv = value.split("=");