diff options
| author | tslil clingman <> | 2021-09-01 15:48:09 -0400 |
|---|---|---|
| committer | tslil clingman <> | 2021-09-01 15:54:03 -0400 |
| commit | de255063b234871021da004d32964e25d549d3e4 (patch) | |
| tree | 5d687c07ad9cefd1574aacec31ab2b3019837b65 /src/raycast.zig | |
| parent | c97c9fc4203dc12982b590d3bfae1d419cf59fbe (diff) | |
Scale the projection plane to the screen correctly
Also bumped up the textures to 32x32
Diffstat (limited to 'src/raycast.zig')
| -rw-r--r-- | src/raycast.zig | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/raycast.zig b/src/raycast.zig index 6acc16b..608bb10 100644 --- a/src/raycast.zig +++ b/src/raycast.zig @@ -84,11 +84,15 @@ pub const Player = struct { pub fn renderMapUsing( self: Player, window: RenderWindow, - sprite: Sprite, + wallSprite: Sprite, map: Map, // the abstract the rendering call renderWall: RenderWallFunction, ) void { + self.renderWalls(window, wallSprite, map, renderWall); + } + + fn renderWalls(self: Player, window: RenderWindow, wallSprite: Sprite, map: Map, renderWall: RenderWallFunction) void { const floor = std.math.floor; var col: i32 = 0; @@ -183,7 +187,7 @@ pub const Player = struct { // textures, in this case clockwise if ((horizontal_hit and sinra < 0) or (!horizontal_hit and cosra > 0)) texfrac = 1 - texfrac; - renderWall(window, sprite, col, top, total_length, draw_frac, texfrac, cell.wall_texture); + renderWall(window, wallSprite, col, top, total_length, draw_frac, texfrac, cell.wall_texture); highest_point = top; } |
