melonjs 14.1.2 → 14.3.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 (381) hide show
  1. package/README.md +3 -4
  2. package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +1 -1
  3. package/dist/melonjs.mjs/_virtual/arraymultimap.js +1 -1
  4. package/dist/melonjs.mjs/_virtual/earcut.js +7 -3
  5. package/dist/melonjs.mjs/_virtual/howler.js +1 -1
  6. package/dist/melonjs.mjs/_virtual/index.js +1 -1
  7. package/dist/melonjs.mjs/_virtual/index2.js +7 -3
  8. package/dist/melonjs.mjs/_virtual/make-built-in.js +10 -0
  9. package/dist/melonjs.mjs/_virtual/multimap.js +1 -1
  10. package/dist/melonjs.mjs/_virtual/object-define-property.js +10 -0
  11. package/dist/melonjs.mjs/_virtual/object-get-own-property-descriptor.js +10 -0
  12. package/dist/melonjs.mjs/_virtual/object-get-own-property-names.js +10 -0
  13. package/dist/melonjs.mjs/_virtual/object-get-own-property-symbols.js +10 -0
  14. package/dist/melonjs.mjs/_virtual/object-property-is-enumerable.js +10 -0
  15. package/dist/melonjs.mjs/_virtual/setmultimap.js +1 -1
  16. package/dist/melonjs.mjs/_virtual/shared.js +10 -0
  17. package/dist/melonjs.mjs/application/application.js +173 -22
  18. package/dist/melonjs.mjs/application/header.js +34 -0
  19. package/dist/melonjs.mjs/application/resize.js +119 -0
  20. package/dist/melonjs.mjs/application/settings.js +28 -0
  21. package/dist/melonjs.mjs/audio/audio.js +1 -1
  22. package/dist/melonjs.mjs/camera/camera2d.js +2 -2
  23. package/dist/melonjs.mjs/entity/entity.js +1 -1
  24. package/dist/melonjs.mjs/game.js +1 -1
  25. package/dist/melonjs.mjs/geometries/ellipse.js +1 -1
  26. package/dist/melonjs.mjs/geometries/line.js +1 -1
  27. package/dist/melonjs.mjs/geometries/path2d.js +3 -3
  28. package/dist/melonjs.mjs/geometries/point.js +1 -1
  29. package/dist/melonjs.mjs/geometries/poly.js +3 -3
  30. package/dist/melonjs.mjs/geometries/rectangle.js +1 -1
  31. package/dist/melonjs.mjs/geometries/roundrect.js +1 -1
  32. package/dist/melonjs.mjs/index.js +41 -61
  33. package/dist/melonjs.mjs/input/gamepad.js +1 -1
  34. package/dist/melonjs.mjs/input/input.js +1 -1
  35. package/dist/melonjs.mjs/input/keyboard.js +1 -1
  36. package/dist/melonjs.mjs/input/pointer.js +2 -2
  37. package/dist/melonjs.mjs/input/pointerevent.js +7 -8
  38. package/dist/melonjs.mjs/lang/deprecated.js +1 -1
  39. package/dist/melonjs.mjs/level/level.js +2 -2
  40. package/dist/melonjs.mjs/level/tiled/TMXGroup.js +1 -1
  41. package/dist/melonjs.mjs/level/tiled/TMXLayer.js +2 -2
  42. package/dist/melonjs.mjs/level/tiled/TMXObject.js +1 -1
  43. package/dist/melonjs.mjs/level/tiled/TMXTile.js +1 -1
  44. package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +2 -2
  45. package/dist/melonjs.mjs/level/tiled/TMXTileset.js +1 -1
  46. package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +1 -1
  47. package/dist/melonjs.mjs/level/tiled/TMXUtils.js +1 -1
  48. package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +1 -1
  49. package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
  50. package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -1
  51. package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +1 -1
  52. package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +1 -1
  53. package/dist/melonjs.mjs/loader/loader.js +1 -1
  54. package/dist/melonjs.mjs/loader/loadingscreen.js +2 -2
  55. package/dist/melonjs.mjs/loader/melonjs_logo.png.js +1 -1
  56. package/dist/melonjs.mjs/math/color.js +1 -1
  57. package/dist/melonjs.mjs/math/math.js +1 -1
  58. package/dist/melonjs.mjs/math/matrix2.js +1 -1
  59. package/dist/melonjs.mjs/math/matrix3.js +1 -1
  60. package/dist/melonjs.mjs/math/observable_vector2.js +1 -1
  61. package/dist/melonjs.mjs/math/observable_vector3.js +1 -1
  62. package/dist/melonjs.mjs/math/vector2.js +1 -1
  63. package/dist/melonjs.mjs/math/vector3.js +1 -1
  64. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/arraymultimap.js +3 -2
  65. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/index.js +1 -1
  66. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/multimap.js +3 -2
  67. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/setmultimap.js +3 -2
  68. package/dist/melonjs.mjs/node_modules/core-js/es/string/trim-end.js +13 -0
  69. package/dist/melonjs.mjs/node_modules/core-js/es/string/trim-start.js +13 -0
  70. package/dist/melonjs.mjs/node_modules/core-js/internals/a-callable.js +22 -0
  71. package/dist/melonjs.mjs/node_modules/core-js/internals/an-object.js +21 -0
  72. package/dist/melonjs.mjs/node_modules/core-js/internals/array-includes.js +45 -0
  73. package/dist/melonjs.mjs/node_modules/core-js/internals/classof-raw.js +19 -0
  74. package/dist/melonjs.mjs/node_modules/core-js/internals/classof.js +43 -0
  75. package/dist/melonjs.mjs/node_modules/core-js/internals/copy-constructor-properties.js +32 -0
  76. package/dist/melonjs.mjs/node_modules/core-js/internals/create-non-enumerable-property.js +24 -0
  77. package/dist/melonjs.mjs/node_modules/core-js/internals/create-property-descriptor.js +17 -0
  78. package/dist/melonjs.mjs/node_modules/core-js/internals/define-built-in.js +43 -0
  79. package/dist/melonjs.mjs/node_modules/core-js/internals/define-global-property.js +23 -0
  80. package/dist/melonjs.mjs/node_modules/core-js/internals/descriptors.js +18 -0
  81. package/dist/melonjs.mjs/node_modules/core-js/internals/document-all.js +18 -0
  82. package/dist/melonjs.mjs/node_modules/core-js/internals/document-create-element.js +22 -0
  83. package/dist/melonjs.mjs/node_modules/core-js/internals/engine-user-agent.js +14 -0
  84. package/dist/melonjs.mjs/node_modules/core-js/internals/engine-v8-version.js +39 -0
  85. package/dist/melonjs.mjs/node_modules/core-js/internals/entry-unbind.js +18 -0
  86. package/dist/melonjs.mjs/node_modules/core-js/internals/enum-bug-keys.js +19 -0
  87. package/dist/melonjs.mjs/node_modules/core-js/internals/export.js +72 -0
  88. package/dist/melonjs.mjs/node_modules/core-js/internals/fails.js +16 -0
  89. package/dist/melonjs.mjs/node_modules/core-js/internals/function-bind-native.js +19 -0
  90. package/dist/melonjs.mjs/node_modules/core-js/internals/function-call.js +18 -0
  91. package/dist/melonjs.mjs/node_modules/core-js/internals/function-name.js +29 -0
  92. package/dist/melonjs.mjs/node_modules/core-js/internals/function-uncurry-this.js +22 -0
  93. package/dist/melonjs.mjs/node_modules/core-js/internals/get-built-in.js +22 -0
  94. package/dist/melonjs.mjs/node_modules/core-js/internals/get-method.js +21 -0
  95. package/dist/melonjs.mjs/node_modules/core-js/internals/global.js +25 -0
  96. package/dist/melonjs.mjs/node_modules/core-js/internals/has-own-property.js +23 -0
  97. package/dist/melonjs.mjs/node_modules/core-js/internals/hidden-keys.js +10 -0
  98. package/dist/melonjs.mjs/node_modules/core-js/internals/ie8-dom-define.js +24 -0
  99. package/dist/melonjs.mjs/node_modules/core-js/internals/indexed-object.js +28 -0
  100. package/dist/melonjs.mjs/node_modules/core-js/internals/inspect-source.js +27 -0
  101. package/dist/melonjs.mjs/node_modules/core-js/internals/internal-state.js +88 -0
  102. package/dist/melonjs.mjs/node_modules/core-js/internals/is-callable.js +22 -0
  103. package/dist/melonjs.mjs/node_modules/core-js/internals/is-forced.js +34 -0
  104. package/dist/melonjs.mjs/node_modules/core-js/internals/is-null-or-undefined.js +14 -0
  105. package/dist/melonjs.mjs/node_modules/core-js/internals/is-object.js +22 -0
  106. package/dist/melonjs.mjs/node_modules/core-js/internals/is-symbol.js +27 -0
  107. package/dist/melonjs.mjs/node_modules/core-js/internals/length-of-array-like.js +18 -0
  108. package/dist/melonjs.mjs/node_modules/core-js/internals/make-built-in.js +68 -0
  109. package/dist/melonjs.mjs/node_modules/core-js/internals/math-trunc.js +19 -0
  110. package/dist/melonjs.mjs/node_modules/core-js/internals/object-define-property.js +58 -0
  111. package/dist/melonjs.mjs/node_modules/core-js/internals/object-get-own-property-descriptor.js +41 -0
  112. package/dist/melonjs.mjs/node_modules/core-js/internals/object-get-own-property-names.js +23 -0
  113. package/dist/melonjs.mjs/node_modules/core-js/internals/object-get-own-property-symbols.js +12 -0
  114. package/dist/melonjs.mjs/node_modules/core-js/internals/object-is-prototype-of.js +14 -0
  115. package/dist/melonjs.mjs/node_modules/core-js/internals/object-keys-internal.js +35 -0
  116. package/dist/melonjs.mjs/node_modules/core-js/internals/object-property-is-enumerable.js +23 -0
  117. package/dist/melonjs.mjs/node_modules/core-js/internals/ordinary-to-primitive.js +28 -0
  118. package/dist/melonjs.mjs/node_modules/core-js/internals/own-keys.js +31 -0
  119. package/dist/melonjs.mjs/node_modules/core-js/internals/require-object-coercible.js +21 -0
  120. package/dist/melonjs.mjs/node_modules/core-js/internals/shared-key.js +21 -0
  121. package/dist/melonjs.mjs/node_modules/core-js/internals/shared-store.js +19 -0
  122. package/dist/melonjs.mjs/node_modules/core-js/internals/shared.js +24 -0
  123. package/dist/melonjs.mjs/node_modules/core-js/internals/string-trim-end.js +22 -0
  124. package/dist/melonjs.mjs/node_modules/core-js/internals/string-trim-forced.js +28 -0
  125. package/dist/melonjs.mjs/node_modules/core-js/internals/string-trim-start.js +22 -0
  126. package/dist/melonjs.mjs/node_modules/core-js/internals/string-trim.js +45 -0
  127. package/dist/melonjs.mjs/node_modules/core-js/internals/symbol-constructor-detection.js +26 -0
  128. package/dist/melonjs.mjs/node_modules/core-js/internals/to-absolute-index.js +23 -0
  129. package/dist/melonjs.mjs/node_modules/core-js/internals/to-indexed-object.js +19 -0
  130. package/dist/melonjs.mjs/node_modules/core-js/internals/to-integer-or-infinity.js +20 -0
  131. package/dist/melonjs.mjs/node_modules/core-js/internals/to-length.js +20 -0
  132. package/dist/melonjs.mjs/node_modules/core-js/internals/to-object.js +20 -0
  133. package/dist/melonjs.mjs/node_modules/core-js/internals/to-primitive.js +41 -0
  134. package/dist/melonjs.mjs/node_modules/core-js/internals/to-property-key.js +21 -0
  135. package/dist/melonjs.mjs/node_modules/core-js/internals/to-string-tag-support.js +19 -0
  136. package/dist/melonjs.mjs/node_modules/core-js/internals/to-string.js +19 -0
  137. package/dist/melonjs.mjs/node_modules/core-js/internals/try-to-string.js +18 -0
  138. package/dist/melonjs.mjs/node_modules/core-js/internals/uid.js +20 -0
  139. package/dist/melonjs.mjs/node_modules/core-js/internals/use-symbol-as-uid.js +18 -0
  140. package/dist/melonjs.mjs/node_modules/core-js/internals/v8-prototype-define-bug.js +24 -0
  141. package/dist/melonjs.mjs/node_modules/core-js/internals/weak-map-basic-detection.js +18 -0
  142. package/dist/melonjs.mjs/node_modules/core-js/internals/well-known-symbol.js +41 -0
  143. package/dist/melonjs.mjs/node_modules/core-js/internals/whitespaces.js +12 -0
  144. package/dist/melonjs.mjs/node_modules/core-js/modules/es.global-this.js +18 -0
  145. package/dist/melonjs.mjs/node_modules/core-js/modules/es.string.trim-end.js +22 -0
  146. package/dist/melonjs.mjs/node_modules/core-js/modules/es.string.trim-left.js +19 -0
  147. package/dist/melonjs.mjs/node_modules/core-js/modules/es.string.trim-right.js +19 -0
  148. package/dist/melonjs.mjs/node_modules/core-js/modules/es.string.trim-start.js +22 -0
  149. package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +4 -5
  150. package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +3 -3
  151. package/dist/melonjs.mjs/node_modules/eventemitter3/index.mjs.js +9 -0
  152. package/dist/melonjs.mjs/node_modules/eventemitter3/index2.js +5 -2
  153. package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +3 -2
  154. package/dist/melonjs.mjs/particles/emitter.js +1 -1
  155. package/dist/melonjs.mjs/particles/particle.js +1 -1
  156. package/dist/melonjs.mjs/particles/settings.js +1 -1
  157. package/dist/melonjs.mjs/physics/body.js +1 -1
  158. package/dist/melonjs.mjs/physics/bounds.js +1 -1
  159. package/dist/melonjs.mjs/physics/collision.js +3 -3
  160. package/dist/melonjs.mjs/physics/detector.js +174 -146
  161. package/dist/melonjs.mjs/physics/quadtree.js +1 -1
  162. package/dist/melonjs.mjs/physics/response.js +1 -1
  163. package/dist/melonjs.mjs/physics/sat.js +1 -1
  164. package/dist/melonjs.mjs/physics/world.js +10 -30
  165. package/dist/melonjs.mjs/plugin/plugin.js +4 -4
  166. package/dist/melonjs.mjs/polyfill/console.js +18 -0
  167. package/dist/melonjs.mjs/polyfill/performance.js +27 -0
  168. package/dist/melonjs.mjs/polyfill/requestAnimationFrame.js +46 -0
  169. package/dist/melonjs.mjs/polyfill/roundrect.js +242 -0
  170. package/dist/melonjs.mjs/renderable/collectable.js +1 -1
  171. package/dist/melonjs.mjs/renderable/colorlayer.js +1 -1
  172. package/dist/melonjs.mjs/renderable/container.js +3 -87
  173. package/dist/melonjs.mjs/renderable/dragndrop.js +1 -1
  174. package/dist/melonjs.mjs/renderable/imagelayer.js +2 -2
  175. package/dist/melonjs.mjs/renderable/light2d.js +1 -1
  176. package/dist/melonjs.mjs/renderable/nineslicesprite.js +1 -1
  177. package/dist/melonjs.mjs/renderable/re_container.js +1016 -0
  178. package/dist/melonjs.mjs/renderable/renderable.js +1 -1
  179. package/dist/melonjs.mjs/renderable/sprite.js +1 -1
  180. package/dist/melonjs.mjs/renderable/trigger.js +2 -2
  181. package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +1 -1
  182. package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +1 -1
  183. package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +1 -1
  184. package/dist/melonjs.mjs/state/stage.js +2 -2
  185. package/dist/melonjs.mjs/state/state.js +2 -2
  186. package/dist/melonjs.mjs/system/device.js +9 -29
  187. package/dist/melonjs.mjs/system/dom.js +3 -2
  188. package/dist/melonjs.mjs/system/event.js +1 -1
  189. package/dist/melonjs.mjs/system/platform.js +1 -1
  190. package/dist/melonjs.mjs/system/pooling.js +1 -1
  191. package/dist/melonjs.mjs/system/save.js +1 -1
  192. package/dist/melonjs.mjs/system/timer.js +1 -1
  193. package/dist/melonjs.mjs/text/bitmaptext.js +1 -1
  194. package/dist/melonjs.mjs/text/bitmaptextdata.js +1 -1
  195. package/dist/melonjs.mjs/text/glyph.js +1 -1
  196. package/dist/melonjs.mjs/text/text.js +1 -1
  197. package/dist/melonjs.mjs/text/textmetrics.js +1 -1
  198. package/dist/melonjs.mjs/text/textstyle.js +1 -1
  199. package/dist/melonjs.mjs/tweens/easing.js +1 -1
  200. package/dist/melonjs.mjs/tweens/interpolation.js +1 -1
  201. package/dist/melonjs.mjs/tweens/tween.js +2 -2
  202. package/dist/melonjs.mjs/utils/agent.js +1 -1
  203. package/dist/melonjs.mjs/utils/array.js +1 -1
  204. package/dist/melonjs.mjs/utils/file.js +1 -1
  205. package/dist/melonjs.mjs/utils/function.js +1 -1
  206. package/dist/melonjs.mjs/utils/string.js +1 -1
  207. package/dist/melonjs.mjs/utils/utils.js +4 -29
  208. package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +4 -1
  209. package/dist/melonjs.mjs/video/renderer.js +26 -6
  210. package/dist/melonjs.mjs/video/texture/atlas.js +1 -1
  211. package/dist/melonjs.mjs/video/texture/cache.js +1 -1
  212. package/dist/melonjs.mjs/video/texture/canvas_texture.js +21 -1
  213. package/dist/melonjs.mjs/video/utils/autodetect.js +27 -0
  214. package/dist/melonjs.mjs/video/utils/resize.js +116 -0
  215. package/dist/melonjs.mjs/video/video.js +20 -294
  216. package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +1 -1
  217. package/dist/melonjs.mjs/video/webgl/glshader.js +2 -3
  218. package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +1 -1
  219. package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +1 -1
  220. package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +1 -1
  221. package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +1 -1
  222. package/dist/melonjs.mjs/video/webgl/utils/attributes.js +1 -1
  223. package/dist/melonjs.mjs/video/webgl/utils/precision.js +20 -2
  224. package/dist/melonjs.mjs/video/webgl/utils/program.js +1 -1
  225. package/dist/melonjs.mjs/video/webgl/utils/string.js +1 -1
  226. package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +1 -1
  227. package/dist/melonjs.mjs/video/webgl/webgl_compositor.js +1 -1
  228. package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +4 -1
  229. package/dist/melonjs.module.js +28551 -26959
  230. package/dist/types/application/application.d.ts +144 -0
  231. package/dist/types/application/header.d.ts +5 -0
  232. package/dist/types/application/resize.d.ts +5 -0
  233. package/dist/types/application/settings.d.ts +18 -0
  234. package/dist/types/audio/audio.d.ts +267 -0
  235. package/dist/types/camera/camera2d.d.ts +289 -0
  236. package/dist/types/entity/entity.d.ts +98 -0
  237. package/{src/game.js → dist/types/game.d.ts} +3 -14
  238. package/dist/types/geometries/ellipse.d.ts +154 -0
  239. package/dist/types/geometries/line.d.ts +11 -0
  240. package/dist/types/geometries/path2d.d.ts +121 -0
  241. package/dist/types/geometries/point.d.ts +53 -0
  242. package/dist/types/geometries/poly.d.ts +222 -0
  243. package/dist/types/geometries/rectangle.d.ts +176 -0
  244. package/dist/types/geometries/roundrect.d.ts +52 -0
  245. package/dist/types/index.d.ts +3 -2
  246. package/dist/types/input/gamepad.d.ts +95 -0
  247. package/dist/types/input/input.d.ts +15 -0
  248. package/dist/types/input/keyboard.d.ts +205 -0
  249. package/dist/types/input/pointer.d.ts +270 -0
  250. package/dist/types/input/pointerevent.d.ts +181 -0
  251. package/dist/types/lang/deprecated.d.ts +53 -0
  252. package/dist/types/level/level.d.ts +134 -0
  253. package/dist/types/level/tiled/TMXGroup.d.ts +82 -0
  254. package/dist/types/level/tiled/TMXLayer.d.ts +180 -0
  255. package/dist/types/level/tiled/TMXObject.d.ts +195 -0
  256. package/dist/types/level/tiled/TMXTile.d.ts +78 -0
  257. package/dist/types/level/tiled/TMXTileMap.d.ts +180 -0
  258. package/dist/types/level/tiled/TMXTileset.d.ts +94 -0
  259. package/dist/types/level/tiled/TMXTilesetGroup.d.ts +32 -0
  260. package/dist/types/level/tiled/TMXUtils.d.ts +47 -0
  261. package/dist/types/level/tiled/renderer/TMXHexagonalRenderer.d.ts +87 -0
  262. package/dist/types/level/tiled/renderer/TMXIsometricRenderer.d.ts +55 -0
  263. package/dist/types/level/tiled/renderer/TMXOrthogonalRenderer.d.ts +43 -0
  264. package/dist/types/level/tiled/renderer/TMXRenderer.d.ts +75 -0
  265. package/dist/types/level/tiled/renderer/TMXStaggeredRenderer.d.ts +8 -0
  266. package/dist/types/loader/loader.d.ts +181 -0
  267. package/dist/types/loader/loadingscreen.d.ts +18 -0
  268. package/dist/types/math/color.d.ts +170 -0
  269. package/dist/types/math/math.d.ts +165 -0
  270. package/dist/types/math/matrix2.d.ts +209 -0
  271. package/dist/types/math/matrix3.d.ts +236 -0
  272. package/dist/types/math/observable_vector2.d.ts +278 -0
  273. package/dist/types/math/observable_vector3.d.ts +277 -0
  274. package/dist/types/math/vector2.d.ts +327 -0
  275. package/dist/types/math/vector3.d.ts +332 -0
  276. package/dist/types/particles/emitter.d.ts +188 -0
  277. package/dist/types/particles/particle.d.ts +32 -0
  278. package/dist/types/particles/settings.d.ts +32 -0
  279. package/dist/types/physics/body.d.ts +330 -0
  280. package/dist/types/physics/bounds.d.ts +250 -0
  281. package/dist/types/physics/collision.d.ts +44 -0
  282. package/dist/types/physics/detector.d.ts +64 -0
  283. package/dist/types/physics/quadtree.d.ts +79 -0
  284. package/dist/types/physics/response.d.ts +37 -0
  285. package/dist/types/physics/sat.d.ts +48 -0
  286. package/dist/types/physics/world.d.ts +83 -0
  287. package/dist/types/plugin/plugin.d.ts +10 -0
  288. package/dist/types/polyfill/console.d.ts +0 -0
  289. package/dist/types/polyfill/index.d.ts +1 -0
  290. package/dist/types/polyfill/performance.d.ts +0 -0
  291. package/dist/types/polyfill/requestAnimationFrame.d.ts +1 -0
  292. package/dist/types/polyfill/roundrect.d.ts +0 -0
  293. package/dist/types/renderable/collectable.d.ts +19 -0
  294. package/dist/types/renderable/colorlayer.d.ts +28 -0
  295. package/dist/types/renderable/container.d.ts +302 -0
  296. package/dist/types/renderable/dragndrop.d.ts +118 -0
  297. package/dist/types/renderable/imagelayer.d.ts +106 -0
  298. package/dist/types/renderable/light2d.d.ts +58 -0
  299. package/dist/types/renderable/nineslicesprite.d.ts +59 -0
  300. package/dist/types/renderable/renderable.d.ts +402 -0
  301. package/dist/types/renderable/sprite.d.ts +268 -0
  302. package/dist/types/renderable/trigger.d.ts +61 -0
  303. package/dist/types/renderable/ui/uibaseelement.d.ts +95 -0
  304. package/dist/types/renderable/ui/uispriteelement.d.ts +127 -0
  305. package/dist/types/renderable/ui/uitextbutton.d.ts +54 -0
  306. package/dist/types/state/stage.d.ts +116 -0
  307. package/dist/types/state/state.d.ts +170 -0
  308. package/dist/types/system/device.d.ts +579 -0
  309. package/dist/types/system/dom.d.ts +1 -0
  310. package/dist/types/system/event.d.ts +473 -0
  311. package/dist/types/system/platform.d.ts +31 -0
  312. package/dist/types/system/pooling.d.ts +101 -0
  313. package/dist/types/system/save.d.ts +25 -0
  314. package/dist/types/system/timer.d.ts +126 -0
  315. package/dist/types/text/bitmaptext.d.ts +151 -0
  316. package/dist/types/text/bitmaptextdata.d.ts +35 -0
  317. package/dist/types/text/glyph.d.ts +28 -0
  318. package/dist/types/text/text.d.ts +173 -0
  319. package/dist/types/text/textmetrics.d.ts +47 -0
  320. package/dist/types/text/textstyle.d.ts +5 -0
  321. package/dist/types/tweens/easing.d.ts +46 -0
  322. package/dist/types/tweens/interpolation.d.ts +18 -0
  323. package/dist/types/tweens/tween.d.ts +195 -0
  324. package/dist/types/utils/agent.d.ts +21 -0
  325. package/dist/types/utils/array.d.ts +39 -0
  326. package/dist/types/utils/file.d.ts +18 -0
  327. package/dist/types/utils/function.d.ts +32 -0
  328. package/dist/types/utils/string.d.ts +50 -0
  329. package/dist/types/utils/utils.d.ts +17 -0
  330. package/dist/types/video/canvas/canvas_renderer.d.ts +380 -0
  331. package/dist/types/video/renderer.d.ts +222 -0
  332. package/dist/types/video/texture/atlas.d.ts +201 -0
  333. package/dist/types/video/texture/cache.d.ts +45 -0
  334. package/dist/types/video/texture/canvas_texture.d.ts +78 -0
  335. package/dist/types/video/utils/autodetect.d.ts +7 -0
  336. package/dist/types/video/utils/resize.d.ts +4 -0
  337. package/dist/types/video/video.d.ts +92 -0
  338. package/dist/types/video/webgl/buffer/vertex.d.ts +56 -0
  339. package/dist/types/video/webgl/glshader.d.ts +93 -0
  340. package/dist/types/video/webgl/utils/attributes.d.ts +4 -0
  341. package/dist/types/video/webgl/utils/precision.d.ts +13 -0
  342. package/dist/types/video/webgl/utils/program.d.ts +5 -0
  343. package/dist/types/video/webgl/utils/string.d.ts +5 -0
  344. package/dist/types/video/webgl/utils/uniforms.d.ts +4 -0
  345. package/dist/types/video/webgl/webgl_compositor.d.ts +174 -0
  346. package/dist/types/video/webgl/webgl_renderer.d.ts +429 -0
  347. package/package.json +14 -14
  348. package/src/application/application.js +171 -20
  349. package/src/application/header.js +25 -0
  350. package/src/application/resize.js +110 -0
  351. package/src/application/settings.js +19 -0
  352. package/src/camera/camera2d.js +1 -1
  353. package/src/index.js +34 -23
  354. package/src/input/pointer.js +1 -1
  355. package/src/input/pointerevent.js +6 -7
  356. package/src/level/level.js +1 -1
  357. package/src/level/tiled/TMXLayer.js +1 -1
  358. package/src/level/tiled/TMXTileMap.js +2 -2
  359. package/src/loader/loadingscreen.js +1 -1
  360. package/src/physics/collision.js +2 -2
  361. package/src/physics/detector.js +172 -145
  362. package/src/physics/world.js +10 -30
  363. package/src/plugin/plugin.js +1 -1
  364. package/src/renderable/container.js +7 -91
  365. package/src/renderable/imagelayer.js +1 -1
  366. package/src/renderable/trigger.js +1 -1
  367. package/src/renderable/ui/uibaseelement.js +1 -1
  368. package/src/state/stage.js +1 -1
  369. package/src/state/state.js +1 -1
  370. package/src/system/device.js +7 -27
  371. package/src/system/dom.js +2 -1
  372. package/src/tweens/tween.js +1 -1
  373. package/src/utils/utils.js +3 -28
  374. package/src/video/canvas/canvas_renderer.js +3 -0
  375. package/src/video/renderer.js +27 -7
  376. package/src/video/texture/canvas_texture.js +20 -0
  377. package/src/video/utils/autodetect.js +18 -0
  378. package/src/video/video.js +17 -291
  379. package/src/video/webgl/glshader.js +3 -4
  380. package/src/video/webgl/utils/precision.js +18 -0
  381. package/src/video/webgl/webgl_renderer.js +3 -0
