@vpmedia/phaser 1.1.8 → 1.2.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/device_util.js +24 -0
- package/src/phaser/core/factory.js +2 -26
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@vpmedia/phaser
|
|
2
2
|
===============
|
|
3
3
|
|
|
4
|
-
[](https://badge.fury.io/js/@vpmedia%2Fphaser)
|
|
5
5
|
[](https://github.com/vpmedia/phaser/actions/workflows/node.js.yml)
|
|
6
6
|
|
|
7
7
|
@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.2.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",
|
|
@@ -191,6 +191,29 @@ export function checkAudio(device) {
|
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
+
/**
|
|
195
|
+
*
|
|
196
|
+
* @param {object} device TBD
|
|
197
|
+
*/
|
|
198
|
+
export function checkImage(device) {
|
|
199
|
+
device.avif = false;
|
|
200
|
+
device.webp = false;
|
|
201
|
+
try {
|
|
202
|
+
const avif = new Image();
|
|
203
|
+
avif.src = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=";
|
|
204
|
+
avif.onload = function () {
|
|
205
|
+
device.avif = true;
|
|
206
|
+
};
|
|
207
|
+
const webp = new Image();
|
|
208
|
+
webp.src = "data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=";
|
|
209
|
+
webp.onload = function () {
|
|
210
|
+
device.webp = true;
|
|
211
|
+
};
|
|
212
|
+
} catch (e) {
|
|
213
|
+
// pass
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
194
217
|
/**
|
|
195
218
|
*
|
|
196
219
|
* @param {object} device TBD
|
|
@@ -199,6 +222,7 @@ export function initialize(device) {
|
|
|
199
222
|
checkOS(device);
|
|
200
223
|
checkBrowser(device);
|
|
201
224
|
checkAudio(device);
|
|
225
|
+
checkImage(device);
|
|
202
226
|
checkFullScreenSupport(device);
|
|
203
227
|
checkInput(device);
|
|
204
228
|
}
|
|
@@ -8,7 +8,6 @@ import Button from '../display/button';
|
|
|
8
8
|
import Group from '../display/group';
|
|
9
9
|
import Graphics from '../display/graphics';
|
|
10
10
|
import Image from '../display/image';
|
|
11
|
-
import SpriteBatch from '../display/sprite_batch';
|
|
12
11
|
import Text from '../display/text';
|
|
13
12
|
|
|
14
13
|
export default class {
|
|
@@ -17,10 +16,6 @@ export default class {
|
|
|
17
16
|
this.game = game;
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
existing(object) {
|
|
21
|
-
return this.game.world.add(object);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
19
|
image(x, y, key, frame, group = null) {
|
|
25
20
|
if (!group) {
|
|
26
21
|
group = this.game.world;
|
|
@@ -32,20 +27,6 @@ export default class {
|
|
|
32
27
|
return new Group(this.game, parent, name, addToStage);
|
|
33
28
|
}
|
|
34
29
|
|
|
35
|
-
spriteBatch(parent = null, name = 'group', addToStage = false) {
|
|
36
|
-
return new SpriteBatch(this.game, parent, name, addToStage);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
audio(key, volume, loop, connect) {
|
|
40
|
-
console.warn('[GameObjectFactory] game.add.audio() is deprecated, use game.sound.add() directly.');
|
|
41
|
-
return this.game.sound.add(key, volume, loop, connect);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
sound(key, volume, loop, connect) {
|
|
45
|
-
console.warn('[GameObjectFactory] game.add.sound() is deprecated, use game.sound.add() directly.');
|
|
46
|
-
return this.game.sound.add(key, volume, loop, connect);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
30
|
text(x, y, text, style, group = null) {
|
|
50
31
|
const parent = group || this.game.world;
|
|
51
32
|
return parent.add(new Text(this.game, x, y, text, style));
|
|
@@ -61,14 +42,9 @@ export default class {
|
|
|
61
42
|
return parent.add(new Graphics(this.game, x, y));
|
|
62
43
|
}
|
|
63
44
|
|
|
64
|
-
bitmapText(x, y, font, text, size, group = null) {
|
|
45
|
+
bitmapText(x, y, font, text, size, group = null, align = 'left') {
|
|
65
46
|
const parent = group || this.game.world;
|
|
66
|
-
return parent.add(new BitmapText(this.game, x, y, font, text, size));
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
tween(object) {
|
|
70
|
-
console.warn('game.add.tween(target) is deprecated, please use game.tweens.create(target) directly.');
|
|
71
|
-
return this.game.tweens.create(object);
|
|
47
|
+
return parent.add(new BitmapText(this.game, x, y, font, text, size, align));
|
|
72
48
|
}
|
|
73
49
|
|
|
74
50
|
}
|