@mulsense/xnew 0.3.4 → 0.3.5

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.
@@ -55,12 +55,11 @@
55
55
  const root = {};
56
56
  xnew.context('xpixi.root', root);
57
57
  root.canvas = canvas;
58
- const renderer = PIXI__namespace.autoDetectRenderer({
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);
@@ -33,12 +33,11 @@ function Root(self, { canvas }) {
33
33
  const root = {};
34
34
  xnew.context('xpixi.root', root);
35
35
  root.canvas = canvas;
36
- const renderer = PIXI.autoDetectRenderer({
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);
@@ -1,5 +1,5 @@
1
1
  declare const _default: {
2
- initialize({ gravity, timestep }?: any): void;
2
+ initialize({ gravity }?: any): void;
3
3
  readonly world: any;
4
4
  };
5
5
 
@@ -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 }, timestep = null } = {}) {
9
- xnew.extend(Root, { gravity, timestep });
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, timestep }) {
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
22
  self.on('update', () => {
26
- if (root.world) {
27
- root.world.step();
28
- }
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 }, timestep = null } = {}) {
6
- xnew.extend(Root, { gravity, timestep });
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, timestep }) {
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
19
  self.on('update', () => {
23
- if (root.world) {
24
- root.world.step();
25
- }
20
+ root.world.step();
26
21
  });
27
22
  }
28
23
 
@@ -1,5 +1,5 @@
1
1
  declare const _default: {
2
- initialize({ gravity, timestep }?: any): void;
2
+ initialize({ gravity }?: any): void;
3
3
  readonly world: any;
4
4
  };
5
5