melonjs 15.3.0 → 15.4.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 (287) hide show
  1. package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +1 -1
  2. package/dist/melonjs.mjs/_virtual/earcut.js +1 -1
  3. package/dist/melonjs.mjs/_virtual/howler.js +1 -1
  4. package/dist/melonjs.mjs/_virtual/index.js +1 -1
  5. package/dist/melonjs.mjs/application/application.js +53 -5
  6. package/dist/melonjs.mjs/application/header.js +2 -2
  7. package/dist/melonjs.mjs/application/resize.js +4 -8
  8. package/dist/melonjs.mjs/application/settings.js +5 -5
  9. package/dist/melonjs.mjs/audio/audio.js +4 -6
  10. package/dist/melonjs.mjs/camera/camera2d.js +12 -14
  11. package/dist/melonjs.mjs/const.js +1 -1
  12. package/dist/melonjs.mjs/entity/entity.js +3 -4
  13. package/dist/melonjs.mjs/geometries/ellipse.js +26 -59
  14. package/dist/melonjs.mjs/geometries/line.js +18 -25
  15. package/dist/melonjs.mjs/geometries/path2d.js +16 -13
  16. package/dist/melonjs.mjs/geometries/point.js +8 -16
  17. package/dist/melonjs.mjs/geometries/poly.js +40 -97
  18. package/dist/melonjs.mjs/geometries/rectangle.js +37 -91
  19. package/dist/melonjs.mjs/geometries/roundrect.js +26 -35
  20. package/dist/melonjs.mjs/index.js +6 -6
  21. package/dist/melonjs.mjs/input/gamepad.js +1 -1
  22. package/dist/melonjs.mjs/input/input.js +1 -1
  23. package/dist/melonjs.mjs/input/keyboard.js +3 -3
  24. package/dist/melonjs.mjs/input/pointer.js +4 -4
  25. package/dist/melonjs.mjs/input/pointerevent.js +6 -7
  26. package/dist/melonjs.mjs/lang/console.js +1 -1
  27. package/dist/melonjs.mjs/lang/deprecated.js +2 -2
  28. package/dist/melonjs.mjs/level/level.js +1 -1
  29. package/dist/melonjs.mjs/level/tiled/TMXGroup.js +1 -1
  30. package/dist/melonjs.mjs/level/tiled/TMXLayer.js +16 -33
  31. package/dist/melonjs.mjs/level/tiled/TMXObject.js +3 -4
  32. package/dist/melonjs.mjs/level/tiled/TMXTile.js +4 -4
  33. package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +3 -3
  34. package/dist/melonjs.mjs/level/tiled/TMXTileset.js +4 -7
  35. package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +2 -2
  36. package/dist/melonjs.mjs/level/tiled/TMXUtils.js +26 -29
  37. package/dist/melonjs.mjs/level/tiled/constants.js +1 -1
  38. package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +3 -3
  39. package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +2 -2
  40. package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +2 -2
  41. package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +2 -2
  42. package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +2 -2
  43. package/dist/melonjs.mjs/level/tiled/renderer/autodetect.js +1 -1
  44. package/dist/melonjs.mjs/loader/cache.js +1 -1
  45. package/dist/melonjs.mjs/loader/loader.js +1 -1
  46. package/dist/melonjs.mjs/loader/loadingscreen.js +1 -1
  47. package/dist/melonjs.mjs/loader/melonjs_logo.png.js +1 -1
  48. package/dist/melonjs.mjs/loader/parser.js +4 -5
  49. package/dist/melonjs.mjs/loader/settings.js +1 -1
  50. package/dist/melonjs.mjs/math/color.js +2 -2
  51. package/dist/melonjs.mjs/math/math.js +1 -1
  52. package/dist/melonjs.mjs/math/matrix2.js +5 -59
  53. package/dist/melonjs.mjs/math/matrix3.js +82 -141
  54. package/dist/melonjs.mjs/math/observable_vector2.js +7 -7
  55. package/dist/melonjs.mjs/math/observable_vector3.js +5 -5
  56. package/dist/melonjs.mjs/math/vector2.js +7 -91
  57. package/dist/melonjs.mjs/math/vector3.js +6 -90
  58. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/arraymultimap.js +1 -1
  59. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/multimap.js +1 -1
  60. package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +1 -1
  61. package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +1 -1
  62. package/dist/melonjs.mjs/node_modules/eventemitter3/index2.js +1 -1
  63. package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +1 -1
  64. package/dist/melonjs.mjs/particles/emitter.js +2 -2
  65. package/dist/melonjs.mjs/particles/particle.js +2 -2
  66. package/dist/melonjs.mjs/particles/settings.js +1 -1
  67. package/dist/melonjs.mjs/physics/body.js +22 -20
  68. package/dist/melonjs.mjs/physics/bounds.js +27 -33
  69. package/dist/melonjs.mjs/physics/collision.js +5 -5
  70. package/dist/melonjs.mjs/physics/detector.js +10 -10
  71. package/dist/melonjs.mjs/physics/quadtree.js +5 -5
  72. package/dist/melonjs.mjs/physics/response.js +1 -1
  73. package/dist/melonjs.mjs/physics/sat.js +3 -4
  74. package/dist/melonjs.mjs/physics/world.js +6 -9
  75. package/dist/melonjs.mjs/plugin/plugin.js +3 -3
  76. package/dist/melonjs.mjs/renderable/collectable.js +2 -2
  77. package/dist/melonjs.mjs/renderable/colorlayer.js +4 -4
  78. package/dist/melonjs.mjs/renderable/container.js +25 -25
  79. package/dist/melonjs.mjs/renderable/draggable.js +1 -1
  80. package/dist/melonjs.mjs/renderable/dragndrop.js +1 -1
  81. package/dist/melonjs.mjs/renderable/imagelayer.js +4 -4
  82. package/dist/melonjs.mjs/renderable/light2d.js +3 -3
  83. package/dist/melonjs.mjs/renderable/nineslicesprite.js +2 -2
  84. package/dist/melonjs.mjs/renderable/renderable.js +26 -26
  85. package/dist/melonjs.mjs/renderable/sprite.js +3 -3
  86. package/dist/melonjs.mjs/renderable/text/bitmaptext.js +421 -0
  87. package/dist/melonjs.mjs/renderable/text/bitmaptextdata.js +195 -0
  88. package/dist/melonjs.mjs/renderable/text/glyph.js +65 -0
  89. package/dist/melonjs.mjs/renderable/text/text.js +422 -0
  90. package/dist/melonjs.mjs/renderable/text/textmetrics.js +175 -0
  91. package/dist/melonjs.mjs/renderable/text/textstyle.js +21 -0
  92. package/dist/melonjs.mjs/renderable/trigger.js +10 -10
  93. package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +7 -7
  94. package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +7 -7
  95. package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +3 -3
  96. package/dist/melonjs.mjs/state/stage.js +2 -2
  97. package/dist/melonjs.mjs/state/state.js +1 -38
  98. package/dist/melonjs.mjs/system/device.js +49 -10
  99. package/dist/melonjs.mjs/system/dom.js +1 -1
  100. package/dist/melonjs.mjs/system/event.js +24 -2
  101. package/dist/melonjs.mjs/system/platform.js +18 -18
  102. package/dist/melonjs.mjs/system/pooling.js +10 -10
  103. package/dist/melonjs.mjs/system/save.js +1 -1
  104. package/dist/melonjs.mjs/system/timer.js +1 -1
  105. package/dist/melonjs.mjs/text/bitmaptext.js +1 -1
  106. package/dist/melonjs.mjs/text/bitmaptextdata.js +3 -6
  107. package/dist/melonjs.mjs/text/glyph.js +1 -1
  108. package/dist/melonjs.mjs/text/text.js +1 -1
  109. package/dist/melonjs.mjs/text/textmetrics.js +1 -1
  110. package/dist/melonjs.mjs/text/textstyle.js +1 -1
  111. package/dist/melonjs.mjs/tweens/easing.js +1 -1
  112. package/dist/melonjs.mjs/tweens/interpolation.js +1 -1
  113. package/dist/melonjs.mjs/tweens/tween.js +2 -2
  114. package/dist/melonjs.mjs/utils/agent.js +1 -1
  115. package/dist/melonjs.mjs/utils/array.js +1 -1
  116. package/dist/melonjs.mjs/utils/file.js +1 -1
  117. package/dist/melonjs.mjs/utils/function.js +2 -3
  118. package/dist/melonjs.mjs/utils/string.js +1 -1
  119. package/dist/melonjs.mjs/utils/utils.js +1 -1
  120. package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +3 -7
  121. package/dist/melonjs.mjs/video/renderer.js +16 -16
  122. package/dist/melonjs.mjs/video/texture/atlas.js +13 -13
  123. package/dist/melonjs.mjs/video/texture/cache.js +1 -1
  124. package/dist/melonjs.mjs/video/texture/canvas_texture.js +15 -15
  125. package/dist/melonjs.mjs/video/utils/autodetect.js +1 -1
  126. package/dist/melonjs.mjs/video/video.js +4 -4
  127. package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +3 -3
  128. package/dist/melonjs.mjs/video/webgl/compositors/compositor.js +13 -14
  129. package/dist/melonjs.mjs/video/webgl/compositors/primitive_compositor.js +5 -5
  130. package/dist/melonjs.mjs/video/webgl/compositors/quad_compositor.js +2 -3
  131. package/dist/melonjs.mjs/video/webgl/glshader.js +2 -2
  132. package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +1 -1
  133. package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +1 -1
  134. package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +1 -1
  135. package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +1 -1
  136. package/dist/melonjs.mjs/video/webgl/utils/attributes.js +1 -1
  137. package/dist/melonjs.mjs/video/webgl/utils/precision.js +4 -4
  138. package/dist/melonjs.mjs/video/webgl/utils/program.js +1 -1
  139. package/dist/melonjs.mjs/video/webgl/utils/string.js +1 -1
  140. package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +1 -1
  141. package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +50 -52
  142. package/dist/melonjs.module.js +1137 -1576
  143. package/dist/types/application/application.d.ts +28 -4
  144. package/dist/types/application/header.d.ts +2 -2
  145. package/dist/types/application/settings.d.ts +23 -23
  146. package/dist/types/audio/audio.d.ts +4 -6
  147. package/dist/types/camera/camera2d.d.ts +13 -16
  148. package/dist/types/entity/entity.d.ts +0 -1
  149. package/dist/types/geometries/ellipse.d.ts +18 -50
  150. package/dist/types/geometries/path2d.d.ts +1 -1
  151. package/dist/types/geometries/point.d.ts +5 -13
  152. package/dist/types/geometries/poly.d.ts +26 -75
  153. package/dist/types/geometries/rectangle.d.ts +12 -58
  154. package/dist/types/geometries/roundrect.d.ts +2 -11
  155. package/dist/types/index.d.ts +3 -3
  156. package/dist/types/input/gamepad.d.ts +31 -31
  157. package/dist/types/input/keyboard.d.ts +105 -105
  158. package/dist/types/input/pointer.d.ts +21 -21
  159. package/dist/types/input/pointerevent.d.ts +6 -6
  160. package/dist/types/level/tiled/TMXLayer.d.ts +1 -1
  161. package/dist/types/math/matrix2.d.ts +9 -63
  162. package/dist/types/math/matrix3.d.ts +9 -68
  163. package/dist/types/math/observable_vector2.d.ts +2 -2
  164. package/dist/types/math/observable_vector3.d.ts +2 -2
  165. package/dist/types/math/vector2.d.ts +8 -92
  166. package/dist/types/math/vector3.d.ts +8 -92
  167. package/dist/types/particles/settings.d.ts +29 -29
  168. package/dist/types/physics/body.d.ts +10 -8
  169. package/dist/types/physics/bounds.d.ts +24 -30
  170. package/dist/types/physics/collision.d.ts +12 -12
  171. package/dist/types/physics/detector.d.ts +1 -1
  172. package/dist/types/physics/world.d.ts +4 -7
  173. package/dist/types/renderable/container.d.ts +19 -19
  174. package/dist/types/renderable/imagelayer.d.ts +6 -6
  175. package/dist/types/renderable/light2d.d.ts +7 -7
  176. package/dist/types/renderable/renderable.d.ts +9 -16
  177. package/dist/types/renderable/text/bitmaptext.d.ts +151 -0
  178. package/dist/types/renderable/text/bitmaptextdata.d.ts +35 -0
  179. package/dist/types/renderable/text/glyph.d.ts +28 -0
  180. package/dist/types/renderable/text/text.d.ts +159 -0
  181. package/dist/types/renderable/text/textmetrics.d.ts +47 -0
  182. package/dist/types/renderable/text/textstyle.d.ts +5 -0
  183. package/dist/types/renderable/ui/uibaseelement.d.ts +0 -1
  184. package/dist/types/renderable/ui/uispriteelement.d.ts +0 -1
  185. package/dist/types/renderable/ui/uitextbutton.d.ts +2 -7
  186. package/dist/types/state/state.d.ts +11 -11
  187. package/dist/types/system/device.d.ts +15 -9
  188. package/dist/types/system/event.d.ts +20 -0
  189. package/dist/types/system/platform.d.ts +17 -17
  190. package/dist/types/utils/function.d.ts +1 -2
  191. package/dist/types/video/renderer.d.ts +13 -13
  192. package/dist/types/video/texture/canvas_texture.d.ts +14 -14
  193. package/dist/types/video/video.d.ts +2 -2
  194. package/dist/types/video/webgl/buffer/vertex.d.ts +2 -2
  195. package/dist/types/video/webgl/compositors/compositor.d.ts +24 -13
  196. package/dist/types/video/webgl/compositors/primitive_compositor.d.ts +0 -1
  197. package/dist/types/video/webgl/compositors/quad_compositor.d.ts +0 -1
  198. package/dist/types/video/webgl/utils/precision.d.ts +1 -1
  199. package/dist/types/video/webgl/webgl_renderer.d.ts +47 -50
  200. package/package.json +15 -15
  201. package/src/application/application.js +51 -3
  202. package/src/application/header.js +1 -1
  203. package/src/application/resize.js +3 -7
  204. package/src/application/settings.js +4 -4
  205. package/src/audio/audio.js +3 -5
  206. package/src/camera/camera2d.js +11 -13
  207. package/src/entity/entity.js +2 -3
  208. package/src/geometries/ellipse.js +25 -58
  209. package/src/geometries/line.js +17 -24
  210. package/src/geometries/path2d.js +15 -12
  211. package/src/geometries/point.js +7 -15
  212. package/src/geometries/poly.js +39 -96
  213. package/src/geometries/rectangle.js +36 -90
  214. package/src/geometries/roundrect.js +25 -34
  215. package/src/index.js +4 -4
  216. package/src/input/keyboard.js +2 -2
  217. package/src/input/pointer.js +3 -3
  218. package/src/input/pointerevent.js +5 -6
  219. package/src/lang/deprecated.js +1 -1
  220. package/src/level/tiled/TMXLayer.js +15 -32
  221. package/src/level/tiled/TMXObject.js +2 -3
  222. package/src/level/tiled/TMXTile.js +3 -3
  223. package/src/level/tiled/TMXTileMap.js +2 -2
  224. package/src/level/tiled/TMXTileset.js +3 -6
  225. package/src/level/tiled/TMXTilesetGroup.js +1 -1
  226. package/src/level/tiled/TMXUtils.js +25 -28
  227. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +2 -2
  228. package/src/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
  229. package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -1
  230. package/src/level/tiled/renderer/TMXRenderer.js +1 -1
  231. package/src/level/tiled/renderer/TMXStaggeredRenderer.js +1 -1
  232. package/src/loader/parser.js +3 -4
  233. package/src/math/color.js +1 -1
  234. package/src/math/matrix2.js +4 -58
  235. package/src/math/matrix3.js +81 -140
  236. package/src/math/observable_vector2.js +6 -6
  237. package/src/math/observable_vector3.js +4 -4
  238. package/src/math/vector2.js +6 -90
  239. package/src/math/vector3.js +5 -89
  240. package/src/particles/emitter.js +1 -1
  241. package/src/particles/particle.js +1 -1
  242. package/src/physics/body.js +21 -19
  243. package/src/physics/bounds.js +26 -32
  244. package/src/physics/collision.js +4 -4
  245. package/src/physics/detector.js +9 -9
  246. package/src/physics/quadtree.js +4 -4
  247. package/src/physics/sat.js +2 -3
  248. package/src/physics/world.js +5 -8
  249. package/src/polyfill/roundrect.js +163 -163
  250. package/src/renderable/collectable.js +1 -1
  251. package/src/renderable/colorlayer.js +3 -3
  252. package/src/renderable/container.js +24 -24
  253. package/src/renderable/imagelayer.js +3 -3
  254. package/src/renderable/light2d.js +2 -2
  255. package/src/renderable/nineslicesprite.js +1 -1
  256. package/src/renderable/renderable.js +25 -25
  257. package/src/renderable/sprite.js +2 -2
  258. package/src/{text → renderable/text}/bitmaptext.js +8 -8
  259. package/src/{text → renderable/text}/bitmaptextdata.js +4 -7
  260. package/src/{text → renderable/text}/glyph.js +1 -1
  261. package/src/{text → renderable/text}/text.js +16 -17
  262. package/src/{text → renderable/text}/textmetrics.js +2 -2
  263. package/src/renderable/trigger.js +9 -9
  264. package/src/renderable/ui/uibaseelement.js +6 -6
  265. package/src/renderable/ui/uispriteelement.js +6 -6
  266. package/src/renderable/ui/uitextbutton.js +2 -2
  267. package/src/state/stage.js +1 -1
  268. package/src/state/state.js +0 -49
  269. package/src/system/device.js +48 -9
  270. package/src/system/event.js +22 -0
  271. package/src/system/platform.js +18 -18
  272. package/src/system/pooling.js +9 -9
  273. package/src/tweens/tween.js +1 -1
  274. package/src/utils/function.js +1 -2
  275. package/src/video/canvas/canvas_renderer.js +2 -6
  276. package/src/video/renderer.js +15 -15
  277. package/src/video/texture/atlas.js +12 -12
  278. package/src/video/texture/canvas_texture.js +14 -14
  279. package/src/video/video.js +3 -3
  280. package/src/video/webgl/buffer/vertex.js +2 -2
  281. package/src/video/webgl/compositors/compositor.js +12 -13
  282. package/src/video/webgl/compositors/primitive_compositor.js +4 -4
  283. package/src/video/webgl/compositors/quad_compositor.js +1 -2
  284. package/src/video/webgl/glshader.js +1 -1
  285. package/src/video/webgl/utils/precision.js +3 -3
  286. package/src/video/webgl/webgl_renderer.js +49 -51
  287. /package/src/{text → renderable/text}/textstyle.js +0 -0
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.3.0
2
+ * melonJS Game Engine - v15.4.0
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -19,7 +19,7 @@ import { emit, on, ONCONTEXT_LOST, ONCONTEXT_RESTORED, GAME_RESET } from '../../
19
19
  * a canvas renderer object
