melonjs 14.0.2 → 14.1.1

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 (219) hide show
  1. package/README.md +2 -0
  2. package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +10 -0
  3. package/dist/melonjs.mjs/_virtual/arraymultimap.js +10 -0
  4. package/dist/melonjs.mjs/_virtual/earcut.js +10 -0
  5. package/dist/melonjs.mjs/_virtual/howler.js +10 -0
  6. package/dist/melonjs.mjs/_virtual/index.js +10 -0
  7. package/dist/melonjs.mjs/_virtual/index2.js +10 -0
  8. package/dist/melonjs.mjs/_virtual/multimap.js +10 -0
  9. package/dist/melonjs.mjs/_virtual/setmultimap.js +10 -0
  10. package/dist/melonjs.mjs/application/application.js +238 -0
  11. package/dist/melonjs.mjs/audio/audio.js +536 -0
  12. package/dist/melonjs.mjs/camera/camera2d.js +731 -0
  13. package/dist/melonjs.mjs/entity/entity.js +247 -0
  14. package/dist/melonjs.mjs/game.js +29 -0
  15. package/dist/melonjs.mjs/geometries/ellipse.js +274 -0
  16. package/dist/melonjs.mjs/geometries/line.js +115 -0
  17. package/dist/melonjs.mjs/geometries/path2d.js +318 -0
  18. package/dist/melonjs.mjs/geometries/point.js +88 -0
  19. package/dist/melonjs.mjs/geometries/poly.js +498 -0
  20. package/dist/melonjs.mjs/geometries/rectangle.js +374 -0
  21. package/dist/melonjs.mjs/geometries/roundrect.js +167 -0
  22. package/dist/melonjs.mjs/index.js +248 -0
  23. package/dist/melonjs.mjs/input/gamepad.js +501 -0
  24. package/dist/melonjs.mjs/input/input.js +26 -0
  25. package/dist/melonjs.mjs/input/keyboard.js +470 -0
  26. package/dist/melonjs.mjs/input/pointer.js +393 -0
  27. package/dist/melonjs.mjs/input/pointerevent.js +818 -0
  28. package/dist/melonjs.mjs/lang/deprecated.js +157 -0
  29. package/dist/melonjs.mjs/level/level.js +297 -0
  30. package/dist/melonjs.mjs/level/tiled/TMXGroup.js +141 -0
  31. package/dist/melonjs.mjs/level/tiled/TMXLayer.js +446 -0
  32. package/dist/melonjs.mjs/level/tiled/TMXObject.js +355 -0
  33. package/dist/melonjs.mjs/level/tiled/TMXTile.js +193 -0
  34. package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +636 -0
  35. package/dist/melonjs.mjs/level/tiled/TMXTileset.js +309 -0
  36. package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +81 -0
  37. package/dist/melonjs.mjs/level/tiled/TMXUtils.js +367 -0
  38. package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +504 -0
  39. package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +218 -0
  40. package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +155 -0
  41. package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +124 -0
  42. package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +107 -0
  43. package/dist/melonjs.mjs/loader/loader.js +801 -0
  44. package/dist/melonjs.mjs/loader/loadingscreen.js +120 -0
  45. package/dist/melonjs.mjs/loader/melonjs_logo.png.js +11 -0
  46. package/dist/melonjs.mjs/math/color.js +616 -0
  47. package/dist/melonjs.mjs/math/math.js +218 -0
  48. package/dist/melonjs.mjs/math/matrix2.js +501 -0
  49. package/dist/melonjs.mjs/math/matrix3.js +679 -0
  50. package/dist/melonjs.mjs/math/observable_vector2.js +469 -0
  51. package/dist/melonjs.mjs/math/observable_vector3.js +559 -0
  52. package/dist/melonjs.mjs/math/vector2.js +526 -0
  53. package/dist/melonjs.mjs/math/vector3.js +567 -0
  54. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/arraymultimap.js +73 -0
  55. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/index.js +21 -0
  56. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/multimap.js +324 -0
  57. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/setmultimap.js +69 -0
  58. package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +691 -0
  59. package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +350 -0
  60. package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +3241 -0
  61. package/dist/melonjs.mjs/particles/emitter.js +265 -0
  62. package/dist/melonjs.mjs/particles/particle.js +186 -0
  63. package/dist/melonjs.mjs/particles/settings.js +319 -0
  64. package/dist/melonjs.mjs/physics/body.js +702 -0
  65. package/dist/melonjs.mjs/physics/bounds.js +459 -0
  66. package/dist/melonjs.mjs/physics/collision.js +132 -0
  67. package/dist/melonjs.mjs/physics/detector.js +194 -0
  68. package/dist/melonjs.mjs/physics/quadtree.js +394 -0
  69. package/dist/melonjs.mjs/physics/response.js +57 -0
  70. package/dist/melonjs.mjs/physics/sat.js +483 -0
  71. package/dist/melonjs.mjs/physics/world.js +219 -0
  72. package/dist/melonjs.mjs/plugin/plugin.js +141 -0
  73. package/dist/melonjs.mjs/renderable/collectable.js +60 -0
  74. package/dist/melonjs.mjs/renderable/colorlayer.js +78 -0
  75. package/dist/melonjs.mjs/renderable/container.js +1016 -0
  76. package/dist/melonjs.mjs/renderable/dragndrop.js +224 -0
  77. package/dist/melonjs.mjs/renderable/imagelayer.js +305 -0
  78. package/dist/melonjs.mjs/renderable/light2d.js +155 -0
  79. package/dist/melonjs.mjs/renderable/nineslicesprite.js +246 -0
  80. package/dist/melonjs.mjs/renderable/renderable.js +781 -0
  81. package/dist/melonjs.mjs/renderable/sprite.js +653 -0
  82. package/dist/melonjs.mjs/renderable/trigger.js +156 -0
  83. package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +212 -0
  84. package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +225 -0
  85. package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +127 -0
  86. package/dist/melonjs.mjs/state/stage.js +236 -0
  87. package/dist/melonjs.mjs/state/state.js +596 -0
  88. package/dist/melonjs.mjs/system/device.js +909 -0
  89. package/dist/melonjs.mjs/system/dom.js +78 -0
  90. package/dist/melonjs.mjs/system/event.js +537 -0
  91. package/dist/melonjs.mjs/system/platform.js +41 -0
  92. package/dist/melonjs.mjs/system/pooling.js +209 -0
  93. package/dist/melonjs.mjs/system/save.js +157 -0
  94. package/dist/melonjs.mjs/system/timer.js +286 -0
  95. package/dist/melonjs.mjs/text/bitmaptext.js +363 -0
  96. package/dist/melonjs.mjs/text/bitmaptextdata.js +198 -0
  97. package/dist/melonjs.mjs/text/glyph.js +65 -0
  98. package/dist/melonjs.mjs/text/text.js +452 -0
  99. package/dist/melonjs.mjs/text/textmetrics.js +175 -0
  100. package/dist/melonjs.mjs/text/textstyle.js +23 -0
  101. package/dist/melonjs.mjs/tweens/easing.js +336 -0
  102. package/dist/melonjs.mjs/tweens/interpolation.js +112 -0
  103. package/dist/melonjs.mjs/tweens/tween.js +479 -0
  104. package/dist/melonjs.mjs/utils/agent.js +76 -0
  105. package/dist/melonjs.mjs/utils/array.js +63 -0
  106. package/dist/melonjs.mjs/utils/file.js +42 -0
  107. package/dist/melonjs.mjs/utils/function.js +70 -0
  108. package/dist/melonjs.mjs/utils/string.js +82 -0
  109. package/dist/melonjs.mjs/utils/utils.js +173 -0
  110. package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +806 -0
  111. package/dist/melonjs.mjs/video/renderer.js +410 -0
  112. package/dist/melonjs.mjs/video/texture/atlas.js +519 -0
  113. package/dist/melonjs.mjs/video/texture/cache.js +143 -0
  114. package/dist/melonjs.mjs/video/texture/canvas_texture.js +144 -0
  115. package/dist/melonjs.mjs/video/video.js +462 -0
  116. package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +142 -0
  117. package/dist/melonjs.mjs/video/webgl/glshader.js +167 -0
  118. package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +10 -0
  119. package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +10 -0
  120. package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +10 -0
  121. package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +10 -0
  122. package/dist/melonjs.mjs/video/webgl/utils/attributes.js +25 -0
  123. package/dist/melonjs.mjs/video/webgl/utils/precision.js +20 -0
  124. package/dist/melonjs.mjs/video/webgl/utils/program.js +67 -0
  125. package/dist/melonjs.mjs/video/webgl/utils/string.js +25 -0
  126. package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +92 -0
  127. package/dist/melonjs.mjs/video/webgl/webgl_compositor.js +494 -0
  128. package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +1035 -0
  129. package/dist/melonjs.module.d.ts +1298 -1359
  130. package/dist/melonjs.module.js +2072 -3520
  131. package/package.json +21 -16
  132. package/src/application/application.js +4 -5
  133. package/src/audio/audio.js +32 -32
  134. package/src/camera/camera2d.js +32 -33
  135. package/src/entity/entity.js +18 -19
  136. package/src/geometries/ellipse.js +17 -18
  137. package/src/geometries/line.js +6 -7
  138. package/src/geometries/path2d.js +33 -34
  139. package/src/geometries/point.js +1 -2
  140. package/src/geometries/poly.js +16 -18
  141. package/src/geometries/rectangle.js +19 -20
  142. package/src/geometries/roundrect.js +9 -10
  143. package/src/input/gamepad.js +15 -15
  144. package/src/input/keyboard.js +12 -12
  145. package/src/input/pointer.js +6 -6
  146. package/src/input/pointerevent.js +12 -12
  147. package/src/lang/deprecated.js +12 -12
  148. package/src/level/level.js +25 -25
  149. package/src/level/tiled/TMXLayer.js +23 -24
  150. package/src/level/tiled/TMXTile.js +6 -7
  151. package/src/level/tiled/TMXTileMap.js +8 -10
  152. package/src/level/tiled/TMXTileset.js +3 -4
  153. package/src/level/tiled/TMXTilesetGroup.js +1 -2
  154. package/src/level/tiled/TMXUtils.js +5 -5
  155. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +3 -4
  156. package/src/level/tiled/renderer/TMXIsometricRenderer.js +3 -4
  157. package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +2 -3
  158. package/src/level/tiled/renderer/TMXRenderer.js +20 -21
  159. package/src/level/tiled/renderer/TMXStaggeredRenderer.js +1 -2
  160. package/src/loader/loader.js +20 -20
  161. package/src/math/color.js +21 -22
  162. package/src/math/math.js +16 -16
  163. package/src/math/matrix2.js +17 -18
  164. package/src/math/matrix3.js +26 -27
  165. package/src/math/observable_vector2.js +15 -16
  166. package/src/math/observable_vector3.js +17 -18
  167. package/src/math/vector2.js +10 -11
  168. package/src/math/vector3.js +11 -12
  169. package/src/particles/emitter.js +7 -8
  170. package/src/particles/particle.js +3 -4
  171. package/src/physics/body.js +29 -30
  172. package/src/physics/bounds.js +10 -10
  173. package/src/physics/collision.js +2 -2
  174. package/src/physics/detector.js +6 -6
  175. package/src/physics/quadtree.js +18 -23
  176. package/src/physics/sat.js +31 -31
  177. package/src/physics/world.js +6 -7
  178. package/src/plugin/plugin.js +5 -5
  179. package/src/renderable/collectable.js +4 -6
  180. package/src/renderable/colorlayer.js +6 -8
  181. package/src/renderable/container.js +25 -27
  182. package/src/renderable/dragndrop.js +14 -14
  183. package/src/renderable/imagelayer.js +14 -15
  184. package/src/renderable/light2d.js +4 -5
  185. package/src/renderable/nineslicesprite.js +17 -18
  186. package/src/renderable/renderable.js +26 -28
  187. package/src/renderable/sprite.js +29 -30
  188. package/src/renderable/trigger.js +16 -17
  189. package/src/renderable/ui/uibaseelement.js +8 -9
  190. package/src/renderable/ui/uispriteelement.js +8 -8
  191. package/src/renderable/ui/uitextbutton.js +15 -15
  192. package/src/state/stage.js +8 -9
  193. package/src/state/state.js +17 -17
  194. package/src/system/device.js +11 -11
  195. package/src/system/event.js +10 -10
  196. package/src/system/pooling.js +9 -9
  197. package/src/system/save.js +2 -2
  198. package/src/system/timer.js +10 -10
  199. package/src/text/bitmaptext.js +19 -20
  200. package/src/text/bitmaptextdata.js +3 -4
  201. package/src/text/glyph.js +1 -2
  202. package/src/text/text.js +24 -25
  203. package/src/text/textmetrics.js +9 -10
  204. package/src/tweens/tween.js +20 -21
  205. package/src/utils/agent.js +5 -5
  206. package/src/utils/array.js +4 -4
  207. package/src/utils/file.js +2 -2
  208. package/src/utils/function.js +6 -6
  209. package/src/utils/string.js +5 -5
  210. package/src/utils/utils.js +4 -4
  211. package/src/video/canvas/canvas_renderer.js +72 -73
  212. package/src/video/renderer.js +27 -28
  213. package/src/video/texture/atlas.js +22 -22
  214. package/src/video/texture/canvas_texture.js +9 -9
  215. package/src/video/video.js +17 -17
  216. package/src/video/webgl/buffer/vertex.js +1 -2
  217. package/src/video/webgl/glshader.js +12 -12
  218. package/src/video/webgl/webgl_compositor.js +42 -43
  219. package/src/video/webgl/webgl_renderer.js +76 -77
