@vworlds/vecs-phaser 1.0.34 → 1.0.36
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/catalog.d.ts +39 -0
- package/catalog.js +2 -0
- package/catalog.js.map +1 -0
- package/components/image.d.ts +7 -0
- package/components/image.js +28 -0
- package/components/image.js.map +1 -0
- package/index.d.ts +6 -2
- package/index.js +5 -0
- package/index.js.map +1 -1
- package/package.json +3 -3
package/catalog.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** Base identity for any catalog asset. New kinds extend this; the base never changes. */
|
|
2
|
+
export interface AssetDescriptor {
|
|
3
|
+
/** Wire id (stable, append-only). */
|
|
4
|
+
id: number;
|
|
5
|
+
/** Author key, authoring/debug only. */
|
|
6
|
+
key: string;
|
|
7
|
+
/** Discriminant; narrowed by each subtype to its literal. */
|
|
8
|
+
kind: string;
|
|
9
|
+
}
|
|
10
|
+
/** A Tiled-tileset-backed spritesheet asset the client loads via Phaser's spritesheet loader. */
|
|
11
|
+
export interface SpritesheetDescriptor extends AssetDescriptor {
|
|
12
|
+
/** Spritesheet catalog discriminant. */
|
|
13
|
+
kind: "spritesheet";
|
|
14
|
+
/** HTTP url the client loads the source image from. */
|
|
15
|
+
url: string;
|
|
16
|
+
/** Tile width (px). */
|
|
17
|
+
frameWidth: number;
|
|
18
|
+
/** Tile height (px). */
|
|
19
|
+
frameHeight: number;
|
|
20
|
+
/** Tileset margin (px). */
|
|
21
|
+
margin: number;
|
|
22
|
+
/** Tile spacing (px). */
|
|
23
|
+
spacing: number;
|
|
24
|
+
/** Tiles per row. */
|
|
25
|
+
columns: number;
|
|
26
|
+
/** Total frames. */
|
|
27
|
+
tileCount: number;
|
|
28
|
+
/** Source image width (px). */
|
|
29
|
+
imageWidth: number;
|
|
30
|
+
/** Source image height (px). */
|
|
31
|
+
imageHeight: number;
|
|
32
|
+
}
|
|
33
|
+
/** Per-world asset catalog served as JSON over HTTP. */
|
|
34
|
+
export interface AssetCatalog {
|
|
35
|
+
/** Name of the world this catalog describes. */
|
|
36
|
+
worldName: string;
|
|
37
|
+
/** Heterogeneous asset descriptors; clients narrow per element via `kind`. */
|
|
38
|
+
assets: AssetDescriptor[];
|
|
39
|
+
}
|
package/catalog.js
ADDED
package/catalog.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { type as wireType } from "@vworlds/vecs-wire";
|
|
11
|
+
/** Textured renderable. Both fields index the asset catalog. */
|
|
12
|
+
export class Image {
|
|
13
|
+
constructor() {
|
|
14
|
+
/** Resource id of the source texture (image or spritesheet). */
|
|
15
|
+
this.texture = 0;
|
|
16
|
+
/** Frame index within a spritesheet/tileset. */
|
|
17
|
+
this.frame = 0;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
__decorate([
|
|
21
|
+
wireType("u32"),
|
|
22
|
+
__metadata("design:type", Object)
|
|
23
|
+
], Image.prototype, "texture", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
wireType("u16"),
|
|
26
|
+
__metadata("design:type", Object)
|
|
27
|
+
], Image.prototype, "frame", void 0);
|
|
28
|
+
//# sourceMappingURL=image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../src/components/image.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEtD,gEAAgE;AAChE,MAAM,OAAO,KAAK;IAAlB;QACE,gEAAgE;QAEzD,YAAO,GAAG,CAAC,CAAC;QAEnB,gDAAgD;QAEzC,UAAK,GAAG,CAAC,CAAC;IACnB,CAAC;CAAA;AALQ;IADN,QAAQ,CAAC,KAAK,CAAC;;sCACG;AAIZ;IADN,QAAQ,CAAC,KAAK,CAAC;;oCACC"}
|
package/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
export { Alpha, Depth, Position, Rotation, Scale } from "./components/transform.js";
|
|
2
2
|
export { FillStyle, StrokeStyle } from "./components/style.js";
|
|
3
|
+
export { Image } from "./components/image.js";
|
|
4
|
+
export type { AssetCatalog, AssetDescriptor, SpritesheetDescriptor } from "./catalog.js";
|
|
3
5
|
export { Arc, Ellipse, Line, Polygon, Rectangle, Size, Star, Triangle, } from "./components/shapes.js";
|
|
4
6
|
export { Text, TextAlign } from "./components/text.js";
|
|
5
7
|
import { Alpha, Depth, Position, Rotation, Scale } from "./components/transform.js";
|
|
6
8
|
import { FillStyle, StrokeStyle } from "./components/style.js";
|
|
9
|
+
import { Image } from "./components/image.js";
|
|
7
10
|
import { Arc, Ellipse, Line, Polygon, Rectangle, Size, Star, Triangle } from "./components/shapes.js";
|
|
8
11
|
import { Text } from "./components/text.js";
|
|
9
12
|
/**
|
|
@@ -27,11 +30,12 @@ import { Text } from "./components/text.js";
|
|
|
27
30
|
* 14 Star
|
|
28
31
|
* 15 Text
|
|
29
32
|
* 16 Size
|
|
33
|
+
* 17 Image
|
|
30
34
|
*/
|
|
31
|
-
export declare const phaserNetworkComponents: readonly [typeof Position, typeof Rotation, typeof Scale, typeof Alpha, typeof Depth, typeof FillStyle, typeof StrokeStyle, typeof Arc, typeof Ellipse, typeof Rectangle, typeof Polygon, typeof Line, typeof Triangle, typeof Star, typeof Text, typeof Size];
|
|
35
|
+
export declare const phaserNetworkComponents: readonly [typeof Position, typeof Rotation, typeof Scale, typeof Alpha, typeof Depth, typeof FillStyle, typeof StrokeStyle, typeof Arc, typeof Ellipse, typeof Rectangle, typeof Polygon, typeof Line, typeof Triangle, typeof Star, typeof Text, typeof Size, typeof Image];
|
|
32
36
|
/**
|
|
33
37
|
* The subset of network components that represent renderable shapes.
|
|
34
38
|
* Exactly one of these should be present on each renderable entity.
|
|
35
39
|
* Order matches phaserNetworkComponents (shapes section).
|
|
36
40
|
*/
|
|
37
|
-
export declare const phaserRenderableComponents: readonly [typeof Arc, typeof Ellipse, typeof Rectangle, typeof Polygon, typeof Line, typeof Triangle, typeof Star, typeof Text];
|
|
41
|
+
export declare const phaserRenderableComponents: readonly [typeof Arc, typeof Ellipse, typeof Rectangle, typeof Polygon, typeof Line, typeof Triangle, typeof Star, typeof Text, typeof Image];
|
package/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export { Alpha, Depth, Position, Rotation, Scale } from "./components/transform.js";
|
|
2
2
|
export { FillStyle, StrokeStyle } from "./components/style.js";
|
|
3
|
+
export { Image } from "./components/image.js";
|
|
3
4
|
export { Arc, Ellipse, Line, Polygon, Rectangle, Size, Star, Triangle, } from "./components/shapes.js";
|
|
4
5
|
export { Text, TextAlign } from "./components/text.js";
|
|
5
6
|
import { Alpha, Depth, Position, Rotation, Scale } from "./components/transform.js";
|
|
6
7
|
import { FillStyle, StrokeStyle } from "./components/style.js";
|
|
8
|
+
import { Image } from "./components/image.js";
|
|
7
9
|
import { Arc, Ellipse, Line, Polygon, Rectangle, Size, Star, Triangle, } from "./components/shapes.js";
|
|
8
10
|
import { Text } from "./components/text.js";
|
|
9
11
|
/**
|
|
@@ -27,6 +29,7 @@ import { Text } from "./components/text.js";
|
|
|
27
29
|
* 14 Star
|
|
28
30
|
* 15 Text
|
|
29
31
|
* 16 Size
|
|
32
|
+
* 17 Image
|
|
30
33
|
*/
|
|
31
34
|
export const phaserNetworkComponents = [
|
|
32
35
|
Position,
|
|
@@ -45,6 +48,7 @@ export const phaserNetworkComponents = [
|
|
|
45
48
|
Star,
|
|
46
49
|
Text,
|
|
47
50
|
Size,
|
|
51
|
+
Image,
|
|
48
52
|
];
|
|
49
53
|
/**
|
|
50
54
|
* The subset of network components that represent renderable shapes.
|
|
@@ -60,5 +64,6 @@ export const phaserRenderableComponents = [
|
|
|
60
64
|
Triangle,
|
|
61
65
|
Star,
|
|
62
66
|
Text,
|
|
67
|
+
Image,
|
|
63
68
|
];
|
|
64
69
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EACL,GAAG,EACH,OAAO,EACP,IAAI,EACJ,OAAO,EACP,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,QAAQ,GACT,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EACL,GAAG,EACH,OAAO,EACP,IAAI,EACJ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Q;IACR,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;CACuC,CAAC;AAE/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,GAAG;IACH,OAAO;IACP,SAAS;IACT,OAAO;IACP,IAAI;IACJ,QAAQ;IACR,IAAI;IACJ,IAAI;IACJ,KAAK;CACuC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vworlds/vecs-phaser",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.36",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"url": "git+https://github.com/vworlds/vecs.git"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@vworlds/vecs": "1.0.
|
|
19
|
-
"@vworlds/vecs-wire": "1.0.
|
|
18
|
+
"@vworlds/vecs": "1.0.36",
|
|
19
|
+
"@vworlds/vecs-wire": "1.0.36"
|
|
20
20
|
},
|
|
21
21
|
"license": "MIT"
|
|
22
22
|
}
|