This commit is contained in:
Schluffe
2026-05-28 19:53:31 +02:00
parent 6a960d7785
commit f8efda0ada
5 changed files with 17 additions and 14 deletions
+7 -7
View File
@@ -8,7 +8,7 @@ export type Viewport = {
canvas: HTMLCanvasElement;
gameContainer: HTMLElement;
canvasContainer: HTMLElement;
bounds: {
boundaries: {
minX: number;
minY: number;
maxX: number;
@@ -27,7 +27,7 @@ export const viewport: Viewport = {
canvas: null as unknown as HTMLCanvasElement,
gameContainer: null as unknown as HTMLElement,
canvasContainer: null as unknown as HTMLElement,
bounds: {
boundaries: {
minX: 0,
minY: 0,
maxX: 0,
@@ -70,7 +70,7 @@ export function resizeCanvas(width: number, height: number): void {
canvasContainer,
gameContainer,
translation,
bounds,
boundaries,
} = viewport;
const containerWidth = (gameContainer.offsetWidth / scale) | 0;
@@ -87,10 +87,10 @@ export function resizeCanvas(width: number, height: number): void {
canvasContainer.style = `width: ${canvasWidth}px; height: ${canvasHeight}px;`;
bounds.minX = translation.x;
bounds.minY = translation.y;
bounds.maxX = translation.x + canvas.width;
bounds.maxY = translation.x + canvas.height;
boundaries.minX = translation.x;
boundaries.minY = translation.y;
boundaries.maxX = translation.x + canvas.width;
boundaries.maxY = translation.x + canvas.height;
}
export function resetCtx() {