@vworlds/vecs-phaser 1.0.36 → 1.0.37

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,3 +1,4 @@
1
+ import { Decoder, Encoder } from "@vworlds/vecs-wire";
1
2
  /** Fill color (RGB integer, e.g. 0xff0000) and opacity 0..1. */
2
3
  export declare class FillStyle {
3
4
  color: number;
@@ -10,3 +11,26 @@ export declare class StrokeStyle {
10
11
  /** Line width in screen pixels. */
11
12
  width: number;
12
13
  }
14
+ /**
15
+ * Multiplicative tint, one color per GameObject corner (top-left, top-right,
16
+ * bottom-left, bottom-right). White (0xffffff) = no tint.
17
+ *
18
+ * Two wire modes keep the encoding efficient:
19
+ * - **Monochromatic** (`monochromatic = true`): one u32 applies to all four
20
+ * corners. Set via the `value` setter (writes all four corners and flips the
21
+ * flag) or by constructing with identical corners.
22
+ * - **Polychromatic** (`monochromatic = false`): four independent u32 corners.
23
+ * Set the corner fields directly.
24
+ */
25
+ export declare class Tint {
26
+ topLeft: number;
27
+ topRight: number;
28
+ bottomLeft: number;
29
+ bottomRight: number;
30
+ monochromatic: boolean;
31
+ /** Uniform tint color; writing it sets all four corners and `monochromatic = true`. */
32
+ get value(): number;
33
+ set value(color: number);
34
+ wireEncode(encoder: Encoder): void;
35
+ static wireDecode(decoder: Decoder): Tint;
36
+ }
@@ -44,4 +44,63 @@ __decorate([
44
44
  wireType("f32"),
45
45
  __metadata("design:type", Object)
46
46
  ], StrokeStyle.prototype, "width", void 0);
47
+ /**
48
+ * Multiplicative tint, one color per GameObject corner (top-left, top-right,
49
+ * bottom-left, bottom-right). White (0xffffff) = no tint.
50
+ *
51
+ * Two wire modes keep the encoding efficient:
52
+ * - **Monochromatic** (`monochromatic = true`): one u32 applies to all four
53
+ * corners. Set via the `value` setter (writes all four corners and flips the
54
+ * flag) or by constructing with identical corners.
55
+ * - **Polychromatic** (`monochromatic = false`): four independent u32 corners.
56
+ * Set the corner fields directly.
57
+ */
58
+ export class Tint {
59
+ constructor() {
60
+ this.topLeft = 0xffffff;
61
+ this.topRight = 0xffffff;
62
+ this.bottomLeft = 0xffffff;
63
+ this.bottomRight = 0xffffff;
64
+ this.monochromatic = true;
65
+ }
66
+ /** Uniform tint color; writing it sets all four corners and `monochromatic = true`. */
67
+ get value() {
68
+ return this.topLeft;
69
+ }
70
+ set value(color) {
71
+ this.topLeft = color;
72
+ this.topRight = color;
73
+ this.bottomLeft = color;
74
+ this.bottomRight = color;
75
+ this.monochromatic = true;
76
+ }
77
+ wireEncode(encoder) {
78
+ encoder.write_bool(this.monochromatic);
79
+ if (this.monochromatic) {
80
+ encoder.write_u32(this.topLeft);
81
+ return;
82
+ }
83
+ encoder.write_u32(this.topLeft);
84
+ encoder.write_u32(this.topRight);
85
+ encoder.write_u32(this.bottomLeft);
86
+ encoder.write_u32(this.bottomRight);
87
+ }
88
+ static wireDecode(decoder) {
89
+ const t = new Tint();
90
+ t.monochromatic = decoder.read_bool();
91
+ if (t.monochromatic) {
92
+ const c = decoder.read_u32();
93
+ t.topLeft = c;
94
+ t.topRight = c;
95
+ t.bottomLeft = c;
96
+ t.bottomRight = c;
97
+ return t;
98
+ }
99
+ t.topLeft = decoder.read_u32();
100
+ t.topRight = decoder.read_u32();
101
+ t.bottomLeft = decoder.read_u32();
102
+ t.bottomRight = decoder.read_u32();
103
+ return t;
104
+ }
105
+ }
47
106
  //# sourceMappingURL=style.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","sourceRoot":"","sources":["../../src/components/style.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEtD,gEAAgE;AAChE,MAAM,OAAO,SAAS;IAAtB;QAES,UAAK,GAAG,QAAQ,CAAC;QAGjB,UAAK,GAAG,CAAC,CAAC;IACnB,CAAC;CAAA;AAJQ;IADN,QAAQ,CAAC,KAAK,CAAC;;wCACQ;AAGjB;IADN,QAA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AC;QACD,CAAC,CAAC,OAAO,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;QAC/B,CAAC,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;QAChC,CAAC,CAAC,UAAU,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;QAClC,CAAC,CAAC,WAAW,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;QACnC,OAAO,CAAC,CAAC;IACX,CAAC;CACF"}
package/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  export { Alpha, Depth, Position, Rotation, Scale } from "./components/transform.js";
2
- export { FillStyle, StrokeStyle } from "./components/style.js";
2
+ export { FillStyle, StrokeStyle, Tint } from "./components/style.js";
3
3
  export { Image } from "./components/image.js";
4
4
  export type { AssetCatalog, AssetDescriptor, SpritesheetDescriptor } from "./catalog.js";
5
5
  export { Arc, Ellipse, Line, Polygon, Rectangle, Size, Star, Triangle, } from "./components/shapes.js";
6
6
  export { Text, TextAlign } from "./components/text.js";
7
7
  import { Alpha, Depth, Position, Rotation, Scale } from "./components/transform.js";
8
- import { FillStyle, StrokeStyle } from "./components/style.js";
8
+ import { FillStyle, StrokeStyle, Tint } from "./components/style.js";
9
9
  import { Image } from "./components/image.js";
10
10
  import { Arc, Ellipse, Line, Polygon, Rectangle, Size, Star, Triangle } from "./components/shapes.js";
11
11
  import { Text } from "./components/text.js";
@@ -28,11 +28,12 @@ import { Text } from "./components/text.js";
28
28
  * 12 Line
29
29
  * 13 Triangle
30
30
  * 14 Star
31
- * 15 Text
32
- * 16 Size
33
- * 17 Image
31
+ * 15 Text
32
+ * 16 Size
33
+ * 17 Image
34
+ * 18 Tint
34
35
  */
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];
36
+ 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, typeof Tint];
36
37
  /**
37
38
  * The subset of network components that represent renderable shapes.
38
39
  * Exactly one of these should be present on each renderable entity.
package/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  export { Alpha, Depth, Position, Rotation, Scale } from "./components/transform.js";
2
- export { FillStyle, StrokeStyle } from "./components/style.js";
2
+ export { FillStyle, StrokeStyle, Tint } from "./components/style.js";
3
3
  export { Image } from "./components/image.js";
4
4
  export { Arc, Ellipse, Line, Polygon, Rectangle, Size, Star, Triangle, } from "./components/shapes.js";
5
5
  export { Text, TextAlign } from "./components/text.js";
6
6
  import { Alpha, Depth, Position, Rotation, Scale } from "./components/transform.js";
7
- import { FillStyle, StrokeStyle } from "./components/style.js";
7
+ import { FillStyle, StrokeStyle, Tint } from "./components/style.js";
8
8
  import { Image } from "./components/image.js";
9
9
  import { Arc, Ellipse, Line, Polygon, Rectangle, Size, Star, Triangle, } from "./components/shapes.js";
10
10
  import { Text } from "./components/text.js";
@@ -27,9 +27,10 @@ import { Text } from "./components/text.js";
27
27
  * 12 Line
28
28
  * 13 Triangle
29
29
  * 14 Star
30
- * 15 Text
31
- * 16 Size
32
- * 17 Image
30
+ * 15 Text
31
+ * 16 Size
32
+ * 17 Image
33
+ * 18 Tint
33
34
  */
34
35
  export const phaserNetworkComponents = [
35
36
  Position,
@@ -49,6 +50,7 @@ export const phaserNetworkComponents = [
49
50
  Text,
50
51
  Size,
51
52
  Image,
53
+ Tint,
52
54
  ];
53
55
  /**
54
56
  * The subset of network components that represent renderable shapes.
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,K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;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.36",
3
+ "version": "1.0.37",
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.36",
19
- "@vworlds/vecs-wire": "1.0.36"
18
+ "@vworlds/vecs": "1.0.37",
19
+ "@vworlds/vecs-wire": "1.0.37"
20
20
  },
21
21
  "license": "MIT"
22
22
  }