mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-13 19:49:36 +00:00
Touchscreen improvements
This commit is contained in:
@@ -679,6 +679,11 @@ DrawSurface *Window::GetDrawSurface() const
|
||||
return const_cast<DrawSurface*>(&m_surface);
|
||||
}
|
||||
|
||||
Point Window::TouchToLocal(const GpTouchInputEvent &evt) const
|
||||
{
|
||||
return Point::Create(evt.m_x - m_wmX, evt.m_y - m_wmY);
|
||||
}
|
||||
|
||||
Point Window::MouseToLocal(const GpMouseInputEvent &evt) const
|
||||
{
|
||||
return Point::Create(evt.m_x - m_wmX, evt.m_y - m_wmY);
|
||||
|
||||
@@ -19,6 +19,7 @@ struct IGpCursor;
|
||||
class GpIOStream;
|
||||
struct GpVOSEvent;
|
||||
struct GpMouseInputEvent;
|
||||
struct GpTouchInputEvent;
|
||||
struct TimeTaggedVOSEvent;
|
||||
|
||||
|
||||
@@ -95,6 +96,8 @@ struct Window
|
||||
// Convenience method to convert a mouse event to local point
|
||||
Point MouseToLocal(const GpMouseInputEvent &evt) const;
|
||||
|
||||
Point TouchToLocal(const GpTouchInputEvent &evt) const;
|
||||
|
||||
// Convenience method that returns a 16-bit precision X/Y
|
||||
Point GetTopLeftCoord() const;
|
||||
|
||||
|
||||
@@ -42,6 +42,12 @@ static void TranslateMouseInputEvent(const GpVOSEvent &vosEventBase, uint32_t ti
|
||||
inputManager->ApplyMouseEvent(vosEvent);
|
||||
}
|
||||
|
||||
static void TranslateTouchInputEvent(const GpVOSEvent &vosEventBase, uint32_t timestamp, PortabilityLayer::EventQueue *queue)
|
||||
{
|
||||
if (TimeTaggedVOSEvent *evt = queue->Enqueue())
|
||||
*evt = TimeTaggedVOSEvent::Create(vosEventBase, timestamp);
|
||||
}
|
||||
|
||||
static void TranslateGamepadInputEvent(const GpGamepadInputEvent &vosEvent, PortabilityLayer::EventQueue *queue)
|
||||
{
|
||||
PortabilityLayer::InputManager *inputManager = PortabilityLayer::InputManager::GetInstance();
|
||||
@@ -127,6 +133,9 @@ static void TranslateVOSEvent(const GpVOSEvent *vosEvent, uint32_t timestamp, Po
|
||||
case GpVOSEventTypes::kMouseInput:
|
||||
TranslateMouseInputEvent(*vosEvent, timestamp, queue);
|
||||
break;
|
||||
case GpVOSEventTypes::kTouchInput:
|
||||
TranslateTouchInputEvent(*vosEvent, timestamp, queue);
|
||||
break;
|
||||
case GpVOSEventTypes::kKeyboardInput:
|
||||
TranslateKeyboardInputEvent(*vosEvent, timestamp, queue);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user