diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-18 03:00:56 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-18 03:00:56 +0200 |
commit | 1a95ead477a0bebbb7017b6b0423ce82cca3ea78 (patch) | |
tree | dbc6728ff50ec2721ea2f61a0f13e3252d3eb763 /main | |
parent | b7c90db8cc966ed7bff33fba1a49de2c384e5e38 (diff) |
a
Diffstat (limited to 'main')
-rw-r--r-- | main/camera.cpp | 4 | ||||
-rw-r--r-- | main/update.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/main/camera.cpp b/main/camera.cpp index b7e2b893..aa4cad00 100644 --- a/main/camera.cpp +++ b/main/camera.cpp @@ -53,7 +53,7 @@ void app::recalc_cursor_tile() global_coords app::pixel_to_tile(Vector2d position) const { - const Vector2d px = position - Vector2d{windowSize()}*.5 - _shader.camera_offset(); + const Vector2d px = position - Vector2d{windowSize()}*.5 - _shader.camera_offset()*.5; const Vector2d vec = tile_shader::unproject(px) / Vector2d{dTILE_SIZE[0]*.5, dTILE_SIZE[1]*.5} + Vector2d{.5, .5}; const auto x = (std::int32_t)std::floor(vec[0]), y = (std::int32_t)std::floor(vec[1]); return { x, y }; @@ -80,7 +80,7 @@ constexpr double ce_sqrt(double x) std::array<std::int16_t, 4> app::get_draw_bounds() const noexcept { const auto center = pixel_to_tile(Vector2d(windowSize()/2)).chunk(); - constexpr auto N = 3; + constexpr auto N = 1; return { std::int16_t(center.x - N), std::int16_t(center.x + N), diff --git a/main/update.cpp b/main/update.cpp index b1f6d945..9a65e182 100644 --- a/main/update.cpp +++ b/main/update.cpp @@ -6,7 +6,7 @@ void app::make_test_chunk(chunk& c) { constexpr auto N = TILE_MAX_DIM; for (auto [x, k, pt] : c) { - const auto& atlas = pt.x > N/2 && pt.y >= N/2 ? floor2 : floor1; + const auto& atlas = pt.x == N/2 || pt.y == N/2 ? floor2 : floor1; x.ground_image = { atlas, (std::uint8_t)(k % atlas->num_tiles().product()) }; } constexpr auto K = N/2; |