melonjs 14.0.2 → 14.1.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 (214) hide show
  1. package/README.md +2 -0
  2. package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +10 -0
  3. package/dist/melonjs.mjs/_virtual/arraymultimap.js +10 -0
  4. package/dist/melonjs.mjs/_virtual/earcut.js +10 -0
  5. package/dist/melonjs.mjs/_virtual/howler.js +10 -0
  6. package/dist/melonjs.mjs/_virtual/index.js +10 -0
  7. package/dist/melonjs.mjs/_virtual/index2.js +10 -0
  8. package/dist/melonjs.mjs/_virtual/multimap.js +10 -0
  9. package/dist/melonjs.mjs/_virtual/setmultimap.js +10 -0
  10. package/dist/melonjs.mjs/application/application.js +240 -0
  11. package/dist/melonjs.mjs/audio/audio.js +536 -0
  12. package/dist/melonjs.mjs/camera/camera2d.js +732 -0
  13. package/dist/melonjs.mjs/entity/entity.js +248 -0
  14. package/dist/melonjs.mjs/game.js +29 -0
  15. package/dist/melonjs.mjs/geometries/ellipse.js +275 -0
  16. package/dist/melonjs.mjs/geometries/line.js +116 -0
  17. package/dist/melonjs.mjs/geometries/path2d.js +319 -0
  18. package/dist/melonjs.mjs/geometries/point.js +89 -0
  19. package/dist/melonjs.mjs/geometries/poly.js +500 -0
  20. package/dist/melonjs.mjs/geometries/rectangle.js +375 -0
  21. package/dist/melonjs.mjs/geometries/roundrect.js +168 -0
  22. package/dist/melonjs.mjs/index.js +248 -0
  23. package/dist/melonjs.mjs/input/gamepad.js +501 -0
  24. package/dist/melonjs.mjs/input/input.js +26 -0
  25. package/dist/melonjs.mjs/input/keyboard.js +470 -0
  26. package/dist/melonjs.mjs/input/pointer.js +393 -0
  27. package/dist/melonjs.mjs/input/pointerevent.js +818 -0
  28. package/dist/melonjs.mjs/lang/deprecated.js +157 -0
  29. package/dist/melonjs.mjs/level/level.js +297 -0
  30. package/dist/melonjs.mjs/level/tiled/TMXGroup.js +141 -0
  31. package/dist/melonjs.mjs/level/tiled/TMXLayer.js +448 -0
  32. package/dist/melonjs.mjs/level/tiled/TMXObject.js +355 -0
  33. package/dist/melonjs.mjs/level/tiled/TMXTile.js +194 -0
  34. package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +639 -0
  35. package/dist/melonjs.mjs/level/tiled/TMXTileset.js +311 -0
  36. package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +83 -0
  37. package/dist/melonjs.mjs/level/tiled/TMXUtils.js +367 -0
  38. package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +506 -0
  39. package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +220 -0
  40. package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +157 -0
  41. package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +125 -0
  42. package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +109 -0
  43. package/dist/melonjs.mjs/loader/loader.js +801 -0
  44. package/dist/melonjs.mjs/loader/loadingscreen.js +120 -0
  45. package/dist/melonjs.mjs/loader/melonjs_logo.png.js +11 -0
  46. package/dist/melonjs.mjs/math/color.js +618 -0
  47. package/dist/melonjs.mjs/math/math.js +218 -0
  48. package/dist/melonjs.mjs/math/matrix2.js +503 -0
  49. package/dist/melonjs.mjs/math/matrix3.js +681 -0
  50. package/dist/melonjs.mjs/math/observable_vector2.js +471 -0
  51. package/dist/melonjs.mjs/math/observable_vector3.js +561 -0
  52. package/dist/melonjs.mjs/math/vector2.js +528 -0
  53. package/dist/melonjs.mjs/math/vector3.js +569 -0
  54. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/arraymultimap.js +73 -0
  55. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/index.js +21 -0
  56. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/multimap.js +324 -0
  57. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/setmultimap.js +69 -0
  58. package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +691 -0
  59. package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +350 -0
  60. package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +3241 -0
  61. package/dist/melonjs.mjs/particles/emitter.js +267 -0
  62. package/dist/melonjs.mjs/particles/particle.js +188 -0
  63. package/dist/melonjs.mjs/particles/settings.js +319 -0
  64. package/dist/melonjs.mjs/physics/body.js +704 -0
  65. package/dist/melonjs.mjs/physics/bounds.js +460 -0
  66. package/dist/melonjs.mjs/physics/collision.js +132 -0
  67. package/dist/melonjs.mjs/physics/detector.js +194 -0
  68. package/dist/melonjs.mjs/physics/quadtree.js +391 -0
  69. package/dist/melonjs.mjs/physics/response.js +57 -0
  70. package/dist/melonjs.mjs/physics/sat.js +483 -0
  71. package/dist/melonjs.mjs/physics/world.js +221 -0
  72. package/dist/melonjs.mjs/plugin/plugin.js +141 -0
  73. package/dist/melonjs.mjs/renderable/collectable.js +62 -0
  74. package/dist/melonjs.mjs/renderable/colorlayer.js +80 -0
  75. package/dist/melonjs.mjs/renderable/container.js +1018 -0
  76. package/dist/melonjs.mjs/renderable/dragndrop.js +224 -0
  77. package/dist/melonjs.mjs/renderable/imagelayer.js +306 -0
  78. package/dist/melonjs.mjs/renderable/light2d.js +156 -0
  79. package/dist/melonjs.mjs/renderable/nineslicesprite.js +247 -0
  80. package/dist/melonjs.mjs/renderable/renderable.js +783 -0
  81. package/dist/melonjs.mjs/renderable/sprite.js +654 -0
  82. package/dist/melonjs.mjs/renderable/trigger.js +157 -0
  83. package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +213 -0
  84. package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +226 -0
  85. package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +128 -0
  86. package/dist/melonjs.mjs/state/stage.js +237 -0
  87. package/dist/melonjs.mjs/state/state.js +596 -0
  88. package/dist/melonjs.mjs/system/device.js +909 -0
  89. package/dist/melonjs.mjs/system/dom.js +78 -0
  90. package/dist/melonjs.mjs/system/event.js +537 -0
  91. package/dist/melonjs.mjs/system/platform.js +41 -0
  92. package/dist/melonjs.mjs/system/pooling.js +209 -0
  93. package/dist/melonjs.mjs/system/save.js +157 -0
  94. package/dist/melonjs.mjs/system/timer.js +286 -0
  95. package/dist/melonjs.mjs/text/bitmaptext.js +364 -0
  96. package/dist/melonjs.mjs/text/bitmaptextdata.js +199 -0
  97. package/dist/melonjs.mjs/text/glyph.js +66 -0
  98. package/dist/melonjs.mjs/text/text.js +453 -0
  99. package/dist/melonjs.mjs/text/textmetrics.js +176 -0
  100. package/dist/melonjs.mjs/text/textstyle.js +23 -0
  101. package/dist/melonjs.mjs/tweens/easing.js +336 -0
  102. package/dist/melonjs.mjs/tweens/interpolation.js +112 -0
  103. package/dist/melonjs.mjs/tweens/tween.js +480 -0
  104. package/dist/melonjs.mjs/utils/agent.js +76 -0
  105. package/dist/melonjs.mjs/utils/array.js +63 -0
  106. package/dist/melonjs.mjs/utils/file.js +42 -0
  107. package/dist/melonjs.mjs/utils/function.js +70 -0
  108. package/dist/melonjs.mjs/utils/string.js +82 -0
  109. package/dist/melonjs.mjs/utils/utils.js +173 -0
  110. package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +807 -0
  111. package/dist/melonjs.mjs/video/renderer.js +411 -0
  112. package/dist/melonjs.mjs/video/texture/atlas.js +519 -0
  113. package/dist/melonjs.mjs/video/texture/cache.js +143 -0
  114. package/dist/melonjs.mjs/video/texture/canvas_texture.js +144 -0
  115. package/dist/melonjs.mjs/video/video.js +462 -0
  116. package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +143 -0
  117. package/dist/melonjs.mjs/video/webgl/glshader.js +168 -0
  118. package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +10 -0
  119. package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +10 -0
  120. package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +10 -0
  121. package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +10 -0
  122. package/dist/melonjs.mjs/video/webgl/utils/attributes.js +25 -0
  123. package/dist/melonjs.mjs/video/webgl/utils/precision.js +20 -0
  124. package/dist/melonjs.mjs/video/webgl/utils/program.js +67 -0
  125. package/dist/melonjs.mjs/video/webgl/utils/string.js +25 -0
  126. package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +92 -0
  127. package/dist/melonjs.mjs/video/webgl/webgl_compositor.js +495 -0
  128. package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +1036 -0
  129. package/dist/melonjs.module.d.ts +1163 -1163
  130. package/dist/melonjs.module.js +1903 -3274
  131. package/package.json +22 -17
  132. package/src/application/application.js +3 -3
  133. package/src/audio/audio.js +32 -32
  134. package/src/camera/camera2d.js +31 -31
  135. package/src/entity/entity.js +17 -17
  136. package/src/geometries/ellipse.js +16 -16
  137. package/src/geometries/line.js +5 -5
  138. package/src/geometries/path2d.js +32 -32
  139. package/src/geometries/poly.js +15 -15
  140. package/src/geometries/rectangle.js +18 -18
  141. package/src/geometries/roundrect.js +8 -8
  142. package/src/input/gamepad.js +15 -15
  143. package/src/input/keyboard.js +12 -12
  144. package/src/input/pointer.js +6 -6
  145. package/src/input/pointerevent.js +12 -12
  146. package/src/lang/deprecated.js +12 -12
  147. package/src/level/level.js +25 -25
  148. package/src/level/tiled/TMXLayer.js +22 -22
  149. package/src/level/tiled/TMXTile.js +5 -5
  150. package/src/level/tiled/TMXTileMap.js +6 -6
  151. package/src/level/tiled/TMXTileset.js +2 -2
  152. package/src/level/tiled/TMXUtils.js +5 -5
  153. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +2 -2
  154. package/src/level/tiled/renderer/TMXIsometricRenderer.js +2 -2
  155. package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -1
  156. package/src/level/tiled/renderer/TMXRenderer.js +19 -19
  157. package/src/loader/loader.js +20 -20
  158. package/src/math/color.js +20 -20
  159. package/src/math/math.js +16 -16
  160. package/src/math/matrix2.js +16 -16
  161. package/src/math/matrix3.js +25 -25
  162. package/src/math/observable_vector2.js +14 -14
  163. package/src/math/observable_vector3.js +16 -16
  164. package/src/math/vector2.js +9 -9
  165. package/src/math/vector3.js +10 -10
  166. package/src/particles/emitter.js +6 -6
  167. package/src/particles/particle.js +2 -2
  168. package/src/physics/body.js +28 -28
  169. package/src/physics/bounds.js +8 -8
  170. package/src/physics/collision.js +2 -2
  171. package/src/physics/detector.js +6 -6
  172. package/src/physics/quadtree.js +11 -11
  173. package/src/physics/sat.js +31 -31
  174. package/src/physics/world.js +5 -5
  175. package/src/plugin/plugin.js +5 -5
  176. package/src/renderable/collectable.js +3 -3
  177. package/src/renderable/colorlayer.js +5 -5
  178. package/src/renderable/container.js +21 -21
  179. package/src/renderable/dragndrop.js +14 -14
  180. package/src/renderable/imagelayer.js +13 -13
  181. package/src/renderable/light2d.js +3 -3
  182. package/src/renderable/nineslicesprite.js +16 -16
  183. package/src/renderable/renderable.js +23 -23
  184. package/src/renderable/sprite.js +28 -28
  185. package/src/renderable/trigger.js +15 -15
  186. package/src/renderable/ui/uibaseelement.js +7 -7
  187. package/src/renderable/ui/uispriteelement.js +6 -6
  188. package/src/renderable/ui/uitextbutton.js +13 -13
  189. package/src/state/stage.js +7 -7
  190. package/src/state/state.js +17 -17
  191. package/src/system/device.js +11 -11
  192. package/src/system/event.js +10 -10
  193. package/src/system/pooling.js +9 -9
  194. package/src/system/save.js +2 -2
  195. package/src/system/timer.js +10 -10
  196. package/src/text/bitmaptext.js +18 -18
  197. package/src/text/bitmaptextdata.js +2 -2
  198. package/src/text/text.js +23 -23
  199. package/src/text/textmetrics.js +8 -8
  200. package/src/tweens/tween.js +19 -19
  201. package/src/utils/agent.js +5 -5
  202. package/src/utils/array.js +4 -4
  203. package/src/utils/file.js +2 -2
  204. package/src/utils/function.js +6 -6
  205. package/src/utils/string.js +5 -5
  206. package/src/utils/utils.js +4 -4
  207. package/src/video/canvas/canvas_renderer.js +70 -70
  208. package/src/video/renderer.js +26 -26
  209. package/src/video/texture/atlas.js +22 -22
  210. package/src/video/texture/canvas_texture.js +9 -9
  211. package/src/video/video.js +17 -17
  212. package/src/video/webgl/glshader.js +10 -10
  213. package/src/video/webgl/webgl_compositor.js +41 -41
  214. package/src/video/webgl/webgl_renderer.js +75 -75
