@vpmedia/phaser 1.95.0 → 1.97.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 (184) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/package.json +10 -10
  3. package/src/phaser/core/animation.js +61 -56
  4. package/src/phaser/core/animation_manager.js +55 -55
  5. package/src/phaser/core/cache.js +154 -154
  6. package/src/phaser/core/device.js +2 -1
  7. package/src/phaser/core/device_util.js +27 -27
  8. package/src/phaser/core/dom.js +43 -43
  9. package/src/phaser/core/event_manager.js +63 -63
  10. package/src/phaser/core/factory.js +47 -47
  11. package/src/phaser/core/frame.js +30 -30
  12. package/src/phaser/core/frame_data.js +30 -28
  13. package/src/phaser/core/frame_util.js +8 -8
  14. package/src/phaser/core/game.js +34 -18
  15. package/src/phaser/core/loader.js +170 -170
  16. package/src/phaser/core/loader_parser.js +22 -22
  17. package/src/phaser/core/raf.js +1 -1
  18. package/src/phaser/core/scene.js +16 -10
  19. package/src/phaser/core/scene_manager.js +51 -43
  20. package/src/phaser/core/signal.js +68 -52
  21. package/src/phaser/core/signal.test.js +37 -0
  22. package/src/phaser/core/sound.js +54 -54
  23. package/src/phaser/core/sound_manager.js +49 -49
  24. package/src/phaser/core/stage.js +16 -16
  25. package/src/phaser/core/time.js +30 -30
  26. package/src/phaser/core/timer.js +79 -64
  27. package/src/phaser/core/timer_event.js +9 -9
  28. package/src/phaser/core/tween.js +90 -90
  29. package/src/phaser/core/tween_data.js +30 -30
  30. package/src/phaser/core/tween_manager.js +29 -24
  31. package/src/phaser/core/world.js +4 -3
  32. package/src/phaser/display/bitmap_text.js +61 -54
  33. package/src/phaser/display/button.js +48 -47
  34. package/src/phaser/display/canvas/buffer.js +8 -8
  35. package/src/phaser/display/canvas/graphics.js +8 -8
  36. package/src/phaser/display/canvas/masker.js +5 -5
  37. package/src/phaser/display/canvas/pool.js +18 -18
  38. package/src/phaser/display/canvas/renderer.js +16 -16
  39. package/src/phaser/display/canvas/tinter.js +22 -22
  40. package/src/phaser/display/canvas/util.js +42 -42
  41. package/src/phaser/display/display_object.js +119 -108
  42. package/src/phaser/display/graphics.js +112 -112
  43. package/src/phaser/display/graphics_data.js +10 -10
  44. package/src/phaser/display/graphics_data_util.js +3 -3
  45. package/src/phaser/display/group.js +50 -50
  46. package/src/phaser/display/image.js +54 -50
  47. package/src/phaser/display/sprite_batch.js +2 -2
  48. package/src/phaser/display/sprite_util.js +19 -19
  49. package/src/phaser/display/text.js +212 -187
  50. package/src/phaser/display/webgl/abstract_filter.js +4 -4
  51. package/src/phaser/display/webgl/base_texture.js +9 -9
  52. package/src/phaser/display/webgl/blend_manager.js +7 -7
  53. package/src/phaser/display/webgl/earcut.js +95 -95
  54. package/src/phaser/display/webgl/earcut_node.js +4 -4
  55. package/src/phaser/display/webgl/fast_sprite_batch.js +15 -15
  56. package/src/phaser/display/webgl/filter_manager.js +9 -9
  57. package/src/phaser/display/webgl/filter_texture.js +10 -10
  58. package/src/phaser/display/webgl/graphics.js +37 -37
  59. package/src/phaser/display/webgl/graphics_data.js +4 -4
  60. package/src/phaser/display/webgl/mask_manager.js +6 -6
  61. package/src/phaser/display/webgl/render_texture.js +16 -16
  62. package/src/phaser/display/webgl/renderer.js +20 -20
  63. package/src/phaser/display/webgl/shader/complex.js +4 -4
  64. package/src/phaser/display/webgl/shader/fast.js +4 -4
  65. package/src/phaser/display/webgl/shader/normal.js +8 -8
  66. package/src/phaser/display/webgl/shader/primitive.js +4 -4
  67. package/src/phaser/display/webgl/shader/strip.js +4 -4
  68. package/src/phaser/display/webgl/shader_manager.js +9 -9
  69. package/src/phaser/display/webgl/sprite_batch.js +18 -18
  70. package/src/phaser/display/webgl/stencil_manager.js +16 -16
  71. package/src/phaser/display/webgl/texture.js +13 -13
  72. package/src/phaser/display/webgl/texture_util.js +8 -8
  73. package/src/phaser/display/webgl/util.js +25 -25
  74. package/src/phaser/geom/circle.js +69 -69
  75. package/src/phaser/geom/circle.test.js +1 -0
  76. package/src/phaser/geom/ellipse.js +28 -28
  77. package/src/phaser/geom/ellipse.test.js +1 -0
  78. package/src/phaser/geom/line.js +93 -93
  79. package/src/phaser/geom/line.test.js +1 -0
  80. package/src/phaser/geom/matrix.js +54 -54
  81. package/src/phaser/geom/matrix.test.js +1 -0
  82. package/src/phaser/geom/point.js +96 -96
  83. package/src/phaser/geom/point.test.js +1 -0
  84. package/src/phaser/geom/polygon.js +22 -22
  85. package/src/phaser/geom/rectangle.js +132 -132
  86. package/src/phaser/geom/rectangle.test.js +1 -0
  87. package/src/phaser/geom/rounded_rectangle.js +12 -12
  88. package/src/phaser/geom/rounded_rectangle.test.js +1 -0
  89. package/src/phaser/geom/util/circle.js +33 -33
  90. package/src/phaser/geom/util/circle.test.js +1 -0
  91. package/src/phaser/geom/util/ellipse.js +5 -5
  92. package/src/phaser/geom/util/ellipse.test.js +1 -0
  93. package/src/phaser/geom/util/line.js +26 -26
  94. package/src/phaser/geom/util/line.test.js +1 -0
  95. package/src/phaser/geom/util/matrix.js +8 -8
  96. package/src/phaser/geom/util/matrix.test.js +1 -0
  97. package/src/phaser/geom/util/point.js +97 -97
  98. package/src/phaser/geom/util/point.test.js +1 -0
  99. package/src/phaser/geom/util/polygon.js +4 -4
  100. package/src/phaser/geom/util/polygon.test.js +1 -0
  101. package/src/phaser/geom/util/rectangle.js +74 -74
  102. package/src/phaser/geom/util/rectangle.test.js +1 -0
  103. package/src/phaser/geom/util/rounded_rectangle.js +4 -4
  104. package/src/phaser/geom/util/rounded_rectangle.test.js +1 -0
  105. package/src/phaser/util/math.js +81 -81
  106. package/src/phaser/util/math.test.js +1 -0
  107. package/types/phaser/core/animation.d.ts +61 -56
  108. package/types/phaser/core/animation.d.ts.map +1 -1
  109. package/types/phaser/core/animation_manager.d.ts +55 -55
  110. package/types/phaser/core/cache.d.ts +154 -154
  111. package/types/phaser/core/device.d.ts.map +1 -1
  112. package/types/phaser/core/dom.d.ts +43 -43
  113. package/types/phaser/core/event_manager.d.ts +63 -63
  114. package/types/phaser/core/factory.d.ts +47 -47
  115. package/types/phaser/core/frame.d.ts +30 -30
  116. package/types/phaser/core/frame_data.d.ts +28 -27
  117. package/types/phaser/core/frame_data.d.ts.map +1 -1
  118. package/types/phaser/core/game.d.ts +52 -19
  119. package/types/phaser/core/game.d.ts.map +1 -1
  120. package/types/phaser/core/loader.d.ts +170 -170
  121. package/types/phaser/core/loader_parser.d.ts.map +1 -1
  122. package/types/phaser/core/raf.d.ts +1 -1
  123. package/types/phaser/core/scene.d.ts +15 -9
  124. package/types/phaser/core/scene.d.ts.map +1 -1
  125. package/types/phaser/core/scene_manager.d.ts +51 -43
  126. package/types/phaser/core/scene_manager.d.ts.map +1 -1
  127. package/types/phaser/core/signal.d.ts +54 -51
  128. package/types/phaser/core/signal.d.ts.map +1 -1
  129. package/types/phaser/core/sound.d.ts +54 -54
  130. package/types/phaser/core/sound_manager.d.ts +49 -49
  131. package/types/phaser/core/stage.d.ts +10 -10
  132. package/types/phaser/core/time.d.ts +30 -30
  133. package/types/phaser/core/timer.d.ts +64 -64
  134. package/types/phaser/core/timer_event.d.ts +9 -9
  135. package/types/phaser/core/tween.d.ts +90 -90
  136. package/types/phaser/core/tween_data.d.ts +30 -30
  137. package/types/phaser/core/tween_manager.d.ts +29 -24
  138. package/types/phaser/core/tween_manager.d.ts.map +1 -1
  139. package/types/phaser/core/world.d.ts +4 -3
  140. package/types/phaser/core/world.d.ts.map +1 -1
  141. package/types/phaser/display/bitmap_text.d.ts +59 -52
  142. package/types/phaser/display/bitmap_text.d.ts.map +1 -1
  143. package/types/phaser/display/button.d.ts +47 -46
  144. package/types/phaser/display/button.d.ts.map +1 -1
  145. package/types/phaser/display/canvas/buffer.d.ts +8 -8
  146. package/types/phaser/display/canvas/renderer.d.ts +16 -16
  147. package/types/phaser/display/display_object.d.ts +119 -108
  148. package/types/phaser/display/display_object.d.ts.map +1 -1
  149. package/types/phaser/display/graphics.d.ts +101 -101
  150. package/types/phaser/display/graphics_data.d.ts +10 -10
  151. package/types/phaser/display/group.d.ts +47 -47
  152. package/types/phaser/display/image.d.ts +42 -40
  153. package/types/phaser/display/image.d.ts.map +1 -1
  154. package/types/phaser/display/text.d.ts +207 -184
  155. package/types/phaser/display/text.d.ts.map +1 -1
  156. package/types/phaser/display/webgl/abstract_filter.d.ts +4 -4
  157. package/types/phaser/display/webgl/base_texture.d.ts +9 -9
  158. package/types/phaser/display/webgl/blend_manager.d.ts +6 -6
  159. package/types/phaser/display/webgl/earcut.d.ts +95 -95
  160. package/types/phaser/display/webgl/earcut_node.d.ts +4 -4
  161. package/types/phaser/display/webgl/fast_sprite_batch.d.ts +15 -15
  162. package/types/phaser/display/webgl/filter_manager.d.ts +8 -8
  163. package/types/phaser/display/webgl/filter_texture.d.ts +10 -10
  164. package/types/phaser/display/webgl/graphics_data.d.ts +4 -4
  165. package/types/phaser/display/webgl/render_texture.d.ts +16 -16
  166. package/types/phaser/display/webgl/renderer.d.ts +20 -20
  167. package/types/phaser/display/webgl/shader/complex.d.ts +4 -4
  168. package/types/phaser/display/webgl/shader/fast.d.ts +4 -4
  169. package/types/phaser/display/webgl/shader/normal.d.ts +8 -8
  170. package/types/phaser/display/webgl/shader/primitive.d.ts +4 -4
  171. package/types/phaser/display/webgl/shader/strip.d.ts +4 -4
  172. package/types/phaser/display/webgl/shader_manager.d.ts +8 -8
  173. package/types/phaser/display/webgl/sprite_batch.d.ts +17 -17
  174. package/types/phaser/display/webgl/stencil_manager.d.ts +15 -15
  175. package/types/phaser/display/webgl/texture.d.ts +12 -12
  176. package/types/phaser/geom/circle.d.ts +69 -69
  177. package/types/phaser/geom/ellipse.d.ts +28 -28
  178. package/types/phaser/geom/line.d.ts +93 -93
  179. package/types/phaser/geom/matrix.d.ts +54 -54
  180. package/types/phaser/geom/point.d.ts +96 -96
  181. package/types/phaser/geom/polygon.d.ts +22 -22
  182. package/types/phaser/geom/rectangle.d.ts +132 -132
  183. package/types/phaser/geom/rounded_rectangle.d.ts +12 -12
  184. package/pnpm-workspace.yaml +0 -4
