Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion examples/common/Character.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,14 @@ export class Character {
const nextFrame = () => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this.node.texture = this.rightFrames[curI]!;
this.node.textureOptions.flipX = flipX;
curI++;
if (curI > iEnd) {
curI = iStart;
}
};
// textureOptions must be replaced wholesale, never mutated in place —
// nodes created without options share a frozen default object.
this.node.textureOptions = { flipX };
nextFrame();
this.curIntervalAnimation = setInterval(nextFrame, intervalMs);
}
Expand Down
5 changes: 4 additions & 1 deletion examples/tests/texture-cleanup-critical.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,16 @@ See docs/ManualRegressionTests.md for more information.
fontSize: 40,
});

// textureOptions must be replaced wholesale, never mutated in place —
// nodes created without options share a frozen default object.
screen.textureOptions = { preload: true };

// Create a new random texture every 10ms
setInterval(() => {
screen.texture = renderer.createTexture('NoiseTexture', {
w: 500,
h: 500,
cacheId: Math.floor(Math.random() * 100000),
});
screen.textureOptions.preload = true;
}, 100);
}
Loading