summaryrefslogtreecommitdiffhomepage
path: root/main/app.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-21 14:20:49 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-21 14:20:49 +0200
commit33530af5f134ea91a24a0dc3333765dbd891f01a (patch)
treed9b0516e961c0ffbff9d64972d29d87006091117 /main/app.cpp
parent41c9dcd43bc3b2d2508dff46e58cb2b91db2ef65 (diff)
tile placement wip
Diffstat (limited to 'main/app.cpp')
-rw-r--r--main/app.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/main/app.cpp b/main/app.cpp
index 42246bbd..07271e27 100644
--- a/main/app.cpp
+++ b/main/app.cpp
@@ -102,22 +102,20 @@ void app::mousePressEvent(Platform::Sdl2Application::MouseEvent& event)
{
if (_imgui.handleMousePressEvent(event))
return event.setAccepted();
+ else if (_cursor_tile)
{
- if (_cursor_tile)
+ const auto& tile = *_cursor_tile;
+ int button;
+ switch (event.button())
{
- const auto& tile = *_cursor_tile;
- int button;
- switch (event.button())
- {
- case MouseEvent::Button::Left: button = 0; break;
- case MouseEvent::Button::Right: button = 1; break;
- case MouseEvent::Button::Middle: button = 2; break;
- case MouseEvent::Button::X1: button = 5; break;
- case MouseEvent::Button::X2: button = 6; break;
- default: button = -1; break;
- }
- do_mouse_click(tile, button);
+ case MouseEvent::Button::Left: button = 0; break;
+ case MouseEvent::Button::Right: button = 1; break;
+ case MouseEvent::Button::Middle: button = 2; break;
+ case MouseEvent::Button::X1: button = 5; break;
+ case MouseEvent::Button::X2: button = 6; break;
+ default: button = -1; break;
}
+ do_mouse_click(tile, button);
}
}