From 2df079d68aca2b06fab4b24f678ea58b70a1c79d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 17 Oct 2022 19:07:41 +0200 Subject: a --- main/draw.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main/draw.cpp b/main/draw.cpp index 2de8ff73..9c13a12f 100644 --- a/main/draw.cpp +++ b/main/draw.cpp @@ -43,10 +43,12 @@ void app::drawEvent() { std::array app::get_draw_bounds() const noexcept { - std::int16_t minx = BASE_X, maxx = BASE_X, miny = BASE_Y, maxy = BASE_Y; + using limits = std::numeric_limits; + constexpr auto MIN = limits::min(), MAX = limits::max(); + std::int16_t minx = MAX, maxx = MIN, miny = MAX, maxy = MIN; { auto fn = [&](std::int32_t x, std::int32_t y) { - const auto pos = pixel_to_tile({float(x + BASE_X), float(y + BASE_Y)}).chunk(); + const auto pos = pixel_to_tile(Vector2(x, y)).chunk(); minx = std::min(minx, pos.x); maxx = std::max(maxx, pos.x); miny = std::min(miny, pos.y); @@ -59,7 +61,10 @@ std::array app::get_draw_bounds() const noexcept fn(0, y); fn(x, y); } - return {minx, maxx, miny, maxy}; + return { + std::int16_t(minx), std::int16_t(maxx), + std::int16_t(miny), std::int16_t(maxy), + }; } void app::draw_world() -- cgit v1.2.3