melonjs 17.4.0 → 18.0.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 (702) hide show
  1. package/{dist/types → build}/application/application.d.ts +9 -10
  2. package/build/application/application.d.ts.map +1 -0
  3. package/build/application/defaultApplicationSettings.d.ts +18 -0
  4. package/build/application/defaultApplicationSettings.d.ts.map +1 -0
  5. package/{dist/types → build}/application/header.d.ts +1 -0
  6. package/build/application/header.d.ts.map +1 -0
  7. package/{dist/types → build}/application/resize.d.ts +1 -0
  8. package/build/application/resize.d.ts.map +1 -0
  9. package/build/application/scaleMethods.d.ts +44 -0
  10. package/build/application/scaleMethods.d.ts.map +1 -0
  11. package/build/application/settings.d.ts +85 -0
  12. package/build/application/settings.d.ts.map +1 -0
  13. package/{dist/types → build}/audio/audio.d.ts +35 -58
  14. package/build/audio/audio.d.ts.map +1 -0
  15. package/{dist/types → build}/camera/camera2d.d.ts +38 -76
  16. package/build/camera/camera2d.d.ts.map +1 -0
  17. package/build/const.d.ts +14 -0
  18. package/build/const.d.ts.map +1 -0
  19. package/build/geometries/earcut.d.ts +3 -0
  20. package/build/geometries/earcut.d.ts.map +1 -0
  21. package/build/geometries/ellipse.d.ts +117 -0
  22. package/build/geometries/ellipse.d.ts.map +1 -0
  23. package/build/geometries/line.d.ts +39 -0
  24. package/build/geometries/line.d.ts.map +1 -0
  25. package/build/geometries/observablePoint.d.ts +75 -0
  26. package/build/geometries/observablePoint.d.ts.map +1 -0
  27. package/{dist/types → build}/geometries/path2d.d.ts +8 -7
  28. package/build/geometries/path2d.d.ts.map +1 -0
  29. package/build/geometries/point.d.ts +44 -0
  30. package/build/geometries/point.d.ts.map +1 -0
  31. package/build/geometries/polygon.d.ts +182 -0
  32. package/build/geometries/polygon.d.ts.map +1 -0
  33. package/build/geometries/rectangle.d.ts +135 -0
  34. package/build/geometries/rectangle.d.ts.map +1 -0
  35. package/build/geometries/roundrect.d.ts +67 -0
  36. package/build/geometries/roundrect.d.ts.map +1 -0
  37. package/build/geometries/toarccanvas.d.ts +28 -0
  38. package/build/geometries/toarccanvas.d.ts.map +1 -0
  39. package/{dist/types → build}/index.d.ts +41 -45
  40. package/build/index.d.ts.map +1 -0
  41. package/build/index.js +28318 -0
  42. package/build/index.js.map +7 -0
  43. package/{dist/types → build}/input/gamepad.d.ts +3 -11
  44. package/build/input/gamepad.d.ts.map +1 -0
  45. package/{dist/types → build}/input/input.d.ts +4 -2
  46. package/build/input/input.d.ts.map +1 -0
  47. package/build/input/key.d.ts +105 -0
  48. package/build/input/key.d.ts.map +1 -0
  49. package/build/input/keyboard.d.ts +72 -0
  50. package/build/input/keyboard.d.ts.map +1 -0
  51. package/build/input/pointer.d.ts +180 -0
  52. package/build/input/pointer.d.ts.map +1 -0
  53. package/{dist/types → build}/input/pointerevent.d.ts +17 -16
  54. package/build/input/pointerevent.d.ts.map +1 -0
  55. package/{dist/types → build}/lang/console.d.ts +1 -0
  56. package/build/lang/console.d.ts.map +1 -0
  57. package/build/lang/deprecated.d.ts +24 -0
  58. package/build/lang/deprecated.d.ts.map +1 -0
  59. package/{dist/types → build}/level/level.d.ts +7 -7
  60. package/build/level/level.d.ts.map +1 -0
  61. package/{dist/types → build}/level/tiled/TMXGroup.d.ts +2 -2
  62. package/build/level/tiled/TMXGroup.d.ts.map +1 -0
  63. package/{dist/types → build}/level/tiled/TMXLayer.d.ts +4 -4
  64. package/build/level/tiled/TMXLayer.d.ts.map +1 -0
  65. package/{dist/types → build}/level/tiled/TMXObject.d.ts +3 -3
  66. package/build/level/tiled/TMXObject.d.ts.map +1 -0
  67. package/{dist/types → build}/level/tiled/TMXTile.d.ts +4 -5
  68. package/build/level/tiled/TMXTile.d.ts.map +1 -0
  69. package/{dist/types → build}/level/tiled/TMXTileMap.d.ts +4 -4
  70. package/build/level/tiled/TMXTileMap.d.ts.map +1 -0
  71. package/{dist/types → build}/level/tiled/TMXTileset.d.ts +2 -2
  72. package/build/level/tiled/TMXTileset.d.ts.map +1 -0
  73. package/{dist/types → build}/level/tiled/TMXTilesetGroup.d.ts +1 -1
  74. package/build/level/tiled/TMXTilesetGroup.d.ts.map +1 -0
  75. package/{dist/types → build}/level/tiled/TMXUtils.d.ts +2 -1
  76. package/build/level/tiled/TMXUtils.d.ts.map +1 -0
  77. package/{dist/types → build}/level/tiled/constants.d.ts +1 -0
  78. package/build/level/tiled/constants.d.ts.map +1 -0
  79. package/{dist/types → build}/level/tiled/renderer/TMXHexagonalRenderer.d.ts +3 -4
  80. package/build/level/tiled/renderer/TMXHexagonalRenderer.d.ts.map +1 -0
  81. package/{dist/types → build}/level/tiled/renderer/TMXIsometricRenderer.d.ts +2 -3
  82. package/build/level/tiled/renderer/TMXIsometricRenderer.d.ts.map +1 -0
  83. package/{dist/types → build}/level/tiled/renderer/TMXOrthogonalRenderer.d.ts +1 -2
  84. package/build/level/tiled/renderer/TMXOrthogonalRenderer.d.ts.map +1 -0
  85. package/{dist/types → build}/level/tiled/renderer/TMXRenderer.d.ts +7 -7
  86. package/build/level/tiled/renderer/TMXRenderer.d.ts.map +1 -0
  87. package/{dist/types → build}/level/tiled/renderer/TMXStaggeredRenderer.d.ts +1 -2
  88. package/build/level/tiled/renderer/TMXStaggeredRenderer.d.ts.map +1 -0
  89. package/{dist/types → build}/level/tiled/renderer/autodetect.d.ts +4 -3
  90. package/build/level/tiled/renderer/autodetect.d.ts.map +1 -0
  91. package/build/loader/cache.d.ts +10 -0
  92. package/build/loader/cache.d.ts.map +1 -0
  93. package/{dist/types → build}/loader/loader.d.ts +19 -13
  94. package/build/loader/loader.d.ts.map +1 -0
  95. package/{dist/types → build}/loader/loadingscreen.d.ts +1 -0
  96. package/build/loader/loadingscreen.d.ts.map +1 -0
  97. package/{dist/types → build}/loader/parsers/binary.d.ts +2 -1
  98. package/build/loader/parsers/binary.d.ts.map +1 -0
  99. package/{dist/types → build}/loader/parsers/compressed_textures/compressed_image.d.ts +1 -0
  100. package/build/loader/parsers/compressed_textures/compressed_image.d.ts.map +1 -0
  101. package/build/loader/parsers/compressed_textures/parseDDS.d.ts +2 -0
  102. package/build/loader/parsers/compressed_textures/parseDDS.d.ts.map +1 -0
  103. package/build/loader/parsers/compressed_textures/parseKTX.d.ts +2 -0
  104. package/build/loader/parsers/compressed_textures/parseKTX.d.ts.map +1 -0
  105. package/build/loader/parsers/compressed_textures/parseKTX2.d.ts +2 -0
  106. package/build/loader/parsers/compressed_textures/parseKTX2.d.ts.map +1 -0
  107. package/build/loader/parsers/compressed_textures/parsePKM.d.ts +2 -0
  108. package/build/loader/parsers/compressed_textures/parsePKM.d.ts.map +1 -0
  109. package/build/loader/parsers/compressed_textures/parsePVR.d.ts +2 -0
  110. package/build/loader/parsers/compressed_textures/parsePVR.d.ts.map +1 -0
  111. package/{dist/types → build}/loader/parsers/fetchdata.d.ts +2 -1
  112. package/build/loader/parsers/fetchdata.d.ts.map +1 -0
  113. package/{dist/types → build}/loader/parsers/fontface.d.ts +2 -1
  114. package/build/loader/parsers/fontface.d.ts.map +1 -0
  115. package/{dist/types → build}/loader/parsers/image.d.ts +2 -1
  116. package/build/loader/parsers/image.d.ts.map +1 -0
  117. package/{dist/types → build}/loader/parsers/json.d.ts +2 -1
  118. package/build/loader/parsers/json.d.ts.map +1 -0
  119. package/{dist/types → build}/loader/parsers/script.d.ts +2 -1
  120. package/build/loader/parsers/script.d.ts.map +1 -0
  121. package/{dist/types → build}/loader/parsers/tmx.d.ts +2 -1
  122. package/build/loader/parsers/tmx.d.ts.map +1 -0
  123. package/{dist/types → build}/loader/parsers/video.d.ts +2 -1
  124. package/build/loader/parsers/video.d.ts.map +1 -0
  125. package/build/math/color.d.ts +192 -0
  126. package/build/math/color.d.ts.map +1 -0
  127. package/build/math/math.d.ts +128 -0
  128. package/build/math/math.d.ts.map +1 -0
  129. package/build/math/matrix2d.d.ts +163 -0
  130. package/build/math/matrix2d.d.ts.map +1 -0
  131. package/build/math/matrix3d.d.ts +188 -0
  132. package/build/math/matrix3d.d.ts.map +1 -0
  133. package/build/math/observableVector2d.d.ts +286 -0
  134. package/build/math/observableVector2d.d.ts.map +1 -0
  135. package/build/math/observableVector2d_old.d.ts +76 -0
  136. package/build/math/observableVector2d_old.d.ts.map +1 -0
  137. package/build/math/observableVector3d.d.ts +283 -0
  138. package/build/math/observableVector3d.d.ts.map +1 -0
  139. package/build/math/observableVector3d_old.d.ts +81 -0
  140. package/build/math/observableVector3d_old.d.ts.map +1 -0
  141. package/build/math/vector2d.d.ts +253 -0
  142. package/build/math/vector2d.d.ts.map +1 -0
  143. package/build/math/vector3d.d.ts +242 -0
  144. package/build/math/vector3d.d.ts.map +1 -0
  145. package/{dist/types → build}/particles/emitter.d.ts +7 -10
  146. package/build/particles/emitter.d.ts.map +1 -0
  147. package/build/particles/particle.d.ts +47 -0
  148. package/build/particles/particle.d.ts.map +1 -0
  149. package/{dist/types → build}/particles/settings.d.ts +1 -0
  150. package/build/particles/settings.d.ts.map +1 -0
  151. package/{dist/types → build}/physics/body.d.ts +27 -27
  152. package/build/physics/body.d.ts.map +1 -0
  153. package/build/physics/bounds.d.ts +192 -0
  154. package/build/physics/bounds.d.ts.map +1 -0
  155. package/{dist/types → build}/physics/collision.d.ts +5 -5
  156. package/build/physics/collision.d.ts.map +1 -0
  157. package/{dist/types → build}/physics/detector.d.ts +8 -6
  158. package/build/physics/detector.d.ts.map +1 -0
  159. package/{dist/types → build}/physics/quadtree.d.ts +5 -19
  160. package/build/physics/quadtree.d.ts.map +1 -0
  161. package/{dist/types → build}/physics/response.d.ts +46 -5
  162. package/build/physics/response.d.ts.map +1 -0
  163. package/{dist/types → build}/physics/sat.d.ts +3 -2
  164. package/build/physics/sat.d.ts.map +1 -0
  165. package/{dist/types → build}/physics/world.d.ts +5 -4
  166. package/build/physics/world.d.ts.map +1 -0
  167. package/{dist/types → build}/plugin/plugin.d.ts +8 -19
  168. package/build/plugin/plugin.d.ts.map +1 -0
  169. package/build/polyfill/console.d.ts +2 -0
  170. package/build/polyfill/console.d.ts.map +1 -0
  171. package/build/polyfill/index.d.ts +6 -0
  172. package/build/polyfill/index.d.ts.map +1 -0
  173. package/build/polyfill/roundrect.d.ts +2 -0
  174. package/build/polyfill/roundrect.d.ts.map +1 -0
  175. package/build/pool.d.ts +39 -0
  176. package/build/pool.d.ts.map +1 -0
  177. package/{dist/types → build}/renderable/collectable.d.ts +2 -2
  178. package/build/renderable/collectable.d.ts.map +1 -0
  179. package/{dist/types → build}/renderable/colorlayer.d.ts +6 -10
  180. package/build/renderable/colorlayer.d.ts.map +1 -0
  181. package/{dist/types → build}/renderable/container.d.ts +14 -15
  182. package/build/renderable/container.d.ts.map +1 -0
  183. package/{dist/types → build}/renderable/draggable.d.ts +5 -13
  184. package/build/renderable/draggable.d.ts.map +1 -0
  185. package/{dist/types → build}/renderable/dragndrop.d.ts +7 -21
  186. package/build/renderable/dragndrop.d.ts.map +1 -0
  187. package/{dist/types → build}/renderable/entity/entity.d.ts +12 -13
  188. package/build/renderable/entity/entity.d.ts.map +1 -0
  189. package/{dist/types → build}/renderable/imagelayer.d.ts +17 -9
  190. package/build/renderable/imagelayer.d.ts.map +1 -0
  191. package/build/renderable/light2d.d.ts +73 -0
  192. package/build/renderable/light2d.d.ts.map +1 -0
  193. package/{dist/types → build}/renderable/nineslicesprite.d.ts +3 -4
  194. package/build/renderable/nineslicesprite.d.ts.map +1 -0
  195. package/{dist/types → build}/renderable/renderable.d.ts +57 -60
  196. package/build/renderable/renderable.d.ts.map +1 -0
  197. package/{dist/types → build}/renderable/sprite.d.ts +28 -14
  198. package/build/renderable/sprite.d.ts.map +1 -0
  199. package/{dist/types → build}/renderable/text/bitmaptext.d.ts +6 -7
  200. package/build/renderable/text/bitmaptext.d.ts.map +1 -0
  201. package/build/renderable/text/bitmaptextdata.d.ts +17 -0
  202. package/build/renderable/text/bitmaptextdata.d.ts.map +1 -0
  203. package/{dist/types → build}/renderable/text/glyph.d.ts +15 -3
  204. package/build/renderable/text/glyph.d.ts.map +1 -0
  205. package/{dist/types → build}/renderable/text/text.d.ts +7 -16
  206. package/build/renderable/text/text.d.ts.map +1 -0
  207. package/{dist/types → build}/renderable/text/textmetrics.d.ts +8 -9
  208. package/build/renderable/text/textmetrics.d.ts.map +1 -0
  209. package/{dist/types → build}/renderable/text/textstyle.d.ts +1 -0
  210. package/build/renderable/text/textstyle.d.ts.map +1 -0
  211. package/{dist/types → build}/renderable/trigger.d.ts +18 -7
  212. package/build/renderable/trigger.d.ts.map +1 -0
  213. package/{dist/types → build}/renderable/ui/uibaseelement.d.ts +7 -7
  214. package/build/renderable/ui/uibaseelement.d.ts.map +1 -0
  215. package/{dist/types → build}/renderable/ui/uispriteelement.d.ts +4 -6
  216. package/build/renderable/ui/uispriteelement.d.ts.map +1 -0
  217. package/{dist/types → build}/renderable/ui/uitextbutton.d.ts +17 -4
  218. package/build/renderable/ui/uitextbutton.d.ts.map +1 -0
  219. package/{dist/types → build}/state/stage.d.ts +3 -3
  220. package/build/state/stage.d.ts.map +1 -0
  221. package/{dist/types → build}/state/state.d.ts +10 -9
  222. package/build/state/state.d.ts.map +1 -0
  223. package/{dist/types → build}/system/device.d.ts +49 -80
  224. package/build/system/device.d.ts.map +1 -0
  225. package/build/system/dom.d.ts +2 -0
  226. package/build/system/dom.d.ts.map +1 -0
  227. package/{dist/types → build}/system/event.d.ts +124 -291
  228. package/build/system/event.d.ts.map +1 -0
  229. package/build/system/eventEmitter.d.ts +19 -0
  230. package/build/system/eventEmitter.d.ts.map +1 -0
  231. package/build/system/eventEmitter.spec.d.ts +2 -0
  232. package/build/system/eventEmitter.spec.d.ts.map +1 -0
  233. package/{dist/types/system/pooling.d.ts → build/system/legacy_pool.d.ts} +22 -7
  234. package/build/system/legacy_pool.d.ts.map +1 -0
  235. package/build/system/platform.d.ts +34 -0
  236. package/build/system/platform.d.ts.map +1 -0
  237. package/build/system/pool.d.ts +26 -0
  238. package/build/system/pool.d.ts.map +1 -0
  239. package/build/system/save.d.ts +3 -0
  240. package/build/system/save.d.ts.map +1 -0
  241. package/build/system/timer.d.ts +118 -0
  242. package/build/system/timer.d.ts.map +1 -0
  243. package/build/tweens/easing.d.ts +93 -0
  244. package/build/tweens/easing.d.ts.map +1 -0
  245. package/build/tweens/interpolation.d.ts +7 -0
  246. package/build/tweens/interpolation.d.ts.map +1 -0
  247. package/build/tweens/tween.d.ts +234 -0
  248. package/build/tweens/tween.d.ts.map +1 -0
  249. package/build/utils/agent.d.ts +16 -0
  250. package/build/utils/agent.d.ts.map +1 -0
  251. package/build/utils/array-multimap.d.ts +14 -0
  252. package/build/utils/array-multimap.d.ts.map +1 -0
  253. package/build/utils/array.d.ts +30 -0
  254. package/build/utils/array.d.ts.map +1 -0
  255. package/build/utils/file.d.ts +16 -0
  256. package/build/utils/file.d.ts.map +1 -0
  257. package/build/utils/function.d.ts +24 -0
  258. package/build/utils/function.d.ts.map +1 -0
  259. package/build/utils/semver.d.ts +2 -0
  260. package/build/utils/semver.d.ts.map +1 -0
  261. package/build/utils/string.d.ts +35 -0
  262. package/build/utils/string.d.ts.map +1 -0
  263. package/build/utils/types.d.ts +5 -0
  264. package/build/utils/types.d.ts.map +1 -0
  265. package/build/utils/utils.d.ts +49 -0
  266. package/build/utils/utils.d.ts.map +1 -0
  267. package/build/version.d.ts +5 -0
  268. package/build/version.d.ts.map +1 -0
  269. package/{dist/types → build}/video/canvas/canvas_renderer.d.ts +40 -32
  270. package/build/video/canvas/canvas_renderer.d.ts.map +1 -0
  271. package/{dist/types → build}/video/renderer.d.ts +36 -29
  272. package/build/video/renderer.d.ts.map +1 -0
  273. package/{dist/types → build}/video/rendertarget/canvasrendertarget.d.ts +8 -26
  274. package/build/video/rendertarget/canvasrendertarget.d.ts.map +1 -0
  275. package/{dist/types → build}/video/texture/atlas.d.ts +8 -8
  276. package/build/video/texture/atlas.d.ts.map +1 -0
  277. package/{dist/types → build}/video/texture/cache.d.ts +4 -3
  278. package/build/video/texture/cache.d.ts.map +1 -0
  279. package/{dist/types → build}/video/texture/parser/aseprite.d.ts +1 -0
  280. package/build/video/texture/parser/aseprite.d.ts.map +1 -0
  281. package/{dist/types → build}/video/texture/parser/spritesheet.d.ts +1 -0
  282. package/build/video/texture/parser/spritesheet.d.ts.map +1 -0
  283. package/{dist/types → build}/video/texture/parser/texturepacker.d.ts +1 -0
  284. package/build/video/texture/parser/texturepacker.d.ts.map +1 -0
  285. package/build/video/utils/autodetect.d.ts +8 -0
  286. package/build/video/utils/autodetect.d.ts.map +1 -0
  287. package/{dist/types → build}/video/video.d.ts +4 -3
  288. package/build/video/video.d.ts.map +1 -0
  289. package/{dist/types → build}/video/webgl/buffer/vertex.d.ts +5 -6
  290. package/build/video/webgl/buffer/vertex.d.ts.map +1 -0
  291. package/{dist/types → build}/video/webgl/compositors/compositor.d.ts +4 -4
  292. package/build/video/webgl/compositors/compositor.d.ts.map +1 -0
  293. package/{dist/types → build}/video/webgl/compositors/primitive_compositor.d.ts +4 -5
  294. package/build/video/webgl/compositors/primitive_compositor.d.ts.map +1 -0
  295. package/{dist/types → build}/video/webgl/compositors/quad_compositor.d.ts +4 -5
  296. package/build/video/webgl/compositors/quad_compositor.d.ts.map +1 -0
  297. package/{dist/types → build}/video/webgl/glshader.d.ts +2 -2
  298. package/build/video/webgl/glshader.d.ts.map +1 -0
  299. package/{dist/types → build}/video/webgl/utils/attributes.d.ts +1 -0
  300. package/build/video/webgl/utils/attributes.d.ts.map +1 -0
  301. package/{dist/types → build}/video/webgl/utils/precision.d.ts +1 -0
  302. package/build/video/webgl/utils/precision.d.ts.map +1 -0
  303. package/{dist/types → build}/video/webgl/utils/program.d.ts +1 -0
  304. package/build/video/webgl/utils/program.d.ts.map +1 -0
  305. package/{dist/types → build}/video/webgl/utils/string.d.ts +1 -0
  306. package/build/video/webgl/utils/string.d.ts.map +1 -0
  307. package/{dist/types → build}/video/webgl/utils/uniforms.d.ts +1 -0
  308. package/build/video/webgl/utils/uniforms.d.ts.map +1 -0
  309. package/{dist/types → build}/video/webgl/webgl_renderer.d.ts +37 -29
  310. package/build/video/webgl/webgl_renderer.d.ts.map +1 -0
  311. package/package.json +83 -104
  312. package/LICENSE.md +0 -21
  313. package/README.md +0 -223
  314. package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +0 -14
  315. package/dist/melonjs.mjs/_virtual/earcut.js +0 -10
  316. package/dist/melonjs.mjs/_virtual/howler.js +0 -10
  317. package/dist/melonjs.mjs/_virtual/index.js +0 -10
  318. package/dist/melonjs.mjs/_virtual/re.js +0 -10
  319. package/dist/melonjs.mjs/application/application.js +0 -443
  320. package/dist/melonjs.mjs/application/header.js +0 -40
  321. package/dist/melonjs.mjs/application/resize.js +0 -128
  322. package/dist/melonjs.mjs/application/settings.js +0 -70
  323. package/dist/melonjs.mjs/audio/audio.js +0 -623
  324. package/dist/melonjs.mjs/camera/camera2d.js +0 -737
  325. package/dist/melonjs.mjs/const.js +0 -32
  326. package/dist/melonjs.mjs/geometries/ellipse.js +0 -253
  327. package/dist/melonjs.mjs/geometries/line.js +0 -113
  328. package/dist/melonjs.mjs/geometries/path2d.js +0 -479
  329. package/dist/melonjs.mjs/geometries/point.js +0 -85
  330. package/dist/melonjs.mjs/geometries/poly.js +0 -441
  331. package/dist/melonjs.mjs/geometries/rectangle.js +0 -335
  332. package/dist/melonjs.mjs/geometries/roundrect.js +0 -165
  333. package/dist/melonjs.mjs/geometries/toarccanvas.js +0 -103
  334. package/dist/melonjs.mjs/index.js +0 -239
  335. package/dist/melonjs.mjs/input/gamepad.js +0 -495
  336. package/dist/melonjs.mjs/input/input.js +0 -26
  337. package/dist/melonjs.mjs/input/keyboard.js +0 -470
  338. package/dist/melonjs.mjs/input/pointer.js +0 -393
  339. package/dist/melonjs.mjs/input/pointerevent.js +0 -807
  340. package/dist/melonjs.mjs/lang/console.js +0 -44
  341. package/dist/melonjs.mjs/lang/deprecated.js +0 -200
  342. package/dist/melonjs.mjs/level/level.js +0 -298
  343. package/dist/melonjs.mjs/level/tiled/TMXGroup.js +0 -120
  344. package/dist/melonjs.mjs/level/tiled/TMXLayer.js +0 -432
  345. package/dist/melonjs.mjs/level/tiled/TMXObject.js +0 -295
  346. package/dist/melonjs.mjs/level/tiled/TMXTile.js +0 -177
  347. package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +0 -574
  348. package/dist/melonjs.mjs/level/tiled/TMXTileset.js +0 -292
  349. package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +0 -74
  350. package/dist/melonjs.mjs/level/tiled/TMXUtils.js +0 -417
  351. package/dist/melonjs.mjs/level/tiled/constants.js +0 -17
  352. package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +0 -503
  353. package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +0 -215
  354. package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +0 -155
  355. package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +0 -113
  356. package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +0 -107
  357. package/dist/melonjs.mjs/level/tiled/renderer/autodetect.js +0 -38
  358. package/dist/melonjs.mjs/loader/cache.js +0 -30
  359. package/dist/melonjs.mjs/loader/loader.js +0 -729
  360. package/dist/melonjs.mjs/loader/loadingscreen.js +0 -118
  361. package/dist/melonjs.mjs/loader/melonjs_logo.png.js +0 -10
  362. package/dist/melonjs.mjs/loader/parsers/binary.js +0 -42
  363. package/dist/melonjs.mjs/loader/parsers/compressed_textures/compressed_image.js +0 -58
  364. package/dist/melonjs.mjs/loader/parsers/compressed_textures/parseDDS.js +0 -13
  365. package/dist/melonjs.mjs/loader/parsers/compressed_textures/parseKTX.js +0 -13
  366. package/dist/melonjs.mjs/loader/parsers/compressed_textures/parseKTX2.js +0 -13
  367. package/dist/melonjs.mjs/loader/parsers/compressed_textures/parsePKM.js +0 -13
  368. package/dist/melonjs.mjs/loader/parsers/compressed_textures/parsePVR.js +0 -136
  369. package/dist/melonjs.mjs/loader/parsers/fetchdata.js +0 -62
  370. package/dist/melonjs.mjs/loader/parsers/fontface.js +0 -62
  371. package/dist/melonjs.mjs/loader/parsers/image.js +0 -129
  372. package/dist/melonjs.mjs/loader/parsers/json.js +0 -43
  373. package/dist/melonjs.mjs/loader/parsers/script.js +0 -46
  374. package/dist/melonjs.mjs/loader/parsers/tmx.js +0 -103
  375. package/dist/melonjs.mjs/loader/parsers/video.js +0 -99
  376. package/dist/melonjs.mjs/math/color.js +0 -635
  377. package/dist/melonjs.mjs/math/math.js +0 -221
  378. package/dist/melonjs.mjs/math/matrix2.js +0 -495
  379. package/dist/melonjs.mjs/math/matrix3.js +0 -628
  380. package/dist/melonjs.mjs/math/observable_vector2.js +0 -468
  381. package/dist/melonjs.mjs/math/observable_vector3.js +0 -564
  382. package/dist/melonjs.mjs/math/vector2.js +0 -431
  383. package/dist/melonjs.mjs/math/vector3.js +0 -473
  384. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/arraymultimap.js +0 -45
  385. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/multimap.js +0 -130
  386. package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +0 -694
  387. package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +0 -352
  388. package/dist/melonjs.mjs/node_modules/eventemitter3/index2.js +0 -12
  389. package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +0 -3246
  390. package/dist/melonjs.mjs/node_modules/semver/classes/comparator.js +0 -165
  391. package/dist/melonjs.mjs/node_modules/semver/classes/range.js +0 -565
  392. package/dist/melonjs.mjs/node_modules/semver/classes/semver.js +0 -317
  393. package/dist/melonjs.mjs/node_modules/semver/functions/clean.js +0 -17
  394. package/dist/melonjs.mjs/node_modules/semver/functions/cmp.js +0 -68
  395. package/dist/melonjs.mjs/node_modules/semver/functions/coerce.js +0 -73
  396. package/dist/melonjs.mjs/node_modules/semver/functions/compare-build.js +0 -18
  397. package/dist/melonjs.mjs/node_modules/semver/functions/compare-loose.js +0 -14
  398. package/dist/melonjs.mjs/node_modules/semver/functions/compare.js +0 -16
  399. package/dist/melonjs.mjs/node_modules/semver/functions/diff.js +0 -76
  400. package/dist/melonjs.mjs/node_modules/semver/functions/eq.js +0 -14
  401. package/dist/melonjs.mjs/node_modules/semver/functions/gt.js +0 -14
  402. package/dist/melonjs.mjs/node_modules/semver/functions/gte.js +0 -14
  403. package/dist/melonjs.mjs/node_modules/semver/functions/inc.js +0 -30
  404. package/dist/melonjs.mjs/node_modules/semver/functions/lt.js +0 -14
  405. package/dist/melonjs.mjs/node_modules/semver/functions/lte.js +0 -14
  406. package/dist/melonjs.mjs/node_modules/semver/functions/major.js +0 -14
  407. package/dist/melonjs.mjs/node_modules/semver/functions/minor.js +0 -14
  408. package/dist/melonjs.mjs/node_modules/semver/functions/neq.js +0 -14
  409. package/dist/melonjs.mjs/node_modules/semver/functions/parse.js +0 -27
  410. package/dist/melonjs.mjs/node_modules/semver/functions/patch.js +0 -14
  411. package/dist/melonjs.mjs/node_modules/semver/functions/prerelease.js +0 -17
  412. package/dist/melonjs.mjs/node_modules/semver/functions/rcompare.js +0 -14
  413. package/dist/melonjs.mjs/node_modules/semver/functions/rsort.js +0 -14
  414. package/dist/melonjs.mjs/node_modules/semver/functions/satisfies.js +0 -21
  415. package/dist/melonjs.mjs/node_modules/semver/functions/sort.js +0 -14
  416. package/dist/melonjs.mjs/node_modules/semver/functions/valid.js +0 -17
  417. package/dist/melonjs.mjs/node_modules/semver/index.js +0 -140
  418. package/dist/melonjs.mjs/node_modules/semver/internal/constants.js +0 -44
  419. package/dist/melonjs.mjs/node_modules/semver/internal/debug.js +0 -18
  420. package/dist/melonjs.mjs/node_modules/semver/internal/identifiers.js +0 -32
  421. package/dist/melonjs.mjs/node_modules/semver/internal/lrucache.js +0 -49
  422. package/dist/melonjs.mjs/node_modules/semver/internal/parse-options.js +0 -24
  423. package/dist/melonjs.mjs/node_modules/semver/internal/re.js +0 -234
  424. package/dist/melonjs.mjs/node_modules/semver/ranges/gtr.js +0 -15
  425. package/dist/melonjs.mjs/node_modules/semver/ranges/intersects.js +0 -18
  426. package/dist/melonjs.mjs/node_modules/semver/ranges/ltr.js +0 -15
  427. package/dist/melonjs.mjs/node_modules/semver/ranges/max-satisfying.js +0 -37
  428. package/dist/melonjs.mjs/node_modules/semver/ranges/min-satisfying.js +0 -36
  429. package/dist/melonjs.mjs/node_modules/semver/ranges/min-version.js +0 -74
  430. package/dist/melonjs.mjs/node_modules/semver/ranges/outside.js +0 -98
  431. package/dist/melonjs.mjs/node_modules/semver/ranges/simplify.js +0 -59
  432. package/dist/melonjs.mjs/node_modules/semver/ranges/subset.js +0 -261
  433. package/dist/melonjs.mjs/node_modules/semver/ranges/to-comparators.js +0 -19
  434. package/dist/melonjs.mjs/node_modules/semver/ranges/valid.js +0 -22
  435. package/dist/melonjs.mjs/particles/emitter.js +0 -265
  436. package/dist/melonjs.mjs/particles/particle.js +0 -190
  437. package/dist/melonjs.mjs/particles/settings.js +0 -317
  438. package/dist/melonjs.mjs/physics/body.js +0 -717
  439. package/dist/melonjs.mjs/physics/bounds.js +0 -415
  440. package/dist/melonjs.mjs/physics/collision.js +0 -135
  441. package/dist/melonjs.mjs/physics/detector.js +0 -227
  442. package/dist/melonjs.mjs/physics/quadtree.js +0 -402
  443. package/dist/melonjs.mjs/physics/response.js +0 -57
  444. package/dist/melonjs.mjs/physics/sat.js +0 -492
  445. package/dist/melonjs.mjs/physics/world.js +0 -228
  446. package/dist/melonjs.mjs/plugin/plugin.js +0 -172
  447. package/dist/melonjs.mjs/renderable/collectable.js +0 -60
  448. package/dist/melonjs.mjs/renderable/colorlayer.js +0 -83
  449. package/dist/melonjs.mjs/renderable/container.js +0 -1016
  450. package/dist/melonjs.mjs/renderable/draggable.js +0 -121
  451. package/dist/melonjs.mjs/renderable/dragndrop.js +0 -119
  452. package/dist/melonjs.mjs/renderable/entity/entity.js +0 -263
  453. package/dist/melonjs.mjs/renderable/imagelayer.js +0 -293
  454. package/dist/melonjs.mjs/renderable/light2d.js +0 -172
  455. package/dist/melonjs.mjs/renderable/nineslicesprite.js +0 -248
  456. package/dist/melonjs.mjs/renderable/renderable.js +0 -878
  457. package/dist/melonjs.mjs/renderable/sprite.js +0 -700
  458. package/dist/melonjs.mjs/renderable/text/bitmaptext.js +0 -421
  459. package/dist/melonjs.mjs/renderable/text/bitmaptextdata.js +0 -195
  460. package/dist/melonjs.mjs/renderable/text/glyph.js +0 -65
  461. package/dist/melonjs.mjs/renderable/text/text.js +0 -424
  462. package/dist/melonjs.mjs/renderable/text/textmetrics.js +0 -176
  463. package/dist/melonjs.mjs/renderable/text/textstyle.js +0 -21
  464. package/dist/melonjs.mjs/renderable/trigger.js +0 -163
  465. package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +0 -285
  466. package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +0 -231
  467. package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +0 -146
  468. package/dist/melonjs.mjs/state/stage.js +0 -235
  469. package/dist/melonjs.mjs/state/state.js +0 -548
  470. package/dist/melonjs.mjs/system/device.js +0 -872
  471. package/dist/melonjs.mjs/system/dom.js +0 -79
  472. package/dist/melonjs.mjs/system/event.js +0 -606
  473. package/dist/melonjs.mjs/system/platform.js +0 -43
  474. package/dist/melonjs.mjs/system/pooling.js +0 -182
  475. package/dist/melonjs.mjs/system/save.js +0 -157
  476. package/dist/melonjs.mjs/system/timer.js +0 -274
  477. package/dist/melonjs.mjs/tweens/easing.js +0 -334
  478. package/dist/melonjs.mjs/tweens/interpolation.js +0 -112
  479. package/dist/melonjs.mjs/tweens/tween.js +0 -479
  480. package/dist/melonjs.mjs/utils/agent.js +0 -77
  481. package/dist/melonjs.mjs/utils/array.js +0 -63
  482. package/dist/melonjs.mjs/utils/file.js +0 -54
  483. package/dist/melonjs.mjs/utils/function.js +0 -69
  484. package/dist/melonjs.mjs/utils/string.js +0 -82
  485. package/dist/melonjs.mjs/utils/utils.js +0 -139
  486. package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +0 -914
  487. package/dist/melonjs.mjs/video/renderer.js +0 -402
  488. package/dist/melonjs.mjs/video/rendertarget/canvasrendertarget.js +0 -316
  489. package/dist/melonjs.mjs/video/texture/atlas.js +0 -465
  490. package/dist/melonjs.mjs/video/texture/cache.js +0 -186
  491. package/dist/melonjs.mjs/video/texture/parser/aseprite.js +0 -78
  492. package/dist/melonjs.mjs/video/texture/parser/spritesheet.js +0 -77
  493. package/dist/melonjs.mjs/video/texture/parser/texturepacker.js +0 -64
  494. package/dist/melonjs.mjs/video/utils/autodetect.js +0 -27
  495. package/dist/melonjs.mjs/video/video.js +0 -142
  496. package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +0 -146
  497. package/dist/melonjs.mjs/video/webgl/compositors/compositor.js +0 -240
  498. package/dist/melonjs.mjs/video/webgl/compositors/primitive_compositor.js +0 -82
  499. package/dist/melonjs.mjs/video/webgl/compositors/quad_compositor.js +0 -259
  500. package/dist/melonjs.mjs/video/webgl/glshader.js +0 -166
  501. package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +0 -10
  502. package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +0 -10
  503. package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +0 -10
  504. package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +0 -10
  505. package/dist/melonjs.mjs/video/webgl/utils/attributes.js +0 -25
  506. package/dist/melonjs.mjs/video/webgl/utils/precision.js +0 -38
  507. package/dist/melonjs.mjs/video/webgl/utils/program.js +0 -67
  508. package/dist/melonjs.mjs/video/webgl/utils/string.js +0 -25
  509. package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +0 -92
  510. package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +0 -1246
  511. package/dist/melonjs.module.js +0 -43200
  512. package/dist/types/application/settings.d.ts +0 -106
  513. package/dist/types/const.d.ts +0 -21
  514. package/dist/types/geometries/ellipse.d.ts +0 -138
  515. package/dist/types/geometries/line.d.ts +0 -15
  516. package/dist/types/geometries/point.d.ts +0 -50
  517. package/dist/types/geometries/poly.d.ts +0 -186
  518. package/dist/types/geometries/rectangle.d.ts +0 -135
  519. package/dist/types/geometries/roundrect.d.ts +0 -43
  520. package/dist/types/geometries/toarccanvas.d.ts +0 -10
  521. package/dist/types/input/keyboard.d.ts +0 -205
  522. package/dist/types/input/pointer.d.ts +0 -261
  523. package/dist/types/lang/deprecated.d.ts +0 -68
  524. package/dist/types/loader/cache.d.ts +0 -9
  525. package/dist/types/loader/parsers/compressed_textures/parseDDS.d.ts +0 -1
  526. package/dist/types/loader/parsers/compressed_textures/parseKTX.d.ts +0 -1
  527. package/dist/types/loader/parsers/compressed_textures/parseKTX2.d.ts +0 -1
  528. package/dist/types/loader/parsers/compressed_textures/parsePKM.d.ts +0 -1
  529. package/dist/types/loader/parsers/compressed_textures/parsePVR.d.ts +0 -1
  530. package/dist/types/math/color.d.ts +0 -179
  531. package/dist/types/math/math.d.ts +0 -149
  532. package/dist/types/math/matrix2.d.ts +0 -174
  533. package/dist/types/math/matrix3.d.ts +0 -186
  534. package/dist/types/math/observable_vector2.d.ts +0 -278
  535. package/dist/types/math/observable_vector3.d.ts +0 -300
  536. package/dist/types/math/vector2.d.ts +0 -255
  537. package/dist/types/math/vector3.d.ts +0 -271
  538. package/dist/types/particles/particle.d.ts +0 -36
  539. package/dist/types/physics/bounds.d.ts +0 -203
  540. package/dist/types/polyfill/console.d.ts +0 -1
  541. package/dist/types/polyfill/index.d.ts +0 -1
  542. package/dist/types/polyfill/roundrect.d.ts +0 -1
  543. package/dist/types/renderable/light2d.d.ts +0 -60
  544. package/dist/types/renderable/text/bitmaptextdata.d.ts +0 -35
  545. package/dist/types/system/dom.d.ts +0 -1
  546. package/dist/types/system/platform.d.ts +0 -33
  547. package/dist/types/system/save.d.ts +0 -25
  548. package/dist/types/system/timer.d.ts +0 -126
  549. package/dist/types/tweens/easing.d.ts +0 -46
  550. package/dist/types/tweens/interpolation.d.ts +0 -18
  551. package/dist/types/tweens/tween.d.ts +0 -195
  552. package/dist/types/utils/agent.d.ts +0 -21
  553. package/dist/types/utils/array.d.ts +0 -39
  554. package/dist/types/utils/file.d.ts +0 -27
  555. package/dist/types/utils/function.d.ts +0 -31
  556. package/dist/types/utils/string.d.ts +0 -50
  557. package/dist/types/utils/utils.d.ts +0 -54
  558. package/dist/types/video/utils/autodetect.d.ts +0 -5
  559. package/src/application/application.js +0 -435
  560. package/src/application/header.js +0 -31
  561. package/src/application/resize.js +0 -119
  562. package/src/application/settings.js +0 -61
  563. package/src/audio/audio.js +0 -622
  564. package/src/camera/camera2d.js +0 -731
  565. package/src/const.js +0 -23
  566. package/src/geometries/ellipse.js +0 -244
  567. package/src/geometries/line.js +0 -104
  568. package/src/geometries/path2d.js +0 -470
  569. package/src/geometries/point.js +0 -76
  570. package/src/geometries/poly.js +0 -432
  571. package/src/geometries/rectangle.js +0 -326
  572. package/src/geometries/roundrect.js +0 -156
  573. package/src/geometries/toarccanvas.js +0 -94
  574. package/src/index.js +0 -315
  575. package/src/input/gamepad.js +0 -487
  576. package/src/input/input.js +0 -17
  577. package/src/input/keyboard.js +0 -461
  578. package/src/input/pointer.js +0 -386
  579. package/src/input/pointerevent.js +0 -798
  580. package/src/lang/console.js +0 -36
  581. package/src/lang/deprecated.js +0 -192
  582. package/src/level/level.js +0 -290
  583. package/src/level/tiled/TMXGroup.js +0 -111
  584. package/src/level/tiled/TMXLayer.js +0 -424
  585. package/src/level/tiled/TMXObject.js +0 -286
  586. package/src/level/tiled/TMXTile.js +0 -168
  587. package/src/level/tiled/TMXTileMap.js +0 -569
  588. package/src/level/tiled/TMXTileset.js +0 -284
  589. package/src/level/tiled/TMXTilesetGroup.js +0 -66
  590. package/src/level/tiled/TMXUtils.js +0 -408
  591. package/src/level/tiled/constants.js +0 -8
  592. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +0 -497
  593. package/src/level/tiled/renderer/TMXIsometricRenderer.js +0 -208
  594. package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +0 -149
  595. package/src/level/tiled/renderer/TMXRenderer.js +0 -103
  596. package/src/level/tiled/renderer/TMXStaggeredRenderer.js +0 -100
  597. package/src/level/tiled/renderer/autodetect.js +0 -29
  598. package/src/loader/cache.js +0 -22
  599. package/src/loader/loader.js +0 -728
  600. package/src/loader/loadingscreen.js +0 -112
  601. package/src/loader/melonjs_logo.png +0 -0
  602. package/src/loader/parsers/binary.js +0 -33
  603. package/src/loader/parsers/compressed_textures/compressed_image.js +0 -49
  604. package/src/loader/parsers/compressed_textures/parseDDS.js +0 -5
  605. package/src/loader/parsers/compressed_textures/parseKTX.js +0 -5
  606. package/src/loader/parsers/compressed_textures/parseKTX2.js +0 -5
  607. package/src/loader/parsers/compressed_textures/parsePKM.js +0 -5
  608. package/src/loader/parsers/compressed_textures/parsePVR.js +0 -127
  609. package/src/loader/parsers/fetchdata.js +0 -53
  610. package/src/loader/parsers/fontface.js +0 -54
  611. package/src/loader/parsers/image.js +0 -120
  612. package/src/loader/parsers/json.js +0 -35
  613. package/src/loader/parsers/script.js +0 -37
  614. package/src/loader/parsers/tmx.js +0 -95
  615. package/src/loader/parsers/video.js +0 -90
  616. package/src/math/color.js +0 -627
  617. package/src/math/math.js +0 -212
  618. package/src/math/matrix2.js +0 -487
  619. package/src/math/matrix3.js +0 -620
  620. package/src/math/observable_vector2.js +0 -460
  621. package/src/math/observable_vector3.js +0 -556
  622. package/src/math/vector2.js +0 -423
  623. package/src/math/vector3.js +0 -465
  624. package/src/particles/emitter.js +0 -258
  625. package/src/particles/particle.js +0 -182
  626. package/src/particles/settings.js +0 -310
  627. package/src/physics/body.js +0 -709
  628. package/src/physics/bounds.js +0 -407
  629. package/src/physics/collision.js +0 -128
  630. package/src/physics/detector.js +0 -218
  631. package/src/physics/quadtree.js +0 -393
  632. package/src/physics/response.js +0 -48
  633. package/src/physics/sat.js +0 -483
  634. package/src/physics/world.js +0 -220
  635. package/src/plugin/plugin.js +0 -163
  636. package/src/polyfill/console.js +0 -11
  637. package/src/polyfill/index.js +0 -13
  638. package/src/polyfill/roundrect.js +0 -237
  639. package/src/renderable/collectable.js +0 -51
  640. package/src/renderable/colorlayer.js +0 -74
  641. package/src/renderable/container.js +0 -1008
  642. package/src/renderable/draggable.js +0 -114
  643. package/src/renderable/dragndrop.js +0 -110
  644. package/src/renderable/entity/entity.js +0 -254
  645. package/src/renderable/imagelayer.js +0 -284
  646. package/src/renderable/light2d.js +0 -163
  647. package/src/renderable/nineslicesprite.js +0 -239
  648. package/src/renderable/renderable.js +0 -869
  649. package/src/renderable/sprite.js +0 -691
  650. package/src/renderable/text/bitmaptext.js +0 -418
  651. package/src/renderable/text/bitmaptextdata.js +0 -186
  652. package/src/renderable/text/glyph.js +0 -57
  653. package/src/renderable/text/text.js +0 -415
  654. package/src/renderable/text/textmetrics.js +0 -167
  655. package/src/renderable/text/textstyle.js +0 -12
  656. package/src/renderable/trigger.js +0 -154
  657. package/src/renderable/ui/uibaseelement.js +0 -276
  658. package/src/renderable/ui/uispriteelement.js +0 -223
  659. package/src/renderable/ui/uitextbutton.js +0 -140
  660. package/src/state/stage.js +0 -226
  661. package/src/state/state.js +0 -541
  662. package/src/system/device.js +0 -863
  663. package/src/system/dom.js +0 -70
  664. package/src/system/event.js +0 -597
  665. package/src/system/platform.js +0 -34
  666. package/src/system/pooling.js +0 -190
  667. package/src/system/save.js +0 -148
  668. package/src/system/timer.js +0 -281
  669. package/src/tweens/easing.js +0 -325
  670. package/src/tweens/interpolation.js +0 -103
  671. package/src/tweens/tween.js +0 -470
  672. package/src/utils/agent.js +0 -68
  673. package/src/utils/array.js +0 -54
  674. package/src/utils/file.js +0 -46
  675. package/src/utils/function.js +0 -60
  676. package/src/utils/string.js +0 -73
  677. package/src/utils/utils.js +0 -127
  678. package/src/video/canvas/canvas_renderer.js +0 -905
  679. package/src/video/renderer.js +0 -393
  680. package/src/video/rendertarget/canvasrendertarget.js +0 -309
  681. package/src/video/texture/atlas.js +0 -456
  682. package/src/video/texture/cache.js +0 -178
  683. package/src/video/texture/parser/aseprite.js +0 -69
  684. package/src/video/texture/parser/spritesheet.js +0 -68
  685. package/src/video/texture/parser/texturepacker.js +0 -55
  686. package/src/video/utils/autodetect.js +0 -18
  687. package/src/video/video.js +0 -160
  688. package/src/video/webgl/buffer/vertex.js +0 -137
  689. package/src/video/webgl/compositors/compositor.js +0 -231
  690. package/src/video/webgl/compositors/primitive_compositor.js +0 -73
  691. package/src/video/webgl/compositors/quad_compositor.js +0 -250
  692. package/src/video/webgl/glshader.js +0 -158
  693. package/src/video/webgl/shaders/primitive.frag +0 -5
  694. package/src/video/webgl/shaders/primitive.vert +0 -15
  695. package/src/video/webgl/shaders/quad.frag +0 -7
  696. package/src/video/webgl/shaders/quad.vert +0 -18
  697. package/src/video/webgl/utils/attributes.js +0 -16
  698. package/src/video/webgl/utils/precision.js +0 -29
  699. package/src/video/webgl/utils/program.js +0 -58
  700. package/src/video/webgl/utils/string.js +0 -16
  701. package/src/video/webgl/utils/uniforms.js +0 -84
  702. package/src/video/webgl/webgl_renderer.js +0 -1237
