From 7ac2c5340763e2d2b86964168f5e6ab4690ae4a6 Mon Sep 17 00:00:00 2001 From: NuclearRedeye Date: Tue, 2 Apr 2024 22:30:35 +0100 Subject: [PATCH] fix: formatting issues --- src/ts/data/levels/level00.ts | 2 +- src/ts/raycaster.ts | 4 ++-- src/ts/utils/canvas-utils.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ts/data/levels/level00.ts b/src/ts/data/levels/level00.ts index d1b81a2..b712d4f 100644 --- a/src/ts/data/levels/level00.ts +++ b/src/ts/data/levels/level00.ts @@ -33,7 +33,7 @@ export const level00: Level = { [i(2), i(2), sw(5), i(2), i(2), i(2), i(2), i(2), i(2), i(2)], [i(2), sf(2), sf(2), sf(2), sf(2), sf(2), sf(2), sf(2), sf(2), i(2)], [i(2), sf(2), sf(2), sf(5), sf(5), sf(2), sf(2), sf(2), st([4, 1, 1, 1, 1, 1]), i(2)], - [i(2), f([2, 2, 2, 2, 6, 7]), sf(2), sf(5), sf(5), sw(2), d(2,10), sw(2), sf(2), i(2)], + [i(2), f([2, 2, 2, 2, 6, 7]), sf(2), sf(5), sf(5), sw(2), d(2, 10), sw(2), sf(2), i(2)], [i(2), sf(2), sf(2), sf(2), sf(2), sf(2), sf(2), sf(2), sf(2), i(2)], [sw(2), sf(2), sf(2), sf(2), sf(2), sf(2), sf(2), sf(2), sf(2), sw(2)], [ssc(10), sf(2), sf(2), w([6, 7, 8, 9, 2, 2]), sf(2), sf(2), sf(2), w([2, 5, 2, 5, 2, 2]), sf(2), sw(2)], diff --git a/src/ts/raycaster.ts b/src/ts/raycaster.ts index 1c7eb15..3fa4b2f 100644 --- a/src/ts/raycaster.ts +++ b/src/ts/raycaster.ts @@ -423,7 +423,7 @@ export function renderSprite(context: CanvasRenderingContext2D, entity: Entity, } const textureCroppedWidth = (clipRectangle.width / destinationRectangle.width) * texture.width; - const textureCroppedX = (clipRectangle.x > destinationRectangle.x) ? texture.width - textureCroppedWidth : 0; + const textureCroppedX = clipRectangle.x > destinationRectangle.x ? texture.width - textureCroppedWidth : 0; // The slice of the texture that we want to render to the framebuffer. const sourceRectangle: Rectangle = { @@ -447,7 +447,7 @@ export function renderSprite(context: CanvasRenderingContext2D, entity: Entity, // If 'debug' is on, draw some additional borders. if (debug) { drawBorderRectangle(context, destinationRectangle); - drawBorderRectangle(context, clipRectangle, "green"); + drawBorderRectangle(context, clipRectangle, 'green'); } } diff --git a/src/ts/utils/canvas-utils.ts b/src/ts/utils/canvas-utils.ts index ff5f957..f56d9a4 100644 --- a/src/ts/utils/canvas-utils.ts +++ b/src/ts/utils/canvas-utils.ts @@ -45,10 +45,10 @@ export function drawSkybox(context: CanvasRenderingContext2D, start: Point, end: context.drawImage(texture.canvas as HTMLCanvasElement, texturePositionX, 0, 1, (wallHeight / context.canvas.height) * texture.height, start.x, start.y, 1, wallHeight); } -export function drawBorderRectangle(context: CanvasRenderingContext2D, destination: Rectangle, colour: string = "white") { +export function drawBorderRectangle(context: CanvasRenderingContext2D, destination: Rectangle, colour: string = 'white') { context.save(); context.strokeStyle = colour; context.lineWidth = 1; context.strokeRect(destination.x, destination.y, destination.width, destination.height); context.restore(); -} \ No newline at end of file +}