diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2023-05-18 16:26:01 +0200 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-05-18 16:26:01 +0200 |
| commit | ec7be88fbb4062af20b77198007d815c321c2850 (patch) | |
| tree | 85fbe24dc79d2e8072990939f1e7e8de97a84e84 /editor/editor.cpp | |
| parent | 44c8e45d71e5320aedaa5b4b839e636a0d973f7f (diff) | |
wip vobj
Diffstat (limited to 'editor/editor.cpp')
| -rw-r--r-- | editor/editor.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/editor/editor.cpp b/editor/editor.cpp index 99a3cf96..b744f03c 100644 --- a/editor/editor.cpp +++ b/editor/editor.cpp @@ -20,6 +20,8 @@ void editor::clear_selection() ed->clear_selection(); else if (auto* ed = current_scenery_editor()) ed->clear_selection(); + else if (auto* vo = current_vobj_editor()) + vo->clear_selection(); } auto editor::get_snap_value(snap_mode snap, int mods) const -> snap_mode @@ -115,6 +117,23 @@ void editor::on_click_(world& world, global_coords pos, button b) } } } + else if (auto* mode = current_vobj_editor()) + { + if (const auto* opt = mode->get_selected(); opt || b == button::remove) + { + switch (b) + { + default: break; + case button::place: + if (const auto& sel = mode->get_selected()) + mode->place_tile(world, pos, sel); + break; + case button::remove: + mode->place_tile(world, pos, {}); + break; + } + } + } on_release(); } @@ -161,6 +180,14 @@ const scenery_editor* editor::current_scenery_editor() const noexcept return nullptr; } +const vobj_editor* editor::current_vobj_editor() const noexcept +{ + if (_mode == editor_mode::vobj) + return &_vobj; + else + return nullptr; +} + tile_editor* editor::current_tile_editor() noexcept { return const_cast<tile_editor*>(static_cast<const editor&>(*this).current_tile_editor()); @@ -171,4 +198,9 @@ scenery_editor* editor::current_scenery_editor() noexcept return const_cast<scenery_editor*>(static_cast<const editor&>(*this).current_scenery_editor()); } +vobj_editor* editor::current_vobj_editor() noexcept +{ + return const_cast<vobj_editor*>(static_cast<const editor&>(*this).current_vobj_editor()); +} + } // namespace floormat |
