react-simple-game-engine 0.1.83 → 0.1.86
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.
@@ -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,UAAiC,GAClC,EAAE,gBAAgB,
|
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,eA2GlB"}
|
@@ -54,29 +54,25 @@ export function SceneRunner(_a) {
|
|
54
54
|
}
|
55
55
|
return (AssetsLoader !== null && AssetsLoader !== void 0 ? AssetsLoader : _jsx("div", { children: "Assets loading..." }));
|
56
56
|
}, [AssetsLoader]);
|
57
|
-
return (
|
57
|
+
return (_jsxs("div", __assign({ style: {
|
58
58
|
width: windowSize.width,
|
59
59
|
height: windowSize.height,
|
60
60
|
overflow: "hidden",
|
61
61
|
position: "relative",
|
62
62
|
boxSizing: "border-box",
|
63
|
-
} }, { children: current.loadedAssets
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
63
|
+
} }, { children: [current.loadedAssets && (_jsx(Sketch, { onSetup: setup, onDraw: draw, scaler: refScaler.current })), _jsx("div", __assign({ style: {
|
64
|
+
position: "absolute",
|
65
|
+
top: 0,
|
66
|
+
left: 0,
|
67
|
+
width: "100%",
|
68
|
+
height: "100%",
|
69
|
+
userSelect: "none",
|
70
|
+
zIndex: 2,
|
71
|
+
} }, { children: _jsx("div", __assign({ style: __assign({ width: width, height: height, transform: "scale(".concat(refScaler.current.value, ")"), transformOrigin: "left top", position: "relative" }, (function () {
|
72
|
+
var deltaToCenter = refScaler.current.deltaToCenterForUI;
|
73
|
+
return { left: deltaToCenter.x, top: deltaToCenter.y };
|
74
|
+
})()) }, { children: !current.loadedAssets ? (assetsLoader) : (_jsx(_Fragment, { children: isBootDone ? (_jsx("div", __assign({ style: {
|
75
75
|
width: "100%",
|
76
76
|
height: "100%",
|
77
|
-
} }, { children: _jsx(current.UI, __assign({ scene: current }, current.UIProps)) }))) : (_jsx("div", {})) })) }))] }))
|
78
|
-
width: "100%",
|
79
|
-
height: "100%",
|
80
|
-
transform: "scale(".concat(refScaler.current.value, ")"),
|
81
|
-
} }, { children: assetsLoader }))) })));
|
77
|
+
} }, { children: _jsx(current.UI, __assign({ scene: current }, current.UIProps)) }))) : (_jsx("div", {})) })) })) }))] })));
|
82
78
|
}
|
package/lib/utils.js
CHANGED
@@ -141,12 +141,12 @@ export function parallel(items, each, limit) {
|
|
141
141
|
}
|
142
142
|
export function useWindowSize() {
|
143
143
|
var _a = useState({
|
144
|
-
width: window.
|
145
|
-
height: window.
|
144
|
+
width: window.innerWidth,
|
145
|
+
height: window.innerHeight,
|
146
146
|
}), size = _a[0], setSize = _a[1];
|
147
147
|
useEffect(function () {
|
148
148
|
function onResize() {
|
149
|
-
setSize({ width: window.
|
149
|
+
setSize({ width: window.innerWidth, height: window.innerHeight });
|
150
150
|
}
|
151
151
|
window.addEventListener("resize", onResize);
|
152
152
|
return function () {
|