Skip to content

Commit

Permalink
fix: TileMap culling did not work properly when using fixed updates l…
Browse files Browse the repository at this point in the history
…ower than refresh rate
  • Loading branch information
eonarheim committed Mar 19, 2024
1 parent 3aeed07 commit ba6012a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Fixed

- Fixed issue where `ex.TileMap` culling did not work properly when using fixed updates lower than refresh rate
- Fixed incomplete types for font options in `ex.FontSource().toFont(options)`
- Fixed issue with `ex.Loader` start button position when using CSS transforms
- Fixed issue where adding scenes with the same name did not work when it was previously removed
Expand Down
2 changes: 1 addition & 1 deletion src/engine/Screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ export class Screen {
Vector.Half)
.scale(vec(1/this._camera.zoom, 1/this._camera.zoom))
.rotate(this._camera.rotation)
.translate(this._camera.pos);
.translate(this._camera.drawPos);
return bounds;
}

Expand Down
4 changes: 4 additions & 0 deletions src/spec/ParallaxSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ describe('A Parallax Component', () => {
const game = TestUtils.engine({width: 500, height: 500}, ['use-canvas-context']);
await TestUtils.runToReady(game);
game.currentScene.camera.pos = ex.vec(0, 0);
game.currentScene.camera.drawPos = ex.vec(0, 0);

const clock = game.clock as ex.TestClock;

Expand All @@ -33,19 +34,22 @@ describe('A Parallax Component', () => {
game.add(actor);

game.currentScene.camera.pos = ex.vec(100, 100);
game.currentScene.camera.drawPos = ex.vec(100, 100);
expect(game.currentScene.camera.pos).toBeVector(ex.vec(100, 100));

clock.step(16);
await expectAsync(game.canvas).toEqualImage('src/spec/images/ParallaxSpec/parallax1.png');
expect(actor.hasTag('ex.offscreen')).toBeFalse();

game.currentScene.camera.pos = ex.vec(520, 520);
game.currentScene.camera.drawPos = ex.vec(520, 520);
clock.step();
expect(game.currentScene.camera.pos).toBeVector(ex.vec(520, 520));
await expectAsync(game.canvas).toEqualImage('src/spec/images/ParallaxSpec/parallax2.png');
expect(actor.hasTag('ex.offscreen')).toBeFalse();

game.currentScene.camera.pos = ex.vec(620, 620);
game.currentScene.camera.drawPos = ex.vec(620, 620);
clock.step();
expect(game.currentScene.camera.pos).toBeVector(ex.vec(620, 620));
expect(actor.hasTag('ex.offscreen')).toBeTrue();
Expand Down

0 comments on commit ba6012a

Please sign in to comment.