diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/events.cpp | 4 | ||||
-rw-r--r-- | main/floormat-app.hpp | 12 | ||||
-rw-r--r-- | main/floormat-events.cpp | 60 | ||||
-rw-r--r-- | main/floormat-main-impl.hpp | 2 |
4 files changed, 35 insertions, 43 deletions
diff --git a/main/events.cpp b/main/events.cpp index 242e890e..8ab3d997 100644 --- a/main/events.cpp +++ b/main/events.cpp @@ -30,7 +30,6 @@ void main_impl::mouseReleaseEvent(Platform::Sdl2Application::MouseEvent& event) return event.setAccepted(); do_mouse_release((int)event.button()); } -#endif void main_impl::mouseMoveEvent(Platform::Sdl2Application::MouseMoveEvent& event) { @@ -44,7 +43,6 @@ void main_impl::mouseMoveEvent(Platform::Sdl2Application::MouseMoveEvent& event) do_mouse_move(*_cursor_tile); } -#if 0 void main_impl::mouseScrollEvent(Platform::Sdl2Application::MouseScrollEvent& event) { if (_imgui.handleMouseScrollEvent(event)) @@ -97,7 +95,6 @@ void main_impl::anyEvent(SDL_Event& event) std::fputs("", stdout); break; // put breakpoint here } } -#endif void main_impl::event_focus_out() // TODO move to app { @@ -110,5 +107,6 @@ void main_impl::event_mouse_leave() // TODO move to app _cursor_pixel = std::nullopt; recalc_cursor_tile(); } +#endif } // namespace floormat diff --git a/main/floormat-app.hpp b/main/floormat-app.hpp index f4f7cc25..e4bf2cae 100644 --- a/main/floormat-app.hpp +++ b/main/floormat-app.hpp @@ -25,12 +25,12 @@ struct floormat_app virtual void draw_msaa(); virtual void draw() = 0; - virtual bool on_mouse_move(const mouse_move_event& event) noexcept = 0; - virtual bool on_mouse_up_down(const mouse_button_event& event, bool is_down) noexcept = 0; - virtual bool on_mouse_scroll(const mouse_scroll_event& event) noexcept = 0; - virtual bool on_key_up_down(const key_event& event, bool is_down) noexcept = 0; - virtual bool on_text_input_event(const text_input_event& event) noexcept = 0; - virtual bool on_text_editing_event(const text_editing_event& event) noexcept = 0; + virtual void on_mouse_move(const mouse_move_event& event) noexcept = 0; + virtual void on_mouse_up_down(const mouse_button_event& event, bool is_down) noexcept = 0; + virtual void on_mouse_scroll(const mouse_scroll_event& event) noexcept = 0; + virtual void on_key_up_down(const key_event& event, bool is_down) noexcept = 0; + virtual void on_text_input_event(const text_input_event& event) noexcept = 0; + //virtual bool on_text_editing_event(const text_editing_event& event) noexcept = 0; virtual void on_viewport_event(const Magnum::Math::Vector2<int>& size) noexcept = 0; virtual void on_any_event(const any_event& event) noexcept = 0; virtual void on_focus_in() noexcept = 0; diff --git a/main/floormat-events.cpp b/main/floormat-events.cpp index 9091e663..62409d35 100644 --- a/main/floormat-events.cpp +++ b/main/floormat-events.cpp @@ -17,67 +17,61 @@ void main_impl::viewportEvent(Platform::Sdl2Application::ViewportEvent& event) void main_impl::mousePressEvent(Platform::Sdl2Application::MouseEvent& event) { - if (app.on_mouse_up_down({event.position(), - (SDL_Keymod)(std::uint16_t)event.modifiers(), - mouse_button(event.button()), - std::uint8_t(std::min(255, event.clickCount()))}, - true)) - return event.setAccepted(); + app.on_mouse_up_down({event.position(), + (SDL_Keymod)(std::uint16_t)event.modifiers(), + mouse_button(event.button()), + std::uint8_t(std::min(255, event.clickCount()))}, + true); } void main_impl::mouseReleaseEvent(Platform::Sdl2Application::MouseEvent& event) { - if (app.on_mouse_up_down({event.position(), - (SDL_Keymod)(std::uint16_t)event.modifiers(), - mouse_button(event.button()), - std::uint8_t(std::min(255, event.clickCount()))}, - false)) - return event.setAccepted(); + app.on_mouse_up_down({event.position(), + (SDL_Keymod)(std::uint16_t)event.modifiers(), + mouse_button(event.button()), + std::uint8_t(std::min(255, event.clickCount()))}, + false); } void main_impl::mouseMoveEvent(Platform::Sdl2Application::MouseMoveEvent& event) { - if (app.on_mouse_move({event.position(), event.relativePosition(), - (mouse_button)(std::uint8_t)(std::uint32_t)event.buttons(), - (SDL_Keymod)(std::uint16_t)event.modifiers()})) - return event.setAccepted(); + app.on_mouse_move({event.position(), event.relativePosition(), + (mouse_button)(std::uint8_t)(std::uint32_t)event.buttons(), + (SDL_Keymod)(std::uint16_t)event.modifiers()}); } void main_impl::mouseScrollEvent(Platform::Sdl2Application::MouseScrollEvent& event) { - if (app.on_mouse_scroll(mouse_scroll_event{event.offset(), event.position(), - (SDL_Keymod)(std::uint16_t)event.modifiers()})) - return event.setAccepted(); + app.on_mouse_scroll({event.offset(), event.position(), + (SDL_Keymod)(std::uint16_t)event.modifiers()}); } void main_impl::textInputEvent(Platform::Sdl2Application::TextInputEvent& event) { - if (app.on_text_input_event({event.text()})) - return event.setAccepted(); + app.on_text_input_event({event.text()}); } +#if 0 void main_impl::textEditingEvent(Platform::Sdl2Application::TextEditingEvent& event) { - if (app.on_text_editing_event({event.text(), event.start(), event.length()})) - return event.setAccepted(); + app.on_text_editing_event({event.text(), event.start(), event.length()}) } +#endif void main_impl::keyPressEvent(Platform::Sdl2Application::KeyEvent& event) { - if (app.on_key_up_down({(SDL_Keycode)(std::uint32_t)event.key(), - (SDL_Keymod)(std::uint16_t)event.modifiers(), - event.isRepeated()}, - true)) - return event.setAccepted(); + app.on_key_up_down({(SDL_Keycode)(std::uint32_t)event.key(), + (SDL_Keymod)(std::uint16_t)event.modifiers(), + event.isRepeated()}, + true) } void main_impl::keyReleaseEvent(Platform::Sdl2Application::KeyEvent& event) { - if (app.on_key_up_down({(SDL_Keycode)(std::uint32_t)event.key(), - (SDL_Keymod)(std::uint16_t)event.modifiers(), - event.isRepeated()}, - false)) - return event.setAccepted(); + app.on_key_up_down({(SDL_Keycode)(std::uint32_t)event.key(), + (SDL_Keymod)(std::uint16_t)event.modifiers(), + event.isRepeated()}, + false) } void main_impl::anyEvent(SDL_Event& event) diff --git a/main/floormat-main-impl.hpp b/main/floormat-main-impl.hpp index 4ab6ef27..a952cdda 100644 --- a/main/floormat-main-impl.hpp +++ b/main/floormat-main-impl.hpp @@ -38,7 +38,7 @@ struct main_impl final : Platform::Sdl2Application, floormat_main [[maybe_unused]] void mouseMoveEvent(MouseMoveEvent& event) override; [[maybe_unused]] void mouseScrollEvent(MouseScrollEvent& event) override; [[maybe_unused]] void textInputEvent(TextInputEvent& event) override; - [[maybe_unused]] void textEditingEvent(TextEditingEvent& event) override; + //[[maybe_unused]] void textEditingEvent(TextEditingEvent& event) override; [[maybe_unused]] void keyPressEvent(KeyEvent& event) override; [[maybe_unused]] void keyReleaseEvent(KeyEvent& event) override; [[maybe_unused]] void anyEvent(SDL_Event& event) override; |