diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-24 12:05:40 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-24 12:05:40 +0200 |
commit | 5385be91cf40b9e610f3c7c9488023b925b563e1 (patch) | |
tree | 0ab01c932e1a80ad002d4e109ed448aa28663d20 /main/events.cpp | |
parent | 2b5e90cfb9c256ae26d9a970a7ff24c9dc0c2bf1 (diff) |
a
Diffstat (limited to 'main/events.cpp')
-rw-r--r-- | main/events.cpp | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/main/events.cpp b/main/events.cpp deleted file mode 100644 index ef1d4ead..00000000 --- a/main/events.cpp +++ /dev/null @@ -1,111 +0,0 @@ -#include "floormat-main.hpp" -#include <cstdio> -#include <SDL_events.h> -#include <SDL_video.h> - -namespace floormat { - -#if 0 -void main_impl::viewportEvent(Platform::Sdl2Application::ViewportEvent& event) -{ - fm_assert(event.framebufferSize() == event.windowSize()); - recalc_viewport(event.windowSize()); -} - -void main_impl::mousePressEvent(Platform::Sdl2Application::MouseEvent& event) -{ - if (_imgui.handleMousePressEvent(event)) - return event.setAccepted(); - else if (_cursor_tile) - { - const auto& tile = *_cursor_tile; - do_mouse_click(tile, (int)event.button()); - } -} - -void main_impl::mouseReleaseEvent(Platform::Sdl2Application::MouseEvent& event) -{ - if (_imgui.handleMouseReleaseEvent(event)) - return event.setAccepted(); - do_mouse_release((int)event.button()); -} - -void main_impl::mouseMoveEvent(Platform::Sdl2Application::MouseMoveEvent& event) -{ - _cursor_in_imgui = _imgui.handleMouseMoveEvent(event); - if (_cursor_in_imgui) - _cursor_pixel = std::nullopt; - else - _cursor_pixel = event.position(); - recalc_cursor_tile(); - if (_cursor_tile) - do_mouse_move(*_cursor_tile); -} - -void main_impl::mouseScrollEvent(Platform::Sdl2Application::MouseScrollEvent& event) -{ - if (_imgui.handleMouseScrollEvent(event)) - return event.setAccepted(); -} - -void main_impl::textInputEvent(Platform::Sdl2Application::TextInputEvent& event) -{ - if (_imgui.handleTextInputEvent(event)) - { - keys = {}; - event.setAccepted(); - } -} - -void main_impl::keyPressEvent(Platform::Sdl2Application::KeyEvent& event) -{ - if (_imgui.handleKeyPressEvent(event)) - { - keys = {}; - return event.setAccepted(); - } - do_key(event.key(), event.modifiers(), true, event.isRepeated()); -} - -void main_impl::keyReleaseEvent(Platform::Sdl2Application::KeyEvent& event) -{ - if (_imgui.handleKeyReleaseEvent(event)) - { - keys = {}; - return event.setAccepted(); - } - do_key(event.key(), event.modifiers(), false, false); -} - -void main_impl::anyEvent(SDL_Event& event) -{ - if (event.type == SDL_WINDOWEVENT) - switch (event.window.event) - { - case SDL_WINDOWEVENT_FOCUS_LOST: - return event_focus_out(); - case SDL_WINDOWEVENT_FOCUS_GAINED: - return event_focus_in(); - case SDL_WINDOWEVENT_LEAVE: - return event_mouse_leave(); - case SDL_WINDOWEVENT_ENTER: - return event_mouse_enter(); - default: - std::fputs("", stdout); break; // put breakpoint here - } -} - -void main_impl::event_focus_out() // TODO move to app -{ - _cursor_pixel = std::nullopt; - recalc_cursor_tile(); -} - -void main_impl::event_mouse_leave() // TODO move to app -{ - _cursor_pixel = std::nullopt; - recalc_cursor_tile(); -} -#endif - -} // namespace floormat |