diff options
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 7 |
1 files changed, 7 insertions, 0 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; |
