@nativescript/canvas-phaser 1.0.2-v6 → 1.1.0-alpha.1
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/game.js +34 -36
- package/game.js.map +1 -1
- package/index.js +1 -6
- package/index.js.map +1 -1
- package/package.json +9 -9
- package/phaser.js +1 -3
- package/phaser.js.map +1 -1
- package/tns-phaser.js +2 -7
- package/tns-phaser.js.map +1 -1
package/game.js
CHANGED
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.Game = function (options) {
|
|
5
|
-
var title = options.title || 'tns-phaser-game';
|
|
1
|
+
import Phaser from './phaser';
|
|
2
|
+
export const Game = (options) => {
|
|
3
|
+
const title = options.title || 'tns-phaser-game';
|
|
6
4
|
// CANVAS
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
5
|
+
const AUTO = 0;
|
|
6
|
+
const CANVAS = 1;
|
|
7
|
+
const WEBGL = 2;
|
|
8
|
+
const type = options.type || WEBGL;
|
|
9
|
+
const customEnvironment = true;
|
|
10
|
+
const domCreateContainer = false;
|
|
11
|
+
const current = options;
|
|
12
|
+
const scene = options.scene || null;
|
|
13
|
+
const antialias = options.antialias || true;
|
|
14
|
+
const transparent = options.transparent || false;
|
|
15
|
+
const physics = options.physics || null;
|
|
16
|
+
const preventLoop = options.preventLoop;
|
|
17
|
+
const onRender = options.onRender;
|
|
18
|
+
const canvas = options.canvas;
|
|
19
|
+
let context;
|
|
20
|
+
let is2D = false;
|
|
23
21
|
switch (type) {
|
|
24
22
|
case 2:
|
|
25
23
|
context = canvas.getContext('webgl');
|
|
@@ -31,30 +29,30 @@ exports.Game = function (options) {
|
|
|
31
29
|
break;
|
|
32
30
|
}
|
|
33
31
|
global.document.readyState = 'complete';
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
let width;
|
|
33
|
+
let height;
|
|
36
34
|
width = options.width || canvas.width;
|
|
37
35
|
height = options.height || canvas.height;
|
|
38
36
|
delete current.domCreateContainer;
|
|
39
37
|
delete current.customEnvironment;
|
|
40
|
-
|
|
41
|
-
width
|
|
42
|
-
height
|
|
38
|
+
let config = {
|
|
39
|
+
width,
|
|
40
|
+
height,
|
|
43
41
|
//canvas,
|
|
44
|
-
context
|
|
45
|
-
title
|
|
46
|
-
type
|
|
47
|
-
scene
|
|
48
|
-
antialias
|
|
49
|
-
transparent
|
|
50
|
-
physics
|
|
51
|
-
customEnvironment
|
|
42
|
+
context,
|
|
43
|
+
title,
|
|
44
|
+
type,
|
|
45
|
+
scene,
|
|
46
|
+
antialias,
|
|
47
|
+
transparent,
|
|
48
|
+
physics,
|
|
49
|
+
customEnvironment,
|
|
52
50
|
};
|
|
53
51
|
config = Object.assign(config, current);
|
|
54
|
-
|
|
52
|
+
const game = new Phaser.Game(config);
|
|
55
53
|
game.width = width;
|
|
56
54
|
game.height = height;
|
|
57
|
-
|
|
55
|
+
const render = function () {
|
|
58
56
|
requestAnimationFrame(render);
|
|
59
57
|
onRender && onRender();
|
|
60
58
|
};
|
package/game.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"game.js","sourceRoot":"","sources":["../../../packages/canvas-phaser/game.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"game.js","sourceRoot":"","sources":["../../../packages/canvas-phaser/game.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,EAAE;IAC/B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,iBAAiB,CAAC;IACjD,SAAS;IACT,MAAM,IAAI,GAAG,CA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IAClC,OAAO,OAAO,CAAC,iBAAiB,CAAC;IAEjC,IAAI,MAAM,GAAG;QACZ,KAAK;QACL,MAAM;QACN,SAAS;QACT,OAAO;QACP,KAAK;QACL,IAAI;QACJ,KAAK;QACL,SAAS;QACT,WAAW;QACX,OAAO;QACP,iBAAiB;KACjB,CAAC;IAGF,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACrB,MAAM,MAAM,GAAG;QACd,qBAAqB,CAAC,MAAM,CAAC,CAAC;QAC9B,QAAQ,IAAI,QAAQ,EAAE,CAAC;IACxB,CAAC,CAAC;IACF,IAAI,CAAC,WAAW,EAAE;QACjB,MAAM,EAAE,CAAC;KACT;IAED,OAAO,IAAI,CAAC;AACb,CAAC,CAAA"}
|
package/index.js
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
function __export(m) {
|
|
3
|
-
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
4
|
-
}
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
__export(require("./tns-phaser"));
|
|
1
|
+
export * from './tns-phaser';
|
|
7
2
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/canvas-phaser/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/canvas-phaser/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nativescript/canvas-phaser",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.1.0-alpha.1",
|
|
4
4
|
"description": "Build awesome 2D games with Phaser.js and NativeScript",
|
|
5
|
-
"main": "index
|
|
5
|
+
"main": "index",
|
|
6
6
|
"typings": "index.d.ts",
|
|
7
7
|
"nativescript": {
|
|
8
8
|
"platforms": {
|
|
9
|
-
"ios": "
|
|
10
|
-
"android": "
|
|
9
|
+
"ios": "7.0.0",
|
|
10
|
+
"android": "7.0.0"
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"homepage": "https://github.com/NativeScript/canvas",
|
|
33
33
|
"readmeFilename": "README.md",
|
|
34
34
|
"bootstrapper": "@nativescript/plugin-seed",
|
|
35
|
-
"peerDependencies": {
|
|
36
|
-
"@nativescript/canvas": "~0.9.4-v6",
|
|
37
|
-
"phaser": "^3.24.1"
|
|
38
|
-
},
|
|
39
35
|
"dependencies": {
|
|
40
|
-
"@nativescript/canvas-polyfill": "
|
|
36
|
+
"@nativescript/canvas-polyfill": "alpha"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"phaser": "^3.24.1",
|
|
40
|
+
"@nativescript/canvas": "1.1.0-alpha.1"
|
|
41
41
|
}
|
|
42
42
|
}
|
package/phaser.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
require('@nativescript/canvas-polyfill');
|
|
4
2
|
function initPhaser() {
|
|
5
3
|
/* if ((global as any).Phaser) {
|
|
@@ -13,5 +11,5 @@ function initPhaser() {
|
|
|
13
11
|
global.window.Phaser = global.Phaser = global.Phaser || require('phaser');
|
|
14
12
|
return global.Phaser;
|
|
15
13
|
}
|
|
16
|
-
|
|
14
|
+
export default initPhaser();
|
|
17
15
|
//# sourceMappingURL=phaser.js.map
|
package/phaser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phaser.js","sourceRoot":"","sources":["../../../packages/canvas-phaser/phaser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"phaser.js","sourceRoot":"","sources":["../../../packages/canvas-phaser/phaser.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,+BAA+B,CAAC,CAAC;AAEzC,SAAS,UAAU;IACnB;;;;;;;SAOK;IACF,MAAc,CAAC,MAAM,CAAC,MAAM,GAAI,MAAc,CAAC,MAAM,GAAI,MAAc,CAAC,MAAM,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;IACrG,OAAQ,MAAc,CAAC,MAAM,CAAC;AAChC,CAAC;AAED,eAAe,UAAU,EAAE,CAAC"}
|
package/tns-phaser.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
4
|
-
}
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
__export(require("./phaser"));
|
|
7
|
-
__export(require("./game"));
|
|
1
|
+
export * from './phaser';
|
|
2
|
+
export * from './game';
|
|
8
3
|
//# sourceMappingURL=tns-phaser.js.map
|
package/tns-phaser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tns-phaser.js","sourceRoot":"","sources":["../../../packages/canvas-phaser/tns-phaser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tns-phaser.js","sourceRoot":"","sources":["../../../packages/canvas-phaser/tns-phaser.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|