@zylem/game-lib 0.9.5 → 0.9.6

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.
Files changed (47) hide show
  1. package/dist/actions.d.ts +2 -2
  2. package/dist/api/game-lib.api.json +526 -175
  3. package/dist/api/game-lib.api.md +41 -11
  4. package/dist/api/game-lib.d.ts +172 -26
  5. package/dist/api/game-lib.typedoc.json +48943 -48302
  6. package/dist/bridge.d.ts +8 -1
  7. package/dist/bridge.js +1 -1
  8. package/dist/catalog.js +1 -1
  9. package/dist/{chunk-BQRMYLYD.js → chunk-273CUPEO.js} +1 -1
  10. package/dist/chunk-5V52N34T.js +1 -0
  11. package/dist/{chunk-YQS7CGXE.js → chunk-FUZDTRCU.js} +1 -1
  12. package/dist/{chunk-4CZZZCFB.js → chunk-JCGW5PIR.js} +1 -1
  13. package/dist/chunk-KIFB427K.js +1 -0
  14. package/dist/chunk-P6IOYQHU.js +1 -0
  15. package/dist/{chunk-2IJLXFWY.js → chunk-RPMV7GDX.js} +4 -4
  16. package/dist/chunk-UM5VNQPY.js +1 -0
  17. package/dist/chunk-VKWJHFUR.js +1 -0
  18. package/dist/chunk-VXE3CV3K.js +1 -0
  19. package/dist/chunk-Y23IJJPD.js +1 -0
  20. package/dist/chunk-YRHRMVHS.js +1 -0
  21. package/dist/cinematics.d.ts +4 -3
  22. package/dist/core.d.ts +20 -7
  23. package/dist/core.js +1 -1
  24. package/dist/{debug-state-Cg3f5FB6.d.ts → debug-state-DhVkY2aM.d.ts} +2 -2
  25. package/dist/debug.d.ts +2 -2
  26. package/dist/debug.js +1 -1
  27. package/dist/{entity-XqvuWgPm.d.ts → entity-DC0P747T.d.ts} +5 -0
  28. package/dist/{entity-type-map-CrsrKT8c.d.ts → entity-type-map-B0S5cfv7.d.ts} +52 -13
  29. package/dist/entity.d.ts +5 -17
  30. package/dist/entity.js +1 -1
  31. package/dist/{game-default-BAZPDNPS.js → game-default-VUMUMTXA.js} +1 -1
  32. package/dist/{game-DBt7iVu4.d.ts → game-mu6OSCrq.d.ts} +7 -7
  33. package/dist/level-types-D10LiOcn.d.ts +91 -0
  34. package/dist/public.d.ts +8 -7
  35. package/dist/public.js +1 -1
  36. package/dist/{stage-PBmwT5-Y.d.ts → stage-B_KdSEK6.d.ts} +15 -2
  37. package/dist/web-components.d.ts +6 -5
  38. package/dist/web-components.js +1 -1
  39. package/package.json +3 -3
  40. package/dist/chunk-3CLQWJ2I.js +0 -1
  41. package/dist/chunk-GPCSX3M6.js +0 -1
  42. package/dist/chunk-K3NNXZIJ.js +0 -1
  43. package/dist/chunk-KP6DLLJO.js +0 -1
  44. package/dist/chunk-LI43BZQN.js +0 -1
  45. package/dist/chunk-NK4IXK5V.js +0 -1
  46. package/dist/chunk-STVEILJJ.js +0 -1
  47. package/dist/chunk-VSFULLND.js +0 -1
