react-simple-game-engine 0.0.21 → 0.0.22
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":"avatar.sprite.d.ts","sourceRoot":"","sources":["../../../src/classes/sprites/avatar.sprite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;
|
1
|
+
{"version":3,"file":"avatar.sprite.d.ts","sourceRoot":"","sources":["../../../src/classes/sprites/avatar.sprite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEpD,aAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,aAAK,sBAAsB,CAAC,CAAC,SAAS,YAAY,IAAI,gBAAgB,CAAC,CAAC,CAAC,GAAG;IAE1E,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CAC/B,CAAC;AAEF,qBAAa,YAAa,SAAQ,MAAM,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACjE,OAAO,CAAC,MAAM,CAMZ;IAEF,MAAM;IAuBN,OAAO,CAAC,MAAM,CAAC,EAAE,sBAAsB,CAAC,IAAI,CAAC;CAc9C"}
|
@@ -35,11 +35,20 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
35
35
|
}
|
36
36
|
return t;
|
37
37
|
};
|
38
|
+
import { copyProperties } from "../../utils";
|
38
39
|
import { Sprite } from "./sprite";
|
39
40
|
var AvatarSprite = /** @class */ (function (_super) {
|
40
41
|
__extends(AvatarSprite, _super);
|
41
42
|
function AvatarSprite() {
|
42
|
-
|
43
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
44
|
+
_this.offset = {
|
45
|
+
x: 0,
|
46
|
+
y: 0,
|
47
|
+
index: 0,
|
48
|
+
width: 0,
|
49
|
+
height: 0,
|
50
|
+
};
|
51
|
+
return _this;
|
43
52
|
}
|
44
53
|
AvatarSprite.prototype.onDraw = function () {
|
45
54
|
if (this.sprite) {
|
@@ -59,19 +68,12 @@ var AvatarSprite = /** @class */ (function (_super) {
|
|
59
68
|
AvatarSprite.prototype.initial = function (params) {
|
60
69
|
var _a = (params ||
|
61
70
|
{}), offset = _a.offset, sprite = _a.sprite, _params = __rest(_a, ["offset", "sprite"]);
|
62
|
-
if (
|
63
|
-
this.offset.
|
64
|
-
this.offset.
|
65
|
-
this.offset.index = offset.index || 0;
|
66
|
-
this.offset.width = offset.width || (sprite === null || sprite === void 0 ? void 0 : sprite.width) || 0;
|
67
|
-
this.offset.height = offset.height || (sprite === null || sprite === void 0 ? void 0 : sprite.height) || 0;
|
71
|
+
if (sprite) {
|
72
|
+
this.offset.width = sprite.width;
|
73
|
+
this.offset.height = sprite.height;
|
68
74
|
}
|
69
|
-
|
70
|
-
this.offset
|
71
|
-
this.offset.y = 0;
|
72
|
-
this.offset.index = 0;
|
73
|
-
this.offset.width = (sprite === null || sprite === void 0 ? void 0 : sprite.width) || 0;
|
74
|
-
this.offset.height = (sprite === null || sprite === void 0 ? void 0 : sprite.height) || 0;
|
75
|
+
if (offset) {
|
76
|
+
copyProperties(this.offset, offset);
|
75
77
|
}
|
76
78
|
_super.prototype.initial.call(this, __assign(__assign({}, _params), { sprite: sprite }));
|
77
79
|
};
|
package/lib/utils.d.ts
CHANGED
@@ -2,4 +2,5 @@ import { Avatar, Sound } from "./export-types";
|
|
2
2
|
export declare function createAssetImage(src: string): Promise<Avatar>;
|
3
3
|
export declare function createAssetSound(src: string): Promise<Sound>;
|
4
4
|
export declare function tick(delay?: number): Promise<unknown>;
|
5
|
+
export declare function copyProperties(source: Record<string, any>, target: Record<string, any>): void;
|
5
6
|
//# sourceMappingURL=utils.d.ts.map
|
package/lib/utils.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAiB/C,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAInE;AAED,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAWlE;AAED,wBAAsB,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,oBAQxC"}
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAiB/C,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAInE;AAED,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAWlE;AAED,wBAAsB,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,oBAQxC;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAO5B"}
|
package/lib/utils.js
CHANGED