From de255063b234871021da004d32964e25d549d3e4 Mon Sep 17 00:00:00 2001 From: tslil clingman <> Date: Wed, 1 Sep 2021 15:48:09 -0400 Subject: Scale the projection plane to the screen correctly Also bumped up the textures to 32x32 --- src/main.zig | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/main.zig') diff --git a/src/main.zig b/src/main.zig index 64da425..aef559f 100644 --- a/src/main.zig +++ b/src/main.zig @@ -28,9 +28,6 @@ usingnamespace @import("raycast.zig"); usingnamespace @import("renderConstants.zig"); usingnamespace @import("map.zig"); -const screenWidth = 1280; -const screenHeight = 960; - // TODO: is there anyway i can say fn renderWall : RenderWallFunction? fn renderWall( window: sf.graphics.RenderWindow, @@ -116,7 +113,7 @@ pub fn main() !void { var backSprite = try sf.Sprite.createFromTexture(backTexture); defer backSprite.destroy(); - backSprite.setScale(.{ .x = 4.0 * @intToFloat(f32, screenWidth) / backTextureWidth, .y = @intToFloat(f32, screenHeight) / (2 * backTextureHeight) }); + backSprite.setScale(.{ .x = 4.0 * screenWidth / backTextureWidth, .y = screenHeight / (2 * backTextureHeight) }); // Load brick texture! var wallTexture = try sf.Texture.createFromFile("walls.png"); -- cgit v1.3.1