@vpmedia/phaser 1.43.0 → 1.44.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/CHANGES.md +4 -0
- package/README.md +1 -1
- package/eslint.config.js +80 -0
- package/lefthook.yml +1 -6
- package/package.json +14 -17
- package/src/index.js +34 -69
- package/src/phaser/core/animation_parser.js +1 -1
- package/src/phaser/core/game.js +27 -12
- package/src/phaser/core/input.js +2 -2
- package/src/phaser/core/loader.js +11 -11
- package/src/phaser/core/scale_manager.js +5 -5
- package/src/phaser/core/signal.js +6 -6
- package/src/phaser/core/signal_binding.js +1 -1
- package/src/phaser/core/sound.js +1 -1
- package/src/phaser/core/sound_sprite.js +1 -1
- package/src/phaser/display/bitmap_text.js +1 -1
- package/src/phaser/display/button.js +2 -2
- package/src/phaser/display/canvas/graphics.js +10 -10
- package/src/phaser/display/canvas/renderer.js +2 -2
- package/src/phaser/display/canvas/tinter.js +3 -3
- package/src/phaser/display/canvas/util.js +3 -3
- package/src/phaser/display/display_object.js +4 -4
- package/src/phaser/display/text.js +9 -9
- package/src/phaser/display/webgl/renderer.js +2 -2
- package/src/phaser/display/webgl/shader/normal.js +3 -3
- package/src/phaser/display/webgl/texture.js +1 -1
- package/src/phaser/geom/circle.js +1 -1
- package/src/phaser/geom/ellipse.js +1 -1
- package/src/phaser/geom/point.js +1 -1
- package/src/phaser/geom/rectangle.js +11 -11
- package/src/phaser/util/math.js +1 -1
package/CHANGES.md
CHANGED
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/eslint.config.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import jsdocPlugin from 'eslint-plugin-jsdoc';
|
|
3
|
+
import unicornPlugin from 'eslint-plugin-unicorn';
|
|
4
|
+
import globals from 'globals';
|
|
5
|
+
|
|
6
|
+
/** @type { import('eslint').Linter.Config[] } */
|
|
7
|
+
export default [
|
|
8
|
+
{
|
|
9
|
+
ignores: [
|
|
10
|
+
'.github/**/*.*',
|
|
11
|
+
'.idea/**/*.*',
|
|
12
|
+
'.vscode/**/*.*',
|
|
13
|
+
'build/**/*.*',
|
|
14
|
+
'coverage/**/*.*',
|
|
15
|
+
'dist/**/*.*',
|
|
16
|
+
'public/**/*.*',
|
|
17
|
+
'types/**/*.*',
|
|
18
|
+
'node_modules/**/*.*',
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
languageOptions: {
|
|
23
|
+
globals: {
|
|
24
|
+
...globals.jest,
|
|
25
|
+
...globals.browser,
|
|
26
|
+
...globals.node,
|
|
27
|
+
...globals.es2021,
|
|
28
|
+
},
|
|
29
|
+
parserOptions: {
|
|
30
|
+
ecmaVersion: 'latest',
|
|
31
|
+
sourceType: 'module',
|
|
32
|
+
ecmaFeatures: {
|
|
33
|
+
jsx: true,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
files: ['**/*.{js,jsx,mjs,cjs,ts,tsx}'],
|
|
38
|
+
plugins: {
|
|
39
|
+
jsdoc: jsdocPlugin,
|
|
40
|
+
unicorn: unicornPlugin,
|
|
41
|
+
},
|
|
42
|
+
settings: {
|
|
43
|
+
'import/parsers': {
|
|
44
|
+
espree: ['.js', '.cjs', '.mjs', '.jsx'],
|
|
45
|
+
},
|
|
46
|
+
'import/resolver': {
|
|
47
|
+
node: true,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
rules: {
|
|
51
|
+
...js.configs.recommended.rules,
|
|
52
|
+
...jsdocPlugin.configs['flat/recommended'].rules,
|
|
53
|
+
'no-unused-vars': 'off',
|
|
54
|
+
'prefer-arrow-callback': 'warn',
|
|
55
|
+
'prefer-template': 'warn',
|
|
56
|
+
'jsdoc/require-jsdoc': [
|
|
57
|
+
'warn',
|
|
58
|
+
{
|
|
59
|
+
require: {
|
|
60
|
+
FunctionDeclaration: true,
|
|
61
|
+
MethodDefinition: true,
|
|
62
|
+
ClassDeclaration: false,
|
|
63
|
+
ArrowFunctionExpression: false,
|
|
64
|
+
FunctionExpression: false,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
'jsdoc/check-indentation': 1,
|
|
69
|
+
'jsdoc/check-line-alignment': 1,
|
|
70
|
+
'jsdoc/check-syntax': 1,
|
|
71
|
+
'jsdoc/require-asterisk-prefix': 1,
|
|
72
|
+
'jsdoc/require-description': 1,
|
|
73
|
+
'jsdoc/require-description-complete-sentence': 1,
|
|
74
|
+
'jsdoc/require-hyphen-before-param-description': 1,
|
|
75
|
+
'jsdoc/require-throws': 1,
|
|
76
|
+
'jsdoc/sort-tags': 1,
|
|
77
|
+
'jsdoc/no-undefined-types': 0,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
];
|
package/lefthook.yml
CHANGED
|
@@ -10,13 +10,8 @@ pre-commit:
|
|
|
10
10
|
run: |
|
|
11
11
|
set -e
|
|
12
12
|
yq 'true' {staged_files} > /dev/null
|
|
13
|
-
lint_json:
|
|
14
|
-
glob: "*.{json}"
|
|
15
|
-
run: |
|
|
16
|
-
set -e
|
|
17
|
-
jq empty {staged_files}
|
|
18
13
|
lint_js:
|
|
19
|
-
glob: "*.{js,
|
|
14
|
+
glob: "*.{js,jsx}"
|
|
20
15
|
run: |
|
|
21
16
|
set -e
|
|
22
17
|
./node_modules/.bin/eslint {staged_files}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vpmedia/phaser",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.44.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",
|
|
@@ -23,33 +23,30 @@
|
|
|
23
23
|
"types": "./types/index.d.ts",
|
|
24
24
|
"type": "module",
|
|
25
25
|
"devDependencies": {
|
|
26
|
+
"@eslint/js": "^9.12.0",
|
|
26
27
|
"@jest/globals": "^29.7.0",
|
|
27
|
-
"@types/jest": "^29.5.
|
|
28
|
-
"eslint": "^
|
|
29
|
-
"eslint-plugin-
|
|
30
|
-
"eslint-plugin-
|
|
31
|
-
"
|
|
28
|
+
"@types/jest": "^29.5.13",
|
|
29
|
+
"eslint": "^9.12.0",
|
|
30
|
+
"eslint-plugin-jsdoc": "^50.3.1",
|
|
31
|
+
"eslint-plugin-unicorn": "^56.0.0",
|
|
32
|
+
"globals": "^15.11.0",
|
|
32
33
|
"jest": "^29.7.0",
|
|
33
34
|
"jest-environment-jsdom": "^29.7.0",
|
|
34
|
-
"lefthook": "^1.
|
|
35
|
-
"prettier": "^3.
|
|
36
|
-
"typescript": "^5.
|
|
35
|
+
"lefthook": "^1.7.18",
|
|
36
|
+
"prettier": "^3.3.3",
|
|
37
|
+
"typescript": "^5.6.3"
|
|
37
38
|
},
|
|
38
39
|
"scripts": {
|
|
39
40
|
"test": "NODE_OPTIONS=--experimental-vm-modules jest --passWithNoTests",
|
|
40
|
-
"lint": "eslint
|
|
41
|
+
"lint": "eslint \"**/*.{js,jsx}\"",
|
|
41
42
|
"typecheck": "tsc",
|
|
42
|
-
"format": "prettier --write \"
|
|
43
|
+
"format": "prettier --write \"./**/*.{js,jsx,mjs,cjs,ts,tsx,json,md,css}\"",
|
|
43
44
|
"lefthook:install": "lefthook install",
|
|
44
45
|
"lefthook:uninstall": "lefthook uninstall"
|
|
45
46
|
},
|
|
46
47
|
"browserslist": [
|
|
47
|
-
">
|
|
48
|
+
"> 0.5%",
|
|
48
49
|
"not dead",
|
|
49
50
|
"not op_mini all"
|
|
50
|
-
]
|
|
51
|
-
"engines": {
|
|
52
|
-
"npm": ">=8.0.0",
|
|
53
|
-
"node": ">=18.0.0"
|
|
54
|
-
}
|
|
51
|
+
]
|
|
55
52
|
}
|
package/src/index.js
CHANGED
|
@@ -1,77 +1,42 @@
|
|
|
1
1
|
// core
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
export * as Const from './phaser/core/const.js';
|
|
3
|
+
export { GameObjectFactory } from './phaser/core/factory.js';
|
|
4
|
+
export { Game } from './phaser/core/game.js';
|
|
5
|
+
export { Signal } from './phaser/core/signal.js';
|
|
6
|
+
export * as MathUtils from './phaser/util/math.js';
|
|
7
7
|
// sound
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
export { Sound } from './phaser/core/sound.js';
|
|
9
|
+
export { SoundManager } from './phaser/core/sound_manager.js';
|
|
10
|
+
export { SoundSprite } from './phaser/core/sound_sprite.js';
|
|
11
11
|
// time
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
export { Time } from './phaser/core/time.js';
|
|
13
|
+
export { Timer } from './phaser/core/timer.js';
|
|
14
|
+
export { TimerEvent } from './phaser/core/timer_event.js';
|
|
15
15
|
// tween
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
export { Tween } from './phaser/core/tween.js';
|
|
17
|
+
export { TweenData } from './phaser/core/tween_data.js';
|
|
18
|
+
export { TweenManager } from './phaser/core/tween_manager.js';
|
|
19
19
|
// animation
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
export { Animation } from './phaser/core/animation.js';
|
|
21
|
+
export { AnimationManager } from './phaser/core/animation_manager.js';
|
|
22
22
|
// texture
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
export { BaseTexture } from './phaser/display/webgl/base_texture.js';
|
|
24
|
+
export { Texture } from './phaser/display/webgl/texture.js';
|
|
25
25
|
// geom
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
export { Circle } from './phaser/geom/circle.js';
|
|
27
|
+
export { Ellipse } from './phaser/geom/ellipse.js';
|
|
28
|
+
export { Line } from './phaser/geom/line.js';
|
|
29
|
+
export { Matrix } from './phaser/geom/matrix.js';
|
|
30
|
+
export { Point } from './phaser/geom/point.js';
|
|
31
|
+
export { Polygon } from './phaser/geom/polygon.js';
|
|
32
|
+
export { Rectangle } from './phaser/geom/rectangle.js';
|
|
33
|
+
export { RoundedRectangle } from './phaser/geom/rounded_rectangle.js';
|
|
34
34
|
// display
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
export {
|
|
44
|
-
Const,
|
|
45
|
-
Game,
|
|
46
|
-
GameObjectFactory,
|
|
47
|
-
Signal,
|
|
48
|
-
MathUtils,
|
|
49
|
-
BaseTexture,
|
|
50
|
-
Sound,
|
|
51
|
-
SoundSprite,
|
|
52
|
-
SoundManager,
|
|
53
|
-
Time,
|
|
54
|
-
Timer,
|
|
55
|
-
TimerEvent,
|
|
56
|
-
Tween,
|
|
57
|
-
TweenData,
|
|
58
|
-
TweenManager,
|
|
59
|
-
Animation,
|
|
60
|
-
AnimationManager,
|
|
61
|
-
Texture,
|
|
62
|
-
Circle,
|
|
63
|
-
Ellipse,
|
|
64
|
-
Line,
|
|
65
|
-
Matrix,
|
|
66
|
-
Point,
|
|
67
|
-
Polygon,
|
|
68
|
-
Rectangle,
|
|
69
|
-
RoundedRectangle,
|
|
70
|
-
BitmapText,
|
|
71
|
-
Button,
|
|
72
|
-
DisplayObject,
|
|
73
|
-
Image,
|
|
74
|
-
Group,
|
|
75
|
-
Text,
|
|
76
|
-
Graphics,
|
|
77
|
-
};
|
|
35
|
+
export { BitmapText } from './phaser/display/bitmap_text.js';
|
|
36
|
+
export { Button } from './phaser/display/button.js';
|
|
37
|
+
export { DisplayObject } from './phaser/display/display_object.js';
|
|
38
|
+
export { Graphics } from './phaser/display/graphics.js';
|
|
39
|
+
export { Group } from './phaser/display/group.js';
|
|
40
|
+
export { Image } from './phaser/display/image.js';
|
|
41
|
+
export { Text } from './phaser/display/text.js';
|
|
42
|
+
|
|
@@ -37,7 +37,7 @@ export function spriteSheet(game, key, frameWidth, frameHeight, frameMax, margin
|
|
|
37
37
|
// Zero or smaller than frame sizes?
|
|
38
38
|
if (width === 0 || height === 0 || width < frameWidth || height < frameHeight || total === 0) {
|
|
39
39
|
console.warn(
|
|
40
|
-
|
|
40
|
+
`AnimationParser.spriteSheet: '${ key }'s width/height zero or width/height < given frameWidth/frameHeight`
|
|
41
41
|
);
|
|
42
42
|
return null;
|
|
43
43
|
}
|
package/src/phaser/core/game.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { CanvasRenderer } from '../display/canvas/renderer.js';
|
|
2
|
+
import { addToDOM, create, removeFromDOM, setTouchAction } from '../display/canvas/util.js';
|
|
2
3
|
import { WebGLRenderer } from '../display/webgl/renderer.js';
|
|
3
|
-
import { Signal } from './signal.js';
|
|
4
|
-
import { Loader } from './loader.js';
|
|
5
4
|
import { Cache } from './cache.js';
|
|
6
|
-
import {
|
|
5
|
+
import { RENDER_AUTO, RENDER_WEBGL } from './const.js';
|
|
7
6
|
import { Device } from './device.js';
|
|
7
|
+
import { checkOS, initialize } from './device_util.js';
|
|
8
8
|
import { GameObjectFactory } from './factory.js';
|
|
9
|
+
import { Input } from './input.js';
|
|
10
|
+
import { Loader } from './loader.js';
|
|
9
11
|
import { RequestAnimationFrame } from './raf.js';
|
|
10
12
|
import { ScaleManager } from './scale_manager.js';
|
|
11
|
-
import { SoundManager } from './sound_manager.js';
|
|
12
13
|
import { SceneManager } from './scene_manager.js';
|
|
14
|
+
import { Signal } from './signal.js';
|
|
15
|
+
import { SoundManager } from './sound_manager.js';
|
|
16
|
+
import { Stage } from './stage.js';
|
|
13
17
|
import { Time } from './time.js';
|
|
14
18
|
import { TweenManager } from './tween_manager.js';
|
|
15
19
|
import { World } from './world.js';
|
|
16
|
-
import { Stage } from './stage.js';
|
|
17
|
-
import { RENDER_AUTO, RENDER_WEBGL } from './const.js';
|
|
18
|
-
import { create, removeFromDOM, addToDOM, setTouchAction } from '../display/canvas/util.js';
|
|
19
|
-
import { initialize, checkOS } from './device_util.js';
|
|
20
20
|
|
|
21
21
|
export class Game {
|
|
22
22
|
/**
|
|
@@ -48,7 +48,9 @@ export class Game {
|
|
|
48
48
|
this.tweens = null;
|
|
49
49
|
this.world = null;
|
|
50
50
|
this.device = new Device();
|
|
51
|
+
/** @type {HTMLCanvasElement} */
|
|
51
52
|
this.canvas = null;
|
|
53
|
+
/** @type {RenderingContext} */
|
|
52
54
|
this.context = null;
|
|
53
55
|
this.onPause = new Signal();
|
|
54
56
|
this.onResume = new Signal();
|
|
@@ -110,7 +112,10 @@ export class Game {
|
|
|
110
112
|
/**
|
|
111
113
|
* TBD.
|
|
112
114
|
*/
|
|
113
|
-
|
|
115
|
+
createRendererCanvas() {
|
|
116
|
+
if (this.canvas) {
|
|
117
|
+
removeFromDOM(this.canvas);
|
|
118
|
+
}
|
|
114
119
|
if (this.config.canvas) {
|
|
115
120
|
this.canvas = this.config.canvas;
|
|
116
121
|
} else {
|
|
@@ -121,6 +126,13 @@ export class Game {
|
|
|
121
126
|
} else {
|
|
122
127
|
this.canvas.style['-webkit-full-screen'] = 'width: 100%; height: 100%';
|
|
123
128
|
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* TBD.
|
|
133
|
+
*/
|
|
134
|
+
initRenderer() {
|
|
135
|
+
this.createRendererCanvas();
|
|
124
136
|
let isWebGlReady = false;
|
|
125
137
|
if (this.config.renderType === RENDER_AUTO || this.config.renderType === RENDER_WEBGL) {
|
|
126
138
|
try {
|
|
@@ -133,7 +145,11 @@ export class Game {
|
|
|
133
145
|
isWebGlReady = true;
|
|
134
146
|
} catch (e) {
|
|
135
147
|
isWebGlReady = false;
|
|
136
|
-
const tags = {
|
|
148
|
+
const tags = {
|
|
149
|
+
'document.readyState': document.readyState,
|
|
150
|
+
'document.hidden': document.hidden,
|
|
151
|
+
'document.visibilityState': document.visibilityState,
|
|
152
|
+
};
|
|
137
153
|
if (window.PhaserRegistry?.GL_PROGRAM_INFO_LOG) {
|
|
138
154
|
tags.gl_program_log = window.PhaserRegistry.GL_PROGRAM_INFO_LOG;
|
|
139
155
|
}
|
|
@@ -159,9 +175,8 @@ export class Game {
|
|
|
159
175
|
this.canvas.removeEventListener('webglcontextlost', this.contextRestoredBinded, false);
|
|
160
176
|
}
|
|
161
177
|
this.renderer.destroy();
|
|
162
|
-
removeFromDOM(this.canvas);
|
|
163
|
-
this.canvas = create(this, this.width, this.height, this.config.canvasID, true);
|
|
164
178
|
}
|
|
179
|
+
this.createRendererCanvas();
|
|
165
180
|
this.renderer = new CanvasRenderer(this);
|
|
166
181
|
this.context = this.renderer.context;
|
|
167
182
|
}
|
package/src/phaser/core/input.js
CHANGED
|
@@ -162,13 +162,13 @@ export class Input {
|
|
|
162
162
|
*/
|
|
163
163
|
addPointer() {
|
|
164
164
|
if (this.pointers.length >= MAX_POINTERS) {
|
|
165
|
-
console.warn(
|
|
165
|
+
console.warn(`Input.addPointer: Maximum limit of ${ MAX_POINTERS } pointers reached.`);
|
|
166
166
|
return null;
|
|
167
167
|
}
|
|
168
168
|
const id = this.pointers.length + 1;
|
|
169
169
|
const pointer = new Pointer(this.game, id, POINTER_CONTACT);
|
|
170
170
|
this.pointers.push(pointer);
|
|
171
|
-
this[
|
|
171
|
+
this[`pointer${ id}`] = pointer;
|
|
172
172
|
return pointer;
|
|
173
173
|
}
|
|
174
174
|
|
|
@@ -163,14 +163,14 @@ export class Loader {
|
|
|
163
163
|
*/
|
|
164
164
|
addToFileList(type, key = '', url = null, properties = null, overwrite = false, extension = null) {
|
|
165
165
|
if (key === undefined || key === '') {
|
|
166
|
-
console.warn(
|
|
166
|
+
console.warn(`Loader: Invalid or no key given of type ${ type}`);
|
|
167
167
|
return this;
|
|
168
168
|
}
|
|
169
169
|
if (url === undefined || url === null) {
|
|
170
170
|
if (extension) {
|
|
171
171
|
url = key + extension;
|
|
172
172
|
} else {
|
|
173
|
-
console.warn(
|
|
173
|
+
console.warn(`Loader: No URL given for file type: ${ type } key: ${ key}`);
|
|
174
174
|
return this;
|
|
175
175
|
}
|
|
176
176
|
}
|
|
@@ -376,12 +376,12 @@ export class Loader {
|
|
|
376
376
|
}
|
|
377
377
|
this.audio(key, urls, autoDecode);
|
|
378
378
|
if (jsonURL) {
|
|
379
|
-
this.json(key
|
|
379
|
+
this.json(`${key }-audioatlas`, jsonURL);
|
|
380
380
|
} else if (jsonData) {
|
|
381
381
|
if (typeof jsonData === 'string') {
|
|
382
382
|
jsonData = JSON.parse(jsonData);
|
|
383
383
|
}
|
|
384
|
-
this.cache.addJSON(key
|
|
384
|
+
this.cache.addJSON(`${key }-audioatlas`, '', jsonData);
|
|
385
385
|
}
|
|
386
386
|
return this;
|
|
387
387
|
}
|
|
@@ -399,10 +399,10 @@ export class Loader {
|
|
|
399
399
|
*/
|
|
400
400
|
bitmapFont(key, textureURL = null, atlasURL = null, atlasData = null, xSpacing = 0, ySpacing = 0) {
|
|
401
401
|
if (textureURL === undefined || textureURL === null) {
|
|
402
|
-
textureURL = key
|
|
402
|
+
textureURL = `${key }.png`;
|
|
403
403
|
}
|
|
404
404
|
if (atlasURL === null && atlasData === null) {
|
|
405
|
-
atlasURL = key
|
|
405
|
+
atlasURL = `${key }.xml`;
|
|
406
406
|
}
|
|
407
407
|
// A URL to a json/xml atlas has been given
|
|
408
408
|
if (atlasURL) {
|
|
@@ -441,10 +441,10 @@ export class Loader {
|
|
|
441
441
|
*/
|
|
442
442
|
atlas(key, textureURL, atlasURL = null, atlasData = null, format = TEXTURE_ATLAS_JSON_HASH) {
|
|
443
443
|
if (textureURL === undefined || textureURL === null) {
|
|
444
|
-
textureURL = key
|
|
444
|
+
textureURL = `${key }.png`;
|
|
445
445
|
}
|
|
446
446
|
if (!atlasURL && !atlasData) {
|
|
447
|
-
atlasURL = key
|
|
447
|
+
atlasURL = `${key }.json`;
|
|
448
448
|
}
|
|
449
449
|
// A URL to a json/xml file has been given
|
|
450
450
|
if (atlasURL) {
|
|
@@ -936,7 +936,7 @@ export class Loader {
|
|
|
936
936
|
if (!reason && xhr) {
|
|
937
937
|
reason = xhr.status;
|
|
938
938
|
}
|
|
939
|
-
const message =
|
|
939
|
+
const message = `Error loading asset (${ reason })`;
|
|
940
940
|
this.asyncComplete(file, message);
|
|
941
941
|
}
|
|
942
942
|
|
|
@@ -976,7 +976,7 @@ export class Loader {
|
|
|
976
976
|
if (file.format === TEXTURE_ATLAS_JSON_HASH) {
|
|
977
977
|
this.xhrLoad(file, this.transformUrl(file.atlasURL, file), 'text', this.jsonLoadComplete);
|
|
978
978
|
} else {
|
|
979
|
-
throw new Error(
|
|
979
|
+
throw new Error(`Invalid Texture Atlas format: ${ file.format}`);
|
|
980
980
|
}
|
|
981
981
|
}
|
|
982
982
|
break;
|
|
@@ -1068,7 +1068,7 @@ export class Loader {
|
|
|
1068
1068
|
const xml = this.parseXml(data);
|
|
1069
1069
|
if (!xml) {
|
|
1070
1070
|
const responseType = xhr.responseType || xhr.contentType; // contentType for MS-XDomainRequest
|
|
1071
|
-
console.warn(
|
|
1071
|
+
console.warn(`Loader - ${ file.key }: invalid XML (${ responseType })`);
|
|
1072
1072
|
this.asyncComplete(file, 'invalid XML');
|
|
1073
1073
|
return;
|
|
1074
1074
|
}
|
|
@@ -552,10 +552,10 @@ export class ScaleManager {
|
|
|
552
552
|
const offset = targetEdge - currentEdge;
|
|
553
553
|
margin.left = Math.round(offset);
|
|
554
554
|
}
|
|
555
|
-
canvas.style.marginLeft = margin.left
|
|
555
|
+
canvas.style.marginLeft = `${margin.left }px`;
|
|
556
556
|
if (margin.left !== 0) {
|
|
557
557
|
margin.right = -(parentBounds.width - canvasBounds.width - margin.left);
|
|
558
|
-
canvas.style.marginRight = margin.right
|
|
558
|
+
canvas.style.marginRight = `${margin.right }px`;
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
561
|
if (vertical) {
|
|
@@ -569,10 +569,10 @@ export class ScaleManager {
|
|
|
569
569
|
const offset = targetEdge - currentEdge;
|
|
570
570
|
margin.top = Math.round(offset);
|
|
571
571
|
}
|
|
572
|
-
canvas.style.marginTop = margin.top
|
|
572
|
+
canvas.style.marginTop = `${margin.top }px`;
|
|
573
573
|
if (margin.top !== 0) {
|
|
574
574
|
margin.bottom = -(parentBounds.height - canvasBounds.height - margin.top);
|
|
575
|
-
canvas.style.marginBottom = margin.bottom
|
|
575
|
+
canvas.style.marginBottom = `${margin.bottom }px`;
|
|
576
576
|
}
|
|
577
577
|
}
|
|
578
578
|
// Silly backwards compatibility..
|
|
@@ -613,7 +613,7 @@ export class ScaleManager {
|
|
|
613
613
|
* @param {string} cssWidth - TBD.
|
|
614
614
|
* @param {string} cssHeight - TBD.
|
|
615
615
|
*/
|
|
616
|
-
resetCanvas(cssWidth = this.width
|
|
616
|
+
resetCanvas(cssWidth = `${this.width }px`, cssHeight = `${this.height }px`) {
|
|
617
617
|
const canvas = this.game.canvas;
|
|
618
618
|
if (!this.compatibility.noMargins) {
|
|
619
619
|
canvas.style.marginLeft = '';
|
|
@@ -44,11 +44,11 @@ export class Signal {
|
|
|
44
44
|
binding = this._bindings[prevIndex];
|
|
45
45
|
if (binding.isOnce() !== isOnce) {
|
|
46
46
|
throw new Error(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
`You cannot add${
|
|
48
|
+
isOnce ? '' : 'Once'
|
|
49
|
+
}() then add${
|
|
50
|
+
!isOnce ? '' : 'Once'
|
|
51
|
+
}() the same listener without removing the relationship first.`
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
} else {
|
|
@@ -243,7 +243,7 @@ export class Signal {
|
|
|
243
243
|
* @returns {string} TBD.
|
|
244
244
|
*/
|
|
245
245
|
toString() {
|
|
246
|
-
return
|
|
246
|
+
return `[Signal active:${ this.active } numListeners:${ this.getNumListeners() }]`;
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
/**
|
|
@@ -96,6 +96,6 @@ export class SignalBinding {
|
|
|
96
96
|
* @returns {string} TBD.
|
|
97
97
|
*/
|
|
98
98
|
toString() {
|
|
99
|
-
return
|
|
99
|
+
return `[SignalBinding isOnce:${ this._isOnce }, isBound:${ this.isBound() }, active:${ this.active }]`;
|
|
100
100
|
}
|
|
101
101
|
}
|
package/src/phaser/core/sound.js
CHANGED
|
@@ -268,7 +268,7 @@ export class Sound {
|
|
|
268
268
|
this._tempVolume = this.volume;
|
|
269
269
|
this._tempLoop = this.loop;
|
|
270
270
|
} else {
|
|
271
|
-
console.warn(
|
|
271
|
+
console.warn(`Sound.play: audio marker ${ marker } does not exist`);
|
|
272
272
|
return this;
|
|
273
273
|
}
|
|
274
274
|
} else {
|
|
@@ -7,7 +7,7 @@ export class SoundSprite {
|
|
|
7
7
|
constructor(game, key) {
|
|
8
8
|
this.game = game;
|
|
9
9
|
this.key = key;
|
|
10
|
-
this.config = this.game.cache.getJSON(key
|
|
10
|
+
this.config = this.game.cache.getJSON(`${key }-audioatlas`);
|
|
11
11
|
this.autoplayKey = null;
|
|
12
12
|
this.autoplay = false;
|
|
13
13
|
this.sounds = {};
|
|
@@ -318,7 +318,7 @@ export class BitmapText extends DisplayObject {
|
|
|
318
318
|
if (typeof this.tint === 'number') {
|
|
319
319
|
let colorStr = this.tint.toString(16);
|
|
320
320
|
while (colorStr.length < 6) {
|
|
321
|
-
colorStr =
|
|
321
|
+
colorStr = `0${ colorStr}`;
|
|
322
322
|
}
|
|
323
323
|
return `#${colorStr.toUpperCase()}`;
|
|
324
324
|
}
|
|
@@ -127,7 +127,7 @@ export class Button extends Image {
|
|
|
127
127
|
* @param {boolean} switchImmediately - TBD.
|
|
128
128
|
*/
|
|
129
129
|
setStateFrame(state, frame, switchImmediately = false) {
|
|
130
|
-
const frameKey =
|
|
130
|
+
const frameKey = `_on${ state }Frame`;
|
|
131
131
|
if (frame) {
|
|
132
132
|
this[frameKey] = frame;
|
|
133
133
|
if (switchImmediately) {
|
|
@@ -148,7 +148,7 @@ export class Button extends Image {
|
|
|
148
148
|
return false;
|
|
149
149
|
}
|
|
150
150
|
const state = this.input.enabled || !this._onDisabledFrame ? newState : STATE_DISABLED;
|
|
151
|
-
const frameKey =
|
|
151
|
+
const frameKey = `_on${ state }Frame`;
|
|
152
152
|
const frame = this[frameKey];
|
|
153
153
|
if (typeof frame === 'string') {
|
|
154
154
|
this.frameName = frame;
|
|
@@ -59,23 +59,23 @@ export function renderGraphics(graphics, context) {
|
|
|
59
59
|
}
|
|
60
60
|
if (data.fill) {
|
|
61
61
|
context.globalAlpha = data.fillAlpha * worldAlpha;
|
|
62
|
-
context.fillStyle =
|
|
62
|
+
context.fillStyle = `#${ (`00000${ (fillColor | 0).toString(16)}`).substr(-6)}`;
|
|
63
63
|
context.fill();
|
|
64
64
|
}
|
|
65
65
|
if (data.lineWidth) {
|
|
66
66
|
context.globalAlpha = data.lineAlpha * worldAlpha;
|
|
67
|
-
context.strokeStyle =
|
|
67
|
+
context.strokeStyle = `#${ (`00000${ (lineColor | 0).toString(16)}`).substr(-6)}`;
|
|
68
68
|
context.stroke();
|
|
69
69
|
}
|
|
70
70
|
} else if (data.type === GEOM_RECTANGLE) {
|
|
71
71
|
if (data.fillColor || data.fillColor === 0) {
|
|
72
72
|
context.globalAlpha = data.fillAlpha * worldAlpha;
|
|
73
|
-
context.fillStyle =
|
|
73
|
+
context.fillStyle = `#${ (`00000${ (fillColor | 0).toString(16)}`).substr(-6)}`;
|
|
74
74
|
context.fillRect(shape.x, shape.y, shape.width, shape.height);
|
|
75
75
|
}
|
|
76
76
|
if (data.lineWidth) {
|
|
77
77
|
context.globalAlpha = data.lineAlpha * worldAlpha;
|
|
78
|
-
context.strokeStyle =
|
|
78
|
+
context.strokeStyle = `#${ (`00000${ (lineColor | 0).toString(16)}`).substr(-6)}`;
|
|
79
79
|
context.strokeRect(shape.x, shape.y, shape.width, shape.height);
|
|
80
80
|
}
|
|
81
81
|
} else if (data.type === GEOM_CIRCLE) {
|
|
@@ -84,12 +84,12 @@ export function renderGraphics(graphics, context) {
|
|
|
84
84
|
context.closePath();
|
|
85
85
|
if (data.fill) {
|
|
86
86
|
context.globalAlpha = data.fillAlpha * worldAlpha;
|
|
87
|
-
context.fillStyle =
|
|
87
|
+
context.fillStyle = `#${ (`00000${ (fillColor | 0).toString(16)}`).substr(-6)}`;
|
|
88
88
|
context.fill();
|
|
89
89
|
}
|
|
90
90
|
if (data.lineWidth) {
|
|
91
91
|
context.globalAlpha = data.lineAlpha * worldAlpha;
|
|
92
|
-
context.strokeStyle =
|
|
92
|
+
context.strokeStyle = `#${ (`00000${ (lineColor | 0).toString(16)}`).substr(-6)}`;
|
|
93
93
|
context.stroke();
|
|
94
94
|
}
|
|
95
95
|
} else if (data.type === GEOM_ELLIPSE) {
|
|
@@ -114,12 +114,12 @@ export function renderGraphics(graphics, context) {
|
|
|
114
114
|
context.closePath();
|
|
115
115
|
if (data.fill) {
|
|
116
116
|
context.globalAlpha = data.fillAlpha * worldAlpha;
|
|
117
|
-
context.fillStyle =
|
|
117
|
+
context.fillStyle = `#${ (`00000${ (fillColor | 0).toString(16)}`).substr(-6)}`;
|
|
118
118
|
context.fill();
|
|
119
119
|
}
|
|
120
120
|
if (data.lineWidth) {
|
|
121
121
|
context.globalAlpha = data.lineAlpha * worldAlpha;
|
|
122
|
-
context.strokeStyle =
|
|
122
|
+
context.strokeStyle = `#${ (`00000${ (lineColor | 0).toString(16)}`).substr(-6)}`;
|
|
123
123
|
context.stroke();
|
|
124
124
|
}
|
|
125
125
|
} else if (data.type === GEOM_ROUNDED_RECTANGLE) {
|
|
@@ -143,12 +143,12 @@ export function renderGraphics(graphics, context) {
|
|
|
143
143
|
context.closePath();
|
|
144
144
|
if (data.fillColor || data.fillColor === 0) {
|
|
145
145
|
context.globalAlpha = data.fillAlpha * worldAlpha;
|
|
146
|
-
context.fillStyle =
|
|
146
|
+
context.fillStyle = `#${ (`00000${ (fillColor | 0).toString(16)}`).substr(-6)}`;
|
|
147
147
|
context.fill();
|
|
148
148
|
}
|
|
149
149
|
if (data.lineWidth) {
|
|
150
150
|
context.globalAlpha = data.lineAlpha * worldAlpha;
|
|
151
|
-
context.strokeStyle =
|
|
151
|
+
context.strokeStyle = `#${ (`00000${ (lineColor | 0).toString(16)}`).substr(-6)}`;
|
|
152
152
|
context.stroke();
|
|
153
153
|
}
|
|
154
154
|
}
|
|
@@ -106,8 +106,8 @@ export class CanvasRenderer {
|
|
|
106
106
|
this.view.width = this.width;
|
|
107
107
|
this.view.height = this.height;
|
|
108
108
|
if (this.autoResize) {
|
|
109
|
-
this.view.style.width = this.width / this.resolution
|
|
110
|
-
this.view.style.height = this.height / this.resolution
|
|
109
|
+
this.view.style.width = `${this.width / this.resolution }px`;
|
|
110
|
+
this.view.style.height = `${this.height / this.resolution }px`;
|
|
111
111
|
}
|
|
112
112
|
if (this.renderSession.smoothProperty) {
|
|
113
113
|
this.context[this.renderSession.smoothProperty] = this.renderSession.scaleMode === SCALE_LINEAR;
|
|
@@ -28,7 +28,7 @@ export function tintWithMultiply(texture, color, canvas) {
|
|
|
28
28
|
canvas.height = crop.height;
|
|
29
29
|
}
|
|
30
30
|
context.clearRect(0, 0, crop.width, crop.height);
|
|
31
|
-
context.fillStyle =
|
|
31
|
+
context.fillStyle = `#${ (`00000${ (color | 0).toString(16)}`).substr(-6)}`;
|
|
32
32
|
context.fillRect(0, 0, crop.width, crop.height);
|
|
33
33
|
context.globalCompositeOperation = 'multiply';
|
|
34
34
|
context.drawImage(texture.baseTexture.source, crop.x, crop.y, crop.width, crop.height, 0, 0, crop.width, crop.height);
|
|
@@ -105,9 +105,9 @@ export function canUseNewCanvasBlendModes() {
|
|
|
105
105
|
const pngHead = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/';
|
|
106
106
|
const pngEnd = 'AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg==';
|
|
107
107
|
const magenta = new Image();
|
|
108
|
-
magenta.src = pngHead
|
|
108
|
+
magenta.src = `${pngHead }AP804Oa6${ pngEnd}`;
|
|
109
109
|
const yellow = new Image();
|
|
110
|
-
yellow.src = pngHead
|
|
110
|
+
yellow.src = `${pngHead }/wCKxvRF${ pngEnd}`;
|
|
111
111
|
const canvas = create('CanvasTinter', 6, 1);
|
|
112
112
|
const context = canvas.getContext('2d');
|
|
113
113
|
context.globalCompositeOperation = 'multiply';
|
|
@@ -7,7 +7,7 @@ import { create as createCanvas } from './pool.js';
|
|
|
7
7
|
* @param {number} height - TBD.
|
|
8
8
|
* @param {string} id - TBD.
|
|
9
9
|
* @param {boolean} skipPool - TBD.
|
|
10
|
-
* @returns {
|
|
10
|
+
* @returns {HTMLCanvasElement} TBD.
|
|
11
11
|
*/
|
|
12
12
|
export function create(parent, width, height, id, skipPool) {
|
|
13
13
|
width = width || 256;
|
|
@@ -100,7 +100,7 @@ export function addToDOM(canvas, parent, overflowHidden = true) {
|
|
|
100
100
|
* @param {HTMLCanvasElement} canvas - TBD.
|
|
101
101
|
*/
|
|
102
102
|
export function removeFromDOM(canvas) {
|
|
103
|
-
if (canvas.parentNode) {
|
|
103
|
+
if (canvas && canvas.parentNode) {
|
|
104
104
|
canvas.parentNode.removeChild(canvas);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
@@ -129,7 +129,7 @@ export function setTransform(context, translateX, translateY, scaleX, scaleY, sk
|
|
|
129
129
|
export function getSmoothingPrefix(context) {
|
|
130
130
|
const VENDORS = ['i', 'webkitI', 'msI', 'mozI', 'oI'];
|
|
131
131
|
for (let i = 0; i < VENDORS.length; i += 1) {
|
|
132
|
-
const s = VENDORS[i]
|
|
132
|
+
const s = `${VENDORS[i] }mageSmoothingEnabled`;
|
|
133
133
|
if (context && context[s]) {
|
|
134
134
|
return s;
|
|
135
135
|
}
|
|
@@ -95,7 +95,7 @@ export class DisplayObject {
|
|
|
95
95
|
this.children.splice(index, 0, child);
|
|
96
96
|
return child;
|
|
97
97
|
}
|
|
98
|
-
throw new Error(child
|
|
98
|
+
throw new Error(`${child }addChildAt: The index ${ index } supplied is out of bounds ${ this.children.length}`);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
/**
|
|
@@ -155,9 +155,9 @@ export class DisplayObject {
|
|
|
155
155
|
getChildAt(index) {
|
|
156
156
|
if (index < 0 || index >= this.children.length) {
|
|
157
157
|
throw new Error(
|
|
158
|
-
|
|
159
|
-
index
|
|
160
|
-
|
|
158
|
+
`getChildAt: Supplied index ${
|
|
159
|
+
index
|
|
160
|
+
} does not exist in the child list, or the supplied DisplayObject must be a child of the caller`
|
|
161
161
|
);
|
|
162
162
|
}
|
|
163
163
|
return this.children[index];
|
|
@@ -545,7 +545,7 @@ export class Text extends Image {
|
|
|
545
545
|
// append the entire line and exit early
|
|
546
546
|
const lineWidth = context.measureText(line).width;
|
|
547
547
|
if (lineWidth < wordWrapWidth) {
|
|
548
|
-
output += line
|
|
548
|
+
output += `${line }\n`;
|
|
549
549
|
} else {
|
|
550
550
|
// otherwise, calculate new lines
|
|
551
551
|
let currentLineWidth = wordWrapWidth;
|
|
@@ -553,7 +553,7 @@ export class Text extends Image {
|
|
|
553
553
|
const words = line.split(' ');
|
|
554
554
|
for (let j = 0; j < words.length; j += 1) {
|
|
555
555
|
const word = words[j];
|
|
556
|
-
const wordWithSpace = word
|
|
556
|
+
const wordWithSpace = `${word } `;
|
|
557
557
|
let wordWidth = context.measureText(wordWithSpace).width;
|
|
558
558
|
if (wordWidth > currentLineWidth) {
|
|
559
559
|
// break word
|
|
@@ -587,7 +587,7 @@ export class Text extends Image {
|
|
|
587
587
|
.join(' ')
|
|
588
588
|
.replace(/[ \n]*$/gi, '');
|
|
589
589
|
// prepend remainder to next line
|
|
590
|
-
lines[i + 1] = remainder
|
|
590
|
+
lines[i + 1] = `${remainder } ${ lines[i + 1] || ''}`;
|
|
591
591
|
linesCount = lines.length;
|
|
592
592
|
break; // processing on this line
|
|
593
593
|
// append word with space to output
|
|
@@ -597,7 +597,7 @@ export class Text extends Image {
|
|
|
597
597
|
}
|
|
598
598
|
}
|
|
599
599
|
// append processed line to output
|
|
600
|
-
output += out.replace(/[ \n]*$/gi, '')
|
|
600
|
+
output += `${out.replace(/[ \n]*$/gi, '') }\n`;
|
|
601
601
|
}
|
|
602
602
|
}
|
|
603
603
|
// trim the end of the string
|
|
@@ -624,11 +624,11 @@ export class Text extends Image {
|
|
|
624
624
|
if (j > 0) {
|
|
625
625
|
result += '\n';
|
|
626
626
|
}
|
|
627
|
-
result += words[j]
|
|
627
|
+
result += `${words[j] } `;
|
|
628
628
|
spaceLeft = this.style.wordWrapWidth - wordWidth;
|
|
629
629
|
} else {
|
|
630
630
|
spaceLeft -= wordWidthWithSpace;
|
|
631
|
-
result += words[j]
|
|
631
|
+
result += `${words[j] } `;
|
|
632
632
|
}
|
|
633
633
|
}
|
|
634
634
|
if (i < lines.length - 1) {
|
|
@@ -674,7 +674,7 @@ export class Text extends Image {
|
|
|
674
674
|
let family = m[5].trim();
|
|
675
675
|
// If it looks like the value should be quoted, but isn't, then quote it.
|
|
676
676
|
if (!/^(?:inherit|serif|sans-serif|cursive|fantasy|monospace)$/.exec(family) && !/['",]/.exec(family)) {
|
|
677
|
-
family =
|
|
677
|
+
family = `'${ family }'`;
|
|
678
678
|
}
|
|
679
679
|
return {
|
|
680
680
|
font,
|
|
@@ -685,7 +685,7 @@ export class Text extends Image {
|
|
|
685
685
|
fontFamily: family,
|
|
686
686
|
};
|
|
687
687
|
}
|
|
688
|
-
console.warn(
|
|
688
|
+
console.warn(`[Text] Error parsing CSS font: ${ font}`);
|
|
689
689
|
return { font };
|
|
690
690
|
}
|
|
691
691
|
|
|
@@ -1039,7 +1039,7 @@ export class Text extends Image {
|
|
|
1039
1039
|
mutatedValue = mutatedValue.trim();
|
|
1040
1040
|
// If it looks like the value should be quoted, but isn't, then quote it.
|
|
1041
1041
|
if (!/^(?:inherit|serif|sans-serif|cursive|fantasy|monospace)$/.exec(mutatedValue) && !/['",]/.exec(mutatedValue)) {
|
|
1042
|
-
mutatedValue =
|
|
1042
|
+
mutatedValue = `'${ mutatedValue }'`;
|
|
1043
1043
|
}
|
|
1044
1044
|
|
|
1045
1045
|
this._fontComponents.fontFamily = mutatedValue;
|
|
@@ -211,8 +211,8 @@ export class WebGLRenderer {
|
|
|
211
211
|
this.view.width = this.width;
|
|
212
212
|
this.view.height = this.height;
|
|
213
213
|
if (this.autoResize) {
|
|
214
|
-
this.view.style.width = this.width / this.resolution
|
|
215
|
-
this.view.style.height = this.height / this.resolution
|
|
214
|
+
this.view.style.width = `${this.width / this.resolution }px`;
|
|
215
|
+
this.view.style.height = `${this.height / this.resolution }px`;
|
|
216
216
|
}
|
|
217
217
|
this.gl.viewport(0, 0, this.width, this.height);
|
|
218
218
|
this.projection.x = this.width / 2 / this.resolution;
|
|
@@ -115,7 +115,7 @@ export class NormalShader {
|
|
|
115
115
|
}
|
|
116
116
|
} else {
|
|
117
117
|
// GL function reference
|
|
118
|
-
uniform.glFunc = gl[
|
|
118
|
+
uniform.glFunc = gl[`uniform${ type}`];
|
|
119
119
|
if (type === '2f' || type === '2i') {
|
|
120
120
|
uniform.glValueLength = 2;
|
|
121
121
|
} else if (type === '3f' || type === '3i') {
|
|
@@ -138,7 +138,7 @@ export class NormalShader {
|
|
|
138
138
|
return;
|
|
139
139
|
}
|
|
140
140
|
const gl = this.gl;
|
|
141
|
-
gl.activeTexture(gl[
|
|
141
|
+
gl.activeTexture(gl[`TEXTURE${ this.textureCount}`]);
|
|
142
142
|
gl.bindTexture(gl.TEXTURE_2D, uniform.value.baseTexture._glTextures[gl.id]);
|
|
143
143
|
// Extended texture data
|
|
144
144
|
if (uniform.textureData) {
|
|
@@ -215,7 +215,7 @@ export class NormalShader {
|
|
|
215
215
|
);
|
|
216
216
|
} else if (uniform.type === 'sampler2D') {
|
|
217
217
|
if (uniform._init) {
|
|
218
|
-
gl.activeTexture(gl[
|
|
218
|
+
gl.activeTexture(gl[`TEXTURE${ this.textureCount}`]);
|
|
219
219
|
if (uniform.value.baseTexture._dirty[gl.id]) {
|
|
220
220
|
window.PhaserRegistry.INSTANCES[gl.id].updateTexture(uniform.value.baseTexture);
|
|
221
221
|
} else {
|
|
@@ -96,7 +96,7 @@ export class Texture {
|
|
|
96
96
|
// TODO: make this configurable
|
|
97
97
|
const isTextureSilentFail = true;
|
|
98
98
|
if (!isTextureSilentFail) {
|
|
99
|
-
throw new Error(
|
|
99
|
+
throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions ${ this}`);
|
|
100
100
|
}
|
|
101
101
|
this.valid = false;
|
|
102
102
|
return;
|
|
@@ -157,7 +157,7 @@ export class Circle {
|
|
|
157
157
|
* @returns {string} TBD.
|
|
158
158
|
*/
|
|
159
159
|
toString() {
|
|
160
|
-
return
|
|
160
|
+
return `[{Circle (x=${ this.x } y=${ this.y } diameter=${ this.diameter } radius=${ this.radius })}]`;
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
/**
|
|
@@ -96,6 +96,6 @@ export class Ellipse {
|
|
|
96
96
|
* @returns {string} TBD.
|
|
97
97
|
*/
|
|
98
98
|
toString() {
|
|
99
|
-
return
|
|
99
|
+
return `[{Ellipse (x=${ this.x } y=${ this.y } width=${ this.width } height=${ this.height })}]`;
|
|
100
100
|
}
|
|
101
101
|
}
|
package/src/phaser/geom/point.js
CHANGED
|
@@ -322,17 +322,17 @@ export class Rectangle {
|
|
|
322
322
|
*/
|
|
323
323
|
toString() {
|
|
324
324
|
return (
|
|
325
|
-
|
|
326
|
-
this.x
|
|
327
|
-
|
|
328
|
-
this.y
|
|
329
|
-
|
|
330
|
-
this.width
|
|
331
|
-
|
|
332
|
-
this.height
|
|
333
|
-
|
|
334
|
-
this.empty
|
|
335
|
-
|
|
325
|
+
`[{Rectangle (x=${
|
|
326
|
+
this.x
|
|
327
|
+
} y=${
|
|
328
|
+
this.y
|
|
329
|
+
} width=${
|
|
330
|
+
this.width
|
|
331
|
+
} height=${
|
|
332
|
+
this.height
|
|
333
|
+
} empty=${
|
|
334
|
+
this.empty
|
|
335
|
+
})}]`
|
|
336
336
|
);
|
|
337
337
|
}
|
|
338
338
|
|
package/src/phaser/util/math.js
CHANGED
|
@@ -285,7 +285,7 @@ export function valueToColor(value, out) {
|
|
|
285
285
|
out.a = tempColor.a / 255;
|
|
286
286
|
}
|
|
287
287
|
out.rgba =
|
|
288
|
-
|
|
288
|
+
`rgba(${ out.r.toString() },${ out.g.toString() },${ out.b.toString() },${ out.a.toString() })`;
|
|
289
289
|
out.color = getColor(out.r, out.g, out.b);
|
|
290
290
|
out.color32 = getColor32(out.a * 255, out.r, out.g, out.b);
|
|
291
291
|
return out;
|