@vpmedia/phaser 1.14.0 → 1.16.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 (306) hide show
  1. package/README.md +3 -3
  2. package/package.json +6 -5
  3. package/src/index.js +15 -18
  4. package/src/phaser/core/animation.js +102 -6
  5. package/src/phaser/core/animation_manager.js +88 -10
  6. package/src/phaser/core/animation_parser.js +5 -20
  7. package/src/phaser/core/array_set.js +51 -5
  8. package/src/phaser/core/cache.js +291 -6
  9. package/src/phaser/core/const.js +107 -4
  10. package/src/phaser/core/device.js +5 -6
  11. package/src/phaser/core/device_util.js +3 -25
  12. package/src/phaser/core/dom.js +127 -29
  13. package/src/phaser/core/event_manager.js +128 -6
  14. package/src/phaser/core/factory.js +69 -34
  15. package/src/phaser/core/frame.js +43 -6
  16. package/src/phaser/core/frame_data.js +55 -5
  17. package/src/phaser/core/frame_util.js +7 -14
  18. package/src/phaser/core/game.js +35 -7
  19. package/src/phaser/core/input.js +116 -17
  20. package/src/phaser/core/input_handler.js +242 -42
  21. package/src/phaser/core/input_mouse.js +68 -7
  22. package/src/phaser/core/input_mspointer.js +40 -9
  23. package/src/phaser/core/input_pointer.js +79 -17
  24. package/src/phaser/core/input_touch.js +42 -5
  25. package/src/phaser/core/loader.js +274 -101
  26. package/src/phaser/core/loader_parser.js +2 -14
  27. package/src/phaser/core/raf.js +16 -5
  28. package/src/phaser/core/scale_manager.js +204 -39
  29. package/src/phaser/core/scene.js +24 -5
  30. package/src/phaser/core/scene_manager.js +81 -11
  31. package/src/phaser/core/signal.js +88 -11
  32. package/src/phaser/core/signal_binding.js +35 -15
  33. package/src/phaser/core/sound.js +99 -10
  34. package/src/phaser/core/sound_manager.js +89 -13
  35. package/src/phaser/core/sound_sprite.js +20 -5
  36. package/src/phaser/core/stage.js +43 -7
  37. package/src/phaser/core/time.js +67 -5
  38. package/src/phaser/core/timer.js +107 -30
  39. package/src/phaser/core/timer_event.js +11 -6
  40. package/src/phaser/core/tween.js +124 -30
  41. package/src/phaser/core/tween_data.js +42 -18
  42. package/src/phaser/core/tween_easing.js +1 -39
  43. package/src/phaser/core/tween_manager.js +47 -5
  44. package/src/phaser/core/world.js +9 -6
  45. package/src/phaser/display/bitmap_text.js +92 -11
  46. package/src/phaser/display/button.js +64 -13
  47. package/src/phaser/display/canvas/buffer.js +16 -6
  48. package/src/phaser/display/canvas/graphics.js +1 -16
  49. package/src/phaser/display/canvas/masker.js +0 -8
  50. package/src/phaser/display/canvas/pool.js +0 -14
  51. package/src/phaser/display/canvas/renderer.js +28 -8
  52. package/src/phaser/display/canvas/tinter.js +4 -48
  53. package/src/phaser/display/canvas/util.js +0 -15
  54. package/src/phaser/display/display_object.js +192 -20
  55. package/src/phaser/display/graphics.js +162 -27
  56. package/src/phaser/display/graphics_data.js +14 -6
  57. package/src/phaser/display/graphics_data_util.js +2 -9
  58. package/src/phaser/display/group.js +75 -10
  59. package/src/phaser/display/image.js +86 -10
  60. package/src/phaser/display/sprite_batch.js +3 -9
  61. package/src/phaser/display/sprite_util.js +3 -28
  62. package/src/phaser/display/text.js +332 -32
  63. package/src/phaser/display/webgl/abstract_filter.js +8 -7
  64. package/src/phaser/display/webgl/base_texture.js +20 -12
  65. package/src/phaser/display/webgl/blend_manager.js +14 -7
  66. package/src/phaser/display/webgl/earcut.js +4 -50
  67. package/src/phaser/display/webgl/earcut_node.js +6 -7
  68. package/src/phaser/display/webgl/fast_sprite_batch.js +34 -11
  69. package/src/phaser/display/webgl/filter_manager.js +25 -7
  70. package/src/phaser/display/webgl/filter_texture.js +21 -22
  71. package/src/phaser/display/webgl/graphics.js +5 -40
  72. package/src/phaser/display/webgl/graphics_data.js +10 -7
  73. package/src/phaser/display/webgl/mask_manager.js +0 -8
  74. package/src/phaser/display/webgl/render_texture.js +33 -21
  75. package/src/phaser/display/webgl/renderer.js +38 -11
  76. package/src/phaser/display/webgl/shader/complex.js +10 -6
  77. package/src/phaser/display/webgl/shader/fast.js +10 -6
  78. package/src/phaser/display/webgl/shader/normal.js +23 -32
  79. package/src/phaser/display/webgl/shader/primitive.js +10 -6
  80. package/src/phaser/display/webgl/shader/strip.js +10 -6
  81. package/src/phaser/display/webgl/shader_manager.js +18 -6
  82. package/src/phaser/display/webgl/sprite_batch.js +41 -8
  83. package/src/phaser/display/webgl/stencil_manager.js +28 -6
  84. package/src/phaser/display/webgl/texture.js +28 -15
  85. package/src/phaser/display/webgl/texture_util.js +0 -8
  86. package/src/phaser/display/webgl/util.js +0 -11
  87. package/src/phaser/geom/circle.js +123 -19
  88. package/src/phaser/geom/ellipse.js +39 -19
  89. package/src/phaser/geom/line.js +148 -17
  90. package/src/phaser/geom/matrix.js +73 -7
  91. package/src/phaser/geom/point.js +152 -7
  92. package/src/phaser/geom/polygon.js +42 -14
  93. package/src/phaser/geom/rectangle.js +233 -7
  94. package/src/phaser/geom/rounded_rectangle.js +10 -7
  95. package/src/phaser/geom/util/circle.js +3 -16
  96. package/src/phaser/geom/util/ellipse.js +0 -8
  97. package/src/phaser/geom/util/line.js +5 -19
  98. package/src/phaser/geom/util/matrix.js +1 -10
  99. package/src/phaser/geom/util/point.js +0 -26
  100. package/src/phaser/geom/util/polygon.js +1 -8
  101. package/src/phaser/geom/util/rectangle.js +1 -23
  102. package/src/phaser/geom/util/rounded_rectangle.js +1 -8
  103. package/src/phaser/util/math.js +3 -43
  104. package/{types → typedefs}/global.d.ts +1 -1
  105. package/types/index.d.ts +2 -1
  106. package/types/index.d.ts.map +1 -1
  107. package/types/phaser/core/animation.d.ts +106 -5
  108. package/types/phaser/core/animation.d.ts.map +1 -1
  109. package/types/phaser/core/animation_manager.d.ts +88 -1
  110. package/types/phaser/core/animation_manager.d.ts.map +1 -1
  111. package/types/phaser/core/animation_parser.d.ts +5 -6
  112. package/types/phaser/core/animation_parser.d.ts.map +1 -1
  113. package/types/phaser/core/array_set.d.ts +53 -7
  114. package/types/phaser/core/array_set.d.ts.map +1 -1
  115. package/types/phaser/core/cache.d.ts +348 -58
  116. package/types/phaser/core/cache.d.ts.map +1 -1
  117. package/types/phaser/core/const.d.ts +143 -40
  118. package/types/phaser/core/const.d.ts.map +1 -1
  119. package/types/phaser/core/device.d.ts +2 -5
  120. package/types/phaser/core/device.d.ts.map +1 -1
  121. package/types/phaser/core/device_util.d.ts +1 -10
  122. package/types/phaser/core/device_util.d.ts.map +1 -1
  123. package/types/phaser/core/dom.d.ts +122 -3
  124. package/types/phaser/core/dom.d.ts.map +1 -1
  125. package/types/phaser/core/event_manager.d.ts +142 -15
  126. package/types/phaser/core/event_manager.d.ts.map +1 -1
  127. package/types/phaser/core/factory.d.ts +74 -7
  128. package/types/phaser/core/factory.d.ts.map +1 -1
  129. package/types/phaser/core/frame.d.ts +68 -26
  130. package/types/phaser/core/frame.d.ts.map +1 -1
  131. package/types/phaser/core/frame_data.d.ts +61 -9
  132. package/types/phaser/core/frame_data.d.ts.map +1 -1
  133. package/types/phaser/core/frame_util.d.ts +10 -10
  134. package/types/phaser/core/frame_util.d.ts.map +1 -1
  135. package/types/phaser/core/game.d.ts +54 -20
  136. package/types/phaser/core/game.d.ts.map +1 -1
  137. package/types/phaser/core/input.d.ts +132 -21
  138. package/types/phaser/core/input.d.ts.map +1 -1
  139. package/types/phaser/core/input_handler.d.ts +258 -25
  140. package/types/phaser/core/input_handler.d.ts.map +1 -1
  141. package/types/phaser/core/input_mouse.d.ts +59 -12
  142. package/types/phaser/core/input_mouse.d.ts.map +1 -1
  143. package/types/phaser/core/input_mspointer.d.ts +49 -15
  144. package/types/phaser/core/input_mspointer.d.ts.map +1 -1
  145. package/types/phaser/core/input_pointer.d.ts +80 -4
  146. package/types/phaser/core/input_pointer.d.ts.map +1 -1
  147. package/types/phaser/core/input_touch.d.ts +52 -15
  148. package/types/phaser/core/input_touch.d.ts.map +1 -1
  149. package/types/phaser/core/loader.d.ts +268 -23
  150. package/types/phaser/core/loader.d.ts.map +1 -1
  151. package/types/phaser/core/loader_parser.d.ts +0 -4
  152. package/types/phaser/core/loader_parser.d.ts.map +1 -1
  153. package/types/phaser/core/raf.d.ts +17 -7
  154. package/types/phaser/core/raf.d.ts.map +1 -1
  155. package/types/phaser/core/scale_manager.d.ts +210 -15
  156. package/types/phaser/core/scale_manager.d.ts.map +1 -1
  157. package/types/phaser/core/scene.d.ts +21 -5
  158. package/types/phaser/core/scene.d.ts.map +1 -1
  159. package/types/phaser/core/scene_manager.d.ts +90 -10
  160. package/types/phaser/core/scene_manager.d.ts.map +1 -1
  161. package/types/phaser/core/signal.d.ts +95 -11
  162. package/types/phaser/core/signal.d.ts.map +1 -1
  163. package/types/phaser/core/signal_binding.d.ts +35 -6
  164. package/types/phaser/core/signal_binding.d.ts.map +1 -1
  165. package/types/phaser/core/sound.d.ts +111 -14
  166. package/types/phaser/core/sound.d.ts.map +1 -1
  167. package/types/phaser/core/sound_manager.d.ts +94 -8
  168. package/types/phaser/core/sound_manager.d.ts.map +1 -1
  169. package/types/phaser/core/sound_sprite.d.ts +22 -8
  170. package/types/phaser/core/sound_sprite.d.ts.map +1 -1
  171. package/types/phaser/core/stage.d.ts +32 -3
  172. package/types/phaser/core/stage.d.ts.map +1 -1
  173. package/types/phaser/core/time.d.ts +73 -6
  174. package/types/phaser/core/time.d.ts.map +1 -1
  175. package/types/phaser/core/timer.d.ts +103 -2
  176. package/types/phaser/core/timer.d.ts.map +1 -1
  177. package/types/phaser/core/timer_event.d.ts +11 -5
  178. package/types/phaser/core/timer_event.d.ts.map +1 -1
  179. package/types/phaser/core/tween.d.ts +123 -3
  180. package/types/phaser/core/tween.d.ts.map +1 -1
  181. package/types/phaser/core/tween_data.d.ts +42 -3
  182. package/types/phaser/core/tween_data.d.ts.map +1 -1
  183. package/types/phaser/core/tween_easing.d.ts +0 -36
  184. package/types/phaser/core/tween_easing.d.ts.map +1 -1
  185. package/types/phaser/core/tween_manager.d.ts +49 -2
  186. package/types/phaser/core/tween_manager.d.ts.map +1 -1
  187. package/types/phaser/core/world.d.ts +9 -1
  188. package/types/phaser/core/world.d.ts.map +1 -1
  189. package/types/phaser/display/bitmap_text.d.ts +89 -12
  190. package/types/phaser/display/bitmap_text.d.ts.map +1 -1
  191. package/types/phaser/display/button.d.ts +68 -11
  192. package/types/phaser/display/button.d.ts.map +1 -1
  193. package/types/phaser/display/canvas/buffer.d.ts +21 -5
  194. package/types/phaser/display/canvas/buffer.d.ts.map +1 -1
  195. package/types/phaser/display/canvas/graphics.d.ts +0 -3
  196. package/types/phaser/display/canvas/graphics.d.ts.map +1 -1
  197. package/types/phaser/display/canvas/masker.d.ts +0 -2
  198. package/types/phaser/display/canvas/masker.d.ts.map +1 -1
  199. package/types/phaser/display/canvas/pool.d.ts +0 -13
  200. package/types/phaser/display/canvas/pool.d.ts.map +1 -1
  201. package/types/phaser/display/canvas/renderer.d.ts +30 -3
  202. package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
  203. package/types/phaser/display/canvas/tinter.d.ts +0 -5
  204. package/types/phaser/display/canvas/tinter.d.ts.map +1 -1
  205. package/types/phaser/display/canvas/util.d.ts +0 -9
  206. package/types/phaser/display/canvas/util.d.ts.map +1 -1
  207. package/types/phaser/display/display_object.d.ts +196 -9
  208. package/types/phaser/display/display_object.d.ts.map +1 -1
  209. package/types/phaser/display/graphics.d.ts +142 -16
  210. package/types/phaser/display/graphics.d.ts.map +1 -1
  211. package/types/phaser/display/graphics_data.d.ts +15 -1
  212. package/types/phaser/display/graphics_data.d.ts.map +1 -1
  213. package/types/phaser/display/graphics_data_util.d.ts +3 -3
  214. package/types/phaser/display/graphics_data_util.d.ts.map +1 -1
  215. package/types/phaser/display/group.d.ts +68 -6
  216. package/types/phaser/display/group.d.ts.map +1 -1
  217. package/types/phaser/display/image.d.ts +77 -15
  218. package/types/phaser/display/image.d.ts.map +1 -1
  219. package/types/phaser/display/sprite_batch.d.ts +4 -4
  220. package/types/phaser/display/sprite_batch.d.ts.map +1 -1
  221. package/types/phaser/display/sprite_util.d.ts +0 -5
  222. package/types/phaser/display/sprite_util.d.ts.map +1 -1
  223. package/types/phaser/display/text.d.ts +373 -53
  224. package/types/phaser/display/text.d.ts.map +1 -1
  225. package/types/phaser/display/webgl/abstract_filter.d.ts +8 -6
  226. package/types/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
  227. package/types/phaser/display/webgl/base_texture.d.ts +20 -1
  228. package/types/phaser/display/webgl/base_texture.d.ts.map +1 -1
  229. package/types/phaser/display/webgl/blend_manager.d.ts +11 -6
  230. package/types/phaser/display/webgl/blend_manager.d.ts.map +1 -1
  231. package/types/phaser/display/webgl/earcut.d.ts +0 -27
  232. package/types/phaser/display/webgl/earcut.d.ts.map +1 -1
  233. package/types/phaser/display/webgl/earcut_node.d.ts +9 -9
  234. package/types/phaser/display/webgl/earcut_node.d.ts.map +1 -1
  235. package/types/phaser/display/webgl/fast_sprite_batch.d.ts +33 -6
  236. package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
  237. package/types/phaser/display/webgl/filter_manager.d.ts +23 -7
  238. package/types/phaser/display/webgl/filter_manager.d.ts.map +1 -1
  239. package/types/phaser/display/webgl/filter_texture.d.ts +21 -3
  240. package/types/phaser/display/webgl/filter_texture.d.ts.map +1 -1
  241. package/types/phaser/display/webgl/graphics.d.ts +0 -12
  242. package/types/phaser/display/webgl/graphics.d.ts.map +1 -1
  243. package/types/phaser/display/webgl/graphics_data.d.ts +12 -8
  244. package/types/phaser/display/webgl/graphics_data.d.ts.map +1 -1
  245. package/types/phaser/display/webgl/mask_manager.d.ts +0 -2
  246. package/types/phaser/display/webgl/mask_manager.d.ts.map +1 -1
  247. package/types/phaser/display/webgl/render_texture.d.ts +31 -4
  248. package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
  249. package/types/phaser/display/webgl/renderer.d.ts +42 -5
  250. package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
  251. package/types/phaser/display/webgl/shader/complex.d.ts +12 -2
  252. package/types/phaser/display/webgl/shader/complex.d.ts.map +1 -1
  253. package/types/phaser/display/webgl/shader/fast.d.ts +12 -2
  254. package/types/phaser/display/webgl/shader/fast.d.ts.map +1 -1
  255. package/types/phaser/display/webgl/shader/normal.d.ts +21 -1
  256. package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -1
  257. package/types/phaser/display/webgl/shader/primitive.d.ts +12 -2
  258. package/types/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
  259. package/types/phaser/display/webgl/shader/strip.d.ts +12 -2
  260. package/types/phaser/display/webgl/shader/strip.d.ts.map +1 -1
  261. package/types/phaser/display/webgl/shader_manager.d.ts +20 -5
  262. package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
  263. package/types/phaser/display/webgl/sprite_batch.d.ts +38 -1
  264. package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
  265. package/types/phaser/display/webgl/stencil_manager.d.ts +25 -0
  266. package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
  267. package/types/phaser/display/webgl/texture.d.ts +22 -1
  268. package/types/phaser/display/webgl/texture.d.ts.map +1 -1
  269. package/types/phaser/display/webgl/texture_util.d.ts +0 -2
  270. package/types/phaser/display/webgl/texture_util.d.ts.map +1 -1
  271. package/types/phaser/display/webgl/util.d.ts +0 -10
  272. package/types/phaser/display/webgl/util.d.ts.map +1 -1
  273. package/types/phaser/geom/circle.d.ts +130 -10
  274. package/types/phaser/geom/circle.d.ts.map +1 -1
  275. package/types/phaser/geom/ellipse.d.ts +42 -6
  276. package/types/phaser/geom/ellipse.d.ts.map +1 -1
  277. package/types/phaser/geom/line.d.ts +159 -14
  278. package/types/phaser/geom/line.d.ts.map +1 -1
  279. package/types/phaser/geom/matrix.d.ts +84 -12
  280. package/types/phaser/geom/matrix.d.ts.map +1 -1
  281. package/types/phaser/geom/point.d.ts +170 -19
  282. package/types/phaser/geom/point.d.ts.map +1 -1
  283. package/types/phaser/geom/polygon.d.ts +45 -5
  284. package/types/phaser/geom/polygon.d.ts.map +1 -1
  285. package/types/phaser/geom/rectangle.d.ts +253 -21
  286. package/types/phaser/geom/rectangle.d.ts.map +1 -1
  287. package/types/phaser/geom/rounded_rectangle.d.ts +11 -2
  288. package/types/phaser/geom/rounded_rectangle.d.ts.map +1 -1
  289. package/types/phaser/geom/util/circle.d.ts +3 -10
  290. package/types/phaser/geom/util/circle.d.ts.map +1 -1
  291. package/types/phaser/geom/util/ellipse.d.ts +0 -7
  292. package/types/phaser/geom/util/ellipse.d.ts.map +1 -1
  293. package/types/phaser/geom/util/line.d.ts +5 -10
  294. package/types/phaser/geom/util/line.d.ts.map +1 -1
  295. package/types/phaser/geom/util/matrix.d.ts +0 -3
  296. package/types/phaser/geom/util/matrix.d.ts.map +1 -1
  297. package/types/phaser/geom/util/point.d.ts +0 -20
  298. package/types/phaser/geom/util/point.d.ts.map +1 -1
  299. package/types/phaser/geom/util/polygon.d.ts +0 -1
  300. package/types/phaser/geom/util/polygon.d.ts.map +1 -1
  301. package/types/phaser/geom/util/rectangle.d.ts +0 -16
  302. package/types/phaser/geom/util/rectangle.d.ts.map +1 -1
  303. package/types/phaser/geom/util/rounded_rectangle.d.ts +0 -1
  304. package/types/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
  305. package/types/phaser/util/math.d.ts +0 -27
  306. package/types/phaser/util/math.d.ts.map +1 -1
