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,473 @@
1
+ /**
2
+ * calls each of the listeners registered for a given event.
3
+ * @function event.emit
4
+ * @param {string|symbol} eventName - The event name.
5
+ * @param {object} [...arguments] - arguments to be passed to all listeners
6
+ * @returns {boolean} true if the event had listeners, false otherwise.
7
+ * @example
8
+ * me.event.emit("event-name", a, b, c);
9
+ */
10
+ export function emit(eventName: string | symbol, ...args: any[]): boolean;
11
+ /**
12
+ * Add a listener for a given event.
13
+ * @function event.on
14
+ * @param {string|symbol} eventName - The event name.
15
+ * @param {Function} listener - The listener function.
16
+ * @param {*} [context=this] - The context to invoke the listener with.
17
+ * @returns {EventEmitter} `this`.
18
+ * @public
19
+ * @example
20
+ * me.event.on("event-name", myFunction, this);
21
+ */
22
+ export function on(eventName: string | symbol, listener: Function, context?: any): EventEmitter;
23
+ /**
24
+ * Add a one-time listener for a given event.
25
+ * @function event.once
26
+ * @param {string|symbol} eventName - The event name.
27
+ * @param {Function} listener - The listener function.
28
+ * @param {*} [context=this] - The context to invoke the listener with.
29
+ * @returns {EventEmitter} `this`.
30
+ * @public
31
+ * @example
32
+ * me.event.once("event-name", myFunction, this);
33
+ */
34
+ export function once(eventName: string | symbol, listener: Function, context?: any): EventEmitter;
35
+ /**
36
+ * remove the given listener for a given event.
37
+ * @function event.off
38
+ * @param {string|symbol} eventName - The event name.
39
+ * @param {Function} listener - The listener function.
40
+ * @returns {EventEmitter} `this`.
41
+ * @public
42
+ * @example
43
+ * me.event.off("event-name", myFunction);
44
+ */
45
+ export function off(eventName: string | symbol, listener: Function): EventEmitter;
46
+ /**
47
+ * event when the DOM is Ready is booting
48
+ * @public
49
+ * @constant
50
+ * @type {string}
51
+ * @name DOM_READY
52
+ * @memberof event
53
+ * @see event.on
54
+ */
55
+ export const DOM_READY: string;
56
+ /**
57
+ * event when the system is booting
58
+ * @public
59
+ * @constant
60
+ * @type {string}
61
+ * @name BOOT
62
+ * @memberof event
63
+ * @see event.on
64
+ */
65
+ export const BOOT: string;
66
+ /**
67
+ * event when the game is paused <br>
68
+ * Data passed : none <br>
69
+ * @public
70
+ * @constant
71
+ * @type {string}
72
+ * @name STATE_PAUSE
73
+ * @memberof event
74
+ * @see event.on
75
+ */
76
+ export const STATE_PAUSE: string;
77
+ /**
78
+ * event for when the game is resumed <br>
79
+ * Data passed : {number} time in ms the game was paused
80
+ * @public
81
+ * @constant
82
+ * @type {string}
83
+ * @name STATE_RESUME
84
+ * @memberof event
85
+ * @see event.on
86
+ */
87
+ export const STATE_RESUME: string;
88
+ /**
89
+ * event when the game is stopped <br>
90
+ * Data passed : none <br>
91
+ * @public
92
+ * @constant
93
+ * @type {string}
94
+ * @name STATE_STOP
95
+ * @memberof event
96
+ * @see event.on
97
+ */
98
+ export const STATE_STOP: string;
99
+ /**
100
+ * event for when the game is restarted <br>
101
+ * Data passed : {number} time in ms the game was stopped
102
+ * @public
103
+ * @constant
104
+ * @type {string}
105
+ * @name STATE_RESTART
106
+ * @memberof event
107
+ * @see event.on
108
+ */
109
+ export const STATE_RESTART: string;
110
+ /**
111
+ * event for when the changing to a different stage
112
+ * @public
113
+ * @constant
114
+ * @type {string}
115
+ * @name STATE_CHANGE
116
+ * @memberof event
117
+ * @see event.on
118
+ */
119
+ export const STATE_CHANGE: string;
120
+ /**
121
+ * event for when the video is initialized<br>
122
+ * Data passed : none <br>
123
+ * @public
124
+ * @constant
125
+ * @type {string}
126
+ * @name VIDEO_INIT
127
+ * @memberof event
128
+ * @see video.init
129
+ * @see event.on
130
+ */
131
+ export const VIDEO_INIT: string;
132
+ /**
133
+ * event for when the game manager is initialized <br>
134
+ * Data passed : none <br>
135
+ * @public
136
+ * @constant
137
+ * @type {string}
138
+ * @name GAME_INIT
139
+ * @memberof event
140
+ * @see event.on
141
+ */
142
+ export const GAME_INIT: string;
143
+ /**
144
+ * event for when the game manager is resetted <br>
145
+ * Data passed : none <br>
146
+ * @public
147
+ * @constant
148
+ * @type {string}
149
+ * @name GAME_RESET
150
+ * @memberof event
151
+ * @see event.on
152
+ */
153
+ export const GAME_RESET: string;
154
+ /**
155
+ * event for when the engine is about to start a new game loop
156
+ * Data passed : {number} time the current time stamp
157
+ * @public
158
+ * @constant
159
+ * @type {string}
160
+ * @name GAME_BEFORE_UPDATE
161
+ * @memberof event
162
+ * @see event.on
163
+ */
164
+ export const GAME_BEFORE_UPDATE: string;
165
+ /**
166
+ * event for the end of the update loop
167
+ * Data passed : {number} time the current time stamp
168
+ * @public
169
+ * @constant
170
+ * @type {string}
171
+ * @name GAME_AFTER_UPDATE
172
+ * @memberof event
173
+ * @see event.on
174
+ */
175
+ export const GAME_AFTER_UPDATE: string;
176
+ /**
177
+ * Event for when the game is updated (will be impacted by frame skip, frame interpolation and pause/resume state) <br>
178
+ * Data passed : {number} time the current time stamp
179
+ * @public
180
+ * @constant
181
+ * @type {string}
182
+ * @name GAME_UPDATE
183
+ * @memberof event
184
+ * @see event.on
185
+ */
186
+ export const GAME_UPDATE: string;
187
+ /**
188
+ * Event for the end of the draw loop
189
+ * Data passed : {number} time the current time stamp
190
+ * @public
191
+ * @constant
192
+ * @type {string}
193
+ * @name GAME_BEFORE_DRAW
194
+ * @memberof event
195
+ * @see event.on
196
+ */
197
+ export const GAME_BEFORE_DRAW: string;
198
+ /**
199
+ * Event for the start of the draw loop
200
+ * Data passed : {number} time the current time stamp
201
+ * @public
202
+ * @constant
203
+ * @type {string}
204
+ * @name GAME_AFTER_DRAW
205
+ * @memberof event
206
+ * @see event.on
207
+ */
208
+ export const GAME_AFTER_DRAW: string;
209
+ /**
210
+ * Event for when a level is loaded <br>
211
+ * Data passed : {string} Level Name
212
+ * @public
213
+ * @constant
214
+ * @type {string}
215
+ * @name LEVEL_LOADED
216
+ * @memberof event
217
+ * @see event.on
218
+ */
219
+ export const LEVEL_LOADED: string;
220
+ /**
221
+ * Event for when everything has loaded <br>
222
+ * Data passed : none <br>
223
+ * @public
224
+ * @constant
225
+ * @type {string}
226
+ * @name LOADER_COMPLETE
227
+ * @memberof event
228
+ * @see event.on
229
+ */
230
+ export const LOADER_COMPLETE: string;
231
+ /**
232
+ * Event for displaying a load progress indicator <br>
233
+ * Data passed : {number} [0 .. 1], {Resource} resource object<br>
234
+ * @public
235
+ * @constant
236
+ * @type {string}
237
+ * @name LOADER_PROGRESS
238
+ * @memberof event
239
+ * @see event.on
240
+ */
241
+ export const LOADER_PROGRESS: string;
242
+ /**
243
+ * Event for pressing a binded key <br>
244
+ * Data passed : {string} user-defined action, {number} keyCode,
245
+ * {boolean} edge state <br>
246
+ * Edge-state is for detecting "locked" key bindings. When a locked key
247
+ * is pressed and held, the first event will have the third argument
248
+ * set true. Subsequent events will continue firing with the third
249
+ * argument set false.
250
+ * @public
251
+ * @constant
252
+ * @type {string}
253
+ * @name KEYDOWN
254
+ * @memberof event
255
+ * @see event.on
256
+ * @example
257
+ * me.input.bindKey(me.input.KEY.X, "jump", true); // Edge-triggered
258
+ * me.input.bindKey(me.input.KEY.Z, "shoot"); // Level-triggered
259
+ * me.event.on(me.event.KEYDOWN, (action, keyCode, edge) => {
260
+ * // Checking bound keys
261
+ * if (action === "jump") {
262
+ * if (edge) {
263
+ * this.doJump();
264
+ * }
265
+ *
266
+ * // Make character fall slower when holding the jump key
267
+ * this.vel.y = this.body.gravity;
268
+ * }
269
+ * });
270
+ */
271
+ export const KEYDOWN: string;
272
+ /**
273
+ * Event for releasing a binded key <br>
274
+ * Data passed : {string} user-defined action, {number} keyCode
275
+ * @public
276
+ * @constant
277
+ * @type {string}
278
+ * @name KEYUP
279
+ * @memberof event
280
+ * @see event.on
281
+ * @example
282
+ * me.event.on(me.event.KEYUP, (action, keyCode) => {
283
+ * // Checking unbound keys
284
+ * if (keyCode == me.input.KEY.ESC) {
285
+ * if (me.state.isPaused()) {
286
+ * me.state.resume();
287
+ * }
288
+ * else {
289
+ * me.state.pause();
290
+ * }
291
+ * }
292
+ * });
293
+ */
294
+ export const KEYUP: string;
295
+ /**
296
+ * Event for when a gamepad is connected <br>
297
+ * Data passed : {object} gamepad object
298
+ * @public
299
+ * @constant
300
+ * @type {string}
301
+ * @name GAMEPAD_CONNECTED
302
+ * @memberof event
303
+ * @see event.on
304
+ */
305
+ export const GAMEPAD_CONNECTED: string;
306
+ /**
307
+ * Event for when a gamepad is disconnected <br>
308
+ * Data passed : {object} gamepad object
309
+ * @public
310
+ * @constant
311
+ * @type {string}
312
+ * @name GAMEPAD_DISCONNECTED
313
+ * @memberof event
314
+ * @see event.on
315
+ */
316
+ export const GAMEPAD_DISCONNECTED: string;
317
+ /**
318
+ * Event for when gamepad button/axis state is updated <br>
319
+ * Data passed : {number} index <br>
320
+ * Data passed : {string} type : "axes" or "buttons" <br>
321
+ * Data passed : {number} button <br>
322
+ * Data passed : {number} current.value <br>
323
+ * Data passed : {boolean} current.pressed
324
+ * @public
325
+ * @constant
326
+ * @type {string}
327
+ * @name GAMEPAD_UPDATE
328
+ * @memberof event
329
+ * @see event.on
330
+ */
331
+ export const GAMEPAD_UPDATE: string;
332
+ /**
333
+ * Event for pointermove events on the screen area <br>
334
+ * Data passed : {me.Pointer} a Pointer object
335
+ * @public
336
+ * @constant
337
+ * @type {string}
338
+ * @name POINTERMOVE
339
+ * @memberof event
340
+ * @see event.on
341
+ */
342
+ export const POINTERMOVE: string;
343
+ /**
344
+ * Event for onPointerLockChange event <br>
345
+ * Data passed : {boolean} pointer lock status (true/false)
346
+ * @public
347
+ * @constant
348
+ * @type {string}
349
+ * @name POINTERLOCKCHANGE
350
+ * @memberof event
351
+ * @see event.on
352
+ */
353
+ export const POINTERLOCKCHANGE: string;
354
+ /**
355
+ * Event for dragstart events on a Draggable entity <br>
356
+ * Data passed:
357
+ * {object} the drag event <br>
358
+ * {object} the Draggable entity
359
+ * @public
360
+ * @constant
361
+ * @type {string}
362
+ * @name DRAGSTART
363
+ * @memberof event
364
+ * @see event.on
365
+ */
366
+ export const DRAGSTART: string;
367
+ /**
368
+ * Event for dragend events on a Draggable entity <br>
369
+ * Data passed:
370
+ * {object} the drag event <br>
371
+ * {object} the Draggable entity
372
+ * @public
373
+ * @constant
374
+ * @type {string}
375
+ * @name DRAGEND
376
+ * @memberof event
377
+ * @see event.on
378
+ */
379
+ export const DRAGEND: string;
380
+ /**
381
+ * Event for when the (browser) window is resized <br>
382
+ * Data passed : {Event} Event object
383
+ * @public
384
+ * @constant
385
+ * @type {string}
386
+ * @name WINDOW_ONRESIZE
387
+ * @memberof event
388
+ * @see event.on
389
+ */
390
+ export const WINDOW_ONRESIZE: string;
391
+ /**
392
+ * Event for when the canvas is resized <br>
393
+ * (this usually follows a WINDOW_ONRESIZE event).<br>
394
+ * Data passed : {number} canvas width <br>
395
+ * Data passed : {number} canvas height
396
+ * @public
397
+ * @constant
398
+ * @type {string}
399
+ * @name CANVAS_ONRESIZE
400
+ * @memberof event
401
+ * @see event.on
402
+ */
403
+ export const CANVAS_ONRESIZE: string;
404
+ /**
405
+ * Event for when the viewport is resized <br>
406
+ * (this usually follows a WINDOW_ONRESIZE event, when using the `flex` scaling mode is used and after the viewport was updated).<br>
407
+ * Data passed : {number} viewport width <br>
408
+ * Data passed : {number} viewport height <br>
409
+ * Data passed : {Camera2d} a reference to the camera viewport being resized
410
+ * @public
411
+ * @constant
412
+ * @type {string}
413
+ * @name VIEWPORT_ONRESIZE
414
+ * @memberof event
415
+ * @see event.on
416
+ */
417
+ export const VIEWPORT_ONRESIZE: string;
418
+ /**
419
+ * Event for when the device is rotated <br>
420
+ * Data passed : {Event} Event object <br>
421
+ * @public
422
+ * @constant
423
+ * @type {string}
424
+ * @name WINDOW_ONORIENTATION_CHANGE
425
+ * @memberof event
426
+ * @see event.on
427
+ */
428
+ export const WINDOW_ONORIENTATION_CHANGE: string;
429
+ /**
430
+ * Event for when the (browser) window is scrolled <br>
431
+ * Data passed : {Event} Event object
432
+ * @public
433
+ * @constant
434
+ * @type {string}
435
+ * @name WINDOW_ONSCROLL
436
+ * @memberof event
437
+ * @see event.on
438
+ */
439
+ export const WINDOW_ONSCROLL: string;
440
+ /**
441
+ * Event for when the viewport position is updated <br>
442
+ * Data passed : {me.Vector2d} viewport position vector
443
+ * @public
444
+ * @constant
445
+ * @type {string}
446
+ * @name VIEWPORT_ONCHANGE
447
+ * @memberof event
448
+ * @see event.on
449
+ */
450
+ export const VIEWPORT_ONCHANGE: string;
451
+ /**
452
+ * Event for when the current context is lost <br>
453
+ * Data passed : {me.Renderer} the current renderer instance
454
+ * @public
455
+ * @constant
456
+ * @type {string}
457
+ * @name WEBGL_ONCONTEXT_LOST
458
+ * @memberof event
459
+ * @see event.on
460
+ */
461
+ export const ONCONTEXT_LOST: string;
462
+ /**
463
+ * Event for when the current context is restored <br>
464
+ * Data passed : {me.Renderer} the current renderer instance`
465
+ * @public
466
+ * @constant
467
+ * @type {string}
468
+ * @name ONCONTEXT_RESTORED
469
+ * @memberof event
470
+ * @see event.on
471
+ */
472
+ export const ONCONTEXT_RESTORED: string;
473
+ import EventEmitter from "eventemitter3";
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The device platform type
3
+ * @namespace platform
4
+ * @memberof device
5
+ * @property {string} ua the user agent string for the current device
6
+ * @property {boolean} iOS `true` if the device is an iOS platform
7
+ * @property {boolean} android `true` if the device is an Android platform
8
+ * @property {boolean} android2 `true` if the device is an Android 2.x platform
9
+ * @property {boolean} linux `true` if the device is a Linux platform
10
+ * @property {boolean} chromeOS `true` if the device is running on ChromeOS.
11
+ * @property {boolean} wp `true` if the device is a Windows Phone platform
12
+ * @property {boolean} BlackBerry`true` if the device is a BlackBerry platform
13
+ * @property {boolean} Kindle`true` if the device is a Kindle platform
14
+ * @property {boolean} ejecta `true` if running under Ejecta
15
+ * @property {boolean} isWeixin `true` if running under Wechat
16
+ * @property {boolean} nodeJS `true` if running under node.js
17
+ * @property {boolean} isMobile `true` if a mobile device
18
+ */
19
+ export const ua: string;
20
+ export const iOS: boolean;
21
+ export const android: boolean;
22
+ export const android2: boolean;
23
+ export const linux: boolean;
24
+ export const chromeOS: boolean;
25
+ export const wp: boolean;
26
+ export const BlackBerry: boolean;
27
+ export const Kindle: boolean;
28
+ export const ejecta: boolean;
29
+ export const isWeixin: boolean;
30
+ export const nodeJS: boolean;
31
+ export const isMobile: boolean;
@@ -0,0 +1,101 @@
1
+ export default pool;
2
+ declare var pool: ObjectPool;
3
+ /**
4
+ * @classdesc
5
+ * Object pooling - a technique that might speed up your game if used properly.<br>
6
+ * If some of your classes will be instantiated and removed a lot at a time, it is a
7
+ * good idea to add the class to this object pool. A separate pool for that class
8
+ * will be created, which will reuse objects of the class. That way they won't be instantiated
9
+ * each time you need a new one (slowing your game), but stored into that pool and taking one
10
+ * already instantiated when you need it.<br><br>
11
+ * This technique is also used by the engine to instantiate objects defined in the map,
12
+ * which means, that on level loading the engine will try to instantiate every object
13
+ * found in the map, based on the user defined name in each Object Properties<br>
14
+ * <img src="images/object_properties.png"/><br>
15
+ * @see {@link pool} the default global instance of ObjectPool
16
+ */
17
+ declare class ObjectPool {
18
+ objectClass: {};
19
+ instance_counter: number;
20
+ /**
21
+ * register an object to the pool. <br>
22
+ * Pooling must be set to true if more than one such objects will be created. <br>
23
+ * (Note: for an object to be poolable, it must implements a `onResetEvent` method)
24
+ * @param {string} className - as defined in the Name field of the Object Properties (in Tiled)
25
+ * @param {object} classObj - corresponding Class to be instantiated
26
+ * @param {boolean} [recycling=false] - enables object recycling for the specified class
27
+ * @example
28
+ * // implement CherryEntity
29
+ * class CherryEntity extends Spritesheet {
30
+ * onResetEvent() {
31
+ * // reset object mutable properties
32
+ * this.lifeBar = 100;
33
+ * }
34
+ * };
35
+ * // add our users defined entities in the object pool and enable object recycling
36
+ * me.pool.register("cherryentity", CherryEntity, true);
37
+ */
38
+ register(className: string, classObj: object, recycling?: boolean | undefined): void;
39
+ /**
40
+ * Pull a new instance of the requested object (if added into the object pool)
41
+ * @param {string} name - as used in {@link pool.register}
42
+ * @param {object} [...arguments] - arguments to be passed when instantiating/reinitializing the object
43
+ * @returns {object} the instance of the requested object
44
+ * @example
45
+ * me.pool.register("bullet", BulletEntity, true);
46
+ * me.pool.register("enemy", EnemyEntity, true);
47
+ * // ...
48
+ * // when we need to manually create a new bullet:
49
+ * var bullet = me.pool.pull("bullet", x, y, direction);
50
+ * // ...
51
+ * // params aren't a fixed number
52
+ * // when we need new enemy we can add more params, that the object construct requires:
53
+ * var enemy = me.pool.pull("enemy", x, y, direction, speed, power, life);
54
+ * // ...
55
+ * // when we want to destroy existing object, the remove
56
+ * // function will ensure the object can then be reallocated later
57
+ * me.game.world.removeChild(enemy);
58
+ * me.game.world.removeChild(bullet);
59
+ */
60
+ pull(name: string, ...args: any[]): object;
61
+ /**
62
+ * purge the object pool from any inactive object <br>
63
+ * Object pooling must be enabled for this function to work<br>
64
+ * note: this will trigger the garbage collector
65
+ */
66
+ purge(): void;
67
+ /**
68
+ * Push back an object instance into the object pool <br>
69
+ * Object pooling for the object class must be enabled,
70
+ * and object must have been instantiated using {@link pool#pull},
71
+ * otherwise this function won't work
72
+ * @throws will throw an error if the object cannot be recycled
73
+ * @param {object} obj - instance to be recycled
74
+ * @param {boolean} [throwOnError=true] - throw an exception if the object cannot be recycled
75
+ * @returns {boolean} true if the object was successfully recycled in the object pool
76
+ */
77
+ push(obj: object, throwOnError?: boolean | undefined): boolean;
78
+ /**
79
+ * Check if an object with the provided name is registered
80
+ * @param {string} name - of the registered object class
81
+ * @returns {boolean} true if the classname is registered
82
+ */
83
+ exists(name: string): boolean;
84
+ /**
85
+ * Check if an object is poolable
86
+ * (was properly registered with the recycling feature enable)
87
+ * @see register
88
+ * @param {object} obj - object to be checked
89
+ * @returns {boolean} true if the object is poolable
90
+ * @example
91
+ * if (!me.pool.poolable(myCherryEntity)) {
92
+ * // object was not properly registered
93
+ * }
94
+ */
95
+ poolable(obj: object): boolean;
96
+ /**
97
+ * returns the amount of object instance currently in the pool
98
+ * @returns {number} amount of object instance
99
+ */
100
+ getInstanceCount(): number;
101
+ }
@@ -0,0 +1,25 @@
1
+ export default save;
2
+ declare namespace save {
3
+ /**
4
+ * Add new keys to localStorage and set them to the given default values if they do not exist
5
+ * @name add
6
+ * @memberof save
7
+ * @param {object} props - key and corresponding values
8
+ * @example
9
+ * // Initialize "score" and "lives" with default values
10
+ * me.save.add({ score : 0, lives : 3 });
11
+ * // get or set the value through me.save
12
+ * me.save.score = 1000;
13
+ */
14
+ function add(props: object): void;
15
+ /**
16
+ * Remove a key from localStorage
17
+ * @name remove
18
+ * @memberof save
19
+ * @param {string} key - key to be removed
20
+ * @example
21
+ * // Remove the "score" key from localStorage
22
+ * me.save.remove("score");
23
+ */
24
+ function remove(key: string): void;
25
+ }