From 2c698881d7fc515984d50c5c39239b48718258bc Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 18 Oct 2022 09:29:46 +0200 Subject: a --- main/camera.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'main/camera.cpp') diff --git a/main/camera.cpp b/main/camera.cpp index 9249bbb2..82d540a1 100644 --- a/main/camera.cpp +++ b/main/camera.cpp @@ -66,16 +66,15 @@ global_coords app::pixel_to_tile(Vector2d position) const std::array app::get_draw_bounds() const noexcept { - const auto win = Vector2d(windowSize()); - const auto p00 = pixel_to_tile(Vector2d{0, 0}).chunk(); - const auto p10 = pixel_to_tile(Vector2d{win[0]-1, 0}).chunk(); - const auto p01 = pixel_to_tile(Vector2d{0, win[1]-1}).chunk(); - const auto p11 = pixel_to_tile(Vector2d{win[0]-1, win[1]-1}).chunk(); using limits = std::numeric_limits; auto x0 = limits::max(), x1 = limits::min(), y0 = limits::max(), y1 = limits::min(); - for (auto p : { p00, p10, p01, p11 }) + for (const auto win = Vector2d(windowSize()); + auto p : {pixel_to_tile(Vector2d{0, 0}).chunk(), + pixel_to_tile(Vector2d{win[0]-1, 0}).chunk(), + pixel_to_tile(Vector2d{0, win[1]-1}).chunk(), + pixel_to_tile(Vector2d{win[0]-1, win[1]-1}).chunk()}) { x0 = std::min(x0, p.x); x1 = std::max(x1, p.x); -- cgit v1.2.3