WIP
This commit is contained in:
+7
-7
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user