diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-23 22:38:54 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-23 22:38:54 +0200 |
commit | 0efe01d0e7286e9eb60c4739ae748c0cb6e7a51f (patch) | |
tree | 09121d7fcbb17151ea10331bfb3de0474fe6a661 /editor/update.cpp | |
parent | b6a067678ab9e225647b256595d54dde2ce6f2f5 (diff) |
a
Diffstat (limited to 'editor/update.cpp')
-rw-r--r-- | editor/update.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/editor/update.cpp b/editor/update.cpp index ebd1881b..b20e0728 100644 --- a/editor/update.cpp +++ b/editor/update.cpp @@ -1,4 +1,6 @@ #include "app.hpp" +#include "src/chunk.hpp" +#include "src/tile-atlas.hpp" namespace floormat { @@ -11,7 +13,7 @@ void app::make_test_chunk(chunk& c) #if defined FM_NO_BINDINGS const auto& atlas = floor1; #else - const auto& atlas = pt.x != pt.y && (pt.x == N/2 || pt.y == N/2) ? floor2 : floor1; + const auto& atlas = pt.x == N/2 || pt.y == N/2 ? _floor2 : _floor1; #endif x.ground_image = { atlas, k % atlas->num_tiles() }; } @@ -19,15 +21,15 @@ void app::make_test_chunk(chunk& c) const auto& wall1 = floor1, wall2 = floor1; #endif constexpr auto K = N/2; - c[{K, K }].wall_north = { wall1, 0 }; - c[{K, K }].wall_west = { wall2, 0 }; - c[{K, K+1}].wall_north = { wall1, 0 }; - c[{K+1, K }].wall_west = { wall2, 0 }; + c[{K, K }].wall_north = { _wall1, 0 }; + c[{K, K }].wall_west = { _wall2, 0 }; + c[{K, K+1}].wall_north = { _wall1, 0 }; + c[{K+1, K }].wall_west = { _wall2, 0 }; } void app::do_mouse_click(const global_coords pos, int button) { - if (button == SDL_BUTTON_LEFT) + if (button == mouse_button_event) _editor.on_click(_world, pos); else _editor.on_release(); @@ -44,7 +46,7 @@ void app::do_mouse_move(global_coords pos) _editor.on_mouse_move(_world, pos); } -void app::update(double dt) +void app::update(float dt) { do_camera(dt); draw_ui(); |