From 0c4d62413a747939dc16181addffb701aaf48b74 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sat, 4 Nov 2023 14:49:55 +0100 Subject: fix aim --- src/game.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/game.c') diff --git a/src/game.c b/src/game.c index 90ce7a5..2222b86 100644 --- a/src/game.c +++ b/src/game.c @@ -337,6 +337,7 @@ void update_client(platform_window* window) { } static void move_camera(platform_window* window) { + static camera _camera_buffer; float speedx = window->width / 1000.0f; float diffx = (_next_camera_pos.x - _global_camera.x); if (abs(diffx) <= speedx) diffx = 0.0f; @@ -353,8 +354,10 @@ static void move_camera(platform_window* window) { float dirx = diffx/length; float diry = diffy/length; - _global_camera.x += dirx*speedx; - _global_camera.y += diry*speedy; + _camera_buffer.x += dirx*speedx; + _camera_buffer.y += diry*speedy; + _global_camera.x = (int)_camera_buffer.x; + _global_camera.y = (int)_camera_buffer.y; //_global_camera.x = _next_camera_pos.x; //_global_camera.y = _next_camera_pos.y; } -- cgit v1.2.3-70-g09d2