react-simple-game-engine 0.0.65 → 0.1.2
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/lib/classes/p5.d.ts +1 -4
- package/lib/classes/p5.d.ts.map +1 -1
- package/lib/classes/p5.js +1 -10
- package/lib/ui-components/Sketch.js +3 -2
- package/package.json +1 -1
package/lib/classes/p5.d.ts
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
import p5 from "p5";
|
2
|
-
import { Camera } from "./camera";
|
3
2
|
declare type ItemWithPercent<I> = [I, number];
|
4
3
|
declare type LastItem<I> = [I];
|
5
4
|
export declare type Collection<I> = [...ItemWithPercent<I>[], LastItem<I>];
|
6
5
|
export declare class P5 extends p5 {
|
7
|
-
|
8
|
-
constructor(sketch: (p5: P5) => void, width: number, height: number);
|
9
|
-
get simpleCamera(): Camera;
|
6
|
+
constructor(sketch: (p5: P5) => void);
|
10
7
|
choose<I = any>(collection: Collection<I>): I;
|
11
8
|
}
|
12
9
|
export {};
|
package/lib/classes/p5.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"p5.d.ts","sourceRoot":"","sources":["../../src/classes/p5.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;
|
1
|
+
{"version":3,"file":"p5.d.ts","sourceRoot":"","sources":["../../src/classes/p5.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,aAAK,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AACtC,aAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEvB,oBAAY,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnE,qBAAa,EAAG,SAAQ,EAAE;gBACZ,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,IAAI;IAKpC,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC;CAgC9C"}
|
package/lib/classes/p5.js
CHANGED
@@ -14,22 +14,13 @@ var __extends = (this && this.__extends) || (function () {
|
|
14
14
|
};
|
15
15
|
})();
|
16
16
|
import p5 from "p5";
|
17
|
-
import { Camera } from "./camera";
|
18
17
|
var P5 = /** @class */ (function (_super) {
|
19
18
|
__extends(P5, _super);
|
20
|
-
function P5(sketch
|
19
|
+
function P5(sketch) {
|
21
20
|
var _this = _super.call(this, sketch) || this;
|
22
21
|
window.Renderer = _this;
|
23
|
-
_this._simpleCamera = new Camera(width, height);
|
24
22
|
return _this;
|
25
23
|
}
|
26
|
-
Object.defineProperty(P5.prototype, "simpleCamera", {
|
27
|
-
get: function () {
|
28
|
-
return this._simpleCamera;
|
29
|
-
},
|
30
|
-
enumerable: false,
|
31
|
-
configurable: true
|
32
|
-
});
|
33
24
|
P5.prototype.choose = function (collection) {
|
34
25
|
var lastItem = collection[collection.length - 1];
|
35
26
|
var restItems = collection.slice(0, collection.length - 1);
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { useEffect, useRef } from "react";
|
3
|
+
import { Camera } from "../classes/camera";
|
3
4
|
import { P5 } from "../classes/p5";
|
4
5
|
export function Sketch(_a) {
|
5
6
|
var onSetup = _a.onSetup, onDraw = _a.onDraw, onPreload = _a.onPreload, width = _a.width, height = _a.height;
|
6
7
|
var refContainer = useRef(null);
|
7
8
|
useEffect(function () {
|
8
9
|
var sketch = function (s) {
|
9
|
-
var camera =
|
10
|
+
var camera = new Camera(width, height);
|
10
11
|
s.preload = function () {
|
11
12
|
return onPreload === null || onPreload === void 0 ? void 0 : onPreload();
|
12
13
|
};
|
@@ -22,7 +23,7 @@ export function Sketch(_a) {
|
|
22
23
|
onDraw();
|
23
24
|
};
|
24
25
|
};
|
25
|
-
new P5(sketch
|
26
|
+
new P5(sketch);
|
26
27
|
// eslint-disable-next-line
|
27
28
|
}, []);
|
28
29
|
return _jsx("div", { style: { backgroundColor: "#000" }, ref: refContainer });
|