melonjs 17.3.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 (704) hide show
  1. package/{dist/types → build}/application/application.d.ts +16 -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/build/application/header.d.ts +11 -0
  6. package/build/application/header.d.ts.map +1 -0
  7. package/{dist/types → build}/application/resize.d.ts +2 -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 +37 -59
  14. package/build/audio/audio.d.ts.map +1 -0
  15. package/{dist/types → build}/camera/camera2d.d.ts +42 -75
  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 +11 -5
  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 -15
  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 +3 -3
  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 +29 -53
  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 +16 -40
  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 +39 -21
  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 +6 -4
  156. package/build/physics/collision.d.ts.map +1 -0
  157. package/{dist/types → build}/physics/detector.d.ts +13 -5
  158. package/build/physics/detector.d.ts.map +1 -0
  159. package/{dist/types → build}/physics/quadtree.d.ts +7 -18
  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 +8 -0
  164. package/build/physics/sat.d.ts.map +1 -0
  165. package/{dist/types → build}/physics/world.d.ts +9 -4
  166. package/build/physics/world.d.ts.map +1 -0
  167. package/{dist/types → build}/plugin/plugin.d.ts +11 -18
  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/build/renderable/colorlayer.d.ts +41 -0
  180. package/build/renderable/colorlayer.d.ts.map +1 -0
  181. package/{dist/types → build}/renderable/container.d.ts +50 -19
  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 +12 -21
  186. package/build/renderable/dragndrop.d.ts.map +1 -0
  187. package/{dist/types → build}/renderable/entity/entity.d.ts +17 -11
  188. package/build/renderable/entity/entity.d.ts.map +1 -0
  189. package/{dist/types → build}/renderable/imagelayer.d.ts +28 -8
  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 +9 -3
  194. package/build/renderable/nineslicesprite.d.ts.map +1 -0
  195. package/{dist/types → build}/renderable/renderable.d.ts +71 -50
  196. package/build/renderable/renderable.d.ts.map +1 -0
  197. package/{dist/types → build}/renderable/sprite.d.ts +34 -13
  198. package/build/renderable/sprite.d.ts.map +1 -0
  199. package/{dist/types → build}/renderable/text/bitmaptext.d.ts +7 -8
  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 +22 -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 +58 -22
  270. package/build/video/canvas/canvas_renderer.d.ts.map +1 -0
  271. package/{dist/types → build}/video/renderer.d.ts +38 -17
  272. package/build/video/renderer.d.ts.map +1 -0
  273. package/{dist/types → build}/video/rendertarget/canvasrendertarget.d.ts +20 -10
  274. package/build/video/rendertarget/canvasrendertarget.d.ts.map +1 -0
  275. package/{dist/types → build}/video/texture/atlas.d.ts +14 -9
  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 +9 -2
  292. package/build/video/webgl/compositors/compositor.d.ts.map +1 -0
  293. package/{dist/types → build}/video/webgl/compositors/primitive_compositor.d.ts +7 -3
  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 +5 -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 +55 -43
  310. package/build/video/webgl/webgl_renderer.d.ts.map +1 -0
  311. package/package.json +83 -105
  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 -437
  320. package/dist/melonjs.mjs/application/header.js +0 -35
  321. package/dist/melonjs.mjs/application/resize.js +0 -123
  322. package/dist/melonjs.mjs/application/settings.js +0 -65
  323. package/dist/melonjs.mjs/audio/audio.js +0 -618
  324. package/dist/melonjs.mjs/camera/camera2d.js +0 -729
  325. package/dist/melonjs.mjs/const.js +0 -32
  326. package/dist/melonjs.mjs/geometries/ellipse.js +0 -245
  327. package/dist/melonjs.mjs/geometries/line.js +0 -108
  328. package/dist/melonjs.mjs/geometries/path2d.js +0 -474
  329. package/dist/melonjs.mjs/geometries/point.js +0 -80
  330. package/dist/melonjs.mjs/geometries/poly.js +0 -433
  331. package/dist/melonjs.mjs/geometries/rectangle.js +0 -330
  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 -803
  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 -728
  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 -487
  379. package/dist/melonjs.mjs/math/matrix3.js +0 -621
  380. package/dist/melonjs.mjs/math/observable_vector2.js +0 -468
  381. package/dist/melonjs.mjs/math/observable_vector3.js +0 -558
  382. package/dist/melonjs.mjs/math/vector2.js +0 -431
  383. package/dist/melonjs.mjs/math/vector3.js +0 -468
  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 -186
  437. package/dist/melonjs.mjs/particles/settings.js +0 -317
  438. package/dist/melonjs.mjs/physics/body.js +0 -706
  439. package/dist/melonjs.mjs/physics/bounds.js +0 -409
  440. package/dist/melonjs.mjs/physics/collision.js +0 -130
  441. package/dist/melonjs.mjs/physics/detector.js +0 -218
  442. package/dist/melonjs.mjs/physics/quadtree.js +0 -396
  443. package/dist/melonjs.mjs/physics/response.js +0 -57
  444. package/dist/melonjs.mjs/physics/sat.js +0 -483
  445. package/dist/melonjs.mjs/physics/world.js +0 -224
  446. package/dist/melonjs.mjs/plugin/plugin.js +0 -168
  447. package/dist/melonjs.mjs/renderable/collectable.js +0 -60
  448. package/dist/melonjs.mjs/renderable/colorlayer.js +0 -78
  449. package/dist/melonjs.mjs/renderable/container.js +0 -994
  450. package/dist/melonjs.mjs/renderable/draggable.js +0 -121
  451. package/dist/melonjs.mjs/renderable/dragndrop.js +0 -114
  452. package/dist/melonjs.mjs/renderable/entity/entity.js +0 -254
  453. package/dist/melonjs.mjs/renderable/imagelayer.js +0 -288
  454. package/dist/melonjs.mjs/renderable/light2d.js +0 -164
  455. package/dist/melonjs.mjs/renderable/nineslicesprite.js +0 -242
  456. package/dist/melonjs.mjs/renderable/renderable.js +0 -860
  457. package/dist/melonjs.mjs/renderable/sprite.js +0 -694
  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 -158
  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 -883
  487. package/dist/melonjs.mjs/video/renderer.js +0 -393
  488. package/dist/melonjs.mjs/video/rendertarget/canvasrendertarget.js +0 -310
  489. package/dist/melonjs.mjs/video/texture/atlas.js +0 -460
  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 -234
  498. package/dist/melonjs.mjs/video/webgl/compositors/primitive_compositor.js +0 -77
  499. package/dist/melonjs.mjs/video/webgl/compositors/quad_compositor.js +0 -254
  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 -1199
  511. package/dist/melonjs.module.js +0 -42838
  512. package/dist/types/application/header.d.ts +0 -5
  513. package/dist/types/application/settings.d.ts +0 -105
  514. package/dist/types/const.d.ts +0 -21
  515. package/dist/types/geometries/ellipse.d.ts +0 -127
  516. package/dist/types/geometries/line.d.ts +0 -11
  517. package/dist/types/geometries/point.d.ts +0 -46
  518. package/dist/types/geometries/poly.d.ts +0 -175
  519. package/dist/types/geometries/rectangle.d.ts +0 -130
  520. package/dist/types/geometries/roundrect.d.ts +0 -43
  521. package/dist/types/geometries/toarccanvas.d.ts +0 -10
  522. package/dist/types/input/keyboard.d.ts +0 -205
  523. package/dist/types/input/pointer.d.ts +0 -261
  524. package/dist/types/lang/deprecated.d.ts +0 -68
  525. package/dist/types/loader/cache.d.ts +0 -9
  526. package/dist/types/loader/parsers/compressed_textures/parseDDS.d.ts +0 -1
  527. package/dist/types/loader/parsers/compressed_textures/parseKTX.d.ts +0 -1
  528. package/dist/types/loader/parsers/compressed_textures/parseKTX2.d.ts +0 -1
  529. package/dist/types/loader/parsers/compressed_textures/parsePKM.d.ts +0 -1
  530. package/dist/types/loader/parsers/compressed_textures/parsePVR.d.ts +0 -1
  531. package/dist/types/math/color.d.ts +0 -179
  532. package/dist/types/math/math.d.ts +0 -149
  533. package/dist/types/math/matrix2.d.ts +0 -165
  534. package/dist/types/math/matrix3.d.ts +0 -177
  535. package/dist/types/math/observable_vector2.d.ts +0 -278
  536. package/dist/types/math/observable_vector3.d.ts +0 -277
  537. package/dist/types/math/vector2.d.ts +0 -255
  538. package/dist/types/math/vector3.d.ts +0 -266
  539. package/dist/types/particles/particle.d.ts +0 -32
  540. package/dist/types/physics/bounds.d.ts +0 -195
  541. package/dist/types/polyfill/console.d.ts +0 -1
  542. package/dist/types/polyfill/index.d.ts +0 -1
  543. package/dist/types/polyfill/roundrect.d.ts +0 -1
  544. package/dist/types/renderable/colorlayer.d.ts +0 -28
  545. package/dist/types/renderable/light2d.d.ts +0 -58
  546. package/dist/types/renderable/text/bitmaptextdata.d.ts +0 -35
  547. package/dist/types/system/dom.d.ts +0 -1
  548. package/dist/types/system/platform.d.ts +0 -33
  549. package/dist/types/system/save.d.ts +0 -25
  550. package/dist/types/system/timer.d.ts +0 -126
  551. package/dist/types/tweens/easing.d.ts +0 -46
  552. package/dist/types/tweens/interpolation.d.ts +0 -18
  553. package/dist/types/tweens/tween.d.ts +0 -195
  554. package/dist/types/utils/agent.d.ts +0 -21
  555. package/dist/types/utils/array.d.ts +0 -39
  556. package/dist/types/utils/file.d.ts +0 -27
  557. package/dist/types/utils/function.d.ts +0 -31
  558. package/dist/types/utils/string.d.ts +0 -50
  559. package/dist/types/utils/utils.d.ts +0 -54
  560. package/dist/types/video/utils/autodetect.d.ts +0 -5
  561. package/src/application/application.js +0 -429
  562. package/src/application/header.js +0 -26
  563. package/src/application/resize.js +0 -114
  564. package/src/application/settings.js +0 -56
  565. package/src/audio/audio.js +0 -617
  566. package/src/camera/camera2d.js +0 -724
  567. package/src/const.js +0 -23
  568. package/src/geometries/ellipse.js +0 -236
  569. package/src/geometries/line.js +0 -99
  570. package/src/geometries/path2d.js +0 -464
  571. package/src/geometries/point.js +0 -71
  572. package/src/geometries/poly.js +0 -424
  573. package/src/geometries/rectangle.js +0 -321
  574. package/src/geometries/roundrect.js +0 -156
  575. package/src/geometries/toarccanvas.js +0 -94
  576. package/src/index.js +0 -315
  577. package/src/input/gamepad.js +0 -487
  578. package/src/input/input.js +0 -17
  579. package/src/input/keyboard.js +0 -461
  580. package/src/input/pointer.js +0 -386
  581. package/src/input/pointerevent.js +0 -794
  582. package/src/lang/console.js +0 -36
  583. package/src/lang/deprecated.js +0 -192
  584. package/src/level/level.js +0 -290
  585. package/src/level/tiled/TMXGroup.js +0 -111
  586. package/src/level/tiled/TMXLayer.js +0 -424
  587. package/src/level/tiled/TMXObject.js +0 -286
  588. package/src/level/tiled/TMXTile.js +0 -168
  589. package/src/level/tiled/TMXTileMap.js +0 -569
  590. package/src/level/tiled/TMXTileset.js +0 -284
  591. package/src/level/tiled/TMXTilesetGroup.js +0 -66
  592. package/src/level/tiled/TMXUtils.js +0 -408
  593. package/src/level/tiled/constants.js +0 -8
  594. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +0 -497
  595. package/src/level/tiled/renderer/TMXIsometricRenderer.js +0 -208
  596. package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +0 -149
  597. package/src/level/tiled/renderer/TMXRenderer.js +0 -103
  598. package/src/level/tiled/renderer/TMXStaggeredRenderer.js +0 -100
  599. package/src/level/tiled/renderer/autodetect.js +0 -29
  600. package/src/loader/cache.js +0 -22
  601. package/src/loader/loader.js +0 -727
  602. package/src/loader/loadingscreen.js +0 -112
  603. package/src/loader/melonjs_logo.png +0 -0
  604. package/src/loader/parsers/binary.js +0 -33
  605. package/src/loader/parsers/compressed_textures/compressed_image.js +0 -49
  606. package/src/loader/parsers/compressed_textures/parseDDS.js +0 -5
  607. package/src/loader/parsers/compressed_textures/parseKTX.js +0 -5
  608. package/src/loader/parsers/compressed_textures/parseKTX2.js +0 -5
  609. package/src/loader/parsers/compressed_textures/parsePKM.js +0 -5
  610. package/src/loader/parsers/compressed_textures/parsePVR.js +0 -127
  611. package/src/loader/parsers/fetchdata.js +0 -53
  612. package/src/loader/parsers/fontface.js +0 -54
  613. package/src/loader/parsers/image.js +0 -120
  614. package/src/loader/parsers/json.js +0 -35
  615. package/src/loader/parsers/script.js +0 -37
  616. package/src/loader/parsers/tmx.js +0 -95
  617. package/src/loader/parsers/video.js +0 -90
  618. package/src/math/color.js +0 -627
  619. package/src/math/math.js +0 -212
  620. package/src/math/matrix2.js +0 -479
  621. package/src/math/matrix3.js +0 -613
  622. package/src/math/observable_vector2.js +0 -460
  623. package/src/math/observable_vector3.js +0 -550
  624. package/src/math/vector2.js +0 -423
  625. package/src/math/vector3.js +0 -460
  626. package/src/particles/emitter.js +0 -258
  627. package/src/particles/particle.js +0 -178
  628. package/src/particles/settings.js +0 -310
  629. package/src/physics/body.js +0 -698
  630. package/src/physics/bounds.js +0 -401
  631. package/src/physics/collision.js +0 -123
  632. package/src/physics/detector.js +0 -209
  633. package/src/physics/quadtree.js +0 -387
  634. package/src/physics/response.js +0 -48
  635. package/src/physics/sat.js +0 -473
  636. package/src/physics/world.js +0 -216
  637. package/src/plugin/plugin.js +0 -159
  638. package/src/polyfill/console.js +0 -11
  639. package/src/polyfill/index.js +0 -13
  640. package/src/polyfill/roundrect.js +0 -237
  641. package/src/renderable/collectable.js +0 -51
  642. package/src/renderable/colorlayer.js +0 -70
  643. package/src/renderable/container.js +0 -985
  644. package/src/renderable/draggable.js +0 -114
  645. package/src/renderable/dragndrop.js +0 -106
  646. package/src/renderable/entity/entity.js +0 -246
  647. package/src/renderable/imagelayer.js +0 -280
  648. package/src/renderable/light2d.js +0 -155
  649. package/src/renderable/nineslicesprite.js +0 -233
  650. package/src/renderable/renderable.js +0 -852
  651. package/src/renderable/sprite.js +0 -685
  652. package/src/renderable/text/bitmaptext.js +0 -418
  653. package/src/renderable/text/bitmaptextdata.js +0 -186
  654. package/src/renderable/text/glyph.js +0 -57
  655. package/src/renderable/text/text.js +0 -415
  656. package/src/renderable/text/textmetrics.js +0 -167
  657. package/src/renderable/text/textstyle.js +0 -12
  658. package/src/renderable/trigger.js +0 -149
  659. package/src/renderable/ui/uibaseelement.js +0 -276
  660. package/src/renderable/ui/uispriteelement.js +0 -223
  661. package/src/renderable/ui/uitextbutton.js +0 -140
  662. package/src/state/stage.js +0 -226
  663. package/src/state/state.js +0 -541
  664. package/src/system/device.js +0 -863
  665. package/src/system/dom.js +0 -70
  666. package/src/system/event.js +0 -597
  667. package/src/system/platform.js +0 -34
  668. package/src/system/pooling.js +0 -190
  669. package/src/system/save.js +0 -148
  670. package/src/system/timer.js +0 -281
  671. package/src/tweens/easing.js +0 -325
  672. package/src/tweens/interpolation.js +0 -103
  673. package/src/tweens/tween.js +0 -470
  674. package/src/utils/agent.js +0 -68
  675. package/src/utils/array.js +0 -54
  676. package/src/utils/file.js +0 -46
  677. package/src/utils/function.js +0 -60
  678. package/src/utils/string.js +0 -73
  679. package/src/utils/utils.js +0 -127
  680. package/src/video/canvas/canvas_renderer.js +0 -874
  681. package/src/video/renderer.js +0 -384
  682. package/src/video/rendertarget/canvasrendertarget.js +0 -303
  683. package/src/video/texture/atlas.js +0 -451
  684. package/src/video/texture/cache.js +0 -178
  685. package/src/video/texture/parser/aseprite.js +0 -69
  686. package/src/video/texture/parser/spritesheet.js +0 -68
  687. package/src/video/texture/parser/texturepacker.js +0 -55
  688. package/src/video/utils/autodetect.js +0 -18
  689. package/src/video/video.js +0 -160
  690. package/src/video/webgl/buffer/vertex.js +0 -137
  691. package/src/video/webgl/compositors/compositor.js +0 -225
  692. package/src/video/webgl/compositors/primitive_compositor.js +0 -68
  693. package/src/video/webgl/compositors/quad_compositor.js +0 -245
  694. package/src/video/webgl/glshader.js +0 -158
  695. package/src/video/webgl/shaders/primitive.frag +0 -5
  696. package/src/video/webgl/shaders/primitive.vert +0 -15
  697. package/src/video/webgl/shaders/quad.frag +0 -7
  698. package/src/video/webgl/shaders/quad.vert +0 -18
  699. package/src/video/webgl/utils/attributes.js +0 -16
  700. package/src/video/webgl/utils/precision.js +0 -29
  701. package/src/video/webgl/utils/program.js +0 -58
  702. package/src/video/webgl/utils/string.js +0 -16
  703. package/src/video/webgl/utils/uniforms.js +0 -84
  704. package/src/video/webgl/webgl_renderer.js +0 -1190
