melonjs 14.3.0 → 14.5.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 (323) hide show
  1. package/README.md +11 -55
  2. package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +2 -2
  3. package/dist/melonjs.mjs/_virtual/arraymultimap.js +2 -2
  4. package/dist/melonjs.mjs/_virtual/earcut.js +2 -2
  5. package/dist/melonjs.mjs/_virtual/howler.js +2 -2
  6. package/dist/melonjs.mjs/_virtual/index.js +2 -2
  7. package/dist/melonjs.mjs/_virtual/index2.js +2 -2
  8. package/dist/melonjs.mjs/_virtual/multimap.js +2 -2
  9. package/dist/melonjs.mjs/_virtual/setmultimap.js +2 -2
  10. package/dist/melonjs.mjs/application/application.js +8 -21
  11. package/dist/melonjs.mjs/application/header.js +2 -2
  12. package/dist/melonjs.mjs/application/resize.js +4 -2
  13. package/dist/melonjs.mjs/application/settings.js +2 -2
  14. package/dist/melonjs.mjs/audio/audio.js +5 -5
  15. package/dist/melonjs.mjs/camera/camera2d.js +2 -2
  16. package/dist/melonjs.mjs/const.js +32 -0
  17. package/dist/melonjs.mjs/entity/entity.js +44 -10
  18. package/dist/melonjs.mjs/geometries/ellipse.js +3 -4
  19. package/dist/melonjs.mjs/geometries/line.js +2 -2
  20. package/dist/melonjs.mjs/geometries/path2d.js +19 -43
  21. package/dist/melonjs.mjs/geometries/point.js +2 -7
  22. package/dist/melonjs.mjs/geometries/poly.js +3 -6
  23. package/dist/melonjs.mjs/geometries/rectangle.js +14 -10
  24. package/dist/melonjs.mjs/geometries/roundrect.js +2 -2
  25. package/dist/melonjs.mjs/index.js +11 -9
  26. package/dist/melonjs.mjs/input/gamepad.js +11 -17
  27. package/dist/melonjs.mjs/input/input.js +2 -2
  28. package/dist/melonjs.mjs/input/keyboard.js +2 -2
  29. package/dist/melonjs.mjs/input/pointer.js +2 -2
  30. package/dist/melonjs.mjs/input/pointerevent.js +3 -17
  31. package/dist/melonjs.mjs/lang/console.js +44 -0
  32. package/dist/melonjs.mjs/lang/deprecated.js +4 -40
  33. package/dist/melonjs.mjs/level/level.js +4 -4
  34. package/dist/melonjs.mjs/level/tiled/TMXGroup.js +2 -23
  35. package/dist/melonjs.mjs/level/tiled/TMXLayer.js +67 -64
  36. package/dist/melonjs.mjs/level/tiled/TMXObject.js +2 -64
  37. package/dist/melonjs.mjs/level/tiled/TMXTile.js +10 -26
  38. package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +21 -83
  39. package/dist/melonjs.mjs/level/tiled/TMXTileset.js +6 -20
  40. package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +3 -10
  41. package/dist/melonjs.mjs/level/tiled/TMXUtils.js +37 -14
  42. package/dist/melonjs.mjs/level/tiled/constants.js +17 -0
  43. package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +7 -8
  44. package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +3 -6
  45. package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +2 -2
  46. package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +2 -14
  47. package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +2 -2
  48. package/dist/melonjs.mjs/level/tiled/renderer/autodetect.js +38 -0
  49. package/dist/melonjs.mjs/loader/cache.js +24 -0
  50. package/dist/melonjs.mjs/loader/loader.js +332 -715
  51. package/dist/melonjs.mjs/loader/loadingscreen.js +5 -5
  52. package/dist/melonjs.mjs/loader/melonjs_logo.png.js +2 -2
  53. package/dist/melonjs.mjs/loader/parser.js +281 -0
  54. package/dist/melonjs.mjs/loader/settings.js +91 -0
  55. package/dist/melonjs.mjs/math/color.js +2 -2
  56. package/dist/melonjs.mjs/math/math.js +2 -2
  57. package/dist/melonjs.mjs/math/matrix2.js +8 -10
  58. package/dist/melonjs.mjs/math/matrix3.js +19 -22
  59. package/dist/melonjs.mjs/math/observable_vector2.js +4 -4
  60. package/dist/melonjs.mjs/math/observable_vector3.js +4 -5
  61. package/dist/melonjs.mjs/math/vector2.js +4 -4
  62. package/dist/melonjs.mjs/math/vector3.js +4 -5
  63. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/arraymultimap.js +2 -2
  64. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/index.js +2 -2
  65. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/multimap.js +2 -2
  66. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/setmultimap.js +2 -2
  67. package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +2 -2
  68. package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +2 -2
  69. package/dist/melonjs.mjs/node_modules/eventemitter3/index2.js +2 -2
  70. package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +2 -2
  71. package/dist/melonjs.mjs/particles/emitter.js +4 -4
  72. package/dist/melonjs.mjs/particles/particle.js +2 -2
  73. package/dist/melonjs.mjs/particles/settings.js +2 -2
  74. package/dist/melonjs.mjs/physics/body.js +19 -15
  75. package/dist/melonjs.mjs/physics/bounds.js +19 -71
  76. package/dist/melonjs.mjs/physics/collision.js +3 -3
  77. package/dist/melonjs.mjs/physics/detector.js +2 -2
  78. package/dist/melonjs.mjs/physics/quadtree.js +2 -2
  79. package/dist/melonjs.mjs/physics/response.js +2 -2
  80. package/dist/melonjs.mjs/physics/sat.js +2 -2
  81. package/dist/melonjs.mjs/physics/world.js +2 -2
  82. package/dist/melonjs.mjs/plugin/plugin.js +4 -4
  83. package/dist/melonjs.mjs/renderable/collectable.js +2 -2
  84. package/dist/melonjs.mjs/renderable/colorlayer.js +2 -2
  85. package/dist/melonjs.mjs/renderable/container.js +26 -20
  86. package/dist/melonjs.mjs/renderable/dragndrop.js +2 -2
  87. package/dist/melonjs.mjs/renderable/imagelayer.js +8 -2
  88. package/dist/melonjs.mjs/renderable/light2d.js +2 -2
  89. package/dist/melonjs.mjs/renderable/nineslicesprite.js +2 -2
  90. package/dist/melonjs.mjs/renderable/renderable.js +127 -106
  91. package/dist/melonjs.mjs/renderable/sprite.js +34 -55
  92. package/dist/melonjs.mjs/renderable/trigger.js +2 -2
  93. package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +2 -2
  94. package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +2 -2
  95. package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +2 -2
  96. package/dist/melonjs.mjs/state/stage.js +2 -2
  97. package/dist/melonjs.mjs/state/state.js +3 -3
  98. package/dist/melonjs.mjs/system/device.js +2 -2
  99. package/dist/melonjs.mjs/system/dom.js +2 -2
  100. package/dist/melonjs.mjs/system/event.js +2 -2
  101. package/dist/melonjs.mjs/system/platform.js +2 -2
  102. package/dist/melonjs.mjs/system/pooling.js +9 -19
  103. package/dist/melonjs.mjs/system/save.js +2 -2
  104. package/dist/melonjs.mjs/system/timer.js +2 -2
  105. package/dist/melonjs.mjs/text/bitmaptext.js +67 -9
  106. package/dist/melonjs.mjs/text/bitmaptextdata.js +2 -2
  107. package/dist/melonjs.mjs/text/glyph.js +2 -2
  108. package/dist/melonjs.mjs/text/text.js +2 -2
  109. package/dist/melonjs.mjs/text/textmetrics.js +2 -2
  110. package/dist/melonjs.mjs/text/textstyle.js +2 -2
  111. package/dist/melonjs.mjs/tweens/easing.js +2 -2
  112. package/dist/melonjs.mjs/tweens/interpolation.js +2 -2
  113. package/dist/melonjs.mjs/tweens/tween.js +2 -2
  114. package/dist/melonjs.mjs/utils/agent.js +2 -2
  115. package/dist/melonjs.mjs/utils/array.js +2 -2
  116. package/dist/melonjs.mjs/utils/file.js +2 -2
  117. package/dist/melonjs.mjs/utils/function.js +2 -2
  118. package/dist/melonjs.mjs/utils/string.js +3 -3
  119. package/dist/melonjs.mjs/utils/utils.js +3 -5
  120. package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +2 -2
  121. package/dist/melonjs.mjs/video/renderer.js +2 -2
  122. package/dist/melonjs.mjs/video/texture/atlas.js +11 -10
  123. package/dist/melonjs.mjs/video/texture/cache.js +4 -4
  124. package/dist/melonjs.mjs/video/texture/canvas_texture.js +2 -2
  125. package/dist/melonjs.mjs/video/utils/autodetect.js +2 -2
  126. package/dist/melonjs.mjs/video/video.js +17 -14
  127. package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +2 -2
  128. package/dist/melonjs.mjs/video/webgl/compositors/compositor.js +235 -0
  129. package/{src/video/webgl → dist/melonjs.mjs/video/webgl/compositors}/webgl_compositor.js +28 -205
  130. package/dist/melonjs.mjs/video/webgl/glshader.js +2 -2
  131. package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +2 -2
  132. package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +2 -2
  133. package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +2 -2
  134. package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +2 -2
  135. package/dist/melonjs.mjs/video/webgl/utils/attributes.js +2 -2
  136. package/dist/melonjs.mjs/video/webgl/utils/precision.js +2 -2
  137. package/dist/melonjs.mjs/video/webgl/utils/program.js +2 -2
  138. package/dist/melonjs.mjs/video/webgl/utils/string.js +2 -2
  139. package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +2 -2
  140. package/dist/melonjs.mjs/video/webgl/webgl_compositor.js +3 -3
  141. package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +3 -3
  142. package/dist/melonjs.module.js +19807 -19896
  143. package/dist/types/application/application.d.ts +5 -1
  144. package/dist/types/application/resize.d.ts +1 -0
  145. package/dist/types/const.d.ts +21 -0
  146. package/dist/types/entity/entity.d.ts +2 -2
  147. package/dist/types/geometries/path2d.d.ts +5 -31
  148. package/dist/types/geometries/point.d.ts +2 -7
  149. package/dist/types/geometries/poly.d.ts +0 -1
  150. package/dist/types/index.d.ts +3 -2
  151. package/dist/types/lang/console.d.ts +7 -0
  152. package/dist/types/lang/deprecated.d.ts +0 -8
  153. package/dist/types/level/tiled/TMXGroup.d.ts +7 -28
  154. package/dist/types/level/tiled/TMXLayer.d.ts +25 -47
  155. package/dist/types/level/tiled/TMXObject.d.ts +20 -82
  156. package/dist/types/level/tiled/TMXTile.d.ts +11 -25
  157. package/dist/types/level/tiled/TMXTileMap.d.ts +18 -56
  158. package/dist/types/level/tiled/TMXTileset.d.ts +7 -21
  159. package/dist/types/level/tiled/TMXTilesetGroup.d.ts +3 -9
  160. package/dist/types/level/tiled/constants.d.ts +5 -0
  161. package/dist/types/level/tiled/renderer/TMXHexagonalRenderer.d.ts +2 -6
  162. package/dist/types/level/tiled/renderer/TMXIsometricRenderer.d.ts +2 -6
  163. package/dist/types/level/tiled/renderer/TMXRenderer.d.ts +6 -18
  164. package/dist/types/level/tiled/renderer/autodetect.d.ts +9 -0
  165. package/dist/types/loader/cache.d.ts +7 -0
  166. package/dist/types/loader/loader.d.ts +166 -181
  167. package/dist/types/loader/parser.d.ts +41 -0
  168. package/dist/types/loader/settings.d.ts +57 -0
  169. package/dist/types/particles/emitter.d.ts +4 -4
  170. package/dist/types/physics/bounds.d.ts +29 -84
  171. package/dist/types/renderable/container.d.ts +0 -11
  172. package/dist/types/renderable/renderable.d.ts +37 -31
  173. package/dist/types/renderable/sprite.d.ts +3 -3
  174. package/dist/types/state/state.d.ts +1 -1
  175. package/dist/types/system/pooling.d.ts +2 -2
  176. package/dist/types/video/renderer.d.ts +1 -1
  177. package/dist/types/video/video.d.ts +7 -6
  178. package/dist/types/video/webgl/compositors/compositor.d.ts +101 -0
  179. package/dist/types/video/webgl/compositors/webgl_compositor.d.ts +86 -0
  180. package/dist/types/video/webgl/webgl_compositor.d.ts +2 -3
  181. package/dist/types/video/webgl/webgl_renderer.d.ts +1 -1
  182. package/package.json +17 -16
  183. package/src/application/application.js +6 -19
  184. package/src/application/resize.js +2 -0
  185. package/src/audio/audio.js +3 -3
  186. package/src/const.js +23 -0
  187. package/src/entity/entity.js +42 -8
  188. package/src/geometries/ellipse.js +1 -2
  189. package/src/geometries/path2d.js +17 -41
  190. package/src/geometries/point.js +0 -5
  191. package/src/geometries/poly.js +1 -4
  192. package/src/geometries/rectangle.js +12 -8
  193. package/src/index.js +4 -2
  194. package/src/input/gamepad.js +9 -15
  195. package/src/input/pointerevent.js +1 -15
  196. package/src/lang/console.js +36 -0
  197. package/src/lang/deprecated.js +2 -37
  198. package/src/level/level.js +2 -2
  199. package/src/level/tiled/TMXGroup.js +0 -21
  200. package/src/level/tiled/TMXLayer.js +65 -62
  201. package/src/level/tiled/TMXObject.js +0 -62
  202. package/src/level/tiled/TMXTile.js +8 -24
  203. package/src/level/tiled/TMXTileMap.js +19 -81
  204. package/src/level/tiled/TMXTileset.js +4 -18
  205. package/src/level/tiled/TMXTilesetGroup.js +1 -9
  206. package/src/level/tiled/TMXUtils.js +38 -15
  207. package/src/level/tiled/constants.js +8 -0
  208. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +5 -6
  209. package/src/level/tiled/renderer/TMXIsometricRenderer.js +1 -4
  210. package/src/level/tiled/renderer/TMXRenderer.js +0 -12
  211. package/src/level/tiled/renderer/autodetect.js +29 -0
  212. package/src/loader/cache.js +16 -0
  213. package/src/loader/loader.js +339 -709
  214. package/src/loader/loadingscreen.js +3 -3
  215. package/src/loader/parser.js +279 -0
  216. package/src/loader/settings.js +85 -0
  217. package/src/math/matrix2.js +6 -8
  218. package/src/math/matrix3.js +17 -20
  219. package/src/math/observable_vector2.js +2 -2
  220. package/src/math/observable_vector3.js +2 -3
  221. package/src/math/vector2.js +2 -2
  222. package/src/math/vector3.js +2 -3
  223. package/src/particles/emitter.js +2 -2
  224. package/src/physics/body.js +17 -13
  225. package/src/physics/bounds.js +17 -69
  226. package/src/physics/collision.js +1 -1
  227. package/src/renderable/container.js +24 -18
  228. package/src/renderable/imagelayer.js +6 -0
  229. package/src/renderable/renderable.js +125 -104
  230. package/src/renderable/sprite.js +32 -53
  231. package/src/state/state.js +1 -1
  232. package/src/system/pooling.js +7 -17
  233. package/src/text/bitmaptext.js +65 -7
  234. package/src/utils/string.js +1 -1
  235. package/src/utils/utils.js +1 -3
  236. package/src/video/texture/atlas.js +9 -8
  237. package/src/video/texture/cache.js +2 -2
  238. package/src/video/video.js +15 -12
  239. package/src/video/webgl/compositors/compositor.js +227 -0
  240. package/src/video/webgl/compositors/webgl_compositor.js +300 -0
  241. package/src/video/webgl/webgl_renderer.js +1 -1
  242. package/dist/melonjs.mjs/node_modules/core-js/es/string/trim-end.js +0 -13
  243. package/dist/melonjs.mjs/node_modules/core-js/es/string/trim-start.js +0 -13
  244. package/dist/melonjs.mjs/node_modules/core-js/internals/a-callable.js +0 -22
  245. package/dist/melonjs.mjs/node_modules/core-js/internals/an-object.js +0 -21
  246. package/dist/melonjs.mjs/node_modules/core-js/internals/array-includes.js +0 -45
  247. package/dist/melonjs.mjs/node_modules/core-js/internals/classof-raw.js +0 -19
  248. package/dist/melonjs.mjs/node_modules/core-js/internals/classof.js +0 -43
  249. package/dist/melonjs.mjs/node_modules/core-js/internals/copy-constructor-properties.js +0 -32
  250. package/dist/melonjs.mjs/node_modules/core-js/internals/create-non-enumerable-property.js +0 -24
  251. package/dist/melonjs.mjs/node_modules/core-js/internals/create-property-descriptor.js +0 -17
  252. package/dist/melonjs.mjs/node_modules/core-js/internals/define-built-in.js +0 -43
  253. package/dist/melonjs.mjs/node_modules/core-js/internals/define-global-property.js +0 -23
  254. package/dist/melonjs.mjs/node_modules/core-js/internals/descriptors.js +0 -18
  255. package/dist/melonjs.mjs/node_modules/core-js/internals/document-all.js +0 -18
  256. package/dist/melonjs.mjs/node_modules/core-js/internals/document-create-element.js +0 -22
  257. package/dist/melonjs.mjs/node_modules/core-js/internals/engine-user-agent.js +0 -14
  258. package/dist/melonjs.mjs/node_modules/core-js/internals/engine-v8-version.js +0 -39
  259. package/dist/melonjs.mjs/node_modules/core-js/internals/entry-unbind.js +0 -18
  260. package/dist/melonjs.mjs/node_modules/core-js/internals/enum-bug-keys.js +0 -19
  261. package/dist/melonjs.mjs/node_modules/core-js/internals/export.js +0 -72
  262. package/dist/melonjs.mjs/node_modules/core-js/internals/fails.js +0 -16
  263. package/dist/melonjs.mjs/node_modules/core-js/internals/function-bind-native.js +0 -19
  264. package/dist/melonjs.mjs/node_modules/core-js/internals/function-call.js +0 -18
  265. package/dist/melonjs.mjs/node_modules/core-js/internals/function-name.js +0 -29
  266. package/dist/melonjs.mjs/node_modules/core-js/internals/function-uncurry-this.js +0 -22
  267. package/dist/melonjs.mjs/node_modules/core-js/internals/get-built-in.js +0 -22
  268. package/dist/melonjs.mjs/node_modules/core-js/internals/get-method.js +0 -21
  269. package/dist/melonjs.mjs/node_modules/core-js/internals/global.js +0 -25
  270. package/dist/melonjs.mjs/node_modules/core-js/internals/has-own-property.js +0 -23
  271. package/dist/melonjs.mjs/node_modules/core-js/internals/hidden-keys.js +0 -10
  272. package/dist/melonjs.mjs/node_modules/core-js/internals/ie8-dom-define.js +0 -24
  273. package/dist/melonjs.mjs/node_modules/core-js/internals/indexed-object.js +0 -28
  274. package/dist/melonjs.mjs/node_modules/core-js/internals/inspect-source.js +0 -27
  275. package/dist/melonjs.mjs/node_modules/core-js/internals/internal-state.js +0 -88
  276. package/dist/melonjs.mjs/node_modules/core-js/internals/is-callable.js +0 -22
  277. package/dist/melonjs.mjs/node_modules/core-js/internals/is-forced.js +0 -34
  278. package/dist/melonjs.mjs/node_modules/core-js/internals/is-null-or-undefined.js +0 -14
  279. package/dist/melonjs.mjs/node_modules/core-js/internals/is-object.js +0 -22
  280. package/dist/melonjs.mjs/node_modules/core-js/internals/is-symbol.js +0 -27
  281. package/dist/melonjs.mjs/node_modules/core-js/internals/length-of-array-like.js +0 -18
  282. package/dist/melonjs.mjs/node_modules/core-js/internals/make-built-in.js +0 -68
  283. package/dist/melonjs.mjs/node_modules/core-js/internals/math-trunc.js +0 -19
  284. package/dist/melonjs.mjs/node_modules/core-js/internals/object-define-property.js +0 -58
  285. package/dist/melonjs.mjs/node_modules/core-js/internals/object-get-own-property-descriptor.js +0 -41
  286. package/dist/melonjs.mjs/node_modules/core-js/internals/object-get-own-property-names.js +0 -23
  287. package/dist/melonjs.mjs/node_modules/core-js/internals/object-get-own-property-symbols.js +0 -12
  288. package/dist/melonjs.mjs/node_modules/core-js/internals/object-is-prototype-of.js +0 -14
  289. package/dist/melonjs.mjs/node_modules/core-js/internals/object-keys-internal.js +0 -35
  290. package/dist/melonjs.mjs/node_modules/core-js/internals/object-property-is-enumerable.js +0 -23
  291. package/dist/melonjs.mjs/node_modules/core-js/internals/ordinary-to-primitive.js +0 -28
  292. package/dist/melonjs.mjs/node_modules/core-js/internals/own-keys.js +0 -31
  293. package/dist/melonjs.mjs/node_modules/core-js/internals/require-object-coercible.js +0 -21
  294. package/dist/melonjs.mjs/node_modules/core-js/internals/shared-key.js +0 -21
  295. package/dist/melonjs.mjs/node_modules/core-js/internals/shared-store.js +0 -19
  296. package/dist/melonjs.mjs/node_modules/core-js/internals/shared.js +0 -24
  297. package/dist/melonjs.mjs/node_modules/core-js/internals/string-trim-end.js +0 -22
  298. package/dist/melonjs.mjs/node_modules/core-js/internals/string-trim-forced.js +0 -28
  299. package/dist/melonjs.mjs/node_modules/core-js/internals/string-trim-start.js +0 -22
  300. package/dist/melonjs.mjs/node_modules/core-js/internals/string-trim.js +0 -45
  301. package/dist/melonjs.mjs/node_modules/core-js/internals/symbol-constructor-detection.js +0 -26
  302. package/dist/melonjs.mjs/node_modules/core-js/internals/to-absolute-index.js +0 -23
  303. package/dist/melonjs.mjs/node_modules/core-js/internals/to-indexed-object.js +0 -19
  304. package/dist/melonjs.mjs/node_modules/core-js/internals/to-integer-or-infinity.js +0 -20
  305. package/dist/melonjs.mjs/node_modules/core-js/internals/to-length.js +0 -20
  306. package/dist/melonjs.mjs/node_modules/core-js/internals/to-object.js +0 -20
  307. package/dist/melonjs.mjs/node_modules/core-js/internals/to-primitive.js +0 -41
  308. package/dist/melonjs.mjs/node_modules/core-js/internals/to-property-key.js +0 -21
  309. package/dist/melonjs.mjs/node_modules/core-js/internals/to-string-tag-support.js +0 -19
  310. package/dist/melonjs.mjs/node_modules/core-js/internals/to-string.js +0 -19
  311. package/dist/melonjs.mjs/node_modules/core-js/internals/try-to-string.js +0 -18
  312. package/dist/melonjs.mjs/node_modules/core-js/internals/uid.js +0 -20
  313. package/dist/melonjs.mjs/node_modules/core-js/internals/use-symbol-as-uid.js +0 -18
  314. package/dist/melonjs.mjs/node_modules/core-js/internals/v8-prototype-define-bug.js +0 -24
  315. package/dist/melonjs.mjs/node_modules/core-js/internals/weak-map-basic-detection.js +0 -18
  316. package/dist/melonjs.mjs/node_modules/core-js/internals/well-known-symbol.js +0 -41
  317. package/dist/melonjs.mjs/node_modules/core-js/internals/whitespaces.js +0 -12
  318. package/dist/melonjs.mjs/node_modules/core-js/modules/es.global-this.js +0 -18
  319. package/dist/melonjs.mjs/node_modules/core-js/modules/es.string.trim-end.js +0 -22
  320. package/dist/melonjs.mjs/node_modules/core-js/modules/es.string.trim-left.js +0 -19
  321. package/dist/melonjs.mjs/node_modules/core-js/modules/es.string.trim-right.js +0 -19
  322. package/dist/melonjs.mjs/node_modules/core-js/modules/es.string.trim-start.js +0 -22
  323. package/dist/melonjs.mjs/node_modules/eventemitter3/index.mjs.js +0 -9
