@holtjs/stage 0.6.0 → 0.7.0
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/CHANGELOG.md +14 -0
- package/dist/anims-CS0rfUIz.d.ts +389 -0
- package/dist/anims.d.ts +2 -0
- package/dist/anims.js +436 -0
- package/dist/{game-Blm49zGH.d.ts → game-3L9wS-Bv.d.ts} +112 -202
- package/dist/{game-Ds-cn2YI.js → game-BnSWR44q.js} +179 -5
- package/dist/headless.d.ts +5 -1
- package/dist/headless.js +18 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +5 -3
- package/dist/joystick.d.ts +1 -1
- package/dist/kernel.d.ts +1 -1
- package/dist/lighting.d.ts +1 -1
- package/dist/projection.d.ts +1 -1
- package/dist/{renderer-webgpu-DJVQHR70.js → renderer-webgpu-alSDj9RR.js} +410 -29
- package/dist/renderer-webgpu.d.ts +1 -1
- package/dist/renderer-webgpu.js +1 -1
- package/dist/rig2d.d.ts +2 -1
- package/dist/tilemap.d.ts +14 -3
- package/dist/tilemap.js +84 -10
- package/dist/trace.d.ts +1 -1
- package/dist/trace.js +7 -1
- package/package.json +5 -1
- package/skills/stage/SKILL.md +23 -7
- package/skills/stage/references/subpaths.md +11 -7
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { _ as rgbToCss, a as EventEmitter, c as Scale, h as packColorAbgr, l as Scenes, m as createMatrix2D, o as FilterMode, p as WHITE_RGB, r as BlendModes, u as TintModes } from "./types-CXsCvp1p.js";
|
|
2
|
-
import {
|
|
2
|
+
import { AnimationManager } from "./anims.js";
|
|
3
|
+
import { _ as SpriteObject, a as Container, b as Camera, d as InstancedBatchObject, f as MsdfIconObject, g as ShapeBatchObject, h as RectangleObject, i as BlitterObject, l as Graphics, m as PanelObject, o as CustomPassObject, p as NineSliceObject, r as Renderer2D, s as DisplayList, t as RendererWebGpu, u as ImageObject, v as TextObject, y as TileSpriteObject } from "./renderer-webgpu-alSDj9RR.js";
|
|
3
4
|
import { TweenManager } from "./tween.js";
|
|
4
5
|
import { StageKernel } from "./kernel.js";
|
|
5
6
|
// src/texture.ts
|
|
@@ -85,12 +86,28 @@ var Frame = class {
|
|
|
85
86
|
v0 = 0;
|
|
86
87
|
u1 = 1;
|
|
87
88
|
v1 = 1;
|
|
88
|
-
|
|
89
|
+
/** True when the atlas/baker specified an explicit per-frame pivot (`ax/ay` or `pivotX/pivotY`). */
|
|
90
|
+
customPivot = false;
|
|
91
|
+
pivotX = .5;
|
|
92
|
+
pivotY = .5;
|
|
93
|
+
pixelPivotX = 0;
|
|
94
|
+
pixelPivotY = 0;
|
|
95
|
+
/** Named frame-space pixel sockets relative to trimmed `(0, 0)`, e.g. `{ hand: [28, 34] }`. */
|
|
96
|
+
anchors = null;
|
|
97
|
+
emissiveCenter = null;
|
|
98
|
+
emissivePower = 0;
|
|
99
|
+
actor = null;
|
|
100
|
+
clip = null;
|
|
101
|
+
dir = null;
|
|
102
|
+
animFrameIndex = null;
|
|
103
|
+
animLoop = void 0;
|
|
104
|
+
constructor(texture, name, sourceIndex, x, y, w, h, meta) {
|
|
89
105
|
this.texture = texture;
|
|
90
106
|
this.name = name;
|
|
91
107
|
this.sourceIndex = sourceIndex;
|
|
92
108
|
this.source = texture.source[sourceIndex];
|
|
93
109
|
this.setSize(w, h, x, y);
|
|
110
|
+
if (meta) this.applyMeta(meta);
|
|
94
111
|
}
|
|
95
112
|
setSize(width, height, x = this.cutX, y = this.cutY) {
|
|
96
113
|
this.cutX = x;
|
|
@@ -99,9 +116,59 @@ var Frame = class {
|
|
|
99
116
|
this.cutHeight = height;
|
|
100
117
|
this.width = width;
|
|
101
118
|
this.height = height;
|
|
119
|
+
if (!this.customPivot) {
|
|
120
|
+
this.pixelPivotX = width * this.pivotX;
|
|
121
|
+
this.pixelPivotY = height * this.pivotY;
|
|
122
|
+
}
|
|
102
123
|
this.updateUVs();
|
|
103
124
|
return this;
|
|
104
125
|
}
|
|
126
|
+
/** Set normalized `[0..1]` per-frame pivot (marks `customPivot = true`). */
|
|
127
|
+
setPivot(pivotX, pivotY) {
|
|
128
|
+
this.customPivot = true;
|
|
129
|
+
this.pivotX = pivotX;
|
|
130
|
+
this.pivotY = pivotY;
|
|
131
|
+
this.pixelPivotX = this.width * pivotX;
|
|
132
|
+
this.pixelPivotY = this.height * pivotY;
|
|
133
|
+
return this;
|
|
134
|
+
}
|
|
135
|
+
/** Set exact pixel pivot `(ax, ay)` from trimmed frame top-left `(0, 0)` (avoids float rounding drift). */
|
|
136
|
+
setPixelPivot(ax, ay) {
|
|
137
|
+
this.customPivot = true;
|
|
138
|
+
this.pixelPivotX = ax;
|
|
139
|
+
this.pixelPivotY = ay;
|
|
140
|
+
this.pivotX = this.width > 0 ? ax / this.width : .5;
|
|
141
|
+
this.pivotY = this.height > 0 ? ay / this.height : .5;
|
|
142
|
+
return this;
|
|
143
|
+
}
|
|
144
|
+
/** Attach or update a named pixel socket `(x, y)` relative to trimmed frame top-left `(0, 0)`. */
|
|
145
|
+
setAnchor(name, x, y) {
|
|
146
|
+
if (!this.anchors) this.anchors = Object.create(null);
|
|
147
|
+
this.anchors[name] = [x, y];
|
|
148
|
+
return this;
|
|
149
|
+
}
|
|
150
|
+
/** Read a named pixel socket `[x, y]` (falls back to `emissiveCenter` when `name === 'emissive'`). */
|
|
151
|
+
getAnchor(name) {
|
|
152
|
+
if (this.anchors && Object.prototype.hasOwnProperty.call(this.anchors, name)) return this.anchors[name];
|
|
153
|
+
if (name === "emissive" && this.emissiveCenter) return this.emissiveCenter;
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
applyMeta(meta) {
|
|
157
|
+
if (typeof meta.ax === "number" && typeof meta.ay === "number") this.setPixelPivot(meta.ax, meta.ay);
|
|
158
|
+
else if (typeof meta.pivotX === "number" || typeof meta.pivotY === "number") this.setPivot(meta.pivotX ?? .5, meta.pivotY ?? .5);
|
|
159
|
+
if (meta.anchors) {
|
|
160
|
+
for (const [k, pt] of Object.entries(meta.anchors)) if (Array.isArray(pt) && pt.length >= 2) this.setAnchor(k, Number(pt[0]) || 0, Number(pt[1]) || 0);
|
|
161
|
+
}
|
|
162
|
+
if (Array.isArray(meta.emissiveCenter) && meta.emissiveCenter.length >= 2) this.emissiveCenter = [Number(meta.emissiveCenter[0]) || 0, Number(meta.emissiveCenter[1]) || 0];
|
|
163
|
+
if (typeof meta.emissivePower === "number") this.emissivePower = meta.emissivePower;
|
|
164
|
+
const actor = meta.actor ?? meta.char;
|
|
165
|
+
if (typeof actor === "string" && actor.length > 0) this.actor = actor;
|
|
166
|
+
if (typeof meta.clip === "string" && meta.clip.length > 0) this.clip = meta.clip;
|
|
167
|
+
if (typeof meta.dir === "number" || typeof meta.dir === "string") this.dir = meta.dir;
|
|
168
|
+
if (typeof meta.frame === "number" && Number.isFinite(meta.frame)) this.animFrameIndex = meta.frame;
|
|
169
|
+
if (typeof meta.loop === "boolean") this.animLoop = meta.loop;
|
|
170
|
+
return this;
|
|
171
|
+
}
|
|
105
172
|
updateUVs() {
|
|
106
173
|
const sw = this.source.width || 1;
|
|
107
174
|
const sh = this.source.height || 1;
|
|
@@ -116,6 +183,10 @@ var Texture = class {
|
|
|
116
183
|
key;
|
|
117
184
|
source;
|
|
118
185
|
frames = Object.create(null);
|
|
186
|
+
/** Optional isometric camera azimuth (`yaw` in radians, e.g. `Math.PI / 4` from `@holtjs/craft/three`) used by `SpriteObject.playDirectional()`. */
|
|
187
|
+
atlasYaw = null;
|
|
188
|
+
atlasPitch = null;
|
|
189
|
+
atlasScale = null;
|
|
119
190
|
constructor(manager, key, image, filterMode, host, premultiplyAlpha = true, isRenderTarget = false) {
|
|
120
191
|
this.manager = manager;
|
|
121
192
|
this.key = key;
|
|
@@ -123,8 +194,8 @@ var Texture = class {
|
|
|
123
194
|
this.source = [src];
|
|
124
195
|
this.add("__BASE", 0, 0, 0, src.width, src.height);
|
|
125
196
|
}
|
|
126
|
-
add(name, sourceIndex, x, y, width, height) {
|
|
127
|
-
const frame = new Frame(this, name, sourceIndex, x, y, width, height);
|
|
197
|
+
add(name, sourceIndex, x, y, width, height, meta) {
|
|
198
|
+
const frame = new Frame(this, name, sourceIndex, x, y, width, height, meta);
|
|
128
199
|
this.frames[String(name)] = frame;
|
|
129
200
|
return frame;
|
|
130
201
|
}
|
|
@@ -254,6 +325,71 @@ var TextureManager = class {
|
|
|
254
325
|
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) tex.add(idx++, 0, margin + c * strideX, margin + r * strideY, fw, fh);
|
|
255
326
|
return tex;
|
|
256
327
|
}
|
|
328
|
+
/**
|
|
329
|
+
* Register a packed sprite atlas (`@holtjs/craft/three`, `@holtjs/craft/atlas`, or TexturePacker / Aseprite JSON Hash & Array)
|
|
330
|
+
* preserving per-frame trimmed pivots (`ax/ay` or `pivot`), named sockets (`anchors`), `emissiveCenter`, and `atlasYaw`!
|
|
331
|
+
*/
|
|
332
|
+
addAtlas(key, source, atlasData, options) {
|
|
333
|
+
const tex = this.addImage(key, source, options);
|
|
334
|
+
if (!tex || !atlasData) return tex;
|
|
335
|
+
const root = atlasData.json && typeof atlasData.json === "object" ? atlasData.json : atlasData;
|
|
336
|
+
if (typeof root.yaw === "number" && Number.isFinite(root.yaw)) tex.atlasYaw = root.yaw;
|
|
337
|
+
if (typeof root.pitch === "number" && Number.isFinite(root.pitch)) tex.atlasPitch = root.pitch;
|
|
338
|
+
if (typeof root.scale === "number" && Number.isFinite(root.scale)) tex.atlasScale = root.scale;
|
|
339
|
+
const rawFrames = root.frames ?? atlasData.frames;
|
|
340
|
+
if (!rawFrames) return tex;
|
|
341
|
+
const addEntry = (frameName, entry) => {
|
|
342
|
+
if (!entry || typeof entry !== "object") return;
|
|
343
|
+
if (entry.frame && typeof entry.frame === "object" && typeof entry.frame.w === "number") {
|
|
344
|
+
const fr = entry.frame;
|
|
345
|
+
const fx = Number(fr.x) || 0;
|
|
346
|
+
const fy = Number(fr.y) || 0;
|
|
347
|
+
const fw = Number(fr.w) || 0;
|
|
348
|
+
const fh = Number(fr.h) || 0;
|
|
349
|
+
const meta = {};
|
|
350
|
+
if (entry.pivot && typeof entry.pivot.x === "number" && typeof entry.pivot.y === "number") {
|
|
351
|
+
const px = Number(entry.pivot.x);
|
|
352
|
+
const py = Number(entry.pivot.y);
|
|
353
|
+
if (entry.trimmed && entry.sourceSize && entry.spriteSourceSize && typeof entry.sourceSize.w === "number" && typeof entry.spriteSourceSize.x === "number") {
|
|
354
|
+
meta.ax = entry.sourceSize.w * px - entry.spriteSourceSize.x;
|
|
355
|
+
meta.ay = entry.sourceSize.h * py - entry.spriteSourceSize.y;
|
|
356
|
+
} else {
|
|
357
|
+
meta.pivotX = px;
|
|
358
|
+
meta.pivotY = py;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (entry.anchors) meta.anchors = entry.anchors;
|
|
362
|
+
tex.add(frameName, 0, fx, fy, fw, fh, meta);
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
const fx = Number(entry.x) || 0;
|
|
366
|
+
const fy = Number(entry.y) || 0;
|
|
367
|
+
const fw = Number(entry.w ?? entry.width) || 0;
|
|
368
|
+
const fh = Number(entry.h ?? entry.height) || 0;
|
|
369
|
+
tex.add(frameName, 0, fx, fy, fw, fh, {
|
|
370
|
+
ax: typeof entry.ax === "number" ? entry.ax : void 0,
|
|
371
|
+
ay: typeof entry.ay === "number" ? entry.ay : void 0,
|
|
372
|
+
pivotX: typeof entry.pivotX === "number" ? entry.pivotX : void 0,
|
|
373
|
+
pivotY: typeof entry.pivotY === "number" ? entry.pivotY : void 0,
|
|
374
|
+
anchors: entry.anchors,
|
|
375
|
+
emissiveCenter: entry.emissiveCenter,
|
|
376
|
+
emissivePower: entry.emissivePower,
|
|
377
|
+
char: entry.char,
|
|
378
|
+
actor: entry.actor,
|
|
379
|
+
clip: entry.clip,
|
|
380
|
+
dir: entry.dir,
|
|
381
|
+
frame: typeof entry.frame === "number" ? entry.frame : void 0,
|
|
382
|
+
frames: entry.frames,
|
|
383
|
+
loop: entry.loop
|
|
384
|
+
});
|
|
385
|
+
};
|
|
386
|
+
if (Array.isArray(rawFrames)) for (let i = 0; i < rawFrames.length; i++) {
|
|
387
|
+
const item = rawFrames[i];
|
|
388
|
+
addEntry(String(item?.filename ?? item?.name ?? item?.key ?? i), item);
|
|
389
|
+
}
|
|
390
|
+
else if (typeof rawFrames === "object") for (const [name, item] of Object.entries(rawFrames)) addEntry(name, item);
|
|
391
|
+
return tex;
|
|
392
|
+
}
|
|
257
393
|
remove(key) {
|
|
258
394
|
if (!this.exists(key)) return false;
|
|
259
395
|
const tex = this.list[key];
|
|
@@ -2901,7 +3037,11 @@ var RendererGl = class extends EventEmitter {
|
|
|
2901
3037
|
if (!frame || frame.width <= 0 || frame.height <= 0) return;
|
|
2902
3038
|
const ox = img.displayOriginX;
|
|
2903
3039
|
const oy = img.displayOriginY;
|
|
2904
|
-
|
|
3040
|
+
const pivotMirrored = frame.customPivot && !img.customOrigin && !img.isCropped;
|
|
3041
|
+
let x0 = pivotMirrored && img.flipX ? ox - img.width : -ox;
|
|
3042
|
+
let y0 = pivotMirrored && img.flipY ? oy - img.height : -oy;
|
|
3043
|
+
let x1 = pivotMirrored && img.flipX ? ox : img.width - ox;
|
|
3044
|
+
let y1 = pivotMirrored && img.flipY ? oy : img.height - oy;
|
|
2905
3045
|
let u0 = frame.u0, v0 = frame.v0, u1 = frame.u1, v1 = frame.v1;
|
|
2906
3046
|
if (img.isCropped) {
|
|
2907
3047
|
const fw = frame.width || 1, fh = frame.height || 1;
|
|
@@ -3912,6 +4052,7 @@ var RendererGl = class extends EventEmitter {
|
|
|
3912
4052
|
}
|
|
3913
4053
|
switch (obj.type) {
|
|
3914
4054
|
case "Image":
|
|
4055
|
+
case "Sprite":
|
|
3915
4056
|
this.renderImage(obj, camera, m, effAlpha);
|
|
3916
4057
|
break;
|
|
3917
4058
|
case "NineSlice":
|
|
@@ -4747,6 +4888,16 @@ var LoaderPlugin = class extends EventEmitter {
|
|
|
4747
4888
|
});
|
|
4748
4889
|
return this;
|
|
4749
4890
|
}
|
|
4891
|
+
atlas(key, imageUrl, atlasData, options) {
|
|
4892
|
+
this.queue.push({
|
|
4893
|
+
kind: "atlas",
|
|
4894
|
+
key,
|
|
4895
|
+
url: imageUrl,
|
|
4896
|
+
atlas: atlasData,
|
|
4897
|
+
imageOpts: options
|
|
4898
|
+
});
|
|
4899
|
+
return this;
|
|
4900
|
+
}
|
|
4750
4901
|
get hasQueued() {
|
|
4751
4902
|
return this.queue.length > 0;
|
|
4752
4903
|
}
|
|
@@ -4865,6 +5016,7 @@ var LoaderPlugin = class extends EventEmitter {
|
|
|
4865
5016
|
if (settled || isAborted() || activeImg !== img) return;
|
|
4866
5017
|
try {
|
|
4867
5018
|
if (item.kind === "spritesheet" && item.sheet) this.textures.addSpriteSheet(item.key, img, item.sheet);
|
|
5019
|
+
else if (item.kind === "atlas" && item.atlas) this.textures.addAtlas(item.key, img, item.atlas, item.imageOpts);
|
|
4868
5020
|
else this.textures.addImage(item.key, img, item.imageOpts);
|
|
4869
5021
|
settle(true);
|
|
4870
5022
|
} catch {
|
|
@@ -4919,6 +5071,9 @@ var GameObjectFactory = class {
|
|
|
4919
5071
|
image(x, y, key, frame) {
|
|
4920
5072
|
return this.register(new ImageObject(this.scene, x, y, key, frame));
|
|
4921
5073
|
}
|
|
5074
|
+
sprite(x, y, key, frame) {
|
|
5075
|
+
return this.register(new SpriteObject(this.scene, x, y, key, frame));
|
|
5076
|
+
}
|
|
4922
5077
|
nineslice(x, y, key, frame, width, height, left, right, top, bottom) {
|
|
4923
5078
|
return this.register(new NineSliceObject(this.scene, x, y, key, frame, width, height, left, right, top, bottom));
|
|
4924
5079
|
}
|
|
@@ -5051,6 +5206,7 @@ var Scene = class {
|
|
|
5051
5206
|
events = new EventEmitter();
|
|
5052
5207
|
/** Deterministic EngineClock-driven tween & spring manager (auto-stepped in `Game.step()`). */
|
|
5053
5208
|
tweens = new TweenManager();
|
|
5209
|
+
_animatedSprites = /* @__PURE__ */ new Set();
|
|
5054
5210
|
_nodesCreated = 0;
|
|
5055
5211
|
_nodesDestroyed = 0;
|
|
5056
5212
|
_disposersRan = 0;
|
|
@@ -5060,6 +5216,7 @@ var Scene = class {
|
|
|
5060
5216
|
clock;
|
|
5061
5217
|
renderer;
|
|
5062
5218
|
textures;
|
|
5219
|
+
anims;
|
|
5063
5220
|
scale;
|
|
5064
5221
|
input;
|
|
5065
5222
|
load;
|
|
@@ -5091,6 +5248,7 @@ var Scene = class {
|
|
|
5091
5248
|
this.clock = game.clock;
|
|
5092
5249
|
this.renderer = game.renderer;
|
|
5093
5250
|
this.textures = game.textures;
|
|
5251
|
+
this.anims = game.anims;
|
|
5094
5252
|
this.scale = game.scale;
|
|
5095
5253
|
this.input = game.input;
|
|
5096
5254
|
this.load = new LoaderPlugin(game.textures);
|
|
@@ -5131,6 +5289,17 @@ var Scene = class {
|
|
|
5131
5289
|
tweenStats() {
|
|
5132
5290
|
return this.tweens.stats();
|
|
5133
5291
|
}
|
|
5292
|
+
_registerAnimatedSprite(sprite) {
|
|
5293
|
+
this._animatedSprites.add(sprite);
|
|
5294
|
+
}
|
|
5295
|
+
_unregisterAnimatedSprite(sprite) {
|
|
5296
|
+
this._animatedSprites.delete(sprite);
|
|
5297
|
+
}
|
|
5298
|
+
_stepAnimations(deltaMs) {
|
|
5299
|
+
if (this._animatedSprites.size === 0 || deltaMs <= 0) return;
|
|
5300
|
+
for (const s of this._animatedSprites) if (s.active) s._stepAnim(deltaMs);
|
|
5301
|
+
else this._animatedSprites.delete(s);
|
|
5302
|
+
}
|
|
5134
5303
|
_invalidateTextGl() {
|
|
5135
5304
|
const walk = (list) => {
|
|
5136
5305
|
for (let i = 0; i < list.length; i++) {
|
|
@@ -5155,6 +5324,7 @@ var Scene = class {
|
|
|
5155
5324
|
for (let i = 0; i < snap.length; i++) try {
|
|
5156
5325
|
snap[i].destroy(true);
|
|
5157
5326
|
} catch {}
|
|
5327
|
+
this._animatedSprites.clear();
|
|
5158
5328
|
this.tweens.clear();
|
|
5159
5329
|
}
|
|
5160
5330
|
};
|
|
@@ -5294,6 +5464,7 @@ var Game = class {
|
|
|
5294
5464
|
canvas;
|
|
5295
5465
|
renderer;
|
|
5296
5466
|
textures;
|
|
5467
|
+
anims;
|
|
5297
5468
|
scale;
|
|
5298
5469
|
input;
|
|
5299
5470
|
cache;
|
|
@@ -5362,6 +5533,7 @@ var Game = class {
|
|
|
5362
5533
|
}
|
|
5363
5534
|
const glHost = this.renderer.type === 2 ? this.renderer : null;
|
|
5364
5535
|
this.textures = new TextureManager(Boolean(config.pixelArt), glHost, this.doc);
|
|
5536
|
+
this.anims = new AnimationManager(this.textures);
|
|
5365
5537
|
if (glHost) glHost.onContextLost = () => {
|
|
5366
5538
|
this.textures.invalidateAllGl();
|
|
5367
5539
|
for (let i = 0; i < this.scene.scenes.length; i++) this.scene.scenes[i]._invalidateTextGl();
|
|
@@ -5411,6 +5583,7 @@ var Game = class {
|
|
|
5411
5583
|
if (sc.sys.settings.status === Scenes.RUNNING) {
|
|
5412
5584
|
sc.events.emit("preupdate", time, delta);
|
|
5413
5585
|
if (sc.tweens.hasActive) sc.tweens.step(this.clock.lastDeltaMs);
|
|
5586
|
+
sc._stepAnimations(this.clock.lastDeltaMs);
|
|
5414
5587
|
sc.update?.(time, delta);
|
|
5415
5588
|
this.kernel._updateScene(sc, time, delta);
|
|
5416
5589
|
sc.cameras.main.stepFollow(this.clock.lastDeltaMs);
|
|
@@ -5459,6 +5632,7 @@ var Game = class {
|
|
|
5459
5632
|
this.kernel.dispose();
|
|
5460
5633
|
this.scene.destroy();
|
|
5461
5634
|
this.input.destroy();
|
|
5635
|
+
this.anims.clear();
|
|
5462
5636
|
this.textures.destroy();
|
|
5463
5637
|
this.cache.json.clear();
|
|
5464
5638
|
this.renderer.destroy();
|
package/dist/headless.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as StagePlugin, L as SceneDigestOptions, N as SceneDigest, f as SceneInput, n as EngineClockSnapshot, r as Game, u as Scene } from "./game-
|
|
1
|
+
import { E as StagePlugin, L as SceneDigestOptions, N as SceneDigest, f as SceneInput, n as EngineClockSnapshot, r as Game, u as Scene } from "./game-3L9wS-Bv.js";
|
|
2
2
|
/** Minimal Canvas2D surface compatible with `@napi-rs/canvas`, `node-canvas`, and browser `<canvas>`. */
|
|
3
3
|
export interface HeadlessCanvasLike {
|
|
4
4
|
width: number;
|
|
@@ -52,6 +52,8 @@ export interface RecordFramesOptions {
|
|
|
52
52
|
readonly digestEvery?: number;
|
|
53
53
|
/** Options forwarded to `buildSceneDigest()`. */
|
|
54
54
|
readonly digestOptions?: SceneDigestOptions;
|
|
55
|
+
/** Reuse a single preallocated `Uint8Array(width * height * 4)` across `onFrame` callbacks to avoid multi-GB GC churn on long 60 FPS video encodes (default `false`). */
|
|
56
|
+
readonly reuseFrameBuffer?: boolean;
|
|
55
57
|
/** Streaming frame consumer (may be sync or async, e.g. backpressure-aware `ffmpeg.stdin.write`). */
|
|
56
58
|
readonly onFrame: (frame: HeadlessRecordedFrame) => void | Promise<void>;
|
|
57
59
|
}
|
|
@@ -83,6 +85,8 @@ export interface HeadlessStage {
|
|
|
83
85
|
keyUp(code: string, key?: string): void;
|
|
84
86
|
/** Read raw W3C RGBA8888 pixels (`width * height * 4` bytes). */
|
|
85
87
|
toRgba(): Uint8Array;
|
|
88
|
+
/** Copy raw W3C RGBA8888 pixels into an existing `Uint8Array` (avoids per-frame buffer allocation in tight video loops). */
|
|
89
|
+
toRgbaInto(out: Uint8Array): Uint8Array;
|
|
86
90
|
/** Encode current frame to PNG bytes (requires `canvas.toBuffer('image/png')` such as `@napi-rs/canvas`). */
|
|
87
91
|
toPng(): Uint8Array;
|
|
88
92
|
/** Capture a zero-PII structured `SceneDigest` for the active scene at the current frame. */
|
package/dist/headless.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./types-CXsCvp1p.js";
|
|
2
|
-
import { n as Game } from "./game-
|
|
2
|
+
import { n as Game } from "./game-BnSWR44q.js";
|
|
3
3
|
import { buildSceneDigest } from "./trace.js";
|
|
4
4
|
// src/headless.ts
|
|
5
5
|
function createVirtualDomHost(createCanvas, width, height) {
|
|
@@ -122,6 +122,20 @@ function createHeadlessStage(options) {
|
|
|
122
122
|
}
|
|
123
123
|
return game.clock.snapshot();
|
|
124
124
|
};
|
|
125
|
+
const toRgbaInto = (out) => {
|
|
126
|
+
const byteLen = width * height * 4;
|
|
127
|
+
const dst = out && out.byteLength >= byteLen ? out : new Uint8Array(byteLen);
|
|
128
|
+
if (game.renderer.type === 2 && game.renderer.gl) {
|
|
129
|
+
const gl = game.renderer.gl;
|
|
130
|
+
gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, dst);
|
|
131
|
+
return dst;
|
|
132
|
+
}
|
|
133
|
+
const ctx = rootCanvas.getContext("2d");
|
|
134
|
+
if (!ctx) throw new Error("HeadlessStage.toRgbaInto: 2D context unavailable");
|
|
135
|
+
const img = ctx.getImageData(0, 0, width, height);
|
|
136
|
+
dst.set(img.data.subarray(0, byteLen));
|
|
137
|
+
return dst;
|
|
138
|
+
};
|
|
125
139
|
const toRgba = () => {
|
|
126
140
|
if (game.renderer.type === 2 && game.renderer.gl) {
|
|
127
141
|
const gl = game.renderer.gl;
|
|
@@ -145,6 +159,7 @@ function createHeadlessStage(options) {
|
|
|
145
159
|
const recordFrames = async (recOpts) => {
|
|
146
160
|
const totalFrames = recOpts.frames !== void 0 ? Math.max(1, Math.floor(recOpts.frames)) : Math.max(1, Math.round((recOpts.durationMs ?? 1e3) / 1e3 * fps));
|
|
147
161
|
const digestEvery = Math.max(0, Math.floor(recOpts.digestEvery ?? 0));
|
|
162
|
+
const sharedRgba = recOpts.reuseFrameBuffer ? new Uint8Array(width * height * 4) : null;
|
|
148
163
|
for (let i = 0; i < totalFrames; i++) {
|
|
149
164
|
if (i > 0 || game.clock.frameSeq === 0) {
|
|
150
165
|
simCursorMs += dt;
|
|
@@ -155,7 +170,7 @@ function createHeadlessStage(options) {
|
|
|
155
170
|
index: i,
|
|
156
171
|
frameSeq: game.clock.frameSeq,
|
|
157
172
|
simTimeMs: Math.round(simCursorMs),
|
|
158
|
-
rgba: toRgba(),
|
|
173
|
+
rgba: sharedRgba ? toRgbaInto(sharedRgba) : toRgba(),
|
|
159
174
|
digest: snapDigest
|
|
160
175
|
});
|
|
161
176
|
}
|
|
@@ -206,6 +221,7 @@ function createHeadlessStage(options) {
|
|
|
206
221
|
source: "headless"
|
|
207
222
|
}),
|
|
208
223
|
toRgba,
|
|
224
|
+
toRgbaInto,
|
|
209
225
|
toPng,
|
|
210
226
|
digest,
|
|
211
227
|
recordFrames,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { $ as WebGpuBootstrapResult,
|
|
1
|
+
import { $ as WebGpuBootstrapResult, A as createInputRecorder, At as PanelStyleConfig, B as SceneDigestSurfaceEntry, Bt as TextObject, C as RecordedInputEntry, Ct as InstancedBatchObject, D as TimelineClickOptions, Dt as NineSliceObject, E as StagePlugin, Et as MsdfIconObject, F as SceneDigestEngineSandbox, Ft as ShapeBatchObject, G as InputConfig, Gt as HiDpiConfigureOptions, H as SceneDigestSurfaces, Ht as TileSpriteObject, I as SceneDigestNode, It as ShapeBatchStyleDefaults, J as Pointer, K as InputPlugin, Kt as HiDpiScaleLike, L as SceneDigestOptions, Lt as SpriteAnimEventListener, M as createInputTimeline, Mt as RectangleObject, N as SceneDigest, Nt as SceneHostLike, O as TimelineDragOptions, Ot as PanelObject, P as SceneDigestActiveFocus, Pt as ShapeBatchColumns, Q as RequestWebGpuOptions, R as SceneDigestOverlayStats, Rt as SpriteObject, S as InputTimelinePlugin, St as ImageObject, T as StageKernel, Tt as MsdfIconConfig, U as buildSceneDigest, Ut as Camera, V as SceneDigestSurfaceSource, Vt as TextStyleConfig, W as sanitizeTrackToken, Wt as CameraFollowOptions, X as RendererWebGpu, Y as PointerSample, Z as RendererWebGpuOptions, _ as ActionMap, _t as DisplayList, a as GameLoop, at as RendererGlOptions, b as InputTargetSpec, bt as DisplaySemantics, c as LoaderPlugin, ct as StageRenderTarget, d as SceneCtor, dt as Container, et as WebGpuCanvasContextLike, f as SceneInput, ft as ContainerFiltersShim, g as ViewportFitResult, gt as DirectionalPlayOptions, h as StageRenderer, ht as CustomPassOptions, i as GameConfig$1, it as RendererGl, j as createInputReplay, jt as RectClipMask, k as TimelineKeyOptions, kt as PanelOpenSide, l as ScaleManager, lt as BlitterObject, m as SceneManager, mt as CustomPassObject, n as EngineClockSnapshot, nt as requestWebGpuDevice, o as GameObjectFactory, ot as RendererStats, p as SceneLifecycleStats, pt as CustomPassCallback, q as KeyboardPlugin, r as Game, rt as Renderer2D, s as JsonCache, st as Stage2DCustomImageHandler, t as EngineClock, tt as WebGpuDeviceLike, u as Scene, ut as Bob$1, v as InputProvider, vt as DisplayObject, w as StageInputEvent, wt as InstancedColumns, x as InputTimelineOptions, xt as Graphics, y as InputRecorderPlugin, yt as DisplayObjectType, z as SceneDigestSandbox, zt as SpritePlayOptions } from "./game-3L9wS-Bv.js";
|
|
2
|
+
import { A as HEX_MASK, B as WEBGPU, C as BLACK_RGB, D as EventEmitter, E as CANVAS, F as ScaleMode, G as parseColor, H as WorldView2D, I as Scenes, K as rgbToCss, L as TintMode, M as Rect2D, N as RgbaColor, O as FilterMode, P as Scale, R as TintModes, S as AUTO, T as BlendModes, U as createMatrix2D, V as WHITE_RGB, W as packColorAbgr, _ as Texture, a as AtlasClipRule, b as TextureManager, c as GenerateFrameNamesConfig, d as AtlasJsonLike, f as CanvasTexture, g as SpriteSheetConfig, h as GlTextureHost, i as AtlasAutoAnimOptions, j as Matrix2D, k as FilterModeValue, l as GenerateFrameNumbersConfig, m as FrameExtraMeta, n as AnimationFrameInput, o as CompiledAnimationFrame, p as Frame, r as AnimationManager, s as DirectionalAnimGroup, t as AnimationConfig, u as StageAnimation, v as TextureImageOptions, w as BlendMode, x as TextureSource, y as TextureImageSource, z as WEBGL } from "./anims-CS0rfUIz.js";
|
|
2
3
|
import { FlexAlign, FlexContainerSpec, FlexDir, FlexItemRect, FlexItemSpec, FlexJustify, FlexPadding, FlexResult, WrapContainerSpec, WrapItemRect, WrapItemSpec, WrapJustify, WrapResult, computeFlexLayout, computeWrapLayout, resolvePadding } from "./flex.js";
|
|
3
4
|
import { a as SpringHandle, c as TweenManager, i as Easings, l as TweenOptions, n as EasingFn, o as SpringOptions, r as EasingName, s as TweenHandle, t as DisposableOwner, u as TweenStats } from "./tween-BiF1FUvc.js";
|
|
4
5
|
import { JoystickDpad, JoystickDpadOptions, JoystickState, JoystickVector, JoystickViewport, JoystickZone, JoystickZonePredicate, JoystickZoneRect, VirtualJoystick, VirtualJoystickMode, VirtualJoystickOptions, VirtualJoystickStyle, clampJoystickOrigin, computeJoystickVector, isInJoystickZone, pullJoystickOrigin, quantizeJoystickDpad } from "./joystick.js";
|
|
@@ -120,6 +121,7 @@ export declare namespace Stage2D {
|
|
|
120
121
|
namespace GameObjects {
|
|
121
122
|
type GameObject = DisplayObject;
|
|
122
123
|
type Image = ImageObject;
|
|
124
|
+
type Sprite = SpriteObject;
|
|
123
125
|
type MsdfIcon = MsdfIconObject;
|
|
124
126
|
type NineSlice = NineSliceObject;
|
|
125
127
|
type Panel = PanelObject;
|
|
@@ -190,6 +192,7 @@ export declare const Stage2D: {
|
|
|
190
192
|
readonly GameObjects: {
|
|
191
193
|
readonly GameObject: typeof DisplayObject;
|
|
192
194
|
readonly Image: typeof ImageObject;
|
|
195
|
+
readonly Sprite: typeof SpriteObject;
|
|
193
196
|
readonly MsdfIcon: typeof MsdfIconObject;
|
|
194
197
|
readonly NineSlice: typeof NineSliceObject;
|
|
195
198
|
readonly Panel: typeof PanelObject;
|
|
@@ -232,6 +235,7 @@ export declare namespace Stage {
|
|
|
232
235
|
namespace GameObjects {
|
|
233
236
|
type GameObject = DisplayObject;
|
|
234
237
|
type Image = ImageObject;
|
|
238
|
+
type Sprite = SpriteObject;
|
|
235
239
|
type MsdfIcon = MsdfIconObject;
|
|
236
240
|
type NineSlice = NineSliceObject;
|
|
237
241
|
type Panel = PanelObject;
|
|
@@ -302,6 +306,7 @@ export declare const Stage: {
|
|
|
302
306
|
readonly GameObjects: {
|
|
303
307
|
readonly GameObject: typeof DisplayObject;
|
|
304
308
|
readonly Image: typeof ImageObject;
|
|
309
|
+
readonly Sprite: typeof SpriteObject;
|
|
305
310
|
readonly MsdfIcon: typeof MsdfIconObject;
|
|
306
311
|
readonly NineSlice: typeof NineSliceObject;
|
|
307
312
|
readonly Panel: typeof PanelObject;
|
|
@@ -326,4 +331,4 @@ export declare const Stage: {
|
|
|
326
331
|
};
|
|
327
332
|
};
|
|
328
333
|
};
|
|
329
|
-
export { AUTO, ActionMap, BLACK_RGB, type BlendMode, BlendModes, BlitterObject, type Bob$1 as Bob, CANVAS, Camera, type CameraFollowOptions, CanvasTexture, Container, type ContainerFiltersShim, type CustomPassCallback, CustomPassObject, type CustomPassOptions, DisplayList, DisplayObject, type DisplayObjectType, type DisplaySemantics, type DisposableOwner, type EasingFn, type EasingName, Easings, EngineClock, type EngineClockSnapshot, EventEmitter, FilterMode, type FilterModeValue, type FlexAlign, type FlexContainerSpec, type FlexDir, type FlexItemRect, type FlexItemSpec, type FlexJustify, type FlexPadding, type FlexResult, Frame, Game, type GameConfig$1 as GameConfig, GameLoop, GameObjectFactory, type GlTextureHost, Graphics, HEX_MASK, type HiDpiConfigureOptions, type HiDpiScaleLike, ImageObject, type InputConfig, InputPlugin, type InputProvider, type InputRecorderPlugin, type InputTargetSpec, type InputTimelineOptions, type InputTimelinePlugin, InstancedBatchObject, type InstancedColumns, type JoystickDpad, type JoystickDpadOptions, type JoystickState, type JoystickVector, type JoystickViewport, type JoystickZone, type JoystickZonePredicate, type JoystickZoneRect, JsonCache, KeyboardPlugin, LoaderPlugin, type Matrix2D, type MsdfIconConfig, MsdfIconObject, NineSliceObject, PanelObject, type PanelOpenSide, type PanelStyleConfig, Pointer, type PointerSample, type RecordedInputEntry, type Rect2D, type RectClipMask, RectangleObject, Renderer2D, RendererGl, type RendererGlOptions, type RendererStats, RendererWebGpu, type RendererWebGpuOptions, type RequestWebGpuOptions, type RgbaColor, SURFACE_BAND, Scale, ScaleManager, type ScaleMode, Scene, type SceneCtor, type SceneDigest, type SceneDigestActiveFocus, type SceneDigestEngineSandbox, type SceneDigestNode, type SceneDigestOptions, type SceneDigestOverlayStats, type SceneDigestSandbox, type SceneDigestSurfaceEntry, type SceneDigestSurfaceSource, type SceneDigestSurfaces, type SceneHostLike, type SceneInput, type SceneLifecycleStats, SceneManager, Scenes, type ShapeBatchColumns, ShapeBatchObject, type ShapeBatchStyleDefaults, type SpringHandle, type SpringOptions, type SpriteSheetConfig, Stage as default, type Stage2DCustomImageHandler, type StageInputEvent, StageKernel, type StagePlugin, type StageRenderTarget, type StageRenderer, type SurfaceBand, type SurfaceBandName, type SurfaceBarrier, type SurfaceCancelContext, type SurfaceCancelDispatchResult, type SurfaceCancelResult, type SurfaceDomEntry, type SurfaceFocusContext, type SurfaceFocusDispatchResult, type SurfaceFocusResult, type SurfaceKeyContext, type SurfaceKeyDispatchResult, type SurfaceKeyResult, type SurfaceNodeInfo, type SurfaceNodeInput, type SurfaceScope, type SurfaceTree, TextObject, type TextStyleConfig, Texture, type TextureImageOptions, type TextureImageSource, TextureManager, TextureSource, TileSpriteObject, type TimelineClickOptions, type TimelineDragOptions, type TimelineKeyOptions, type TintMode, TintModes, type TweenHandle, TweenManager, type TweenOptions, type TweenStats, type ViewportFitResult, VirtualJoystick, type VirtualJoystickMode, type VirtualJoystickOptions, type VirtualJoystickStyle, WEBGL, WEBGPU, WHITE_RGB, type WebGpuBootstrapResult, type WebGpuCanvasContextLike, type WebGpuDeviceLike, type WorldView2D, type WrapContainerSpec, type WrapItemRect, type WrapItemSpec, type WrapJustify, type WrapResult, buildSceneDigest, clampJoystickOrigin, computeFlexLayout, computeJoystickVector, computeSurfaceDomZ, computeWrapLayout, createInputRecorder, createInputReplay, createInputTimeline, createMatrix2D, createSurfaceTree, isInJoystickZone, packColorAbgr, parseColor, pullJoystickOrigin, quantizeJoystickDpad, requestWebGpuDevice, resolvePadding, resolveSurfacePriority, rgbToCss, sanitizeTrackToken, surfacePriorityToDomZ };
|
|
334
|
+
export { AUTO, ActionMap, type AnimationConfig, type AnimationFrameInput, AnimationManager, type AtlasAutoAnimOptions, type AtlasClipRule, type AtlasJsonLike, BLACK_RGB, type BlendMode, BlendModes, BlitterObject, type Bob$1 as Bob, CANVAS, Camera, type CameraFollowOptions, CanvasTexture, type CompiledAnimationFrame, Container, type ContainerFiltersShim, type CustomPassCallback, CustomPassObject, type CustomPassOptions, type DirectionalAnimGroup, type DirectionalPlayOptions, DisplayList, DisplayObject, type DisplayObjectType, type DisplaySemantics, type DisposableOwner, type EasingFn, type EasingName, Easings, EngineClock, type EngineClockSnapshot, EventEmitter, FilterMode, type FilterModeValue, type FlexAlign, type FlexContainerSpec, type FlexDir, type FlexItemRect, type FlexItemSpec, type FlexJustify, type FlexPadding, type FlexResult, Frame, type FrameExtraMeta, Game, type GameConfig$1 as GameConfig, GameLoop, GameObjectFactory, type GenerateFrameNamesConfig, type GenerateFrameNumbersConfig, type GlTextureHost, Graphics, HEX_MASK, type HiDpiConfigureOptions, type HiDpiScaleLike, ImageObject, type InputConfig, InputPlugin, type InputProvider, type InputRecorderPlugin, type InputTargetSpec, type InputTimelineOptions, type InputTimelinePlugin, InstancedBatchObject, type InstancedColumns, type JoystickDpad, type JoystickDpadOptions, type JoystickState, type JoystickVector, type JoystickViewport, type JoystickZone, type JoystickZonePredicate, type JoystickZoneRect, JsonCache, KeyboardPlugin, LoaderPlugin, type Matrix2D, type MsdfIconConfig, MsdfIconObject, NineSliceObject, PanelObject, type PanelOpenSide, type PanelStyleConfig, Pointer, type PointerSample, type RecordedInputEntry, type Rect2D, type RectClipMask, RectangleObject, Renderer2D, RendererGl, type RendererGlOptions, type RendererStats, RendererWebGpu, type RendererWebGpuOptions, type RequestWebGpuOptions, type RgbaColor, SURFACE_BAND, Scale, ScaleManager, type ScaleMode, Scene, type SceneCtor, type SceneDigest, type SceneDigestActiveFocus, type SceneDigestEngineSandbox, type SceneDigestNode, type SceneDigestOptions, type SceneDigestOverlayStats, type SceneDigestSandbox, type SceneDigestSurfaceEntry, type SceneDigestSurfaceSource, type SceneDigestSurfaces, type SceneHostLike, type SceneInput, type SceneLifecycleStats, SceneManager, Scenes, type ShapeBatchColumns, ShapeBatchObject, type ShapeBatchStyleDefaults, type SpringHandle, type SpringOptions, type SpriteAnimEventListener, SpriteObject, type SpritePlayOptions, type SpriteSheetConfig, Stage as default, type Stage2DCustomImageHandler, type StageAnimation, type StageInputEvent, StageKernel, type StagePlugin, type StageRenderTarget, type StageRenderer, type SurfaceBand, type SurfaceBandName, type SurfaceBarrier, type SurfaceCancelContext, type SurfaceCancelDispatchResult, type SurfaceCancelResult, type SurfaceDomEntry, type SurfaceFocusContext, type SurfaceFocusDispatchResult, type SurfaceFocusResult, type SurfaceKeyContext, type SurfaceKeyDispatchResult, type SurfaceKeyResult, type SurfaceNodeInfo, type SurfaceNodeInput, type SurfaceScope, type SurfaceTree, TextObject, type TextStyleConfig, Texture, type TextureImageOptions, type TextureImageSource, TextureManager, TextureSource, TileSpriteObject, type TimelineClickOptions, type TimelineDragOptions, type TimelineKeyOptions, type TintMode, TintModes, type TweenHandle, TweenManager, type TweenOptions, type TweenStats, type ViewportFitResult, VirtualJoystick, type VirtualJoystickMode, type VirtualJoystickOptions, type VirtualJoystickStyle, WEBGL, WEBGPU, WHITE_RGB, type WebGpuBootstrapResult, type WebGpuCanvasContextLike, type WebGpuDeviceLike, type WorldView2D, type WrapContainerSpec, type WrapItemRect, type WrapItemSpec, type WrapJustify, type WrapResult, buildSceneDigest, clampJoystickOrigin, computeFlexLayout, computeJoystickVector, computeSurfaceDomZ, computeWrapLayout, createInputRecorder, createInputReplay, createInputTimeline, createMatrix2D, createSurfaceTree, isInJoystickZone, packColorAbgr, parseColor, pullJoystickOrigin, quantizeJoystickDpad, requestWebGpuDevice, resolvePadding, resolveSurfacePriority, rgbToCss, sanitizeTrackToken, surfacePriorityToDomZ };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { _ as rgbToCss, a as EventEmitter, c as Scale, d as WEBGL, f as WEBGPU, g as parseColor, h as packColorAbgr, i as CANVAS, l as Scenes, m as createMatrix2D, n as BLACK_RGB, o as FilterMode, p as WHITE_RGB, r as BlendModes, s as HEX_MASK, t as AUTO, u as TintModes } from "./types-CXsCvp1p.js";
|
|
2
|
-
import { _ as CanvasTexture, a as JsonCache, b as TextureManager, c as Scene, d as KeyboardPlugin, f as Pointer, g as SdfPanelBatcher, h as MsdfIconBatcher, i as GameObjectFactory, l as SceneManager, m as PixelAaBatcher, n as Game, o as LoaderPlugin, p as RendererGl, r as GameLoop, s as ScaleManager, t as EngineClock, u as InputPlugin, v as Frame, x as TextureSource, y as Texture } from "./game-
|
|
3
|
-
import {
|
|
2
|
+
import { _ as CanvasTexture, a as JsonCache, b as TextureManager, c as Scene, d as KeyboardPlugin, f as Pointer, g as SdfPanelBatcher, h as MsdfIconBatcher, i as GameObjectFactory, l as SceneManager, m as PixelAaBatcher, n as Game, o as LoaderPlugin, p as RendererGl, r as GameLoop, s as ScaleManager, t as EngineClock, u as InputPlugin, v as Frame, x as TextureSource, y as Texture } from "./game-BnSWR44q.js";
|
|
3
|
+
import { AnimationManager } from "./anims.js";
|
|
4
|
+
import { _ as SpriteObject, a as Container, b as Camera, c as DisplayObject, d as InstancedBatchObject, f as MsdfIconObject, g as ShapeBatchObject, h as RectangleObject, i as BlitterObject, l as Graphics, m as PanelObject, n as requestWebGpuDevice, o as CustomPassObject, p as NineSliceObject, r as Renderer2D, s as DisplayList, t as RendererWebGpu, u as ImageObject, v as TextObject, y as TileSpriteObject } from "./renderer-webgpu-alSDj9RR.js";
|
|
4
5
|
import { ActionMap, StageKernel, createInputRecorder, createInputReplay, createInputTimeline } from "./kernel.js";
|
|
5
6
|
import { buildSceneDigest, sanitizeTrackToken } from "./trace.js";
|
|
6
7
|
import { computeFlexLayout, computeWrapLayout, resolvePadding } from "./flex.js";
|
|
@@ -30,6 +31,7 @@ const Stage2D = {
|
|
|
30
31
|
GameObjects: {
|
|
31
32
|
GameObject: DisplayObject,
|
|
32
33
|
Image: ImageObject,
|
|
34
|
+
Sprite: SpriteObject,
|
|
33
35
|
MsdfIcon: MsdfIconObject,
|
|
34
36
|
NineSlice: NineSliceObject,
|
|
35
37
|
Panel: PanelObject,
|
|
@@ -47,4 +49,4 @@ const Stage2D = {
|
|
|
47
49
|
Display: { Canvas: { CanvasPool: { enableSmoothing() {} } } }
|
|
48
50
|
};
|
|
49
51
|
const Stage = Stage2D;
|
|
50
|
-
export { AUTO, ActionMap, BLACK_RGB, BlendModes, BlitterObject, CANVAS, Camera, CanvasTexture, Container, CustomPassObject, DisplayList, DisplayObject, Easings, EngineClock, EventEmitter, FilterMode, Frame, Game, GameLoop, GameObjectFactory, Graphics, HEX_MASK, ImageObject, InputPlugin, InstancedBatchObject, JsonCache, KeyboardPlugin, LoaderPlugin, MsdfIconBatcher, MsdfIconObject, NineSliceObject, PanelObject, PixelAaBatcher, Pointer, RectangleObject, Renderer2D, RendererGl, RendererWebGpu, SURFACE_BAND, Scale, ScaleManager, Scene, SceneManager, Scenes, SdfPanelBatcher, ShapeBatchObject, Stage, Stage as default, Stage2D, StageKernel, TextObject, Texture, TextureManager, TextureSource, TileSpriteObject, TintModes, TweenManager, VirtualJoystick, WEBGL, WEBGPU, WHITE_RGB, buildSceneDigest, clampJoystickOrigin, computeFlexLayout, computeJoystickVector, computeSurfaceDomZ, computeWrapLayout, createInputRecorder, createInputReplay, createInputTimeline, createMatrix2D, createSurfaceTree, isInJoystickZone, packColorAbgr, parseColor, pullJoystickOrigin, quantizeJoystickDpad, requestWebGpuDevice, resolvePadding, resolveSurfacePriority, rgbToCss, sanitizeTrackToken, surfacePriorityToDomZ };
|
|
52
|
+
export { AUTO, ActionMap, AnimationManager, BLACK_RGB, BlendModes, BlitterObject, CANVAS, Camera, CanvasTexture, Container, CustomPassObject, DisplayList, DisplayObject, Easings, EngineClock, EventEmitter, FilterMode, Frame, Game, GameLoop, GameObjectFactory, Graphics, HEX_MASK, ImageObject, InputPlugin, InstancedBatchObject, JsonCache, KeyboardPlugin, LoaderPlugin, MsdfIconBatcher, MsdfIconObject, NineSliceObject, PanelObject, PixelAaBatcher, Pointer, RectangleObject, Renderer2D, RendererGl, RendererWebGpu, SURFACE_BAND, Scale, ScaleManager, Scene, SceneManager, Scenes, SdfPanelBatcher, ShapeBatchObject, SpriteObject, Stage, Stage as default, Stage2D, StageKernel, TextObject, Texture, TextureManager, TextureSource, TileSpriteObject, TintModes, TweenManager, VirtualJoystick, WEBGL, WEBGPU, WHITE_RGB, buildSceneDigest, clampJoystickOrigin, computeFlexLayout, computeJoystickVector, computeSurfaceDomZ, computeWrapLayout, createInputRecorder, createInputReplay, createInputTimeline, createMatrix2D, createSurfaceTree, isInJoystickZone, packColorAbgr, parseColor, pullJoystickOrigin, quantizeJoystickDpad, requestWebGpuDevice, resolvePadding, resolveSurfacePriority, rgbToCss, sanitizeTrackToken, surfacePriorityToDomZ };
|
package/dist/joystick.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { J as Pointer, Ot as PanelObject, dt as Container, u as Scene } from "./game-3L9wS-Bv.js";
|
|
2
2
|
export type VirtualJoystickMode = 'floating' | 'fixed';
|
|
3
3
|
export interface JoystickVector {
|
|
4
4
|
/** Normalized X axis in [-1, 1] after deadzone remapping. */
|
package/dist/kernel.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as createInputRecorder, C as RecordedInputEntry, D as TimelineClickOptions, E as StagePlugin, M as createInputTimeline, O as TimelineDragOptions, S as InputTimelinePlugin, T as StageKernel, _ as ActionMap, b as InputTargetSpec, j as createInputReplay, k as TimelineKeyOptions, v as InputProvider, w as StageInputEvent, x as InputTimelineOptions, y as InputRecorderPlugin } from "./game-
|
|
1
|
+
import { A as createInputRecorder, C as RecordedInputEntry, D as TimelineClickOptions, E as StagePlugin, M as createInputTimeline, O as TimelineDragOptions, S as InputTimelinePlugin, T as StageKernel, _ as ActionMap, b as InputTargetSpec, j as createInputReplay, k as TimelineKeyOptions, v as InputProvider, w as StageInputEvent, x as InputTimelineOptions, y as InputRecorderPlugin } from "./game-3L9wS-Bv.js";
|
|
2
2
|
export { ActionMap, InputProvider, InputRecorderPlugin, InputTargetSpec, InputTimelineOptions, InputTimelinePlugin, RecordedInputEntry, StageInputEvent, StageKernel, StagePlugin, TimelineClickOptions, TimelineDragOptions, TimelineKeyOptions, createInputRecorder, createInputReplay, createInputTimeline };
|
package/dist/lighting.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Nt as SceneHostLike, St as ImageObject, mt as CustomPassObject } from "./game-3L9wS-Bv.js";
|
|
2
2
|
export type DayPhase = 'day' | 'dusk' | 'night';
|
|
3
3
|
export interface DayNightConfig {
|
|
4
4
|
dayLengthMs?: number;
|
package/dist/projection.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Nt as SceneHostLike, dt as Container, vt as DisplayObject } from "./game-3L9wS-Bv.js";
|
|
2
2
|
export interface Camera25DConfig {
|
|
3
3
|
viewportWidth: number;
|
|
4
4
|
viewportHeight: number;
|