diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.zig | 7 | ||||
| -rw-r--r-- | src/render.zig | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/main.zig b/src/main.zig index 781b9a7..6a10921 100644 --- a/src/main.zig +++ b/src/main.zig @@ -103,6 +103,10 @@ pub fn main() !void { window.setFramerateLimit(40); + // TODO: implement this in the SFML wrapper and make a PR + sf.c.sfRenderWindow_setMouseCursorGrabbed(window.ptr, 1); + sf.c.sfRenderWindow_setMouseCursorVisible(window.ptr, 0); + // Load the background skybox, really `skycylinder', and assign it to a // sprite -- it's set to repeating so that it goes on forever. We need to // scale the sprite so that drawing 1/4 of backTextureWidth fills the Screen @@ -153,6 +157,9 @@ pub fn main() !void { if (isKeyPressed(.C)) plyr.height -= 0.1; if (isKeyPressed(.V)) plyr.height += 0.1; + plyr.ang -= @intToFloat(f32, sf.window.mouse.getPosition(window).x) / constants.ScreenWidth - 0.5; + sf.window.mouse.setPosition(.{.x = constants.ScreenWidth / 2, .y = 0}, window); + const rotation = 2.0 * PI / 200.0; if (isKeyPressed(.Left)) plyr.ang += rotation; if (isKeyPressed(.Right)) plyr.ang -= rotation; diff --git a/src/render.zig b/src/render.zig index f2f06ae..49595dd 100644 --- a/src/render.zig +++ b/src/render.zig @@ -321,7 +321,7 @@ pub fn Renderer(PlaneWidth: f32, PlaneHeight: f32) type { const should_try_to_draw_layer = switch (layer.polygon) { .square => hit: { // we have to compute texture_frac by hand. - var texfrac : f32 = undefined; + var texfrac: f32 = undefined; // Using the notation in the below diagram, // we want face_i to have [0.25i, 0.25(i+1)] // of the texture. |
