@mulsense/xnew 0.3.4 → 0.3.6
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/dist/addons/xmatter.js +1 -1
- package/dist/addons/xmatter.mjs +1 -1
- package/dist/addons/xpixi.js +9 -10
- package/dist/addons/xpixi.mjs +9 -10
- package/dist/addons/xrapier2d.d.ts +1 -1
- package/dist/addons/xrapier2d.js +5 -10
- package/dist/addons/xrapier2d.mjs +5 -10
- package/dist/addons/xrapier3d.d.ts +1 -1
- package/dist/addons/xrapier3d.js +5 -10
- package/dist/addons/xrapier3d.mjs +5 -10
- package/dist/addons/xthree.js +4 -6
- package/dist/addons/xthree.mjs +4 -6
- package/dist/xnew.d.ts +1 -0
- package/dist/xnew.js +1337 -680
- package/dist/xnew.mjs +1337 -680
- package/package.json +1 -1
package/dist/addons/xmatter.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
const root = {};
|
|
22
22
|
xnew.context('xmatter.root', root);
|
|
23
23
|
root.engine = engine !== null && engine !== void 0 ? engine : Matter.Engine.create();
|
|
24
|
-
unit.on('
|
|
24
|
+
unit.on('logicupdate', () => {
|
|
25
25
|
Matter.Engine.update(root.engine);
|
|
26
26
|
});
|
|
27
27
|
}
|
package/dist/addons/xmatter.mjs
CHANGED
|
@@ -18,7 +18,7 @@ function Root(unit, { engine }) {
|
|
|
18
18
|
const root = {};
|
|
19
19
|
xnew.context('xmatter.root', root);
|
|
20
20
|
root.engine = engine !== null && engine !== void 0 ? engine : Matter.Engine.create();
|
|
21
|
-
unit.on('
|
|
21
|
+
unit.on('logicupdate', () => {
|
|
22
22
|
Matter.Engine.update(root.engine);
|
|
23
23
|
});
|
|
24
24
|
}
|
package/dist/addons/xpixi.js
CHANGED
|
@@ -51,20 +51,19 @@
|
|
|
51
51
|
return (_a = xnew.context('xpixi.root')) === null || _a === void 0 ? void 0 : _a.canvas;
|
|
52
52
|
},
|
|
53
53
|
};
|
|
54
|
-
function Root(
|
|
54
|
+
function Root(unit, { canvas }) {
|
|
55
55
|
const root = {};
|
|
56
56
|
xnew.context('xpixi.root', root);
|
|
57
57
|
root.canvas = canvas;
|
|
58
|
-
|
|
58
|
+
root.renderer = null;
|
|
59
|
+
xnew.promise(PIXI__namespace.autoDetectRenderer({
|
|
59
60
|
width: canvas.width, height: canvas.height, view: canvas,
|
|
60
61
|
antialias: true, backgroundAlpha: 0,
|
|
61
|
-
});
|
|
62
|
-
root.renderer = null;
|
|
63
|
-
xnew.promise(renderer, false).then((renderer) => root.renderer = renderer);
|
|
62
|
+
})).then((renderer) => root.renderer = renderer);
|
|
64
63
|
root.updates = [];
|
|
65
64
|
root.scene = new PIXI__namespace.Container();
|
|
66
65
|
xnew.context('xpixi.object', root.scene);
|
|
67
|
-
|
|
66
|
+
unit.on('update', () => {
|
|
68
67
|
root.updates.forEach((update) => {
|
|
69
68
|
update();
|
|
70
69
|
});
|
|
@@ -73,18 +72,18 @@
|
|
|
73
72
|
}
|
|
74
73
|
});
|
|
75
74
|
}
|
|
76
|
-
function Nest(
|
|
75
|
+
function Nest(unit, { object }) {
|
|
77
76
|
const parent = xnew.context('xpixi.object');
|
|
78
77
|
xnew.context('xpixi.object', object);
|
|
79
78
|
parent.addChild(object);
|
|
80
|
-
|
|
79
|
+
unit.on('finalize', () => {
|
|
81
80
|
parent.removeChild(object);
|
|
82
81
|
});
|
|
83
82
|
}
|
|
84
|
-
function PreUpdate(
|
|
83
|
+
function PreUpdate(unit, callback) {
|
|
85
84
|
const root = xnew.context('xpixi.root');
|
|
86
85
|
root.updates.push(callback);
|
|
87
|
-
|
|
86
|
+
unit.on('finalize', () => {
|
|
88
87
|
root.updates = root.updates.filter((update) => update !== callback);
|
|
89
88
|
});
|
|
90
89
|
}
|
package/dist/addons/xpixi.mjs
CHANGED
|
@@ -29,20 +29,19 @@ var xpixi = {
|
|
|
29
29
|
return (_a = xnew.context('xpixi.root')) === null || _a === void 0 ? void 0 : _a.canvas;
|
|
30
30
|
},
|
|
31
31
|
};
|
|
32
|
-
function Root(
|
|
32
|
+
function Root(unit, { canvas }) {
|
|
33
33
|
const root = {};
|
|
34
34
|
xnew.context('xpixi.root', root);
|
|
35
35
|
root.canvas = canvas;
|
|
36
|
-
|
|
36
|
+
root.renderer = null;
|
|
37
|
+
xnew.promise(PIXI.autoDetectRenderer({
|
|
37
38
|
width: canvas.width, height: canvas.height, view: canvas,
|
|
38
39
|
antialias: true, backgroundAlpha: 0,
|
|
39
|
-
});
|
|
40
|
-
root.renderer = null;
|
|
41
|
-
xnew.promise(renderer, false).then((renderer) => root.renderer = renderer);
|
|
40
|
+
})).then((renderer) => root.renderer = renderer);
|
|
42
41
|
root.updates = [];
|
|
43
42
|
root.scene = new PIXI.Container();
|
|
44
43
|
xnew.context('xpixi.object', root.scene);
|
|
45
|
-
|
|
44
|
+
unit.on('update', () => {
|
|
46
45
|
root.updates.forEach((update) => {
|
|
47
46
|
update();
|
|
48
47
|
});
|
|
@@ -51,18 +50,18 @@ function Root(self, { canvas }) {
|
|
|
51
50
|
}
|
|
52
51
|
});
|
|
53
52
|
}
|
|
54
|
-
function Nest(
|
|
53
|
+
function Nest(unit, { object }) {
|
|
55
54
|
const parent = xnew.context('xpixi.object');
|
|
56
55
|
xnew.context('xpixi.object', object);
|
|
57
56
|
parent.addChild(object);
|
|
58
|
-
|
|
57
|
+
unit.on('finalize', () => {
|
|
59
58
|
parent.removeChild(object);
|
|
60
59
|
});
|
|
61
60
|
}
|
|
62
|
-
function PreUpdate(
|
|
61
|
+
function PreUpdate(unit, callback) {
|
|
63
62
|
const root = xnew.context('xpixi.root');
|
|
64
63
|
root.updates.push(callback);
|
|
65
|
-
|
|
64
|
+
unit.on('finalize', () => {
|
|
66
65
|
root.updates = root.updates.filter((update) => update !== callback);
|
|
67
66
|
});
|
|
68
67
|
}
|
package/dist/addons/xrapier2d.js
CHANGED
|
@@ -5,27 +5,22 @@
|
|
|
5
5
|
})(this, (function (xnew, RAPIER) { 'use strict';
|
|
6
6
|
|
|
7
7
|
var xrapier2d = {
|
|
8
|
-
initialize({ gravity = { x: 0.0, y: 9.81 }
|
|
9
|
-
xnew.extend(Root, { gravity
|
|
8
|
+
initialize({ gravity = { x: 0.0, y: 9.81 } } = {}) {
|
|
9
|
+
xnew.extend(Root, { gravity });
|
|
10
10
|
},
|
|
11
11
|
get world() {
|
|
12
12
|
var _a;
|
|
13
13
|
return (_a = xnew.context('xrapier2d.root')) === null || _a === void 0 ? void 0 : _a.world;
|
|
14
14
|
},
|
|
15
15
|
};
|
|
16
|
-
function Root(self, { gravity
|
|
16
|
+
function Root(self, { gravity }) {
|
|
17
17
|
const root = {};
|
|
18
18
|
xnew.context('xrapier2d.root', root);
|
|
19
19
|
xnew.promise(RAPIER.init()).then(() => {
|
|
20
20
|
root.world = new RAPIER.World(gravity);
|
|
21
|
-
if (timestep !== null) {
|
|
22
|
-
root.world.timestep = timestep;
|
|
23
|
-
}
|
|
24
21
|
});
|
|
25
|
-
self.on('
|
|
26
|
-
|
|
27
|
-
root.world.step();
|
|
28
|
-
}
|
|
22
|
+
self.on('fixedupdate', () => {
|
|
23
|
+
root.world.step();
|
|
29
24
|
});
|
|
30
25
|
}
|
|
31
26
|
|
|
@@ -2,27 +2,22 @@ import xnew from '@mulsense/xnew';
|
|
|
2
2
|
import RAPIER from '@dimforge/rapier2d-compat';
|
|
3
3
|
|
|
4
4
|
var xrapier2d = {
|
|
5
|
-
initialize({ gravity = { x: 0.0, y: 9.81 }
|
|
6
|
-
xnew.extend(Root, { gravity
|
|
5
|
+
initialize({ gravity = { x: 0.0, y: 9.81 } } = {}) {
|
|
6
|
+
xnew.extend(Root, { gravity });
|
|
7
7
|
},
|
|
8
8
|
get world() {
|
|
9
9
|
var _a;
|
|
10
10
|
return (_a = xnew.context('xrapier2d.root')) === null || _a === void 0 ? void 0 : _a.world;
|
|
11
11
|
},
|
|
12
12
|
};
|
|
13
|
-
function Root(self, { gravity
|
|
13
|
+
function Root(self, { gravity }) {
|
|
14
14
|
const root = {};
|
|
15
15
|
xnew.context('xrapier2d.root', root);
|
|
16
16
|
xnew.promise(RAPIER.init()).then(() => {
|
|
17
17
|
root.world = new RAPIER.World(gravity);
|
|
18
|
-
if (timestep !== null) {
|
|
19
|
-
root.world.timestep = timestep;
|
|
20
|
-
}
|
|
21
18
|
});
|
|
22
|
-
self.on('
|
|
23
|
-
|
|
24
|
-
root.world.step();
|
|
25
|
-
}
|
|
19
|
+
self.on('fixedupdate', () => {
|
|
20
|
+
root.world.step();
|
|
26
21
|
});
|
|
27
22
|
}
|
|
28
23
|
|
package/dist/addons/xrapier3d.js
CHANGED
|
@@ -5,27 +5,22 @@
|
|
|
5
5
|
})(this, (function (xnew, RAPIER) { 'use strict';
|
|
6
6
|
|
|
7
7
|
var xrapier3d = {
|
|
8
|
-
initialize({ gravity = { x: 0.0, y: 9.81, z: 0.0 }
|
|
9
|
-
xnew.extend(Root, { gravity
|
|
8
|
+
initialize({ gravity = { x: 0.0, y: 9.81, z: 0.0 } } = {}) {
|
|
9
|
+
xnew.extend(Root, { gravity });
|
|
10
10
|
},
|
|
11
11
|
get world() {
|
|
12
12
|
var _a;
|
|
13
13
|
return (_a = xnew.context('xrapier3d.root')) === null || _a === void 0 ? void 0 : _a.world;
|
|
14
14
|
},
|
|
15
15
|
};
|
|
16
|
-
function Root(self, { gravity
|
|
16
|
+
function Root(self, { gravity }) {
|
|
17
17
|
const root = {};
|
|
18
18
|
xnew.context('xrapier3d.root', root);
|
|
19
19
|
xnew.promise(RAPIER.init()).then(() => {
|
|
20
20
|
root.world = new RAPIER.World(gravity);
|
|
21
|
-
if (timestep !== null) {
|
|
22
|
-
root.world.timestep = timestep;
|
|
23
|
-
}
|
|
24
21
|
});
|
|
25
|
-
self.on('
|
|
26
|
-
|
|
27
|
-
root.world.step();
|
|
28
|
-
}
|
|
22
|
+
self.on('logicupdate', () => {
|
|
23
|
+
root.world.step();
|
|
29
24
|
});
|
|
30
25
|
}
|
|
31
26
|
|
|
@@ -2,27 +2,22 @@ import xnew from '@mulsense/xnew';
|
|
|
2
2
|
import RAPIER from '@dimforge/rapier3d-compat';
|
|
3
3
|
|
|
4
4
|
var xrapier3d = {
|
|
5
|
-
initialize({ gravity = { x: 0.0, y: 9.81, z: 0.0 }
|
|
6
|
-
xnew.extend(Root, { gravity
|
|
5
|
+
initialize({ gravity = { x: 0.0, y: 9.81, z: 0.0 } } = {}) {
|
|
6
|
+
xnew.extend(Root, { gravity });
|
|
7
7
|
},
|
|
8
8
|
get world() {
|
|
9
9
|
var _a;
|
|
10
10
|
return (_a = xnew.context('xrapier3d.root')) === null || _a === void 0 ? void 0 : _a.world;
|
|
11
11
|
},
|
|
12
12
|
};
|
|
13
|
-
function Root(self, { gravity
|
|
13
|
+
function Root(self, { gravity }) {
|
|
14
14
|
const root = {};
|
|
15
15
|
xnew.context('xrapier3d.root', root);
|
|
16
16
|
xnew.promise(RAPIER.init()).then(() => {
|
|
17
17
|
root.world = new RAPIER.World(gravity);
|
|
18
|
-
if (timestep !== null) {
|
|
19
|
-
root.world.timestep = timestep;
|
|
20
|
-
}
|
|
21
18
|
});
|
|
22
|
-
self.on('
|
|
23
|
-
|
|
24
|
-
root.world.step();
|
|
25
|
-
}
|
|
19
|
+
self.on('logicupdate', () => {
|
|
20
|
+
root.world.step();
|
|
26
21
|
});
|
|
27
22
|
}
|
|
28
23
|
|
package/dist/addons/xthree.js
CHANGED
|
@@ -64,12 +64,10 @@
|
|
|
64
64
|
function Nest(unit, { object }) {
|
|
65
65
|
const parent = xnew.context('xthree.object');
|
|
66
66
|
xnew.context('xthree.object', object);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
});
|
|
72
|
-
}
|
|
67
|
+
parent.add(object);
|
|
68
|
+
unit.on('finalize', () => {
|
|
69
|
+
parent.remove(object);
|
|
70
|
+
});
|
|
73
71
|
}
|
|
74
72
|
|
|
75
73
|
return xthree;
|
package/dist/addons/xthree.mjs
CHANGED
|
@@ -42,12 +42,10 @@ function Root(unit, { canvas, camera }) {
|
|
|
42
42
|
function Nest(unit, { object }) {
|
|
43
43
|
const parent = xnew.context('xthree.object');
|
|
44
44
|
xnew.context('xthree.object', object);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
});
|
|
50
|
-
}
|
|
45
|
+
parent.add(object);
|
|
46
|
+
unit.on('finalize', () => {
|
|
47
|
+
parent.remove(object);
|
|
48
|
+
});
|
|
51
49
|
}
|
|
52
50
|
|
|
53
51
|
export { xthree as default };
|
package/dist/xnew.d.ts
CHANGED