66#include " touch_input.hpp"
77
88#include < cmath>
9- #include < memory>
109#include < core/helper/spdlog_wrapper.hpp>
10+ #include < memory>
1111#include < stdexcept>
1212
1313void input::TouchGameInput::handle_event (const SDL_Event& event) {
@@ -213,7 +213,8 @@ input::TouchInput::get_by_device_index(const std::shared_ptr<Window>& window, in
213213}
214214
215215
216- [[nodiscard]] std::optional<input::NavigationEvent> input::TouchInput::get_navigation_event (const SDL_Event& event
216+ [[nodiscard]] std::optional<input::NavigationEvent> input::TouchInput::get_navigation_event (
217+ const SDL_Event& event
217218) const {
218219 // technically no touch event, but it's a navigation event, and by APi design it can also handle those
219220 if (event.type == SDL_KEYDOWN and event.key .keysym .sym == SDLK_AC_BACK) {
@@ -239,7 +240,8 @@ input::TouchInput::get_by_device_index(const std::shared_ptr<Window>& window, in
239240 }
240241}
241242
242- [[nodiscard]] std::optional<input::PointerEventHelper> input::TouchInput::get_pointer_event (const SDL_Event& event
243+ [[nodiscard]] std::optional<input::PointerEventHelper> input::TouchInput::get_pointer_event (
244+ const SDL_Event& event
243245) const {
244246
245247 auto pointer_event = input::PointerEvent::PointerUp;
@@ -276,8 +278,8 @@ input::TouchInput::get_by_device_index(const std::shared_ptr<Window>& window, in
276278}
277279
278280
279- [[nodiscard]] SDL_Event input::TouchInput::offset_pointer_event ( const SDL_Event& event, const shapes::IPoint& point)
280- const {
281+ [[nodiscard]] SDL_Event
282+ input::TouchInput::offset_pointer_event ( const SDL_Event& event, const shapes::IPoint& point) const {
281283
282284
283285 auto new_event = event;
@@ -316,6 +318,13 @@ input::TouchInput::get_by_device_index(const std::shared_ptr<Window>& window, in
316318 return {};
317319}
318320
321+ input::TouchSettings input::TouchSettings::default_settings () {
322+ return TouchSettings{ .move_x_threshold = 150.0 / 2160.0 ,
323+ .move_y_threshold = 400.0 / 1080.0 ,
324+ .rotation_duration_threshold = 500 ,
325+ .drop_duration_threshold = 200 };
326+ }
327+
319328
320329void input::TouchInputManager::discover_devices (
321330 std::vector<std::unique_ptr<Input>>& inputs,
0 commit comments