@vpmedia/phaser 1.68.0 → 1.69.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 (86) hide show
  1. package/README.md +1 -1
  2. package/package.json +6 -5
  3. package/src/phaser/core/animation_parser.js +4 -4
  4. package/src/phaser/core/device_util.js +18 -18
  5. package/src/phaser/core/frame_util.js +4 -4
  6. package/src/phaser/core/loader_parser.js +8 -8
  7. package/src/phaser/display/canvas/graphics.js +7 -7
  8. package/src/phaser/display/canvas/masker.js +4 -4
  9. package/src/phaser/display/canvas/pool.js +14 -14
  10. package/src/phaser/display/canvas/tinter.js +14 -16
  11. package/src/phaser/display/canvas/util.js +18 -18
  12. package/src/phaser/display/graphics_data_util.js +2 -2
  13. package/src/phaser/display/sprite_util.js +10 -10
  14. package/src/phaser/display/webgl/graphics.js +24 -24
  15. package/src/phaser/display/webgl/mask_manager.js +4 -4
  16. package/src/phaser/display/webgl/shader/complex.js +2 -2
  17. package/src/phaser/display/webgl/shader/fast.js +2 -2
  18. package/src/phaser/display/webgl/shader/normal.js +2 -2
  19. package/src/phaser/display/webgl/shader/primitive.js +2 -2
  20. package/src/phaser/display/webgl/shader/strip.js +2 -2
  21. package/src/phaser/display/webgl/texture_util.js +4 -4
  22. package/src/phaser/display/webgl/util.js +13 -13
  23. package/src/phaser/geom/util/circle.js +15 -15
  24. package/src/phaser/geom/util/ellipse.js +2 -2
  25. package/src/phaser/geom/util/line.js +11 -11
  26. package/src/phaser/geom/util/matrix.js +6 -6
  27. package/src/phaser/geom/util/point.js +40 -40
  28. package/src/phaser/geom/util/polygon.js +2 -2
  29. package/src/phaser/geom/util/rectangle.js +33 -33
  30. package/src/phaser/geom/util/rounded_rectangle.js +2 -2
  31. package/src/phaser/util/math.js +40 -56
  32. package/types/phaser/core/animation_parser.d.ts +0 -17
  33. package/types/phaser/core/animation_parser.d.ts.map +1 -1
  34. package/types/phaser/core/device_util.d.ts +2 -43
  35. package/types/phaser/core/device_util.d.ts.map +1 -1
  36. package/types/phaser/core/frame_util.d.ts +0 -12
  37. package/types/phaser/core/frame_util.d.ts.map +1 -1
  38. package/types/phaser/core/loader_parser.d.ts +0 -30
  39. package/types/phaser/core/loader_parser.d.ts.map +1 -1
  40. package/types/phaser/core/tween_data.d.ts +1 -1
  41. package/types/phaser/core/tween_data.d.ts.map +1 -1
  42. package/types/phaser/display/canvas/graphics.d.ts +0 -14
  43. package/types/phaser/display/canvas/graphics.d.ts.map +1 -1
  44. package/types/phaser/display/canvas/masker.d.ts +0 -9
  45. package/types/phaser/display/canvas/masker.d.ts.map +1 -1
  46. package/types/phaser/display/canvas/pool.d.ts +0 -32
  47. package/types/phaser/display/canvas/pool.d.ts.map +1 -1
  48. package/types/phaser/display/canvas/tinter.d.ts +2 -36
  49. package/types/phaser/display/canvas/tinter.d.ts.map +1 -1
  50. package/types/phaser/display/canvas/util.d.ts +0 -60
  51. package/types/phaser/display/canvas/util.d.ts.map +1 -1
  52. package/types/phaser/display/graphics_data_util.d.ts +0 -5
  53. package/types/phaser/display/graphics_data_util.d.ts.map +1 -1
  54. package/types/phaser/display/sprite_util.d.ts +0 -29
  55. package/types/phaser/display/sprite_util.d.ts.map +1 -1
  56. package/types/phaser/display/webgl/graphics.d.ts +0 -65
  57. package/types/phaser/display/webgl/graphics.d.ts.map +1 -1
  58. package/types/phaser/display/webgl/mask_manager.d.ts +0 -10
  59. package/types/phaser/display/webgl/mask_manager.d.ts.map +1 -1
  60. package/types/phaser/display/webgl/shader/complex.d.ts.map +1 -1
  61. package/types/phaser/display/webgl/shader/fast.d.ts.map +1 -1
  62. package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -1
  63. package/types/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
  64. package/types/phaser/display/webgl/shader/strip.d.ts.map +1 -1
  65. package/types/phaser/display/webgl/texture_util.d.ts +0 -12
  66. package/types/phaser/display/webgl/texture_util.d.ts.map +1 -1
  67. package/types/phaser/display/webgl/util.d.ts +7 -46
  68. package/types/phaser/display/webgl/util.d.ts.map +1 -1
  69. package/types/phaser/geom/util/circle.d.ts +0 -47
  70. package/types/phaser/geom/util/circle.d.ts.map +1 -1
  71. package/types/phaser/geom/util/ellipse.d.ts +0 -7
  72. package/types/phaser/geom/util/ellipse.d.ts.map +1 -1
  73. package/types/phaser/geom/util/line.d.ts +0 -36
  74. package/types/phaser/geom/util/line.d.ts.map +1 -1
  75. package/types/phaser/geom/util/matrix.d.ts +0 -14
  76. package/types/phaser/geom/util/matrix.d.ts.map +1 -1
  77. package/types/phaser/geom/util/point.d.ts +0 -137
  78. package/types/phaser/geom/util/point.d.ts.map +1 -1
  79. package/types/phaser/geom/util/polygon.d.ts +0 -6
  80. package/types/phaser/geom/util/polygon.d.ts.map +1 -1
  81. package/types/phaser/geom/util/rectangle.d.ts +0 -106
  82. package/types/phaser/geom/util/rectangle.d.ts.map +1 -1
  83. package/types/phaser/geom/util/rounded_rectangle.d.ts +0 -6
  84. package/types/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
  85. package/types/phaser/util/math.d.ts +3 -134
  86. package/types/phaser/util/math.d.ts.map +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @vpmedia/phaser
