melonjs 15.3.0 → 15.4.1

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 (287) hide show
  1. package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +1 -1
  2. package/dist/melonjs.mjs/_virtual/earcut.js +1 -1
  3. package/dist/melonjs.mjs/_virtual/howler.js +1 -1
  4. package/dist/melonjs.mjs/_virtual/index.js +1 -1
  5. package/dist/melonjs.mjs/application/application.js +53 -5
  6. package/dist/melonjs.mjs/application/header.js +2 -2
  7. package/dist/melonjs.mjs/application/resize.js +4 -8
  8. package/dist/melonjs.mjs/application/settings.js +5 -5
  9. package/dist/melonjs.mjs/audio/audio.js +4 -6
  10. package/dist/melonjs.mjs/camera/camera2d.js +12 -14
  11. package/dist/melonjs.mjs/const.js +1 -1
  12. package/dist/melonjs.mjs/entity/entity.js +3 -4
  13. package/dist/melonjs.mjs/geometries/ellipse.js +26 -59
  14. package/dist/melonjs.mjs/geometries/line.js +18 -25
  15. package/dist/melonjs.mjs/geometries/path2d.js +16 -13
  16. package/dist/melonjs.mjs/geometries/point.js +8 -16
  17. package/dist/melonjs.mjs/geometries/poly.js +40 -97
  18. package/dist/melonjs.mjs/geometries/rectangle.js +37 -91
  19. package/dist/melonjs.mjs/geometries/roundrect.js +26 -35
  20. package/dist/melonjs.mjs/index.js +6 -6
  21. package/dist/melonjs.mjs/input/gamepad.js +1 -1
  22. package/dist/melonjs.mjs/input/input.js +1 -1
  23. package/dist/melonjs.mjs/input/keyboard.js +3 -3
  24. package/dist/melonjs.mjs/input/pointer.js +4 -4
  25. package/dist/melonjs.mjs/input/pointerevent.js +6 -7
  26. package/dist/melonjs.mjs/lang/console.js +1 -1
  27. package/dist/melonjs.mjs/lang/deprecated.js +2 -2
  28. package/dist/melonjs.mjs/level/level.js +1 -1
  29. package/dist/melonjs.mjs/level/tiled/TMXGroup.js +1 -1
  30. package/dist/melonjs.mjs/level/tiled/TMXLayer.js +16 -33
  31. package/dist/melonjs.mjs/level/tiled/TMXObject.js +3 -4
  32. package/dist/melonjs.mjs/level/tiled/TMXTile.js +4 -4
  33. package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +3 -3
  34. package/dist/melonjs.mjs/level/tiled/TMXTileset.js +4 -7
  35. package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +2 -2
  36. package/dist/melonjs.mjs/level/tiled/TMXUtils.js +26 -29
  37. package/dist/melonjs.mjs/level/tiled/constants.js +1 -1
  38. package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +3 -3
  39. package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +2 -2
  40. package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +2 -2
  41. package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +2 -2
  42. package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +2 -2
  43. package/dist/melonjs.mjs/level/tiled/renderer/autodetect.js +1 -1
  44. package/dist/melonjs.mjs/loader/cache.js +1 -1
  45. package/dist/melonjs.mjs/loader/loader.js +1 -1
  46. package/dist/melonjs.mjs/loader/loadingscreen.js +1 -1
  47. package/dist/melonjs.mjs/loader/melonjs_logo.png.js +1 -1
  48. package/dist/melonjs.mjs/loader/parser.js +4 -5
  49. package/dist/melonjs.mjs/loader/settings.js +1 -1
  50. package/dist/melonjs.mjs/math/color.js +2 -2
  51. package/dist/melonjs.mjs/math/math.js +1 -1
  52. package/dist/melonjs.mjs/math/matrix2.js +5 -59
  53. package/dist/melonjs.mjs/math/matrix3.js +82 -141
  54. package/dist/melonjs.mjs/math/observable_vector2.js +7 -7
  55. package/dist/melonjs.mjs/math/observable_vector3.js +5 -5
  56. package/dist/melonjs.mjs/math/vector2.js +7 -91
  57. package/dist/melonjs.mjs/math/vector3.js +6 -90
  58. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/arraymultimap.js +1 -1
  59. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/multimap.js +1 -1
  60. package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +1 -1
  61. package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +1 -1
  62. package/dist/melonjs.mjs/node_modules/eventemitter3/index2.js +1 -1
  63. package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +1 -1
  64. package/dist/melonjs.mjs/particles/emitter.js +2 -2
  65. package/dist/melonjs.mjs/particles/particle.js +2 -2
  66. package/dist/melonjs.mjs/particles/settings.js +1 -1
  67. package/dist/melonjs.mjs/physics/body.js +22 -20
  68. package/dist/melonjs.mjs/physics/bounds.js +27 -33
  69. package/dist/melonjs.mjs/physics/collision.js +5 -5
  70. package/dist/melonjs.mjs/physics/detector.js +10 -10
  71. package/dist/melonjs.mjs/physics/quadtree.js +5 -5
  72. package/dist/melonjs.mjs/physics/response.js +1 -1
  73. package/dist/melonjs.mjs/physics/sat.js +3 -4
  74. package/dist/melonjs.mjs/physics/world.js +6 -9
  75. package/dist/melonjs.mjs/plugin/plugin.js +3 -3
  76. package/dist/melonjs.mjs/renderable/collectable.js +2 -2
  77. package/dist/melonjs.mjs/renderable/colorlayer.js +4 -4
  78. package/dist/melonjs.mjs/renderable/container.js +25 -25
  79. package/dist/melonjs.mjs/renderable/draggable.js +1 -1
  80. package/dist/melonjs.mjs/renderable/dragndrop.js +1 -1
  81. package/dist/melonjs.mjs/renderable/imagelayer.js +4 -4
  82. package/dist/melonjs.mjs/renderable/light2d.js +3 -3
  83. package/dist/melonjs.mjs/renderable/nineslicesprite.js +2 -2
  84. package/dist/melonjs.mjs/renderable/renderable.js +26 -26
  85. package/dist/melonjs.mjs/renderable/sprite.js +3 -3
  86. package/dist/melonjs.mjs/renderable/text/bitmaptext.js +421 -0
  87. package/dist/melonjs.mjs/renderable/text/bitmaptextdata.js +195 -0
  88. package/dist/melonjs.mjs/renderable/text/glyph.js +65 -0
  89. package/dist/melonjs.mjs/renderable/text/text.js +422 -0
  90. package/dist/melonjs.mjs/renderable/text/textmetrics.js +175 -0
  91. package/dist/melonjs.mjs/renderable/text/textstyle.js +21 -0
  92. package/dist/melonjs.mjs/renderable/trigger.js +10 -10
  93. package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +7 -7
  94. package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +7 -7
  95. package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +3 -3
  96. package/dist/melonjs.mjs/state/stage.js +2 -2
  97. package/dist/melonjs.mjs/state/state.js +1 -38
  98. package/dist/melonjs.mjs/system/device.js +49 -10
  99. package/dist/melonjs.mjs/system/dom.js +1 -1
  100. package/dist/melonjs.mjs/system/event.js +24 -2
  101. package/dist/melonjs.mjs/system/platform.js +18 -18
  102. package/dist/melonjs.mjs/system/pooling.js +10 -10
  103. package/dist/melonjs.mjs/system/save.js +1 -1
  104. package/dist/melonjs.mjs/system/timer.js +1 -1
  105. package/dist/melonjs.mjs/text/bitmaptext.js +1 -1
  106. package/dist/melonjs.mjs/text/bitmaptextdata.js +3 -6
  107. package/dist/melonjs.mjs/text/glyph.js +1 -1
  108. package/dist/melonjs.mjs/text/text.js +1 -1
  109. package/dist/melonjs.mjs/text/textmetrics.js +1 -1
  110. package/dist/melonjs.mjs/text/textstyle.js +1 -1
  111. package/dist/melonjs.mjs/tweens/easing.js +1 -1
  112. package/dist/melonjs.mjs/tweens/interpolation.js +1 -1
  113. package/dist/melonjs.mjs/tweens/tween.js +2 -2
  114. package/dist/melonjs.mjs/utils/agent.js +1 -1
  115. package/dist/melonjs.mjs/utils/array.js +1 -1
  116. package/dist/melonjs.mjs/utils/file.js +1 -1
  117. package/dist/melonjs.mjs/utils/function.js +2 -3
  118. package/dist/melonjs.mjs/utils/string.js +1 -1
  119. package/dist/melonjs.mjs/utils/utils.js +1 -1
  120. package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +3 -7
  121. package/dist/melonjs.mjs/video/renderer.js +16 -16
  122. package/dist/melonjs.mjs/video/texture/atlas.js +13 -13
  123. package/dist/melonjs.mjs/video/texture/cache.js +1 -1
  124. package/dist/melonjs.mjs/video/texture/canvas_texture.js +15 -15
  125. package/dist/melonjs.mjs/video/utils/autodetect.js +1 -1
  126. package/dist/melonjs.mjs/video/video.js +4 -4
  127. package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +3 -3
  128. package/dist/melonjs.mjs/video/webgl/compositors/compositor.js +13 -14
  129. package/dist/melonjs.mjs/video/webgl/compositors/primitive_compositor.js +5 -5
  130. package/dist/melonjs.mjs/video/webgl/compositors/quad_compositor.js +2 -3
  131. package/dist/melonjs.mjs/video/webgl/glshader.js +2 -2
  132. package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +1 -1
  133. package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +1 -1
  134. package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +1 -1
  135. package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +1 -1
  136. package/dist/melonjs.mjs/video/webgl/utils/attributes.js +1 -1
  137. package/dist/melonjs.mjs/video/webgl/utils/precision.js +4 -4
  138. package/dist/melonjs.mjs/video/webgl/utils/program.js +1 -1
  139. package/dist/melonjs.mjs/video/webgl/utils/string.js +1 -1
  140. package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +1 -1
  141. package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +50 -52
  142. package/dist/melonjs.module.js +1137 -1576
  143. package/dist/types/application/application.d.ts +28 -4
  144. package/dist/types/application/header.d.ts +2 -2
  145. package/dist/types/application/settings.d.ts +23 -23
  146. package/dist/types/audio/audio.d.ts +3 -5
  147. package/dist/types/camera/camera2d.d.ts +13 -16
  148. package/dist/types/entity/entity.d.ts +0 -1
  149. package/dist/types/geometries/ellipse.d.ts +18 -50
  150. package/dist/types/geometries/path2d.d.ts +1 -1
  151. package/dist/types/geometries/point.d.ts +5 -13
  152. package/dist/types/geometries/poly.d.ts +26 -75
  153. package/dist/types/geometries/rectangle.d.ts +12 -58
  154. package/dist/types/geometries/roundrect.d.ts +2 -11
  155. package/dist/types/index.d.ts +3 -3
  156. package/dist/types/input/gamepad.d.ts +31 -31
  157. package/dist/types/input/keyboard.d.ts +105 -105
  158. package/dist/types/input/pointer.d.ts +21 -21
  159. package/dist/types/input/pointerevent.d.ts +6 -6
  160. package/dist/types/level/tiled/TMXLayer.d.ts +1 -1
  161. package/dist/types/math/matrix2.d.ts +9 -63
  162. package/dist/types/math/matrix3.d.ts +9 -68
  163. package/dist/types/math/observable_vector2.d.ts +2 -2
  164. package/dist/types/math/observable_vector3.d.ts +2 -2
  165. package/dist/types/math/vector2.d.ts +8 -92
  166. package/dist/types/math/vector3.d.ts +8 -92
  167. package/dist/types/particles/settings.d.ts +29 -29
  168. package/dist/types/physics/body.d.ts +10 -8
  169. package/dist/types/physics/bounds.d.ts +24 -30
  170. package/dist/types/physics/collision.d.ts +12 -12
  171. package/dist/types/physics/detector.d.ts +1 -1
  172. package/dist/types/physics/world.d.ts +4 -7
  173. package/dist/types/renderable/container.d.ts +19 -19
  174. package/dist/types/renderable/imagelayer.d.ts +6 -6
  175. package/dist/types/renderable/light2d.d.ts +7 -7
  176. package/dist/types/renderable/renderable.d.ts +9 -16
  177. package/dist/types/renderable/text/bitmaptext.d.ts +151 -0
  178. package/dist/types/renderable/text/bitmaptextdata.d.ts +35 -0
  179. package/dist/types/renderable/text/glyph.d.ts +28 -0
  180. package/dist/types/renderable/text/text.d.ts +159 -0
  181. package/dist/types/renderable/text/textmetrics.d.ts +47 -0
  182. package/dist/types/renderable/text/textstyle.d.ts +5 -0
  183. package/dist/types/renderable/ui/uibaseelement.d.ts +0 -1
  184. package/dist/types/renderable/ui/uispriteelement.d.ts +0 -1
  185. package/dist/types/renderable/ui/uitextbutton.d.ts +2 -7
  186. package/dist/types/state/state.d.ts +11 -11
  187. package/dist/types/system/device.d.ts +15 -9
  188. package/dist/types/system/event.d.ts +20 -0
  189. package/dist/types/system/platform.d.ts +17 -17
  190. package/dist/types/utils/function.d.ts +1 -2
  191. package/dist/types/video/renderer.d.ts +13 -13
  192. package/dist/types/video/texture/canvas_texture.d.ts +14 -14
  193. package/dist/types/video/video.d.ts +2 -2
  194. package/dist/types/video/webgl/buffer/vertex.d.ts +2 -2
  195. package/dist/types/video/webgl/compositors/compositor.d.ts +24 -13
  196. package/dist/types/video/webgl/compositors/primitive_compositor.d.ts +0 -1
  197. package/dist/types/video/webgl/compositors/quad_compositor.d.ts +0 -1
  198. package/dist/types/video/webgl/utils/precision.d.ts +1 -1
  199. package/dist/types/video/webgl/webgl_renderer.d.ts +47 -50
  200. package/package.json +15 -15
  201. package/src/application/application.js +51 -3
  202. package/src/application/header.js +1 -1
  203. package/src/application/resize.js +3 -7
  204. package/src/application/settings.js +4 -4
  205. package/src/audio/audio.js +3 -5
  206. package/src/camera/camera2d.js +11 -13
  207. package/src/entity/entity.js +2 -3
  208. package/src/geometries/ellipse.js +25 -58
  209. package/src/geometries/line.js +17 -24
  210. package/src/geometries/path2d.js +15 -12
  211. package/src/geometries/point.js +7 -15
  212. package/src/geometries/poly.js +39 -96
  213. package/src/geometries/rectangle.js +36 -90
  214. package/src/geometries/roundrect.js +25 -34
  215. package/src/index.js +4 -4
  216. package/src/input/keyboard.js +2 -2
  217. package/src/input/pointer.js +3 -3
  218. package/src/input/pointerevent.js +5 -6
  219. package/src/lang/deprecated.js +1 -1
  220. package/src/level/tiled/TMXLayer.js +15 -32
  221. package/src/level/tiled/TMXObject.js +2 -3
  222. package/src/level/tiled/TMXTile.js +3 -3
  223. package/src/level/tiled/TMXTileMap.js +2 -2
  224. package/src/level/tiled/TMXTileset.js +3 -6
  225. package/src/level/tiled/TMXTilesetGroup.js +1 -1
  226. package/src/level/tiled/TMXUtils.js +25 -28
  227. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +2 -2
  228. package/src/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
  229. package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -1
  230. package/src/level/tiled/renderer/TMXRenderer.js +1 -1
  231. package/src/level/tiled/renderer/TMXStaggeredRenderer.js +1 -1
  232. package/src/loader/parser.js +3 -4
  233. package/src/math/color.js +1 -1
  234. package/src/math/matrix2.js +4 -58
  235. package/src/math/matrix3.js +81 -140
  236. package/src/math/observable_vector2.js +6 -6
  237. package/src/math/observable_vector3.js +4 -4
  238. package/src/math/vector2.js +6 -90
  239. package/src/math/vector3.js +5 -89
  240. package/src/particles/emitter.js +1 -1
  241. package/src/particles/particle.js +1 -1
  242. package/src/physics/body.js +21 -19
  243. package/src/physics/bounds.js +26 -32
  244. package/src/physics/collision.js +4 -4
  245. package/src/physics/detector.js +9 -9
  246. package/src/physics/quadtree.js +4 -4
  247. package/src/physics/sat.js +2 -3
  248. package/src/physics/world.js +5 -8
  249. package/src/polyfill/roundrect.js +163 -163
  250. package/src/renderable/collectable.js +1 -1
  251. package/src/renderable/colorlayer.js +3 -3
  252. package/src/renderable/container.js +24 -24
  253. package/src/renderable/imagelayer.js +3 -3
  254. package/src/renderable/light2d.js +2 -2
  255. package/src/renderable/nineslicesprite.js +1 -1
  256. package/src/renderable/renderable.js +25 -25
  257. package/src/renderable/sprite.js +2 -2
  258. package/src/{text → renderable/text}/bitmaptext.js +8 -8
  259. package/src/{text → renderable/text}/bitmaptextdata.js +4 -7
  260. package/src/{text → renderable/text}/glyph.js +1 -1
  261. package/src/{text → renderable/text}/text.js +16 -17
  262. package/src/{text → renderable/text}/textmetrics.js +2 -2
  263. package/src/renderable/trigger.js +9 -9
  264. package/src/renderable/ui/uibaseelement.js +6 -6
  265. package/src/renderable/ui/uispriteelement.js +6 -6
  266. package/src/renderable/ui/uitextbutton.js +2 -2
  267. package/src/state/stage.js +1 -1
  268. package/src/state/state.js +0 -49
  269. package/src/system/device.js +48 -9
  270. package/src/system/event.js +22 -0
  271. package/src/system/platform.js +18 -18
  272. package/src/system/pooling.js +9 -9
  273. package/src/tweens/tween.js +1 -1
  274. package/src/utils/function.js +1 -2
  275. package/src/video/canvas/canvas_renderer.js +2 -6
  276. package/src/video/renderer.js +15 -15
  277. package/src/video/texture/atlas.js +12 -12
  278. package/src/video/texture/canvas_texture.js +14 -14
  279. package/src/video/video.js +3 -3
  280. package/src/video/webgl/buffer/vertex.js +2 -2
  281. package/src/video/webgl/compositors/compositor.js +12 -13
  282. package/src/video/webgl/compositors/primitive_compositor.js +4 -4
  283. package/src/video/webgl/compositors/quad_compositor.js +1 -2
  284. package/src/video/webgl/glshader.js +1 -1
  285. package/src/video/webgl/utils/precision.js +3 -3
  286. package/src/video/webgl/webgl_renderer.js +49 -51
  287. /package/src/{text → renderable/text}/textstyle.js +0 -0
