react-simple-game-engine 0.1.70 → 0.1.73

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.
@@ -98,7 +98,7 @@ var EntitySult = /** @class */ (function () {
98
98
  this._scene = worldManagement.scene;
99
99
  this.camera = worldManagement.camera;
100
100
  }
101
- console.log("Active entity (name : ".concat(this._name, ")"));
101
+ // console.log(`Active entity (name : ${this._name})`);
102
102
  this.onActive();
103
103
  };
104
104
  EntitySult.prototype.onActive = function () { };
@@ -7,9 +7,12 @@ export declare class Scaler {
7
7
  private _value;
8
8
  constructor(_canvasSize: Size, _gameSize: Size, _layoutMode: LayoutMode);
9
9
  get value(): number;
10
+ get gameSize(): Size;
11
+ get canvasSize(): Size;
12
+ get layoutMode(): LayoutMode;
10
13
  set gameSize(_gameSize: Size);
11
14
  set canvasSize(_canvasSize: Size);
12
15
  set layoutMode(_layoutMode: LayoutMode);
13
- update(): void;
16
+ private update;
14
17
  }
15
18
  //# sourceMappingURL=scaler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scaler.d.ts","sourceRoot":"","sources":["../../src/classes/scaler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAGvC,qBAAa,MAAM;IAGf,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,WAAW;IAJrB,OAAO,CAAC,MAAM,CAAS;gBAEJ,WAAW,EAAE,IAAI,EACjB,SAAS,EAAE,IAAI,EACxB,WAAW,EAAE,UAAU;IAKjC,IAAI,KAAK,WAER;IAED,IAAI,QAAQ,CAAC,SAAS,EAAE,IAAI,EAG3B;IAED,IAAI,UAAU,CAAC,WAAW,EAAE,IAAI,EAG/B;IAED,IAAI,UAAU,CAAC,WAAW,EAAE,UAAU,EAGrC;IAED,MAAM;CAOP"}
