diff options
Diffstat (limited to 'main/draw.cpp')
-rw-r--r-- | main/draw.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/main/draw.cpp b/main/draw.cpp index 028f6ac6..e124389f 100644 --- a/main/draw.cpp +++ b/main/draw.cpp @@ -103,11 +103,13 @@ auto main_impl::get_draw_bounds() const noexcept -> draw_bounds y1 = std::max(y1, p.y); } - constexpr int16_t max = 7, min = -max; - x0 = std::clamp(x0, min, max); - x1 = std::clamp(x1, min, max); - y0 = std::clamp(y0, min, max); - y1 = std::clamp(y1, min, max); + constexpr int16_t maxx = tile_shader::max_screen_tiles.x()/2 - 1, minx = -maxx, + maxy = tile_shader::max_screen_tiles.y()/2 - 1, miny = -maxy; + + x0 = std::clamp(x0, minx, maxx); + x1 = std::clamp(x1, minx, maxx); + y0 = std::clamp(y0, miny, maxy); + y1 = std::clamp(y1, miny, maxy); return {x0, x1, y0, y1}; } |