@@ -5,7 +5,7 @@ import pool from "./../system/pooling.js";
5
5
  * @classdesc
6
6
  * a generic 3D Vector Object
7
7
  */
8
- export default class Vector3d {
8
+ export default class Vector3d {
9
9
  /**
10
10
  * @param {number} [x=0] - x value of the vector
11
11
  * @param {number} [y=0] - y value of the vector
@@ -38,8 +38,6 @@ import pool from "./../system/pooling.js";
38
38
 
39
39
  /**
40
40
  * set the Vector x and y properties to the given values<br>
41
- * @name set
42
- * @memberof Vector3d
43
41
  * @param {number} x
44
42
  * @param {number} y
45
43
  * @param {number} [z=0]
@@ -84,8 +82,6 @@ import pool from "./../system/pooling.js";
84
82
 
85
83
  /**
86
84
  * set the Vector x and y properties to 0
87
- * @name setZero
88
- * @memberof Vector3d
89
85
  * @returns {Vector3d} Reference to this object for method chaining
90
86
  */
91
87
  setZero() {
@@ -94,8 +90,6 @@ import pool from "./../system/pooling.js";
94
90
 
95
91
  /**
96
92
  * set the Vector x and y properties using the passed vector
97
- * @name setV
98
- * @memberof Vector3d
99
93
  * @param {Vector2d|Vector3d} v
100
94
  * @returns {Vector3d} Reference to this object for method chaining
101
95
  */
@@ -105,8 +99,6 @@ import pool from "./../system/pooling.js";
105
99
 
106
100
  /**
107
101
  * Add the passed vector to this vector
108
- * @name add
109
- * @memberof Vector3d
110
102
  * @param {Vector2d|Vector3d} v
111
103
  * @returns {Vector3d} Reference to this object for method chaining
112
104
  */
@@ -116,8 +108,6 @@ import pool from "./../system/pooling.js";
116
108
 
117
109
  /**
118
110
  * Substract the passed vector to this vector
119
- * @name sub
120
- * @memberof Vector3d
121
111
  * @param {Vector2d|Vector3d} v
122
112
  * @returns {Vector3d} Reference to this object for method chaining
123
113
  */
@@ -127,8 +117,6 @@ import pool from "./../system/pooling.js";
127
117
 
128
118
  /**
129
119
  * Multiply this vector values by the given scalar
130
- * @name scale
131
- * @memberof Vector3d
132
120
  * @param {number} x
133
121
  * @param {number} [y=x]
134
122
  * @param {number} [z=1]
@@ -140,8 +128,6 @@ import pool from "./../system/pooling.js";
140
128
 
141
129
  /**
142
130
  * Multiply this vector values by the passed vector
143
- * @name scaleV
144
- * @memberof Vector3d
145
131
  * @param {Vector2d|Vector3d} v
146
132
  * @returns {Vector3d} Reference to this object for method chaining
147
133
  */
@@ -151,8 +137,6 @@ import pool from "./../system/pooling.js";
151
137
 
152
138
  /**
153
139
  * Convert this vector into isometric coordinate space
154
- * @name toIso
155
- * @memberof Vector3d
156
140
  * @returns {Vector3d} Reference to this object for method chaining
157
141
  */
158
142
  toIso() {
@@ -161,8 +145,6 @@ import pool from "./../system/pooling.js";
161
145
 
162
146
  /**
163
147
  * Convert this vector into 2d coordinate space
164
- * @name to2d
165
- * @memberof Vector3d
166
148
  * @returns {Vector3d} Reference to this object for method chaining
167
149
  */
168
150
  to2d() {
@@ -171,8 +153,6 @@ import pool from "./../system/pooling.js";
171
153
 
172
154
  /**
173
155
  * Divide this vector values by the passed value
174
- * @name div
175
- * @memberof Vector3d
176
156
  * @param {number} n - the value to divide the vector by
177
157
  * @returns {Vector3d} Reference to this object for method chaining
178
158
  */
@@ -182,8 +162,6 @@ import pool from "./../system/pooling.js";
182
162
 
183
163
  /**
184
164
  * Update this vector values to absolute values
185
- * @name abs
186
- * @memberof Vector3d
187
165
  * @returns {Vector3d} Reference to this object for method chaining
188
166
  */
189
167
  abs() {
@@ -192,8 +170,6 @@ import pool from "./../system/pooling.js";
192
170
 
193
171
  /**
194
172
  * Clamp the vector value within the specified value range
195
- * @name clamp
196
- * @memberof Vector3d
197
173
  * @param {number} low
198
174
  * @param {number} high
199
175
  * @returns {Vector3d} new me.Vector3d
@@ -204,8 +180,6 @@ import pool from "./../system/pooling.js";
204
180
 
205
181
  /**
206
182
  * Clamp this vector value within the specified value range
207
- * @name clampSelf
208
- * @memberof Vector3d
209
183
  * @param {number} low
210
184
  * @param {number} high
211
185
  * @returns {Vector3d} Reference to this object for method chaining
@@ -216,8 +190,6 @@ import pool from "./../system/pooling.js";
216
190
 
217
191
  /**
218
192
  * Update this vector with the minimum value between this and the passed vector
219
- * @name minV
220
- * @memberof Vector3d
221
193
  * @param {Vector2d|Vector3d} v
222
194
  * @returns {Vector3d} Reference to this object for method chaining
223
195
  */
@@ -228,8 +200,6 @@ import pool from "./../system/pooling.js";
228
200
 
229
201
  /**
230
202
  * Update this vector with the maximum value between this and the passed vector
231
- * @name maxV
232
- * @memberof Vector3d
233
203
  * @param {Vector2d|Vector3d} v
234
204
  * @returns {Vector3d} Reference to this object for method chaining
235
205
  */
@@ -240,8 +210,6 @@ import pool from "./../system/pooling.js";
240
210
 
241
211
  /**
242
212
  * Floor the vector values
243
- * @name floor
244
- * @memberof Vector3d
245
213
  * @returns {Vector3d} new me.Vector3d
246
214
  */
247
215
  floor() {
@@ -250,8 +218,6 @@ import pool from "./../system/pooling.js";
250
218
 
251
219
  /**
252
220
  * Floor this vector values
253
- * @name floorSelf
254
- * @memberof Vector3d
255
221
  * @returns {Vector3d} Reference to this object for method chaining
256
222
  */
257
223
  floorSelf() {
@@ -260,8 +226,6 @@ import pool from "./../system/pooling.js";
260
226
 
261
227
  /**
262
228
  * Ceil the vector values
263
- * @name ceil
264
- * @memberof Vector3d
265
229
  * @returns {Vector3d} new me.Vector3d
266
230
  */
267
231
  ceil() {
@@ -270,8 +234,6 @@ import pool from "./../system/pooling.js";
270
234
 
271
235
  /**
272
236
  * Ceil this vector values
273
- * @name ceilSelf
274
- * @memberof Vector3d
275
237
  * @returns {Vector3d} Reference to this object for method chaining
276
238
  */
277
239
  ceilSelf() {
@@ -280,8 +242,6 @@ import pool from "./../system/pooling.js";
280
242
 
281
243
  /**
282
244
  * Negate the vector values
283
- * @name negate
284
- * @memberof Vector3d
285
245
  * @returns {Vector3d} new me.Vector3d
286
246
  */
287
247
  negate() {
@@ -290,8 +250,6 @@ import pool from "./../system/pooling.js";
290
250
 
291
251
  /**
292
252
  * Negate this vector values
293
- * @name negateSelf
294
- * @memberof Vector3d
295
253
  * @returns {Vector3d} Reference to this object for method chaining
296
254
  */
297
255
  negateSelf() {
@@ -300,8 +258,6 @@ import pool from "./../system/pooling.js";
300
258
 
301
259
  /**
302
260
  * Copy the components of the given vector into this one
303
- * @name copy
304
- * @memberof Vector3d
305
261
  * @param {Vector2d|Vector3d} v
306
262
  * @returns {Vector3d} Reference to this object for method chaining
307
263
  */
@@ -310,19 +266,9 @@ import pool from "./../system/pooling.js";
310
266
  }
311
267
 
312
268
  /**
313
- * return true if the two vectors are the same
314
- * @name equals
315
- * @memberof Vector3d
316
- * @method
317
- * @param {Vector2d|Vector3d} v
318
- * @returns {boolean}
319
- */
320
- /**
321
- * return true if this vector is equal to the given values
322
- * @name equals
323
- * @memberof Vector3d
324
- * @param {number} x
325
- * @param {number} y
269
+ * return true if this vector is equal to the given values or vector
270
+ * @param {number|Vector2d|ObservableVector2d|Vector3d|ObservableVector3d} x
271
+ * @param {number} [y]
326
272
  * @param {number} [z]
327
273
  * @returns {boolean}
328
274
  */
@@ -349,8 +295,6 @@ import pool from "./../system/pooling.js";
349
295
 
350
296
  /**
351
297
  * normalize this vector (scale the vector so that its magnitude is 1)
352
- * @name normalize
353
- * @memberof Vector3d
354
298
  * @returns {Vector3d} Reference to this object for method chaining
355
299
  */
356
300
  normalize() {
@@ -360,8 +304,6 @@ import pool from "./../system/pooling.js";
360
304
  /**
361
305
  * change this vector to be perpendicular to what it was before.<br>
362
306
  * (Effectively rotates it 90 degrees in a clockwise direction around the z axis)
363
- * @name perp
364
- * @memberof Vector3d
365
307
  * @returns {Vector3d} Reference to this object for method chaining
366
308
  */
367
309
  perp() {
@@ -370,8 +312,6 @@ import pool from "./../system/pooling.js";
370
312
 
371
313
  /**
372
314
  * Rotate this vector (counter-clockwise) by the specified angle (in radians) around the z axis
373
- * @name rotate
374
- * @memberof Vector3d
375
315
  * @param {number} angle - The angle to rotate (in radians)
376
316
  * @param {Vector2d|ObservableVector2d} [v] - an optional point to rotate around (on the same z axis)
377
317
  * @returns {Vector3d} Reference to this object for method chaining
@@ -397,8 +337,6 @@ import pool from "./../system/pooling.js";
397
337
 
398
338
  /**
399
339
  * return the dot product of this vector and the passed one
400
- * @name dot
401
- * @memberof Vector3d
402
340
  * @param {Vector2d|Vector3d} v
403
341
  * @returns {number} The dot product.
404
342
  */
@@ -408,8 +346,6 @@ import pool from "./../system/pooling.js";
408
346
 
409
347
  /**
410
348
  * calculate the cross product of this vector and the passed one
411
- * @name cross
412
- * @memberof Vector3d
413
349
  * @param {Vector3d} v
414
350
  * @returns {Vector3d} Reference to this object for method chaining
415
351
  */
@@ -424,10 +360,8 @@ import pool from "./../system/pooling.js";
424
360
  return this;
425
361
  }
426
362
 
427
- /**
363
+ /**
428
364
  * return the square length of this vector
429
- * @name length2
430
- * @memberof Vector3d
431
365
  * @returns {number} The length^2 of this vector.
432
366
  */
433
367
  length2() {
@@ -436,8 +370,6 @@ import pool from "./../system/pooling.js";
436
370
 
437
371
  /**
438
372
  * return the length (magnitude) of this vector
439
- * @name length
440
- * @memberof Vector3d
441
373
  * @returns {number} the length of this vector
442
374
  */
443
375
  length() {
@@ -446,8 +378,6 @@ import pool from "./../system/pooling.js";
446
378
 
447
379
  /**
448
380
  * Linearly interpolate between this vector and the given one.
449
- * @name lerp
450
- * @memberof Vector3d
451
381
  * @param {Vector3d} v
452
382
  * @param {number} alpha - distance along the line (alpha = 0 will be this vector, and alpha = 1 will be the given one).
453
383
  * @returns {Vector3d} Reference to this object for method chaining
@@ -461,8 +391,6 @@ import pool from "./../system/pooling.js";
461
391
 
462
392
  /**
463
393
  * interpolate the position of this vector on the x and y axis towards the given one by the given maximum step.
464
- * @name moveTowards
465
- * @memberof Vector3d
466
394
  * @param {Vector2d|Vector3d} target
467
395
  * @param {number} step - the maximum step per iteration (Negative values will push the vector away from the target)
468
396
  * @returns {Vector3d} Reference to this object for method chaining
@@ -487,8 +415,6 @@ import pool from "./../system/pooling.js";
487
415
 
488
416
  /**
489
417
  * return the distance between this vector and the passed one
490
- * @name distance
491
- * @memberof Vector3d
492
418
  * @param {Vector2d|Vector3d} v
493
419
  * @returns {number}
494
420
  */
@@ -501,8 +427,6 @@ import pool from "./../system/pooling.js";
501
427
 
502
428
  /**
503
429
  * return the angle between this vector and the passed one
504
- * @name angle
505
- * @memberof Vector3d
506
430
  * @param {Vector2d|Vector3d} v
507
431
  * @returns {number} angle in radians
508
432
  */
@@ -512,8 +436,6 @@ import pool from "./../system/pooling.js";
512
436
 
513
437
  /**
514
438
  * project this vector on to another vector.
515
- * @name project
516
- * @memberof Vector3d
517
439
  * @param {Vector2d|Vector3d} v - The vector to project onto.
518
440
  * @returns {Vector3d} Reference to this object for method chaining
519
441
  */
@@ -525,8 +447,6 @@ import pool from "./../system/pooling.js";
525
447
  /**
526
448
  * Project this vector onto a vector of unit length.<br>
527
449
  * This is slightly more efficient than `project` when dealing with unit vectors.
528
- * @name projectN
529
- * @memberof Vector3d
530
450
  * @param {Vector2d|Vector3d} v - The unit vector to project onto.
531
451
  * @returns {Vector3d} Reference to this object for method chaining
532
452
  */
@@ -537,8 +457,6 @@ import pool from "./../system/pooling.js";
537
457
 
538
458
  /**
539
459
  * return a clone copy of this vector
540
- * @name clone
541
- * @memberof Vector3d
542
460
  * @returns {Vector3d} new me.Vector3d
543
461
  */
544
462
  clone() {
@@ -547,8 +465,6 @@ import pool from "./../system/pooling.js";
547
465
 
548
466
  /**
549
467
  * convert the object to a string representation
550
- * @name toString
551
- * @memberof Vector3d
552
468
  * @returns {string}
553
469
  */
554
470
  toString() {
@@ -21,7 +21,7 @@ function createDefaultParticleTexture(w = 8, h = 8) {
21
21
  * Particle Emitter Object.
22
22
  * @augments Container
23
23
  */
24
- export default class ParticleEmitter extends Container {
24
+ export default class ParticleEmitter extends Container {
25
25
  /**
26
26
  * @param {number} x - x position of the particle emitter
27
27
  * @param {number} y - y position of the particle emitter
@@ -8,7 +8,7 @@ import Renderable from "./../renderable/renderable.js";
8
8
  * Single Particle Object.
9
9
  * @augments Renderable
10
10
  */
11
- export default class Particle extends Renderable {
11
+ export default class Particle extends Renderable {
12
12
  /**
13
13
  * @param {ParticleEmitter} emitter - the particle emitter
14
14
  */
@@ -14,7 +14,7 @@ import Point from "../geometries/point.js";
14
14
  * a Generic Physic Body Object with some physic properties and behavior functionality, to as a member of a Renderable.
15
15
  * @see Renderable.body
16
16
  */
17
- export default class Body {
17
+ export default class Body {
18
18
  /**
19
19
  * @param {Renderable|Container|Entity|Sprite|NineSliceSprite} ancestor - the parent object this body is attached to
20
20
  * @param {Rect|Rect[]|Polygon|Polygon[]|Line|Line[]|Ellipse|Ellipse[]|Point|Point[]|Bounds|Bounds[]|object} [shapes] - a initial shape, list of shapes, or JSON object defining the body
@@ -516,32 +516,34 @@ import Point from "../geometries/point.js";
516
516
 
517
517
  /**
518
518
  * Returns true if the any of the shape composing the body contains the given point.
519
- * @method Body#contains
520
- * @param {Vector2d} point
521
- * @returns {boolean} true if contains
522
- */
523
- /**
524
- * Returns true if the any of the shape composing the body contains the given point.
525
- * @param {number} x - x coordinate
526
- * @param {number} y - y coordinate
519
+ * @param {number|Vector2d} x - x coordinate or a vector point to check
520
+ * @param {number} [y] - y coordinate
527
521
  * @returns {boolean} true if contains
522
+ * @example
523
+ * if (mySprite.body.contains(10, 10)) {
524
+ * // do something
525
+ * }
526
+ * // or
527
+ * if (mySprite.body.contains(myVector2d)) {
528
+ * // do something
529
+ * }
528
530
  */
529
531
  contains() {
530
532
  let _x, _y;
531
533
 
532
534
  if (arguments.length === 2) {
533
- // x, y
534
- _x = arguments[0];
535
- _y = arguments[1];
535
+ // x, y
536
+ _x = arguments[0];
537
+ _y = arguments[1];
536
538
  } else {
537
- // vector
538
- _x = arguments[0].x;
539
- _y = arguments[0].y;
539
+ // vector
540
+ _x = arguments[0].x;
541
+ _y = arguments[0].y;
540
542
  }
541
543
 
542
544
  if (this.getBounds().contains(_x, _y)) {
543
- // cannot use forEach here as cannot break out with a return
544
- for (let i = this.shapes.length, shape; i--, (shape = this.shapes[i]);) {
545
+ // cannot use forEach here as cannot break out with a return
546
+ for (let i = this.shapes.length, shape; i--, (shape = this.shapes[i]);) {
545
547
  if (shape.contains(_x, _y)) {
546
548
  return true;
547
549
  }
@@ -633,7 +635,7 @@ import Point from "../geometries/point.js";
633
635
 
634
636
  this.vel.x = (
635
637
  (nx < 0) ? nx :
636
- ( x > 0) ? x : 0
638
+ ( x > 0) ? x : 0
637
639
  );
638
640
  }
639
641
  if (this.friction.y > 0) {
@@ -643,7 +645,7 @@ import Point from "../geometries/point.js";
643
645
 
644
646
  this.vel.y = (
645
647
  (ny < 0) ? ny :
646
- ( y > 0) ? y : 0
648
+ ( y > 0) ? y : 0
647
649
  );
648
650
  }
649
651
 
@@ -5,7 +5,7 @@ import Vector2d from "./../math/vector2.js";
5
5
  * @classdesc
6
6
  * a bound object contains methods for creating and manipulating axis-aligned bounding boxes (AABB).
7
7
  */
8
- export default class Bounds {
8
+ export default class Bounds {
9
9
  /**
10
10
  * @param {Vector2d[]|Point[]} [vertices] - an array of Vector2d or Point
11
11
  */
@@ -254,17 +254,17 @@ import Vector2d from "./../math/vector2.js";
254
254
 
255
255
  /**
256
256
  * Returns true if the bounds contains the given point.
257
- * @name contains
258
- * @memberof Bounds
259
- * @method
260
- * @param {Vector2d} point
261
- * @returns {boolean} True if the bounds contain the point, otherwise false
262
- */
263
- /**
264
- * Returns true if the bounds contains the given point.
265
- * @param {number} x
266
- * @param {number} y
257
+ * @param {number|Vector2d} x - x coordinate or a vector point to check
258
+ * @param {number} [y] - y coordinate
267
259
  * @returns {boolean} True if the bounds contain the point, otherwise false
260
+ * @example
261
+ * if (bounds.contains(10, 10)) {
262
+ * // do something
263
+ * }
264
+ * // or
265
+ * if (bounds.contains(myVector2d)) {
266
+ * // do something
267
+ * }
268
268
  */
269
269
  contains() {
270
270
  let arg0 = arguments[0];
@@ -274,8 +274,8 @@ import Vector2d from "./../math/vector2.js";
274
274
  _x1 = _x2 = arg0;
275
275
  _y1 = _y2 = arguments[1];
276
276
  } else {
277
- if (arg0 instanceof Bounds) {
278
- // bounds
277
+ if (typeof arg0.max !== "undefined") {
278
+ // only bounds define min and max properties
279
279
  _x1 = arg0.min.x;
280
280
  _x2 = arg0.max.x;
281
281
  _y1 = arg0.min.y;
@@ -310,16 +310,13 @@ import Vector2d from "./../math/vector2.js";
310
310
  }
311
311
 
312
312
  /**
313
- * Translates the bounds by the given vector.
314
- * @name translate
315
- * @memberof Bounds
316
- * @method
317
- * @param {Vector2d} vector
318
- */
319
- /**
320
- * Translates the bounds by x on the x axis, and y on the y axis
321
- * @param {number} x
322
- * @param {number} y
313
+ * Translates the bounds by the given point
314
+ * @param {number|Vector2d} x - x coordinate or a vector point to translate by
315
+ * @param {number} [y]
316
+ * @example
317
+ * bounds.translate(10, 10);
318
+ * // or
319
+ * bounds.translate(myVector2d);
323
320
  */
324
321
  translate() {
325
322
  let _x, _y;
@@ -338,17 +335,14 @@ import Vector2d from "./../math/vector2.js";
338
335
  this.max.y += _y;
339
336
  }
340
337
 
341
- /**
342
- * Shifts the bounds to the given position vector.
343
- * @name shift
344
- * @memberof Bounds
345
- * @method
346
- * @param {Vector2d} position
347
- */
348
338
  /**
349
339
  * Shifts the bounds to the given x, y position.
350
- * @param {number} x
351
- * @param {number} y
340
+ * @param {number|Vector2d} x - x coordinate or a vector point to shift to
341
+ * @param {number} [y]
342
+ * @example
343
+ * bounds.shift(10, 10);
344
+ * // or
345
+ * bounds.shift(myVector2d);
352
346
  */
353
347
  shift() {
354
348
  let _x, _y;
@@ -8,7 +8,7 @@ import { game } from "../index.js";
8
8
 
9
9
  let collision = {
10
10
 
11
- /**
11
+ /**
12
12
  * The maximum number of children that a quadtree node can contain before it is split into sub-nodes.
13
13
  * @name maxChildren
14
14
  * @memberof collision
@@ -17,9 +17,9 @@ let collision = {
17
17
  * @default 8
18
18
  * @see game.world.broadphase
19
19
  */
20
- maxChildren : 8,
20
+ maxChildren : 8,
21
21
 
22
- /**
22
+ /**
23
23
  * The maximum number of levels that the quadtree will create.
24
24
  * @name maxDepth
25
25
  * @memberof collision
@@ -28,7 +28,7 @@ let collision = {
28
28
  * @default 4
29
29
  * @see game.world.broadphase
30
30
  */
31
- maxDepth : 4,
31
+ maxDepth : 4,
32
32
 
33
33
  /**
34
34
  * Enum for collision type values.
@@ -62,7 +62,7 @@ export default class Detector {
62
62
  * detect collision between two bodies.
63
63
  * @param {Body} bodyA - a reference to body A.
64
64
  * @param {Body} bodyB - a reference to body B.
65
- * @returns {Boolean} true if colliding
65
+ * @returns {boolean} true if colliding
66
66
  */
67
67
  collides(bodyA, bodyB, response = this.response) {
68
68
  // for each shape in body A
@@ -71,13 +71,13 @@ export default class Detector {
71
71
  for (let indexB = bodyB.shapes.length, shapeB; indexB--, (shapeB = bodyB.shapes[indexB]);) {
72
72
  // full SAT collision check
73
73
  if (SAT["test" + shapeA.shapeType + shapeB.shapeType].call(
74
- this,
75
- bodyA.ancestor, // a reference to the object A
76
- shapeA,
77
- bodyB.ancestor, // a reference to the object B
78
- shapeB,
79
- // clear response object before reusing
80
- response.clear()) === true
74
+ this,
75
+ bodyA.ancestor, // a reference to the object A
76
+ shapeA,
77
+ bodyB.ancestor, // a reference to the object B
78
+ shapeB,
79
+ // clear response object before reusing
80
+ response.clear()) === true
81
81
  ) {
82
82
 
83
83
  // set the shape index
@@ -190,7 +190,7 @@ export default class Detector {
190
190
  shapeA,
191
191
  objB, // a reference to the object B
192
192
  shapeB
193
- )) {
193
+ )) {
194
194
  // we touched something !
195
195
  result[collisionCounter] = objB;
196
196
  collisionCounter++;
@@ -51,7 +51,7 @@ let QT_VECTOR = new Vector2d();
51
51
  * a QuadTree implementation in JavaScript, a 2d spatial subdivision algorithm.
52
52
  * @see game.world.broadphase
53
53
  */
54
- export default class QuadTree {
54
+ export default class QuadTree {
55
55
  /**
56
56
  * @param {World} world - the physic world this QuadTree belongs to
57
57
  * @param {Bounds} bounds - bounds of the node
@@ -83,7 +83,7 @@ let QT_VECTOR = new Vector2d();
83
83
  left = this.bounds.left,
84
84
  top = this.bounds.top;
85
85
 
86
- //top right node
86
+ //top right node
87
87
  this.nodes[0] = QT_ARRAY_POP(
88
88
  this.world,
89
89
  {
@@ -279,7 +279,7 @@ let QT_VECTOR = new Vector2d();
279
279
  if (index !== -1) {
280
280
  returnObjects = returnObjects.concat(this.nodes[index].retrieve(item));
281
281
  } else {
282
- //if rect does not fit into a subnode, check it against all subnodes
282
+ //if rect does not fit into a subnode, check it against all subnodes
283
283
  for (let i = 0; i < this.nodes.length; i = i + 1) {
284
284
  returnObjects = returnObjects.concat(this.nodes[i].retrieve(item));
285
285
  }
@@ -301,7 +301,7 @@ let QT_VECTOR = new Vector2d();
301
301
  * @param {object} item - object to be removed
302
302
  * @returns {boolean} true if the item was found and removed.
303
303
  */
304
- remove(item) {
304
+ remove(item) {
305
305
  let found = false;
306
306
 
307
307
  if (typeof (item.getBounds) === "undefined") {
@@ -205,10 +205,9 @@ export function testPolygonPolygon(a, polyA, b, polyB, response) {
205
205
  // aboslute shape position
206
206
  let posA = T_VECTORS.pop().copy(a.pos).add(a.ancestor.getAbsolutePosition()).add(polyA.pos);
207
207
  let posB = T_VECTORS.pop().copy(b.pos).add(b.ancestor.getAbsolutePosition()).add(polyB.pos);
208
- let i;
209
208
 
210
209
  // If any of the edge normals of A is a separating axis, no intersection.
211
- for (i = 0; i < aLen; i++) {
210
+ for (let i = 0; i < aLen; i++) {
212
211
  if (isSeparatingAxis(posA, posB, aPoints, bPoints, aNormals[i], response)) {
213
212
  T_VECTORS.push(posA);
214
213
  T_VECTORS.push(posB);
@@ -217,7 +216,7 @@ export function testPolygonPolygon(a, polyA, b, polyB, response) {
217
216
  }
218
217
 
219
218
  // If any of the edge normals of B is a separating axis, no intersection.
220
- for (i = 0; i < bLen; i++) {
219
+ for (let i = 0; i < bLen; i++) {
221
220
  if (isSeparatingAxis(posA, posB, aPoints, bPoints, bNormals[i], response)) {
222
221
  T_VECTORS.push(posA);
223
222
  T_VECTORS.push(posB);