@vpmedia/phaser 1.44.0 → 1.46.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.
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/phaser/core/animation_manager.js +2 -2
- package/src/phaser/core/game.js +1 -5
- package/src/phaser/core/sound_manager.js +2 -1
- package/src/phaser/display/canvas/renderer.js +1 -1
- package/src/phaser/display/display_object.js +1 -1
- package/src/phaser/display/webgl/renderer.js +1 -1
- package/src/phaser/display/webgl/util.js +6 -4
- package/src/phaser/geom/util/point.js +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @vpmedia/phaser
|
|
2
2
|
|
|
3
|
-
[](https://badge.fury.io/js/@vpmedia%2Fphaser)
|
|
4
4
|
[](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.
|
|
3
|
+
"version": "1.46.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",
|
|
@@ -306,7 +306,7 @@ export class AnimationManager {
|
|
|
306
306
|
this.sprite.setFrame(this.currentFrame);
|
|
307
307
|
}
|
|
308
308
|
} else {
|
|
309
|
-
this.game.exceptionHandler(new Error('Cannot set frame'), { key: value });
|
|
309
|
+
this.game.exceptionHandler(new Error('Cannot set frame'), { 'asset.key': value });
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
312
|
|
|
@@ -332,7 +332,7 @@ export class AnimationManager {
|
|
|
332
332
|
this.sprite.setFrame(this.currentFrame);
|
|
333
333
|
}
|
|
334
334
|
} else {
|
|
335
|
-
this.game.exceptionHandler(new Error('Cannot set frameName'), { key: value });
|
|
335
|
+
this.game.exceptionHandler(new Error('Cannot set frameName'), { 'asset.key': value });
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
338
|
}
|
package/src/phaser/core/game.js
CHANGED
|
@@ -145,11 +145,7 @@ export class Game {
|
|
|
145
145
|
isWebGlReady = true;
|
|
146
146
|
} catch (e) {
|
|
147
147
|
isWebGlReady = false;
|
|
148
|
-
const tags = {
|
|
149
|
-
'document.readyState': document.readyState,
|
|
150
|
-
'document.hidden': document.hidden,
|
|
151
|
-
'document.visibilityState': document.visibilityState,
|
|
152
|
-
};
|
|
148
|
+
const tags = {};
|
|
153
149
|
if (window.PhaserRegistry?.GL_PROGRAM_INFO_LOG) {
|
|
154
150
|
tags.gl_program_log = window.PhaserRegistry.GL_PROGRAM_INFO_LOG;
|
|
155
151
|
}
|
|
@@ -61,6 +61,7 @@ export class SoundManager {
|
|
|
61
61
|
this.context === null ||
|
|
62
62
|
(this.context && this.context.createGain === undefined && this.context.createGainNode === undefined)
|
|
63
63
|
) {
|
|
64
|
+
this.game.exceptionHandler(new Error('Error creating AudioContext'));
|
|
64
65
|
this.noAudio = true;
|
|
65
66
|
return;
|
|
66
67
|
}
|
|
@@ -220,7 +221,7 @@ export class SoundManager {
|
|
|
220
221
|
this.game.cache.decodedSound(key, buffer);
|
|
221
222
|
})
|
|
222
223
|
.catch((e) => {
|
|
223
|
-
this.game.exceptionHandler(e, { key });
|
|
224
|
+
this.game.exceptionHandler(e, { 'asset.key': key });
|
|
224
225
|
});
|
|
225
226
|
}
|
|
226
227
|
}
|
|
@@ -42,7 +42,7 @@ export class CanvasRenderer {
|
|
|
42
42
|
this.view = game.canvas;
|
|
43
43
|
this.context = this.view.getContext('2d', { alpha: this.transparent });
|
|
44
44
|
if (!this.context) {
|
|
45
|
-
throw new Error('Error creating
|
|
45
|
+
throw new Error('Error creating Canvas2D context');
|
|
46
46
|
}
|
|
47
47
|
this.refresh = true;
|
|
48
48
|
this.count = 0;
|
|
@@ -111,7 +111,7 @@ export class DisplayObject {
|
|
|
111
111
|
const index1 = this.getChildIndex(child);
|
|
112
112
|
const index2 = this.getChildIndex(child2);
|
|
113
113
|
if (index1 < 0 || index2 < 0) {
|
|
114
|
-
throw new Error('swapChildren: Both the supplied DisplayObjects must be a child of the caller
|
|
114
|
+
throw new Error('swapChildren: Both the supplied DisplayObjects must be a child of the caller');
|
|
115
115
|
}
|
|
116
116
|
this.children[index1] = child2;
|
|
117
117
|
this.children[index2] = child;
|
|
@@ -128,7 +128,7 @@ export class WebGLRenderer {
|
|
|
128
128
|
this.gl = gl;
|
|
129
129
|
if (!gl) {
|
|
130
130
|
// fail, not able to get a context
|
|
131
|
-
throw new Error('
|
|
131
|
+
throw new Error('Error creating WebGL context');
|
|
132
132
|
}
|
|
133
133
|
this.initRegistry();
|
|
134
134
|
this.glContextId = window.PhaserRegistry.GL_CONTEXT_ID;
|
|
@@ -19,9 +19,10 @@ export function compileShader(gl, shaderSrc, shaderType) {
|
|
|
19
19
|
gl.shaderSource(shader, src);
|
|
20
20
|
gl.compileShader(shader);
|
|
21
21
|
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
|
|
22
|
-
if (window.PhaserRegistry) {
|
|
23
|
-
window.PhaserRegistry
|
|
22
|
+
if (!window.PhaserRegistry) {
|
|
23
|
+
window.PhaserRegistry = {};
|
|
24
24
|
}
|
|
25
|
+
window.PhaserRegistry.GL_SHADER_INFO_LOG = gl.getShaderInfoLog(shader);
|
|
25
26
|
return null;
|
|
26
27
|
}
|
|
27
28
|
return shader;
|
|
@@ -65,9 +66,10 @@ export function compileProgram(gl, vertexSrc, fragmentSrc) {
|
|
|
65
66
|
gl.linkProgram(shaderProgram);
|
|
66
67
|
|
|
67
68
|
if (!gl.getProgramParameter(shaderProgram, gl.LINK_STATUS)) {
|
|
68
|
-
if (window.PhaserRegistry) {
|
|
69
|
-
window.PhaserRegistry
|
|
69
|
+
if (!window.PhaserRegistry) {
|
|
70
|
+
window.PhaserRegistry = {};
|
|
70
71
|
}
|
|
72
|
+
window.PhaserRegistry.GL_PROGRAM_INFO_LOG = gl.getProgramInfoLog(shaderProgram);
|
|
71
73
|
}
|
|
72
74
|
return shaderProgram;
|
|
73
75
|
}
|
|
@@ -248,7 +248,7 @@ export function centroid(points, output = null) {
|
|
|
248
248
|
const result = output || new Point();
|
|
249
249
|
const pointsLen = points.length;
|
|
250
250
|
if (pointsLen < 1) {
|
|
251
|
-
throw new Error('Point(points) array must not be empty
|
|
251
|
+
throw new Error('Point(points) array must not be empty');
|
|
252
252
|
}
|
|
253
253
|
if (pointsLen === 1) {
|
|
254
254
|
result.copyFrom(points[0]);
|