@@ -23,10 +23,10 @@ import { Interpolation } from "./interpolation.js";
23
23
  * author lechecacharro<br>
24
24
  * author Josh Faul / http://jocafa.com/
25
25
  */
26
- class Tween {
26
+ export default class Tween {
27
27
 
28
28
  /**
29
- * @param {object} object object on which to apply the tween
29
+ * @param {object} object - object on which to apply the tween
30
30
  * @example
31
31
  * // add a tween to change the object pos.x and pos.y variable to 200 in 3 seconds
32
32
  * tween = new me.Tween(myObject.pos).to({
@@ -121,15 +121,15 @@ class Tween {
121
121
  * @name to
122
122
  * @memberof Tween
123
123
  * @public
124
- * @param {object} properties hash of properties
125
- * @param {object|number} [options] object of tween properties, or a duration if a numeric value is passed
126
- * @param {number} [options.duration] tween duration
127
- * @param {Tween.Easing} [options.easing] easing function
128
- * @param {number} [options.delay] delay amount expressed in milliseconds
129
- * @param {boolean} [options.yoyo] allows the tween to bounce back to their original value when finished. To be used together with repeat to create endless loops.
130
- * @param {number} [options.repeat] amount of times the tween should be repeated
131
- * @param {Tween.Interpolation} [options.interpolation] interpolation function
132
- * @param {boolean} [options.autoStart] allow this tween to start automatically. Otherwise call me.Tween.start().
124
+ * @param {object} properties - hash of properties
125
+ * @param {object|number} [options] - object of tween properties, or a duration if a numeric value is passed
126
+ * @param {number} [options.duration] - tween duration
127
+ * @param {Tween.Easing} [options.easing] - easing function
128
+ * @param {number} [options.delay] - delay amount expressed in milliseconds
129
+ * @param {boolean} [options.yoyo] - allows the tween to bounce back to their original value when finished. To be used together with repeat to create endless loops.
130
+ * @param {number} [options.repeat] - amount of times the tween should be repeated
131
+ * @param {Tween.Interpolation} [options.interpolation] - interpolation function
132
+ * @param {boolean} [options.autoStart] - allow this tween to start automatically. Otherwise call me.Tween.start().
133
133
  * @returns {Tween} this instance for object chaining
134
134
  */
135
135
  to( properties, options ) {
@@ -162,7 +162,7 @@ class Tween {
162
162
  * @name start
163
163
  * @memberof Tween
164
164
  * @public
165
- * @param {number} [time] the current time when the tween was started
165
+ * @param {number} [time] - the current time when the tween was started
166
166
  * @returns {Tween} this instance for object chaining
167
167
  */
168
168
  start( time = timer.getTime() ) {
@@ -221,7 +221,7 @@ class Tween {
221
221
  * @name delay
222
222
  * @memberof Tween
223
223
  * @public
224
- * @param {number} amount delay amount expressed in milliseconds
224
+ * @param {number} amount - delay amount expressed in milliseconds
225
225
  * @returns {Tween} this instance for object chaining
226
226
  */
227
227
  delay( amount ) {
@@ -236,7 +236,7 @@ class Tween {
236
236
  * @name repeat
237
237
  * @memberof Tween
238
238
  * @public
239
- * @param {number} times amount of times the tween should be repeated
239
+ * @param {number} times - amount of times the tween should be repeated
240
240
  * @returns {Tween} this instance for object chaining
241
241
  */
242
242
  repeat( times ) {
@@ -268,7 +268,7 @@ class Tween {
268
268
  * @name easing
269
269
  * @memberof Tween
270
270
  * @public
271
- * @param {Tween.Easing} easing easing function
271
+ * @param {Tween.Easing} easing - easing function
272
272
  * @returns {Tween} this instance for object chaining
273
273
  */
274
274
  easing( easing ) {
@@ -284,7 +284,7 @@ class Tween {
284
284
  * @name interpolation
285
285
  * @memberof Tween
286
286
  * @public
287
- * @param {Tween.Interpolation} interpolation interpolation function
287
+ * @param {Tween.Interpolation} interpolation - interpolation function
288
288
  * @returns {Tween} this instance for object chaining
289
289
  */
290
290
  interpolation( interpolation ) {
@@ -297,7 +297,7 @@ class Tween {
297
297
  * @name chain
298
298
  * @memberof Tween
299
299
  * @public
300
- * @param {...Tween} chainedTween Tween(s) to be chained
300
+ * @param {...Tween} chainedTween - Tween(s) to be chained
301
301
  * @returns {Tween} this instance for object chaining
302
302
  */
303
303
  chain() {
@@ -310,7 +310,7 @@ class Tween {
310
310
  * @name onStart
311
311
  * @memberof Tween
312
312
  * @public
313
- * @param {Function} onStartCallback callback
313
+ * @param {Function} onStartCallback - callback
314
314
  * @returns {Tween} this instance for object chaining
315
315
  */
316
316
  onStart( onStartCallback ) {
@@ -323,7 +323,7 @@ class Tween {
323
323
  * @name onUpdate
324
324
  * @memberof Tween
325
325
  * @public
326
- * @param {Function} onUpdateCallback callback
326
+ * @param {Function} onUpdateCallback - callback
327
327
  * @returns {Tween} this instance for object chaining
328
328
  */
329
329
  onUpdate( onUpdateCallback ) {
@@ -336,7 +336,7 @@ class Tween {
336
336
  * @name onComplete
337
337
  * @memberof Tween
338
338
  * @public
339
- * @param {Function} onCompleteCallback callback
339
+ * @param {Function} onCompleteCallback - callback
340
340
  * @returns {Tween} this instance for object chaining
341
341
  */
342
342
  onComplete( onCompleteCallback ) {
@@ -468,4 +468,3 @@ class Tween {
468
468
  static get Easing() { return Easing; }
469
469
  static get Interpolation() { return Interpolation; }
470
470
  }
471
- export default Tween;
@@ -15,8 +15,8 @@ const vendors = [ "ms", "MS", "moz", "webkit", "o" ];
15
15
  * Get a vendor-prefixed property
16
16
  * @public
17
17
  * @name prefixed
18
- * @param {string} name Property name
19
- * @param {object} [obj=globalThis] Object or element reference to access
18
+ * @param {string} name - Property name
19
+ * @param {object} [obj=globalThis] - Object or element reference to access
20
20
  * @returns {string} Value of property
21
21
  * @memberof utils.agent
22
22
  */
@@ -40,9 +40,9 @@ export function prefixed(name, obj) {
40
40
  * Set a vendor-prefixed property
41
41
  * @public
42
42
  * @name setPrefixed
43
- * @param {string} name Property name
44
- * @param {string} value Property value
45
- * @param {object} [obj=globalThis] Object or element reference to access
43
+ * @param {string} name - Property name
44
+ * @param {string} value - Property value
45
+ * @param {object} [obj=globalThis] - Object or element reference to access
46
46
  * @returns {boolean} true if one of the vendor-prefixed property was found
47
47
  * @memberof utils.agent
48
48
  */
@@ -10,8 +10,8 @@ import {random as mathRandom, weightedRandom as mathWeightedRandom} from "./../m
10
10
  * @public
11
11
  * @memberof utils.array
12
12
  * @name remove
13
- * @param {Array} arr array from which to remove an object
14
- * @param {object} obj to be removed
13
+ * @param {Array} arr - array from which to remove an object
14
+ * @param {object} obj - to be removed
15
15
  * @returns {Array} the modified Array
16
16
  * var arr = [ "foo", "bar", "baz" ];
17
17
  * // remove "foo" from the array
@@ -30,7 +30,7 @@ export function remove(arr, obj) {
30
30
  * @public
31
31
  * @memberof utils.array
32
32
  * @name random
33
- * @param {Array} arr array to pick a element
33
+ * @param {Array} arr - array to pick a element
34
34
  * @returns {any} random member of array
35
35
  * @example
36
36
  * // Select a random array element
@@ -46,7 +46,7 @@ export function random(arr) {
46
46
  * @public
47
47
  * @memberof utils.array
48
48
  * @name weightedRandom
49
- * @param {Array} arr array to pick a element
49
+ * @param {Array} arr - array to pick a element
50
50
  * @returns {any} random member of array
51
51
  */
52
52
  export function weightedRandom(arr) {
package/src/utils/file.js CHANGED
@@ -14,7 +14,7 @@ const REMOVE_EXT = /\.[^\.]*$/;
14
14
  * @public
15
15
  * @memberof utils.file
16
16
  * @name getBasename
17
- * @param {string} path path containing the filename
17
+ * @param {string} path- - path containing the filename
18
18
  * @returns {string} the base name without path information.
19
19
  */
20
20
  export function getBasename(path) {
@@ -26,7 +26,7 @@ export function getBasename(path) {
26
26
  * @public
27
27
  * @memberof utils.file
28
28
  * @name getExtension
29
- * @param {string} path path containing the filename
29
+ * @param {string} path- - path containing the filename
30
30
  * @returns {string} filename extension.
31
31
  */
32
32
  export function getExtension(path) {
@@ -8,9 +8,9 @@
8
8
  * @public
9
9
  * @memberof utils.function
10
10
  * @name defer
11
- * @param {Function} func The function to be deferred.
12
- * @param {object} thisArg The value to be passed as the this parameter to the target function when the deferred function is called
13
- * @param {...*} args Optional additional arguments to carry for the function.
11
+ * @param {Function} func - The function to be deferred.
12
+ * @param {object} thisArg - The value to be passed as the this parameter to the target function when the deferred function is called
13
+ * @param {...*} args - Optional additional arguments to carry for the function.
14
14
  * @returns {number} id that can be used to clear the deferred function using
15
15
  * clearTimeout
16
16
  * @example
@@ -28,9 +28,9 @@ export function defer(func, thisArg, ...args) {
28
28
  * @public
29
29
  * @memberof utils.function
30
30
  * @name throttle
31
- * @param {Function} fn the function to be throttled.
32
- * @param {number} delay The delay in ms
33
- * @param {no_trailing} no_trailing disable the execution on the trailing edge
31
+ * @param {Function} fn - the function to be throttled.
32
+ * @param {number} delay - The delay in ms
33
+ * @param {no_trailing} no_trailing - disable the execution on the trailing edge
34
34
  * @returns {Function} the function that will be throttled
35
35
  */
36
36
  export function throttle(fn, delay, no_trailing) {
@@ -8,7 +8,7 @@
8
8
  * @public
9
9
  * @memberof utils.string
10
10
  * @name capitalize
11
- * @param {string} str the string to be capitalized
11
+ * @param {string} str - the string to be capitalized
12
12
  * @returns {string} the capitalized string
13
13
  */
14
14
  export function capitalize(str) {
@@ -20,7 +20,7 @@ export function capitalize(str) {
20
20
  * @public
21
21
  * @memberof utils.string
22
22
  * @name isNumeric
23
- * @param {string} str the string to be tested
23
+ * @param {string} str - the string to be tested
24
24
  * @returns {boolean} true if string contains only digits
25
25
  */
26
26
  export function isNumeric(str) {
@@ -35,7 +35,7 @@ export function isNumeric(str) {
35
35
  * @public
36
36
  * @memberof utils.string
37
37
  * @name isBoolean
38
- * @param {string} str the string to be tested
38
+ * @param {string} str - the string to be tested
39
39
  * @returns {boolean} true if the string is either true or false
40
40
  */
41
41
  export function isBoolean(str) {
@@ -48,7 +48,7 @@ export function isBoolean(str) {
48
48
  * @public
49
49
  * @memberof utils.string
50
50
  * @name toHex
51
- * @param {string} str the string to be converted
51
+ * @param {string} str - the string to be converted
52
52
  * @returns {string} the converted hexadecimal value
53
53
  */
54
54
  export function toHex(str) {
@@ -65,7 +65,7 @@ export function toHex(str) {
65
65
  * @public
66
66
  * @memberof utils.string
67
67
  * @name isDataUrl
68
- * @param {string} str the string (url) to be tested
68
+ * @param {string} str - the string (url) to be tested
69
69
  * @returns {boolean} true if the string is a data url
70
70
  */
71
71
  export function isDataUrl(str) {
@@ -29,7 +29,7 @@ var utils = {
29
29
  * @public
30
30
  * @memberof utils
31
31
  * @name getPixels
32
- * @param {HTMLImageElement|HTMLCanvasElement} image Image to read
32
+ * @param {HTMLImageElement|HTMLCanvasElement} image - Image to read
33
33
  * @returns {ImageData} ImageData object
34
34
  */
35
35
  getPixels : function (image) {
@@ -51,8 +51,8 @@ var utils = {
51
51
  * @public
52
52
  * @memberof utils
53
53
  * @name checkVersion
54
- * @param {string} first First version string to compare
55
- * @param {string} [second=version] Second version string to compare
54
+ * @param {string} first - First version string to compare
55
+ * @param {string} [second=version] - Second version string to compare
56
56
  * @returns {number} comparison result <br>&lt; 0 : first &lt; second<br>
57
57
  * 0 : first == second<br>
58
58
  * &gt; 0 : first &gt; second
@@ -83,7 +83,7 @@ var utils = {
83
83
  * @public
84
84
  * @memberof utils
85
85
  * @name getUriFragment
86
- * @param {string} [url=document.location] an optional params string or URL containing fragment (hash) params to be parsed
86
+ * @param {string} [url=document.location] - an optional params string or URL containing fragment (hash) params to be parsed
87
87
  * @returns {object} an object representing the deserialized params string.
88
88
  * @property {boolean} [hitbox=false] draw the hitbox in the debug panel (if enabled)
89
89
  * @property {boolean} [velocity=false] draw the entities velocity in the debug panel (if enabled)
@@ -12,18 +12,18 @@ import * as event from "./../../system/event.js";
12
12
  * a canvas renderer object
13
13
  * @augments Renderer
14
14
  */
15
- class CanvasRenderer extends Renderer {
16
- /**
17
- * @param {object} options The renderer parameters
18
- * @param {number} options.width The width of the canvas without scaling
19
- * @param {number} options.height The height of the canvas without scaling
20
- * @param {HTMLCanvasElement} [options.canvas] The html canvas to draw to on screen
21
- * @param {boolean} [options.antiAlias=false] Whether to enable anti-aliasing
22
- * @param {boolean} [options.transparent=false] Whether to enable transparency on the canvas (performance hit when enabled)
23
- * @param {boolean} [options.subPixel=false] Whether to enable subpixel renderering (performance hit when enabled)
24
- * @param {boolean} [options.textureSeamFix=true] enable the texture seam fix when rendering Tile when antiAlias is off for the canvasRenderer
25
- * @param {number} [options.zoomX=width] The actual width of the canvas with scaling applied
26
- * @param {number} [options.zoomY=height] The actual height of the canvas with scaling applied
15
+ export default class CanvasRenderer extends Renderer {
16
+ /**
17
+ * @param {object} options - The renderer parameters
18
+ * @param {number} options.width - The width of the canvas without scaling
19
+ * @param {number} options.height - The height of the canvas without scaling
20
+ * @param {HTMLCanvasElement} [options.canvas] - The html canvas to draw to on screen
21
+ * @param {boolean} [options.antiAlias=false] - Whether to enable anti-aliasing
22
+ * @param {boolean} [options.transparent=false] - Whether to enable transparency on the canvas (performance hit when enabled)
23
+ * @param {boolean} [options.subPixel=false] - Whether to enable subpixel renderering (performance hit when enabled)
24
+ * @param {boolean} [options.textureSeamFix=true] - enable the texture seam fix when rendering Tile when antiAlias is off for the canvasRenderer
25
+ * @param {number} [options.zoomX=width] - The actual width of the canvas with scaling applied
26
+ * @param {number} [options.zoomY=height] - The actual height of the canvas with scaling applied
27
27
  */
28
28
  constructor(options) {
29
29
  // parent constructor
@@ -91,7 +91,7 @@ class CanvasRenderer extends Renderer {
91
91
  * @name setBlendMode
92
92
  * @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
93
93
  * @memberof CanvasRenderer
94
- * @param {string} [mode="normal"] blend mode : "normal", "multiply", "lighter, "additive", "screen"
94
+ * @param {string} [mode="normal"] - blend mode : "normal", "multiply", "lighter, "additive", "screen"
95
95
  * @param {CanvasRenderingContext2D} [context]
96
96
  */
97
97
  setBlendMode(mode = "normal", context) {
@@ -135,8 +135,8 @@ class CanvasRenderer extends Renderer {
135
135
  * Clears the main framebuffer with the given color
136
136
  * @name clearColor
137
137
  * @memberof CanvasRenderer
138
- * @param {Color|string} [color="#000000"] CSS color.
139
- * @param {boolean} [opaque=false] Allow transparency [default] or clear the surface completely [true]
138
+ * @param {Color|string} [color="#000000"] - CSS color.
139
+ * @param {boolean} [opaque=false] - Allow transparency [default] or clear the surface completely [true]
140
140
  */
141
141
  clearColor(color = "#000000", opaque = false) {
142
142
  var canvas = this.getCanvas();
@@ -155,10 +155,10 @@ class CanvasRenderer extends Renderer {
155
155
  * Erase the pixels in the given rectangular area by setting them to transparent black (rgba(0,0,0,0)).
156
156
  * @name clearRect
157
157
  * @memberof CanvasRenderer
158
- * @param {number} x x axis of the coordinate for the rectangle starting point.
159
- * @param {number} y y axis of the coordinate for the rectangle starting point.
160
- * @param {number} width The rectangle's width.
161
- * @param {number} height The rectangle's height.
158
+ * @param {number} x - x axis of the coordinate for the rectangle starting point.
159
+ * @param {number} y - y axis of the coordinate for the rectangle starting point.
160
+ * @param {number} width - The rectangle's width.
161
+ * @param {number} height - The rectangle's height.
162
162
  */
163
163
  clearRect(x, y, width, height) {
164
164
  this.getContext().clearRect(x, y, width, height);
@@ -168,8 +168,8 @@ class CanvasRenderer extends Renderer {
168
168
  * Create a pattern with the specified repetition
169
169
  * @name createPattern
170
170
  * @memberof CanvasRenderer
171
- * @param {Image} image Source image
172
- * @param {string} repeat Define how the pattern should be repeated
171
+ * @param {Image} image - Source image
172
+ * @param {string} repeat - Define how the pattern should be repeated
173
173
  * @returns {CanvasPattern}
174
174
  * @see ImageLayer#repeat
175
175
  * @example
@@ -186,15 +186,15 @@ class CanvasRenderer extends Renderer {
186
186
  * Draw an image onto the main using the canvas api
187
187
  * @name drawImage
188
188
  * @memberof CanvasRenderer
189
- * @param {Image} image An element to draw into the context. The specification permits any canvas image source (CanvasImageSource), specifically, a CSSImageValue, an HTMLImageElement, an SVGImageElement, an HTMLVideoElement, an HTMLCanvasElement, an ImageBitmap, or an OffscreenCanvas.
190
- * @param {number} sx The X coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
191
- * @param {number} sy The Y coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
192
- * @param {number} sw The width of the sub-rectangle of the source image to draw into the destination context. If not specified, the entire rectangle from the coordinates specified by sx and sy to the bottom-right corner of the image is used.
193
- * @param {number} sh The height of the sub-rectangle of the source image to draw into the destination context.
194
- * @param {number} dx The X coordinate in the destination canvas at which to place the top-left corner of the source image.
195
- * @param {number} dy The Y coordinate in the destination canvas at which to place the top-left corner of the source image.
196
- * @param {number} dw The width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.
197
- * @param {number} dh The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.
189
+ * @param {Image} image - An element to draw into the context. The specification permits any canvas image source (CanvasImageSource), specifically, a CSSImageValue, an HTMLImageElement, an SVGImageElement, an HTMLVideoElement, an HTMLCanvasElement, an ImageBitmap, or an OffscreenCanvas.
190
+ * @param {number} sx - The X coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
191
+ * @param {number} sy - The Y coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
192
+ * @param {number} sw - The width of the sub-rectangle of the source image to draw into the destination context. If not specified, the entire rectangle from the coordinates specified by sx and sy to the bottom-right corner of the image is used.
193
+ * @param {number} sh - The height of the sub-rectangle of the source image to draw into the destination context.
194
+ * @param {number} dx - The X coordinate in the destination canvas at which to place the top-left corner of the source image.
195
+ * @param {number} dy - The Y coordinate in the destination canvas at which to place the top-left corner of the source image.
196
+ * @param {number} dw - The width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.
197
+ * @param {number} dh - The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.
198
198
  * @example
199
199
  * // Position the image on the canvas:
200
200
  * renderer.drawImage(image, dx, dy);
@@ -249,7 +249,7 @@ class CanvasRenderer extends Renderer {
249
249
  * Draw a pattern within the given rectangle.
250
250
  * @name drawPattern
251
251
  * @memberof CanvasRenderer
252
- * @param {CanvasPattern} pattern Pattern object
252
+ * @param {CanvasPattern} pattern - Pattern object
253
253
  * @param {number} x
254
254
  * @param {number} y
255
255
  * @param {number} width
@@ -272,13 +272,13 @@ class CanvasRenderer extends Renderer {
272
272
  * Stroke an arc at the specified coordinates with given radius, start and end points
273
273
  * @name strokeArc
274
274
  * @memberof CanvasRenderer
275
- * @param {number} x arc center point x-axis
276
- * @param {number} y arc center point y-axis
275
+ * @param {number} x - arc center point x-axis
276
+ * @param {number} y - arc center point y-axis
277
277
  * @param {number} radius
278
- * @param {number} start start angle in radians
279
- * @param {number} end end angle in radians
280
- * @param {boolean} [antiClockwise=false] draw arc anti-clockwise
281
- * @param {boolean} [fill=false] also fill the shape with the current color if true
278
+ * @param {number} start - start angle in radians
279
+ * @param {number} end - end angle in radians
280
+ * @param {boolean} [antiClockwise=false] - draw arc anti-clockwise
281
+ * @param {boolean} [fill=false] - also fill the shape with the current color if true
282
282
  */
283
283
  strokeArc(x, y, radius, start, end, antiClockwise, fill = false) {
284
284
  if (this.getGlobalAlpha() < 1 / 255) {
@@ -298,12 +298,12 @@ class CanvasRenderer extends Renderer {
298
298
  * Fill an arc at the specified coordinates with given radius, start and end points
299
299
  * @name fillArc
300
300
  * @memberof CanvasRenderer
301
- * @param {number} x arc center point x-axis
302
- * @param {number} y arc center point y-axis
301
+ * @param {number} x - arc center point x-axis
302
+ * @param {number} y - arc center point y-axis
303
303
  * @param {number} radius
304
- * @param {number} start start angle in radians
305
- * @param {number} end end angle in radians
306
- * @param {boolean} [antiClockwise=false] draw arc anti-clockwise
304
+ * @param {number} start - start angle in radians
305
+ * @param {number} end - end angle in radians
306
+ * @param {boolean} [antiClockwise=false] - draw arc anti-clockwise
307
307
  */
308
308
  fillArc(x, y, radius, start, end, antiClockwise) {
309
309
  this.strokeArc(x, y, radius, start, end, antiClockwise || false, true);
@@ -313,11 +313,11 @@ class CanvasRenderer extends Renderer {
313
313
  * Stroke an ellipse at the specified coordinates with given radius
314
314
  * @name strokeEllipse
315
315
  * @memberof CanvasRenderer
316
- * @param {number} x ellipse center point x-axis
317
- * @param {number} y ellipse center point y-axis
318
- * @param {number} w horizontal radius of the ellipse
319
- * @param {number} h vertical radius of the ellipse
320
- * @param {boolean} [fill=false] also fill the shape with the current color if true
316
+ * @param {number} x - ellipse center point x-axis
317
+ * @param {number} y - ellipse center point y-axis
318
+ * @param {number} w - horizontal radius of the ellipse
319
+ * @param {number} h - vertical radius of the ellipse
320
+ * @param {boolean} [fill=false] - also fill the shape with the current color if true
321
321
  */
322
322
  strokeEllipse(x, y, w, h, fill = false) {
323
323
  if (this.getGlobalAlpha() < 1 / 255) {
@@ -354,10 +354,10 @@ class CanvasRenderer extends Renderer {
354
354
  * Fill an ellipse at the specified coordinates with given radius
355
355
  * @name fillEllipse
356
356
  * @memberof CanvasRenderer
357
- * @param {number} x ellipse center point x-axis
358
- * @param {number} y ellipse center point y-axis
359
- * @param {number} w horizontal radius of the ellipse
360
- * @param {number} h vertical radius of the ellipse
357
+ * @param {number} x - ellipse center point x-axis
358
+ * @param {number} y - ellipse center point y-axis
359
+ * @param {number} w - horizontal radius of the ellipse
360
+ * @param {number} h - vertical radius of the ellipse
361
361
  */
362
362
  fillEllipse(x, y, w, h) {
363
363
  this.strokeEllipse(x, y, w, h, true);
@@ -367,10 +367,10 @@ class CanvasRenderer extends Renderer {
367
367
  * Stroke a line of the given two points
368
368
  * @name strokeLine
369
369
  * @memberof CanvasRenderer
370
- * @param {number} startX the start x coordinate
371
- * @param {number} startY the start y coordinate
372
- * @param {number} endX the end x coordinate
373
- * @param {number} endY the end y coordinate
370
+ * @param {number} startX - the start x coordinate
371
+ * @param {number} startY - the start y coordinate
372
+ * @param {number} endX - the end x coordinate
373
+ * @param {number} endY - the end y coordinate
374
374
  */
375
375
  strokeLine(startX, startY, endX, endY) {
376
376
  if (this.getGlobalAlpha() < 1 / 255) {
@@ -390,10 +390,10 @@ class CanvasRenderer extends Renderer {
390
390
  * Fill a line of the given two points
391
391
  * @name fillLine
392
392
  * @memberof CanvasRenderer
393
- * @param {number} startX the start x coordinate
394
- * @param {number} startY the start y coordinate
395
- * @param {number} endX the end x coordinate
396
- * @param {number} endY the end y coordinate
393
+ * @param {number} startX - the start x coordinate
394
+ * @param {number} startY - the start y coordinate
395
+ * @param {number} endX - the end x coordinate
396
+ * @param {number} endY - the end y coordinate
397
397
  */
398
398
  fillLine(startX, startY, endX, endY) {
399
399
  this.strokeLine(startX, startY, endX, endY);
@@ -403,8 +403,8 @@ class CanvasRenderer extends Renderer {
403
403
  * Stroke the given me.Polygon on the screen
404
404
  * @name strokePolygon
405
405
  * @memberof CanvasRenderer
406
- * @param {Polygon} poly the shape to draw
407
- * @param {boolean} [fill=false] also fill the shape with the current color if true
406
+ * @param {Polygon} poly - the shape to draw
407
+ * @param {boolean} [fill=false] - also fill the shape with the current color if true
408
408
  */
409
409
  strokePolygon(poly, fill = false) {
410
410
  if (this.getGlobalAlpha() < 1 / 255) {
@@ -431,7 +431,7 @@ class CanvasRenderer extends Renderer {
431
431
  * Fill the given me.Polygon on the screen
432
432
  * @name fillPolygon
433
433
  * @memberof CanvasRenderer
434
- * @param {Polygon} poly the shape to draw
434
+ * @param {Polygon} poly - the shape to draw
435
435
  */
436
436
  fillPolygon(poly) {
437
437
  this.strokePolygon(poly, true);
@@ -445,7 +445,7 @@ class CanvasRenderer extends Renderer {
445
445
  * @param {number} y
446
446
  * @param {number} width
447
447
  * @param {number} height
448
- * @param {boolean} [fill=false] also fill the shape with the current color if true
448
+ * @param {boolean} [fill=false] - also fill the shape with the current color if true
449
449
  */
450
450
  strokeRect(x, y, width, height, fill = false) {
451
451
  if (this.getGlobalAlpha() < 1 / 255) {
@@ -479,7 +479,7 @@ class CanvasRenderer extends Renderer {
479
479
  * @param {number} width
480
480
  * @param {number} height
481
481
  * @param {number} radius
482
- * @param {boolean} [fill=false] also fill the shape with the current color if true
482
+ * @param {boolean} [fill=false] - also fill the shape with the current color if true
483
483
  */
484
484
  strokeRoundRect(x, y, width, height, radius, fill = false) {
485
485
  if (this.getGlobalAlpha() < 1 / 255) {
@@ -567,7 +567,7 @@ class CanvasRenderer extends Renderer {
567
567
  * rotates the canvas context
568
568
  * @name rotate
569
569
  * @memberof CanvasRenderer
570
- * @param {number} angle in radians
570
+ * @param {number} angle - in radians
571
571
  */
572
572
  rotate(angle) {
573
573
  this.getContext().rotate(angle);
@@ -589,7 +589,7 @@ class CanvasRenderer extends Renderer {
589
589
  * By default, or upon reset, the value is set to #000000.
590
590
  * @name setColor
591
591
  * @memberof CanvasRenderer
592
- * @param {Color|string} color css color value
592
+ * @param {Color|string} color - css color value
593
593
  */
594
594
  setColor(color) {
595
595
  var context = this.getContext();
@@ -605,7 +605,7 @@ class CanvasRenderer extends Renderer {
605
605
  * Set the global alpha
606
606
  * @name setGlobalAlpha
607
607
  * @memberof CanvasRenderer
608
- * @param {number} alpha 0.0 to 1.0 values accepted.
608
+ * @param {number} alpha - 0.0 to 1.0 values accepted.
609
609
  */
610
610
  setGlobalAlpha(alpha) {
611
611
  this.getContext().globalAlpha = this.currentColor.glArray[3] = alpha;
@@ -625,7 +625,7 @@ class CanvasRenderer extends Renderer {
625
625
  * Set the line width on the context
626
626
  * @name setLineWidth
627
627
  * @memberof CanvasRenderer
628
- * @param {number} width Line width
628
+ * @param {number} width - Line width
629
629
  */
630
630
  setLineWidth(width) {
631
631
  this.getContext().lineWidth = width;
@@ -636,7 +636,7 @@ class CanvasRenderer extends Renderer {
636
636
  * identity one, and then apply the given transformation matrix.
637
637
  * @name setTransform
638
638
  * @memberof CanvasRenderer
639
- * @param {Matrix2d} mat2d Matrix to transform by
639
+ * @param {Matrix2d} mat2d - Matrix to transform by
640
640
  */
641
641
  setTransform(mat2d) {
642
642
  this.resetTransform();
@@ -647,7 +647,7 @@ class CanvasRenderer extends Renderer {
647
647
  * Multiply given matrix into the renderer tranformation matrix
648
648
  * @name transform
649
649
  * @memberof CanvasRenderer
650
- * @param {Matrix2d} mat2d Matrix to transform by
650
+ * @param {Matrix2d} mat2d - Matrix to transform by
651
651
  */
652
652
  transform(mat2d) {
653
653
  var m = mat2d.toArray(),
@@ -721,8 +721,8 @@ class CanvasRenderer extends Renderer {
721
721
  * Mask are not preserved through renderer context save and restore.
722
722
  * @name setMask
723
723
  * @memberof CanvasRenderer
724
- * @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
725
- * @param {boolean} [invert=false] either the given shape should define what is visible (default) or the opposite
724
+ * @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] - the shape defining the mask to be applied
725
+ * @param {boolean} [invert=false] - either the given shape should define what is visible (default) or the opposite
726
726
  */
727
727
  setMask(mask, invert = false) {
728
728
  var context = this.getContext();
@@ -795,4 +795,3 @@ class CanvasRenderer extends Renderer {
795
795
  }
796
796
  }
797
797
  }
798
- export default CanvasRenderer;