1681-engine 0.6.6 → 0.6.8
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 +16 -0
- package/dist/core/Camera.js +6 -6
- package/dist/core/Group.js +12 -0
- package/dist/core/Stage.js +9 -8
- package/dist/core/depthSort.js +44 -0
- package/dist/types/core/Camera.d.ts.map +1 -1
- package/dist/types/core/Group.d.ts +8 -0
- package/dist/types/core/Group.d.ts.map +1 -1
- package/dist/types/core/PixelGrid.d.ts +4 -2
- package/dist/types/core/PixelGrid.d.ts.map +1 -1
- package/dist/types/core/Stage.d.ts.map +1 -1
- package/dist/types/core/depthSort.d.ts +6 -0
- package/dist/types/core/depthSort.d.ts.map +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this package are written here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
4
4
|
and versions follow [Semantic Versioning](https://semver.org/); before 1.0 a minor version may break the API.
|
|
5
5
|
|
|
6
|
+
## 0.6.7
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- `Group.keepAbove` / `keepBelow`: keep a child on one side of another, moved only when it is on the wrong side. Two
|
|
11
|
+
pieces each placed *directly* above one body with `moveAbove` (two blades, a fist on a hilt) pushed each other out
|
|
12
|
+
every frame, and every push rebuilt Pixi's draw instructions.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- The world layer sorts by depth once a frame (`deferDepthSort`, `flushDepthSorts`, run by `Stage.frame` after the
|
|
17
|
+
camera): a child's `zIndex` changing only notes the container, and the children are sorted — the render group's
|
|
18
|
+
structure marked changed — only when they are out of order. Pixi marked the structure changed at every `zIndex`
|
|
19
|
+
change, so a world sorted by its bodies' feet rebuilt every draw instruction every frame anything walked up or down
|
|
20
|
+
the screen. A container not handed over keeps Pixi's own behaviour.
|
|
21
|
+
|
|
6
22
|
## 0.6.6
|
|
7
23
|
|
|
8
24
|
### Added
|
package/dist/core/Camera.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Rectangle as
|
|
1
|
+
import { Rectangle as m } from "./Rectangle.js";
|
|
2
2
|
class g {
|
|
3
3
|
constructor(t, s) {
|
|
4
4
|
this.world = t, this.screen = s;
|
|
@@ -104,8 +104,8 @@ class g {
|
|
|
104
104
|
this.followers.delete(t);
|
|
105
105
|
}
|
|
106
106
|
/** Full-screen colour flash starting at `peak` alpha and fading out over `ms`. */
|
|
107
|
-
flash(t, s, h, e,
|
|
108
|
-
(!this.flashRect || this.flashRect.destroyed) && (this.flashRect = new
|
|
107
|
+
flash(t, s, h, e, n = !1, o = 1) {
|
|
108
|
+
(!this.flashRect || this.flashRect.destroyed) && (this.flashRect = new m(1, 1, 16777215).setOrigin(0, 0), this.screen.addChild(this.flashRect)), this.flashRect.resize(this.width, this.height).setFillStyle(s << 16 | h << 8 | e).setAlpha(o).setVisible(!0), this.flashStart = performance.now(), this.flashMs = t, this.flashPeak = o;
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
111
|
* Keeps `target` (anything with `x` and `y`, read every frame: an entity's position, a sprite) in view, inside the
|
|
@@ -121,7 +121,7 @@ class g {
|
|
|
121
121
|
follow1(t) {
|
|
122
122
|
const s = this.target;
|
|
123
123
|
if (!s) return;
|
|
124
|
-
const h = this.trackOpts, e = this.width / this.zoom,
|
|
124
|
+
const h = this.trackOpts, e = this.width / this.zoom, n = this.height / this.zoom, o = this.scrollX + e / 2, r = this.scrollY + n / 2, i = s.x + h.offsetX, l = s.y + h.offsetY, a = h.deadzoneWidth / 2, c = h.deadzoneHeight / 2, f = i - o > a ? i - o - a : i - o < -a ? i - o + a : 0, u = l - r > c ? l - r - c : l - r < -c ? l - r + c : 0, d = h.lerp >= 1 ? 1 : 1 - Math.pow(1 - Math.max(0, h.lerp), t / (1e3 / 60));
|
|
125
125
|
this.scrollX += f * d, this.scrollY += u * d, this.clamp();
|
|
126
126
|
}
|
|
127
127
|
/** Writes the camera into the world layer; called once per frame after the scene updated. */
|
|
@@ -138,8 +138,8 @@ class g {
|
|
|
138
138
|
h = Math.round((Math.random() * 2 - 1) * this.shakeIntensity * this.width * i), e = Math.round((Math.random() * 2 - 1) * this.shakeIntensity * this.height * i);
|
|
139
139
|
}
|
|
140
140
|
this.world.scale.set(this.zoom);
|
|
141
|
-
const
|
|
142
|
-
this.world.position.set(-o + h, -
|
|
141
|
+
const n = this.zoom * this.resolution, o = this.pixelGrid ? Math.round(this.scrollX) * this.zoom : this.roundPixels ? Math.round(this.scrollX * n) / this.resolution : this.scrollX * this.zoom, r = this.pixelGrid ? Math.round(this.scrollY) * this.zoom : this.roundPixels ? Math.round(this.scrollY * n) / this.resolution : this.scrollY * this.zoom;
|
|
142
|
+
this.world.position.set(-o + h, -r + e);
|
|
143
143
|
for (const i of this.followers)
|
|
144
144
|
i.scale.set(this.zoom), i.position.copyFrom(this.world.position);
|
|
145
145
|
if (this.flashRect?.visible) {
|
package/dist/core/Group.js
CHANGED
|
@@ -22,6 +22,18 @@ class d extends r(i) {
|
|
|
22
22
|
moveBelow(t, e) {
|
|
23
23
|
return t.parent !== this || e.parent !== this || t === e ? this : this.getChildIndex(t) === this.getChildIndex(e) - 1 ? this : (this.removeChild(t), this.addChildAt(t, this.getChildIndex(e)), this);
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Keeps `child` drawn above `other`, anywhere above it: moved (directly above) only when it is below. What a weapon
|
|
27
|
+
* held over its body asks for. `moveAbove` from two pieces each wanting to sit *directly* above the same body (two
|
|
28
|
+
* blades, a fist on a hilt, a load) pushed the other out every frame, and every push rebuilt Pixi's instructions.
|
|
29
|
+
*/
|
|
30
|
+
keepAbove(t, e) {
|
|
31
|
+
return t.parent !== this || e.parent !== this || t === e ? this : this.getChildIndex(t) > this.getChildIndex(e) ? this : this.moveAbove(t, e);
|
|
32
|
+
}
|
|
33
|
+
/** Keeps `child` drawn below `other`, anywhere below it: moved (directly below) only when it is above (`keepAbove`). */
|
|
34
|
+
keepBelow(t, e) {
|
|
35
|
+
return t.parent !== this || e.parent !== this || t === e ? this : this.getChildIndex(t) < this.getChildIndex(e) ? this : this.moveBelow(t, e);
|
|
36
|
+
}
|
|
25
37
|
/** Puts `child` directly above `other` in the draw order; already there, it does nothing (see `moveBelow`). */
|
|
26
38
|
moveAbove(t, e) {
|
|
27
39
|
return t.parent !== this || e.parent !== this || t === e ? this : this.getChildIndex(t) === this.getChildIndex(e) + 1 ? this : (this.removeChild(t), this.addChildAt(t, this.getChildIndex(e) + 1), this);
|
package/dist/core/Stage.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Container as s } from "pixi.js";
|
|
2
2
|
import { Camera as n } from "./Camera.js";
|
|
3
3
|
import { Clock as a } from "./Clock.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { deferDepthSort as o, flushDepthSorts as d } from "./depthSort.js";
|
|
5
|
+
import { ObjectFactory as c } from "./ObjectFactory.js";
|
|
6
|
+
import { PixelGrid as m } from "./PixelGrid.js";
|
|
7
|
+
import { Pointer as p } from "./Pointer.js";
|
|
8
|
+
import { Tweener as u } from "./Tweener.js";
|
|
8
9
|
class h {
|
|
9
10
|
constructor(t, e) {
|
|
10
|
-
this.app = t, this.textures = e, t.stage.addChild(this.world, this.screen), this.cameras = { main: new n(this.world, this.screen) }, this.input = { activePointer: new
|
|
11
|
+
this.app = t, this.textures = e, t.stage.addChild(this.world, this.screen), o(this.world), this.cameras = { main: new n(this.world, this.screen) }, this.input = { activePointer: new p(t.canvas) }, this.grid = new m(t, this.world), this.time.onError = (i) => this.caught("timers", i), this.syncSize();
|
|
11
12
|
}
|
|
12
13
|
app;
|
|
13
14
|
textures;
|
|
@@ -15,8 +16,8 @@ class h {
|
|
|
15
16
|
static onCaught = null;
|
|
16
17
|
world = new s({ sortableChildren: !0 });
|
|
17
18
|
screen = new s();
|
|
18
|
-
add = new
|
|
19
|
-
tweens = new
|
|
19
|
+
add = new c(this);
|
|
20
|
+
tweens = new u();
|
|
20
21
|
time = new a();
|
|
21
22
|
cameras;
|
|
22
23
|
input;
|
|
@@ -61,7 +62,7 @@ class h {
|
|
|
61
62
|
*/
|
|
62
63
|
frame(t) {
|
|
63
64
|
const e = performance.now();
|
|
64
|
-
this.guard("resize", () => this.syncSize()), this.guard("update", () => this.update(e, t)), this.guard("tweens", () => this.tweens.update(t)), this.guard("timers", () => this.time.update(e)), this.guard("camera", () => this.cameras.main.apply(e)), (this.pixelPerfect || this.gridLive) && (this.gridLive = this.pixelPerfect, this.guard("pixel grid", () => this.grid.render(this.cameras.main, this.pixelPerfect, this.pixelDensity)));
|
|
65
|
+
this.guard("resize", () => this.syncSize()), this.guard("update", () => this.update(e, t)), this.guard("tweens", () => this.tweens.update(t)), this.guard("timers", () => this.time.update(e)), this.guard("camera", () => this.cameras.main.apply(e)), this.guard("depth", d), (this.pixelPerfect || this.gridLive) && (this.gridLive = this.pixelPerfect, this.guard("pixel grid", () => this.grid.render(this.cameras.main, this.pixelPerfect, this.pixelDensity)));
|
|
65
66
|
}
|
|
66
67
|
/**
|
|
67
68
|
* Keeps a piece of text made outside `add.text`/`add.label` (put on the world any way) at screen resolution while the
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Container as c } from "pixi.js";
|
|
2
|
+
const s = /* @__PURE__ */ new WeakSet(), d = /* @__PURE__ */ new Set();
|
|
3
|
+
let f = !1;
|
|
4
|
+
function p() {
|
|
5
|
+
if (f) return;
|
|
6
|
+
f = !0;
|
|
7
|
+
const e = c.prototype, r = e.depthOfChildModified;
|
|
8
|
+
e.depthOfChildModified = function() {
|
|
9
|
+
const t = this.parent;
|
|
10
|
+
if (t && s.has(t)) {
|
|
11
|
+
const n = t;
|
|
12
|
+
n.sortableChildren = !0, n.sortDirty = !0, d.add(t);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
r.call(this);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function h(e) {
|
|
19
|
+
p(), s.add(e);
|
|
20
|
+
}
|
|
21
|
+
function l() {
|
|
22
|
+
for (const e of d) {
|
|
23
|
+
if (e.destroyed) continue;
|
|
24
|
+
const r = e, o = e.children;
|
|
25
|
+
let t = !0;
|
|
26
|
+
for (let i = 1; i < o.length; i++)
|
|
27
|
+
if (o[i - 1].zIndex > o[i].zIndex) {
|
|
28
|
+
t = !1;
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
if (t) {
|
|
32
|
+
r.sortDirty = !1;
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
r.sortChildren();
|
|
36
|
+
const n = r.renderGroup ?? r.parentRenderGroup;
|
|
37
|
+
n && (n.structureDidChange = !0);
|
|
38
|
+
}
|
|
39
|
+
d.clear();
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
h as deferDepthSort,
|
|
43
|
+
l as flushDepthSorts
|
|
44
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Camera.d.ts","sourceRoot":"","sources":["../../../src/core/Camera.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGzC,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mGAAmG;IACnG,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mGAAmG;IACnG,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KA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M,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAS1D;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAI9B,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAIhC,kFAAkF;IAClF,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,UAAQ,EAAE,IAAI,SAAI,GAAG,IAAI;IAWlF;;;OAGG;IACH,KAAK,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,OAAO,GAAE,YAAiB,GAAG,IAAI;IAO3F,OAAO,IAAI,IAAI;IAKf,wEAAwE;IACxE,OAAO,CAAC,OAAO;IAqBf,6FAA6F;IAC7F,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAqCxB,OAAO,CAAC,KAAK;CAQd"}
|
|
@@ -12,6 +12,14 @@ export declare class Group extends Group_base {
|
|
|
12
12
|
* frame — a held weapon ordered against its body every frame did it every frame.
|
|
13
13
|
*/
|
|
14
14
|
moveBelow(child: PixiContainer, other: PixiContainer): this;
|
|
15
|
+
/**
|
|
16
|
+
* Keeps `child` drawn above `other`, anywhere above it: moved (directly above) only when it is below. What a weapon
|
|
17
|
+
* held over its body asks for. `moveAbove` from two pieces each wanting to sit *directly* above the same body (two
|
|
18
|
+
* blades, a fist on a hilt, a load) pushed the other out every frame, and every push rebuilt Pixi's instructions.
|
|
19
|
+
*/
|
|
20
|
+
keepAbove(child: PixiContainer, other: PixiContainer): this;
|
|
21
|
+
/** Keeps `child` drawn below `other`, anywhere below it: moved (directly below) only when it is above (`keepAbove`). */
|
|
22
|
+
keepBelow(child: PixiContainer, other: PixiContainer): this;
|
|
15
23
|
/** Puts `child` directly above `other` in the draw order; already there, it does nothing (see `moveBelow`). */
|
|
16
24
|
moveAbove(child: PixiContainer, other: PixiContainer): this;
|
|
17
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Group.d.ts","sourceRoot":"","sources":["../../../src/core/Group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;;AAGrE,yFAAyF;AACzF,qBAAa,KAAM,SAAQ,UAAqB;IAC9C,IAAI,IAAI,IAAI,aAAa,EAAE,CAE1B;IAED,GAAG,CAAC,KAAK,EAAE,aAAa,GAAG,aAAa,EAAE,GAAG,IAAI;IAKjD,KAAK,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAKhD,MAAM,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,UAAQ,GAAG,IAAI;IAMnD;;;;OAIG;IACH,SAAS,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,GAAG,IAAI;IAQ3D,+GAA+G;IAC/G,SAAS,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,GAAG,IAAI;CAO5D"}
|
|
1
|
+
{"version":3,"file":"Group.d.ts","sourceRoot":"","sources":["../../../src/core/Group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;;AAGrE,yFAAyF;AACzF,qBAAa,KAAM,SAAQ,UAAqB;IAC9C,IAAI,IAAI,IAAI,aAAa,EAAE,CAE1B;IAED,GAAG,CAAC,KAAK,EAAE,aAAa,GAAG,aAAa,EAAE,GAAG,IAAI;IAKjD,KAAK,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAKhD,MAAM,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,UAAQ,GAAG,IAAI;IAMnD;;;;OAIG;IACH,SAAS,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,GAAG,IAAI;IAQ3D;;;;OAIG;IACH,SAAS,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,GAAG,IAAI;IAM3D,wHAAwH;IACxH,SAAS,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,GAAG,IAAI;IAM3D,+GAA+G;IAC/G,SAAS,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,GAAG,IAAI;CAO5D"}
|
|
@@ -3,8 +3,10 @@ import type { Camera } from './Camera.js';
|
|
|
3
3
|
import { SharpText } from './SharpText.js';
|
|
4
4
|
/**
|
|
5
5
|
* A pixel-perfect world (`Stage.pixelPerfect`): the world layer is taken off the stage and drawn each frame into a
|
|
6
|
-
* texture of one texel per world pixel (`Stage.pixelDensity` texels, when the art is finer), whose origin sits on a whole world pixel, then shown at the camera's zoom
|
|
7
|
-
*
|
|
6
|
+
* texture of one texel per world pixel (`Stage.pixelDensity` texels, when the art is finer), whose origin sits on a whole world pixel, then shown at the camera's zoom.
|
|
7
|
+
* The camera scrolls by whole world pixels meanwhile (`Camera.apply`), the grid the roots are snapped to: it glided a
|
|
8
|
+
* backing pixel at a time until 0.6.8, and the followed body, snapped to world pixels under it, jittered and read as
|
|
9
|
+
* blurred. Everything turned, scaled or
|
|
8
10
|
* placed between pixels lands on the same grid as the rest of the art, so no pixel on screen is drawn at another size
|
|
9
11
|
* ("mixels"); the world is also filled at 1/zoom² of the screen's pixels. Roots placed with `Camera.snapRoot` land on
|
|
10
12
|
* whole world pixels meanwhile, and text stays at screen resolution (`SharpText`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PixelGrid.d.ts","sourceRoot":"","sources":["../../../src/core/PixelGrid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAC1F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC
|
|
1
|
+
{"version":3,"file":"PixelGrid.d.ts","sourceRoot":"","sources":["../../../src/core/PixelGrid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAC1F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;;;;;GASG;AACH,qBAAa,SAAS;IAQlB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,KAAK;IARxB,OAAO,CAAC,OAAO,CAA8B;IAC7C,OAAO,CAAC,MAAM,CAAuB;IACrC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAgB;IAC1C,OAAO,CAAC,EAAE,CAAS;gBAGA,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,SAAS;IAKnC,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,mGAAmG;IACnG,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,SAAI,GAAG,IAAI;IAmBxD,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAK1B,OAAO,CAAC,MAAM;IAWd,OAAO,CAAC,OAAO;IAef;;;OAGG;IACH,OAAO,CAAC,GAAG;CAQZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stage.d.ts","sourceRoot":"","sources":["../../../src/core/Stage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CA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,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAsB;IACtD,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,UAAU,CAAK;gBAGZ,GAAG,EAAE,WAAW,EAChB,QAAQ,EAAE,eAAe;IAapC,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED,6GAA6G;IAC7G,QAAQ,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAQpC,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAEjD;;;;OAIG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAe1B;;;OAGG;IACH,SAAS,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI;IAI/B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAE9C;;;;OAIG;IACH,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI;IAInD,2EAA2E;IAC3E,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC;IAS/D,iIAAiI;IACjI,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI;IASlD,OAAO,IAAI,IAAI;IAUf,OAAO,CAAC,QAAQ;CAWjB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Container } from 'pixi.js';
|
|
2
|
+
/** Checks `container`'s depth order once a frame (`flushDepthSorts`) instead of at every child's `zIndex` change. */
|
|
3
|
+
export declare function deferDepthSort(container: Container): void;
|
|
4
|
+
/** Sorts each container whose children changed depth, marking its render group changed only if the order did. */
|
|
5
|
+
export declare function flushDepthSorts(): void;
|
|
6
|
+
//# sourceMappingURL=depthSort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"depthSort.d.ts","sourceRoot":"","sources":["../../../src/core/depthSort.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAyCpC,qHAAqH;AACrH,wBAAgB,cAAc,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAGzD;AAED,iHAAiH;AACjH,wBAAgB,eAAe,IAAI,IAAI,CAqBtC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "1681-engine",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8",
|
|
4
4
|
"description": "A 2D game engine on PixiJS 8 for any art style: scenes and a fast ECS, a fixed-step loop, asset loading, Tiled maps, sprite animation, input actions, camera follow, audio and deterministic, server-replayable movement, plus Dither, an optional pixel-art module (pixel-perfect effects, dithered lighting).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|