@@ -1,874 +0,0 @@
1
- import Color from "./../../math/color.js";
2
- import Renderer from "./../renderer.js";
3
- import TextureCache from "./../texture/cache.js";
4
- import * as event from "./../../system/event.js";
5
-
6
- /**
7
- * @classdesc
8
- * a canvas renderer object
9
- * @augments Renderer
10
- */
11
- export default class CanvasRenderer extends Renderer {
12
- /**
13
- * @param {ApplicationSettings} [options] - optional parameters for the renderer
14
- */
15
- constructor(options) {
16
- // parent constructor
17
- super(options);
18
-
19
- this.setBlendMode(this.settings.blendMode);
20
-
21
- // apply the default color to the 2d context
22
- this.setColor(this.currentColor);
23
-
24
- // create a texture cache
25
- this.cache = new TextureCache();
26
-
27
- if (this.settings.textureSeamFix !== false && !this.settings.antiAlias) {
28
- // enable the tile texture seam fix with the canvas renderer
29
- this.uvOffset = 1;
30
- }
31
-
32
- // set the renderer type
33
- this.type = "CANVAS";
34
-
35
- // context lost & restore event for canvas
36
- this.getCanvas().addEventListener("contextlost", (e) => {
37
- e.preventDefault();
38
- this.isContextValid = false;
39
- event.emit(event.ONCONTEXT_LOST, this);
40
- }, false);
41
- // ctx.restoreContext()
42
- this.getCanvas().addEventListener("contextrestored", () => {
43
- this.isContextValid = true;
44
- event.emit(event.ONCONTEXT_RESTORED, this);
45
- }, false);
46
-
47
- // reset the renderer on game reset
48
- event.on(event.GAME_RESET, () => {
49
- this.reset();
50
- });
51
- }
52
-
53
- /**
54
- * Reset context state
55
- */
56
- reset() {
57
- super.reset();
58
- this.clearColor(this.currentColor, this.settings.transparent !== true);
59
- }
60
-
61
- /**
62
- * Reset the canvas transform to identity
63
- */
64
- resetTransform() {
65
- this.getContext().setTransform(1, 0, 0, 1, 0, 0);
66
- }
67
-
68
- /**
69
- * set a blend mode for the given context. <br>
70
- * Supported blend mode between Canvas and WebGL remderer : <br>
71
- * - "normal" : this is the default mode and draws new content on top of the existing content <br>
72
- * <img src="images/normal-blendmode.png" width="510"/> <br>
73
- * - "multiply" : the pixels of the top layer are multiplied with the corresponding pixel of the bottom layer. A darker picture is the result. <br>
74
- * <img src="images/multiply-blendmode.png" width="510"/> <br>
75
- * - "additive or lighter" : where both content overlap the color is determined by adding color values. <br>
76
- * <img src="images/lighter-blendmode.png" width="510"/> <br>
77
- * - "screen" : The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) <br>
78
- * <img src="images/screen-blendmode.png" width="510"/> <br>
79
- * @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
80
- * @param {string} [mode="normal"] - blend mode : "normal", "multiply", "lighter, "additive", "screen"
81
- * @param {CanvasRenderingContext2D} [context]
82
- */
83
- setBlendMode(mode = "normal", context) {
84
- context = context || this.getContext();
85
- this.currentBlendMode = mode;
86
- switch (mode) {
87
- case "screen" :
88
- context.globalCompositeOperation = "screen";
89
- break;
90
-
91
- case "lighter" :
92
- case "additive" :
93
- context.globalCompositeOperation = "lighter";
94
- break;
95
-
96
- case "multiply" :
97
- context.globalCompositeOperation = "multiply";
98
- break;
99
-
100
- default : // normal
101
- context.globalCompositeOperation = "source-over";
102
- this.currentBlendMode = "normal";
103
- break;
104
- }
105
- }
106
-
107
- /**
108
- * prepare the framebuffer for drawing a new frame
109
- */
110
- clear() {
111
- if (this.settings.transparent === false) {
112
- let canvas = this.getCanvas();
113
- let context = this.getContext();
114
- context.clearRect(0, 0, canvas.width, canvas.height);
115
- }
116
- }
117
-
118
- /**
119
- * Clears the main framebuffer with the given color
120
- * @param {Color|string} [color="#000000"] - CSS color.
121
- * @param {boolean} [opaque=false] - Allow transparency [default] or clear the surface completely [true]
122
- */
123
- clearColor(color = "#000000", opaque = false) {
124
- let canvas = this.getCanvas();
125
- let context = this.getContext();
126
-
127
- this.save();
128
- this.resetTransform();
129
- context.globalAlpha = 1;
130
- context.globalCompositeOperation = opaque === true ? "copy" : "source-over";
131
- context.fillStyle = (color instanceof Color) ? color.toRGBA() : color;
132
- this.fillRect(0, 0, canvas.width, canvas.height);
133
- this.restore();
134
- }
135
-
136
- /**
137
- * Erase the pixels in the given rectangular area by setting them to transparent black (rgba(0,0,0,0)).
138
- * @param {number} x - x axis of the coordinate for the rectangle starting point.
139
- * @param {number} y - y axis of the coordinate for the rectangle starting point.
140
- * @param {number} width - The rectangle's width.
141
- * @param {number} height - The rectangle's height.
142
- */
143
- clearRect(x, y, width, height) {
144
- this.getContext().clearRect(x, y, width, height);
145
- }
146
-
147
- /**
148
- * Create a pattern with the specified repetition
149
- * @param {HTMLImageElement|SVGImageElement|HTMLVideoElement|HTMLCanvasElement|ImageBitmap|OffscreenCanvas|VideoFrame} image - Source image to be used as the pattern's image
150
- * @param {string} repeat - Define how the pattern should be repeated
151
- * @returns {CanvasPattern}
152
- * @see ImageLayer#repeat
153
- * @example
154
- * let tileable = renderer.createPattern(image, "repeat");
155
- * let horizontal = renderer.createPattern(image, "repeat-x");
156
- * let vertical = renderer.createPattern(image, "repeat-y");
157
- * let basic = renderer.createPattern(image, "no-repeat");
158
- */
159
- createPattern(image, repeat) {
160
- return this.getContext().createPattern(image, repeat);
161
- }
162
-
163
- /**
164
- * Draw an image onto the main using the canvas api
165
- * @param {HTMLImageElement|SVGImageElement|HTMLVideoElement|HTMLCanvasElement|ImageBitmap|OffscreenCanvas|VideoFrame} image - An element to draw into the context.
166
- * @param {number} sx - The X coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
167
- * @param {number} sy - The Y coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
168
- * @param {number} sw - The width of the sub-rectangle of the source image to draw into the destination context. If not specified, the entire rectangle from the coordinates specified by sx and sy to the bottom-right corner of the image is used.
169
- * @param {number} sh - The height of the sub-rectangle of the source image to draw into the destination context.
170
- * @param {number} dx - The X coordinate in the destination canvas at which to place the top-left corner of the source image.
171
- * @param {number} dy - The Y coordinate in the destination canvas at which to place the top-left corner of the source image.
172
- * @param {number} dw - The width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.
173
- * @param {number} dh - The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.
174
- * @example
175
- * // Position the image on the canvas:
176
- * renderer.drawImage(image, dx, dy);
177
- * // Position the image on the canvas, and specify width and height of the image:
178
- * renderer.drawImage(image, dx, dy, dWidth, dHeight);
179
- * // Clip the image and position the clipped part on the canvas:
180
- * renderer.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight);
181
- */
182
- drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh) {
183
- if (this.getGlobalAlpha() < 1 / 255) {
184
- // Fast path: don't draw fully transparent
185
- return;
186
- }
187
- let context = this.getContext();
188
-
189
- if (typeof sw === "undefined") {
190
- sw = dw = image.width;
191
- sh = dh = image.height;
192
- dx = sx;
193
- dy = sy;
194
- sx = 0;
195
- sy = 0;
196
- }
197
- else if (typeof dx === "undefined") {
198
- dx = sx;
199
- dy = sy;
200
- dw = sw;
201
- dh = sh;
202
- sw = image.width;
203
- sh = image.height;
204
- sx = 0;
205
- sy = 0;
206
- }
207
-
208
- if (this.settings.subPixel === false) {
209
- // clamp to pixel grid
210
- dx = ~~dx;
211
- dy = ~~dy;
212
- }
213
-
214
- // apply a tint if required
215
- let source = image;
216
- let tint = this.currentTint.toArray();
217
- if (tint[0] !== 1.0 || tint[1] !== 1.0 || tint[2] !== 1.0) {
218
- // get a tinted version of this image from the texture cache
219
- source = this.cache.tint(image, this.currentTint.toRGB());
220
- }
221
- context.drawImage(source, sx, sy, sw, sh, dx, dy, dw, dh);
222
- }
223
-
224
- /**
225
- * Draw a pattern within the given rectangle.
226
- * @param {CanvasPattern} pattern - Pattern object
227
- * @param {number} x
228
- * @param {number} y
229
- * @param {number} width
230
- * @param {number} height
231
- * @see CanvasRenderer#createPattern
232
- */
233
- drawPattern(pattern, x, y, width, height) {
234
- if (this.getGlobalAlpha() < 1 / 255) {
235
- // Fast path: don't draw fully transparent
236
- return;
237
- }
238
- let context = this.getContext();
239
- let fillStyle = context.fillStyle;
240
- context.fillStyle = pattern;
241
- context.fillRect(x, y, width, height);
242
- context.fillStyle = fillStyle;
243
- }
244
-
245
- /**
246
- * starts a new path by emptying the list of sub-paths. Call this method when you want to create a new path
247
- * @example
248
- * // First path
249
- * renderer.beginPath();
250
- * renderer.setColor("blue");
251
- * renderer.moveTo(20, 20);
252
- * renderer.lineTo(200, 20);
253
- * renderer.stroke();
254
- * // Second path
255
- * renderer.beginPath();
256
- * renderer.setColor("green");
257
- * renderer.moveTo(20, 20);
258
- * renderer.lineTo(120, 120);
259
- * renderer.stroke();
260
- */
261
- beginPath() {
262
- this.getContext().beginPath();
263
- }
264
-
265
- /**
266
- * begins a new sub-path at the point specified by the given (x, y) coordinates.
267
- * @param {number} x - The x axis of the point.
268
- * @param {number} y - The y axis of the point.
269
- */
270
- moveTo(x, y) {
271
- this.getContext().moveTo(x, y);
272
- }
273
-
274
- /**
275
- * adds a straight line to the current sub-path by connecting the sub-path's last point to the specified (x, y) coordinates.
276
- */
277
- lineTo(x, y) {
278
- this.getContext().lineTo(x, y);
279
- }
280
-
281
- /**
282
- * creates a rectangular path whose starting point is at (x, y) and whose size is specified by width and height.
283
- * @param {number} x - The x axis of the coordinate for the rectangle starting point.
284
- * @param {number} y - The y axis of the coordinate for the rectangle starting point.
285
- * @param {number} width - The rectangle's width.
286
- * @param {number} height - The rectangle's height.
287
- */
288
- rect(x, y, width, height) {
289
- this.getContext().rect(x, y, width, height);
290
- }
291
-
292
- /**
293
- * adds a rounded rectangle to the current path.
294
- * @param {number} x - The x axis of the coordinate for the rectangle starting point.
295
- * @param {number} y - The y axis of the coordinate for the rectangle starting point.
296
- * @param {number} width - The rectangle's width.
297
- * @param {number} height - The rectangle's height.
298
- * @param {number} radius - The corner radius.
299
- */
300
- roundRect(x, y, width, height, radii) {
301
- this.getContext().roundRect(x, y, width, height, radii);
302
- }
303
-
304
- /**
305
- * stroke the given shape or the current defined path
306
- * @param {Rect|RoundRect|Polygon|Line|Ellipse} [shape] - a shape object to stroke
307
- * @param {boolean} [fill=false] - fill the shape with the current color if true
308
- */
309
- stroke(shape, fill) {
310
- if (typeof shape === "undefined") {
311
- if (fill === true) {
312
- this.getContext().fill();
313
- } else {
314
- this.getContext().stroke();
315
- }
316
- } else {
317
- super.stroke(shape, fill);
318
- }
319
- }
320
-
321
- /**
322
- * fill the given shape or the current defined path
323
- * @param {Rect|RoundRect|Polygon|Line|Ellipse} [shape] - a shape object to fill
324
- */
325
- fill(shape) {
326
- this.stroke(shape, true);
327
- }
328
-
329
- /**
330
- * add a straight line from the current point to the start of the current sub-path. If the shape has already been closed or has only one point, this function does nothing
331
- */
332
- closePath() {
333
- this.getContext().closePath();
334
- }
335
-
336
-
337
- /**
338
- * Stroke an arc at the specified coordinates with given radius, start and end points
339
- * @param {number} x - arc center point x-axis
340
- * @param {number} y - arc center point y-axis
341
- * @param {number} radius
342
- * @param {number} start - start angle in radians
343
- * @param {number} end - end angle in radians
344
- * @param {boolean} [antiClockwise=false] - draw arc anti-clockwise
345
- * @param {boolean} [fill=false] - also fill the shape with the current color if true
346
- */
347
- strokeArc(x, y, radius, start, end, antiClockwise, fill = false) {
348
- if (this.getGlobalAlpha() < 1 / 255) {
349
- // Fast path: don't draw fully transparent
350
- return;
351
- }
352
- let context = this.getContext();
353
-
354
- context.translate(x, y);
355
- context.beginPath();
356
- context.arc(0, 0, radius, start, end, antiClockwise || false);
357
- context[fill === true ? "fill" : "stroke"]();
358
- context.translate(-x, -y);
359
- }
360
-
361
- /**
362
- * Fill an arc at the specified coordinates with given radius, start and end points
363
- * @param {number} x - arc center point x-axis
364
- * @param {number} y - arc center point y-axis
365
- * @param {number} radius
366
- * @param {number} start - start angle in radians
367
- * @param {number} end - end angle in radians
368
- * @param {boolean} [antiClockwise=false] - draw arc anti-clockwise
369
- */
370
- fillArc(x, y, radius, start, end, antiClockwise) {
371
- this.strokeArc(x, y, radius, start, end, antiClockwise || false, true);
372
- }
373
-
374
- /**
375
- * Stroke an ellipse at the specified coordinates with given radius
376
- * @param {number} x - ellipse center point x-axis
377
- * @param {number} y - ellipse center point y-axis
378
- * @param {number} w - horizontal radius of the ellipse
379
- * @param {number} h - vertical radius of the ellipse
380
- * @param {boolean} [fill=false] - also fill the shape with the current color if true
381
- */
382
- strokeEllipse(x, y, w, h, fill = false) {
383
- if (this.getGlobalAlpha() < 1 / 255) {
384
- // Fast path: don't draw fully transparent
385
- return;
386
- }
387
- let context = this.getContext();
388
-
389
- let hw = w,
390
- hh = h,
391
- lx = x - hw,
392
- rx = x + hw,
393
- ty = y - hh,
394
- by = y + hh;
395
-
396
- let xmagic = hw * 0.551784,
397
- ymagic = hh * 0.551784,
398
- xmin = x - xmagic,
399
- xmax = x + xmagic,
400
- ymin = y - ymagic,
401
- ymax = y + ymagic;
402
-
403
- context.beginPath();
404
- context.moveTo(x, ty);
405
- context.bezierCurveTo(xmax, ty, rx, ymin, rx, y);
406
- context.bezierCurveTo(rx, ymax, xmax, by, x, by);
407
- context.bezierCurveTo(xmin, by, lx, ymax, lx, y);
408
- context.bezierCurveTo(lx, ymin, xmin, ty, x, ty);
409
- context[fill === true ? "fill" : "stroke"]();
410
- context.closePath();
411
- }
412
-
413
- /**
414
- * Fill an ellipse at the specified coordinates with given radius
415
- * @param {number} x - ellipse center point x-axis
416
- * @param {number} y - ellipse center point y-axis
417
- * @param {number} w - horizontal radius of the ellipse
418
- * @param {number} h - vertical radius of the ellipse
419
- */
420
- fillEllipse(x, y, w, h) {
421
- this.strokeEllipse(x, y, w, h, true);
422
- }
423
-
424
- /**
425
- * Stroke a line of the given two points
426
- * @param {number} startX - the start x coordinate
427
- * @param {number} startY - the start y coordinate
428
- * @param {number} endX - the end x coordinate
429
- * @param {number} endY - the end y coordinate
430
- */
431
- strokeLine(startX, startY, endX, endY) {
432
- if (this.getGlobalAlpha() < 1 / 255) {
433
- // Fast path: don't draw fully transparent
434
- return;
435
- }
436
-
437
- let context = this.getContext();
438
-
439
- context.beginPath();
440
- context.moveTo(startX, startY);
441
- context.lineTo(endX, endY);
442
- context.stroke();
443
- }
444
-
445
- /**
446
- * Fill a line of the given two points
447
- * @param {number} startX - the start x coordinate
448
- * @param {number} startY - the start y coordinate
449
- * @param {number} endX - the end x coordinate
450
- * @param {number} endY - the end y coordinate
451
- */
452
- fillLine(startX, startY, endX, endY) {
453
- this.strokeLine(startX, startY, endX, endY);
454
- }
455
-
456
- /**
457
- * Stroke the given me.Polygon on the screen
458
- * @param {Polygon} poly - the shape to draw
459
- * @param {boolean} [fill=false] - also fill the shape with the current color if true
460
- */
461
- strokePolygon(poly, fill = false) {
462
- if (this.getGlobalAlpha() < 1 / 255) {
463
- // Fast path: don't draw fully transparent
464
- return;
465
- }
466
- let context = this.getContext();
467
- let points = poly.points;
468
- let pointsLength = points.length;
469
- let firstPoint = points[0];
470
-
471
- this.translate(poly.pos.x, poly.pos.y);
472
-
473
- context.beginPath();
474
- context.moveTo(firstPoint.x, firstPoint.y);
475
- for (let i = 1; i < pointsLength; i++) {
476
- const point = points[i];
477
- context.lineTo(point.x, point.y);
478
- }
479
- context.lineTo(firstPoint.x, firstPoint.y);
480
- context[fill === true ? "fill" : "stroke"]();
481
- context.closePath();
482
-
483
- this.translate(-poly.pos.x, -poly.pos.y);
484
- }
485
-
486
- /**
487
- * Fill the given me.Polygon on the screen
488
- * @param {Polygon} poly - the shape to draw
489
- */
490
- fillPolygon(poly) {
491
- this.strokePolygon(poly, true);
492
- }
493
-
494
- /**
495
- * Stroke a rectangle at the specified coordinates
496
- * @param {number} x
497
- * @param {number} y
498
- * @param {number} width
499
- * @param {number} height
500
- * @param {boolean} [fill=false] - also fill the shape with the current color if true
501
- */
502
- strokeRect(x, y, width, height, fill = false) {
503
- if (this.getGlobalAlpha() < 1 / 255) {
504
- // Fast path: don't draw fully transparent
505
- return;
506
- }
507
- let context = this.getContext();
508
-
509
- context[fill === true ? "fillRect" : "strokeRect"](x, y, width, height);
510
- }
511
-
512
- /**
513
- * Draw a filled rectangle at the specified coordinates
514
- * @param {number} x
515
- * @param {number} y
516
- * @param {number} width
517
- * @param {number} height
518
- */
519
- fillRect(x, y, width, height) {
520
- this.strokeRect(x, y, width, height, true);
521
- }
522
-
523
- /**
524
- * Stroke a rounded rectangle at the specified coordinates
525
- * @param {number} x
526
- * @param {number} y
527
- * @param {number} width
528
- * @param {number} height
529
- * @param {number} radius
530
- * @param {boolean} [fill=false] - also fill the shape with the current color if true
531
- */
532
- strokeRoundRect(x, y, width, height, radius, fill = false) {
533
- if (this.getGlobalAlpha() < 1 / 255) {
534
- // Fast path: don't draw fully transparent
535
- return;
536
- }
537
- let context = this.getContext();
538
-
539
- context.beginPath();
540
- context.roundRect(x, y, width, height, radius);
541
- context[fill === true ? "fill" : "stroke"]();
542
- }
543
-
544
- /**
545
- * Draw a rounded filled rectangle at the specified coordinates
546
- * @param {number} x
547
- * @param {number} y
548
- * @param {number} width
549
- * @param {number} height
550
- * @param {number} radius
551
- */
552
- fillRoundRect(x, y, width, height, radius) {
553
- this.strokeRoundRect(x, y, width, height, radius, true);
554
- }
555
-
556
- /**
557
- * Stroke a Point at the specified coordinates
558
- * @param {number} x
559
- * @param {number} y
560
- */
561
- strokePoint(x, y) {
562
- this.strokeLine(x, y, x + 1, y + 1);
563
- }
564
-
565
- /**
566
- * Draw a a point at the specified coordinates
567
- * @param {number} x
568
- * @param {number} y
569
- * @param {number} width
570
- * @param {number} height
571
- */
572
- fillPoint(x, y) {
573
- this.strokePoint(x, y);
574
- }
575
-
576
- /**
577
- * restores the most recently saved renderer state by popping the top entry in the drawing state stack
578
- * @example
579
- * // Save the current state
580
- * renderer.save();
581
- *
582
- * // apply a transform and draw a rect
583
- * renderer.tranform(matrix);
584
- * renderer.fillRect(10, 10, 100, 100);
585
- *
586
- * // Restore to the state saved by the most recent call to save()
587
- * renderer.restore();
588
- */
589
- restore() {
590
- const canvas = this.getCanvas();
591
- this.getContext().restore();
592
- this.currentColor.glArray[3] = this.getGlobalAlpha();
593
- this.currentScissor[0] = 0;
594
- this.currentScissor[1] = 0;
595
- this.currentScissor[2] = canvas.width;
596
- this.currentScissor[3] = canvas.height;
597
- }
598
-
599
- /**
600
- * saves the entire state of the renderer by pushing the current state onto a stack.
601
- * @example
602
- * // Save the current state
603
- * renderer.save();
604
- *
605
- * // apply a transform and draw a rect
606
- * renderer.tranform(matrix);
607
- * renderer.fillRect(10, 10, 100, 100);
608
- *
609
- * // Restore to the state saved by the most recent call to save()
610
- * renderer.restore();
611
- */
612
- save() {
613
- this.getContext().save();
614
- }
615
-
616
- /**
617
- * adds a rotation to the transformation matrix.
618
- * @param {number} angle - the rotation angle, clockwise in radians
619
- * @example
620
- * // Rotated rectangle
621
- * renderer.rotate((45 * Math.PI) / 180);
622
- * renderer.setColor("red");
623
- * renderer.fillRect(10, 10, 100, 100);
624
- *
625
- * // Reset transformation matrix to the identity matrix
626
- * renderer.setTransform(1, 0, 0, 1, 0, 0);
627
- */
628
- rotate(angle) {
629
- this.getContext().rotate(angle);
630
- }
631
-
632
- /**
633
- * adds a scaling transformation to the renderer units horizontally and/or vertically
634
- * @param {number} x - Scaling factor in the horizontal direction. A negative value flips pixels across the vertical axis. A value of 1 results in no horizontal scaling.
635
- * @param {number} y - Scaling factor in the vertical direction. A negative value flips pixels across the horizontal axis. A value of 1 results in no vertical scaling
636
- */
637
- scale(x, y) {
638
- this.getContext().scale(x, y);
639
- }
640
-
641
- /**
642
- * Set the current fill & stroke style color.
643
- * By default, or upon reset, the value is set to #000000.
644
- * @param {Color|string} color - css color value
645
- */
646
- setColor(color) {
647
- let currentColor = this.currentColor;
648
- let context = this.getContext();
649
-
650
- currentColor.copy(color);
651
- // globalAlpha is applied at rendering time by the canvas
652
-
653
- context.strokeStyle = context.fillStyle = currentColor.toRGBA();
654
- }
655
-
656
- /**
657
- * Set the global alpha
658
- * @param {number} alpha - 0.0 to 1.0 values accepted.
659
- */
660
- setGlobalAlpha(alpha) {
661
- this.getContext().globalAlpha = alpha;
662
- }
663
-
664
- /**
665
- * Return the global alpha
666
- * @returns {number} global alpha value
667
- */
668
- getGlobalAlpha() {
669
- return this.getContext().globalAlpha;
670
- }
671
-
672
- /**
673
- * sets or returns the thickness of lines for shape drawing
674
- */
675
- get lineWidth() {
676
- return this.getContext().lineWidth;
677
- }
678
-
679
- /**
680
- * @ignore
681
- */
682
- set lineWidth(value) {
683
- this.getContext().lineWidth = value;
684
- return value;
685
- }
686
-
687
- /**
688
- * Reset (overrides) the renderer transformation matrix to the
689
- * identity one, and then apply the given transformation matrix.
690
- * @param {Matrix2d|number} a - a matrix2d to transform by, or a the a component to multiply the current matrix by
691
- * @param {number} b - the b component to multiply the current matrix by
692
- * @param {number} c - the c component to multiply the current matrix by
693
- * @param {number} d - the d component to multiply the current matrix by
694
- * @param {number} e - the e component to multiply the current matrix by
695
- * @param {number} f - the f component to multiply the current matrix by
696
- */
697
- setTransform(a, b, c, d, e, f) {
698
- this.resetTransform();
699
- this.transform(a, b, c, d, e, f);
700
- }
701
-
702
- /**
703
- * Multiply given matrix into the renderer tranformation matrix
704
- * @see {@link CanvasRenderer.setTransform} which will reset the current transform matrix prior to performing the new transformation
705
- * @param {Matrix2d|number} a - a matrix2d to transform by, or a the a component to multiply the current matrix by
706
- * @param {number} b - the b component to multiply the current matrix by
707
- * @param {number} c - the c component to multiply the current matrix by
708
- * @param {number} d - the d component to multiply the current matrix by
709
- * @param {number} e - the e component to multiply the current matrix by
710
- * @param {number} f - the f component to multiply the current matrix by
711
- */
712
- transform(a, b, c, d, e, f) {
713
- if (typeof a === "object") {
714
- let m = a.toArray();
715
- a = m[0];
716
- b = m[1];
717
- c = m[3];
718
- d = m[4];
719
- e = m[6];
720
- f = m[7];
721
- }
722
- // else individual components
723
-
724
- if (this.settings.subPixel === false) {
725
- e |= 0;
726
- f |= 0;
727
- }
728
-
729
- this.getContext().transform(a, b, c, d, e, f);
730
- }
731
-
732
- /**
733
- * adds a translation transformation to the current matrix.
734
- * @param {number} x - Distance to move in the horizontal direction. Positive values are to the right, and negative to the left.
735
- * @param {number} y - Distance to move in the vertical direction. Positive values are down, and negative are up.
736
- */
737
- translate(x, y) {
738
- if (this.settings.subPixel === false) {
739
- this.getContext().translate(~~x, ~~y);
740
- } else {
741
- this.getContext().translate(x, y);
742
- }
743
- }
744
-
745
- /**
746
- * clip the given region from the original canvas. Once a region is clipped,
747
- * all future drawing will be limited to the clipped region.
748
- * You can however save the current region using the save(),
749
- * and restore it (with the restore() method) any time in the future.
750
- * (<u>this is an experimental feature !</u>)
751
- * @param {number} x
752
- * @param {number} y
753
- * @param {number} width
754
- * @param {number} height
755
- */
756
- clipRect(x, y, width, height) {
757
- let canvas = this.getCanvas();
758
- // if requested box is different from the current canvas size;
759
- if (x !== 0 || y !== 0 || width !== canvas.width || height !== canvas.height) {
760
- let currentScissor = this.currentScissor;
761
- // if different from the current scissor box
762
- if (currentScissor[0] !== x || currentScissor[1] !== y ||
763
- currentScissor[2] !== width || currentScissor[3] !== height) {
764
- let context = this.getContext();
765
- context.beginPath();
766
- context.rect(x, y, width, height);
767
- context.clip();
768
- // save the new currentScissor box
769
- currentScissor[0] = x;
770
- currentScissor[1] = y;
771
- currentScissor[2] = width;
772
- currentScissor[3] = height;
773
- }
774
- }
775
- }
776
-
777
- /**
778
- * A mask limits rendering elements to the shape and position of the given mask object.
779
- * If the drawing or rendering area is larger than the mask, only the intersecting part of the renderable will be visible.
780
- * (Note Mask are not preserved through renderer context save and restore and need so be manually cleared)
781
- * @see CanvasRenderer#clearMask
782
- * @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] - the shape defining the mask to be applied
783
- * @param {boolean} [invert=false] - either the given shape should define what is visible (default) or the opposite
784
- */
785
- setMask(mask, invert = false) {
786
- let context = this.getContext();
787
-
788
- if (this.maskLevel === 0) {
789
- // only save context on the first mask
790
- context.save();
791
- if (typeof mask !== "undefined") {
792
- context.beginPath();
793
- }
794
- // else use the current path
795
- }
796
-
797
- if (typeof mask !== "undefined") {
798
- switch (mask.type) {
799
- // RoundRect
800
- case "RoundRect":
801
- context.roundRect(mask.top, mask.left, mask.width, mask.height, mask.radius);
802
- break;
803
-
804
- // Rect or Bounds
805
- case "Rectangle":
806
- case "Bounds":
807
- context.rect(mask.top, mask.left, mask.width, mask.height);
808
- break;
809
-
810
- // Polygon or Line
811
- case "Polygon":
812
- {
813
- // polygon
814
- const _x = mask.pos.x, _y = mask.pos.y;
815
- context.moveTo(_x + mask.points[0].x, _y + mask.points[0].y);
816
- for (let i = 1; i < mask.points.length; i++) {
817
- const point = mask.points[i];
818
- context.lineTo(_x + point.x, _y + point.y);
819
- }
820
- }
821
- break;
822
-
823
- case "Ellipse":
824
- {
825
- const _x = mask.pos.x, _y = mask.pos.y,
826
- hw = mask.radiusV.x,
827
- hh = mask.radiusV.y,
828
- lx = _x - hw,
829
- rx = _x + hw,
830
- ty = _y - hh,
831
- by = _y + hh;
832
-
833
- let xmagic = hw * 0.551784,
834
- ymagic = hh * 0.551784,
835
- xmin = _x - xmagic,
836
- xmax = _x + xmagic,
837
- ymin = _y - ymagic,
838
- ymax = _y + ymagic;
839
-
840
- context.moveTo(_x, ty);
841
- context.bezierCurveTo(xmax, ty, rx, ymin, rx, _y);
842
- context.bezierCurveTo(rx, ymax, xmax, by, _x, by);
843
- context.bezierCurveTo(xmin, by, lx, ymax, lx, _y);
844
- context.bezierCurveTo(lx, ymin, xmin, ty, _x, ty);
845
- }
846
- break;
847
-
848
- default:
849
- throw new Error("Invalid geometry for setMask");
850
- }
851
- }
852
-
853
- this.maskLevel++;
854
-
855
- if (invert === true) {
856
- context.closePath();
857
- context.globalCompositeOperation = "destination-atop";
858
- context.fill();
859
- } else {
860
- context.clip();
861
- }
862
- }
863
-
864
- /**
865
- * disable (remove) the rendering mask set through setMask.
866
- * @see CanvasRenderer#setMask
867
- */
868
- clearMask() {
869
- if (this.maskLevel > 0) {
870
- this.maskLevel = 0;
871
- this.getContext().restore();
872
- }
873
- }
874
- }