diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-16 23:15:43 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-16 23:15:43 +0200 |
commit | 69aaa0205ae096654015924c75fdf43fbe16f768 (patch) | |
tree | 4acb91644767af685bfc965421e940805d336685 /main/camera.cpp | |
parent | 98e9636d33f5c6101888609a2d2193cee4fd6c64 (diff) |
a
Diffstat (limited to 'main/camera.cpp')
-rw-r--r-- | main/camera.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/main/camera.cpp b/main/camera.cpp index bfbf6aa5..b0b8f001 100644 --- a/main/camera.cpp +++ b/main/camera.cpp @@ -15,6 +15,11 @@ void app::do_camera(float dt) else if (keys[key::camera_right]) camera_offset += Vector2(-1, 0) * dt * pixels_per_second; + { + const auto max_camera_offset = Vector2(windowSize() * 10); + camera_offset[0] = std::clamp(camera_offset[0], -max_camera_offset[0], max_camera_offset[0]); + camera_offset[1] = std::clamp(camera_offset[1], -max_camera_offset[1], max_camera_offset[1]); + } _shader.set_camera_offset(camera_offset); if (keys[key::camera_reset]) |