@@ -12,10 +12,10 @@ import { registerPointerEvent, releasePointerEvent} from "./../../input/input.js
12
12
  class UIBaseElement extends Container {
13
13
  /**
14
14
  *
15
- * @param {number} x The x position of the container
16
- * @param {number} y The y position of the container
17
- * @param {number} w width of the container (default: viewport width)
18
- * @param {number} h height of the container (default: viewport height)
15
+ * @param {number} x - The x position of the container
16
+ * @param {number} y - The y position of the container
17
+ * @param {number} w - width of the container (default: viewport width)
18
+ * @param {number} h - height of the container (default: viewport height)
19
19
  */
20
20
  constructor(x, y, w, h) {
21
21
  super(x, y, w, h);
@@ -83,7 +83,7 @@ class UIBaseElement extends Container {
83
83
 
84
84
  /**
85
85
  * function called when the object is pressed (to be extended)
86
- * @param {Pointer} event the event object
86
+ * @param {Pointer} event - the event object
87
87
  * @returns {boolean} return false if we need to stop propagating the event
88
88
  */
89
89
  onClick(event) { // eslint-disable-line no-unused-vars
@@ -102,7 +102,7 @@ class UIBaseElement extends Container {
102
102
 
103
103
  /**
104
104
  * function called when the pointer is over the object
105
- * @param {Pointer} event the event object
105
+ * @param {Pointer} event - the event object
106
106
  */
107
107
  onOver(event) { // eslint-disable-line no-unused-vars
108
108
  // to be extended
@@ -121,7 +121,7 @@ class UIBaseElement extends Container {
121
121
 
122
122
  /**
123
123
  * function called when the pointer is leaving the object area
124
- * @param {Pointer} event the event object
124
+ * @param {Pointer} event - the event object
125
125
  */
126
126
  onOut(event) { // eslint-disable-line no-unused-vars
127
127
  // to be extended
@@ -9,9 +9,9 @@ import { registerPointerEvent, releasePointerEvent} from "./../../input/input.js
9
9
  */
10
10
  class UISpriteElement extends Sprite {
11
11
  /**
12
- * @param {number} x the x coordinate of the GUI Object
13
- * @param {number} y the y coordinate of the GUI Object
14
- * @param {object} settings See {@link Sprite}
12
+ * @param {number} x - the x coordinate of the GUI Object
13
+ * @param {number} y - the y coordinate of the GUI Object
14
+ * @param {object} settings - See {@link Sprite}
15
15
  * @example
16
16
  * // create a basic GUI Object
17
17
  * class myButton extends UISpriteElement {
@@ -104,7 +104,7 @@ class UISpriteElement extends Sprite {
104
104
 
105
105
  /**
106
106
  * function called when the object is pressed (to be extended)
107
- * @param {Pointer} event the event object
107
+ * @param {Pointer} event - the event object
108
108
  * @returns {boolean} return false if we need to stop propagating the event
109
109
  */
110
110
  onClick(event) { // eslint-disable-line no-unused-vars
@@ -123,7 +123,7 @@ class UISpriteElement extends Sprite {
123
123
 
124
124
  /**
125
125
  * function called when the pointer is over the object
126
- * @param {Pointer} event the event object
126
+ * @param {Pointer} event - the event object
127
127
  */
128
128
  onOver(event) { // eslint-disable-line no-unused-vars
129
129
  // to be extended
@@ -142,7 +142,7 @@ class UISpriteElement extends Sprite {
142
142
 
143
143
  /**
144
144
  * function called when the pointer is leaving the object area
145
- * @param {Pointer} event the event object
145
+ * @param {Pointer} event - the event object
146
146
  */
147
147
  onOut(event) { // eslint-disable-line no-unused-vars
148
148
  // to be extended
@@ -15,19 +15,19 @@ class UITextButton extends UIBaseElement {
15
15
  * It uses a RoundRect as background and changes the background color on hovering over.
16
16
  * The background will be drawn with 0.5 opacity, so that the background of the button is
17
17
  * slightly shining through.
18
- * @param {number} x x pos of the button
19
- * @param {number} y y pos of the button
20
- * @param {string} [settings.font] The name of the BitmapText font to use
21
- * @param {number} [settings.size] The scale factor of the font (default: 1)
22
- * @param {string} [settings.text] The text to display (default: 'click me')
23
- * @param {string} [settings.bindKey] The key to bind the action to (default: none)
24
- * @param {string} [settings.backgroundColor] The css value of a background color
25
- * @param {string} [settings.hoverColor] The css value of a color to be used if the pointer hovers over the button
26
- * @param {string} [settings.borderStrokeColor] The css value of a color to be used to draw the border
27
- * @param {boolean} [settings.offScreenCanvas] Weather to use an offScreen canvas or not
28
- * @param {string} [settings.fillStyle] The css value of a tint color to be used to tint the text
29
- * @param {number} [settings.borderWidth] Width of the button
30
- * @param {number} [settings.borderHeight] Height of the button
18
+ * @param {number} x - x pos of the button
19
+ * @param {number} y - y pos of the button
20
+ * @param {string} [settings.font] - The name of the BitmapText font to use
21
+ * @param {number} [settings.size] - The scale factor of the font (default: 1)
22
+ * @param {string} [settings.text] - The text to display (default: 'click me')
23
+ * @param {string} [settings.bindKey] - The key to bind the action to (default: none)
24
+ * @param {string} [settings.backgroundColor] - The css value of a background color
25
+ * @param {string} [settings.hoverColor] - The css value of a color to be used if the pointer hovers over the button
26
+ * @param {string} [settings.borderStrokeColor] - The css value of a color to be used to draw the border
27
+ * @param {boolean} [settings.offScreenCanvas] - Weather to use an offScreen canvas or not
28
+ * @param {string} [settings.fillStyle] - The css value of a tint color to be used to tint the text
29
+ * @param {number} [settings.borderWidth] - Width of the button
30
+ * @param {number} [settings.borderHeight] - Height of the button
31
31
  * @example
32
32
  * // Create a new Button
33
33
  * class PlayButton extends BaseTextButton {
@@ -21,10 +21,10 @@ var default_settings = {
21
21
  class Stage {
22
22
 
23
23
  /**
24
- * @param {object} [settings] The stage` parameters
25
- * @param {Camera2d[]} [settings.cameras=[new me.Camera2d()]] a list of cameras (experimental)
26
- * @param {Function} [settings.onResetEvent] called by the state manager when reseting the object
27
- * @param {Function} [settings.onDestroyEvent] called by the state manager before switching to another state
24
+ * @param {object} [settings] - The stage` parameters
25
+ * @param {Camera2d[]} [settings.cameras=[new me.Camera2d()]] - a list of cameras (experimental)
26
+ * @param {Function} [settings.onResetEvent] - called by the state manager when reseting the object
27
+ * @param {Function} [settings.onDestroyEvent] - called by the state manager before switching to another state
28
28
  */
29
29
  constructor(settings) {
30
30
  /**
@@ -116,7 +116,7 @@ class Stage {
116
116
  * @name update
117
117
  * @memberof Stage
118
118
  * @ignore
119
- * @param {number} dt time since the last update in milliseconds.
119
+ * @param {number} dt - time since the last update in milliseconds.
120
120
  * @returns {boolean}
121
121
  */
122
122
  update(dt) {
@@ -146,7 +146,7 @@ class Stage {
146
146
  * @name draw
147
147
  * @memberof Stage
148
148
  * @ignore
149
- * @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
149
+ * @param {CanvasRenderer|WebGLRenderer} renderer - a renderer object
150
150
  */
151
151
  draw(renderer) {
152
152
  // iterate through all cameras
@@ -201,7 +201,7 @@ class Stage {
201
201
  * this is typically where you will load a level, add renderables, etc...
202
202
  * @name onResetEvent
203
203
  * @memberof Stage
204
- * @param {object} [...arguments] optional arguments passed when switching state
204
+ * @param {object} [...arguments] - optional arguments passed when switching state
205
205
  * @see state#change
206
206
  */
207
207
  onResetEvent() {
@@ -68,7 +68,7 @@ function _pauseRunLoop() {
68
68
 
69
69
  /**
70
70
  * this is only called when using requestAnimFrame stuff
71
- * @param {number} time current timestamp in milliseconds
71
+ * @param {number} time - current timestamp in milliseconds
72
72
  * @ignore
73
73
  */
74
74
  function _renderFrame(time) {
@@ -296,7 +296,7 @@ var state = {
296
296
  * @name stop
297
297
  * @memberof state
298
298
  * @public
299
- * @param {boolean} [pauseTrack=false] pause current track on screen stop.
299
+ * @param {boolean} [pauseTrack=false] - pause current track on screen stop.
300
300
  */
301
301
  stop(pauseTrack=false) {
302
302
  // only stop when we are not loading stuff
@@ -322,7 +322,7 @@ var state = {
322
322
  * @name pause
323
323
  * @memberof state
324
324
  * @public
325
- * @param {boolean} [music=false] pause current music track on screen pause
325
+ * @param {boolean} [music=false] - pause current music track on screen pause
326
326
  */
327
327
  pause(music=false) {
328
328
  // only pause when we are not loading stuff
@@ -347,7 +347,7 @@ var state = {
347
347
  * @name restart
348
348
  * @memberof state
349
349
  * @public
350
- * @param {boolean} [music=false] resume current music track on screen resume
350
+ * @param {boolean} [music=false] - resume current music track on screen resume
351
351
  */
352
352
  restart(music=false) {
353
353
  if (!this.isRunning()) {
@@ -374,7 +374,7 @@ var state = {
374
374
  * @name resume
375
375
  * @memberof state
376
376
  * @public
377
- * @param {boolean} [music=false] resume current music track on screen resume
377
+ * @param {boolean} [music=false] - resume current music track on screen resume
378
378
  */
379
379
  resume(music=false) {
380
380
  if (this.isPaused()) {
@@ -420,9 +420,9 @@ var state = {
420
420
  * @name set
421
421
  * @memberof state
422
422
  * @public
423
- * @param {number} state State ID (see constants)
424
- * @param {Stage} stage Instantiated Stage to associate with state ID
425
- * @param {boolean} [start = false] if true the state will be changed immediately after adding it.
423
+ * @param {number} state - State ID (see constants)
424
+ * @param {Stage} stage - Instantiated Stage to associate with state ID
425
+ * @param {boolean} [start = false] - if true the state will be changed immediately after adding it.
426
426
  * @example
427
427
  * class MenuButton extends me.GUI_Object {
428
428
  * onClick() {
@@ -479,7 +479,7 @@ var state = {
479
479
  * @name set
480
480
  * @memberof state
481
481
  * @public
482
- * @param {number} [state] State ID (see constants)
482
+ * @param {number} [state] - State ID (see constants)
483
483
  * @returns {Stage}
484
484
  */
485
485
  get(state = _state) {
@@ -508,9 +508,9 @@ var state = {
508
508
  * @name transition
509
509
  * @memberof state
510
510
  * @public
511
- * @param {string} effect (only "fade" is supported for now)
512
- * @param {Color|string} color a CSS color value
513
- * @param {number} [duration=1000] expressed in milliseconds
511
+ * @param {string} effect - (only "fade" is supported for now)
512
+ * @param {Color|string} color - a CSS color value
513
+ * @param {number} [duration=1000] - expressed in milliseconds
514
514
  */
515
515
  transition(effect, color, duration) {
516
516
  if (effect === "fade") {
@@ -524,7 +524,7 @@ var state = {
524
524
  * @name setTransition
525
525
  * @memberof state
526
526
  * @public
527
- * @param {number} state State ID (see constants)
527
+ * @param {number} state - State ID (see constants)
528
528
  * @param {boolean} enable
529
529
  */
530
530
  setTransition(state, enable) {
@@ -536,9 +536,9 @@ var state = {
536
536
  * @name change
537
537
  * @memberof state
538
538
  * @public
539
- * @param {number} state State ID (see constants)
540
- * @param {boolean} forceChange if true the state will be changed immediately
541
- * @param {object} [...arguments] extra arguments to be passed to the reset functions
539
+ * @param {number} state - State ID (see constants)
540
+ * @param {boolean} forceChange - if true the state will be changed immediately
541
+ * @param {object} [...arguments] - extra arguments to be passed to the reset functions
542
542
  * @example
543
543
  * // The onResetEvent method on the play screen will receive two args:
544
544
  * // "level_1" and the number 3
@@ -589,7 +589,7 @@ var state = {
589
589
  * @name isCurrent
590
590
  * @memberof state
591
591
  * @public
592
- * @param {number} state State ID (see constants)
592
+ * @param {number} state - State ID (see constants)
593
593
  * @returns {boolean} true if the specified state is the current one
594
594
  */
595
595
  isCurrent(state) {
@@ -389,7 +389,7 @@ export let stopOnBlur = false;
389
389
  * @function onReady
390
390
  * @memberof device
391
391
  * @public
392
- * @param {Function} fn the function to be executed
392
+ * @param {Function} fn - the function to be executed
393
393
  * @example
394
394
  * // small game skeleton
395
395
  * var game = {
@@ -438,7 +438,7 @@ export function onReady(fn) {
438
438
  * @function enableSwipe
439
439
  * @memberof device
440
440
  * @public
441
- * @param {boolean} [enable=true] enable or disable swipe.
441
+ * @param {boolean} [enable=true] - enable or disable swipe.
442
442
  */
443
443
  export function enableSwipe(enable) {
444
444
  let moveEvent = pointerEvent ? "pointermove" : (touchEvent ? "touchmove" : "mousemove");
@@ -473,7 +473,7 @@ export function isFullscreen() {
473
473
  * @function requestFullscreen
474
474
  * @memberof device
475
475
  * @public
476
- * @param {object} [element=default canvas object] the element to be set in full-screen mode.
476
+ * @param {object} [element=default canvas object] - the element to be set in full-screen mode.
477
477
  * @example
478
478
  * // add a keyboard shortcut to toggle Fullscreen mode on/off
479
479
  * me.input.bindKey(me.input.KEY.F, "toggleFullscreen");
@@ -549,7 +549,7 @@ export function getScreenOrientation() {
549
549
  * @memberof device
550
550
  * @public
551
551
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation
552
- * @param {string|string[]} orientation The orientation into which to lock the screen.
552
+ * @param {string|string[]} orientation - The orientation into which to lock the screen.
553
553
  * @returns {boolean} true if the orientation was unsuccessfully locked
554
554
  */
555
555
  export function lockOrientation(orientation) {
@@ -629,7 +629,7 @@ export function getStorage(type = "local") {
629
629
  * @function getParentElement
630
630
  * @memberof device
631
631
  * @public
632
- * @param {string|HTMLElement} element the parent element name or a HTMLElement object
632
+ * @param {string|HTMLElement} element - the parent element name or a HTMLElement object
633
633
  * @returns {HTMLElement} the parent Element
634
634
  */
635
635
  export function getParentElement(element) {
@@ -647,7 +647,7 @@ export function getParentElement(element) {
647
647
  * @function getElement
648
648
  * @memberof device
649
649
  * @public
650
- * @param {string|HTMLElement} element the parent element name or a HTMLElement object
650
+ * @param {string|HTMLElement} element - the parent element name or a HTMLElement object
651
651
  * @returns {HTMLElement} the corresponding DOM Element or null if not existing
652
652
  */
653
653
  export function getElement(element) {
@@ -677,7 +677,7 @@ export function getElement(element) {
677
677
  * @memberof device
678
678
  * @public
679
679
  * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMRect
680
- * @param {string|HTMLElement} element an HTMLElement object
680
+ * @param {string|HTMLElement} element - an HTMLElement object
681
681
  * @returns {DOMRect} the size and position of the element relatively to the viewport
682
682
  */
683
683
  export function getElementBounds(element) {
@@ -697,7 +697,7 @@ export function getElementBounds(element) {
697
697
  * @memberof device
698
698
  * @public
699
699
  * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMRect
700
- * @param {string|HTMLElement} element an HTMLElement object
700
+ * @param {string|HTMLElement} element - an HTMLElement object
701
701
  * @returns {DOMRect} the size and position of the given element parent relative to the viewport
702
702
  */
703
703
  export function getParentBounds(element) {
@@ -709,8 +709,8 @@ export function getParentBounds(element) {
709
709
  * @function isWebGLSupported
710
710
  * @memberof device
711
711
  * @public
712
- * @param {object} [options] context creation options
713
- * @param {boolean} [options.failIfMajorPerformanceCaveat=true] If true, the renderer will switch to CANVAS mode if the performances of a WebGL context would be dramatically lower than that of a native application making equivalent OpenGL calls.
712
+ * @param {object} [options] - context creation options
713
+ * @param {boolean} [options.failIfMajorPerformanceCaveat=true] - If true, the renderer will switch to CANVAS mode if the performances of a WebGL context would be dramatically lower than that of a native application making equivalent OpenGL calls.
714
714
  * @returns {boolean} true if WebGL is supported
715
715
  */
716
716
  export function isWebGLSupported(options) {
@@ -882,7 +882,7 @@ export function unwatchDeviceOrientation() {
882
882
  * @function vibrate
883
883
  * @memberof device
884
884
  * @public
885
- * @param {number|number[]} pattern pattern of vibration and pause intervals
885
+ * @param {number|number[]} pattern - pattern of vibration and pause intervals
886
886
  * @example
887
887
  * // vibrate for 1000 ms
888
888
  * me.device.vibrate(1000);
@@ -473,8 +473,8 @@ export const ONCONTEXT_RESTORED = "renderer.contextrestored";
473
473
  /**
474
474
  * calls each of the listeners registered for a given event.
475
475
  * @function event.emit
476
- * @param {string|symbol} eventName The event name.
477
- * @param {object} [...arguments] arguments to be passed to all listeners
476
+ * @param {string|symbol} eventName - The event name.
477
+ * @param {object} [...arguments] - arguments to be passed to all listeners
478
478
  * @returns {boolean} true if the event had listeners, false otherwise.
479
479
  * @example
480
480
  * me.event.emit("event-name", a, b, c);
@@ -486,9 +486,9 @@ export function emit(eventName, ...args) {
486
486
  /**
487
487
  * Add a listener for a given event.
488
488
  * @function event.on
489
- * @param {string|symbol} eventName The event name.
490
- * @param {Function} listener The listener function.
491
- * @param {*} [context=this] The context to invoke the listener with.
489
+ * @param {string|symbol} eventName - The event name.
490
+ * @param {Function} listener - The listener function.
491
+ * @param {*} [context=this] - The context to invoke the listener with.
492
492
  * @returns {EventEmitter} `this`.
493
493
  * @public
494
494
  * @example
@@ -501,9 +501,9 @@ export function on(eventName, listener, context) {
501
501
  /**
502
502
  * Add a one-time listener for a given event.
503
503
  * @function event.once
504
- * @param {string|symbol} eventName The event name.
505
- * @param {Function} listener The listener function.
506
- * @param {*} [context=this] The context to invoke the listener with.
504
+ * @param {string|symbol} eventName - The event name.
505
+ * @param {Function} listener - The listener function.
506
+ * @param {*} [context=this] - The context to invoke the listener with.
507
507
  * @returns {EventEmitter} `this`.
508
508
  * @public
509
509
  * @example
@@ -516,8 +516,8 @@ export function once(eventName, listener, context) {
516
516
  /**
517
517
  * remove the given listener for a given event.
518
518
  * @function event.off
519
- * @param {string|symbol} eventName The event name.
520
- * @param {Function} listener The listener function.
519
+ * @param {string|symbol} eventName - The event name.
520
+ * @param {Function} listener - The listener function.
521
521
  * @returns {EventEmitter} `this`.
522
522
  * @public
523
523
  * @example
@@ -23,9 +23,9 @@ class ObjectPool {
23
23
  * register an object to the pool. <br>
24
24
  * Pooling must be set to true if more than one such objects will be created. <br>
25
25
  * (Note: for an object to be poolable, it must implements a `onResetEvent` method)
26
- * @param {string} className as defined in the Name field of the Object Properties (in Tiled)
27
- * @param {object} classObj corresponding Class to be instantiated
28
- * @param {boolean} [recycling=false] enables object recycling for the specified class
26
+ * @param {string} className - as defined in the Name field of the Object Properties (in Tiled)
27
+ * @param {object} classObj - corresponding Class to be instantiated
28
+ * @param {boolean} [recycling=false] - enables object recycling for the specified class
29
29
  * @example
30
30
  * // implement CherryEntity
31
31
  * class CherryEntity extends Spritesheet {
@@ -50,8 +50,8 @@ class ObjectPool {
50
50
 
51
51
  /**
52
52
  * Pull a new instance of the requested object (if added into the object pool)
53
- * @param {string} name as used in {@link pool.register}
54
- * @param {object} [...arguments] arguments to be passed when instantiating/reinitializing the object
53
+ * @param {string} name - as used in {@link pool.register}
54
+ * @param {object} [...arguments] - arguments to be passed when instantiating/reinitializing the object
55
55
  * @returns {object} the instance of the requested object
56
56
  * @example
57
57
  * me.pool.register("bullet", BulletEntity, true);
@@ -122,8 +122,8 @@ class ObjectPool {
122
122
  * and object must have been instantiated using {@link pool#pull},
123
123
  * otherwise this function won't work
124
124
  * @throws will throw an error if the object cannot be recycled
125
- * @param {object} obj instance to be recycled
126
- * @param {boolean} [throwOnError=true] throw an exception if the object cannot be recycled
125
+ * @param {object} obj - instance to be recycled
126
+ * @param {boolean} [throwOnError=true] - throw an exception if the object cannot be recycled
127
127
  * @returns {boolean} true if the object was successfully recycled in the object pool
128
128
  */
129
129
  push(obj, throwOnError = true) {
@@ -144,7 +144,7 @@ class ObjectPool {
144
144
 
145
145
  /**
146
146
  * Check if an object with the provided name is registered
147
- * @param {string} name of the registered object class
147
+ * @param {string} name - of the registered object class
148
148
  * @returns {boolean} true if the classname is registered
149
149
  */
150
150
  exists(name) {
@@ -155,7 +155,7 @@ class ObjectPool {
155
155
  * Check if an object is poolable
156
156
  * (was properly registered with the recycling feature enable)
157
157
  * @see register
158
- * @param {object} obj object to be checked
158
+ * @param {object} obj - object to be checked
159
159
  * @returns {boolean} true if the object is poolable
160
160
  * @example
161
161
  * if (!me.pool.poolable(myCherryEntity)) {
@@ -74,7 +74,7 @@ var save = {
74
74
  * Add new keys to localStorage and set them to the given default values if they do not exist
75
75
  * @name add
76
76
  * @memberof save
77
- * @param {object} props key and corresponding values
77
+ * @param {object} props - key and corresponding values
78
78
  * @example
79
79
  * // Initialize "score" and "lives" with default values
80
80
  * me.save.add({ score : 0, lives : 3 });
@@ -127,7 +127,7 @@ var save = {
127
127
  * Remove a key from localStorage
128
128
  * @name remove
129
129
  * @memberof save
130
- * @param {string} key key to be removed
130
+ * @param {string} key - key to be removed
131
131
  * @example
132
132
  * // Remove the "score" key from localStorage
133
133
  * me.save.remove("score");
@@ -105,10 +105,10 @@ class Timer {
105
105
 
106
106
  /**
107
107
  * Calls a function once after a specified delay. See me.timer.setInterval to repeativly call a function.
108
- * @param {Function} fn the function you want to execute after delay milliseconds.
109
- * @param {number} delay the number of milliseconds (thousandths of a second) that the function call should be delayed by.
110
- * @param {boolean} [pauseable=true] respects the pause state of the engine.
111
- * @param {...*} args optional parameters which are passed through to the function specified by fn once the timer expires.
108
+ * @param {Function} fn - the function you want to execute after delay milliseconds.
109
+ * @param {number} delay - the number of milliseconds (thousandths of a second) that the function call should be delayed by.
110
+ * @param {boolean} [pauseable=true] - respects the pause state of the engine.
111
+ * @param {...*} args - optional parameters which are passed through to the function specified by fn once the timer expires.
112
112
  * @returns {number} The numerical ID of the timer, which can be used later with me.timer.clearTimeout().
113
113
  * @example
114
114
  * // set a timer to call "myFunction" after 1000ms
@@ -131,10 +131,10 @@ class Timer {
131
131
 
132
132
  /**
133
133
  * Calls a function continously at the specified interval. See setTimeout to call function a single time.
134
- * @param {Function} fn the function to execute
135
- * @param {number} delay the number of milliseconds (thousandths of a second) on how often to execute the function
136
- * @param {boolean} [pauseable=true] respects the pause state of the engine.
137
- * @param {...*} args optional parameters which are passed through to the function specified by fn once the timer expires.
134
+ * @param {Function} fn - the function to execute
135
+ * @param {number} delay - the number of milliseconds (thousandths of a second) on how often to execute the function
136
+ * @param {boolean} [pauseable=true] - respects the pause state of the engine.
137
+ * @param {...*} args - optional parameters which are passed through to the function specified by fn once the timer expires.
138
138
  * @returns {number} The numerical ID of the timer, which can be used later with me.timer.clearInterval().
139
139
  * @example
140
140
  * // set a timer to call "myFunction" every 1000ms
@@ -157,7 +157,7 @@ class Timer {
157
157
 
158
158
  /**
159
159
  * Clears the delay set by me.timer.setTimeout().
160
- * @param {number} timeoutID ID of the timeout to be cleared
160
+ * @param {number} timeoutID - ID of the timeout to be cleared
161
161
  */
162
162
  clearTimeout(timeoutID) {
163
163
  utils.function.defer(this.clearTimer.bind(this), this, timeoutID);
@@ -165,7 +165,7 @@ class Timer {
165
165
 
166
166
  /**
167
167
  * Clears the Interval set by me.timer.setInterval().
168
- * @param {number} intervalID ID of the interval to be cleared
168
+ * @param {number} intervalID - ID of the interval to be cleared
169
169
  */
170
170
  clearInterval(intervalID) {
171
171
  utils.function.defer(this.clearTimer.bind(this), this, intervalID);
@@ -11,20 +11,20 @@ import TextMetrics from "./textmetrics.js";
11
11
  */
12
12
  class BitmapText extends Renderable {
13
13
  /**
14
- * @param {number} x position of the text object
15
- * @param {number} y position of the text object
16
- * @param {object} settings the text configuration
17
- * @param {string|Image} settings.font a font name to identify the corresponing source image
18
- * @param {string} [settings.fontData=settings.font] the bitmap font data corresponding name, or the bitmap font data itself
19
- * @param {number} [settings.size] size a scaling ratio
20
- * @param {Color|string} [settings.fillStyle] a CSS color value used to tint the bitmapText (@see BitmapText.tint)
21
- * @param {number} [settings.lineWidth=1] line width, in pixels, when drawing stroke
22
- * @param {string} [settings.textAlign="left"] horizontal text alignment
23
- * @param {string} [settings.textBaseline="top"] the text baseline
24
- * @param {number} [settings.lineHeight=1.0] line spacing height
25
- * @param {Vector2d} [settings.anchorPoint={x:0.0, y:0.0}] anchor point to draw the text at
26
- * @param {number} [settings.wordWrapWidth] the maximum length in CSS pixel for a single segment of text
27
- * @param {(string|string[])} [settings.text] a string, or an array of strings
14
+ * @param {number} x - position of the text object
15
+ * @param {number} y - position of the text object
16
+ * @param {object} settings - the text configuration
17
+ * @param {string|Image} settings.font - a font name to identify the corresponing source image
18
+ * @param {string} [settings.fontData=settings.font] - the bitmap font data corresponding name, or the bitmap font data itself
19
+ * @param {number} [settings.size] - size a scaling ratio
20
+ * @param {Color|string} [settings.fillStyle] - a CSS color value used to tint the bitmapText (@see BitmapText.tint)
21
+ * @param {number} [settings.lineWidth=1] - line width, in pixels, when drawing stroke
22
+ * @param {string} [settings.textAlign="left"] - horizontal text alignment
23
+ * @param {string} [settings.textBaseline="top"] - the text baseline
24
+ * @param {number} [settings.lineHeight=1.0] - line spacing height
25
+ * @param {Vector2d} [settings.anchorPoint={x:0.0, y:0.0}] - anchor point to draw the text at
26
+ * @param {number} [settings.wordWrapWidth] - the maximum length in CSS pixel for a single segment of text
27
+ * @param {(string|string[])} [settings.text] - a string, or an array of strings
28
28
  * @example
29
29
  * // Use me.loader.preload or me.loader.load to load assets
30
30
  * me.loader.preload([
@@ -142,7 +142,7 @@ class BitmapText extends Renderable {
142
142
 
143
143
  /**
144
144
  * change the font settings
145
- * @param {string} textAlign ("left", "center", "right")
145
+ * @param {string} textAlign - ("left", "center", "right")
146
146
  * @param {number} [scale]
147
147
  * @returns {BitmapText} this object for chaining
148
148
  */
@@ -159,7 +159,7 @@ class BitmapText extends Renderable {
159
159
 
160
160
  /**
161
161
  * change the text to be displayed
162
- * @param {number|string|string[]} value a string, or an array of strings
162
+ * @param {number|string|string[]} value - a string, or an array of strings
163
163
  * @returns {BitmapText} this object for chaining
164
164
  */
165
165
  setText(value = "") {
@@ -201,7 +201,7 @@ class BitmapText extends Renderable {
201
201
 
202
202
  /**
203
203
  * change the font display size
204
- * @param {number} scale ratio
204
+ * @param {number} scale - ratio
205
205
  * @returns {BitmapText} this object for chaining
206
206
  */
207
207
  resize(scale) {
@@ -226,7 +226,7 @@ class BitmapText extends Renderable {
226
226
 
227
227
  /**
228
228
  * draw the bitmap font
229
- * @param {CanvasRenderer|WebGLRenderer} renderer Reference to the destination renderer instance
229
+ * @param {CanvasRenderer|WebGLRenderer} renderer - Reference to the destination renderer instance
230
230
  * @param {string} [text]
231
231
  * @param {number} [x]
232
232
  * @param {number} [y]
@@ -21,7 +21,7 @@ function getValueFromPair(string, pattern) {
21
21
  * @ignore
22
22
  * @name _getFirstGlyph
23
23
  * @memberof BitmapTextData
24
- * @param {object} glyphs the map of glyphs, each key is a char code
24
+ * @param {object} glyphs - the map of glyphs, each key is a char code
25
25
  * @returns {Glyph}
26
26
  */
27
27
  function getFirstGlyph(glyphs) {
@@ -39,7 +39,7 @@ function getFirstGlyph(glyphs) {
39
39
  * @ignore
40
40
  * @name createSpaceGlyph
41
41
  * @memberof BitmapTextData
42
- * @param {object} glyphs the map of glyphs, each key is a char code
42
+ * @param {object} glyphs - the map of glyphs, each key is a char code
43
43
  */
44
44
  function createSpaceGlyph(glyphs) {
45
45
  var spaceCharCode = " ".charCodeAt(0);