mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-15 20:03:15 +02:00
Added debug option to test touchscreen input on desktop systems
This commit is contained in:
@@ -49,6 +49,7 @@ void InputHandler::handleCurrentEvent(const SDL_Event & current)
|
||||
return keyboardHandler->handleEventKeyDown(current.key);
|
||||
case SDL_KEYUP:
|
||||
return keyboardHandler->handleEventKeyUp(current.key);
|
||||
#ifndef VCMI_EMULATE_TOUCHSCREEN_WITH_MOUSE
|
||||
case SDL_MOUSEMOTION:
|
||||
return mouseHandler->handleEventMouseMotion(current.motion);
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
@@ -57,6 +58,7 @@ void InputHandler::handleCurrentEvent(const SDL_Event & current)
|
||||
return mouseHandler->handleEventMouseButtonUp(current.button);
|
||||
case SDL_MOUSEWHEEL:
|
||||
return mouseHandler->handleEventMouseWheel(current.wheel);
|
||||
#endif
|
||||
case SDL_TEXTINPUT:
|
||||
return textHandler->handleEventTextInput(current.text);
|
||||
case SDL_TEXTEDITING:
|
||||
|
@@ -38,7 +38,11 @@ InputSourceTouch::InputSourceTouch()
|
||||
else
|
||||
state = TouchState::IDLE;
|
||||
|
||||
#ifdef VCMI_EMULATE_TOUCHSCREEN_WITH_MOUSE
|
||||
SDL_SetHint(SDL_HINT_MOUSE_TOUCH_EVENTS, "1");
|
||||
#else
|
||||
SDL_SetHint(SDL_HINT_MOUSE_TOUCH_EVENTS, "0");
|
||||
#endif
|
||||
SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");
|
||||
}
|
||||
|
||||
|
@@ -12,6 +12,9 @@
|
||||
|
||||
#include "../../lib/Point.h"
|
||||
|
||||
// Debug option. If defined, mouse events will instead generate touch events, allowing testing of touch input on desktop
|
||||
// #define VCMI_EMULATE_TOUCHSCREEN_WITH_MOUSE
|
||||
|
||||
enum class MouseButton;
|
||||
struct SDL_TouchFingerEvent;
|
||||
|
||||
@@ -33,7 +36,7 @@ enum class TouchState
|
||||
// DOWN -> transition to TAP_DOWN_DOUBLE
|
||||
// MOTION -> transition to TAP_DOWN_PANNING
|
||||
// UP -> transition to IDLE, emit onLeftClickDown and onLeftClickUp
|
||||
// on timer -> transition to TAP_DOWN_LONG, emit onRightClickDown event
|
||||
// on timer -> transition to TAP_DOWN_LONG, emit showPopup() event
|
||||
TAP_DOWN_SHORT,
|
||||
|
||||
// single finger is moving across screen
|
||||
@@ -57,17 +60,8 @@ enum class TouchState
|
||||
// right-click popup is active, waiting for new tap to hide popup
|
||||
// DOWN -> ignored
|
||||
// MOTION -> ignored
|
||||
// UP -> transition to IDLE, generate onRightClickUp() event
|
||||
// UP -> transition to IDLE, generate closePopup() event
|
||||
TAP_DOWN_LONG_AWAIT,
|
||||
|
||||
|
||||
// Possible transitions:
|
||||
// -> DOUBLE
|
||||
// -> PANNING -> IDLE
|
||||
// IDLE -> DOWN_SHORT -> IDLE
|
||||
// -> LONG -> IDLE
|
||||
// -> DOUBLE -> PANNING
|
||||
// -> IDLE
|
||||
};
|
||||
|
||||
struct TouchInputParameters
|
||||
|
Reference in New Issue
Block a user