@@ -7,21 +7,21 @@ import { Text } from '../display/text.js';
7
7
 
8
8
  export class GameObjectFactory {
9
9
  /**
10
- * TBD.
11
- * @param {import('./game.js').Game} game - TBD.
10
+ * Creates a new GameObjectFactory instance.
11
+ * @param {import('./game.js').Game} game - The game instance this factory belongs to.
12
12
  */
13
13
  constructor(game) {
14
14
  this.game = game;
15
15
  }
16
16
 
17
17
  /**
18
- * TBD.
19
- * @param {number} x - TBD.
20
- * @param {number} y - TBD.
21
- * @param {string} key - TBD.
22
- * @param {string|number} frame - TBD.
23
- * @param {Group} group - TBD.
24
- * @returns {Image} TBD.
18
+ * Creates a new Image object.
19
+ * @param {number} x - The x coordinate of the image.
20
+ * @param {number} y - The y coordinate of the image.
21
+ * @param {string} key - The texture key for the image.
22
+ * @param {string|number} frame - The frame to display.
23
+ * @param {Group} group - The parent group for the image.
24
+ * @returns {Image} The created Image object.
25
25
  */
26
26
  image(x, y, key, frame, group = null) {
27
27
  if (!group) {
@@ -31,24 +31,24 @@ export class GameObjectFactory {
31
31
  }
32
32
 
33
33
  /**
34
- * TBD.
35
- * @param {Group | null} parent - TBD.
36
- * @param {string | null} name - TBD.
37
- * @param {boolean} addToStage - TBD.
38
- * @returns {Group} TBD.
34
+ * Creates a new Group object.
35
+ * @param {Group | null} parent - The parent group for the new group.
36
+ * @param {string | null} name - The name of the group.
37
+ * @param {boolean} addToStage - Whether to add the group to the stage.
38
+ * @returns {Group} The created Group object.
39
39
  */
40
40
  group(parent = null, name = null, addToStage = false) {
41
41
  return new Group(this.game, parent, name, addToStage);
42
42
  }
43
43
 
44
44
  /**
45
- * TBD.
46
- * @param {number} x - TBD.
47
- * @param {number} y - TBD.
48
- * @param {string} text - TBD.
49
- * @param {object} style - TBD.
50
- * @param {Group | null} group - TBD.
51
- * @returns {Text} TBD.
45
+ * Creates a new Text object.
46
+ * @param {number} x - The x coordinate of the text.
47
+ * @param {number} y - The y coordinate of the text.
48
+ * @param {string} text - The text content to display.
49
+ * @param {object} style - The style configuration for the text.
50
+ * @param {Group | null} group - The parent group for the text.
51
+ * @returns {Text} The created Text object.
52
52
  */
53
53
  text(x, y, text, style, group = null) {
54
54
  const parent = group || this.game.world;
@@ -56,18 +56,18 @@ export class GameObjectFactory {
56
56
  }
57
57
 
58
58
  /**
59
- * TBD.
60
- * @param {number} x - TBD.
61
- * @param {number} y - TBD.
62
- * @param {string} key - TBD.
63
- * @param {Function | null} callback - TBD.
64
- * @param {object | null} callbackContext - TBD.
65
- * @param {string | null} overFrame - TBD.
66
- * @param {string | null} outFrame - TBD.
67
- * @param {string | null} downFrame - TBD.
68
- * @param {string | null} upFrame - TBD.
69
- * @param {Group | null} group - TBD.
70
- * @returns {Button} TBD.
59
+ * Creates a new Button object.
60
+ * @param {number} x - The x coordinate of the button.
61
+ * @param {number} y - The y coordinate of the button.
62
+ * @param {string} key - The texture key for the button.
63
+ * @param {Function | null} callback - The function to call when the button is clicked.
64
+ * @param {object | null} callbackContext - The context to apply when calling the callback.
65
+ * @param {string | null} overFrame - The frame to display when the mouse is over the button.
66
+ * @param {string | null} outFrame - The frame to display when the mouse is not over the button.
67
+ * @param {string | null} downFrame - The frame to display when the button is pressed.
68
+ * @param {string | null} upFrame - The frame to display when the button is released.
69
+ * @param {Group | null} group - The parent group for the button.
70
+ * @returns {Button} The created Button object.
71
71
  */
72
72
  button(
73
73
  x,
@@ -88,11 +88,11 @@ export class GameObjectFactory {
88
88
  }
89
89
 
90
90
  /**
91
- * TBD.
92
- * @param {number} x - TBD.
93
- * @param {number} y - TBD.
94
- * @param {Group | null} group - TBD.
95
- * @returns {Graphics} TBD.
91
+ * Creates a new Graphics object.
92
+ * @param {number} x - The x coordinate of the graphics object.
93
+ * @param {number} y - The y coordinate of the graphics object.
94
+ * @param {Group | null} group - The parent group for the graphics object.
95
+ * @returns {Graphics} The created Graphics object.
96
96
  */
97
97
  graphics(x = 0, y = 0, group = null) {
98
98
  const parent = group || this.game.world;
@@ -100,15 +100,15 @@ export class GameObjectFactory {
100
100
  }
101
101
 
102
102
  /**
103
- * TBD.
104
- * @param {number} x - TBD.
105
- * @param {number} y - TBD.
106
- * @param {string} font - TBD.
107
- * @param {string} text - TBD.
108
- * @param {number} size - TBD.
109
- * @param {Group | null} group - TBD.
110
- * @param {string} align - TBD.
111
- * @returns {BitmapText} TBD.
103
+ * Creates a new BitmapText object.
104
+ * @param {number} x - The x coordinate of the bitmap text.
105
+ * @param {number} y - The y coordinate of the bitmap text.
106
+ * @param {string} font - The font key for the bitmap text.
107
+ * @param {string} text - The text content to display.
108
+ * @param {number} size - The font size.
109
+ * @param {Group | null} group - The parent group for the bitmap text.
110
+ * @param {string} align - The alignment of the text.
111
+ * @returns {BitmapText} The created BitmapText object.
112
112
  */
113
113
  bitmapText(x, y, font, text, size, group = null, align = 'left') {
114
114
  const parent = group || this.game.world;
@@ -4,26 +4,26 @@ import { cloneFrame } from './frame_util.js';
4
4
 
5
5
  export class Frame {
6
6
  /**
7
- * TBD.
8
- * @param {number} index - TBD.
9
- * @param {number} x - TBD.
10
- * @param {number} y - TBD.
11
- * @param {number} width - TBD.
12
- * @param {number} height - TBD.
13
- * @param {string} name - TBD.
7
+ * Creates a new Frame instance.
8
+ * @param {number} index - The index of this frame in the animation.
9
+ * @param {number} x - The x coordinate of this frame's position in the texture.
10
+ * @param {number} y - The y coordinate of this frame's position in the texture.
11
+ * @param {number} width - The width of this frame in pixels.
12
+ * @param {number} height - The height of this frame in pixels.
13
+ * @param {string} name - The name of this frame.
14
14
  */
15
15
  constructor(index, x, y, width, height, name) {
16
16
  this.initialize(index, x, y, width, height, name);
17
17
  }
18
18
 
19
19
  /**
20
- * TBD.
21
- * @param {number} index - TBD.
22
- * @param {number} x - TBD.
23
- * @param {number} y - TBD.
24
- * @param {number} width - TBD.
25
- * @param {number} height - TBD.
26
- * @param {string} name - TBD.
20
+ * Initializes this frame with the specified properties.
21
+ * @param {number} index - The index of this frame in the animation.
22
+ * @param {number} x - The x coordinate of this frame's position in the texture.
23
+ * @param {number} y - The y coordinate of this frame's position in the texture.
24
+ * @param {number} width - The width of this frame in pixels.
25
+ * @param {number} height - The height of this frame in pixels.
26
+ * @param {string} name - The name of this frame.
27
27
  */
28
28
  initialize(index, x, y, width, height, name) {
29
29
  this.index = index;
@@ -49,9 +49,9 @@ export class Frame {
49
49
  }
50
50
 
51
51
  /**
52
- * TBD.
53
- * @param {number} width - TBD.
54
- * @param {number} height - TBD.
52
+ * Resizes this frame to the specified dimensions.
53
+ * @param {number} width - The new width of this frame in pixels.
54
+ * @param {number} height - The new height of this frame in pixels.
55
55
  */
56
56
  resize(width, height) {
57
57
  this.width = width;
@@ -66,14 +66,14 @@ export class Frame {
66
66
  }
67
67
 
68
68
  /**
69
- * TBD.
70
- * @param {boolean} trimmed - TBD.
71
- * @param {number} actualWidth - TBD.
72
- * @param {number} actualHeight - TBD.
73
- * @param {number} destX - TBD.
74
- * @param {number} destY - TBD.
75
- * @param {number} destWidth - TBD.
76
- * @param {number} destHeight - TBD.
69
+ * Sets the trim properties for this frame.
70
+ * @param {boolean} trimmed - Whether this frame is trimmed.
71
+ * @param {number} actualWidth - The actual width of the trimmed frame.
72
+ * @param {number} actualHeight - The actual height of the trimmed frame.
73
+ * @param {number} destX - The destination x coordinate for the trimmed frame.
74
+ * @param {number} destY - The destination y coordinate for the trimmed frame.
75
+ * @param {number} destWidth - The destination width of the trimmed frame.
76
+ * @param {number} destHeight - The destination height of the trimmed frame.
77
77
  */
78
78
  setTrim(trimmed, actualWidth, actualHeight, destX, destY, destWidth, destHeight) {
79
79
  this.trimmed = trimmed;
@@ -90,17 +90,17 @@ export class Frame {
90
90
  }
91
91
 
92
92
  /**
93
- * TBD.
94
- * @returns {Frame} TBD.
93
+ * Creates a clone of this frame.
94
+ * @returns {Frame} A new Frame instance with the same properties.
95
95
  */
96
96
  clone() {
97
97
  return cloneFrame(this);
98
98
  }
99
99
 
100
100
  /**
101
- * TBD.
102
- * @param {Rectangle} output - TBD.
103
- * @returns {Rectangle} TBD.
101
+ * Gets the rectangle bounds of this frame.
102
+ * @param {Rectangle} output - The rectangle to use for the result (optional).
103
+ * @returns {Rectangle} A Rectangle object representing this frame's bounds.
104
104
  */
105
105
  getRect(output = null) {
106
106
  const result = output || new Rectangle();
@@ -2,7 +2,8 @@ import { cloneFrameData } from './frame_util.js';
2
2
 
3
3
  export class FrameData {
4
4
  /**
5
- * TBD.
5
+ * Creates a new FrameData instance.
6
+ * This class holds data about frames in a texture atlas or sprite sheet.
6
7
  */
7
8
  constructor() {
8
9
  /**
@@ -16,9 +17,9 @@ export class FrameData {
16
17
  }
17
18
 
18
19
  /**
19
- * TBD.
20
- * @param {import('./frame.js').Frame} frame - TBD.
21
- * @returns {import('./frame.js').Frame} TBD.
20
+ * Add a frame to the frame data collection.
21
+ * @param {import('./frame.js').Frame} frame - The frame to add.
22
+ * @returns {import('./frame.js').Frame} The added frame.
22
23
  */
23
24
  addFrame(frame) {
24
25
  frame.index = this._frames.length;
@@ -30,9 +31,9 @@ export class FrameData {
30
31
  }
31
32
 
32
33
  /**
33
- * TBD.
34
- * @param {number} index - TBD.
35
- * @returns {import('./frame.js').Frame} TBD.
34
+ * Get a frame by its index.
35
+ * @param {number} index - The index of the frame to get.
36
+ * @returns {import('./frame.js').Frame} The frame at the specified index, or the first frame if index is out of bounds.
36
37
  */
37
38
  getFrame(index = 0) {
38
39
  if (index >= this._frames.length) {
@@ -42,9 +43,9 @@ export class FrameData {
42
43
  }
43
44
 
44
45
  /**
45
- * TBD.
46
- * @param {string} name - TBD.
47
- * @returns {import('./frame.js').Frame} TBD.
46
+ * Get a frame by its name.
47
+ * @param {string} name - The name of the frame to get.
48
+ * @returns {import('./frame.js').Frame} The frame with the specified name, or null if not found.
48
49
  */
49
50
  getFrameByName(name) {
50
51
  if (typeof this._frameNames[name] === 'number') {
@@ -54,9 +55,9 @@ export class FrameData {
54
55
  }
55
56
 
56
57
  /**
57
- * TBD.
58
- * @param {string} name - TBD.
59
- * @returns {boolean} TBD.
58
+ * Check if a frame with the given name exists.
59
+ * @param {string} name - The name of the frame to check.
60
+ * @returns {boolean} True if a frame with this name exists, false otherwise.
60
61
  */
61
62
  checkFrameName(name) {
62
63
  if (this._frameNames[name] == null) {
@@ -66,19 +67,19 @@ export class FrameData {
66
67
  }
67
68
 
68
69
  /**
69
- * TBD.
70
- * @returns {FrameData} TBD.
70
+ * Create a clone of this FrameData instance.
71
+ * @returns {FrameData} A new FrameData instance with cloned frames.
71
72
  */
72
73
  clone() {
73
74
  return cloneFrameData(this);
74
75
  }
75
76
 
76
77
  /**
77
- * TBD.
78
- * @param {number} start - TBD.
79
- * @param {number} end - TBD.
80
- * @param {import('./frame.js').Frame[]} output - TBD.
81
- * @returns {import('./frame.js').Frame[]} TBD.
78
+ * Get a range of frames by index.
79
+ * @param {number} start - The starting index of the frame range.
80
+ * @param {number} end - The ending index of the frame range.
81
+ * @param {import('./frame.js').Frame[]} output - Optional array to populate with frames.
82
+ * @returns {import('./frame.js').Frame[]} An array of frames in the specified range.
82
83
  */
83
84
  getFrameRange(start, end, output = null) {
84
85
  const result = output || [];
@@ -89,11 +90,11 @@ export class FrameData {
89
90
  }
90
91
 
91
92
  /**
92
- * TBD.
93
- * @param {number[]|string[]} frames - TBD.
94
- * @param {boolean} useNumericIndex - TBD.
95
- * @param {number[]} output - TBD.
96
- * @returns {number[]} TBD.
93
+ * Get frame indexes from an array of frame names or indices.
94
+ * @param {number[]|string[]} frames - An array of frame names or indices.
95
+ * @param {boolean} useNumericIndex - Whether to treat numeric values as frame indices.
96
+ * @param {number[]} output - Optional array to populate with frame indexes.
97
+ * @returns {number[]} An array of frame indexes.
97
98
  */
98
99
  getFrameIndexes(frames, useNumericIndex = true, output = null) {
99
100
  const result = output || [];
@@ -114,7 +115,8 @@ export class FrameData {
114
115
  }
115
116
 
116
117
  /**
117
- * TBD.
118
+ * Destroy this FrameData instance and clean up resources.
119
+ * This method clears internal arrays and releases references to frames.
118
120
  */
119
121
  destroy() {
120
122
  this._frames = null;
@@ -122,8 +124,8 @@ export class FrameData {
122
124
  }
123
125
 
124
126
  /**
125
- * TBD.
126
- * @returns {number} TBD.
127
+ * Get the total number of frames in this FrameData instance.
128
+ * @returns {number} The total number of frames.
127
129
  */
128
130
  get total() {
129
131
  return this._frames.length;
@@ -2,10 +2,10 @@ import { Frame } from './frame.js';
2
2
  import { FrameData } from './frame_data.js';
3
3
 
4
4
  /**
5
- * TBD.
6
- * @param {Frame} frame - TBD.
7
- * @param {Frame} output - TBD.
8
- * @returns {Frame} TBD.
5
+ * Clone a Frame object.
6
+ * @param {Frame} frame - The frame to clone.
7
+ * @param {Frame} output - Optional output frame to populate.
8
+ * @returns {Frame} The cloned frame or the provided output frame.
9
9
  */
10
10
  export const cloneFrame = (frame, output = null) => {
11
11
  const result = output || new Frame(frame.index, frame.x, frame.y, frame.width, frame.height);
@@ -14,10 +14,10 @@ export const cloneFrame = (frame, output = null) => {
14
14
  };
15
15
 
16
16
  /**
17
- * TBD.
18
- * @param {FrameData} frameData - TBD.
19
- * @param {FrameData} output - TBD.
20
- * @returns {FrameData} TBD.
17
+ * Clone a FrameData object.
18
+ * @param {FrameData} frameData - The frame data to clone.
19
+ * @param {FrameData} output - Optional output frame data to populate.
20
+ * @returns {FrameData} The cloned frame data or the provided output frame data.
21
21
  */
22
22
  export const cloneFrameData = (frameData, output = null) => {
23
23
  const result = output || new FrameData();
@@ -21,8 +21,24 @@ import { World } from './world.js';
21
21
 
22
22
  export class Game {
23
23
  /**
24
- * TBD.
25
- * @param {object} gameConfig - TBD.
24
+ * Creates a new Game instance.
25
+ * @param {object} gameConfig - The configuration object for the game.
26
+ * @param {number} gameConfig.width - The width of the game canvas (default: 800).
27
+ * @param {number} gameConfig.height - The height of the game canvas (default: 600).
28
+ * @param {string} gameConfig.backgroundColor - The background color of the canvas (default: 0x000000).
29
+ * @param {string} gameConfig.canvasID - The ID of the canvas element (default: '').
30
+ * @param {object} gameConfig.canvasStyle - CSS styles to apply to the canvas.
31
+ * @param {number} gameConfig.resolution - The resolution scale factor (default: 1).
32
+ * @param {boolean} gameConfig.transparent - Whether the canvas should be transparent (default: false).
33
+ * @param {boolean} gameConfig.antialias - Whether to enable antialiasing (default: false).
34
+ * @param {boolean} gameConfig.preserveDrawingBuffer - Whether to preserve the drawing buffer (default: false).
35
+ * @param {boolean} gameConfig.clearBeforeRender - Whether to clear the canvas before rendering (default: true).
36
+ * @param {boolean} gameConfig.roundPixels - Whether to round pixel values (default: true).
37
+ * @param {number} gameConfig.renderType - The rendering type to use (default: RENDER_AUTO).
38
+ * @param {boolean} gameConfig.isForceDisabledAudio - Whether to force disable audio (default: false).
39
+ * @param {number} gameConfig.maxParallelDownloads - Maximum parallel downloads (default: 16).
40
+ * @param {string|HTMLElement} gameConfig.parent - The parent element to append the canvas to.
41
+ * @param {object} gameConfig.state - The initial state object or class.
26
42
  */
27
43
  constructor(gameConfig = {}) {
28
44
  if (!window.PhaserRegistry) {
@@ -77,7 +93,7 @@ export class Game {
77
93
  }
78
94
 
79
95
  /**
80
- * TBD.
96
+ * Boots the game and initializes all systems.
81
97
  */
82
98
  boot() {
83
99
  if (this.isBooted) {
@@ -113,7 +129,7 @@ export class Game {
113
129
  }
114
130
 
115
131
  /**
116
- * TBD.
132
+ * Creates the renderer canvas element.
117
133
  */
118
134
  createRendererCanvas() {
119
135
  this.logger.info('createRendererCanvas');
@@ -136,7 +152,7 @@ export class Game {
136
152
  }
137
153
 
138
154
  /**
139
- * TBD.
155
+ * Initializes the renderer and sets up the rendering context.
140
156
  */
141
157
  initRenderer() {
142
158
  let isWebGlReady = false;
@@ -184,10 +200,10 @@ export class Game {
184
200
  }
185
201
 
186
202
  /**
187
- * TBD.
188
- * @param {object} config - TBD.
189
- * @param {string} key - TBD.
190
- * @param {*} defaultValue - TBD.
203
+ * Parses a configuration element and sets it on the game config.
204
+ * @param {object} config - The configuration object to parse from.
205
+ * @param {string} key - The configuration key to parse.
206
+ * @param {*} defaultValue - The default value if the key is not found in config.
191
207
  */
192
208
  parseConfigElement(config, key, defaultValue) {
193
209
  if (config[key] !== undefined) {
@@ -198,8 +214,8 @@ export class Game {
198
214
  }
199
215
 
200
216
  /**
201
- * TBD.
202
- * @param {object} config - TBD.
217
+ * Parses the configuration object and sets up game properties.
218
+ * @param {object} config - The configuration object to parse.
203
219
  */
204
220
  parseConfig(config) {
205
221
  this.logger = config.logger ?? new Logger('phaser');
@@ -229,8 +245,8 @@ export class Game {
229
245
  }
230
246
 
231
247
  /**
232
- * TBD.
233
- * @param {WebGLContextEvent | Event} event - TBD.
248
+ * Called when the WebGL context is lost.
249
+ * @param {WebGLContextEvent | Event} event - The WebGL context loss event.
234
250
  */
235
251
  contextLost(event) {
236
252
  this.logger.info('contextLost', event);
@@ -241,8 +257,8 @@ export class Game {
241
257
  }
242
258
 
243
259
  /**
244
- * TBD.
245
- * @param {WebGLContextEvent | Event} event - TBD.
260
+ * Called when the WebGL context is restored.
261
+ * @param {WebGLContextEvent | Event} event - The WebGL context restore event.
246
262
  */
247
263
  contextRestored(event) {
248
264
  this.logger.info('contextRestored', event);
@@ -254,8 +270,8 @@ export class Game {
254
270
  }
255
271
 
256
272
  /**
257
- * TBD.
258
- * @param {number} time - TBD.
273
+ * Updates the game state.
274
+ * @param {number} time - The current timestamp.
259
275
  */
260
276
  update(time) {
261
277
  this.time.update(time);
@@ -278,7 +294,7 @@ export class Game {
278
294
  }
279
295
 
280
296
  /**
281
- * TBD.
297
+ * Destroys the game and cleans up all resources.
282
298
  */
283
299
  destroy() {
284
300
  this.logger.info('destroy');