@@ -1,1008 +0,0 @@
1
- import Renderable from "./renderable.js";
2
- import { createGUID } from "../utils/utils";
3
- import { defer } from "../utils/function";
4
- import { game } from "../index.js";
5
- import * as event from "../system/event.js";
6
- import pool from "../system/pooling.js";
7
- import state from "../state/state.js";
8
- import Body from "../physics/body.js";
9
-
10
-
11
- /**
12
- * Private function to re-use for object removal in a defer
13
- * @ignore
14
- */
15
- function deferredRemove(child, keepalive) {
16
- this.removeChildNow(child, keepalive);
17
- }
18
-
19
- let globalFloatingCounter = 0;
20
-
21
- /**
22
- * additional import for TypeScript
23
- * @import Color from "./../math/color.js";
24
- * @import Entity from "./entity/entity.js";
25
- * @import Sprite from "./sprite.js";
26
- * @import Collectable from "./collectable.js";
27
- * @import Trigger from "./trigger.js";
28
- * @import { Draggable } from "./draggable.js";
29
- * @import { DropTarget } from "./dragndrop.js";
30
- * @import NineSliceSprite from "./nineslicesprite.js";
31
- * @import ImageLayer from "./imagelayer.js";
32
- * @import ColorLayer from "./colorlayer.js";
33
- * @import Light2d from "./light2d.js";
34
- * @import UIBaseElement from "./ui/uibaseelement.js";
35
- * @import UISpriteElement from "./ui/uispriteelement.js";
36
- * @import UITextButton from "./ui/uitextbutton.js";
37
- * @import Text from "./text/text.js";
38
- * @import BitmapText from "./text/bitmaptext.js";
39
- * @import Bounds from "./../physics/bounds.js";
40
- * @import CanvasRenderer from "./../video/canvas/canvas_renderer.js";
41
- * @import WebGLRenderer from "./../video/webgl/webgl_renderer.js";
42
- */
43
-
44
- /**
45
- * @classdesc
46
- * Container represents a collection of child objects
47
- * @augments Renderable
48
- */
49
- export default class Container extends Renderable {
50
- /**
51
- * @param {number} [x=0] - position of the container (accessible via the inherited pos.x property)
52
- * @param {number} [y=0] - position of the container (accessible via the inherited pos.y property)
53
- * @param {number} [width=game.viewport.width] - width of the container
54
- * @param {number} [height=game.viewport.height] - height of the container
55
- */
56
- constructor(x = 0, y = 0, width, height, root = false) {
57
-
58
- // call the super constructor
59
- super(
60
- x, y,
61
- typeof width === "undefined" ? (typeof game.viewport !== "undefined" ? game.viewport.width : Infinity) : width,
62
- typeof height === "undefined" ? (typeof game.viewport !== "undefined" ? game.viewport.height : Infinity) : height
63
- );
64
-
65
- /**
66
- * keep track of pending sort
67
- * @ignore
68
- */
69
- this.pendingSort = null;
70
-
71
- /**
72
- * whether the container is the root of the scene
73
- * @type {boolean}
74
- * @default false
75
- */
76
- this.root = root;
77
-
78
- /**
79
- * The array of children of this container.
80
- * @ignore
81
- */
82
- this.children = undefined;
83
-
84
- /**
85
- * The property of the child object that should be used to sort on this container
86
- * value : "x", "y", "z"
87
- * @type {string}
88
- * @default "z"
89
- */
90
- this.sortOn = "z";
91
-
92
- /**
93
- * Specify if the children list should be automatically sorted when adding a new child
94
- * @type {boolean}
95
- * @default true
96
- */
97
- this.autoSort = true;
98
-
99
- /**
100
- * Specify if the children z index should automatically be managed by the parent container
101
- * @type {boolean}
102
- * @default true
103
- */
104
- this.autoDepth = true;
105
-
106
- /**
107
- * Specify if the container draw operation should clip his children to its own bounds
108
- * @type {boolean}
109
- * @default false
110
- */
111
- this.clipping = false;
112
-
113
- /**
114
- * a callback to be extended, triggered after a child has been added or removed
115
- * @param {number} index - added or removed child index
116
- */
117
- this.onChildChange = function (index) { // eslint-disable-line no-unused-vars
118
- // to be extended
119
- };
120
-
121
- /**
122
- * Specify if the container bounds should automatically take in account
123
- * all child bounds when updated (this is expensive and disabled by default,
124
- * only enable if necessary)
125
- * @type {boolean}
126
- * @default false
127
- */
128
- this.enableChildBoundsUpdate = false;
129
-
130
- /**
131
- * define a background color for this container
132
- * @type {Color}
133
- * @default (0, 0, 0, 0.0)
134
- * @example
135
- * // add a red background color to this container
136
- * this.backgroundColor.setColor(255, 0, 0);
137
- */
138
- this.backgroundColor = pool.pull("Color", 0, 0, 0, 0.0);
139
-
140
- /**
141
- * Used by the debug panel plugin
142
- * @ignore
143
- */
144
- this.drawCount = 0;
145
-
146
- // container self apply any defined transformation
147
- this.autoTransform = true;
148
-
149
- // enable collision and event detection
150
- this.isKinematic = false;
151
-
152
- this.anchorPoint.set(0, 0);
153
-
154
- // subscribe on the canvas resize event
155
- if (this.root === true) {
156
- // Workaround for not updating container child-bounds automatically (it's expensive!)
157
- event.on(event.CANVAS_ONRESIZE, () => {
158
- // temporarly enable the enableChildBoundsUpdate flag
159
- this.enableChildBoundsUpdate === true;
160
- // update bounds
161
- this.updateBounds();
162
- this.enableChildBoundsUpdate === false;
163
- });
164
- }
165
- }
166
-
167
- /**
168
- * reset the container, removing all childrens, and reseting transforms.
169
- */
170
- reset() {
171
- // cancel any sort operation
172
- if (this.pendingSort) {
173
- clearTimeout(this.pendingSort);
174
- this.pendingSort = null;
175
- }
176
-
177
- // delete all children
178
- let children = this.getChildren();
179
- for (let i = children.length, child; i >= 0; (child = children[--i])) {
180
- // don't remove it if a persistent object
181
- if (child && child.isPersistent !== true) {
182
- this.removeChildNow(child);
183
- }
184
- }
185
-
186
- if (typeof this.currentTransform !== "undefined") {
187
- // just reset some variables
188
- this.currentTransform.identity();
189
- }
190
-
191
- this.backgroundColor.setColor(0, 0, 0, 0.0);
192
- }
193
-
194
- /**
195
- * Add a child to the container <br>
196
- * if auto-sort is disable, the object will be appended at the bottom of the list.
197
- * Adding a child to the container will automatically remove it from its other container.
198
- * Meaning a child can only have one parent. This is important if you add a renderable
199
- * to a container then add it to the World container it will move it out of the
200
- * orginal container. Then when the World container reset() method is called the renderable
201
- * will not be in any container. <br>
202
- * if the given child implements a onActivateEvent method, that method will be called
203
- * once the child is added to this container.
204
- * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - Child to be added
205
- * @param {number} [z] - forces the z index of the child to the specified value
206
- * @returns {Renderable} the added child
207
- */
208
- addChild(child, z) {
209
- if (child.ancestor instanceof Container) {
210
- child.ancestor.removeChildNow(child);
211
- }
212
- else {
213
- // only allocate a GUID if the object has no previous ancestor
214
- // (e.g. move one child from one container to another)
215
- if (child.isRenderable) {
216
- // allocated a GUID value (use child.id as based index if defined)
217
- child.GUID = createGUID(child.id);
218
- }
219
- }
220
-
221
- // add the new child
222
- child.ancestor = this;
223
- this.getChildren().push(child);
224
-
225
- // update child bounds to reflect the new ancestor
226
- if (typeof child.updateBounds === "function") {
227
- if (this.isFloating === true) {
228
- // only parent container can be floating
229
- child.floating = false;
230
- }
231
- child.updateBounds();
232
- }
233
-
234
- // set the child z value if required
235
- if (typeof(child.pos) !== "undefined") {
236
- if (typeof(z) === "number") {
237
- child.pos.z = z;
238
- } else if (this.autoDepth === true) {
239
- child.pos.z = this.getChildren().length;
240
- }
241
- }
242
-
243
- if (this.autoSort === true) {
244
- this.sort();
245
- }
246
-
247
- if (typeof child.onActivateEvent === "function" && this.isAttachedToRoot()) {
248
- child.onActivateEvent();
249
- }
250
-
251
- // force container bounds update if required
252
- if (this.enableChildBoundsUpdate === true) {
253
- this.updateBounds();
254
- }
255
-
256
- // if a physic body(ies) to the game world
257
- if (this.isAttachedToRoot()) {
258
- let worldContainer = this.getRootAncestor();
259
- if (child.body instanceof Body) {
260
- worldContainer.addBody(child.body);
261
- }
262
- // if the child is a container
263
- if (child instanceof Container) {
264
- // add all container child bodies
265
- // TODO: make it recursive ?
266
- child.forEach((cchild) => {
267
- if (cchild.body instanceof Body) {
268
- worldContainer.addBody(cchild.body);
269
- }
270
- });
271
- }
272
- }
273
-
274
- // mark the container for repaint
275
- this.isDirty = true;
276
-
277
- // triggered callback if defined
278
- this.onChildChange.call(this, this.getChildren().length - 1);
279
-
280
- return child;
281
- }
282
-
283
- /**
284
- * Add a child to the container at the specified index<br>
285
- * (the list won't be sorted after insertion)
286
- * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - Child to be added
287
- * @param {number} index - The index at which to insert the child
288
- * @returns {Renderable} the added child
289
- */
290
- addChildAt(child, index) {
291
- if (index >= 0 && index < this.getChildren().length) {
292
- if (child.ancestor instanceof Container) {
293
- child.ancestor.removeChildNow(child);
294
- }
295
- else {
296
- // only allocate a GUID if the object has no previous ancestor
297
- // (e.g. move one child from one container to another)
298
- if (child.isRenderable) {
299
- // allocated a GUID value
300
- child.GUID = createGUID();
301
- }
302
- }
303
-
304
- // add the new child
305
- child.ancestor = this;
306
- this.getChildren().splice(index, 0, child);
307
-
308
- // update child bounds to reflect the new ancestor
309
- if (typeof child.updateBounds === "function") {
310
- if (this.isFloating === true) {
311
- // only parent container can be floating
312
- child.floating = false;
313
- }
314
- child.updateBounds();
315
- }
316
-
317
- if (typeof child.onActivateEvent === "function" && this.isAttachedToRoot()) {
318
- child.onActivateEvent();
319
- }
320
-
321
- // force container bounds update if required
322
- if (this.enableChildBoundsUpdate === true) {
323
- this.updateBounds();
324
- }
325
-
326
- // if a physic body(ies) to the game world
327
- if (this.isAttachedToRoot()) {
328
- let worldContainer = this.getRootAncestor();
329
- if (child.body instanceof Body) {
330
- worldContainer.addBody(child.body);
331
- }
332
- // if the child is a container
333
- if (child instanceof Container) {
334
- // add all container child bodies
335
- // TODO: make it recursive ?
336
- child.forEach((cchild) => {
337
- if (cchild.body instanceof Body) {
338
- worldContainer.addBody(cchild.body);
339
- }
340
- });
341
- }
342
- }
343
-
344
- // mark the container for repaint
345
- this.isDirty = true;
346
-
347
- // triggered callback if defined
348
- this.onChildChange.call(this, index);
349
-
350
- return child;
351
- }
352
- else {
353
- throw new Error("Index (" + index + ") Out Of Bounds for addChildAt()");
354
- }
355
- }
356
-
357
- /**
358
- * The forEach() method executes a provided function once per child element. <br>
359
- * the callback function is invoked with three arguments: <br>
360
- * - The current element being processed in the array <br>
361
- * - The index of element in the array. <br>
362
- * - The array forEach() was called upon. <br>
363
- * @param {Function} callback - fnction to execute on each element
364
- * @param {object} [thisArg] - value to use as this(i.e reference Object) when executing callback.
365
- * @example
366
- * // iterate through all children of this container
367
- * container.forEach((child) => {
368
- * // do something with the child
369
- * child.doSomething();
370
- * });
371
- * container.forEach((child, index) => { ... });
372
- * container.forEach((child, index, array) => { ... });
373
- * container.forEach((child, index, array) => { ... }, thisArg);
374
- */
375
- forEach(callback, thisArg) {
376
- let context = this, i = 0;
377
- let children = this.getChildren();
378
-
379
- let len = children.length;
380
-
381
- if (typeof callback !== "function") {
382
- throw new Error(callback + " is not a function");
383
- }
384
-
385
- if (arguments.length > 1) {
386
- context = thisArg;
387
- }
388
-
389
- while (i < len) {
390
- callback.call(context, children[i], i, children);
391
- i++;
392
- }
393
- }
394
-
395
- /**
396
- * Swaps the position (z-index) of 2 children
397
- * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - Child to be added
398
- * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child2 - Child to be added
399
- */
400
- swapChildren(child, child2) {
401
- let index = this.getChildIndex(child);
402
- let index2 = this.getChildIndex(child2);
403
-
404
- if ((index !== -1) && (index2 !== -1)) {
405
- // swap z index
406
- let _z = child.pos.z;
407
- child.pos.z = child2.pos.z;
408
- child2.pos.z = _z;
409
- // swap the positions..
410
- this.getChildren()[index] = child2;
411
- this.getChildren()[index2] = child;
412
- // mark the container as dirty
413
- this.isDirty = true;
414
- }
415
- else {
416
- throw new Error(child + " Both the supplied childs must be a child of the caller " + this);
417
- }
418
- }
419
-
420
- /**
421
- * Returns the Child at the specified index
422
- * @param {number} index - The index of the child
423
- * @returns {Renderable} the child at the specified index
424
- */
425
- getChildAt(index) {
426
- if (index >= 0 && index < this.getChildren().length) {
427
- return this.getChildren()[index];
428
- }
429
- else {
430
- throw new Error("Index (" + index + ") Out Of Bounds for getChildAt()");
431
- }
432
- }
433
-
434
- /**
435
- * Returns the index of the given Child
436
- * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - The child object
437
- * @returns {number} index
438
- */
439
- getChildIndex(child) {
440
- return this.getChildren().indexOf(child);
441
- }
442
-
443
- /**
444
- * Returns the next child within the container or undefined if none
445
- * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - The child object
446
- * @returns {Renderable} child
447
- */
448
- getNextChild(child) {
449
- let index = this.getChildren().indexOf(child) - 1;
450
- if (index >= 0 && index < this.getChildren().length) {
451
- return this.getChildAt(index);
452
- }
453
- return undefined;
454
- }
455
-
456
- /**
457
- * Returns true if contains the specified Child
458
- * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - The child object
459
- * @returns {boolean}
460
- */
461
- hasChild(child) {
462
- return this === child.ancestor;
463
- }
464
-
465
- /**
466
- * return the child corresponding to the given property and value.<br>
467
- * note : avoid calling this function every frame since
468
- * it parses the whole object tree each time
469
- * @param {string} prop - Property name
470
- * @param {string|RegExp|number|boolean} value - Value of the property
471
- * @returns {Renderable[]} Array of childs
472
- * @example
473
- * // get the first child object called "mainPlayer" in a specific container :
474
- * let ent = myContainer.getChildByProp("name", "mainPlayer");
475
- *
476
- * // or query the whole world :
477
- * let ent = container.getChildByProp("name", "mainPlayer");
478
- *
479
- * // partial property matches are also allowed by using a RegExp.
480
- * // the following matches "redCOIN", "bluecoin", "bagOfCoins", etc :
481
- * let allCoins = container.getChildByProp("name", /coin/i);
482
- *
483
- * // searching for numbers or other data types :
484
- * let zIndex10 = container.getChildByProp("z", 10);
485
- * let inViewport = container.getChildByProp("inViewport", true);
486
- */
487
- getChildByProp(prop, value) {
488
- let objList = [];
489
-
490
- /**
491
- * @ignore
492
- */
493
- function compare(obj, prop) {
494
- let v = obj[prop];
495
- if (value instanceof RegExp && typeof(v) === "string") {
496
- if (value.test(v)) {
497
- objList.push(obj);
498
- }
499
- }
500
- else if (v === value) {
501
- objList.push(obj);
502
- }
503
- }
504
-
505
- this.forEach((child) => {
506
- compare(child, prop);
507
- if (child instanceof Container) {
508
- objList = objList.concat(child.getChildByProp(prop, value));
509
- }
510
- });
511
-
512
- return objList;
513
- }
514
-
515
- /**
516
- * returns the list of childs with the specified class type
517
- * @param {object} classType - Class type
518
- * @returns {Renderable[]} Array of children
519
- */
520
- getChildByType(classType) {
521
- let objList = [];
522
-
523
- this.forEach((child) => {
524
- if (child instanceof classType) {
525
- objList.push(child);
526
- }
527
- if (child instanceof Container) {
528
- objList = objList.concat(child.getChildByType(classType));
529
- }
530
- });
531
-
532
- return objList;
533
- }
534
-
535
- /**
536
- * returns the list of childs with the specified name<br>
537
- * as defined in Tiled (Name field of the Object Properties)<br>
538
- * note : avoid calling this function every frame since
539
- * it parses the whole object list each time
540
- * @param {string|RegExp|number|boolean} name - child name
541
- * @returns {Renderable[]} Array of children
542
- */
543
- getChildByName(name) {
544
- return this.getChildByProp("name", name);
545
- }
546
-
547
- /**
548
- * return the child corresponding to the specified GUID<br>
549
- * note : avoid calling this function every frame since
550
- * it parses the whole object list each time
551
- * @param {string|RegExp|number|boolean} guid - child GUID
552
- * @returns {Renderable} corresponding child or null
553
- */
554
- getChildByGUID(guid) {
555
- let obj = this.getChildByProp("GUID", guid);
556
- return (obj.length > 0) ? obj[0] : null;
557
- }
558
-
559
- /**
560
- * return all child in this container
561
- * @returns {Renderable[]} an array of renderable object
562
- */
563
- getChildren() {
564
- if (typeof this.children === "undefined") {
565
- this.children = [];
566
- }
567
- return this.children;
568
- }
569
-
570
- /**
571
- * update the bounding box for this container.
572
- * @param {boolean} [absolute=true] - update the bounds size and position in (world) absolute coordinates
573
- * @returns {Bounds} this container bounding box Rectangle object
574
- */
575
- updateBounds(absolute = true) {
576
- let bounds = this.getBounds();
577
-
578
- // call parent method
579
- super.updateBounds(absolute);
580
-
581
- if (this.enableChildBoundsUpdate === true) {
582
- this.forEach((child) => {
583
- if (child.isRenderable) {
584
- let childBounds = child.updateBounds(true);
585
- if (childBounds.isFinite()) {
586
- bounds.addBounds(childBounds);
587
- }
588
- }
589
- });
590
- }
591
-
592
- return bounds;
593
- }
594
-
595
- /**
596
- * Checks if this container is root or if it's attached to the root container.
597
- * @returns {boolean} true if this container is root or if it's attached to the root container
598
- */
599
- isAttachedToRoot() {
600
- if (this.root === true) {
601
- return true;
602
- } else {
603
- let ancestor = this.ancestor;
604
- while (ancestor) {
605
- if (ancestor.root === true) {
606
- return true;
607
- }
608
- ancestor = ancestor.ancestor;
609
- }
610
- return false;
611
- }
612
- }
613
-
614
- /**
615
- * Returns the instance of the root container (i.e. the current application World container).
616
- * @returns {Container} root container
617
- */
618
- getRootAncestor() {
619
- if (this.root === true) {
620
- return this;
621
- } else {
622
- let ancestor = this.ancestor;
623
- while (ancestor) {
624
- if (ancestor.root === true) {
625
- break;
626
- }
627
- ancestor = ancestor.ancestor;
628
- }
629
- return ancestor;
630
- }
631
- }
632
-
633
- /**
634
- * update the cointainer's bounding rect (private)
635
- * @ignore
636
- */
637
- updateBoundsPos(newX = this.pos.x, newY = this.pos.y) {
638
- // call the parent method
639
- super.updateBoundsPos(newX, newY);
640
-
641
- // Notify children that the parent's position has changed
642
- this.forEach((child) => {
643
- if (child.isRenderable) {
644
- child.updateBoundsPos(
645
- child.pos.x + newX - this.pos.x,
646
- child.pos.y + newY - this.pos.y
647
- );
648
- }
649
- });
650
- }
651
-
652
- /**
653
- * @ignore
654
- */
655
- onActivateEvent() {
656
- this.forEach((child) => {
657
- if (typeof child.onActivateEvent === "function") {
658
- child.onActivateEvent();
659
- }
660
- });
661
- }
662
-
663
- /**
664
- * Invokes the removeChildNow in a defer, to ensure the child is removed safely after the update & draw stack has completed. <br>
665
- * if the given child implements a onDeactivateEvent() method, that method will be called once the child is removed from this container.
666
- * @param {Renderable|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - Child to be removed
667
- * @param {boolean} [keepalive=false] - true to prevent calling child.destroy()
668
- */
669
- removeChild(child, keepalive) {
670
- if (this.hasChild(child)) {
671
- defer(deferredRemove, this, child, keepalive);
672
- }
673
- else {
674
- throw new Error("Child is not mine.");
675
- }
676
- }
677
-
678
- /**
679
- * Removes (and optionally destroys) a child from the container.<br>
680
- * (removal is immediate and unconditional)<br>
681
- * Never use keepalive=true with objects from {@link pool}. Doing so will create a memory leak.
682
- * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - Child to be removed
683
- * @param {boolean} [keepalive=False] - True to prevent calling child.destroy()
684
- */
685
- removeChildNow(child, keepalive) {
686
- if (this.hasChild(child) && (this.getChildIndex(child) >= 0)) {
687
- if (typeof child.onDeactivateEvent === "function") {
688
- child.onDeactivateEvent();
689
- }
690
-
691
- // remove the body first to avoid a condition where a body can be detached
692
- // from its parent, before the body is removed from the game world
693
- if (child.body instanceof Body) {
694
- this.getRootAncestor().removeBody(child.body);
695
- }
696
-
697
- if (!keepalive) {
698
- // attempt at recycling the object
699
- if (pool.push(child, false) === false) {
700
- // else just destroy it
701
- if (typeof child.destroy === "function") {
702
- child.destroy();
703
- }
704
- }
705
- }
706
-
707
- // Don't cache the child index; another element might have been removed
708
- // by the child's `onDeactivateEvent` or `destroy` methods
709
- let childIndex = this.getChildIndex(child);
710
- if (childIndex >= 0) {
711
- this.getChildren().splice(childIndex, 1);
712
- child.ancestor = undefined;
713
- }
714
-
715
- // force bounds update if required
716
- if (this.enableChildBoundsUpdate === true) {
717
- this.updateBounds();
718
- }
719
-
720
- // mark the container for repaint
721
- this.isDirty = true;
722
-
723
- // triggered callback if defined
724
- this.onChildChange.call(this, childIndex);
725
- }
726
- }
727
-
728
- /**
729
- * Automatically set the specified property of all childs to the given value
730
- * @param {string} prop - property name
731
- * @param {object} value - property value
732
- * @param {boolean} [recursive=false] - recursively apply the value to child containers if true
733
- */
734
- setChildsProperty(prop, value, recursive) {
735
- this.forEach((child) => {
736
- if ((recursive === true) && (child instanceof Container)) {
737
- child.setChildsProperty(prop, value, recursive);
738
- }
739
- child[prop] = value;
740
- });
741
- }
742
-
743
- /**
744
- * Move the child in the group one step forward (z depth).
745
- * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - Child to be moved
746
- */
747
- moveUp(child) {
748
- let childIndex = this.getChildIndex(child);
749
- if (childIndex - 1 >= 0) {
750
- // note : we use an inverted loop
751
- this.swapChildren(child, this.getChildAt(childIndex - 1));
752
- // mark the container as dirty
753
- this.isDirty = true;
754
- }
755
- }
756
-
757
- /**
758
- * Move the child in the group one step backward (z depth).
759
- * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - Child to be moved
760
- */
761
- moveDown(child) {
762
- let childIndex = this.getChildIndex(child);
763
- if (childIndex >= 0 && (childIndex + 1) < this.getChildren().length) {
764
- // note : we use an inverted loop
765
- this.swapChildren(child, this.getChildAt(childIndex + 1));
766
- // mark the container as dirty
767
- this.isDirty = true;
768
- }
769
- }
770
-
771
- /**
772
- * Move the specified child to the top(z depth).
773
- * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - Child to be moved
774
- */
775
- moveToTop(child) {
776
- let childIndex = this.getChildIndex(child);
777
- if (childIndex > 0) {
778
- let children = this.getChildren();
779
- // note : we use an inverted loop
780
- children.splice(0, 0, children.splice(childIndex, 1)[0]);
781
- // increment our child z value based on the previous child depth
782
- child.pos.z = children[1].pos.z + 1;
783
- // mark the container as dirty
784
- this.isDirty = true;
785
- }
786
- }
787
-
788
- /**
789
- * Move the specified child the bottom (z depth).
790
- * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - Child to be moved
791
- */
792
- moveToBottom(child) {
793
- let childIndex = this.getChildIndex(child);
794
- let children = this.getChildren();
795
- if (childIndex >= 0 && childIndex < (children.length - 1)) {
796
- // note : we use an inverted loop
797
- children.splice((children.length - 1), 0, children.splice(childIndex, 1)[0]);
798
- // increment our child z value based on the next child depth
799
- child.pos.z = children[(children.length - 2)].pos.z - 1;
800
- // mark the container as dirty
801
- this.isDirty = true;
802
- }
803
- }
804
-
805
- /**
806
- * Manually trigger the sort of all the childs in the container
807
- * @param {boolean} [recursive=false] - recursively sort all containers if true
808
- */
809
- sort(recursive) {
810
- // do nothing if there is already a pending sort
811
- if (!this.pendingSort) {
812
- if (recursive === true) {
813
- this.forEach((child) => {
814
- if (child instanceof Container) {
815
- // note : this will generate one defered sorting function
816
- // for each existing containe
817
- child.sort(recursive);
818
- }
819
- });
820
- }
821
- /** @ignore */
822
- this.pendingSort = defer(function () {
823
- // sort everything in this container
824
- this.getChildren().sort(this["_sort" + this.sortOn.toUpperCase()]);
825
- // clear the defer id
826
- this.pendingSort = null;
827
- // make sure we redraw everything
828
- this.isDirty = true;
829
- }, this);
830
- }
831
- }
832
-
833
- /**
834
- * @ignore
835
- */
836
- onDeactivateEvent() {
837
- this.forEach((child) => {
838
- if (typeof child.onDeactivateEvent === "function") {
839
- child.onDeactivateEvent();
840
- }
841
- });
842
- }
843
-
844
- /**
845
- * Z Sorting function
846
- * @ignore
847
- */
848
- _sortZ(a, b) {
849
- return (b.pos && a.pos) ? (b.pos.z - a.pos.z) : (a.pos ? -Infinity : Infinity);
850
- }
851
-
852
- /**
853
- * Reverse Z Sorting function
854
- * @ignore
855
- */
856
- _sortReverseZ(a, b) {
857
- return (a.pos && b.pos) ? (a.pos.z - b.pos.z) : (a.pos ? Infinity : -Infinity);
858
- }
859
-
860
- /**
861
- * X Sorting function
862
- * @ignore
863
- */
864
- _sortX(a, b) {
865
- if (!b.pos || !a.pos) {
866
- return (a.pos ? -Infinity : Infinity);
867
- }
868
- let result = b.pos.z - a.pos.z;
869
- return (result ? result : (b.pos.x - a.pos.x));
870
- }
871
-
872
- /**
873
- * Y Sorting function
874
- * @ignore
875
- */
876
- _sortY(a, b) {
877
- if (!b.pos || !a.pos) {
878
- return (a.pos ? -Infinity : Infinity);
879
- }
880
- let result = b.pos.z - a.pos.z;
881
- return (result ? result : (b.pos.y - a.pos.y));
882
- }
883
-
884
- /**
885
- * Destroy function<br>
886
- * @ignore
887
- */
888
- destroy() {
889
- // empty the container
890
- this.reset();
891
- // call the parent destroy method
892
- super.destroy(arguments);
893
- }
894
-
895
- /**
896
- * container update function. <br>
897
- * automatically called by the application update loop {@link Application}
898
- * @protected
899
- * @param {number} dt - time since the last update in milliseconds.
900
- * @returns {boolean} true if the Container is dirty
901
- */
902
- update(dt) {
903
- let isFloating = false;
904
- let isPaused = state.isPaused();
905
- let children = this.getChildren();
906
- const childrenLength = children.length;
907
-
908
- for (let i = childrenLength, obj; i--, (obj = children[i]);) {
909
- if (isPaused && (!obj.updateWhenPaused)) {
910
- // skip this object
911
- continue;
912
- }
913
-
914
- if (obj.isRenderable) {
915
- isFloating = (globalFloatingCounter > 0 || obj.floating);
916
- if (isFloating) {
917
- globalFloatingCounter++;
918
- }
919
-
920
- // check if object is in any active cameras
921
- obj.inViewport = false;
922
- // iterate through all cameras
923
- state.current().cameras.forEach((camera) => {
924
- if (camera.isVisible(obj, isFloating)) {
925
- obj.inViewport = true;
926
- }
927
- });
928
-
929
- // update our object
930
- this.isDirty |= ((obj.inViewport || obj.alwaysUpdate) && obj.update(dt));
931
-
932
- if (globalFloatingCounter > 0) {
933
- globalFloatingCounter--;
934
- }
935
- }
936
- else {
937
- // just directly call update() for non renderable object
938
- this.isDirty |= obj.update(dt);
939
- }
940
- }
941
-
942
- // call the parent method
943
- return super.update(dt);
944
- }
945
-
946
- /**
947
- * draw this renderable (automatically called by melonJS)
948
- * @param {CanvasRenderer|WebGLRenderer} renderer - a renderer instance
949
- * @param {Camera2d} [viewport] - the viewport to (re)draw
950
- */
951
- draw(renderer, viewport) {
952
- let isFloating = false;
953
- let bounds = this.getBounds();
954
-
955
- this.drawCount = 0;
956
-
957
- // clip the containter children to the container bounds
958
- if (this.root === false && this.clipping === true && bounds.isFinite() === true) {
959
- renderer.clipRect(
960
- bounds.left,
961
- bounds.top,
962
- bounds.width,
963
- bounds.height
964
- );
965
- }
966
-
967
- // adjust position if required (e.g. canvas/window centering)
968
- renderer.translate(this.pos.x, this.pos.y);
969
-
970
- // color background if defined
971
- if (this.backgroundColor.alpha > 1 / 255) {
972
- renderer.clearColor(this.backgroundColor);
973
- }
974
-
975
- let children = this.getChildren();
976
- for (let i = children.length, obj; i--, (obj = children[i]);) {
977
- if (obj.isRenderable) {
978
-
979
- isFloating = obj.floating === true;
980
-
981
- if ((obj.inViewport || isFloating)) {
982
-
983
- if (isFloating) {
984
- // translate to screen coordinates
985
- renderer.save();
986
- renderer.resetTransform();
987
- }
988
-
989
- // predraw (apply transforms)
990
- obj.preDraw(renderer);
991
-
992
- // draw the object
993
- obj.draw(renderer, viewport);
994
-
995
- // postdraw (clean-up);
996
- obj.postDraw(renderer);
997
-
998
- // restore the previous "state"
999
- if (isFloating) {
1000
- renderer.restore();
1001
- }
1002
-
1003
- this.drawCount++;
1004
- }
1005
- }
1006
- }
1007
- }
1008
- }