melonjs 14.2.0 → 14.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (388) hide show
  1. package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +2 -2
  2. package/dist/melonjs.mjs/_virtual/arraymultimap.js +2 -2
  3. package/dist/melonjs.mjs/_virtual/earcut.js +2 -2
  4. package/dist/melonjs.mjs/_virtual/howler.js +2 -2
  5. package/dist/melonjs.mjs/_virtual/index.js +2 -2
  6. package/dist/melonjs.mjs/_virtual/index2.js +2 -2
  7. package/dist/melonjs.mjs/_virtual/multimap.js +2 -2
  8. package/dist/melonjs.mjs/_virtual/setmultimap.js +2 -2
  9. package/dist/melonjs.mjs/application/application.js +141 -10
  10. package/dist/melonjs.mjs/application/header.js +34 -0
  11. package/dist/melonjs.mjs/application/resize.js +4 -2
  12. package/dist/melonjs.mjs/application/settings.js +28 -0
  13. package/dist/melonjs.mjs/audio/audio.js +2 -2
  14. package/dist/melonjs.mjs/camera/camera2d.js +3 -3
  15. package/dist/melonjs.mjs/const.js +32 -0
  16. package/dist/melonjs.mjs/entity/entity.js +2 -2
  17. package/dist/melonjs.mjs/game.js +1 -1
  18. package/dist/melonjs.mjs/geometries/ellipse.js +2 -2
  19. package/dist/melonjs.mjs/geometries/line.js +2 -2
  20. package/dist/melonjs.mjs/geometries/path2d.js +2 -2
  21. package/dist/melonjs.mjs/geometries/point.js +2 -2
  22. package/dist/melonjs.mjs/geometries/poly.js +2 -2
  23. package/dist/melonjs.mjs/geometries/rectangle.js +2 -2
  24. package/dist/melonjs.mjs/geometries/roundrect.js +2 -2
  25. package/dist/melonjs.mjs/index.js +44 -33
  26. package/dist/melonjs.mjs/input/gamepad.js +2 -2
  27. package/dist/melonjs.mjs/input/input.js +2 -2
  28. package/dist/melonjs.mjs/input/keyboard.js +2 -2
  29. package/dist/melonjs.mjs/input/pointer.js +3 -3
  30. package/dist/melonjs.mjs/input/pointerevent.js +3 -3
  31. package/dist/melonjs.mjs/lang/console.js +44 -0
  32. package/dist/melonjs.mjs/lang/deprecated.js +4 -40
  33. package/dist/melonjs.mjs/level/level.js +3 -3
  34. package/dist/melonjs.mjs/level/tiled/TMXGroup.js +2 -23
  35. package/dist/melonjs.mjs/level/tiled/TMXLayer.js +68 -58
  36. package/dist/melonjs.mjs/level/tiled/TMXObject.js +2 -64
  37. package/dist/melonjs.mjs/level/tiled/TMXTile.js +10 -26
  38. package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +18 -84
  39. package/dist/melonjs.mjs/level/tiled/TMXTileset.js +2 -16
  40. package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +3 -10
  41. package/dist/melonjs.mjs/level/tiled/TMXUtils.js +37 -14
  42. package/dist/melonjs.mjs/level/tiled/constants.js +17 -0
  43. package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +7 -8
  44. package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +3 -6
  45. package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +2 -2
  46. package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +2 -14
  47. package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +2 -2
  48. package/dist/melonjs.mjs/level/tiled/renderer/autodetect.js +38 -0
  49. package/dist/melonjs.mjs/loader/loader.js +5 -3
  50. package/dist/melonjs.mjs/loader/loadingscreen.js +3 -3
  51. package/dist/melonjs.mjs/loader/melonjs_logo.png.js +2 -2
  52. package/dist/melonjs.mjs/math/color.js +2 -2
  53. package/dist/melonjs.mjs/math/math.js +2 -2
  54. package/dist/melonjs.mjs/math/matrix2.js +2 -2
  55. package/dist/melonjs.mjs/math/matrix3.js +2 -2
  56. package/dist/melonjs.mjs/math/observable_vector2.js +2 -2
  57. package/dist/melonjs.mjs/math/observable_vector3.js +2 -2
  58. package/dist/melonjs.mjs/math/vector2.js +2 -2
  59. package/dist/melonjs.mjs/math/vector3.js +2 -2
  60. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/arraymultimap.js +2 -2
  61. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/index.js +2 -2
  62. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/multimap.js +2 -2
  63. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/setmultimap.js +2 -2
  64. package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +2 -2
  65. package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +2 -2
  66. package/dist/melonjs.mjs/node_modules/eventemitter3/index2.js +2 -2
  67. package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +2 -2
  68. package/dist/melonjs.mjs/particles/emitter.js +2 -2
  69. package/dist/melonjs.mjs/particles/particle.js +2 -2
  70. package/dist/melonjs.mjs/particles/settings.js +2 -2
  71. package/dist/melonjs.mjs/physics/body.js +2 -2
  72. package/dist/melonjs.mjs/physics/bounds.js +2 -2
  73. package/dist/melonjs.mjs/physics/collision.js +4 -4
  74. package/dist/melonjs.mjs/physics/detector.js +175 -147
  75. package/dist/melonjs.mjs/physics/quadtree.js +2 -2
  76. package/dist/melonjs.mjs/physics/response.js +2 -2
  77. package/dist/melonjs.mjs/physics/sat.js +2 -2
  78. package/dist/melonjs.mjs/physics/world.js +11 -31
  79. package/dist/melonjs.mjs/plugin/plugin.js +4 -4
  80. package/dist/melonjs.mjs/renderable/collectable.js +2 -2
  81. package/dist/melonjs.mjs/renderable/colorlayer.js +2 -2
  82. package/dist/melonjs.mjs/renderable/container.js +4 -88
  83. package/dist/melonjs.mjs/renderable/dragndrop.js +2 -2
  84. package/dist/melonjs.mjs/renderable/imagelayer.js +3 -3
  85. package/dist/melonjs.mjs/renderable/light2d.js +2 -2
  86. package/dist/melonjs.mjs/renderable/nineslicesprite.js +2 -2
  87. package/dist/melonjs.mjs/renderable/renderable.js +2 -2
  88. package/dist/melonjs.mjs/renderable/sprite.js +2 -2
  89. package/dist/melonjs.mjs/renderable/trigger.js +3 -3
  90. package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +2 -2
  91. package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +2 -2
  92. package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +2 -2
  93. package/dist/melonjs.mjs/state/stage.js +3 -3
  94. package/dist/melonjs.mjs/state/state.js +3 -3
  95. package/dist/melonjs.mjs/system/device.js +3 -23
  96. package/dist/melonjs.mjs/system/dom.js +2 -2
  97. package/dist/melonjs.mjs/system/event.js +2 -2
  98. package/dist/melonjs.mjs/system/platform.js +2 -2
  99. package/dist/melonjs.mjs/system/pooling.js +2 -2
  100. package/dist/melonjs.mjs/system/save.js +2 -2
  101. package/dist/melonjs.mjs/system/timer.js +2 -2
  102. package/dist/melonjs.mjs/text/bitmaptext.js +2 -2
  103. package/dist/melonjs.mjs/text/bitmaptextdata.js +2 -2
  104. package/dist/melonjs.mjs/text/glyph.js +2 -2
  105. package/dist/melonjs.mjs/text/text.js +2 -2
  106. package/dist/melonjs.mjs/text/textmetrics.js +2 -2
  107. package/dist/melonjs.mjs/text/textstyle.js +2 -2
  108. package/dist/melonjs.mjs/tweens/easing.js +2 -2
  109. package/dist/melonjs.mjs/tweens/interpolation.js +2 -2
  110. package/dist/melonjs.mjs/tweens/tween.js +3 -3
  111. package/dist/melonjs.mjs/utils/agent.js +2 -2
  112. package/dist/melonjs.mjs/utils/array.js +2 -2
  113. package/dist/melonjs.mjs/utils/file.js +2 -2
  114. package/dist/melonjs.mjs/utils/function.js +2 -2
  115. package/dist/melonjs.mjs/utils/string.js +2 -2
  116. package/dist/melonjs.mjs/utils/utils.js +2 -2
  117. package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +5 -2
  118. package/dist/melonjs.mjs/video/renderer.js +9 -2
  119. package/dist/melonjs.mjs/video/texture/atlas.js +2 -2
  120. package/dist/melonjs.mjs/video/texture/cache.js +2 -2
  121. package/dist/melonjs.mjs/video/texture/canvas_texture.js +4 -3
  122. package/dist/melonjs.mjs/video/utils/autodetect.js +27 -0
  123. package/dist/melonjs.mjs/video/utils/resize.js +1 -1
  124. package/dist/melonjs.mjs/video/video.js +29 -158
  125. package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +2 -2
  126. package/dist/melonjs.mjs/video/webgl/glshader.js +3 -4
  127. package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +2 -2
  128. package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +2 -2
  129. package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +2 -2
  130. package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +2 -2
  131. package/dist/melonjs.mjs/video/webgl/utils/attributes.js +2 -2
  132. package/dist/melonjs.mjs/video/webgl/utils/precision.js +21 -3
  133. package/dist/melonjs.mjs/video/webgl/utils/program.js +2 -2
  134. package/dist/melonjs.mjs/video/webgl/utils/string.js +2 -2
  135. package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +2 -2
  136. package/dist/melonjs.mjs/video/webgl/webgl_compositor.js +2 -2
  137. package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +5 -2
  138. package/dist/melonjs.module.js +20845 -20968
  139. package/dist/types/application/application.d.ts +148 -0
  140. package/dist/types/application/header.d.ts +5 -0
  141. package/dist/types/application/resize.d.ts +6 -0
  142. package/dist/types/application/settings.d.ts +18 -0
  143. package/dist/types/audio/audio.d.ts +267 -0
  144. package/dist/types/camera/camera2d.d.ts +289 -0
  145. package/dist/types/const.d.ts +21 -0
  146. package/dist/types/entity/entity.d.ts +98 -0
  147. package/{src/game.js → dist/types/game.d.ts} +3 -14
  148. package/dist/types/geometries/ellipse.d.ts +154 -0
  149. package/dist/types/geometries/line.d.ts +11 -0
  150. package/dist/types/geometries/path2d.d.ts +121 -0
  151. package/dist/types/geometries/point.d.ts +53 -0
  152. package/dist/types/geometries/poly.d.ts +222 -0
  153. package/dist/types/geometries/rectangle.d.ts +176 -0
  154. package/dist/types/geometries/roundrect.d.ts +52 -0
  155. package/dist/types/index.d.ts +4 -2
  156. package/dist/types/input/gamepad.d.ts +95 -0
  157. package/dist/types/input/input.d.ts +15 -0
  158. package/dist/types/input/keyboard.d.ts +205 -0
  159. package/dist/types/input/pointer.d.ts +270 -0
  160. package/dist/types/input/pointerevent.d.ts +181 -0
  161. package/dist/types/lang/console.d.ts +7 -0
  162. package/dist/types/lang/deprecated.d.ts +45 -0
  163. package/dist/types/level/level.d.ts +134 -0
  164. package/dist/types/level/tiled/TMXGroup.d.ts +61 -0
  165. package/dist/types/level/tiled/TMXLayer.d.ts +158 -0
  166. package/dist/types/level/tiled/TMXObject.d.ts +133 -0
  167. package/dist/types/level/tiled/TMXTile.d.ts +64 -0
  168. package/dist/types/level/tiled/TMXTileMap.d.ts +142 -0
  169. package/dist/types/level/tiled/TMXTileset.d.ts +80 -0
  170. package/dist/types/level/tiled/TMXTilesetGroup.d.ts +26 -0
  171. package/dist/types/level/tiled/TMXUtils.d.ts +47 -0
  172. package/dist/types/level/tiled/constants.d.ts +5 -0
  173. package/dist/types/level/tiled/renderer/TMXHexagonalRenderer.d.ts +83 -0
  174. package/dist/types/level/tiled/renderer/TMXIsometricRenderer.d.ts +51 -0
  175. package/dist/types/level/tiled/renderer/TMXOrthogonalRenderer.d.ts +43 -0
  176. package/dist/types/level/tiled/renderer/TMXRenderer.d.ts +63 -0
  177. package/dist/types/level/tiled/renderer/TMXStaggeredRenderer.d.ts +8 -0
  178. package/dist/types/level/tiled/renderer/autodetect.d.ts +9 -0
  179. package/dist/types/loader/loader.d.ts +181 -0
  180. package/dist/types/loader/loadingscreen.d.ts +18 -0
  181. package/dist/types/math/color.d.ts +170 -0
  182. package/dist/types/math/math.d.ts +165 -0
  183. package/dist/types/math/matrix2.d.ts +209 -0
  184. package/dist/types/math/matrix3.d.ts +236 -0
  185. package/dist/types/math/observable_vector2.d.ts +278 -0
  186. package/dist/types/math/observable_vector3.d.ts +277 -0
  187. package/dist/types/math/vector2.d.ts +327 -0
  188. package/dist/types/math/vector3.d.ts +332 -0
  189. package/dist/types/particles/emitter.d.ts +188 -0
  190. package/dist/types/particles/particle.d.ts +32 -0
  191. package/dist/types/particles/settings.d.ts +32 -0
  192. package/dist/types/physics/body.d.ts +330 -0
  193. package/dist/types/physics/bounds.d.ts +250 -0
  194. package/dist/types/physics/collision.d.ts +44 -0
  195. package/dist/types/physics/detector.d.ts +64 -0
  196. package/dist/types/physics/quadtree.d.ts +79 -0
  197. package/dist/types/physics/response.d.ts +37 -0
  198. package/dist/types/physics/sat.d.ts +48 -0
  199. package/dist/types/physics/world.d.ts +83 -0
  200. package/dist/types/plugin/plugin.d.ts +10 -0
  201. package/dist/types/polyfill/console.d.ts +0 -0
  202. package/dist/types/polyfill/index.d.ts +1 -0
  203. package/dist/types/polyfill/performance.d.ts +0 -0
  204. package/dist/types/polyfill/requestAnimationFrame.d.ts +1 -0
  205. package/dist/types/polyfill/roundrect.d.ts +0 -0
  206. package/dist/types/renderable/collectable.d.ts +19 -0
  207. package/dist/types/renderable/colorlayer.d.ts +28 -0
  208. package/dist/types/renderable/container.d.ts +302 -0
  209. package/dist/types/renderable/dragndrop.d.ts +118 -0
  210. package/dist/types/renderable/imagelayer.d.ts +106 -0
  211. package/dist/types/renderable/light2d.d.ts +58 -0
  212. package/dist/types/renderable/nineslicesprite.d.ts +59 -0
  213. package/dist/types/renderable/renderable.d.ts +402 -0
  214. package/dist/types/renderable/sprite.d.ts +268 -0
  215. package/dist/types/renderable/trigger.d.ts +61 -0
  216. package/dist/types/renderable/ui/uibaseelement.d.ts +95 -0
  217. package/dist/types/renderable/ui/uispriteelement.d.ts +127 -0
  218. package/dist/types/renderable/ui/uitextbutton.d.ts +54 -0
  219. package/dist/types/state/stage.d.ts +116 -0
  220. package/dist/types/state/state.d.ts +170 -0
  221. package/dist/types/system/device.d.ts +579 -0
  222. package/dist/types/system/dom.d.ts +1 -0
  223. package/dist/types/system/event.d.ts +473 -0
  224. package/dist/types/system/platform.d.ts +31 -0
  225. package/dist/types/system/pooling.d.ts +101 -0
  226. package/dist/types/system/save.d.ts +25 -0
  227. package/dist/types/system/timer.d.ts +126 -0
  228. package/dist/types/text/bitmaptext.d.ts +151 -0
  229. package/dist/types/text/bitmaptextdata.d.ts +35 -0
  230. package/dist/types/text/glyph.d.ts +28 -0
  231. package/dist/types/text/text.d.ts +173 -0
  232. package/dist/types/text/textmetrics.d.ts +47 -0
  233. package/dist/types/text/textstyle.d.ts +5 -0
  234. package/dist/types/tweens/easing.d.ts +46 -0
  235. package/dist/types/tweens/interpolation.d.ts +18 -0
  236. package/dist/types/tweens/tween.d.ts +195 -0
  237. package/dist/types/utils/agent.d.ts +21 -0
  238. package/dist/types/utils/array.d.ts +39 -0
  239. package/dist/types/utils/file.d.ts +18 -0
  240. package/dist/types/utils/function.d.ts +32 -0
  241. package/dist/types/utils/string.d.ts +50 -0
  242. package/dist/types/utils/utils.d.ts +17 -0
  243. package/dist/types/video/canvas/canvas_renderer.d.ts +380 -0
  244. package/dist/types/video/renderer.d.ts +222 -0
  245. package/dist/types/video/texture/atlas.d.ts +201 -0
  246. package/dist/types/video/texture/cache.d.ts +45 -0
  247. package/dist/types/video/texture/canvas_texture.d.ts +78 -0
  248. package/dist/types/video/utils/autodetect.d.ts +7 -0
  249. package/dist/types/video/utils/resize.d.ts +4 -0
  250. package/dist/types/video/video.d.ts +93 -0
  251. package/dist/types/video/webgl/buffer/vertex.d.ts +56 -0
  252. package/dist/types/video/webgl/glshader.d.ts +93 -0
  253. package/dist/types/video/webgl/utils/attributes.d.ts +4 -0
  254. package/dist/types/video/webgl/utils/precision.d.ts +13 -0
  255. package/dist/types/video/webgl/utils/program.d.ts +5 -0
  256. package/dist/types/video/webgl/utils/string.d.ts +5 -0
  257. package/dist/types/video/webgl/utils/uniforms.d.ts +4 -0
  258. package/dist/types/video/webgl/webgl_compositor.d.ts +174 -0
  259. package/dist/types/video/webgl/webgl_renderer.d.ts +429 -0
  260. package/package.json +8 -8
  261. package/src/application/application.js +138 -7
  262. package/src/application/header.js +25 -0
  263. package/src/{video/utils → application}/resize.js +11 -6
  264. package/src/application/settings.js +19 -0
  265. package/src/camera/camera2d.js +1 -1
  266. package/src/const.js +23 -0
  267. package/src/index.js +36 -23
  268. package/src/input/pointer.js +1 -1
  269. package/src/input/pointerevent.js +1 -1
  270. package/src/lang/console.js +36 -0
  271. package/src/lang/deprecated.js +2 -37
  272. package/src/level/level.js +1 -1
  273. package/src/level/tiled/TMXGroup.js +0 -21
  274. package/src/level/tiled/TMXLayer.js +66 -56
  275. package/src/level/tiled/TMXObject.js +0 -62
  276. package/src/level/tiled/TMXTile.js +8 -24
  277. package/src/level/tiled/TMXTileMap.js +17 -83
  278. package/src/level/tiled/TMXTileset.js +0 -14
  279. package/src/level/tiled/TMXTilesetGroup.js +1 -9
  280. package/src/level/tiled/TMXUtils.js +38 -15
  281. package/src/level/tiled/constants.js +8 -0
  282. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +5 -6
  283. package/src/level/tiled/renderer/TMXIsometricRenderer.js +1 -4
  284. package/src/level/tiled/renderer/TMXRenderer.js +0 -12
  285. package/src/level/tiled/renderer/autodetect.js +29 -0
  286. package/src/loader/loader.js +3 -1
  287. package/src/loader/loadingscreen.js +1 -1
  288. package/src/physics/collision.js +2 -2
  289. package/src/physics/detector.js +172 -145
  290. package/src/physics/world.js +10 -30
  291. package/src/renderable/container.js +7 -91
  292. package/src/renderable/imagelayer.js +1 -1
  293. package/src/renderable/trigger.js +1 -1
  294. package/src/renderable/ui/uibaseelement.js +1 -1
  295. package/src/state/stage.js +1 -1
  296. package/src/state/state.js +1 -1
  297. package/src/system/device.js +0 -20
  298. package/src/tweens/tween.js +1 -1
  299. package/src/video/canvas/canvas_renderer.js +3 -0
  300. package/src/video/renderer.js +7 -0
  301. package/src/video/texture/canvas_texture.js +2 -1
  302. package/src/video/utils/autodetect.js +18 -0
  303. package/src/video/video.js +26 -155
  304. package/src/video/webgl/glshader.js +3 -4
  305. package/src/video/webgl/utils/precision.js +18 -0
  306. package/src/video/webgl/webgl_renderer.js +3 -0
  307. package/dist/melonjs.mjs/node_modules/core-js/es/string/trim-end.js +0 -13
  308. package/dist/melonjs.mjs/node_modules/core-js/es/string/trim-start.js +0 -13
  309. package/dist/melonjs.mjs/node_modules/core-js/internals/a-callable.js +0 -22
  310. package/dist/melonjs.mjs/node_modules/core-js/internals/an-object.js +0 -21
  311. package/dist/melonjs.mjs/node_modules/core-js/internals/array-includes.js +0 -45
  312. package/dist/melonjs.mjs/node_modules/core-js/internals/classof-raw.js +0 -19
  313. package/dist/melonjs.mjs/node_modules/core-js/internals/classof.js +0 -43
  314. package/dist/melonjs.mjs/node_modules/core-js/internals/copy-constructor-properties.js +0 -32
  315. package/dist/melonjs.mjs/node_modules/core-js/internals/create-non-enumerable-property.js +0 -24
  316. package/dist/melonjs.mjs/node_modules/core-js/internals/create-property-descriptor.js +0 -17
  317. package/dist/melonjs.mjs/node_modules/core-js/internals/define-built-in.js +0 -43
  318. package/dist/melonjs.mjs/node_modules/core-js/internals/define-global-property.js +0 -23
  319. package/dist/melonjs.mjs/node_modules/core-js/internals/descriptors.js +0 -18
  320. package/dist/melonjs.mjs/node_modules/core-js/internals/document-all.js +0 -18
  321. package/dist/melonjs.mjs/node_modules/core-js/internals/document-create-element.js +0 -22
  322. package/dist/melonjs.mjs/node_modules/core-js/internals/engine-user-agent.js +0 -14
  323. package/dist/melonjs.mjs/node_modules/core-js/internals/engine-v8-version.js +0 -39
  324. package/dist/melonjs.mjs/node_modules/core-js/internals/entry-unbind.js +0 -18
  325. package/dist/melonjs.mjs/node_modules/core-js/internals/enum-bug-keys.js +0 -19
  326. package/dist/melonjs.mjs/node_modules/core-js/internals/export.js +0 -72
  327. package/dist/melonjs.mjs/node_modules/core-js/internals/fails.js +0 -16
  328. package/dist/melonjs.mjs/node_modules/core-js/internals/function-bind-native.js +0 -19
  329. package/dist/melonjs.mjs/node_modules/core-js/internals/function-call.js +0 -18
  330. package/dist/melonjs.mjs/node_modules/core-js/internals/function-name.js +0 -29
  331. package/dist/melonjs.mjs/node_modules/core-js/internals/function-uncurry-this.js +0 -22
  332. package/dist/melonjs.mjs/node_modules/core-js/internals/get-built-in.js +0 -22
  333. package/dist/melonjs.mjs/node_modules/core-js/internals/get-method.js +0 -21
  334. package/dist/melonjs.mjs/node_modules/core-js/internals/global.js +0 -25
  335. package/dist/melonjs.mjs/node_modules/core-js/internals/has-own-property.js +0 -23
  336. package/dist/melonjs.mjs/node_modules/core-js/internals/hidden-keys.js +0 -10
  337. package/dist/melonjs.mjs/node_modules/core-js/internals/ie8-dom-define.js +0 -24
  338. package/dist/melonjs.mjs/node_modules/core-js/internals/indexed-object.js +0 -28
  339. package/dist/melonjs.mjs/node_modules/core-js/internals/inspect-source.js +0 -27
  340. package/dist/melonjs.mjs/node_modules/core-js/internals/internal-state.js +0 -88
  341. package/dist/melonjs.mjs/node_modules/core-js/internals/is-callable.js +0 -22
  342. package/dist/melonjs.mjs/node_modules/core-js/internals/is-forced.js +0 -34
  343. package/dist/melonjs.mjs/node_modules/core-js/internals/is-null-or-undefined.js +0 -14
  344. package/dist/melonjs.mjs/node_modules/core-js/internals/is-object.js +0 -22
  345. package/dist/melonjs.mjs/node_modules/core-js/internals/is-symbol.js +0 -27
  346. package/dist/melonjs.mjs/node_modules/core-js/internals/length-of-array-like.js +0 -18
  347. package/dist/melonjs.mjs/node_modules/core-js/internals/make-built-in.js +0 -68
  348. package/dist/melonjs.mjs/node_modules/core-js/internals/math-trunc.js +0 -19
  349. package/dist/melonjs.mjs/node_modules/core-js/internals/object-define-property.js +0 -58
  350. package/dist/melonjs.mjs/node_modules/core-js/internals/object-get-own-property-descriptor.js +0 -41
  351. package/dist/melonjs.mjs/node_modules/core-js/internals/object-get-own-property-names.js +0 -23
  352. package/dist/melonjs.mjs/node_modules/core-js/internals/object-get-own-property-symbols.js +0 -12
  353. package/dist/melonjs.mjs/node_modules/core-js/internals/object-is-prototype-of.js +0 -14
  354. package/dist/melonjs.mjs/node_modules/core-js/internals/object-keys-internal.js +0 -35
  355. package/dist/melonjs.mjs/node_modules/core-js/internals/object-property-is-enumerable.js +0 -23
  356. package/dist/melonjs.mjs/node_modules/core-js/internals/ordinary-to-primitive.js +0 -28
  357. package/dist/melonjs.mjs/node_modules/core-js/internals/own-keys.js +0 -31
  358. package/dist/melonjs.mjs/node_modules/core-js/internals/require-object-coercible.js +0 -21
  359. package/dist/melonjs.mjs/node_modules/core-js/internals/shared-key.js +0 -21
  360. package/dist/melonjs.mjs/node_modules/core-js/internals/shared-store.js +0 -19
  361. package/dist/melonjs.mjs/node_modules/core-js/internals/shared.js +0 -24
  362. package/dist/melonjs.mjs/node_modules/core-js/internals/string-trim-end.js +0 -22
  363. package/dist/melonjs.mjs/node_modules/core-js/internals/string-trim-forced.js +0 -28
  364. package/dist/melonjs.mjs/node_modules/core-js/internals/string-trim-start.js +0 -22
  365. package/dist/melonjs.mjs/node_modules/core-js/internals/string-trim.js +0 -45
  366. package/dist/melonjs.mjs/node_modules/core-js/internals/symbol-constructor-detection.js +0 -26
  367. package/dist/melonjs.mjs/node_modules/core-js/internals/to-absolute-index.js +0 -23
  368. package/dist/melonjs.mjs/node_modules/core-js/internals/to-indexed-object.js +0 -19
  369. package/dist/melonjs.mjs/node_modules/core-js/internals/to-integer-or-infinity.js +0 -20
  370. package/dist/melonjs.mjs/node_modules/core-js/internals/to-length.js +0 -20
  371. package/dist/melonjs.mjs/node_modules/core-js/internals/to-object.js +0 -20
  372. package/dist/melonjs.mjs/node_modules/core-js/internals/to-primitive.js +0 -41
  373. package/dist/melonjs.mjs/node_modules/core-js/internals/to-property-key.js +0 -21
  374. package/dist/melonjs.mjs/node_modules/core-js/internals/to-string-tag-support.js +0 -19
  375. package/dist/melonjs.mjs/node_modules/core-js/internals/to-string.js +0 -19
  376. package/dist/melonjs.mjs/node_modules/core-js/internals/try-to-string.js +0 -18
  377. package/dist/melonjs.mjs/node_modules/core-js/internals/uid.js +0 -20
  378. package/dist/melonjs.mjs/node_modules/core-js/internals/use-symbol-as-uid.js +0 -18
  379. package/dist/melonjs.mjs/node_modules/core-js/internals/v8-prototype-define-bug.js +0 -24
  380. package/dist/melonjs.mjs/node_modules/core-js/internals/weak-map-basic-detection.js +0 -18
  381. package/dist/melonjs.mjs/node_modules/core-js/internals/well-known-symbol.js +0 -41
  382. package/dist/melonjs.mjs/node_modules/core-js/internals/whitespaces.js +0 -12
  383. package/dist/melonjs.mjs/node_modules/core-js/modules/es.global-this.js +0 -18
  384. package/dist/melonjs.mjs/node_modules/core-js/modules/es.string.trim-end.js +0 -22
  385. package/dist/melonjs.mjs/node_modules/core-js/modules/es.string.trim-left.js +0 -19
  386. package/dist/melonjs.mjs/node_modules/core-js/modules/es.string.trim-right.js +0 -19
  387. package/dist/melonjs.mjs/node_modules/core-js/modules/es.string.trim-start.js +0 -22
  388. package/dist/melonjs.mjs/node_modules/eventemitter3/index.mjs.js +0 -9
@@ -0,0 +1,380 @@
1
+ /**
2
+ * @classdesc
3
+ * a canvas renderer object
4
+ * @augments Renderer
5
+ */
6
+ export default class CanvasRenderer extends Renderer {
7
+ /**
8
+ * @param {object} options - The renderer parameters
9
+ * @param {number} options.width - The width of the canvas without scaling
10
+ * @param {number} options.height - The height of the canvas without scaling
11
+ * @param {HTMLCanvasElement} [options.canvas] - The html canvas to draw to on screen
12
+ * @param {boolean} [options.antiAlias=false] - Whether to enable anti-aliasing
13
+ * @param {boolean} [options.transparent=false] - Whether to enable transparency on the canvas (performance hit when enabled)
14
+ * @param {boolean} [options.subPixel=false] - Whether to enable subpixel renderering (performance hit when enabled)
15
+ * @param {boolean} [options.textureSeamFix=true] - enable the texture seam fix when rendering Tile when antiAlias is off for the canvasRenderer
16
+ * @param {number} [options.zoomX=width] - The actual width of the canvas with scaling applied
17
+ * @param {number} [options.zoomY=height] - The actual height of the canvas with scaling applied
18
+ */
19
+ constructor(options: {
20
+ width: number;
21
+ height: number;
22
+ canvas?: HTMLCanvasElement | undefined;
23
+ antiAlias?: boolean | undefined;
24
+ transparent?: boolean | undefined;
25
+ subPixel?: boolean | undefined;
26
+ textureSeamFix?: boolean | undefined;
27
+ zoomX?: number | undefined;
28
+ zoomY?: number | undefined;
29
+ });
30
+ context: CanvasRenderingContext2D;
31
+ cache: TextureCache;
32
+ /**
33
+ * Reset the canvas transform to identity
34
+ * @name resetTransform
35
+ * @memberof CanvasRenderer
36
+ */
37
+ resetTransform(): void;
38
+ /**
39
+ * set a blend mode for the given context. <br>
40
+ * Supported blend mode between Canvas and WebGL remderer : <br>
41
+ * - "normal" : this is the default mode and draws new content on top of the existing content <br>
42
+ * <img src="images/normal-blendmode.png" width="510"/> <br>
43
+ * - "multiply" : the pixels of the top layer are multiplied with the corresponding pixel of the bottom layer. A darker picture is the result. <br>
44
+ * <img src="images/multiply-blendmode.png" width="510"/> <br>
45
+ * - "additive or lighter" : where both content overlap the color is determined by adding color values. <br>
46
+ * <img src="images/lighter-blendmode.png" width="510"/> <br>
47
+ * - "screen" : The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) <br>
48
+ * <img src="images/screen-blendmode.png" width="510"/> <br>
49
+ * @name setBlendMode
50
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
51
+ * @memberof CanvasRenderer
52
+ * @param {string} [mode="normal"] - blend mode : "normal", "multiply", "lighter, "additive", "screen"
53
+ * @param {CanvasRenderingContext2D} [context]
54
+ */
55
+ setBlendMode(mode?: string | undefined, context?: CanvasRenderingContext2D | undefined): void;
56
+ /**
57
+ * Clears the main framebuffer with the given color
58
+ * @name clearColor
59
+ * @memberof CanvasRenderer
60
+ * @param {Color|string} [color="#000000"] - CSS color.
61
+ * @param {boolean} [opaque=false] - Allow transparency [default] or clear the surface completely [true]
62
+ */
63
+ clearColor(color?: string | Color | undefined, opaque?: boolean | undefined): void;
64
+ /**
65
+ * Erase the pixels in the given rectangular area by setting them to transparent black (rgba(0,0,0,0)).
66
+ * @name clearRect
67
+ * @memberof CanvasRenderer
68
+ * @param {number} x - x axis of the coordinate for the rectangle starting point.
69
+ * @param {number} y - y axis of the coordinate for the rectangle starting point.
70
+ * @param {number} width - The rectangle's width.
71
+ * @param {number} height - The rectangle's height.
72
+ */
73
+ clearRect(x: number, y: number, width: number, height: number): void;
74
+ /**
75
+ * Create a pattern with the specified repetition
76
+ * @name createPattern
77
+ * @memberof CanvasRenderer
78
+ * @param {Image} image - Source image
79
+ * @param {string} repeat - Define how the pattern should be repeated
80
+ * @returns {CanvasPattern}
81
+ * @see ImageLayer#repeat
82
+ * @example
83
+ * var tileable = renderer.createPattern(image, "repeat");
84
+ * var horizontal = renderer.createPattern(image, "repeat-x");
85
+ * var vertical = renderer.createPattern(image, "repeat-y");
86
+ * var basic = renderer.createPattern(image, "no-repeat");
87
+ */
88
+ createPattern(image: new (width?: number | undefined, height?: number | undefined) => HTMLImageElement, repeat: string): CanvasPattern;
89
+ /**
90
+ * Draw an image onto the main using the canvas api
91
+ * @name drawImage
92
+ * @memberof CanvasRenderer
93
+ * @param {Image} image - An element to draw into the context. The specification permits any canvas image source (CanvasImageSource), specifically, a CSSImageValue, an HTMLImageElement, an SVGImageElement, an HTMLVideoElement, an HTMLCanvasElement, an ImageBitmap, or an OffscreenCanvas.
94
+ * @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.
95
+ * @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.
96
+ * @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.
97
+ * @param {number} sh - The height of the sub-rectangle of the source image to draw into the destination context.
98
+ * @param {number} dx - The X coordinate in the destination canvas at which to place the top-left corner of the source image.
99
+ * @param {number} dy - The Y coordinate in the destination canvas at which to place the top-left corner of the source image.
100
+ * @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.
101
+ * @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.
102
+ * @example
103
+ * // Position the image on the canvas:
104
+ * renderer.drawImage(image, dx, dy);
105
+ * // Position the image on the canvas, and specify width and height of the image:
106
+ * renderer.drawImage(image, dx, dy, dWidth, dHeight);
107
+ * // Clip the image and position the clipped part on the canvas:
108
+ * renderer.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight);
109
+ */
110
+ drawImage(image: new (width?: number | undefined, height?: number | undefined) => HTMLImageElement, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): void;
111
+ /**
112
+ * Draw a pattern within the given rectangle.
113
+ * @name drawPattern
114
+ * @memberof CanvasRenderer
115
+ * @param {CanvasPattern} pattern - Pattern object
116
+ * @param {number} x
117
+ * @param {number} y
118
+ * @param {number} width
119
+ * @param {number} height
120
+ * @see CanvasRenderer#createPattern
121
+ */
122
+ drawPattern(pattern: CanvasPattern, x: number, y: number, width: number, height: number): void;
123
+ /**
124
+ * Stroke an arc at the specified coordinates with given radius, start and end points
125
+ * @name strokeArc
126
+ * @memberof CanvasRenderer
127
+ * @param {number} x - arc center point x-axis
128
+ * @param {number} y - arc center point y-axis
129
+ * @param {number} radius
130
+ * @param {number} start - start angle in radians
131
+ * @param {number} end - end angle in radians
132
+ * @param {boolean} [antiClockwise=false] - draw arc anti-clockwise
133
+ * @param {boolean} [fill=false] - also fill the shape with the current color if true
134
+ */
135
+ strokeArc(x: number, y: number, radius: number, start: number, end: number, antiClockwise?: boolean | undefined, fill?: boolean | undefined): void;
136
+ /**
137
+ * Fill an arc at the specified coordinates with given radius, start and end points
138
+ * @name fillArc
139
+ * @memberof CanvasRenderer
140
+ * @param {number} x - arc center point x-axis
141
+ * @param {number} y - arc center point y-axis
142
+ * @param {number} radius
143
+ * @param {number} start - start angle in radians
144
+ * @param {number} end - end angle in radians
145
+ * @param {boolean} [antiClockwise=false] - draw arc anti-clockwise
146
+ */
147
+ fillArc(x: number, y: number, radius: number, start: number, end: number, antiClockwise?: boolean | undefined): void;
148
+ /**
149
+ * Stroke an ellipse at the specified coordinates with given radius
150
+ * @name strokeEllipse
151
+ * @memberof CanvasRenderer
152
+ * @param {number} x - ellipse center point x-axis
153
+ * @param {number} y - ellipse center point y-axis
154
+ * @param {number} w - horizontal radius of the ellipse
155
+ * @param {number} h - vertical radius of the ellipse
156
+ * @param {boolean} [fill=false] - also fill the shape with the current color if true
157
+ */
158
+ strokeEllipse(x: number, y: number, w: number, h: number, fill?: boolean | undefined): void;
159
+ /**
160
+ * Fill an ellipse at the specified coordinates with given radius
161
+ * @name fillEllipse
162
+ * @memberof CanvasRenderer
163
+ * @param {number} x - ellipse center point x-axis
164
+ * @param {number} y - ellipse center point y-axis
165
+ * @param {number} w - horizontal radius of the ellipse
166
+ * @param {number} h - vertical radius of the ellipse
167
+ */
168
+ fillEllipse(x: number, y: number, w: number, h: number): void;
169
+ /**
170
+ * Stroke a line of the given two points
171
+ * @name strokeLine
172
+ * @memberof CanvasRenderer
173
+ * @param {number} startX - the start x coordinate
174
+ * @param {number} startY - the start y coordinate
175
+ * @param {number} endX - the end x coordinate
176
+ * @param {number} endY - the end y coordinate
177
+ */
178
+ strokeLine(startX: number, startY: number, endX: number, endY: number): void;
179
+ /**
180
+ * Fill a line of the given two points
181
+ * @name fillLine
182
+ * @memberof CanvasRenderer
183
+ * @param {number} startX - the start x coordinate
184
+ * @param {number} startY - the start y coordinate
185
+ * @param {number} endX - the end x coordinate
186
+ * @param {number} endY - the end y coordinate
187
+ */
188
+ fillLine(startX: number, startY: number, endX: number, endY: number): void;
189
+ /**
190
+ * Stroke the given me.Polygon on the screen
191
+ * @name strokePolygon
192
+ * @memberof CanvasRenderer
193
+ * @param {Polygon} poly - the shape to draw
194
+ * @param {boolean} [fill=false] - also fill the shape with the current color if true
195
+ */
196
+ strokePolygon(poly: Polygon, fill?: boolean | undefined): void;
197
+ /**
198
+ * Fill the given me.Polygon on the screen
199
+ * @name fillPolygon
200
+ * @memberof CanvasRenderer
201
+ * @param {Polygon} poly - the shape to draw
202
+ */
203
+ fillPolygon(poly: Polygon): void;
204
+ /**
205
+ * Stroke a rectangle at the specified coordinates
206
+ * @name strokeRect
207
+ * @memberof CanvasRenderer
208
+ * @param {number} x
209
+ * @param {number} y
210
+ * @param {number} width
211
+ * @param {number} height
212
+ * @param {boolean} [fill=false] - also fill the shape with the current color if true
213
+ */
214
+ strokeRect(x: number, y: number, width: number, height: number, fill?: boolean | undefined): void;
215
+ /**
216
+ * Draw a filled rectangle at the specified coordinates
217
+ * @name fillRect
218
+ * @memberof CanvasRenderer
219
+ * @param {number} x
220
+ * @param {number} y
221
+ * @param {number} width
222
+ * @param {number} height
223
+ */
224
+ fillRect(x: number, y: number, width: number, height: number): void;
225
+ /**
226
+ * Stroke a rounded rectangle at the specified coordinates
227
+ * @name strokeRoundRect
228
+ * @memberof CanvasRenderer
229
+ * @param {number} x
230
+ * @param {number} y
231
+ * @param {number} width
232
+ * @param {number} height
233
+ * @param {number} radius
234
+ * @param {boolean} [fill=false] - also fill the shape with the current color if true
235
+ */
236
+ strokeRoundRect(x: number, y: number, width: number, height: number, radius: number, fill?: boolean | undefined): void;
237
+ /**
238
+ * Draw a rounded filled rectangle at the specified coordinates
239
+ * @name fillRoundRect
240
+ * @memberof CanvasRenderer
241
+ * @param {number} x
242
+ * @param {number} y
243
+ * @param {number} width
244
+ * @param {number} height
245
+ * @param {number} radius
246
+ */
247
+ fillRoundRect(x: number, y: number, width: number, height: number, radius: number): void;
248
+ /**
249
+ * Stroke a Point at the specified coordinates
250
+ * @name strokePoint
251
+ * @memberof CanvasRenderer
252
+ * @param {number} x
253
+ * @param {number} y
254
+ */
255
+ strokePoint(x: number, y: number): void;
256
+ /**
257
+ * Draw a a point at the specified coordinates
258
+ * @name fillPoint
259
+ * @memberof CanvasRenderer
260
+ * @param {number} x
261
+ * @param {number} y
262
+ * @param {number} width
263
+ * @param {number} height
264
+ */
265
+ fillPoint(x: number, y: number): void;
266
+ /**
267
+ * return a reference to the font 2d Context
268
+ * @ignore
269
+ */
270
+ getFontContext(): CanvasRenderingContext2D | WebGLRenderingContext;
271
+ /**
272
+ * save the canvas context
273
+ * @name save
274
+ * @memberof CanvasRenderer
275
+ */
276
+ save(): void;
277
+ /**
278
+ * restores the canvas context
279
+ * @name restore
280
+ * @memberof CanvasRenderer
281
+ */
282
+ restore(): void;
283
+ /**
284
+ * rotates the canvas context
285
+ * @name rotate
286
+ * @memberof CanvasRenderer
287
+ * @param {number} angle - in radians
288
+ */
289
+ rotate(angle: number): void;
290
+ /**
291
+ * scales the canvas context
292
+ * @name scale
293
+ * @memberof CanvasRenderer
294
+ * @param {number} x
295
+ * @param {number} y
296
+ */
297
+ scale(x: number, y: number): void;
298
+ /**
299
+ * Set the current fill & stroke style color.
300
+ * By default, or upon reset, the value is set to #000000.
301
+ * @name setColor
302
+ * @memberof CanvasRenderer
303
+ * @param {Color|string} color - css color value
304
+ */
305
+ setColor(color: Color | string): void;
306
+ /**
307
+ * Set the global alpha
308
+ * @name setGlobalAlpha
309
+ * @memberof CanvasRenderer
310
+ * @param {number} alpha - 0.0 to 1.0 values accepted.
311
+ */
312
+ setGlobalAlpha(alpha: number): void;
313
+ /**
314
+ * Return the global alpha
315
+ * @name getGlobalAlpha
316
+ * @memberof CanvasRenderer
317
+ * @returns {number} global alpha value
318
+ */
319
+ getGlobalAlpha(): number;
320
+ /**
321
+ * Set the line width on the context
322
+ * @name setLineWidth
323
+ * @memberof CanvasRenderer
324
+ * @param {number} width - Line width
325
+ */
326
+ setLineWidth(width: number): void;
327
+ /**
328
+ * Reset (overrides) the renderer transformation matrix to the
329
+ * identity one, and then apply the given transformation matrix.
330
+ * @name setTransform
331
+ * @memberof CanvasRenderer
332
+ * @param {Matrix2d} mat2d - Matrix to transform by
333
+ */
334
+ setTransform(mat2d: Matrix2d): void;
335
+ /**
336
+ * Multiply given matrix into the renderer tranformation matrix
337
+ * @name transform
338
+ * @memberof CanvasRenderer
339
+ * @param {Matrix2d} mat2d - Matrix to transform by
340
+ */
341
+ transform(mat2d: Matrix2d): void;
342
+ /**
343
+ * Translates the context to the given position
344
+ * @name translate
345
+ * @memberof CanvasRenderer
346
+ * @param {number} x
347
+ * @param {number} y
348
+ */
349
+ translate(x: number, y: number): void;
350
+ /**
351
+ * clip the given region from the original canvas. Once a region is clipped,
352
+ * all future drawing will be limited to the clipped region.
353
+ * You can however save the current region using the save(),
354
+ * and restore it (with the restore() method) any time in the future.
355
+ * (<u>this is an experimental feature !</u>)
356
+ * @name clipRect
357
+ * @memberof CanvasRenderer
358
+ * @param {number} x
359
+ * @param {number} y
360
+ * @param {number} width
361
+ * @param {number} height
362
+ */
363
+ clipRect(x: number, y: number, width: number, height: number): void;
364
+ /**
365
+ * A mask limits rendering elements to the shape and position of the given mask object.
366
+ * So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
367
+ * Mask are not preserved through renderer context save and restore.
368
+ * @name setMask
369
+ * @memberof CanvasRenderer
370
+ * @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] - the shape defining the mask to be applied
371
+ * @param {boolean} [invert=false] - either the given shape should define what is visible (default) or the opposite
372
+ */
373
+ setMask(mask?: Rect | RoundRect | Polygon | Line | Ellipse, invert?: boolean | undefined): void;
374
+ }
375
+ import Renderer from "./../renderer.js";
376
+ import TextureCache from "./../texture/cache.js";
377
+ import Color from "./../../math/color.js";
378
+ import Rect from "./../../geometries/rectangle.js";
379
+ import RoundRect from "./../../geometries/roundrect.js";
380
+ import Ellipse from "./../../geometries/ellipse.js";
@@ -0,0 +1,222 @@
1
+ /**
2
+ * @classdesc
3
+ * a base renderer object
4
+ */
5
+ export default class Renderer {
6
+ /**
7
+ * @param {object} options - The renderer parameters
8
+ * @param {number} options.width - The width of the canvas without scaling
9
+ * @param {number} options.height - The height of the canvas without scaling
10
+ * @param {HTMLCanvasElement} [options.canvas] - The html canvas to draw to on screen
11
+ * @param {boolean} [options.antiAlias=false] - Whether to enable anti-aliasing, use false (default) for a pixelated effect.
12
+ * @param {boolean} [options.failIfMajorPerformanceCaveat=true] - If true, the renderer will switch to CANVAS mode if the performances of a WebGL context would be dramatically lower than that of a native application making equivalent OpenGL calls.
13
+ * @param {boolean} [options.transparent=false] - Whether to enable transparency on the canvas
14
+ * @param {boolean} [options.premultipliedAlpha=true] - in WebGL, whether the renderer will assume that colors have premultiplied alpha when canvas transparency is enabled
15
+ * @param {boolean} [options.blendMode="normal"] - the default blend mode to use ("normal", "multiply")
16
+ * @param {boolean} [options.subPixel=false] - Whether to enable subpixel rendering (performance hit when enabled)
17
+ * @param {boolean} [options.verbose=false] - Enable the verbose mode that provides additional details as to what the renderer is doing
18
+ * @param {number} [options.zoomX=width] - The actual width of the canvas with scaling applied
19
+ * @param {number} [options.zoomY=height] - The actual height of the canvas with scaling applied
20
+ */
21
+ constructor(options: {
22
+ width: number;
23
+ height: number;
24
+ canvas?: HTMLCanvasElement | undefined;
25
+ antiAlias?: boolean | undefined;
26
+ failIfMajorPerformanceCaveat?: boolean | undefined;
27
+ transparent?: boolean | undefined;
28
+ premultipliedAlpha?: boolean | undefined;
29
+ blendMode?: boolean | undefined;
30
+ subPixel?: boolean | undefined;
31
+ verbose?: boolean | undefined;
32
+ zoomX?: number | undefined;
33
+ zoomY?: number | undefined;
34
+ });
35
+ /**
36
+ * The given constructor options
37
+ * @public
38
+ * @type {object}
39
+ */
40
+ public settings: object;
41
+ /**
42
+ * the requested video size ratio
43
+ * @public
44
+ * @type {Number}
45
+ */
46
+ public designRatio: number;
47
+ /**
48
+ * the scaling ratio to be applied to the main canvas
49
+ * @type {Vector2d}
50
+ * @default <1,1>
51
+ */
52
+ scaleRatio: Vector2d;
53
+ /**
54
+ * true if the current rendering context is valid
55
+ * @default true
56
+ * @type {boolean}
57
+ */
58
+ isContextValid: boolean;
59
+ /**
60
+ * The Path2D instance used by the renderer to draw primitives
61
+ * @type {Path2D}
62
+ */
63
+ path2D: Path2D;
64
+ /**
65
+ * The renderer type : Canvas, WebGL, etc...
66
+ * (override this property with a specific value when implementing a custom renderer)
67
+ * @type {string}
68
+ */
69
+ type: string;
70
+ /**
71
+ * @ignore
72
+ */
73
+ currentScissor: Int32Array;
74
+ /**
75
+ * @ignore
76
+ */
77
+ maskLevel: number;
78
+ /**
79
+ * @ignore
80
+ */
81
+ currentBlendMode: string;
82
+ canvas: any;
83
+ currentColor: Color;
84
+ currentTint: Color;
85
+ projectionMatrix: Matrix3d;
86
+ uvOffset: number;
87
+ /**
88
+ * prepare the framebuffer for drawing a new frame
89
+ */
90
+ clear(): void;
91
+ /**
92
+ * render the main framebuffer on screen
93
+ */
94
+ flush(): void;
95
+ /**
96
+ * Reset context state
97
+ */
98
+ reset(): void;
99
+ /**
100
+ * return a reference to the canvas which this renderer draws to
101
+ * @returns {HTMLCanvasElement}
102
+ */
103
+ getCanvas(): HTMLCanvasElement;
104
+ /**
105
+ * return a reference to this renderer canvas corresponding Context
106
+ * @returns {CanvasRenderingContext2D|WebGLRenderingContext}
107
+ */
108
+ getContext(): CanvasRenderingContext2D | WebGLRenderingContext;
109
+ /**
110
+ * returns the current blend mode for this renderer
111
+ * @returns {string} blend mode
112
+ */
113
+ getBlendMode(): string;
114
+ /**
115
+ * Returns the 2D Context object of the given Canvas<br>
116
+ * Also configures anti-aliasing and blend modes based on constructor options.
117
+ * @param {HTMLCanvasElement} canvas
118
+ * @param {boolean} [transparent=true] - use false to disable transparency
119
+ * @returns {CanvasRenderingContext2D}
120
+ */
121
+ getContext2d(canvas: HTMLCanvasElement, transparent?: boolean | undefined): CanvasRenderingContext2D;
122
+ /**
123
+ * return the width of the system Canvas
124
+ * @returns {number}
125
+ */
126
+ getWidth(): number;
127
+ /**
128
+ * return the height of the system Canvas
129
+ * @returns {number} height of the system Canvas
130
+ */
131
+ getHeight(): number;
132
+ /**
133
+ * get the current fill & stroke style color.
134
+ * @returns {Color} current global color
135
+ */
136
+ getColor(): Color;
137
+ /**
138
+ * return the current global alpha
139
+ * @returns {number}
140
+ */
141
+ globalAlpha(): number;
142
+ /**
143
+ * check if the given rect or bounds overlaps with the renderer screen coordinates
144
+ * @param {Rect|Bounds} bounds
145
+ * @returns {boolean} true if overlaps
146
+ */
147
+ overlaps(bounds: Rect | Bounds): boolean;
148
+ /**
149
+ * resizes the system canvas
150
+ * @param {number} width - new width of the canvas
151
+ * @param {number} height - new height of the canvas
152
+ */
153
+ resize(width: number, height: number): void;
154
+ /**
155
+ * enable/disable image smoothing (scaling interpolation) for the given context
156
+ * @param {CanvasRenderingContext2D} context
157
+ * @param {boolean} [enable=false]
158
+ */
159
+ setAntiAlias(context: CanvasRenderingContext2D, enable?: boolean | undefined): void;
160
+ /**
161
+ * set/change the current projection matrix (WebGL only)
162
+ * @param {Matrix3d} matrix
163
+ */
164
+ setProjection(matrix: Matrix3d): void;
165
+ /**
166
+ * stroke the given shape
167
+ * @param {Rect|RoundRect|Polygon|Line|Ellipse} shape - a shape object to stroke
168
+ * @param {boolean} [fill=false] - fill the shape with the current color if true
169
+ */
170
+ stroke(shape: Rect | RoundRect | Polygon | Line | Ellipse, fill?: boolean | undefined): void;
171
+ /**
172
+ * fill the given shape
173
+ * @param {Rect|RoundRect|Polygon|Line|Ellipse} shape - a shape object to fill
174
+ */
175
+ fill(shape: Rect | RoundRect | Polygon | Line | Ellipse): void;
176
+ /**
177
+ * tint the given image or canvas using the given color
178
+ * @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas} src - the source image to be tinted
179
+ * @param {Color|string} color - the color that will be used to tint the image
180
+ * @param {string} [mode="multiply"] - the composition mode used to tint the image
181
+ * @returns {HTMLCanvasElement|OffscreenCanvas} a new canvas element representing the tinted image
182
+ */
183
+ tint(src: HTMLImageElement | HTMLCanvasElement | OffscreenCanvas, color: Color | string, mode?: string | undefined): HTMLCanvasElement | OffscreenCanvas;
184
+ /**
185
+ * A mask limits rendering elements to the shape and position of the given mask object.
186
+ * So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
187
+ * Mask are not preserved through renderer context save and restore.
188
+ * @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] - the shape defining the mask to be applied
189
+ * @param {boolean} [invert=false] - either the given shape should define what is visible (default) or the opposite
190
+ */
191
+ setMask(mask?: Rect | Polygon | Ellipse | RoundRect | Line | undefined): void;
192
+ /**
193
+ * disable (remove) the rendering mask set through setMask.
194
+ * @see Renderer#setMask
195
+ */
196
+ clearMask(): void;
197
+ /**
198
+ * set a coloring tint for sprite based renderables
199
+ * @param {Color} tint - the tint color
200
+ * @param {number} [alpha] - an alpha value to be applied to the tint
201
+ */
202
+ setTint(tint: Color, alpha?: number | undefined): void;
203
+ /**
204
+ * clear the rendering tint set through setTint.
205
+ * @see Renderer#setTint
206
+ */
207
+ clearTint(): void;
208
+ /**
209
+ * @ignore
210
+ */
211
+ drawFont(): void;
212
+ }
213
+ import Vector2d from "../math/vector2.js";
214
+ import Path2D from "./../geometries/path2d.js";
215
+ import Color from "./../math/color.js";
216
+ import Matrix3d from "./../math/matrix3.js";
217
+ import Rect from "./../geometries/rectangle.js";
218
+ import Bounds from "./../physics/bounds.js";
219
+ import RoundRect from "./../geometries/roundrect.js";
220
+ import Polygon from "./../geometries/poly.js";
221
+ import Line from "./../geometries/line.js";
222
+ import Ellipse from "./../geometries/ellipse.js";