diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/app.cpp | 2 | ||||
-rw-r--r-- | editor/app.hpp | 4 | ||||
-rw-r--r-- | editor/camera.cpp | 5 | ||||
-rw-r--r-- | editor/imgui-inspect.cpp | 6 | ||||
-rw-r--r-- | editor/imgui-misc.cpp | 6 | ||||
-rw-r--r-- | editor/update.cpp | 4 |
6 files changed, 19 insertions, 8 deletions
diff --git a/editor/app.cpp b/editor/app.cpp index 6186beb7..4293708d 100644 --- a/editor/app.cpp +++ b/editor/app.cpp @@ -30,7 +30,7 @@ app::app(fm_settings&& opts) : { reset_world(); auto& w = M->world(); - constexpr chunk_coords coord{0, 0}; + constexpr chunk_coords_ coord{0, 0, 0}; maybe_initialize_chunk_(coord, w[coord]); reset_camera_offset(); inspectors.reserve(16); diff --git a/editor/app.hpp b/editor/app.hpp index c5e9f67a..17dd80fe 100644 --- a/editor/app.hpp +++ b/editor/app.hpp @@ -73,8 +73,8 @@ private: void update_world(float dt); void update_cursor_tile(const Optional<Vector2i>& pixel); void set_cursor(); - void maybe_initialize_chunk(const chunk_coords& pos, chunk& c) override; - void maybe_initialize_chunk_(const chunk_coords& pos, chunk& c); + void maybe_initialize_chunk(const chunk_coords_& pos, chunk& c) override; + void maybe_initialize_chunk_(const chunk_coords_& pos, chunk& c); void update_character(float dt); void reset_world(); void reset_world(struct world&& w); diff --git a/editor/camera.cpp b/editor/camera.cpp index b43c7af8..f018ad8c 100644 --- a/editor/camera.cpp +++ b/editor/camera.cpp @@ -61,7 +61,10 @@ void app::update_cursor_tile(const Optional<Vector2i>& pixel) { cursor.pixel = pixel; if (pixel) - cursor.tile = M->pixel_to_tile(Vector2d{*pixel}); + { + auto coord = M->pixel_to_tile(Vector2d{*pixel}); + cursor.tile = {InPlaceInit, coord.chunk(), coord.local(), _z_level}; + } else cursor.tile = NullOpt; } diff --git a/editor/imgui-inspect.cpp b/editor/imgui-inspect.cpp index 534dd1cf..cb5b9ce7 100644 --- a/editor/imgui-inspect.cpp +++ b/editor/imgui-inspect.cpp @@ -33,6 +33,7 @@ void app::draw_inspector() auto& s = *e; chunk_coords ch = e->coord.chunk(); local_coords pos = e->coord.local(); + auto z = e->coord.z(); char buf[32]; snformat(buf, "inspector-{:08x}"_cf, s.id); @@ -40,7 +41,10 @@ void app::draw_inspector() auto b1 = push_id(buf); ImGui::SetNextWindowSize({300*dpi[0], 0}); auto name = loader.strip_prefix(s.atlas->name()); - snformat(buf, "{} ({}x{} -> {}x{})"_cf, name, ch.x, ch.y, (int)pos.x, (int)pos.y); + if (z == 0) + snformat(buf, "{} ({}x{} -> {}x{})"_cf, name, ch.x, ch.y, (int)pos.x, (int)pos.y); + else + snformat(buf, "{} ({}x{}:{} -> {}x{})"_cf, name, ch.x, ch.y, (int)z, (int)pos.x, (int)pos.y); bool is_open = true; if (s.type() == entity_type::scenery) diff --git a/editor/imgui-misc.cpp b/editor/imgui-misc.cpp index 84522f57..22fe3d2f 100644 --- a/editor/imgui-misc.cpp +++ b/editor/imgui-misc.cpp @@ -39,7 +39,11 @@ void app::draw_tile_under_cursor() const auto coord = *cursor.tile; const auto chunk = coord.chunk(); const auto local = coord.local(); - snformat(buf, "{}:{} - {}:{}"_cf, chunk.x, chunk.y, local.x, local.y); + const auto z = coord.z(); + if (z == 0) + snformat(buf, "{}x{} - {}:{}"_cf, chunk.x, chunk.y, local.x, local.y); + else + snformat(buf, "{}x{}:{} - {}:{}"_cf, chunk.x, chunk.y, (int)z, local.x, local.y); const auto size = ImGui::CalcTextSize(buf); const auto window_size = M->window_size(); diff --git a/editor/update.cpp b/editor/update.cpp index 97d77ffb..6bb1ff66 100644 --- a/editor/update.cpp +++ b/editor/update.cpp @@ -13,7 +13,7 @@ namespace floormat { //#define FM_NO_BINDINGS -void app::maybe_initialize_chunk_(const chunk_coords& pos, chunk& c) +void app::maybe_initialize_chunk_(const chunk_coords_& pos, chunk& c) { (void)pos; (void)c; @@ -39,7 +39,7 @@ void app::maybe_initialize_chunk_(const chunk_coords& pos, chunk& c) c.mark_modified(); } -void app::maybe_initialize_chunk([[maybe_unused]] const chunk_coords& pos, [[maybe_unused]] chunk& c) +void app::maybe_initialize_chunk([[maybe_unused]] const chunk_coords_& pos, [[maybe_unused]] chunk& c) { //maybe_initialize_chunk_(pos, c); } |