@@ -0,0 +1,289 @@
1
+ /**
2
+ * @classdesc
3
+ * a 2D orthographic camera
4
+ * @augments Renderable
5
+ */
6
+ export default class Camera2d extends Renderable {
7
+ /**
8
+ * Axis definition
9
+ * @enum {number}
10
+ * @property {number} NONE no axis
11
+ * @property {number} HORIZONTAL horizontal axis only
12
+ * @property {number} VERTICAL vertical axis only
13
+ * @property {number} BOTH both axis
14
+ * @readonly
15
+ * @name AXIS
16
+ * @memberof Camera2d
17
+ */
18
+ readonly AXIS: {
19
+ NONE: number;
20
+ HORIZONTAL: number;
21
+ VERTICAL: number;
22
+ BOTH: number;
23
+ };
24
+ /**
25
+ * Camera bounds
26
+ * @public
27
+ * @type {Bounds}
28
+ * @name bounds
29
+ * @memberof Camera2d
30
+ */
31
+ public bounds: Bounds;
32
+ /**
33
+ * enable or disable damping
34
+ * @private
35
+ * @default true
36
+ */
37
+ private smoothFollow;
38
+ /**
39
+ * Camera damping for smooth transition [0 .. 1].
40
+ * 1 being the maximum value and will snap the camera to the target position
41
+ * @public
42
+ * @type {number}
43
+ * @name damping
44
+ * @default 1.0
45
+ * @memberof Camera2d
46
+ */
47
+ public damping: number;
48
+ /**
49
+ * the closest point relative to the camera
50
+ * @public
51
+ * @type {number}
52
+ * @name near
53
+ * @default -1000
54
+ * @memberof Camera2d
55
+ */
56
+ public near: number;
57
+ /**
58
+ * the furthest point relative to the camera.
59
+ * @public
60
+ * @type {number}
61
+ * @name far
62
+ * @default 1000
63
+ * @memberof Camera2d
64
+ */
65
+ public far: number;
66
+ /**
67
+ * the default camera projection matrix
68
+ * (2d cameras use an orthographic projection by default).
69
+ * @public
70
+ * @type {Matrix3d}
71
+ * @name projectionMatrix
72
+ * @memberof Camera2d
73
+ */
74
+ public projectionMatrix: Matrix3d;
75
+ /**
76
+ * the invert camera transform used to unproject points
77
+ * @ignore
78
+ * @type {Matrix2d}
79
+ * @name invCurrentTransform
80
+ * @memberof Camera2d
81
+ */
82
+ invCurrentTransform: Matrix2d;
83
+ offset: Vector2d;
84
+ target: Vector2d | ObservableVector3d | null;
85
+ follow_axis: number;
86
+ _shake: {
87
+ intensity: number;
88
+ duration: number;
89
+ axis: number;
90
+ onComplete: null;
91
+ };
92
+ _fadeOut: {
93
+ color: null;
94
+ tween: null;
95
+ };
96
+ _fadeIn: {
97
+ color: null;
98
+ tween: null;
99
+ };
100
+ /** @ignore */
101
+ _updateProjectionMatrix(): void;
102
+ /** @ignore */
103
+ _followH(target: any): number;
104
+ /** @ignore */
105
+ _followV(target: any): number;
106
+ /**
107
+ * reset the camera position to specified coordinates
108
+ * @name reset
109
+ * @memberof Camera2d
110
+ * @param {number} [x=0]
111
+ * @param {number} [y=0]
112
+ */
113
+ reset(x?: number | undefined, y?: number | undefined): void;
114
+ /**
115
+ * change the deadzone settings.
116
+ * the "deadzone" defines an area within the current camera in which
117
+ * the followed renderable can move without scrolling the camera.
118
+ * @name setDeadzone
119
+ * @see Camera2d.follow
120
+ * @memberof Camera2d
121
+ * @param {number} w - deadzone width
122
+ * @param {number} h - deadzone height
123
+ */
124
+ setDeadzone(w: number, h: number): void;
125
+ deadzone: Rect | undefined;
126
+ /**
127
+ * resize the camera
128
+ * @name resize
129
+ * @memberof Camera2d
130
+ * @param {number} w - new width of the camera
131
+ * @param {number} h - new height of the camera
132
+ * @returns {Camera2d} this camera
133
+ */
134
+ resize(w: number, h: number): Camera2d;
135
+ /**
136
+ * set the camera boundaries (set to the world limit by default).
137
+ * the camera is bound to the given coordinates and cannot move/be scrolled outside of it.
138
+ * @name setBounds
139
+ * @memberof Camera2d
140
+ * @param {number} x - world left limit
141
+ * @param {number} y - world top limit
142
+ * @param {number} w - world width limit
143
+ * @param {number} h - world height limit
144
+ */
145
+ setBounds(x: number, y: number, w: number, h: number): void;
146
+ /**
147
+ * set the camera to follow the specified renderable. <br>
148
+ * (this will put the camera center around the given target)
149
+ * @name follow
150
+ * @memberof Camera2d
151
+ * @param {Renderable|Vector2d} target - renderable or position vector to follow
152
+ * @param {number} [axis=me.game.viewport.AXIS.BOTH] - Which axis to follow (see {@link Camera2d.AXIS})
153
+ * @param {number} [damping=1] - default damping value
154
+ * @example
155
+ * // set the camera to follow this renderable on both axis, and enable damping
156
+ * me.game.viewport.follow(this, me.game.viewport.AXIS.BOTH, 0.1);
157
+ */
158
+ follow(target: Renderable | Vector2d, axis?: number | undefined, damping?: number | undefined): void;
159
+ /**
160
+ * unfollow the current target
161
+ * @name unfollow
162
+ * @memberof Camera2d
163
+ */
164
+ unfollow(): void;
165
+ /**
166
+ * move the camera upper-left position by the specified offset.
167
+ * @name move
168
+ * @memberof Camera2d
169
+ * @see Camera2d.focusOn
170
+ * @param {number} x
171
+ * @param {number} y
172
+ * @example
173
+ * // Move the camera up by four pixels
174
+ * me.game.viewport.move(0, -4);
175
+ */
176
+ move(x: number, y: number): void;
177
+ /**
178
+ * move the camera upper-left position to the specified coordinates
179
+ * @name moveTo
180
+ * @memberof Camera2d
181
+ * @see Camera2d.focusOn
182
+ * @param {number} x
183
+ * @param {number} y
184
+ */
185
+ moveTo(x: number, y: number): void;
186
+ /** @ignore */
187
+ updateTarget(): void;
188
+ /** @ignore */
189
+ update(dt: any): boolean;
190
+ /**
191
+ * shake the camera
192
+ * @name shake
193
+ * @memberof Camera2d
194
+ * @param {number} intensity - maximum offset that the screen can be moved
195
+ * while shaking
196
+ * @param {number} duration - expressed in milliseconds
197
+ * @param {number} [axis=me.game.viewport.AXIS.BOTH] - specify on which axis to apply the shake effect (see {@link Camera2d.AXIS})
198
+ * @param {Function} [onComplete] - callback once shaking effect is over
199
+ * @param {boolean} [force] - if true this will override the current effect
200
+ * @example
201
+ * // shake it baby !
202
+ * me.game.viewport.shake(10, 500, me.game.viewport.AXIS.BOTH);
203
+ */
204
+ shake(intensity: number, duration: number, axis?: number | undefined, onComplete?: Function | undefined, force?: boolean | undefined): void;
205
+ /**
206
+ * fadeOut(flash) effect<p>
207
+ * screen is filled with the specified color and slowly goes back to normal
208
+ * @name fadeOut
209
+ * @memberof Camera2d
210
+ * @param {Color|string} color - a CSS color value
211
+ * @param {number} [duration=1000] - expressed in milliseconds
212
+ * @param {Function} [onComplete] - callback once effect is over
213
+ * @example
214
+ * // fade the camera to white upon dying, reload the level, and then fade out back
215
+ * me.game.viewport.fadeIn("#fff", 150, function() {
216
+ * me.audio.play("die", false);
217
+ * me.level.reload();
218
+ * me.game.viewport.fadeOut("#fff", 150);
219
+ * });
220
+ */
221
+ fadeOut(color: Color | string, duration?: number | undefined, onComplete?: Function | undefined): void;
222
+ /**
223
+ * fadeIn effect <p>
224
+ * fade to the specified color
225
+ * @name fadeIn
226
+ * @memberof Camera2d
227
+ * @param {Color|string} color - a CSS color value
228
+ * @param {number} [duration=1000] - expressed in milliseconds
229
+ * @param {Function} [onComplete] - callback once effect is over
230
+ * @example
231
+ * // flash the camera to white for 75ms
232
+ * me.game.viewport.fadeIn("#FFFFFF", 75);
233
+ */
234
+ fadeIn(color: Color | string, duration?: number | undefined, onComplete?: Function | undefined): void;
235
+ /**
236
+ * set the camera position around the specified object
237
+ * @name focusOn
238
+ * @memberof Camera2d
239
+ * @param {Renderable} target - the renderable to focus the camera on
240
+ */
241
+ focusOn(target: Renderable): void;
242
+ /**
243
+ * check if the specified renderable is in the camera
244
+ * @name isVisible
245
+ * @memberof Camera2d
246
+ * @param {Renderable} obj - to be checked against
247
+ * @param {boolean} [floating = obj.floating] - if visibility check should be done against screen coordinates
248
+ * @returns {boolean}
249
+ */
250
+ isVisible(obj: Renderable, floating?: boolean | undefined): boolean;
251
+ /**
252
+ * convert the given "local" (screen) coordinates into world coordinates
253
+ * @name localToWorld
254
+ * @memberof Camera2d
255
+ * @param {number} x
256
+ * @param {number} y
257
+ * @param {number} [v] - an optional vector object where to set the
258
+ * converted value
259
+ * @returns {Vector2d}
260
+ */
261
+ localToWorld(x: number, y: number, v?: number | undefined): Vector2d;
262
+ /**
263
+ * convert the given world coordinates into "local" (screen) coordinates
264
+ * @name worldToLocal
265
+ * @memberof Camera2d
266
+ * @param {number} x
267
+ * @param {number} y
268
+ * @param {number} [v] - an optional vector object where to set the
269
+ * converted value
270
+ * @returns {Vector2d}
271
+ */
272
+ worldToLocal(x: number, y: number, v?: number | undefined): Vector2d;
273
+ /**
274
+ * render the camera effects
275
+ * @ignore
276
+ */
277
+ drawFX(renderer: any): void;
278
+ /**
279
+ * draw all object visibile in this viewport
280
+ * @ignore
281
+ */
282
+ draw(renderer: any, container: any): void;
283
+ }
284
+ import Renderable from "./../renderable/renderable.js";
285
+ import Matrix3d from "./../math/matrix3.js";
286
+ import Matrix2d from "./../math/matrix2.js";
287
+ import Vector2d from "./../math/vector2.js";
288
+ import ObservableVector3d from "./../math/observable_vector3.js";
289
+ import Rect from "./../geometries/rectangle.js";
@@ -0,0 +1,98 @@
1
+ /**
2
+ * @classdesc
3
+ * a Generic Object Entity
4
+ * @augments Renderable
5
+ * @see Renderable
6
+ */
7
+ export default class Entity extends Renderable {
8
+ /**
9
+ * @param {number} x - the x coordinates of the entity object
10
+ * @param {number} y - the y coordinates of the entity object
11
+ * @param {object} settings - Entity properties, to be defined through Tiled or when calling the entity constructor
12
+ * <img src="images/object_properties.png"/>
13
+ * @param {number} settings.width - the physical width the entity takes up in game
14
+ * @param {number} settings.height - the physical height the entity takes up in game
15
+ * @param {string} [settings.name] - object entity name
16
+ * @param {string} [settings.id] - object unique IDs
17
+ * @param {Image|string} [settings.image] - resource name of a spritesheet to use for the entity renderable component
18
+ * @param {Vector2d} [settings.anchorPoint=0.0] - Entity anchor point
19
+ * @param {number} [settings.framewidth=settings.width] - width of a single frame in the given spritesheet
20
+ * @param {number} [settings.frameheight=settings.width] - height of a single frame in the given spritesheet
21
+ * @param {string} [settings.type] - object type
22
+ * @param {number} [settings.collisionMask] - Mask collision detection for this object
23
+ * @param {Rect[]|Polygon[]|Line[]|Ellipse[]} [settings.shapes] - the initial list of collision shapes (usually populated through Tiled)
24
+ */
25
+ constructor(x: number, y: number, settings: {
26
+ width: number;
27
+ height: number;
28
+ name?: string | undefined;
29
+ id?: string | undefined;
30
+ image?: string | (new (width?: number | undefined, height?: number | undefined) => HTMLImageElement) | undefined;
31
+ anchorPoint?: any;
32
+ framewidth?: number | undefined;
33
+ frameheight?: number | undefined;
34
+ type?: string | undefined;
35
+ collisionMask?: number | undefined;
36
+ shapes?: Line[] | Polygon[] | Ellipse[] | Rect[] | undefined;
37
+ });
38
+ /**
39
+ * The array of renderable children of this entity.
40
+ * @ignore
41
+ */
42
+ children: any[];
43
+ public set renderable(arg: Renderable);
44
+ /**
45
+ * The entity renderable component (can be any objects deriving from me.Renderable, like me.Sprite for example)
46
+ * @public
47
+ * @type {Renderable}
48
+ * @name renderable
49
+ * @memberof Entity
50
+ */
51
+ public get renderable(): Renderable;
52
+ /**
53
+ * object type (as defined in Tiled)
54
+ * @public
55
+ * @type {string}
56
+ * @name type
57
+ * @memberof Entity
58
+ */
59
+ public type: string;
60
+ /**
61
+ * object unique ID (as defined in Tiled)
62
+ * @public
63
+ * @type {number}
64
+ * @name id
65
+ * @memberof Entity
66
+ */
67
+ public id: number;
68
+ /**
69
+ * dead/living state of the entity<br>
70
+ * default value : true
71
+ * @public
72
+ * @type {boolean}
73
+ * @name alive
74
+ * @memberof Entity
75
+ */
76
+ public alive: boolean;
77
+ body: Body;
78
+ /** @ignore */
79
+ update(dt: any): boolean;
80
+ /**
81
+ * update the bounds position when the body is modified
82
+ * @ignore
83
+ * @name onBodyUpdate
84
+ * @memberof Entity
85
+ * @param {Body} body - the body whose bounds to update
86
+ */
87
+ onBodyUpdate(body: Body): void;
88
+ preDraw(renderer: any): void;
89
+ /**
90
+ * onDeactivateEvent Notification function<br>
91
+ * Called by engine before deleting the object
92
+ * @name onDeactivateEvent
93
+ * @memberof Entity
94
+ */
95
+ onDeactivateEvent(): void;
96
+ }
97
+ import Renderable from "./../renderable/renderable.js";
98
+ import Body from "./../physics/body.js";
@@ -1,20 +1,9 @@
1
- import * as event from "./system/event.js";
2
- import Application from "./application/application.js";
3
-
1
+ export default game;
4
2
  /**
5
3
  * game is a default instance of a melonJS Application and represents your current game,
6
4
  * it contains all the objects, tilemap layers, current viewport, collision map, etc...<br>
7
5
  * @namespace game
8
6
  * @see Application
9
7
  */