1
+ {"version":3,"file":"scaler.d.ts","sourceRoot":"","sources":["../../src/classes/scaler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAGvC,qBAAa,MAAM;IAGf,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,WAAW;IAJrB,OAAO,CAAC,MAAM,CAAS;gBAEJ,WAAW,EAAE,IAAI,EACjB,SAAS,EAAE,IAAI,EACxB,WAAW,EAAE,UAAU;IAKjC,IAAI,KAAK,WAER;IAED,IAAI,QAAQ,IAYY,IAAI,CAV3B;IAED,IAAI,UAAU,IAac,IAAI,CAX/B;IAED,IAAI,UAAU,IAcc,UAAU,CAZrC;IAED,IAAI,QAAQ,CAAC,SAAS,EAAE,IAAI,EAG3B;IAED,IAAI,UAAU,CAAC,WAAW,EAAE,IAAI,EAG/B;IAED,IAAI,UAAU,CAAC,WAAW,EAAE,UAAU,EAGrC;IAED,OAAO,CAAC,MAAM;CAOf"}
@@ -15,6 +15,9 @@ var Scaler = /** @class */ (function () {
15
15
  configurable: true
16
16
  });
17
17
  Object.defineProperty(Scaler.prototype, "gameSize", {
18
+ get: function () {
19
+ return this._gameSize;
20
+ },
18
21
  set: function (_gameSize) {
19
22
  copyProperties(this._gameSize, _gameSize);
20
23
  this.update();
@@ -23,6 +26,9 @@ var Scaler = /** @class */ (function () {
23
26
  configurable: true
24
27
  });
25
28
  Object.defineProperty(Scaler.prototype, "canvasSize", {
29
+ get: function () {
30
+ return this._canvasSize;
31
+ },
26
32
  set: function (_canvasSize) {
27
33
  copyProperties(this._canvasSize, _canvasSize);
28
34
  this.update();
@@ -31,6 +37,9 @@ var Scaler = /** @class */ (function () {
31
37
  configurable: true
32
38
  });
33
39
  Object.defineProperty(Scaler.prototype, "layoutMode", {
40
+ get: function () {
41
+ return this._layoutMode;
42
+ },
34
43
  set: function (_layoutMode) {
35
44
  this._layoutMode = _layoutMode;
36
45
  this.update();
@@ -1 +1 @@
1
- {"version":3,"file":"scene-runner.d.ts","sourceRoot":"","sources":["../../src/ui-components/scene-runner.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAEb,SAAS,EAKV,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAKzC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,oBAAY,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF,aAAK,gBAAgB,GAAG,sBAAsB,GAAG;IAC/C,OAAO,EAAE,KAAK,CAAC;CAChB,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAC1B,WAAW,EACX,OAAO,EACP,KAAK,EACL,MAAM,EACN,YAAY,EAAE,YAAY,EAC1B,UAAU,GACX,EAAE,gBAAgB,eA4FlB"}
1
+ {"version":3,"file":"scene-runner.d.ts","sourceRoot":"","sources":["../../src/ui-components/scene-runner.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAEb,SAAS,EAKV,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAKzC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,oBAAY,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF,aAAK,gBAAgB,GAAG,sBAAsB,GAAG;IAC/C,OAAO,EAAE,KAAK,CAAC;CAChB,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAC1B,WAAW,EACX,OAAO,EACP,KAAK,EACL,MAAM,EACN,YAAY,EAAE,YAAY,EAC1B,UAAiC,GAClC,EAAE,gBAAgB,eAkGlB"}
@@ -13,15 +13,16 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
13
13
  import { useEffect, useMemo, useRef, useState, } from "react";
14
14
  import { Sketch } from "./sketch";
15
15
  import { useWindowSize } from "../utils";
16
+ import { LayoutMode } from "../export-enums";
16
17
  import { Scaler } from "../classes/scaler";
17
18
  export function SceneRunner(_a) {
18
- var assetsDelay = _a.assetsDelay, current = _a.current, width = _a.width, height = _a.height, AssetsLoader = _a.assetsLoader, layoutMode = _a.layoutMode;
19
+ var assetsDelay = _a.assetsDelay, current = _a.current, width = _a.width, height = _a.height, AssetsLoader = _a.assetsLoader, _b = _a.layoutMode, layoutMode = _b === void 0 ? LayoutMode.LANDSCAPE : _b;
19
20
  var windowSize = useWindowSize();
20
21
  var refScaler = useRef(new Scaler(windowSize, { width: width, height: height }, layoutMode));
21
- var _b = useState(false), isBootDone = _b[0], setBootDone = _b[1];
22
+ var _c = useState(false), isBootDone = _c[0], setBootDone = _c[1];
22
23
  useEffect(function () {
23
- if (Renderer) {
24
- Renderer.resizeCanvas(windowSize.width, windowSize.height);
24
+ if (window.Renderer) {
25
+ window.Renderer.resizeCanvas(windowSize.width, windowSize.height);
25
26
  }
26
27
  refScaler.current.canvasSize = {
27
28
  width: windowSize.width,
@@ -53,7 +54,11 @@ export function SceneRunner(_a) {
53
54
  }
54
55
  return (AssetsLoader !== null && AssetsLoader !== void 0 ? AssetsLoader : _jsx("div", { children: "Assets loading..." }));
55
56
  }, [AssetsLoader]);
56
- return (_jsx("div", __assign({ style: { width: width, height: height, position: "relative" } }, { children: current.loadedAssets ? (_jsxs(_Fragment, { children: [_jsx(Sketch, { onSetup: setup, onDraw: draw, scaler: refScaler.current }), _jsx("div", __assign({ style: {
57
+ return (_jsx("div", __assign({ style: {
58
+ width: windowSize.width,
59
+ height: windowSize.height,
60
+ position: "relative",
61
+ } }, { children: current.loadedAssets ? (_jsxs(_Fragment, { children: [_jsx(Sketch, { onSetup: setup, onDraw: draw, scaler: refScaler.current }), _jsx("div", __assign({ style: {
57
62
  position: "absolute",
58
63
  top: 0,
59
64
  bottom: 0,
@@ -6,8 +6,8 @@ export function Sketch(_a) {
6
6
  var onSetup = _a.onSetup, onDraw = _a.onDraw, onPreload = _a.onPreload, scaler = _a.scaler;
7
7
  var refContainer = useRef(null);
8
8
  useEffect(function () {
9
- if (Renderer) {
10
- Renderer.scaler = scaler;
9
+ if (window.Renderer) {
10
+ window.Renderer.scaler = scaler;
11
11
  }
12
12
  }, [scaler]);
13
13
  useEffect(function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-simple-game-engine",
3
- "version": "0.1.70",
3
+ "version": "0.1.73",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib",