Skip to content

Commit

Permalink
Scene: Prevent image blurring on resize
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanGrieb committed Nov 16, 2023
1 parent 7e6554e commit 38f74a5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions client/src/Game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ export class Game {
if (this.currentScene) {
this.currentScene.redraw();
}
this.canvasContext.imageSmoothingEnabled = false;
}, 300);
});

Expand Down
2 changes: 0 additions & 2 deletions client/src/map/GameMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -646,8 +646,6 @@ export class GameMap {
});
updatedMapChunk.setPosition(chunk.getX(), chunk.getY());

console.log(updatedMapChunk.getZIndex());

Game.getCurrentScene().addActor(updatedMapChunk);
Game.getCurrentScene().removeActor(chunk);

Expand Down
2 changes: 1 addition & 1 deletion client/src/player/ClientPlayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class ClientPlayer extends AbstractPlayer {
});

Game.getCurrentScene().on("mouseup", (options) => {
if (Game.getCurrentScene().getCamera().isLocked()) {
if (Game.getCurrentScene().getCamera().isLocked() || !this.hoveredTile) {
return;
}

Expand Down
6 changes: 5 additions & 1 deletion client/src/scene/Scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ import { Line } from "./Line";
import { SceneObject } from "./SceneObject";

export abstract class Scene {
private static ExitReceipt = new (class {})();
protected static ExitReceipt = new (class {})();

protected storedEvents: Map<string, Function[]>;
protected firstLoad: boolean;
private sceneObjects: SceneObject[];
private camera: Camera;
private name: string;

constructor() {
this.storedEvents = new Map<string, Function[]>();
this.sceneObjects = [];
this.firstLoad = true;
}

public setName(name: string) {
Expand Down Expand Up @@ -80,10 +82,12 @@ export abstract class Scene {
}
});

this.camera = undefined;
this.sceneObjects = [];
this.storedEvents.clear();
NetworkEvents.clear();

this.firstLoad = false;
return Scene.ExitReceipt;
}

Expand Down

0 comments on commit 38f74a5

Please sign in to comment.