diff options
| author | Aldrik Ramaekers <aldrik@amftech.nl> | 2023-11-04 14:49:55 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrik@amftech.nl> | 2023-11-04 14:49:55 +0100 |
| commit | 0c4d62413a747939dc16181addffb701aaf48b74 (patch) | |
| tree | 6d03f0271c7ebc67230caa5972d065834b2bbab2 /src/game.c | |
| parent | 9f57cd3ec64a3dc98d4ffe406f630963e82d6935 (diff) | |
fix aim
Diffstat (limited to 'src/game.c')
| -rw-r--r-- | src/game.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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; } |