@@ -688,6 +688,7 @@ export class CameraManager implements EditorCameraHost {
688
688
  activateCameraById(id: string): boolean;
689
689
  // Warning: (ae-forgotten-export) The symbol "ZylemCamera" needs to be exported by the entry point public.d.ts
690
690
  get activeCameras(): ReadonlyArray<ZylemCamera>;
691
+ activeEditorCameraId(): string | null;
691
692
  addActiveCamera(nameOrRef: string | ZylemCamera): boolean;
692
693
  addCamera(camera: ZylemCamera, name?: string): string;
693
694
  get allCameras(): ReadonlyArray<ZylemCamera>;
@@ -1582,7 +1583,7 @@ export type DebugEntityResolver = (uuid: string) => GameEntity<any> | null;
1582
1583
  export const debugState: DebugState;
1583
1584
 
1584
1585
  // @public (undocumented)
1585
- export type DebugTools = 'select' | 'translate' | 'rotate' | 'scale' | 'delete' | 'add' | 'none';
1586
+ export type DebugTools = 'select' | 'translate' | 'rotate' | 'scale' | 'delete' | 'add' | 'brush' | 'clip' | 'vertex' | 'none';
1586
1587
 
1587
1588
  // @public (undocumented)
1588
1589
  export const DEFAULT_SNAP_SETTINGS: SnapSettings;
@@ -2198,6 +2199,10 @@ export interface GameBridgeHost {
2198
2199
  seek(time: number): void;
2199
2200
  unload(): void;
2200
2201
  };
2202
+ levelClose?(): void;
2203
+ levelPlay?(document: LevelDocument): void;
2204
+ // Warning: (ae-forgotten-export) The symbol "LevelSyncPayload" needs to be exported by the entry point public.d.ts
2205
+ levelSync?(payload: LevelSyncPayload): void;
2201
2206
  pickEntity?(ndc: BridgeNdc): EntitySummaryPayload | null;
2202
2207
  resolveEntity(uuid: string): GameEntity<any> | null;
2203
2208
  setStageVariable?(key: string, value: unknown): void;
@@ -2567,6 +2572,7 @@ export type GameEntityOptions = {
2567
2572
  position?: Vec3Input;
2568
2573
  hideUntilPositioned?: boolean;
2569
2574
  visible?: boolean;
2575
+ editorOwned?: boolean;
2570
2576
  category?: RenderCategory_2;
2571
2577
  runtime?: RuntimeEntityOptions;
2572
2578
  collision?: Partial<CollisionOptions>;
@@ -2830,6 +2836,9 @@ export { GameToEditorMessages }
2830
2836
 
2831
2837
  export { GameVariablePayload }
2832
2838
 
2839
+ // @public
2840
+ export function getActiveLevelDocument(): LevelDocument | null;
2841
+
2833
2842
  // @public
2834
2843
  export function getActiveSongPlayer(): SongPlayer | null;
2835
2844
 
@@ -3180,6 +3189,24 @@ export function lerpVec3(a: Vec3Def, b: Vec3Def, t: number): Vec3Def;
3180
3189
 
3181
3190
  export { LevelBuffer }
3182
3191
 
3192
+ // @public
3193
+ export interface LevelDocument {
3194
+ // Warning: (ae-forgotten-export) The symbol "DoodadPlacement" needs to be exported by the entry point public.d.ts
3195
+ //
3196
+ // (undocumented)
3197
+ doodads: DoodadPlacement[];
3198
+ // Warning: (ae-forgotten-export) The symbol "EntityPlacement" needs to be exported by the entry point public.d.ts
3199
+ //
3200
+ // (undocumented)
3201
+ entities: EntityPlacement[];
3202
+ // Warning: (ae-forgotten-export) The symbol "BrushSolid" needs to be exported by the entry point public.d.ts
3203
+ //
3204
+ // (undocumented)
3205
+ solids: BrushSolid[];
3206
+ // (undocumented)
3207
+ version: 2;
3208
+ }
3209
+
3183
3210
  // @public
3184
3211
  export interface LevelStage {
3185
3212
  // (undocumented)
@@ -3669,6 +3696,9 @@ export function radiansToDegrees(radians: number): number;
3669
3696
  // @public (undocumented)
3670
3697
  export const RECT_TYPE: unique symbol;
3671
3698
 
3699
+ // @public (undocumented)
3700
+ export type RectShape = 'rect' | 'ellipse';
3701
+
3672
3702
  export { registerCooldown }
3673
3703
 
3674
3704
  // @public
@@ -6058,7 +6088,7 @@ export class ZylemRect extends GameEntity<ZylemRectOptions> {
6058
6088
  // (undocumented)
6059
6089
  static type: symbol;
6060
6090
  // (undocumented)
6061
- updateRect(options?: Partial<Pick<ZylemRectOptions, 'width' | 'height' | 'fillColor' | 'strokeColor' | 'strokeWidth' | 'radius'>>): void;
6091
+ updateRect(options?: Partial<Pick<ZylemRectOptions, 'width' | 'height' | 'fillColor' | 'strokeColor' | 'strokeWidth' | 'radius' | 'shape' | 'image'>>): void;
6062
6092
  }
6063
6093
 
6064
6094
  // @public
@@ -6201,15 +6231,15 @@ export class ZylemZone extends GameEntity<ZylemZoneOptions> implements Collision
6201
6231
 
6202
6232
  // Warnings were encountered during analysis:
6203
6233
  //
6204
- // dist/entity-XqvuWgPm.d.ts:332:5 - (ae-forgotten-export) The symbol "RenderCategory_2" needs to be exported by the entry point public.d.ts
6205
- // dist/entity-XqvuWgPm.d.ts:333:5 - (ae-forgotten-export) The symbol "RuntimeEntityOptions" needs to be exported by the entry point public.d.ts
6206
- // dist/entity-XqvuWgPm.d.ts:334:5 - (ae-forgotten-export) The symbol "CollisionOptions" needs to be exported by the entry point public.d.ts
6207
- // dist/entity-XqvuWgPm.d.ts:343:9 - (ae-forgotten-export) The symbol "IBuilder" needs to be exported by the entry point public.d.ts
6208
- // dist/entity-XqvuWgPm.d.ts:343:9 - (ae-forgotten-export) The symbol "EntityMeshBuilder" needs to be exported by the entry point public.d.ts
6209
- // dist/entity-XqvuWgPm.d.ts:344:9 - (ae-forgotten-export) The symbol "EntityCollisionBuilder" needs to be exported by the entry point public.d.ts
6210
- // dist/entity-XqvuWgPm.d.ts:345:9 - (ae-forgotten-export) The symbol "MaterialBuilder" needs to be exported by the entry point public.d.ts
6211
- // dist/game-DBt7iVu4.d.ts:258:5 - (ae-forgotten-export) The symbol "StageInterface" needs to be exported by the entry point public.d.ts
6212
- // dist/stage-PBmwT5-Y.d.ts:1150:5 - (ae-forgotten-export) The symbol "StageAssetLoaderConfig" needs to be exported by the entry point public.d.ts
6234
+ // dist/entity-DC0P747T.d.ts:337:5 - (ae-forgotten-export) The symbol "RenderCategory_2" needs to be exported by the entry point public.d.ts
6235
+ // dist/entity-DC0P747T.d.ts:338:5 - (ae-forgotten-export) The symbol "RuntimeEntityOptions" needs to be exported by the entry point public.d.ts
6236
+ // dist/entity-DC0P747T.d.ts:339:5 - (ae-forgotten-export) The symbol "CollisionOptions" needs to be exported by the entry point public.d.ts
6237
+ // dist/entity-DC0P747T.d.ts:348:9 - (ae-forgotten-export) The symbol "IBuilder" needs to be exported by the entry point public.d.ts
6238
+ // dist/entity-DC0P747T.d.ts:348:9 - (ae-forgotten-export) The symbol "EntityMeshBuilder" needs to be exported by the entry point public.d.ts
6239
+ // dist/entity-DC0P747T.d.ts:349:9 - (ae-forgotten-export) The symbol "EntityCollisionBuilder" needs to be exported by the entry point public.d.ts
6240
+ // dist/entity-DC0P747T.d.ts:350:9 - (ae-forgotten-export) The symbol "MaterialBuilder" needs to be exported by the entry point public.d.ts
6241
+ // dist/game-mu6OSCrq.d.ts:258:5 - (ae-forgotten-export) The symbol "StageInterface" needs to be exported by the entry point public.d.ts
6242
+ // dist/stage-B_KdSEK6.d.ts:1163:5 - (ae-forgotten-export) The symbol "StageAssetLoaderConfig" needs to be exported by the entry point public.d.ts
6213
6243
 
6214
6244
  // (No @packageDocumentation comment for this package)
6215
6245
 
@@ -822,6 +822,35 @@ export { BridgeNdc }
822
822
 
823
823
  export { BridgeVec3 }
824
824
 
825
+ declare interface BrushPlane {
826
+ normal: BrushVec3;
827
+ /** The solid is `normal · point <= distance`. */
828
+ distance: number;
829
+ }
830
+
831
+ /** One convex solid. Planes are world-space half-spaces. */
832
+ declare interface BrushSolid {
833
+ id: string;
834
+ planes: BrushPlane[];
835
+ }
836
+
837
+ /**
838
+ * Convex brush kernel.
839
+ *
840
+ * A brush is the intersection of half-spaces: a point is inside when
841
+ * `normal · point <= distance` for every plane. The normal points outward.
842
+ * Planes are world-space, so moving a brush shifts every distance by
843
+ * `normal · delta`. No Three.js and no physics types.
844
+ *
845
+ * Copy of `packages/bridge/src/level/brush.ts`, kept inside this package so
846
+ * the declaration build does not reach outside `src`.
847
+ */
848
+ declare interface BrushVec3 {
849
+ x: number;
850
+ y: number;
851
+ z: number;
852
+ }
853
+
825
854
  /** Cuboid collider sized as `size.xyz` (full extents — half-extents are computed). */
826
855
  export declare function buildBoxCollider(size: Vec3Input, options?: RuntimeColliderOptions): StageColliderConfig;
827
856
 
@@ -1003,6 +1032,8 @@ export declare class CameraManager implements EditorCameraHost {
1003
1032
  get primaryCamera(): ZylemCamera | null;
1004
1033
  /** True while side, top, isometric, or free is the main view. */
1005
1034
  isEditorViewActive(): boolean;
1035
+ /** Id of the editor view that is currently the main camera, if one is. */
1036
+ activeEditorCameraId(): string | null;
1006
1037
  /** True after the four editor views have been created. */
1007
1038
  hasEditorCameras(): boolean;
1008
1039
  /**
@@ -2545,7 +2576,7 @@ declare interface DebugState {
2545
2576
 
2546
2577
  export declare const debugState: DebugState;
2547
2578
 
2548
- export declare type DebugTools = 'select' | 'translate' | 'rotate' | 'scale' | 'delete' | 'add' | 'none';
2579
+ export declare type DebugTools = 'select' | 'translate' | 'rotate' | 'scale' | 'delete' | 'add' | 'brush' | 'clip' | 'vertex' | 'none';
2549
2580
 
2550
2581
  export declare const DEFAULT_SNAP_SETTINGS: SnapSettings;
2551
2582
 
@@ -2706,6 +2737,14 @@ export declare const DollyPathSchema: _sinclair_typebox.TObject<{
2706
2737
  /** Point along a dolly path at `u` in 0…1 (arc-length parameterised). */
2707
2738
  export declare function dollyPointAt(path: DollyPath, u: number): Vec3Def;
2708
2739
 
2740
+ /** A visual placement. Spawned with no collider. */
2741
+ declare interface DoodadPlacement {
2742
+ id: string;
2743
+ typeId: string;
2744
+ pose: BridgePose;
2745
+ props: Record<string, unknown>;
2746
+ }
2747
+
2709
2748
  export { dot }
2710
2749
 
2711
2750
  /**
@@ -2919,6 +2958,20 @@ export { EntityPickPayload }
2919
2958
 
2920
2959
  export { EntityPickResultPayload }
2921
2960
 
2961
+ /**
2962
+ * A gameplay marker.
2963
+ *
2964
+ * `typeId` is `spawn` or `zone`. Spawn props carry `spawnKind`
2965
+ * (`player` | `enemy` | `item`) and `archetype`. Trigger props carry `size`.
2966
+ */
2967
+ declare interface EntityPlacement {
2968
+ id: string;
2969
+ typeId: string;
2970
+ name: string;
2971
+ pose: BridgePose;
2972
+ props: Record<string, unknown>;
2973
+ }
2974
+
2922
2975
  /**
2923
2976
  * Runtime entity blueprint (open `data` for factory spreading).
2924
2977
  * Prefer {@link EntityJsonSchema} for editor / Monaco JSON Schema.
@@ -3695,6 +3748,12 @@ export declare interface GameBridgeHost {
3695
3748
  };
3696
3749
  /** Describe the live camera (`camera:pose:get`), for capturing framing into a cutscene. */
3697
3750
  cameraPose?(): Omit<CameraPosePayload, 'requestId'> | null;
3751
+ /** Draw the level document as an edit preview (`level:sync`). */
3752
+ levelSync?(payload: LevelSyncPayload): void;
3753
+ /** Spawn collision, doodads, and triggers for play (`level:play`). */
3754
+ levelPlay?(document: LevelDocument): void;
3755
+ /** Remove the level preview (`level:close`). */
3756
+ levelClose?(): void;
3698
3757
  }
3699
3758
 
3700
3759
  /**
@@ -4284,6 +4343,11 @@ export declare type GameEntityOptions = {
4284
4343
  hideUntilPositioned?: boolean;
4285
4344
  /** Explicit render visibility. When false, entity stays hidden until {@link GameEntity.reveal}. */
4286
4345
  visible?: boolean;
4346
+ /**
4347
+ * Level-mode object. Stays out of the entity list so the live stage cannot
4348
+ * be written back over the level document.
4349
+ */
4350
+ editorOwned?: boolean;
4287
4351
  /** Render path: `environment` (bundle), `pack` (instanced), or `none` (default). */
4288
4352
  category?: RenderCategory_2;
4289
4353
  runtime?: RuntimeEntityOptions;
@@ -4535,6 +4599,18 @@ export { GameToEditorMessages }
4535
4599
 
4536
4600
  export { GameVariablePayload }
4537
4601
 
4602
+ /**
4603
+ * The stage's picture of the level document.
4604
+ *
4605
+ * The editor owns the file. This session draws it, reports finished gestures,
4606
+ * and on play swaps the brush faces for one static body of convex hulls.
4607
+ * Nothing it creates is a normal stage entity except play-mode trigger zones,
4608
+ * and those are marked editor-owned so they are not published back.
4609
+ */
4610
+
4611
+ /** The document currently previewed or playing, for hosts that spawn from markers. */
4612
+ export declare function getActiveLevelDocument(): LevelDocument | null;
4613
+
4538
4614
  /** The most recently created, still-live song player, if any. */
4539
4615
  export declare function getActiveSongPlayer(): SongPlayer | null;
4540
4616
 
@@ -5058,6 +5134,41 @@ export declare function lerpVec3(a: Vec3Def, b: Vec3Def, t: number): Vec3Def;
5058
5134
 
5059
5135
  export { LevelBuffer }
5060
5136
 
5137
+ /**
5138
+ * The level file. The editor owns it; the stage only previews and plays it.
5139
+ *
5140
+ * `version` is 2 so a v1 catalog buffer is recognisable and left alone.
5141
+ */
5142
+ export declare interface LevelDocument {
5143
+ version: 2;
5144
+ solids: BrushSolid[];
5145
+ doodads: DoodadPlacement[];
5146
+ entities: EntityPlacement[];
5147
+ }
5148
+
5149
+ /**
5150
+ * Level document shapes shared with the editor over the bridge.
5151
+ *
5152
+ * Defined here, matching `packages/bridge/src/protocol.ts`, because the
5153
+ * installed `@zylem/bridge` build does not export them yet and the
5154
+ * declaration build cannot import files outside this package.
5155
+ */
5156
+
5157
+ /** Which list in a level document an edit or a visibility toggle addresses. */
5158
+ declare type LevelLayerId = 'solid' | 'doodad' | 'entity';
5159
+
5160
+ /** What the Add tool will write into the document on the next click. */
5161
+ declare type LevelPlacementArm = {
5162
+ kind: 'doodad';
5163
+ typeId: string;
5164
+ props?: Record<string, unknown>;
5165
+ } | {
5166
+ kind: 'spawn';
5167
+ } | {
5168
+ kind: 'trigger';
5169
+ size: BridgeVec3;
5170
+ };
5171
+
5061
5172
  /**
5062
5173
  * Stream a level buffer into a stage through the catalog.
5063
5174
  *
@@ -5071,6 +5182,15 @@ export declare interface LevelStage {
5071
5182
  spawnEntity(node: BaseNode): Promise<void> | void;
5072
5183
  }
5073
5184
 
5185
+ /** Edit-time preview. Hidden layers are omitted; play ignores this and streams everything. */
5186
+ declare interface LevelSyncPayload {
5187
+ document: LevelDocument;
5188
+ hiddenLayers: LevelLayerId[];
5189
+ selectedIds: string[];
5190
+ activeLayer: LevelLayerId;
5191
+ placement: LevelPlacementArm | null;
5192
+ }
5193
+
5074
5194
  /**
5075
5195
  * Provides BaseNode-like lifecycle without ECS/children. Consumers implement
5076
5196
  * the protected hooks and may assign public setup/update/destroy callbacks.
@@ -5961,6 +6081,8 @@ export declare const RECT_TYPE: unique symbol;
5961
6081
 
5962
6082
  declare type RectOptions = BaseNode | Partial<ZylemRectOptions>;
5963
6083
 
6084
+ export declare type RectShape = 'rect' | 'ellipse';
6085
+
5964
6086
  export { registerCooldown }
5965
6087
 
5966
6088
  /**
@@ -6658,13 +6780,13 @@ export declare interface ScheduleOptions {
6658
6780
  export declare function scheduleSong(song: SongDefinition, options?: ScheduleOptions): SongSchedule;
6659
6781
 
6660
6782
  /**
6661
- * CooldownIcon -- a WoW-style cooldown icon UI entity.
6783
+ * Viewport placement shared by the camera-attached HUD entities.
6662
6784
  *
6663
- * Renders a square icon with a semi-transparent clockwise sweep overlay
6664
- * that reflects cooldown progress from the CooldownStore. Optionally shows
6665
- * remaining time text in the center.
6666
- *
6667
- * Modeled after ZylemRect's canvas-based viewport-attached sprite pattern.
6785
+ * Text, rects, and cooldown icons all pin a canvas-drawn sprite to a point on
6786
+ * screen by parenting it to the camera and placing it on a plane `zDistance`
6787
+ * in front of the lens. This module holds what they share: the named viewport
6788
+ * anchors, the viewport size layouts resolve against, and the camera-local
6789
+ * transform for a box of a given pixel size pinned to a point on screen.
6668
6790
  */
6669
6791
 
6670
6792
  /**
@@ -7693,6 +7815,9 @@ declare class StageDebugDelegate {
7693
7815
  private selectionBoundsPool;
7694
7816
  private hoverBounds;
7695
7817
  private grid;
7818
+ private levelSession;
7819
+ /** The press belongs to the level session, through pointerup. */
7820
+ private levelPointer;
7696
7821
  private lastTool;
7697
7822
  /** Element the current gizmo drag captured, so pointerup is never missed. */
7698
7823
  private capturedPointer;
@@ -7702,6 +7827,13 @@ declare class StageDebugDelegate {
7702
7827
  * point. Without one the tool warns instead of silently doing nothing.
7703
7828
  */
7704
7829
  setAddEntityFactory(factory: AddEntityFactory | null): void;
7830
+ /** Show the level document as an edit preview. Brush faces, no collision. */
7831
+ syncLevel(payload: LevelSyncPayload): void;
7832
+ /** Respawn the document for play: hull collision, hidden brush faces, live zones. */
7833
+ playLevel(document: LevelDocument): void;
7834
+ /** Remove the preview and any play collision. Stage entities stay. */
7835
+ closeLevel(): void;
7836
+ private levelSessionHost;
7705
7837
  /** Camera used for raycasts and gizmos: whichever one is rendering. */
7706
7838
  private getDebugViewCamera;
7707
7839
  private resolveEntity;
@@ -9989,21 +10121,13 @@ declare class ZylemCooldownIcon extends GameEntity<ZylemCooldownIconOptions> {
9989
10121
  private createSprite;
9990
10122
  private redraw;
9991
10123
  private toCssColor;
9992
- private getResolution;
9993
10124
  private iconSetup;
9994
10125
  private iconUpdate;
9995
- /**
9996
- * Resolve screen position to pixels.
9997
- * Computes the anchor point in pixels, then adds the view-unit offset.
9998
- */
9999
- private resolveScreenPosition;
10000
10126
  /**
10001
10127
  * Resolve `iconSize` to screen pixels using the view-unit grid.
10002
10128
  * Viewport height = {@link VIEW_UNITS_HEIGHT} units; width scales with aspect ratio.
10003
10129
  */
10004
10130
  private resolveIconSize;
10005
- /** Compute the world-space half-extents at a given distance from the camera. */
10006
- private computeWorldExtents;
10007
10131
  private updateStickyTransform;
10008
10132
  /**
10009
10133
  * Dispose Three.js / DOM resources when the entity is destroyed.
@@ -10627,25 +10751,27 @@ export declare class ZylemRect extends GameEntity<ZylemRectOptions> {
10627
10751
  private _cameraRef;
10628
10752
  private _lastCanvasW;
10629
10753
  private _lastCanvasH;
10754
+ private _image;
10755
+ private _imageSource;
10630
10756
  constructor(options?: ZylemRectOptions);
10631
10757
  private createSprite;
10758
+ /** Starts loading `options.image` when it differs from what is drawn. */
10759
+ private loadImage;
10632
10760
  private redrawRect;
10633
10761
  getWidth(): number;
10634
10762
  getHeight(): number;
10635
10763
  private roundedRectPath;
10636
10764
  private toCssColor;
10637
- /**
10638
- * Get the viewport resolution from the renderer DOM element,
10639
- * falling back to the camera's screenResolution if the renderer
10640
- * is not available (e.g. when using the new RendererManager path).
10641
- */
10642
- private getResolution;
10643
10765
  private rectSetup;
10644
10766
  private rectUpdate;
10767
+ /** Where the rect's anchor goes on screen, in pixels from the top-left. */
10768
+ private screenPoint;
10769
+ /** Point of the rect placed on its screen position, as 0..1 fractions of its box. */
10770
+ private pivot;
10645
10771
  private updateStickyTransform;
10646
10772
  private worldToScreen;
10647
10773
  private computeScreenBoundsFromOptions;
10648
- updateRect(options?: Partial<Pick<ZylemRectOptions, 'width' | 'height' | 'fillColor' | 'strokeColor' | 'strokeWidth' | 'radius'>>): void;
10774
+ updateRect(options?: Partial<Pick<ZylemRectOptions, 'width' | 'height' | 'fillColor' | 'strokeColor' | 'strokeWidth' | 'radius' | 'shape' | 'image'>>): void;
10649
10775
  buildInfo(): Record<string, any>;
10650
10776
  }
10651
10777
 
@@ -10657,9 +10783,23 @@ declare type ZylemRectOptions = GameEntityOptions & {
10657
10783
  strokeWidth?: number;
10658
10784
  radius?: number;
10659
10785
  padding?: number;
10786
+ /** `ellipse` inscribes an ellipse in the width × height box and ignores `radius`. */
10787
+ shape?: RectShape;
10788
+ /** Image URL drawn over the fill, stretched to the box and clipped to the shape. */
10789
+ image?: string | null;
10660
10790
  stickToViewport?: boolean;
10791
+ /**
10792
+ * Viewport point the rect is positioned from. When set, `screenPosition` is
10793
+ * a pixel offset from it (+x right, +y down) and `anchor` defaults to the
10794
+ * same point, so a `bottom-right` rect sits inside that corner.
10795
+ */
10796
+ screenAnchor?: ScreenAnchor;
10661
10797
  screenPosition?: Vec2Input;
10662
10798
  zDistance?: number;
10799
+ /**
10800
+ * Point of the rect placed on its screen position, 0-100 per axis. Defaults
10801
+ * to the `screenAnchor` point when one is set, otherwise top-left (0,0).
10802
+ */
10663
10803
  anchor?: Vec2Input;
10664
10804
  bounds?: {
10665
10805
  screen?: {
@@ -10993,10 +11133,8 @@ export declare class ZylemText extends GameEntity<ZylemTextOptions> {
10993
11133
  private toCssColor;
10994
11134
  private textSetup;
10995
11135
  private textUpdate;
10996
- private getResolution;
10997
- private getScreenPixels;
10998
- private computeWorldExtents;
10999
- private updateSpriteScale;
11136
+ /** Where the text's pivot goes on screen, in pixels from the top-left. */
11137
+ private screenPoint;
11000
11138
  private updateWorldSpriteScale;
11001
11139
  private updateStickyTransform;
11002
11140
  updateText(_text: string): void;
@@ -11015,6 +11153,14 @@ declare type ZylemTextOptions = GameEntityOptions & {
11015
11153
  backgroundColor?: Color | string | null;
11016
11154
  padding?: number;
11017
11155
  stickToViewport?: boolean;
11156
+ /**
11157
+ * Viewport point the text is positioned from. When set, `screenPosition` is
11158
+ * a pixel offset from it (+x right, +y down) and the text aligns to the same
11159
+ * point, so `top-right` text ends at that corner. Without it,
11160
+ * `screenPosition` is the text's centre, in pixels or as 0..1 fractions of
11161
+ * the viewport.
11162
+ */
11163
+ screenAnchor?: ScreenAnchor;
11018
11164
  screenPosition?: Vec2Input;
11019
11165
  zDistance?: number;
11020
11166
  };