@@ -7,7 +7,7 @@ import Vector2d from "./../math/vector2.js";
7
7
  */
8
8
  export default class Bounds {
9
9
  /**
10
- * @param {Vector2d[]} [vertices] - an array of me.Vector2d points
10
+ * @param {Vector2d[]|Point[]} [vertices] - an array of Vector2d or Point
11
11
  */
12
12
  constructor(vertices) {
13
13
  // @ignore
@@ -32,8 +32,6 @@ import Vector2d from "./../math/vector2.js";
32
32
 
33
33
  /**
34
34
  * reset the bound
35
- * @name clear
36
- * @memberof Bounds
37
35
  */
38
36
  clear() {
39
37
  this.setMinMax(Infinity, Infinity, -Infinity, -Infinity);
@@ -42,8 +40,6 @@ import Vector2d from "./../math/vector2.js";
42
40
 
43
41
  /**
44
42
  * sets the bounds to the given min and max value
45
- * @name setMinMax
46
- * @memberof Bounds
47
43
  * @param {number} minX
48
44
  * @param {number} minY
49
45
  * @param {number} maxX
@@ -59,10 +55,7 @@ import Vector2d from "./../math/vector2.js";
59
55
 
60
56
  /**
61
57
  * x position of the bound
62
- * @public
63
58
  * @type {number}
64
- * @name x
65
- * @memberof Bounds
66
59
  */
67
60
  get x() {
68
61
  return this.min.x;
@@ -76,10 +69,7 @@ import Vector2d from "./../math/vector2.js";
76
69
 
77
70
  /**
78
71
  * y position of the bounds
79
- * @public
80
72
  * @type {number}
81
- * @name y
82
- * @memberof Bounds
83
73
  */
84
74
  get y() {
85
75
  return this.min.y;
@@ -94,10 +84,7 @@ import Vector2d from "./../math/vector2.js";
94
84
 
95
85
  /**
96
86
  * width of the bounds
97
- * @public
98
87
  * @type {number}
99
- * @name width
100
- * @memberof Bounds
101
88
  */
102
89
  get width() {
103
90
  return this.max.x - this.min.x;
@@ -109,10 +96,7 @@ import Vector2d from "./../math/vector2.js";
109
96
 
110
97
  /**
111
98
  * width of the bounds
112
- * @public
113
99
  * @type {number}
114
- * @name width
115
- * @memberof Bounds
116
100
  */
117
101
  get height() {
118
102
  return this.max.y - this.min.y;
@@ -124,10 +108,7 @@ import Vector2d from "./../math/vector2.js";
124
108
 
125
109
  /**
126
110
  * left coordinate of the bound
127
- * @public
128
111
  * @type {number}
129
- * @name left
130
- * @memberof Bounds
131
112
  */
132
113
  get left() {
133
114
  return this.min.x;
@@ -135,10 +116,7 @@ import Vector2d from "./../math/vector2.js";
135
116
 
136
117
  /**
137
118
  * right coordinate of the bound
138
- * @public
139
119
  * @type {number}
140
- * @name right
141
- * @memberof Bounds
142
120
  */
143
121
  get right() {
144
122
  return this.max.x;
@@ -146,10 +124,7 @@ import Vector2d from "./../math/vector2.js";
146
124
 
147
125
  /**
148
126
  * top coordinate of the bound
149
- * @public
150
127
  * @type {number}
151
- * @name top
152
- * @memberof Bounds
153
128
  */
154
129
  get top() {
155
130
  return this.min.y;
@@ -157,10 +132,7 @@ import Vector2d from "./../math/vector2.js";
157
132
 
158
133
  /**
159
134
  * bottom coordinate of the bound
160
- * @public
161
135
  * @type {number}
162
- * @name bottom
163
- * @memberof Bounds
164
136
  */
165
137
  get bottom() {
166
138
  return this.max.y;
@@ -168,10 +140,7 @@ import Vector2d from "./../math/vector2.js";
168
140
 
169
141
  /**
170
142
  * center position of the bound on the x axis
171
- * @public
172
143
  * @type {number}
173
- * @name centerX
174
- * @memberof Bounds
175
144
  */
176
145
  get centerX() {
177
146
  return this.min.x + (this.width / 2);
@@ -179,10 +148,7 @@ import Vector2d from "./../math/vector2.js";
179
148
 
180
149
  /**
181
150
  * center position of the bound on the y axis
182
- * @public
183
151
  * @type {number}
184
- * @name centerY
185
- * @memberof Bounds
186
152
  */
187
153
  get centerY() {
188
154
  return this.min.y + (this.height / 2);
@@ -190,20 +156,25 @@ import Vector2d from "./../math/vector2.js";
190
156
 
191
157
  /**
192
158
  * return the center position of the bound
193
- * @public
194
159
  * @type {Vector2d}
195
- * @name center
196
- * @memberof Bounds
197
160
  */
198
161
  get center() {
199
162
  return this._center.set(this.centerX, this.centerY);
200
163
  }
201
164
 
165
+ /**
166
+ * center the bounds position around the given coordinates
167
+ * @param {number} x - the x coordinate around which to center this bounds
168
+ * @param {number} y - the y coordinate around which to center this bounds
169
+ */
170
+ centerOn(x, y) {
171
+ this.shift(x - this.width / 2, y - this.height / 2);
172
+ return this;
173
+ }
174
+
202
175
  /**
203
176
  * Updates bounds using the given vertices
204
- * @name update
205
- * @memberof Bounds
206
- * @param {Vector2d[]} vertices - an array of me.Vector2d points
177
+ * @param {Vector2d[]|Point[]} vertices - an array of Vector2d or Point
207
178
  */
208
179
  update(vertices) {
209
180
  this.add(vertices, true);
@@ -211,9 +182,7 @@ import Vector2d from "./../math/vector2.js";
211
182
 
212
183
  /**
213
184
  * add the given vertices to the bounds definition.
214
- * @name add
215
- * @memberof Bounds
216
- * @param {Vector2d[]} vertices - an array of me.Vector2d points
185
+ * @param {Vector2d[]|Point[]} vertices - an array of Vector2d or Point
217
186
  * @param {boolean} [clear=false] - either to reset the bounds before adding the new vertices
218
187
  */
219
188
  add(vertices, clear = false) {
@@ -231,8 +200,6 @@ import Vector2d from "./../math/vector2.js";
231
200
 
232
201
  /**
233
202
  * add the given bounds to the bounds definition.
234
- * @name addBounds
235
- * @memberof Bounds
236
203
  * @param {Bounds} bounds
237
204
  * @param {boolean} [clear=false] - either to reset the bounds before adding the new vertices
238
205
  */
@@ -252,13 +219,11 @@ import Vector2d from "./../math/vector2.js";
252
219
 
253
220
  /**
254
221
  * add the given point to the bounds definition.
255
- * @name addPoint
256
- * @memberof Bounds
257
- * @param {Vector2d|Point} point - the point to be added to the bounds
258
- * @param {Matrix2d} [m] - an optional transform to apply to the given point (only if the given point is a vector)
222
+ * @param {Vector2d|Point} point - the vector or point to be added to the bounds
223
+ * @param {Matrix2d} [m] - an optional transform to apply to the given point (if the given point is a Vector2d)
259
224
  */
260
225
  addPoint(point, m) {
261
- if ((typeof m !== "undefined") && (typeof point.rotate === "function")) {
226
+ if ((typeof m !== "undefined")) {
262
227
  // only Vectors object have a rotate function
263
228
  point = m.apply(point);
264
229
  }
@@ -270,8 +235,6 @@ import Vector2d from "./../math/vector2.js";
270
235
 
271
236
  /**
272
237
  * add the given quad coordinates to this bound definition, multiplied by the given matrix
273
- * @name addFrame
274
- * @memberof Bounds
275
238
  * @param {number} x0 - left X coordinates of the quad
276
239
  * @param {number} y0 - top Y coordinates of the quad
277
240
  * @param {number} x1 - right X coordinates of the quad
@@ -279,9 +242,8 @@ import Vector2d from "./../math/vector2.js";
279
242
  * @param {Matrix2d} [m] - an optional transform to apply to the given frame coordinates
280
243
  */
281
244
  addFrame(x0, y0, x1, y1, m) {
282
- var v = pool.pull("Vector2d");
245
+ var v = pool.pull("Point");
283
246
 
284
- // transform all points and add to the bound definition
285
247
  this.addPoint(v.set(x0, y0), m);
286
248
  this.addPoint(v.set(x1, y0), m);
287
249
  this.addPoint(v.set(x0, y1), m);
@@ -300,8 +262,6 @@ import Vector2d from "./../math/vector2.js";
300
262
  */
301
263
  /**
302
264
  * Returns true if the bounds contains the given point.
303
- * @name contains
304
- * @memberof Bounds
305
265
  * @param {number} x
306
266
  * @param {number} y
307
267
  * @returns {boolean} True if the bounds contain the point, otherwise false
@@ -333,8 +293,6 @@ import Vector2d from "./../math/vector2.js";
333
293
 
334
294
  /**
335
295
  * Returns true if the two bounds intersect.
336
- * @name overlaps
337
- * @memberof Bounds
338
296
  * @param {Bounds|Rect} bounds
339
297
  * @returns {boolean} True if the bounds overlap, otherwise false
340
298
  */
@@ -345,8 +303,6 @@ import Vector2d from "./../math/vector2.js";
345
303
 
346
304
  /**
347
305
  * determines whether all coordinates of this bounds are finite numbers.
348
- * @name isFinite
349
- * @memberof Bounds
350
306
  * @returns {boolean} false if all coordinates are positive or negative Infinity or NaN; otherwise, true.
351
307
  */
352
308
  isFinite() {
@@ -362,8 +318,6 @@ import Vector2d from "./../math/vector2.js";
362
318
  */
363
319
  /**
364
320
  * Translates the bounds by x on the x axis, and y on the y axis
365
- * @name translate
366
- * @memberof Bounds
367
321
  * @param {number} x
368
322
  * @param {number} y
369
323
  */
@@ -393,8 +347,6 @@ import Vector2d from "./../math/vector2.js";
393
347
  */
394
348
  /**
395
349
  * Shifts the bounds to the given x, y position.
396
- * @name shift
397
- * @memberof Bounds
398
350
  * @param {number} x
399
351
  * @param {number} y
400
352
  */
@@ -422,8 +374,6 @@ import Vector2d from "./../math/vector2.js";
422
374
 
423
375
  /**
424
376
  * clone this bounds
425
- * @name clone
426
- * @memberof Bounds
427
377
  * @returns {Bounds}
428
378
  */
429
379
  clone() {
@@ -434,8 +384,6 @@ import Vector2d from "./../math/vector2.js";
434
384
 
435
385
  /**
436
386
  * Returns a polygon whose edges are the same as this bounds.
437
- * @name toPolygon
438
- * @memberof Bounds
439
387
  * @returns {Polygon} a new Polygon that represents this bounds.
440
388
  */
441
389
  toPolygon () {
@@ -117,7 +117,7 @@ var collision = {
117
117
  * // ...
118
118
  * }
119
119
  */
120
- rayCast(line, result) { return game.world.rayCast(line, result); }
120
+ rayCast(line, result) { return game.world.detector.rayCast(line, result); }
121
121
  };
122
122
 
123
123
  export default collision;
@@ -129,7 +129,13 @@ let globalFloatingCounter = 0;
129
129
  // subscribe on the canvas resize event
130
130
  if (this.root === true) {
131
131
  // Workaround for not updating container child-bounds automatically (it's expensive!)
132
- event.on(event.CANVAS_ONRESIZE, this.updateBounds.bind(this, true));
132
+ event.on(event.CANVAS_ONRESIZE, () => {
133
+ // temporarly enable the enableChildBoundsUpdate flag
134
+ this.enableChildBoundsUpdate === true;
135
+ // update bounds
136
+ this.updateBounds();
137
+ this.enableChildBoundsUpdate === false;
138
+ });
133
139
  }
134
140
  }
135
141
 
@@ -189,6 +195,10 @@ let globalFloatingCounter = 0;
189
195
 
190
196
  child.ancestor = this;
191
197
  this.getChildren().push(child);
198
+ if (typeof child.updateBounds === "function") {
199
+ // update child bounds to reflect the new ancestor
200
+ child.updateBounds();
201
+ }
192
202
 
193
203
  // set the child z value if required
194
204
  if (typeof(child.pos) !== "undefined") {
@@ -213,8 +223,8 @@ let globalFloatingCounter = 0;
213
223
  }
214
224
 
215
225
  // force bounds update if required
216
- if (this.enableChildBoundsUpdate) {
217
- this.updateBounds(true);
226
+ if (this.enableChildBoundsUpdate === true) {
227
+ this.updateBounds();
218
228
  }
219
229
 
220
230
  // if a physic body is defined, add it to the game world
@@ -262,8 +272,8 @@ let globalFloatingCounter = 0;
262
272
  }
263
273
 
264
274
  // force bounds update if required
265
- if (this.enableChildBoundsUpdate) {
266
- this.updateBounds(true);
275
+ if (this.enableChildBoundsUpdate === true) {
276
+ this.updateBounds();
267
277
  }
268
278
 
269
279
  // if a physic body is defined, add it to the game world
@@ -497,26 +507,25 @@ let globalFloatingCounter = 0;
497
507
  /**
498
508
  * update the bounding box for this shape.
499
509
  * @ignore
510
+ * @param {boolean} absolute - update the bounds size and position in (world) absolute coordinates
500
511
  * @returns {Bounds} this shape bounding box Rectangle object
501
512
  */
502
- updateBounds(forceUpdateChildBounds = false) {
513
+ updateBounds(absolute = true) {
514
+ var bounds = this.getBounds();
503
515
 
504
516
  // call parent method
505
- super.updateBounds();
517
+ super.updateBounds(absolute);
506
518
 
507
- var bounds = this.getBounds();
508
-
509
- if (forceUpdateChildBounds === true || this.enableChildBoundsUpdate === true) {
519
+ if (this.enableChildBoundsUpdate === true) {
510
520
  this.forEach((child) => {
511
521
  if (child.isRenderable) {
512
522
  var childBounds = child.getBounds();
513
523
  if (childBounds.isFinite()) {
514
- bounds.addBounds(child.getBounds());
524
+ bounds.addBounds(childBounds);
515
525
  }
516
526
  }
517
527
  });
518
528
  }
519
-
520
529
  return bounds;
521
530
  }
522
531
 
@@ -544,7 +553,7 @@ let globalFloatingCounter = 0;
544
553
  * update the cointainer's bounding rect (private)
545
554
  * @ignore
546
555
  */
547
- updateBoundsPos(newX, newY) {
556
+ updateBoundsPos(newX = this.pos.x, newY = this.pos.y) {
548
557
  // call the parent method
549
558
  super.updateBoundsPos(newX, newY);
550
559
 
@@ -552,14 +561,11 @@ let globalFloatingCounter = 0;
552
561
  this.forEach((child) => {
553
562
  if (child.isRenderable) {
554
563
  child.updateBoundsPos(
555
- // workaround on this.pos being updated after
556
- // the callback being triggered
557
564
  child.pos.x + newX - this.pos.x,
558
565
  child.pos.y + newY - this.pos.y
559
566
  );
560
567
  }
561
568
  });
562
- return this.getBounds();
563
569
  }
564
570
 
565
571
  /**
@@ -631,8 +637,8 @@ let globalFloatingCounter = 0;
631
637
  }
632
638
 
633
639
  // force bounds update if required
634
- if (this.enableChildBoundsUpdate) {
635
- this.updateBounds(true);
640
+ if (this.enableChildBoundsUpdate === true) {
641
+ this.updateBounds();
636
642
  }
637
643
 
638
644
  // triggered callback if defined
@@ -235,11 +235,17 @@ import * as stringUtil from "./../utils/string.js";
235
235
  preDraw(renderer) {
236
236
  // save the context
237
237
  renderer.save();
238
+
238
239
  // apply the defined alpha value
239
240
  renderer.setGlobalAlpha(renderer.globalAlpha() * this.getOpacity());
240
241
 
241
242
  // apply the defined tint, if any
242
243
  renderer.setTint(this.tint);
244
+
245
+ // apply blending if different from "normal"
246
+ if (this.blendMode !== renderer.getBlendMode()) {
247
+ renderer.setBlendMode(this.blendMode);
248
+ }
243
249
  }
244
250
 
245
251
  /**