2
2
 
3
- [![npm version](https://badge.fury.io/js/@vpmedia%2Fphaser.svg?v=1.68.0)](https://badge.fury.io/js/@vpmedia%2Fphaser)
3
+ [![npm version](https://badge.fury.io/js/@vpmedia%2Fphaser.svg?v=1.69.0)](https://badge.fury.io/js/@vpmedia%2Fphaser)
4
4
  [![Node.js CI](https://github.com/vpmedia/phaser/actions/workflows/ci.yml/badge.svg)](https://github.com/vpmedia/phaser/actions/workflows/ci.yml)
5
5
 
6
6
  @vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vpmedia/phaser",
3
- "version": "1.68.0",
3
+ "version": "1.69.0",
4
4
  "description": "@vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2",
5
5
  "author": "Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)",
6
6
  "license": "MIT",
@@ -22,6 +22,10 @@
22
22
  "main": "./src/index.js",
23
23
  "types": "./types/index.d.ts",
24
24
  "type": "module",
25
+ "dependencies": {
26
+ "@vpmedia/simplify": "^1.14.0",
27
+ "uuid": "^11.0.3"
28
+ },
25
29
  "devDependencies": {
26
30
  "@eslint/js": "^9.15.0",
27
31
  "@jest/globals": "^29.7.0",
@@ -48,8 +52,5 @@
48
52
  "> 0.5%",
49
53
  "not dead",
50
54
  "not op_mini all"
51
- ],
52
- "dependencies": {
53
- "@vpmedia/simplify": "^1.14.0"
54
- }
55
+ ]
55
56
  }
@@ -12,7 +12,7 @@ import { FrameData } from './frame_data.js';
12
12
  * @param {number} spacing - TBD.
13
13
  * @returns {object} TBD.
14
14
  */
15
- export function spriteSheet(game, key, frameWidth, frameHeight, frameMax, margin, spacing) {
15
+ export const spriteSheet = (game, key, frameWidth, frameHeight, frameMax, margin, spacing) => {
16
16
  let img = key;
17
17
  if (typeof key === 'string') {
18
18
  img = game.cache.getImage(key);
@@ -54,7 +54,7 @@ export function spriteSheet(game, key, frameWidth, frameHeight, frameMax, margin
54
54
  }
55
55
  }
56
56
  return data;
57
- }
57
+ };
58
58
 
59
59
  /**
60
60
  * TBD.
@@ -62,7 +62,7 @@ export function spriteSheet(game, key, frameWidth, frameHeight, frameMax, margin
62
62
  * @param {object} json - TBD.
63
63
  * @returns {object} TBD.
64
64
  */
65
- export function JSONDataHash(game, json) {
65
+ export const JSONDataHash = (game, json) => {
66
66
  if (!json.frames) {
67
67
  game.logger.warn('JSONDataHash: Invalid Texture Atlas JSON given, missing frames object', json);
68
68
  return null;
@@ -93,4 +93,4 @@ export function JSONDataHash(game, json) {
93
93
  i += 1;
94
94
  }
95
95
  return data;
96
- }
96
+ };
@@ -9,15 +9,15 @@ const logger = new Logger('device');
9
9
  * @param {string} type - TBD.
10
10
  * @returns {boolean} TBD.
11
11
  */
12
- export function canPlayAudio(device, type) {
12
+ export const canPlayAudio = (device, type) => {
13
13
  return device.supportedAudioFormats[type] === true;
14
- }
14
+ };
15
15
 
16
16
  /**
17
17
  * TBD.
18
18
  * @param {Device} device - TBD.
19
19
  */
20
- export function checkOS(device) {
20
+ export const checkOS = (device) => {
21
21
  const ua = navigator.userAgent;
22
22
  if (/Android/.test(ua)) {
23
23
  device.android = true;
@@ -48,13 +48,13 @@ export function checkOS(device) {
48
48
  if (device.android || device.iOS || device.windowsPhone || (/Windows NT/i.test(ua) && /Touch/i.test(ua))) {
49
49
  device.desktop = false;
50
50
  }
51
- }
51
+ };
52
52
 
53
53
  /**
54
54
  * TBD.
55
55
  * @param {Device} device - TBD.
56
56
  */
57
- export function checkInput(device) {
57
+ export const checkInput = (device) => {
58
58
  if (
59
59
  'ontouchstart' in document.documentElement ||
60
60
  (window.navigator.maxTouchPoints && window.navigator.maxTouchPoints >= 1)
@@ -68,13 +68,13 @@ export function checkInput(device) {
68
68
  if ('onwheel' in window || 'WheelEvent' in window) {
69
69
  device.wheelEvent = 'wheel';
70
70
  }
71
- }
71
+ };
72
72
 
73
73
  /**
74
74
  * TBD.
75
75
  * @param {Device} device - TBD.
76
76
  */
77
- export function checkFullScreenSupport(device) {
77
+ export const checkFullScreenSupport = (device) => {
78
78
  const fs = [
79
79
  'requestFullscreen',
80
80
  'requestFullScreen',
@@ -114,13 +114,13 @@ export function checkFullScreenSupport(device) {
114
114
  device.fullscreenKeyboard = true;
115
115
  }
116
116
  }
117
- }
117
+ };
118
118
 
119
119
  /**
120
120
  * TBD.
121
121
  * @param {Device} device - TBD.
122
122
  */
123
- export function checkBrowser(device) {
123
+ export const checkBrowser = (device) => {
124
124
  const ua = navigator.userAgent;
125
125
  if (/Edge\/\d+/.test(ua)) {
126
126
  device.edge = true;
@@ -131,7 +131,7 @@ export function checkBrowser(device) {
131
131
  } else if (/Safari\/(\d+)/.test(ua) && !device.windowsPhone) {
132
132
  device.safari = true;
133
133
  }
134
- }
134
+ };
135
135
 
136
136
  /**
137
137
  * Check for codec support.
@@ -175,7 +175,7 @@ export const isMediaSourceTypeSupported = (type) => {
175
175
  * @see https://developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements
176
176
  * @see https://bit.ly/iphoneoscodecs
177
177
  */
178
- export function checkAudio(device) {
178
+ export const checkAudio = (device) => {
179
179
  const audioElement = document.createElement('audio');
180
180
  const formats = [
181
181
  { type: 'ogg', codecs: ['audio/ogg; codecs="vorbis"'] },
@@ -194,13 +194,13 @@ export function checkAudio(device) {
194
194
  }
195
195
  }
196
196
  }
197
- }
197
+ };
198
198
 
199
199
  /**
200
200
  * TBD.
201
201
  * @param {Device} device - TBD.
202
202
  */
203
- export function checkImage(device) {
203
+ export const checkImage = (device) => {
204
204
  try {
205
205
  const avif = new Image();
206
206
  avif.src =
@@ -222,25 +222,25 @@ export function checkImage(device) {
222
222
  const typedError = error instanceof Error ? error : new Error(String(error));
223
223
  logger.exception('checkImage error with webp', typedError);
224
224
  }
225
- }
225
+ };
226
226
 
227
227
  /**
228
228
  * TBD.
229
229
  * @param {Device} device - TBD.
230
230
  */
231
- export function initialize(device) {
231
+ export const initialize = (device) => {
232
232
  checkOS(device);
233
233
  checkBrowser(device);
234
234
  checkAudio(device);
235
235
  // checkImage(device);
236
236
  checkFullScreenSupport(device);
237
237
  checkInput(device);
238
- }
238
+ };
239
239
 
240
240
  /**
241
241
  * TBD.
242
242
  * @returns {Device} TBD.
243
243
  */
244
- export function createDevice() {
244
+ export const createDevice = () => {
245
245
  return new Device();
246
- }
246
+ };
@@ -7,11 +7,11 @@ import { FrameData } from './frame_data.js';
7
7
  * @param {Frame} output - TBD.
8
8
  * @returns {Frame} TBD.
9
9
  */
10
- export function cloneFrame(frame, output = null) {
10
+ export const cloneFrame = (frame, output = null) => {
11
11
  const result = output || new Frame(frame.index, frame.x, frame.y, frame.width, frame.height);
12
12
  result.initialize(frame.index, frame.x, frame.y, frame.width, frame.height);
13
13
  return result;
14
- }
14
+ };
15
15
 
16
16
  /**
17
17
  * TBD.
@@ -19,10 +19,10 @@ export function cloneFrame(frame, output = null) {
19
19
  * @param {FrameData} output - TBD.
20
20
  * @returns {FrameData} TBD.
21
21
  */
22
- export function cloneFrameData(frameData, output = null) {
22
+ export const cloneFrameData = (frameData, output = null) => {
23
23
  const result = output || new FrameData();
24
24
  for (let i = 0; i < frameData.total; i += 1) {
25
25
  result.addFrame(frameData.getFrame(i).clone());
26
26
  }
27
27
  return result;
28
- }
28
+ };
@@ -7,13 +7,13 @@ import { Rectangle } from '../geom/rectangle.js';
7
7
  * @param {object} bitmapFontData - TBD.
8
8
  * @returns {object} TBD.
9
9
  */
10
- export function finalizeBitmapFont(baseTexture, bitmapFontData) {
10
+ export const finalizeBitmapFont = (baseTexture, bitmapFontData) => {
11
11
  Object.keys(bitmapFontData.chars).forEach((charCode) => {
12
12
  const letter = bitmapFontData.chars[charCode];
13
13
  letter.texture = new Texture(baseTexture, new Rectangle(letter.x, letter.y, letter.width, letter.height));
14
14
  });
15
15
  return bitmapFontData;
16
- }
16
+ };
17
17
 
18
18
  /**
19
19
  * TBD.
@@ -23,7 +23,7 @@ export function finalizeBitmapFont(baseTexture, bitmapFontData) {
23
23
  * @param {number} ySpacing - TBD.
24
24
  * @returns {object} TBD.
25
25
  */
26
- export function xmlBitmapFont(xml, baseTexture, xSpacing, ySpacing) {
26
+ export const xmlBitmapFont = (xml, baseTexture, xSpacing, ySpacing) => {
27
27
  const data = {};
28
28
  const info = xml.getElementsByTagName('info')[0];
29
29
  const common = xml.getElementsByTagName('common')[0];
@@ -53,7 +53,7 @@ export function xmlBitmapFont(xml, baseTexture, xSpacing, ySpacing) {
53
53
  data.chars[second].kerning[first] = amount;
54
54
  }
55
55
  return finalizeBitmapFont(baseTexture, data);
56
- }
56
+ };
57
57
 
58
58
  /**
59
59
  * TBD.
@@ -63,9 +63,9 @@ export function xmlBitmapFont(xml, baseTexture, xSpacing, ySpacing) {
63
63
  * @param {number} ySpacing - TBD.
64
64
  * @returns {object} TBD.
65
65
  */
66
- export function bitmapFont(xml, baseTexture, xSpacing, ySpacing) {
66
+ export const bitmapFont = (xml, baseTexture, xSpacing, ySpacing) => {
67
67
  return xmlBitmapFont(xml, baseTexture, xSpacing, ySpacing);
68
- }
68
+ };
69
69
 
70
70
  /**
71
71
  * TBD.
@@ -75,7 +75,7 @@ export function bitmapFont(xml, baseTexture, xSpacing, ySpacing) {
75
75
  * @param {number} ySpacing - TBD.
76
76
  * @returns {object} TBD.
77
77
  */
78
- export function jsonBitmapFont(json, baseTexture, xSpacing, ySpacing) {
78
+ export const jsonBitmapFont = (json, baseTexture, xSpacing, ySpacing) => {
79
79
  const data = {
80
80
  font: json.font.info._face,
81
81
  size: parseInt(json.font.info._size, 10),
@@ -101,4 +101,4 @@ export function jsonBitmapFont(json, baseTexture, xSpacing, ySpacing) {
101
101
  });
102
102
  }
103
103
  return finalizeBitmapFont(baseTexture, data);
104
- }
104
+ };
@@ -1,10 +1,10 @@
1
- import { GEOM_POLYGON, GEOM_RECTANGLE, GEOM_CIRCLE, GEOM_ELLIPSE, GEOM_ROUNDED_RECTANGLE } from '../../core/const.js';
1
+ import { GEOM_CIRCLE, GEOM_ELLIPSE, GEOM_POLYGON, GEOM_RECTANGLE, GEOM_ROUNDED_RECTANGLE } from '../../core/const.js';
2
2
 
3
3
  /**
4
4
  * TBD.
5
5
  * @param {object} graphics - TBD.
6
6
  */
7
- export function updateGraphicsTint(graphics) {
7
+ export const updateGraphicsTint = (graphics) => {
8
8
  if (graphics.tint === 0xffffff) {
9
9
  return;
10
10
  }
@@ -24,14 +24,14 @@ export function updateGraphicsTint(graphics) {
24
24
  (((((lineColor >> 8) & 0xff) / 255) * tintG * 255) << 8) +
25
25
  ((lineColor & 0xff) / 255) * tintB * 255;
26
26
  }
27
- }
27
+ };
28
28
 
29
29
  /**
30
30
  * TBD.
31
31
  * @param {object} graphics - TBD.
32
32
  * @param {object} context - TBD.
33
33
  */
34
- export function renderGraphics(graphics, context) {
34
+ export const renderGraphics = (graphics, context) => {
35
35
  const worldAlpha = graphics.worldAlpha;
36
36
  if (graphics.dirty) {
37
37
  updateGraphicsTint(graphics);
@@ -153,14 +153,14 @@ export function renderGraphics(graphics, context) {
153
153
  }
154
154
  }
155
155
  }
156
- }
156
+ };
157
157
 
158
158
  /**
159
159
  * TBD.
160
160
  * @param {object} graphics - TBD.
161
161
  * @param {object} context - TBD.
162
162
  */
163
- export function renderGraphicsMask(graphics, context) {
163
+ export const renderGraphicsMask = (graphics, context) => {
164
164
  const len = graphics.graphicsData.length;
165
165
  if (len === 0) {
166
166
  return;
@@ -224,4 +224,4 @@ export function renderGraphicsMask(graphics, context) {
224
224
  context.closePath();
225
225
  }
226
226
  }
227
- }
227
+ };
@@ -5,7 +5,7 @@ import { renderGraphicsMask } from './graphics.js';
5
5
  * @param {object} maskData - TBD.
6
6
  * @param {object} renderSession - TBD.
7
7
  */
8
- export function pushMask(maskData, renderSession) {
8
+ export const pushMask = (maskData, renderSession) => {
9
9
  const context = renderSession.context;
10
10
  context.save();
11
11
  const cacheAlpha = maskData.alpha;
@@ -22,12 +22,12 @@ export function pushMask(maskData, renderSession) {
22
22
  renderGraphicsMask(maskData, context);
23
23
  context.clip();
24
24
  maskData.worldAlpha = cacheAlpha;
25
- }
25
+ };
26
26
 
27
27
  /**
28
28
  * TBD.
29
29
  * @param {object} renderSession - TBD.
30
30
  */
31
- export function popMask(renderSession) {
31
+ export const popMask = (renderSession) => {
32
32
  renderSession.context.restore();
33
- }
33
+ };
@@ -2,7 +2,7 @@
2
2
  * TBD.
3
3
  * @returns {object[]} TBD.
4
4
  */
5
- export function getPool() {
5
+ export const getPool = () => {
6
6
  if (!window.PhaserRegistry) {
7
7
  window.PhaserRegistry = {};
8
8
  }
@@ -10,13 +10,13 @@ export function getPool() {
10
10
  window.PhaserRegistry.CANVAS_POOL = [];
11
11
  }
12
12
  return window.PhaserRegistry.CANVAS_POOL;
13
- }
13
+ };
14
14
 
15
15
  /**
16
16
  * TBD.
17
17
  * @returns {object} TBD.
18
18
  */
19
- export function getFirst() {
19
+ export const getFirst = () => {
20
20
  const pool = getPool();
21
21
  for (let i = 0; i < pool.length; i += 1) {
22
22
  if (!pool[i].parent) {
@@ -24,13 +24,13 @@ export function getFirst() {
24
24
  }
25
25
  }
26
26
  return -1;
27
- }
27
+ };
28
28
 
29
29
  /**
30
30
  * TBD.
31
31
  * @param {object} parent - TBD.
32
32
  */
33
- export function remove(parent) {
33
+ export const remove = (parent) => {
34
34
  const pool = getPool();
35
35
  for (let i = 0; i < pool.length; i += 1) {
36
36
  if (pool[i].parent === parent) {
@@ -39,13 +39,13 @@ export function remove(parent) {
39
39
  pool[i].canvas.height = 1;
40
40
  }
41
41
  }
42
- }
42
+ };
43
43
 
44
44
  /**
45
45
  * TBD.
46
46
  * @param {HTMLCanvasElement} canvas - TBD.
47
47
  */
48
- export function removeByCanvas(canvas) {
48
+ export const removeByCanvas = (canvas) => {
49
49
  const pool = getPool();
50
50
  for (let i = 0; i < pool.length; i += 1) {
51
51
  if (pool[i].canvas === canvas) {
@@ -54,13 +54,13 @@ export function removeByCanvas(canvas) {
54
54
  pool[i].canvas.height = 1;
55
55
  }
56
56
  }
57
- }
57
+ };
58
58
 
59
59
  /**
60
60
  * TBD.
61
61
  * @returns {number} TBD.
62
62
  */
63
- export function getTotal() {
63
+ export const getTotal = () => {
64
64
  const pool = getPool();
65
65
  let c = 0;
66
66
  for (let i = 0; i < pool.length; i += 1) {
@@ -69,13 +69,13 @@ export function getTotal() {
69
69
  }
70
70
  }
71
71
  return c;
72
- }
72
+ };
73
73
 
74
74
  /**
75
75
  * TBD.
76
76
  * @returns {number} TBD.
77
77
  */
78
- export function getFree() {
78
+ export const getFree = () => {
79
79
  const pool = getPool();
80
80
  let c = 0;
81
81
  for (let i = 0; i < pool.length; i += 1) {
@@ -84,7 +84,7 @@ export function getFree() {
84
84
  }
85
85
  }
86
86
  return c;
87
- }
87
+ };
88
88
 
89
89
  /**
90
90
  * TBD.
@@ -94,7 +94,7 @@ export function getFree() {
94
94
  * @param {boolean} skipPool - TBD.
95
95
  * @returns {HTMLCanvasElement} TBD.
96
96
  */
97
- export function create(parent, width, height, skipPool = false) {
97
+ export const create = (parent, width, height, skipPool = false) => {
98
98
  if (parent === undefined) {
99
99
  console.warn('Created CanvasPool element with undefined parent.');
100
100
  }
@@ -117,4 +117,4 @@ export function create(parent, width, height, skipPool = false) {
117
117
  canvas.height = height;
118
118
  }
119
119
  return canvas;
120
- }
120
+ };
@@ -7,11 +7,11 @@ import { create, removeByCanvas } from './pool.js';
7
7
  * @param {object} color - TBD.
8
8
  * @returns {object} TBD.
9
9
  */
10
- export function getTintedTexture(sprite, color) {
10
+ export const getTintedTexture = (sprite, color) => {
11
11
  const canvas = sprite.tintedTexture || create('CanvasTinter', 1, 1);
12
12
  window.PhaserRegistry.CANVAS_TINT_METHOD(sprite.texture, color, canvas);
13
13
  return canvas;
14
- }
14
+ };
15
15
 
16
16
  /**
17
17
  * TBD.
@@ -19,7 +19,7 @@ export function getTintedTexture(sprite, color) {
19
19
  * @param {object} color - TBD.
20
20
  * @param {HTMLCanvasElement} canvas - TBD.
21
21
  */
22
- export function tintWithMultiply(texture, color, canvas) {
22
+ export const tintWithMultiply = (texture, color, canvas) => {
23
23
  const context = canvas.getContext('2d', { willReadFrequently: false });
24
24
  const crop = texture.crop;
25
25
  if (canvas.width !== crop.width || canvas.height !== crop.height) {
@@ -33,7 +33,7 @@ export function tintWithMultiply(texture, color, canvas) {
33
33
  context.drawImage(texture.baseTexture.source, crop.x, crop.y, crop.width, crop.height, 0, 0, crop.width, crop.height);
34
34
  context.globalCompositeOperation = 'destination-atop';
35
35
  context.drawImage(texture.baseTexture.source, crop.x, crop.y, crop.width, crop.height, 0, 0, crop.width, crop.height);
36
- }
36
+ };
37
37
 
38
38
  /**
39
39
  * TBD.
@@ -41,7 +41,7 @@ export function tintWithMultiply(texture, color, canvas) {
41
41
  * @param {object} color - TBD.
42
42
  * @param {HTMLCanvasElement} canvas - TBD.
43
43
  */
44
- export function tintWithPerPixel(texture, color, canvas) {
44
+ export const tintWithPerPixel = (texture, color, canvas) => {
45
45
  const context = canvas.getContext('2d', { willReadFrequently: false });
46
46
  const crop = texture.crop;
47
47
  canvas.width = crop.width;
@@ -67,15 +67,14 @@ export function tintWithPerPixel(texture, color, canvas) {
67
67
  }
68
68
  }
69
69
  context.putImageData(pixelData, 0, 0);
70
- }
70
+ };
71
71
 
72
72
  /**
73
73
  * TBD.
74
- * @param {import('../../core/game.js').Game} game - TBD.
75
74
  * @returns {boolean} TBD.
76
75
  * @throws {Error} TBD.
77
76
  */
78
- export function checkInverseAlpha(game) {
77
+ export const checkInverseAlpha = () => {
79
78
  // Check for DOM
80
79
  if (document === undefined) {
81
80
  throw new Error('Error getting Document for checkInverseAlpha()');
@@ -110,15 +109,14 @@ export function checkInverseAlpha(game) {
110
109
  return (
111
110
  s2.data[0] === s1.data[0] && s2.data[1] === s1.data[1] && s2.data[2] === s1.data[2] && s2.data[3] === s1.data[3]
112
111
  );
113
- }
112
+ };
114
113
 
115
114
  /**
116
115
  * TBD.
117
- * @param {import('../../core/game.js').Game} game - TBD.
118
116
  * @returns {boolean} TBD.
119
117
  * @throws {Error} TBD.
120
118
  */
121
- export function canUseNewCanvasBlendModes(game) {
119
+ export const canUseNewCanvasBlendModes = () => {
122
120
  // Check for DOM
123
121
  if (document === undefined) {
124
122
  throw new Error('Error getting Document for canUseNewCanvasBlendModes()');
@@ -153,24 +151,24 @@ export function canUseNewCanvasBlendModes(game) {
153
151
  removeByCanvas(canvas);
154
152
  // Compare and return
155
153
  return data[0] === 255 && data[1] === 0 && data[2] === 0;
156
- }
154
+ };
157
155
 
158
156
  /**
159
157
  * TBD.
160
158
  * @param {import('../../core/game.js').Game} game - TBD.
161
159
  */
162
- export function detectCapabilities(game) {
160
+ export const detectCapabilities = (game) => {
163
161
  if (!window.PhaserRegistry) {
164
162
  window.PhaserRegistry = {};
165
163
  }
166
164
  try {
167
- window.PhaserRegistry.CAN_CANVAS_HANDLE_ALPHA = checkInverseAlpha(game);
165
+ window.PhaserRegistry.CAN_CANVAS_HANDLE_ALPHA = checkInverseAlpha();
168
166
  } catch (error) {
169
167
  game.exceptionHandler(error);
170
168
  window.PhaserRegistry.CAN_CANVAS_HANDLE_ALPHA = false;
171
169
  }
172
170
  try {
173
- window.PhaserRegistry.CAN_CANVAS_USE_MULTIPLY = canUseNewCanvasBlendModes(game);
171
+ window.PhaserRegistry.CAN_CANVAS_USE_MULTIPLY = canUseNewCanvasBlendModes();
174
172
  } catch (error) {
175
173
  game.exceptionHandler(error);
176
174
  window.PhaserRegistry.CAN_CANVAS_USE_MULTIPLY = false;
@@ -178,4 +176,4 @@ export function detectCapabilities(game) {
178
176
  window.PhaserRegistry.CANVAS_TINT_METHOD = window.PhaserRegistry.CAN_CANVAS_USE_MULTIPLY
179
177
  ? tintWithMultiply
180
178
  : tintWithPerPixel;
181
- }
179
+ };