20
20
  * @augments Renderer
21
21
  */
22
- class CanvasRenderer extends Renderer {
22
+ class CanvasRenderer extends Renderer {
23
23
  /**
24
24
  * @param {Application.Settings} [options] - optional parameters for the renderer
25
25
  */
@@ -534,11 +534,7 @@ import { emit, on, ONCONTEXT_LOST, ONCONTEXT_RESTORED, GAME_RESET } from '../../
534
534
  setColor(color) {
535
535
  let context = this.getContext();
536
536
  context.strokeStyle =
537
- context.fillStyle = (
538
- color instanceof Color ?
539
- color.toRGBA() :
540
- color
541
- );
537
+ context.fillStyle = (color instanceof Color ? color.toRGBA() : color);
542
538
  }
543
539
 
544
540
  /**
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.3.0
2
+ * melonJS Game Engine - v15.4.0
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -25,7 +25,7 @@ import Point from '../geometries/point.js';
25
25
  * @classdesc
26
26
  * a base renderer object
27
27
  */
28
- class Renderer {
28
+ class Renderer {
29
29
  /**
30
30
  * @param {Application.Settings} [options] - optional parameters for the renderer
31
31
  */
@@ -40,7 +40,7 @@ import Point from '../geometries/point.js';
40
40
  /**
41
41
  * the requested video size ratio
42
42
  * @public
43
- * @type {Number}
43
+ * @type {number}
44
44
  */
45
45
  this.designRatio = this.settings.width / this.settings.height;
46
46
 
@@ -197,7 +197,7 @@ import Point from '../geometries/point.js';
197
197
  }
198
198
 
199
199
  let _context = canvas.getContext("2d", {
200
- "alpha" : transparent
200
+ "alpha" : transparent
201
201
  });
202
202
 
203
203
  if (!_context.canvas) {
@@ -413,10 +413,10 @@ import Point from '../geometries/point.js';
413
413
 
414
414
  /**
415
415
  * creates a Blob object representing the last rendered frame
416
- * @param {Object} [options] - An object with the following properties:
417
- * @param {String} [options.type="image/png"] - A string indicating the image format
418
- * @param {Number} [options.quality] - A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.
419
- * @return {Promise} A Promise returning a Blob object representing the last rendered frame
416
+ * @param {object} [options] - An object with the following properties:
417
+ * @param {string} [options.type="image/png"] - A string indicating the image format
418
+ * @param {number} [options.quality] - A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.
419
+ * @returns {Promise} A Promise returning a Blob object representing the last rendered frame
420
420
  * @example
421
421
  * renderer.convertToBlob().then((blob) => console.log(blob));
422
422
  */
@@ -433,10 +433,10 @@ import Point from '../geometries/point.js';
433
433
  /**
434
434
  * creates an ImageBitmap object of the last frame rendered
435
435
  * (not supported by standard Canvas)
436
- * @param {Object} [options] - An object with the following properties:
437
- * @param {String} [options.type="image/png"] - A string indicating the image format
438
- * @param {Number} [options.quality] - A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.
439
- * @return {Promise} A Promise returning an ImageBitmap.
436
+ * @param {object} [options] - An object with the following properties:
437
+ * @param {string} [options.type="image/png"] - A string indicating the image format
438
+ * @param {number} [options.quality] - A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.
439
+ * @returns {Promise} A Promise returning an ImageBitmap.
440
440
  * @example
441
441
  * renderer.transferToImageBitmap().then((image) => console.log(image));
442
442
  */
@@ -454,10 +454,10 @@ import Point from '../geometries/point.js';
454
454
 
455
455
  /**
456
456
  * returns a data URL containing a representation of the last frame rendered
457
- * @param {Object} [options] - An object with the following properties:
458
- * @param {String} [options.type="image/png"] - A string indicating the image format
459
- * @param {Number} [options.quality] - A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.
460
- * @return {Promise} A Promise returning a string containing the requested data URL.
457
+ * @param {object} [options] - An object with the following properties:
458
+ * @param {string} [options.type="image/png"] - A string indicating the image format
459
+ * @param {number} [options.quality] - A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.
460
+ * @returns {Promise} A Promise returning a string containing the requested data URL.
461
461
  * @example
462
462
  * renderer.toDataURL().then((dataURL) => console.log(dataURL));
463
463
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.3.0
2
+ * melonJS Game Engine - v15.4.0
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -17,18 +17,18 @@ import { ETA } from '../../math/math.js';
17
17
  * @ignore
18
18
  */
19
19
  function createAtlas(width, height, name = "default", repeat = "no-repeat") {
20
- return {
21
- "meta" : {
22
- "app" : "melonJS",
23
- "size" : { "w" : width, "h" : height },
24
- "repeat" : repeat,
25
- "image" : "default"
26
- },
27
- "frames" : [{
28
- "filename" : name,
29
- "frame" : { "x" : 0, "y" : 0, "w" : width, "h" : height }
30
- }]
31
- };
20
+ return {
21
+ "meta" : {
22
+ "app" : "melonJS",
23
+ "size" : { "w" : width, "h" : height },
24
+ "repeat" : repeat,
25
+ "image" : "default"
26
+ },
27
+ "frames" : [{
28
+ "filename" : name,
29
+ "frame" : { "x" : 0, "y" : 0, "w" : width, "h" : height }
30
+ }]
31
+ };
32
32
  }
33
33
 
34
34
  /**
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.3.0
2
+ * melonJS Game Engine - v15.4.0
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.3.0
2
+ * melonJS Game Engine - v15.4.0
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -69,7 +69,7 @@ class CanvasTexture {
69
69
 
70
70
  /**
71
71
  * enable/disable image smoothing (scaling interpolation)
72
- * @param {boolean} [enable=false]
72
+ * @param {boolean} [enable=false] - whether to enable or not image smoothing (scaling interpolation)
73
73
  */
74
74
  setAntiAlias(enable = false) {
75
75
  let canvas = this.canvas;
@@ -112,7 +112,7 @@ class CanvasTexture {
112
112
  * @param {number} y - The y-axis coordinate of the top-left corner of the rectangle from which the ImageData will be extracted
113
113
  * @param {number} width - The width of the rectangle from which the ImageData will be extracted. Positive values are to the right, and negative to the left
114
114
  * @param {number} height - The height of the rectangle from which the ImageData will be extracted. Positive values are down, and negative are up
115
- * @return {ImageData} The ImageData extracted from this CanvasTexture.
115
+ * @returns {ImageData} The ImageData extracted from this CanvasTexture.
116
116
  */
117
117
  getImageData(x, y, width, height) {
118
118
  // clamp values
@@ -126,10 +126,10 @@ class CanvasTexture {
126
126
 
127
127
  /**
128
128
  * creates a Blob object representing the image contained in this canvas texture
129
- * @param {Object} [options] - An object with the following properties:
130
- * @param {String} [options.type="image/png"] - A string indicating the image format
131
- * @param {Number} [options.quality] - A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.
132
- * @return {Promise} A Promise returning a Blob object representing the image contained in this canvas texture
129
+ * @param {object} [options] - An object with the following properties:
130
+ * @param {string} [options.type="image/png"] - A string indicating the image format
131
+ * @param {number} [options.quality] - A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.
132
+ * @returns {Promise} A Promise returning a Blob object representing the image contained in this canvas texture
133
133
  * @example
134
134
  * canvasTexture.convertToBlob().then((blob) => console.log(blob));
135
135
  */
@@ -147,10 +147,10 @@ class CanvasTexture {
147
147
 
148
148
  /**
149
149
  * creates an ImageBitmap object from the most recently rendered image of this canvas texture
150
- * @param {Object} [options] - An object with the following properties:
151
- * @param {String} [options.type="image/png"] - A string indicating the image format
152
- * @param {Number} [options.quality] - A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.
153
- * @return {Promise} A Promise returning an ImageBitmap.
150
+ * @param {object} [options] - An object with the following properties:
151
+ * @param {string} [options.type="image/png"] - A string indicating the image format
152
+ * @param {number} [options.quality] - A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.
153
+ * @returns {Promise} A Promise returning an ImageBitmap.
154
154
  * @example
155
155
  * canvasTexture.transferToImageBitmap().then((bitmap) => console.log(bitmap));
156
156
  */
@@ -171,10 +171,10 @@ class CanvasTexture {
171
171
  /**
172
172
  * returns a data URL containing a representation of the most recently rendered image of this canvas texture
173
173
  * (not supported by OffscreenCanvas)
174
- * @param {Object} [options] - An object with the following properties:
175
- * @param {String} [options.type="image/png"] - A string indicating the image format
176
- * @param {Number} [options.quality] - A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.
177
- * @return {Promise} A Promise returning a string containing the requested data URL.
174
+ * @param {object} [options] - An object with the following properties:
175
+ * @param {string} [options.type="image/png"] - A string indicating the image format
176
+ * @param {number} [options.quality] - A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.
177
+ * @returns {Promise} A Promise returning a string containing the requested data URL.
178
178
  * @example
179
179
  * renderer.toDataURL().then((dataURL) => console.log(dataURL));
180
180
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.3.0
2
+ * melonJS Game Engine - v15.4.0
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.3.0
2
+ * melonJS Game Engine - v15.4.0
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -41,7 +41,7 @@ function init(width, height, options) {
41
41
  }
42
42
 
43
43
  try {
44
- // initialize the default game Application with the given options
44
+ // initialize the default game Application with the given options
45
45
  game.init(width, height, options);
46
46
  } catch (e) {
47
47
  console.log(e.message);
@@ -103,7 +103,7 @@ function init(width, height, options) {
103
103
  * @param {number} width - width
104
104
  * @param {number} height - height
105
105
  * @param {boolean} [returnOffscreenCanvas=false] - will return an OffscreenCanvas if supported
106
- * @returns {HTMLCanvasElement|OffscreenCanvas}
106
+ * @returns {HTMLCanvasElement|OffscreenCanvas} a new Canvas element of the given size
107
107
  */
108
108
  function createCanvas(width, height, returnOffscreenCanvas = false) {
109
109
  let _canvas;
@@ -132,7 +132,7 @@ function createCanvas(width, height, returnOffscreenCanvas = false) {
132
132
  /**
133
133
  * return a reference to the parent DOM element holding the main canvas
134
134
  * @memberof video
135
- * @returns {HTMLElement}
135
+ * @returns {HTMLElement} the HTML parent element
136
136
  */
137
137
  function getParent() {
138
138
  return game.getParentElement();
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.3.0
2
+ * melonJS Game Engine - v15.4.0
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -12,7 +12,7 @@
12
12
  * @ignore
13
13
  */
14
14
 
15
- class VertexArrayBuffer {
15
+ class VertexArrayBuffer {
16
16
 
17
17
  constructor(vertex_size, vertex_per_obj) {
18
18
  // the size of one vertex in float
@@ -45,7 +45,7 @@
45
45
  * @ignore
46
46
  */
47
47
  isFull(vertex = this.objSize) {
48
- return (this.vertexCount + vertex >= this.maxVertex);
48
+ return (this.vertexCount + vertex >= this.maxVertex);
49
49
  }
50
50
 
51
51
  /**
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.3.0
2
+ * melonJS Game Engine - v15.4.0
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -12,19 +12,19 @@ import GLShader from '../glshader.js';
12
12
  * @classdesc
13
13
  * A base Compositor object.
14
14
  */
15
- class Compositor {
15
+ class Compositor {
16
16
  /**
17
17
  * @param {WebGLRenderer} renderer - the current WebGL renderer session
18
- * @param {Object} settings - additional settings to initialize this compositors
19
- * @param {object[]} attribute - an array of attributes definition
20
- * @param {string} attribute.name - name of the attribute in the vertex shader
21
- * @param {number} attribute.size - number of components per vertex attribute. Must be 1, 2, 3, or 4.
22
- * @param {GLenum} attribute.type - data type of each component in the array
23
- * @param {boolean} attribute.normalized - whether integer data values should be normalized into a certain range when being cast to a float
24
- * @param {number} attribute.offset - offset in bytes of the first component in the vertex attribute array
25
- * @param {object} shader - an array of attributes definition
26
- * @param {string} shader.vertex - a string containing the GLSL source code to set
27
- * @param {string} shader.fragment - a string containing the GLSL source code to set
18
+ * @param {object} settings - additional settings to initialize this compositors
19
+ * @param {object[]} settings.attribute - an array of attributes definition
20
+ * @param {string} settings.attribute.name - name of the attribute in the vertex shader
21
+ * @param {number} settings.attribute.size - number of components per vertex attribute. Must be 1, 2, 3, or 4.
22
+ * @param {GLenum} settings.attribute.type - data type of each component in the array
23
+ * @param {boolean} settings.attribute.normalized - whether integer data values should be normalized into a certain range when being cast to a float
24
+ * @param {number} settings.attribute.offset - offset in bytes of the first component in the vertex attribute array
25
+ * @param {object} settings.shader - an array of attributes definition
26
+ * @param {string} settings.shader.vertex - a string containing the GLSL source code to set
27
+ * @param {string} settings.shader.fragment - a string containing the GLSL source code to set
28
28
  */
29
29
  constructor (renderer, settings) {
30
30
  this.init(renderer, settings);
@@ -126,7 +126,6 @@ import GLShader from '../glshader.js';
126
126
  }
127
127
 
128
128
  /**
129
- * @ignore
130
129
  * called by the WebGL renderer when a compositor become the current one
131
130
  */
132
131
  bind() {
@@ -199,7 +198,7 @@ import GLShader from '../glshader.js';
199
198
 
200
199
  /**
201
200
  * set/change the current projection matrix
202
- * @param {Matrix3d} matrix
201
+ * @param {Matrix3d} matrix - the new projection matrix
203
202
  */
204
203
  setProjection(matrix) {
205
204
  this.currentShader.setUniform("uProjectionMatrix", matrix);
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.3.0
2
+ * melonJS Game Engine - v15.4.0
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -15,7 +15,7 @@ import Compositor from './compositor.js';
15
15
  * Pushes texture regions or shape geometry into WebGL buffers, automatically flushes to GPU
16
16
  * @augments Compositor
17
17
  */
18
- class PrimitiveCompositor extends Compositor {
18
+ class PrimitiveCompositor extends Compositor {
19
19
 
20
20
  /**
21
21
  * Initialize the compositor
@@ -42,8 +42,8 @@ import Compositor from './compositor.js';
42
42
  drawVertices(mode, verts, vertexCount = verts.length) {
43
43
  let viewMatrix = this.viewMatrix;
44
44
  let vertexData = this.vertexData;
45
- let color = this.renderer.currentColor;
46
45
  let alpha = this.renderer.getGlobalAlpha();
46
+ let colorUint32 = this.renderer.currentColor.toUint32(alpha);
47
47
 
48
48
  if (vertexData.isFull(vertexCount)) {
49
49
  // is the vertex buffer full if we add more vertices
@@ -59,11 +59,11 @@ import Compositor from './compositor.js';
59
59
  if (!viewMatrix.isIdentity()) {
60
60
  verts.forEach((vert) => {
61
61
  viewMatrix.apply(vert);
62
- vertexData.push(vert.x, vert.y, undefined, undefined, color.toUint32(alpha));
62
+ vertexData.push(vert.x, vert.y, undefined, undefined, colorUint32);
63
63
  });
64
64
  } else {
65
65
  verts.forEach((vert) => {
66
- vertexData.push(vert.x, vert.y, undefined, undefined, color.toUint32(alpha));
66
+ vertexData.push(vert.x, vert.y, undefined, undefined, colorUint32);
67
67
  });
68
68
  }
69
69
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.3.0
2
+ * melonJS Game Engine - v15.4.0
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -25,7 +25,7 @@ let V_ARRAY = [
25
25
  * Pushes texture regions or shape geometry into WebGL buffers, automatically flushes to GPU
26
26
  * @augments Compositor
27
27
  */
28
- class QuadCompositor extends Compositor {
28
+ class QuadCompositor extends Compositor {
29
29
 
30
30
  /**
31
31
  * Initialize the compositor
@@ -115,7 +115,6 @@ let V_ARRAY = [
115
115
  /**
116
116
  * delete the given WebGL texture
117
117
  * @param {WebGLTexture} [texture] - a WebGL texture to delete
118
- * @param {number} [unit] - Texture unit to delete
119
118
  */
120
119
  deleteTexture2D(texture) {
121
120
  this.gl.deleteTexture(texture);
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.3.0
2
+ * melonJS Game Engine - v15.4.0
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -16,7 +16,7 @@ import { minify } from './utils/string.js';
16
16
  * @classdesc
17
17
  * a base GL Shader object
18
18
  */
19
- class GLShader {
19
+ class GLShader {
20
20
  /**
21
21
  * @param {WebGLRenderingContext} gl - the current WebGL rendering context
22
22
  * @param {string} vertex - a string containing the GLSL source code to set
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.3.0
2
+ * melonJS Game Engine - v15.4.0
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.3.0
2
+ * melonJS Game Engine - v15.4.0
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.3.0
2
+ * melonJS Game Engine - v15.4.0
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.3.0
2
+ * melonJS Game Engine - v15.4.0
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.3.0
2
+ * melonJS Game Engine - v15.4.0
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.3.0
2
+ * melonJS Game Engine - v15.4.0
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -20,17 +20,17 @@ function setPrecision(src, precision) {
20
20
  /**
21
21
  * return the highest precision format supported by this device for GL Shaders
22
22
  * @ignore
23
- * @param {WebGLRenderingContext} gl
23
+ * @param {WebGLRenderingContext} gl - the current WebGL context
24
24
  * @returns {boolean} "lowp", "mediump", or "highp"
25
25
  */
26
26
  function getMaxShaderPrecision(gl) {
27
27
  if (gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.HIGH_FLOAT ).precision > 0 &&
28
28
  gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT ).precision > 0) {
29
- return "highp";
29
+ return "highp";
30
30
  }
31
31
  if (gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT ).precision > 0 &&
32
32
  gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT ).precision > 0) {
33
- return "mediump";
33
+ return "mediump";
34
34
  }
35
35
  return "lowp";
36
36
  }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.3.0
2
+ * melonJS Game Engine - v15.4.0
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.3.0
2
+ * melonJS Game Engine - v15.4.0
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.3.0
2
+ * melonJS Game Engine - v15.4.0
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license