@holtjs/stage 0.6.0 → 0.8.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 +24 -0
- package/dist/anims-ClNi6zZQ.d.ts +391 -0
- package/dist/anims.d.ts +2 -0
- package/dist/anims.js +436 -0
- package/dist/{game-Blm49zGH.d.ts → game-CEa0m4eX.d.ts} +154 -203
- package/dist/{game-Ds-cn2YI.js → game-D46nY-B2.js} +187 -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-BXU-ZDIp.js} +507 -32
- 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 +24 -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-BXU-ZDIp.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)`: `[x, y]` or oriented `[x, y, angleRad, zBias]`. */
|
|
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,67 @@ 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)` (with optional projected `angleRad` & front/back `zBias`). */
|
|
145
|
+
setAnchor(name, x, y, angleRad, zBias) {
|
|
146
|
+
if (!this.anchors) this.anchors = Object.create(null);
|
|
147
|
+
if (typeof angleRad === "number" && Number.isFinite(angleRad)) {
|
|
148
|
+
const zb = typeof zBias === "number" && Number.isFinite(zBias) ? zBias >= 0 ? 1 : -1 : 1;
|
|
149
|
+
this.anchors[name] = [
|
|
150
|
+
x,
|
|
151
|
+
y,
|
|
152
|
+
angleRad,
|
|
153
|
+
zb
|
|
154
|
+
];
|
|
155
|
+
} else this.anchors[name] = [x, y];
|
|
156
|
+
return this;
|
|
157
|
+
}
|
|
158
|
+
/** Read a named pixel socket `[x, y]` or `[x, y, angleRad, zBias]` (falls back to `emissiveCenter` when `name === 'emissive'`). */
|
|
159
|
+
getAnchor(name) {
|
|
160
|
+
if (this.anchors && Object.prototype.hasOwnProperty.call(this.anchors, name)) return this.anchors[name];
|
|
161
|
+
if (name === "emissive" && this.emissiveCenter) return this.emissiveCenter;
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
applyMeta(meta) {
|
|
165
|
+
if (typeof meta.ax === "number" && typeof meta.ay === "number") this.setPixelPivot(meta.ax, meta.ay);
|
|
166
|
+
else if (typeof meta.pivotX === "number" || typeof meta.pivotY === "number") this.setPivot(meta.pivotX ?? .5, meta.pivotY ?? .5);
|
|
167
|
+
if (meta.anchors) {
|
|
168
|
+
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, pt.length >= 3 && typeof pt[2] === "number" ? Number(pt[2]) : void 0, pt.length >= 4 && typeof pt[3] === "number" ? Number(pt[3]) : void 0);
|
|
169
|
+
}
|
|
170
|
+
if (Array.isArray(meta.emissiveCenter) && meta.emissiveCenter.length >= 2) this.emissiveCenter = [Number(meta.emissiveCenter[0]) || 0, Number(meta.emissiveCenter[1]) || 0];
|
|
171
|
+
if (typeof meta.emissivePower === "number") this.emissivePower = meta.emissivePower;
|
|
172
|
+
const actor = meta.actor ?? meta.char;
|
|
173
|
+
if (typeof actor === "string" && actor.length > 0) this.actor = actor;
|
|
174
|
+
if (typeof meta.clip === "string" && meta.clip.length > 0) this.clip = meta.clip;
|
|
175
|
+
if (typeof meta.dir === "number" || typeof meta.dir === "string") this.dir = meta.dir;
|
|
176
|
+
if (typeof meta.frame === "number" && Number.isFinite(meta.frame)) this.animFrameIndex = meta.frame;
|
|
177
|
+
if (typeof meta.loop === "boolean") this.animLoop = meta.loop;
|
|
178
|
+
return this;
|
|
179
|
+
}
|
|
105
180
|
updateUVs() {
|
|
106
181
|
const sw = this.source.width || 1;
|
|
107
182
|
const sh = this.source.height || 1;
|
|
@@ -116,6 +191,10 @@ var Texture = class {
|
|
|
116
191
|
key;
|
|
117
192
|
source;
|
|
118
193
|
frames = Object.create(null);
|
|
194
|
+
/** Optional isometric camera azimuth (`yaw` in radians, e.g. `Math.PI / 4` from `@holtjs/craft/three`) used by `SpriteObject.playDirectional()`. */
|
|
195
|
+
atlasYaw = null;
|
|
196
|
+
atlasPitch = null;
|
|
197
|
+
atlasScale = null;
|
|
119
198
|
constructor(manager, key, image, filterMode, host, premultiplyAlpha = true, isRenderTarget = false) {
|
|
120
199
|
this.manager = manager;
|
|
121
200
|
this.key = key;
|
|
@@ -123,8 +202,8 @@ var Texture = class {
|
|
|
123
202
|
this.source = [src];
|
|
124
203
|
this.add("__BASE", 0, 0, 0, src.width, src.height);
|
|
125
204
|
}
|
|
126
|
-
add(name, sourceIndex, x, y, width, height) {
|
|
127
|
-
const frame = new Frame(this, name, sourceIndex, x, y, width, height);
|
|
205
|
+
add(name, sourceIndex, x, y, width, height, meta) {
|
|
206
|
+
const frame = new Frame(this, name, sourceIndex, x, y, width, height, meta);
|
|
128
207
|
this.frames[String(name)] = frame;
|
|
129
208
|
return frame;
|
|
130
209
|
}
|
|
@@ -254,6 +333,71 @@ var TextureManager = class {
|
|
|
254
333
|
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
334
|
return tex;
|
|
256
335
|
}
|
|
336
|
+
/**
|
|
337
|
+
* Register a packed sprite atlas (`@holtjs/craft/three`, `@holtjs/craft/atlas`, or TexturePacker / Aseprite JSON Hash & Array)
|
|
338
|
+
* preserving per-frame trimmed pivots (`ax/ay` or `pivot`), named sockets (`anchors`), `emissiveCenter`, and `atlasYaw`!
|
|
339
|
+
*/
|
|
340
|
+
addAtlas(key, source, atlasData, options) {
|
|
341
|
+
const tex = this.addImage(key, source, options);
|
|
342
|
+
if (!tex || !atlasData) return tex;
|
|
343
|
+
const root = atlasData.json && typeof atlasData.json === "object" ? atlasData.json : atlasData;
|
|
344
|
+
if (typeof root.yaw === "number" && Number.isFinite(root.yaw)) tex.atlasYaw = root.yaw;
|
|
345
|
+
if (typeof root.pitch === "number" && Number.isFinite(root.pitch)) tex.atlasPitch = root.pitch;
|
|
346
|
+
if (typeof root.scale === "number" && Number.isFinite(root.scale)) tex.atlasScale = root.scale;
|
|
347
|
+
const rawFrames = root.frames ?? atlasData.frames;
|
|
348
|
+
if (!rawFrames) return tex;
|
|
349
|
+
const addEntry = (frameName, entry) => {
|
|
350
|
+
if (!entry || typeof entry !== "object") return;
|
|
351
|
+
if (entry.frame && typeof entry.frame === "object" && typeof entry.frame.w === "number") {
|
|
352
|
+
const fr = entry.frame;
|
|
353
|
+
const fx = Number(fr.x) || 0;
|
|
354
|
+
const fy = Number(fr.y) || 0;
|
|
355
|
+
const fw = Number(fr.w) || 0;
|
|
356
|
+
const fh = Number(fr.h) || 0;
|
|
357
|
+
const meta = {};
|
|
358
|
+
if (entry.pivot && typeof entry.pivot.x === "number" && typeof entry.pivot.y === "number") {
|
|
359
|
+
const px = Number(entry.pivot.x);
|
|
360
|
+
const py = Number(entry.pivot.y);
|
|
361
|
+
if (entry.trimmed && entry.sourceSize && entry.spriteSourceSize && typeof entry.sourceSize.w === "number" && typeof entry.spriteSourceSize.x === "number") {
|
|
362
|
+
meta.ax = entry.sourceSize.w * px - entry.spriteSourceSize.x;
|
|
363
|
+
meta.ay = entry.sourceSize.h * py - entry.spriteSourceSize.y;
|
|
364
|
+
} else {
|
|
365
|
+
meta.pivotX = px;
|
|
366
|
+
meta.pivotY = py;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
if (entry.anchors) meta.anchors = entry.anchors;
|
|
370
|
+
tex.add(frameName, 0, fx, fy, fw, fh, meta);
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
const fx = Number(entry.x) || 0;
|
|
374
|
+
const fy = Number(entry.y) || 0;
|
|
375
|
+
const fw = Number(entry.w ?? entry.width) || 0;
|
|
376
|
+
const fh = Number(entry.h ?? entry.height) || 0;
|
|
377
|
+
tex.add(frameName, 0, fx, fy, fw, fh, {
|
|
378
|
+
ax: typeof entry.ax === "number" ? entry.ax : void 0,
|
|
379
|
+
ay: typeof entry.ay === "number" ? entry.ay : void 0,
|
|
380
|
+
pivotX: typeof entry.pivotX === "number" ? entry.pivotX : void 0,
|
|
381
|
+
pivotY: typeof entry.pivotY === "number" ? entry.pivotY : void 0,
|
|
382
|
+
anchors: entry.anchors,
|
|
383
|
+
emissiveCenter: entry.emissiveCenter,
|
|
384
|
+
emissivePower: entry.emissivePower,
|
|
385
|
+
char: entry.char,
|
|
386
|
+
actor: entry.actor,
|
|
387
|
+
clip: entry.clip,
|
|
388
|
+
dir: entry.dir,
|
|
389
|
+
frame: typeof entry.frame === "number" ? entry.frame : void 0,
|
|
390
|
+
frames: entry.frames,
|
|
391
|
+
loop: entry.loop
|
|
392
|
+
});
|
|
393
|
+
};
|
|
394
|
+
if (Array.isArray(rawFrames)) for (let i = 0; i < rawFrames.length; i++) {
|
|
395
|
+
const item = rawFrames[i];
|
|
396
|
+
addEntry(String(item?.filename ?? item?.name ?? item?.key ?? i), item);
|
|
397
|
+
}
|
|
398
|
+
else if (typeof rawFrames === "object") for (const [name, item] of Object.entries(rawFrames)) addEntry(name, item);
|
|
399
|
+
return tex;
|
|
400
|
+
}
|
|
257
401
|
remove(key) {
|
|
258
402
|
if (!this.exists(key)) return false;
|
|
259
403
|
const tex = this.list[key];
|
|
@@ -2901,7 +3045,11 @@ var RendererGl = class extends EventEmitter {
|
|
|
2901
3045
|
if (!frame || frame.width <= 0 || frame.height <= 0) return;
|
|
2902
3046
|
const ox = img.displayOriginX;
|
|
2903
3047
|
const oy = img.displayOriginY;
|
|
2904
|
-
|
|
3048
|
+
const pivotMirrored = frame.customPivot && !img.customOrigin && !img.isCropped;
|
|
3049
|
+
let x0 = pivotMirrored && img.flipX ? ox - img.width : -ox;
|
|
3050
|
+
let y0 = pivotMirrored && img.flipY ? oy - img.height : -oy;
|
|
3051
|
+
let x1 = pivotMirrored && img.flipX ? ox : img.width - ox;
|
|
3052
|
+
let y1 = pivotMirrored && img.flipY ? oy : img.height - oy;
|
|
2905
3053
|
let u0 = frame.u0, v0 = frame.v0, u1 = frame.u1, v1 = frame.v1;
|
|
2906
3054
|
if (img.isCropped) {
|
|
2907
3055
|
const fw = frame.width || 1, fh = frame.height || 1;
|
|
@@ -3912,6 +4060,7 @@ var RendererGl = class extends EventEmitter {
|
|
|
3912
4060
|
}
|
|
3913
4061
|
switch (obj.type) {
|
|
3914
4062
|
case "Image":
|
|
4063
|
+
case "Sprite":
|
|
3915
4064
|
this.renderImage(obj, camera, m, effAlpha);
|
|
3916
4065
|
break;
|
|
3917
4066
|
case "NineSlice":
|
|
@@ -4747,6 +4896,16 @@ var LoaderPlugin = class extends EventEmitter {
|
|
|
4747
4896
|
});
|
|
4748
4897
|
return this;
|
|
4749
4898
|
}
|
|
4899
|
+
atlas(key, imageUrl, atlasData, options) {
|
|
4900
|
+
this.queue.push({
|
|
4901
|
+
kind: "atlas",
|
|
4902
|
+
key,
|
|
4903
|
+
url: imageUrl,
|
|
4904
|
+
atlas: atlasData,
|
|
4905
|
+
imageOpts: options
|
|
4906
|
+
});
|
|
4907
|
+
return this;
|
|
4908
|
+
}
|
|
4750
4909
|
get hasQueued() {
|
|
4751
4910
|
return this.queue.length > 0;
|
|
4752
4911
|
}
|
|
@@ -4865,6 +5024,7 @@ var LoaderPlugin = class extends EventEmitter {
|
|
|
4865
5024
|
if (settled || isAborted() || activeImg !== img) return;
|
|
4866
5025
|
try {
|
|
4867
5026
|
if (item.kind === "spritesheet" && item.sheet) this.textures.addSpriteSheet(item.key, img, item.sheet);
|
|
5027
|
+
else if (item.kind === "atlas" && item.atlas) this.textures.addAtlas(item.key, img, item.atlas, item.imageOpts);
|
|
4868
5028
|
else this.textures.addImage(item.key, img, item.imageOpts);
|
|
4869
5029
|
settle(true);
|
|
4870
5030
|
} catch {
|
|
@@ -4919,6 +5079,9 @@ var GameObjectFactory = class {
|
|
|
4919
5079
|
image(x, y, key, frame) {
|
|
4920
5080
|
return this.register(new ImageObject(this.scene, x, y, key, frame));
|
|
4921
5081
|
}
|
|
5082
|
+
sprite(x, y, key, frame) {
|
|
5083
|
+
return this.register(new SpriteObject(this.scene, x, y, key, frame));
|
|
5084
|
+
}
|
|
4922
5085
|
nineslice(x, y, key, frame, width, height, left, right, top, bottom) {
|
|
4923
5086
|
return this.register(new NineSliceObject(this.scene, x, y, key, frame, width, height, left, right, top, bottom));
|
|
4924
5087
|
}
|
|
@@ -5051,6 +5214,7 @@ var Scene = class {
|
|
|
5051
5214
|
events = new EventEmitter();
|
|
5052
5215
|
/** Deterministic EngineClock-driven tween & spring manager (auto-stepped in `Game.step()`). */
|
|
5053
5216
|
tweens = new TweenManager();
|
|
5217
|
+
_animatedSprites = /* @__PURE__ */ new Set();
|
|
5054
5218
|
_nodesCreated = 0;
|
|
5055
5219
|
_nodesDestroyed = 0;
|
|
5056
5220
|
_disposersRan = 0;
|
|
@@ -5060,6 +5224,7 @@ var Scene = class {
|
|
|
5060
5224
|
clock;
|
|
5061
5225
|
renderer;
|
|
5062
5226
|
textures;
|
|
5227
|
+
anims;
|
|
5063
5228
|
scale;
|
|
5064
5229
|
input;
|
|
5065
5230
|
load;
|
|
@@ -5091,6 +5256,7 @@ var Scene = class {
|
|
|
5091
5256
|
this.clock = game.clock;
|
|
5092
5257
|
this.renderer = game.renderer;
|
|
5093
5258
|
this.textures = game.textures;
|
|
5259
|
+
this.anims = game.anims;
|
|
5094
5260
|
this.scale = game.scale;
|
|
5095
5261
|
this.input = game.input;
|
|
5096
5262
|
this.load = new LoaderPlugin(game.textures);
|
|
@@ -5131,6 +5297,17 @@ var Scene = class {
|
|
|
5131
5297
|
tweenStats() {
|
|
5132
5298
|
return this.tweens.stats();
|
|
5133
5299
|
}
|
|
5300
|
+
_registerAnimatedSprite(sprite) {
|
|
5301
|
+
this._animatedSprites.add(sprite);
|
|
5302
|
+
}
|
|
5303
|
+
_unregisterAnimatedSprite(sprite) {
|
|
5304
|
+
this._animatedSprites.delete(sprite);
|
|
5305
|
+
}
|
|
5306
|
+
_stepAnimations(deltaMs) {
|
|
5307
|
+
if (this._animatedSprites.size === 0 || deltaMs <= 0) return;
|
|
5308
|
+
for (const s of this._animatedSprites) if (s.active) s._stepAnim(deltaMs);
|
|
5309
|
+
else this._animatedSprites.delete(s);
|
|
5310
|
+
}
|
|
5134
5311
|
_invalidateTextGl() {
|
|
5135
5312
|
const walk = (list) => {
|
|
5136
5313
|
for (let i = 0; i < list.length; i++) {
|
|
@@ -5155,6 +5332,7 @@ var Scene = class {
|
|
|
5155
5332
|
for (let i = 0; i < snap.length; i++) try {
|
|
5156
5333
|
snap[i].destroy(true);
|
|
5157
5334
|
} catch {}
|
|
5335
|
+
this._animatedSprites.clear();
|
|
5158
5336
|
this.tweens.clear();
|
|
5159
5337
|
}
|
|
5160
5338
|
};
|
|
@@ -5294,6 +5472,7 @@ var Game = class {
|
|
|
5294
5472
|
canvas;
|
|
5295
5473
|
renderer;
|
|
5296
5474
|
textures;
|
|
5475
|
+
anims;
|
|
5297
5476
|
scale;
|
|
5298
5477
|
input;
|
|
5299
5478
|
cache;
|
|
@@ -5362,6 +5541,7 @@ var Game = class {
|
|
|
5362
5541
|
}
|
|
5363
5542
|
const glHost = this.renderer.type === 2 ? this.renderer : null;
|
|
5364
5543
|
this.textures = new TextureManager(Boolean(config.pixelArt), glHost, this.doc);
|
|
5544
|
+
this.anims = new AnimationManager(this.textures);
|
|
5365
5545
|
if (glHost) glHost.onContextLost = () => {
|
|
5366
5546
|
this.textures.invalidateAllGl();
|
|
5367
5547
|
for (let i = 0; i < this.scene.scenes.length; i++) this.scene.scenes[i]._invalidateTextGl();
|
|
@@ -5411,6 +5591,7 @@ var Game = class {
|
|
|
5411
5591
|
if (sc.sys.settings.status === Scenes.RUNNING) {
|
|
5412
5592
|
sc.events.emit("preupdate", time, delta);
|
|
5413
5593
|
if (sc.tweens.hasActive) sc.tweens.step(this.clock.lastDeltaMs);
|
|
5594
|
+
sc._stepAnimations(this.clock.lastDeltaMs);
|
|
5414
5595
|
sc.update?.(time, delta);
|
|
5415
5596
|
this.kernel._updateScene(sc, time, delta);
|
|
5416
5597
|
sc.cameras.main.stepFollow(this.clock.lastDeltaMs);
|
|
@@ -5459,6 +5640,7 @@ var Game = class {
|
|
|
5459
5640
|
this.kernel.dispose();
|
|
5460
5641
|
this.scene.destroy();
|
|
5461
5642
|
this.input.destroy();
|
|
5643
|
+
this.anims.clear();
|
|
5462
5644
|
this.textures.destroy();
|
|
5463
5645
|
this.cache.json.clear();
|
|
5464
5646
|
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-CEa0m4eX.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-D46nY-B2.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 PanelOpenSide, B as SceneDigestSurfaceEntry, Bt as SpritePlayOptions, C as RecordedInputEntry, Ct as ImageObject, D as TimelineClickOptions, Dt as MsdfIconObject, E as StagePlugin, Et as MsdfIconConfig, F as SceneDigestEngineSandbox, Ft as ShapeBatchColumns, G as InputConfig, Gt as Camera, H as SceneDigestSurfaces, Ht as TextObject, I as SceneDigestNode, It as ShapeBatchObject, J as Pointer, Jt as HiDpiScaleLike, K as InputPlugin, Kt as CameraFollowOptions, L as SceneDigestOptions, Lt as ShapeBatchStyleDefaults, M as createInputTimeline, Mt as RectClipMask, N as SceneDigest, Nt as RectangleObject, O as TimelineDragOptions, Ot as NineSliceObject, P as SceneDigestActiveFocus, Pt as SceneHostLike, Q as RequestWebGpuOptions, R as SceneDigestOverlayStats, Rt as SpriteAnimEventListener, S as InputTimelinePlugin, St as Graphics, T as StageKernel, Tt as InstancedColumns, U as buildSceneDigest, Ut as TextStyleConfig, V as SceneDigestSurfaceSource, Vt as SyncAttachmentOptions, W as sanitizeTrackToken, Wt as TileSpriteObject, X as RendererWebGpu, Y as PointerSample, Z as RendererWebGpuOptions, _ as ActionMap, _t as DirectionalPlayOptions, a as GameLoop, at as RendererGlOptions, b as InputTargetSpec, bt as DisplayObjectType, c as LoaderPlugin, ct as StageRenderTarget, d as SceneCtor, dt as Bob$1, et as WebGpuCanvasContextLike, f as SceneInput, ft as Container, g as ViewportFitResult, gt as CustomPassOptions, h as StageRenderer, ht as CustomPassObject, i as GameConfig$1, it as RendererGl, j as createInputReplay, jt as PanelStyleConfig, k as TimelineKeyOptions, kt as PanelObject, l as ScaleManager, lt as AnchorPose2D, m as SceneManager, mt as CustomPassCallback, n as EngineClockSnapshot, nt as requestWebGpuDevice, o as GameObjectFactory, ot as RendererStats, p as SceneLifecycleStats, pt as ContainerFiltersShim, q as KeyboardPlugin, qt as HiDpiConfigureOptions, r as Game, rt as Renderer2D, s as JsonCache, st as Stage2DCustomImageHandler, t as EngineClock, tt as WebGpuDeviceLike, u as Scene, ut as BlitterObject, v as InputProvider, vt as DisplayList, w as StageInputEvent, wt as InstancedBatchObject, x as InputTimelineOptions, xt as DisplaySemantics, y as InputRecorderPlugin, yt as DisplayObject, z as SceneDigestSandbox, zt as SpriteObject } from "./game-CEa0m4eX.js";
|
|
2
|
+
import { A as FilterModeValue, B as WEBGL, C as AUTO, D as CANVAS, E as BlendModes, F as Scale, G as packColorAbgr, H as WHITE_RGB, I as ScaleMode, K as parseColor, L as Scenes, M as Matrix2D, N as Rect2D, O as EventEmitter, P as RgbaColor, R as TintMode, S as TextureSource, T as BlendMode, U as WorldView2D, V as WEBGPU, W as createMatrix2D, _ as SpriteSheetConfig, a as AtlasClipRule, b as TextureImageSource, c as GenerateFrameNamesConfig, d as AtlasJsonLike, f as CanvasTexture, g as GlTextureHost, h as FrameExtraMeta, i as AtlasAutoAnimOptions, j as HEX_MASK, k as FilterMode, l as GenerateFrameNumbersConfig, m as FrameAnchorTuple, n as AnimationFrameInput, o as CompiledAnimationFrame, p as Frame, q as rgbToCss, r as AnimationManager, s as DirectionalAnimGroup, t as AnimationConfig, u as StageAnimation, v as Texture, w as BLACK_RGB, x as TextureManager, y as TextureImageOptions, z as TintModes } from "./anims-ClNi6zZQ.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 AnchorPose2D, 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 FrameAnchorTuple, 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, type SyncAttachmentOptions, 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-D46nY-B2.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-BXU-ZDIp.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, ft as Container, kt as PanelObject, u as Scene } from "./game-CEa0m4eX.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-CEa0m4eX.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 { Ct as ImageObject, Pt as SceneHostLike, ht as CustomPassObject } from "./game-CEa0m4eX.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 { Pt as SceneHostLike, ft as Container, yt as DisplayObject } from "./game-CEa0m4eX.js";
|
|
2
2
|
export interface Camera25DConfig {
|
|
3
3
|
viewportWidth: number;
|
|
4
4
|
viewportHeight: number;
|