summaryrefslogtreecommitdiffhomepage
path: root/editor/update.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-26 16:11:47 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-26 16:11:47 +0200
commit1649e034b553022a95f4e347b863aa2823bbdf12 (patch)
tree68db83c3eb95742418b906e819afa4da1ebef641 /editor/update.cpp
parent6029b7938aa3cf6be507ef58ca35c0bca24b8596 (diff)
refactor how cursor.in_imgui is handled
Diffstat (limited to 'editor/update.cpp')
-rw-r--r--editor/update.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/editor/update.cpp b/editor/update.cpp
index 7e72de5e..28c2ffd3 100644
--- a/editor/update.cpp
+++ b/editor/update.cpp
@@ -35,9 +35,23 @@ void app::maybe_initialize_chunk([[maybe_unused]] const chunk_coords& pos, [[may
//maybe_initialize_chunk_(pos, c);
}
-void app::do_mouse_move(global_coords pos)
+void app::do_mouse_move()
{
- _editor.on_mouse_move(M->world(), pos);
+ if (cursor.tile && !cursor.in_imgui)
+ _editor.on_mouse_move(M->world(), *cursor.tile);
+}
+
+void app::do_mouse_up_down(std::uint8_t button, bool is_down)
+{
+ if (!cursor.in_imgui && button == mouse_button_left && is_down)
+ _editor.on_click(M->world(), *cursor.tile);
+ else
+ _editor.on_release();
+}
+
+void app::do_keys()
+{
+
}
void app::update(float dt)
@@ -46,6 +60,8 @@ void app::update(float dt)
draw_ui();
if (keys[key::quit])
M->quit(0);
+ if (!keys.any())
+ do_keys();
}
} // namespace floormat