10
-
11
- // create a default melonJS application instance
12
- let game = new Application();
13
-
14
- // initialize the game manager on system boot
15
- event.on(event.BOOT, () => {
16
- // initialize the default game instance
17
- game.init();
18
- });
19
-
20
- export default game;
8
+ declare let game: Application;
9
+ import Application from "./application/application.js";
@@ -0,0 +1,154 @@
1
+ /**
2
+ * @classdesc
3
+ * an ellipse Object
4
+ */
5
+ export default class Ellipse {
6
+ /**
7
+ * @param {number} x - the center x coordinate of the ellipse
8
+ * @param {number} y - the center y coordinate of the ellipse
9
+ * @param {number} w - width (diameter) of the ellipse
10
+ * @param {number} h - height (diameter) of the ellipse
11
+ */
12
+ constructor(x: number, y: number, w: number, h: number);
13
+ /**
14
+ * the center coordinates of the ellipse
15
+ * @public
16
+ * @type {Vector2d}
17
+ * @name pos
18
+ * @memberof Ellipse
19
+ */
20
+ public pos: Vector2d;
21
+ /**
22
+ * The bounding rectangle for this shape
23
+ * @private
24
+ */
25
+ private _bounds;
26
+ /**
27
+ * Maximum radius of the ellipse
28
+ * @public
29
+ * @type {number}
30
+ * @name radius
31
+ * @memberof Ellipse
32
+ */
33
+ public radius: number;
34
+ /**
35
+ * Pre-scaled radius vector for ellipse
36
+ * @public
37
+ * @type {Vector2d}
38
+ * @name radiusV
39
+ * @memberof Ellipse
40
+ */
41
+ public radiusV: Vector2d;
42
+ /**
43
+ * Radius squared, for pythagorean theorom
44
+ * @public
45
+ * @type {Vector2d}
46
+ * @name radiusSq
47
+ * @memberof Ellipse
48
+ */
49
+ public radiusSq: Vector2d;
50
+ /**
51
+ * x/y scaling ratio for ellipse
52
+ * @public
53
+ * @type {Vector2d}
54
+ * @name ratio
55
+ * @memberof Ellipse
56
+ */
57
+ public ratio: Vector2d;
58
+ shapeType: string;
59
+ /** @ignore */
60
+ onResetEvent(x: any, y: any, w: any, h: any): void;
61
+ /**
62
+ * set new value to the Ellipse shape
63
+ * @name setShape
64
+ * @memberof Ellipse
65
+ * @param {number} x - the center x coordinate of the ellipse
66
+ * @param {number} y - the center y coordinate of the ellipse
67
+ * @param {number} w - width (diameter) of the ellipse
68
+ * @param {number} h - height (diameter) of the ellipse
69
+ * @returns {Ellipse} this instance for objecf chaining
70
+ */
71
+ setShape(x: number, y: number, w: number, h: number): Ellipse;
72
+ /**
73
+ * Rotate this Ellipse (counter-clockwise) by the specified angle (in radians).
74
+ * @name rotate
75
+ * @memberof Ellipse
76
+ * @param {number} angle - The angle to rotate (in radians)
77
+ * @param {Vector2d|ObservableVector2d} [v] - an optional point to rotate around
78
+ * @returns {Ellipse} Reference to this object for method chaining
79
+ */
80
+ rotate(angle: number, v?: Vector2d | ObservableVector2d): Ellipse;
81
+ /**
82
+ * Scale this Ellipse by the specified scalar.
83
+ * @name scale
84
+ * @memberof Ellipse
85
+ * @param {number} x
86
+ * @param {number} [y=x]
87
+ * @returns {Ellipse} Reference to this object for method chaining
88
+ */
89
+ scale(x: number, y?: number | undefined): Ellipse;
90
+ /**
91
+ * Scale this Ellipse by the specified vector.
92
+ * @name scale
93
+ * @memberof Ellipse
94
+ * @param {Vector2d} v
95
+ * @returns {Ellipse} Reference to this object for method chaining
96
+ */
97
+ scaleV(v: Vector2d): Ellipse;
98
+ /**
99
+ * apply the given transformation matrix to this ellipse
100
+ * @name transform
101
+ * @memberof Ellipse
102
+ * @param {Matrix2d} matrix - the transformation matrix
103
+ * @returns {Polygon} Reference to this object for method chaining
104
+ */
105
+ transform(matrix: Matrix2d): Polygon;
106
+ /**
107
+ * translate the circle/ellipse by the specified offset
108
+ * @name translate
109
+ * @memberof Ellipse
110
+ * @method
111
+ * @param {number} x - x offset
112
+ * @param {number} y - y offset
113
+ * @returns {Ellipse} this ellipse
114
+ */
115
+ /**
116
+ * translate the circle/ellipse by the specified vector
117
+ * @name translate
118
+ * @memberof Ellipse
119
+ * @param {Vector2d} v - vector offset
120
+ * @returns {Ellipse} this ellipse
121
+ */
122
+ translate(...args: any[]): Ellipse;
123
+ /**
124
+ * check if this circle/ellipse contains the specified point
125
+ * @name contains
126
+ * @method
127
+ * @memberof Ellipse
128
+ * @param {Vector2d} point
129
+ * @returns {boolean} true if contains
130
+ */
131
+ /**
132
+ * check if this circle/ellipse contains the specified point
133
+ * @name contains
134
+ * @memberof Ellipse
135
+ * @param {number} x - x coordinate
136
+ * @param {number} y - y coordinate
137
+ * @returns {boolean} true if contains
138
+ */
139
+ contains(...args: any[]): boolean;
140
+ /**
141
+ * returns the bounding box for this shape, the smallest Rectangle object completely containing this shape.
142
+ * @name getBounds
143
+ * @memberof Ellipse
144
+ * @returns {Bounds} this shape bounding box Rectangle object
145
+ */
146
+ getBounds(): Bounds;
147
+ /**
148
+ * clone this Ellipse
149
+ * @name clone
150
+ * @memberof Ellipse
151
+ * @returns {Ellipse} new Ellipse
152
+ */
153
+ clone(): Ellipse;
154
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @classdesc
3
+ * a line segment Object
4
+ * @augments Polygon
5
+ * @param {number} x - origin point of the Line
6
+ * @param {number} y - origin point of the Line
7
+ * @param {Vector2d[]} points - array of vectors defining the Line
8
+ */
9
+ export default class Line extends Polygon {
10
+ }
11
+ import Polygon from "./poly.js";
@@ -0,0 +1,121 @@
1
+ /**
2
+ * @classdesc
3
+ * a simplified path2d implementation, supporting only one path
4
+ */
5
+ export default class Path2D {
6
+ /**
7
+ * the points defining the current path
8
+ * @public
9
+ * @type {Vector2d[]}
10
+ * @name points
11
+ * @memberof Path2D#
12
+ */
13
+ public points: Vector2d[];
14
+ /**
15
+ * space between interpolated points for quadratic and bezier curve approx. in pixels.
16
+ * @public
17
+ * @type {number}
18
+ * @name arcResolution
19
+ * @default 5
20
+ * @memberof Path2D#
21
+ */
22
+ public arcResolution: number;
23
+ vertices: any[];
24
+ /**
25
+ * begin a new path
26
+ * @name beginPath
27
+ * @memberof Path2D
28
+ */
29
+ beginPath(): void;
30
+ /**
31
+ * causes the point of the pen to move back to the start of the current path.
32
+ * It tries to draw a straight line from the current point to the start.
33
+ * If the shape has already been closed or has only one point, this function does nothing.
34
+ * @name closePath
35
+ * @memberof Path2D
36
+ */
37
+ closePath(): void;
38
+ /**
39
+ * triangulate the shape defined by this path into an array of triangles
40
+ * @name triangulatePath
41
+ * @memberof Path2D
42
+ * @returns {Vector2d[]}
43
+ */
44
+ triangulatePath(): Vector2d[];
45
+ /**
46
+ * moves the starting point of the current path to the (x, y) coordinates.
47
+ * @name moveTo
48
+ * @memberof Path2D
49
+ * @param {number} x - the x-axis (horizontal) coordinate of the point.
50
+ * @param {number} y - the y-axis (vertical) coordinate of the point.
51
+ */
52
+ moveTo(x: number, y: number): void;
53
+ /**
54
+ * connects the last point in the current patch to the (x, y) coordinates with a straight line.
55
+ * @name lineTo
56
+ * @memberof Path2D
57
+ * @param {number} x - the x-axis coordinate of the line's end point.
58
+ * @param {number} y - the y-axis coordinate of the line's end point.
59
+ */
60
+ lineTo(x: number, y: number): void;
61
+ /**
62
+ * adds an arc to the current path which is centered at (x, y) position with the given radius,
63
+ * starting at startAngle and ending at endAngle going in the given direction by counterclockwise (defaulting to clockwise).
64
+ * @name arc
65
+ * @memberof Path2D
66
+ * @param {number} x - the horizontal coordinate of the arc's center.
67
+ * @param {number} y - the vertical coordinate of the arc's center.
68
+ * @param {number} radius - the arc's radius. Must be positive.
69
+ * @param {number} startAngle - the angle at which the arc starts in radians, measured from the positive x-axis.
70
+ * @param {number} endAngle - the angle at which the arc ends in radians, measured from the positive x-axis.
71
+ * @param {boolean} [anticlockwise=false] - an optional boolean value. If true, draws the arc counter-clockwise between the start and end angles.
72
+ */
73
+ arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean | undefined): void;
74
+ /**
75
+ * adds a circular arc to the path with the given control points and radius, connected to the previous point by a straight line.
76
+ * @name arcTo
77
+ * @memberof Path2D
78
+ * @param {number} x1 - the x-axis coordinate of the first control point.
79
+ * @param {number} y1 - the y-axis coordinate of the first control point.
80
+ * @param {number} x2 - the x-axis coordinate of the second control point.
81
+ * @param {number} y2 - the y-axis coordinate of the second control point.
82
+ * @param {number} radius - the arc's radius. Must be positive.
83
+ */
84
+ arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;
85
+ /**
86
+ * adds an elliptical arc to the path which is centered at (x, y) position with the radii radiusX and radiusY
87
+ * starting at startAngle and ending at endAngle going in the given direction by counterclockwise.
88
+ * @name ellipse
89
+ * @memberof Path2D
90
+ * @param {number} x - the x-axis (horizontal) coordinate of the ellipse's center.
91
+ * @param {number} y - the y-axis (vertical) coordinate of the ellipse's center.
92
+ * @param {number} radiusX - the ellipse's major-axis radius. Must be non-negative.
93
+ * @param {number} radiusY - the ellipse's minor-axis radius. Must be non-negative.
94
+ * @param {number} rotation - the rotation of the ellipse, expressed in radians.
95
+ * @param {number} startAngle - the angle at which the ellipse starts, measured clockwise from the positive x-axis and expressed in radians.
96
+ * @param {number} endAngle - the angle at which the ellipse ends, measured clockwise from the positive x-axis and expressed in radians.
97
+ * @param {boolean} [anticlockwise=false] - an optional boolean value which, if true, draws the ellipse counterclockwise (anticlockwise).
98
+ */
99
+ ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean | undefined): void;
100
+ /**
101
+ * creates a path for a rectangle at position (x, y) with a size that is determined by width and height.
102
+ * @name rect
103
+ * @memberof Path2D
104
+ * @param {number} x - the x-axis coordinate of the rectangle's starting point.
105
+ * @param {number} y - the y-axis coordinate of the rectangle's starting point.
106
+ * @param {number} width - the rectangle's width. Positive values are to the right, and negative to the left.
107
+ * @param {number} height - the rectangle's height. Positive values are down, and negative are up.
108
+ */
109
+ rect(x: number, y: number, width: number, height: number): void;
110
+ /**
111
+ * adds an rounded rectangle to the current path.
112
+ * @name roundRect
113
+ * @memberof Path2D
114
+ * @param {number} x - the x-axis coordinate of the rectangle's starting point.
115
+ * @param {number} y - the y-axis coordinate of the rectangle's starting point.
116
+ * @param {number} width - the rectangle's width. Positive values are to the right, and negative to the left.
117
+ * @param {number} height - the rectangle's height. Positive values are down, and negative are up.
118
+ * @param {number} radius - the arc's radius to draw the borders. Must be positive.
119
+ */
120
+ roundRect(x: number, y: number, width: number, height: number, radius: number): void;
121
+ }