aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authortslil clingman <>2021-09-01 15:48:09 -0400
committertslil clingman <>2021-09-01 15:54:03 -0400
commitde255063b234871021da004d32964e25d549d3e4 (patch)
tree5d687c07ad9cefd1574aacec31ab2b3019837b65 /src/main.zig
parentc97c9fc4203dc12982b590d3bfae1d419cf59fbe (diff)
Scale the projection plane to the screen correctly
Also bumped up the textures to 32x32
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig5
1 files changed, 1 insertions, 4 deletions
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");