@@ -1,9 +1,3 @@
1
- /**
2
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
3
- * @author Andras Csizmadia <andras@vpmedia.hu>
4
- * @author Richard Davey <rich@photonstorm.com>
5
- * @author Mat Groves http://matgroves.com/ @Doormat23
6
- */
7
1
  import { PrimitiveShader } from './shader/primitive';
8
2
  import { ComplexPrimitiveShader } from './shader/complex';
9
3
  import { NormalShader } from './shader/normal';
@@ -11,6 +5,9 @@ import { FastShader } from './shader/fast';
11
5
  import { StripShader } from './shader/strip';
12
6
 
13
7
  export class WebGLShaderManager {
8
+ /**
9
+ * TBD.
10
+ */
14
11
  constructor() {
15
12
  this.gl = null;
16
13
  this.primitiveShader = null;
@@ -27,6 +24,10 @@ export class WebGLShaderManager {
27
24
  this.stack = [];
28
25
  }
29
26
 
27
+ /**
28
+ * TBD.
29
+ * @param gl - TBD.
30
+ */
30
31
  setContext(gl) {
31
32
  this.gl = gl;
32
33
  this.primitiveShader = new PrimitiveShader(gl);
@@ -37,6 +38,10 @@ export class WebGLShaderManager {
37
38
  this.setShader(this.defaultShader);
38
39
  }
39
40
 
41
+ /**
42
+ * TBD.
43
+ * @param attribs
44
+ */
40
45
  setAttribs(attribs) {
41
46
  // reset temp state
42
47
  let i;
@@ -61,6 +66,10 @@ export class WebGLShaderManager {
61
66
  }
62
67
  }
63
68
 
69
+ /**
70
+ * TBD.
71
+ * @param shader
72
+ */
64
73
  setShader(shader) {
65
74
  if (this._currentId === shader._UID) {
66
75
  return false;
@@ -72,6 +81,9 @@ export class WebGLShaderManager {
72
81
  return true;
73
82
  }
74
83
 
84
+ /**
85
+ * TBD.
86
+ */
75
87
  destroy() {
76
88
  this.attribState = null;
77
89
  this.tempAttribState = null;
@@ -1,13 +1,10 @@
1
- /**
2
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
3
- * @author Andras Csizmadia <andras@vpmedia.hu>
4
- * @author Richard Davey <rich@photonstorm.com>
5
- * @author Mat Groves http://matgroves.com/ @Doormat23
6
- */
7
1
  import { AbstractFilter } from './abstract_filter';
8
2
  import { NormalShader } from './shader/normal';
9
3
 
10
4
  export class WebGLSpriteBatch {
5
+ /**
6
+ * TBD.
7
+ */
11
8
  constructor() {
12
9
  this.vertSize = 5;
13
10
  this.size = 2000; // Math.pow(2, 16) / this.vertSize;
@@ -47,6 +44,10 @@ export class WebGLSpriteBatch {
47
44
  ]);
48
45
  }
49
46
 
47
+ /**
48
+ * TBD.
49
+ * @param gl - TBD.
50
+ */
50
51
  setContext(gl) {
51
52
  this.gl = gl;
52
53
  // create a couple of buffers
@@ -66,16 +67,28 @@ export class WebGLSpriteBatch {
66
67
  this.defaultShader.shaders[gl.id] = shader;
67
68
  }
68
69
 
70
+ /**
71
+ * TBD.
72
+ * @param renderSession - TBD.
73
+ */
69
74
  begin(renderSession) {
70
75
  this.renderSession = renderSession;
71
76
  this.shader = this.renderSession.shaderManager.defaultShader;
72
77
  this.start();
73
78
  }
74
79
 
80
+ /**
81
+ * TBD.
82
+ */
75
83
  end() {
76
84
  this.flush();
77
85
  }
78
86
 
87
+ /**
88
+ * TBD.
89
+ * @param sprite
90
+ * @param matrix - TBD.
91
+ */
79
92
  render(sprite, matrix) {
80
93
  const texture = sprite.texture;
81
94
  // They provided an alternative rendering matrix, so use it
@@ -164,8 +177,7 @@ export class WebGLSpriteBatch {
164
177
  positions[i + 18] = uvs.y3;
165
178
  // color and alpha
166
179
  const tint = sprite.tint;
167
- colors[i + 4] =
168
- (tint >> 16) + (tint & 0xff00) + ((tint & 0xff) << 16) + ((sprite.worldAlpha * 255) << 24);
180
+ colors[i + 4] = (tint >> 16) + (tint & 0xff00) + ((tint & 0xff) << 16) + ((sprite.worldAlpha * 255) << 24);
169
181
  colors[i + 9] = colors[i + 4];
170
182
  colors[i + 14] = colors[i + 4];
171
183
  colors[i + 19] = colors[i + 4];
@@ -174,10 +186,16 @@ export class WebGLSpriteBatch {
174
186
  this.currentBatchSize += 1;
175
187
  }
176
188
 
189
+ /**
190
+ * TBD.
191
+ */
177
192
  renderTilingSprite() {
178
193
  // TODO
179
194
  }
180
195
 
196
+ /**
197
+ * TBD.
198
+ */
181
199
  flush() {
182
200
  // If the batch is length 0 then return as there is nothing to draw
183
201
  if (this.currentBatchSize === 0) {
@@ -274,6 +292,12 @@ export class WebGLSpriteBatch {
274
292
  this.currentBatchSize = 0;
275
293
  }
276
294
 
295
+ /**
296
+ * TBD.
297
+ * @param texture
298
+ * @param size
299
+ * @param startIndex
300
+ */
277
301
  renderBatch(texture, size, startIndex) {
278
302
  if (size === 0) {
279
303
  return;
@@ -295,15 +319,24 @@ export class WebGLSpriteBatch {
295
319
  this.renderSession.drawCount += 1;
296
320
  }
297
321
 
322
+ /**
323
+ * TBD.
324
+ */
298
325
  stop() {
299
326
  this.flush();
300
327
  this.dirty = true;
301
328
  }
302
329
 
330
+ /**
331
+ * TBD.
332
+ */
303
333
  start() {
304
334
  this.dirty = true;
305
335
  }
306
336
 
337
+ /**
338
+ * TBD.
339
+ */
307
340
  destroy() {
308
341
  this.vertices = null;
309
342
  this.positions = null;
@@ -1,27 +1,37 @@
1
- /**
2
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
3
- * @author Andras Csizmadia <andras@vpmedia.hu>
4
- * @author Richard Davey <rich@photonstorm.com>
5
- * @author Mat Groves http://matgroves.com/ @Doormat23
6
- */
7
1
  import { hex2rgb } from '../../util/math';
8
2
 
9
3
  export class WebGLStencilManager {
4
+ /**
5
+ * TBD.
6
+ */
10
7
  constructor() {
11
8
  this.stencilStack = [];
12
9
  this.reverse = true;
13
10
  this.count = 0;
14
11
  }
15
12
 
13
+ /**
14
+ * TBD.
15
+ * @param gl - TBD.
16
+ */
16
17
  setContext(gl) {
17
18
  this.gl = gl;
18
19
  }
19
20
 
21
+ /**
22
+ * TBD.
23
+ */
20
24
  destroy() {
21
25
  this.stencilStack = null;
22
26
  this.gl = null;
23
27
  }
24
28
 
29
+ /**
30
+ * TBD.
31
+ * @param graphics - TBD.
32
+ * @param webGLData
33
+ * @param renderSession - TBD.
34
+ */
25
35
  pushStencil(graphics, webGLData, renderSession) {
26
36
  const gl = renderSession.gl;
27
37
  this.bindGraphics(graphics, webGLData, renderSession);
@@ -74,6 +84,12 @@ export class WebGLStencilManager {
74
84
  this.count += 1;
75
85
  }
76
86
 
87
+ /**
88
+ * TBD.
89
+ * @param graphics - TBD.
90
+ * @param webGLData
91
+ * @param renderSession - TBD.
92
+ */
77
93
  bindGraphics(graphics, webGLData, renderSession) {
78
94
  // if(this._currentGraphics === graphics)return;
79
95
  // this._currentGraphics = graphics;
@@ -115,6 +131,12 @@ export class WebGLStencilManager {
115
131
  }
116
132
  }
117
133
 
134
+ /**
135
+ * TBD.
136
+ * @param graphics - TBD.
137
+ * @param webGLData
138
+ * @param renderSession - TBD.
139
+ */
118
140
  popStencil(graphics, webGLData, renderSession) {
119
141
  const gl = renderSession.gl;
120
142
  this.stencilStack.pop();
@@ -1,13 +1,9 @@
1
- /**
2
- * @module display/webgl/texture
3
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
4
- * @author Andras Csizmadia <andras@vpmedia.hu>
5
- * @author Richard Davey <rich@photonstorm.com>
6
- * @author Mat Groves http://matgroves.com/ @Doormat23
7
- */
8
- import { Rectangle } from '../../geom/rectangle';
1
+ import { Rectangle } from '../../geom/rectangle';
9
2
 
10
3
  export class TextureUvs {
4
+ /**
5
+ * TBD.
6
+ */
11
7
  constructor() {
12
8
  this.x0 = 0;
13
9
  this.y0 = 0;
@@ -21,6 +17,13 @@ export class TextureUvs {
21
17
  }
22
18
 
23
19
  export class Texture {
20
+ /**
21
+ * TBD.
22
+ * @param baseTexture - TBD.
23
+ * @param frame - TBD.
24
+ * @param crop - TBD.
25
+ * @param trim - TBD.
26
+ */
24
27
  constructor(baseTexture, frame, crop, trim) {
25
28
  this.noFrame = false;
26
29
  if (!frame) {
@@ -49,6 +52,9 @@ export class Texture {
49
52
  }
50
53
  }
51
54
 
55
+ /**
56
+ * TBD.
57
+ */
52
58
  onBaseTextureLoaded() {
53
59
  if (this.noFrame) {
54
60
  this.frame = new Rectangle(0, 0, this.baseTexture.width, this.baseTexture.height);
@@ -56,6 +62,10 @@ export class Texture {
56
62
  this.setFrame(this.frame);
57
63
  }
58
64
 
65
+ /**
66
+ * TBD.
67
+ * @param destroyBase - TBD.
68
+ */
59
69
  destroy(destroyBase = false) {
60
70
  if (destroyBase) {
61
71
  this.baseTexture.destroy();
@@ -63,6 +73,10 @@ export class Texture {
63
73
  this.valid = false;
64
74
  }
65
75
 
76
+ /**
77
+ * TBD.
78
+ * @param frame - TBD.
79
+ */
66
80
  setFrame(frame) {
67
81
  this.noFrame = false;
68
82
  this.frame = frame;
@@ -74,23 +88,19 @@ export class Texture {
74
88
  this.crop.height = frame.height;
75
89
  if (
76
90
  !this.trim &&
77
- (frame.x + frame.width > this.baseTexture.width ||
78
- frame.y + frame.height > this.baseTexture.height)
91
+ (frame.x + frame.width > this.baseTexture.width || frame.y + frame.height > this.baseTexture.height)
79
92
  ) {
80
93
  // If `true` then `PIXI.Texture.setFrame` will no longer throw an error if the texture dimensions are incorrect.
81
94
  // Instead `Texture.valid` will be set to `false` (#1556)
82
95
  // TODO: make this configurable
83
96
  const isTextureSilentFail = true;
84
97
  if (!isTextureSilentFail) {
85
- throw new Error(
86
- 'Texture Error: frame does not fit inside the base Texture dimensions ' + this
87
- );
98
+ throw new Error('Texture Error: frame does not fit inside the base Texture dimensions ' + this);
88
99
  }
89
100
  this.valid = false;
90
101
  return;
91
102
  }
92
- this.valid =
93
- frame && frame.width && frame.height && this.baseTexture.source && this.baseTexture.hasLoaded;
103
+ this.valid = frame && frame.width && frame.height && this.baseTexture.source && this.baseTexture.hasLoaded;
94
104
  if (this.trim) {
95
105
  this.width = this.trim.width;
96
106
  this.height = this.trim.height;
@@ -102,6 +112,9 @@ export class Texture {
102
112
  }
103
113
  }
104
114
 
115
+ /**
116
+ * TBD.
117
+ */
105
118
  _updateUvs() {
106
119
  if (!this._uvs) {
107
120
  this._uvs = new TextureUvs();
@@ -1,15 +1,8 @@
1
- /**
2
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
3
- * @author Andras Csizmadia <andras@vpmedia.hu>
4
- * @author Richard Davey <rich@photonstorm.com>
5
- * @author Mat Groves http://matgroves.com/ @Doormat23
6
- */
7
1
  import { BaseTexture } from './base_texture';
8
2
  import { Texture } from './texture';
9
3
 
10
4
  /**
11
5
  * TBD.
12
- *
13
6
  * @param {HTMLCanvasElement} canvas - TBD.
14
7
  * @param {number} scaleMode - TBD.
15
8
  * @returns {object} TBD.
@@ -26,7 +19,6 @@ export function baseTextureFromCanvas(canvas, scaleMode) {
26
19
 
27
20
  /**
28
21
  * TBD.
29
- *
30
22
  * @param {HTMLCanvasElement} canvas - TBD.
31
23
  * @param {number} scaleMode - TBD.
32
24
  * @returns {object} TBD.
@@ -1,10 +1,3 @@
1
- /**
2
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
3
- * @author Andras Csizmadia <andras@vpmedia.hu>
4
- * @author Richard Davey <rich@photonstorm.com>
5
- * @author Mat Groves http://matgroves.com/ @Doormat23
6
- */
7
-
8
1
  /**
9
2
  * TBD.
10
3
  */
@@ -12,7 +5,6 @@ export function initDefaultShaders() {}
12
5
 
13
6
  /**
14
7
  * TBD.
15
- *
16
8
  * @param {object} gl - TBD.
17
9
  * @param {string[]|string} shaderSrc - TBD.
18
10
  * @param {object} shaderType - TBD.
@@ -37,7 +29,6 @@ export function compileShader(gl, shaderSrc, shaderType) {
37
29
 
38
30
  /**
39
31
  * TBD.
40
- *
41
32
  * @param {object} gl - TBD.
42
33
  * @param {string[]|string} shaderSrc - TBD.
43
34
  * @returns {object} TBD.
@@ -48,7 +39,6 @@ export function compileVertexShader(gl, shaderSrc) {
48
39
 
49
40
  /**
50
41
  * TBD.
51
- *
52
42
  * @param {object} gl - TBD.
53
43
  * @param {string[]|string} shaderSrc - TBD.
54
44
  * @returns {object} TBD.
@@ -59,7 +49,6 @@ export function compileFragmentShader(gl, shaderSrc) {
59
49
 
60
50
  /**
61
51
  * TBD.
62
- *
63
52
  * @param {object} gl - TBD.
64
53
  * @param {string[]|string} vertexSrc - TBD.
65
54
  * @param {string[]|string} fragmentSrc - TBD.
@@ -1,11 +1,5 @@
1
- /**
2
- * @module geom/circle
3
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
4
- * @author Andras Csizmadia <andras@vpmedia.hu>
5
- * @author Richard Davey <rich@photonstorm.com>
6
- */
7
1
  import { Point } from './point';
8
- import { Rectangle } from './rectangle';
2
+ import { Rectangle } from './rectangle';
9
3
  import { distance } from '../util/math';
10
4
  import { clone, contains, circumferencePoint } from './util/circle';
11
5
  import { GEOM_CIRCLE } from '../core/const';
@@ -13,7 +7,6 @@ import { GEOM_CIRCLE } from '../core/const';
13
7
  export class Circle {
14
8
  /**
15
9
  * TBD.
16
- *
17
10
  * @param {number} x - TBD.
18
11
  * @param {number} y - TBD.
19
12
  * @param {number} diameter - TBD.
@@ -29,10 +22,19 @@ export class Circle {
29
22
  this.type = GEOM_CIRCLE;
30
23
  }
31
24
 
25
+ /**
26
+ * TBD.
27
+ * @returns {number} TBD.
28
+ */
32
29
  circumference() {
33
30
  return 2 * (Math.PI * this._radius);
34
31
  }
35
32
 
33
+ /**
34
+ * TBD.
35
+ * @param {Point} output - TBD.
36
+ * @returns {Point} TBD.
37
+ */
36
38
  random(output = null) {
37
39
  const result = output || new Point();
38
40
  const t = 2 * Math.PI * Math.random();
@@ -45,10 +47,21 @@ export class Circle {
45
47
  return result;
46
48
  }
47
49
 
50
+ /**
51
+ * TBD.
52
+ * @returns {Rectangle} TBD.
53
+ */
48
54
  getBounds() {
49
55
  return new Rectangle(this.x - this.radius, this.y - this.radius, this.diameter, this.diameter);
50
56
  }
51
57
 
58
+ /**
59
+ * TBD.
60
+ * @param {number} x - TBD.
61
+ * @param {number} y - TBD.
62
+ * @param {number} diameter - TBD.
63
+ * @returns {Circle} TBD.
64
+ */
52
65
  setTo(x, y, diameter) {
53
66
  this.x = x;
54
67
  this.y = y;
@@ -57,10 +70,20 @@ export class Circle {
57
70
  return this;
58
71
  }
59
72
 
73
+ /**
74
+ * TBD.
75
+ * @param {Circle} source - TBD.
76
+ * @returns {Circle} TBD.
77
+ */
60
78
  copyFrom(source) {
61
79
  return this.setTo(source.x, source.y, source.diameter);
62
80
  }
63
81
 
82
+ /**
83
+ * TBD.
84
+ * @param {Circle} dest - TBD.
85
+ * @returns {Circle} TBD.
86
+ */
64
87
  copyTo(dest) {
65
88
  dest.x = this.x;
66
89
  dest.y = this.y;
@@ -68,51 +91,86 @@ export class Circle {
68
91
  return dest;
69
92
  }
70
93
 
94
+ /**
95
+ * TBD.
96
+ * @param {Circle} dest - TBD.
97
+ * @param {boolean} round - TBD.
98
+ * @returns {number} TBD.
99
+ */
71
100
  distance(dest, round = false) {
72
101
  const d = distance(this.x, this.y, dest.x, dest.y);
73
102
  return round ? Math.round(d) : d;
74
103
  }
75
104
 
105
+ /**
106
+ * TBD.
107
+ * @returns {Circle} TBD.
108
+ */
76
109
  clone() {
77
110
  return clone(this);
78
111
  }
79
112
 
113
+ /**
114
+ * TBD.
115
+ * @param {number} x - TBD.
116
+ * @param {number} y - TBD.
117
+ * @returns {boolean} TBD.
118
+ */
80
119
  contains(x, y) {
81
120
  return contains(this, x, y);
82
121
  }
83
122
 
123
+ /**
124
+ * TBD.
125
+ * @param {number} angle - TBD.
126
+ * @param {boolean} asDegrees - TBD.
127
+ * @param {Point} out - TBD.
128
+ * @returns {Point} TBD.
129
+ */
84
130
  circumferencePoint(angle, asDegrees, out) {
85
131
  return circumferencePoint(this, angle, asDegrees, out);
86
132
  }
87
133
 
134
+ /**
135
+ * TBD.
136
+ * @param {number} dx - TBD.
137
+ * @param {number} dy - TBD.
138
+ * @returns {Circle} TBD.
139
+ */
88
140
  offset(dx, dy) {
89
141
  this.x += dx;
90
142
  this.y += dy;
91
143
  return this;
92
144
  }
93
145
 
146
+ /**
147
+ * TBD.
148
+ * @param {Point} point - TBD.
149
+ * @returns {Circle} TBD.
150
+ */
94
151
  offsetPoint(point) {
95
152
  return this.offset(point.x, point.y);
96
153
  }
97
154
 
155
+ /**
156
+ * TBD.
157
+ * @returns {string} TBD.
158
+ */
98
159
  toString() {
99
- return (
100
- '[{Circle (x=' +
101
- this.x +
102
- ' y=' +
103
- this.y +
104
- ' diameter=' +
105
- this.diameter +
106
- ' radius=' +
107
- this.radius +
108
- ')}]'
109
- );
160
+ return '[{Circle (x=' + this.x + ' y=' + this.y + ' diameter=' + this.diameter + ' radius=' + this.radius + ')}]';
110
161
  }
111
162
 
163
+ /**
164
+ * TBD.
165
+ * @returns {number} TBD.
166
+ */
112
167
  get diameter() {
113
168
  return this._diameter;
114
169
  }
115
170
 
171
+ /**
172
+ * TBD.
173
+ */
116
174
  set diameter(value) {
117
175
  if (value > 0) {
118
176
  this._diameter = value;
@@ -120,10 +178,17 @@ export class Circle {
120
178
  }
121
179
  }
122
180
 
181
+ /**
182
+ * TBD.
183
+ * @returns {number} TBD.
184
+ */
123
185
  get radius() {
124
186
  return this._radius;
125
187
  }
126
188
 
189
+ /**
190
+ * TBD.
191
+ */
127
192
  set radius(value) {
128
193
  if (value > 0) {
129
194
  this._radius = value;
@@ -131,10 +196,17 @@ export class Circle {
131
196
  }
132
197
  }
133
198
 
199
+ /**
200
+ * TBD.
201
+ * @returns {number} TBD.
202
+ */
134
203
  get left() {
135
204
  return this.x - this._radius;
136
205
  }
137
206
 
207
+ /**
208
+ * TBD.
209
+ */
138
210
  set left(value) {
139
211
  if (value > this.x) {
140
212
  this._radius = 0;
@@ -144,10 +216,17 @@ export class Circle {
144
216
  }
145
217
  }
146
218
 
219
+ /**
220
+ * TBD.
221
+ * @returns {number} TBD.
222
+ */
147
223
  get right() {
148
224
  return this.x + this._radius;
149
225
  }
150
226
 
227
+ /**
228
+ * TBD.
229
+ */
151
230
  set right(value) {
152
231
  if (value < this.x) {
153
232
  this._radius = 0;
@@ -157,10 +236,17 @@ export class Circle {
157
236
  }
158
237
  }
159
238
 
239
+ /**
240
+ * TBD.
241
+ * @returns {number} TBD.
242
+ */
160
243
  get top() {
161
244
  return this.y - this._radius;
162
245
  }
163
246
 
247
+ /**
248
+ * TBD.
249
+ */
164
250
  set top(value) {
165
251
  if (value > this.y) {
166
252
  this._radius = 0;
@@ -170,10 +256,17 @@ export class Circle {
170
256
  }
171
257
  }
172
258
 
259
+ /**
260
+ * TBD.
261
+ * @returns {number} TBD.
262
+ */
173
263
  get bottom() {
174
264
  return this.y + this._radius;
175
265
  }
176
266
 
267
+ /**
268
+ * TBD.
269
+ */
177
270
  set bottom(value) {
178
271
  if (value < this.y) {
179
272
  this._radius = 0;
@@ -183,6 +276,10 @@ export class Circle {
183
276
  }
184
277
  }
185
278
 
279
+ /**
280
+ * TBD.
281
+ * @returns {number} TBD.
282
+ */
186
283
  get area() {
187
284
  if (this._radius > 0) {
188
285
  return Math.PI * this._radius * this._radius;
@@ -190,10 +287,17 @@ export class Circle {
190
287
  return 0;
191
288
  }
192
289
 
290
+ /**
291
+ * TBD.
292
+ * @returns {boolean} TBD.
293
+ */
193
294
  get empty() {
194
295
  return this._diameter === 0;
195
296
  }
196
297
 
298
+ /**
299
+ * TBD.
300
+ */
197
301
  set empty(value) {
198
302
  if (value === true) {
199
303
  this.setTo(0, 0, 0);