## Description:

Add a new pixi layer for rendering structure icons
Add new sprites for structures

![image](https://github.com/user-attachments/assets/d5171b31-c83b-431a-a0f6-87b85b460a3f)

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:

Vivacious Box

---------

Co-authored-by: evanpelle <evanpelle@gmail.com>
This commit is contained in:
Vivacious Box
2025-06-28 02:00:01 +02:00
committed by GitHub
parent 09bd6312e3
commit 77dddbf3ee
38 changed files with 1312 additions and 231 deletions
+10 -2
View File
@@ -14,6 +14,7 @@ export const CAMERA_SMOOTHING = 0.03;
export class TransformHandler {
public scale: number = 1.8;
private _boundingRect: DOMRect;
private offsetX: number = -350;
private offsetY: number = -200;
private lastGoToCallTime: number | null = null;
@@ -27,6 +28,7 @@ export class TransformHandler {
private eventBus: EventBus,
private canvas: HTMLCanvasElement,
) {
this._boundingRect = this.canvas.getBoundingClientRect();
this.eventBus.on(ZoomEvent, (e) => this.onZoom(e));
this.eventBus.on(DragEvent, (e) => this.onMove(e));
this.eventBus.on(GoToPlayerEvent, (e) => this.onGoToPlayer(e));
@@ -35,8 +37,12 @@ export class TransformHandler {
this.eventBus.on(CenterCameraEvent, () => this.centerCamera());
}
public updateCanvasBoundingRect() {
this._boundingRect = this.canvas.getBoundingClientRect();
}
boundingRect(): DOMRect {
return this.canvas.getBoundingClientRect();
return this._boundingRect;
}
width(): number {
@@ -45,6 +51,9 @@ export class TransformHandler {
hasChanged(): boolean {
return this.changed;
}
resetChanged() {
this.changed = false;
}
handleTransform(context: CanvasRenderingContext2D) {
// Disable image smoothing for pixelated effect
@@ -59,7 +68,6 @@ export class TransformHandler {
this.game.width() / 2 - this.offsetX * this.scale,
this.game.height() / 2 - this.offsetY * this.scale,
);
this.changed = false;
}
worldToScreenCoordinates(cell: Cell): { x: number; y: number } {