diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-18 09:29:46 +0200 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-18 09:29:46 +0200 |
| commit | 2c698881d7fc515984d50c5c39239b48718258bc (patch) | |
| tree | f55247795a6381ee207c650e476498d5d214c47c | |
| parent | 247e43df1afc2f0e1b9b77363e0a029b14033ae7 (diff) | |
a
| -rw-r--r-- | main/camera.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
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<std::int16_t, 4> 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<std::int16_t>; 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); |
