Advantages of touch events

Hi,

I am porting my game from PC/Mac to iOS using SDL2 and though I will have to add explicit support for touch/finger events but everything seems to work (more or less) OK with just usual mouse move / button press events. What would be additional advantages of touch events? I don’t need pressure value only “clicks”.

Touch events are useful for recognising gestures, for example: pinch zoom,
where the player uses two fingers in pinch like motion for zoom in/out.On Tue, Sep 17, 2013 at 2:04 PM, slimshader <szymon.gatner at gmail.com> wrote:

**
Hi,

I am porting my game from PC/Mac to iOS using SDL2 and though I will have
to add explicit support for touch/finger events but everything seems to
work (more or less) OK with just usual mouse move / button press events.
What would be additional advantages of touch events? I don’t need pressure
value only “clicks”.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768

[quote=“Pallav Nawani”]Touch events are useful for recognising gestures, for example: pinch zoom, where the player uses two fingers in pinch like motion for zoom in/out.On Tue, Sep 17, 2013 at 2:04 PM, slimshader <@slimshader (@slimshader)> wrote:

[quote]

Ah, right. I do need zooming functionality that was previously supported by mouse wheel scroll. This does mean that I will be getting double “cursor” events tho right? mouse moves / buttons (as now) and touch events on top? Is there a way then to disable translation of touch events to mouse events?

IIRC, no - there is no way to disable SDL from sending a mouse event for a
Touch event. However, you should be able to differentiate between events
generated by an actual mouse and a touch event translated to a mouse press
by using the ‘which’ member of an SDL_MouseButtonEvent. For a touch event,
‘which’ is set to SDL_TOUCH_MOUSEID.On Tue, Sep 17, 2013 at 2:55 PM, slimshader <szymon.gatner at gmail.com> wrote:

**

[quote=“Pallav Nawani”]Touch events are useful for recognising gestures,
for example: pinch zoom, where the player uses two fingers in pinch like
motion for zoom in/out.

On Tue, Sep 17, 2013 at 2:04 PM, slimshader <> wrote:

[quote]

Ah, right. I do need zooming functionality that was previously supported
by mouse wheel scroll. This does mean that I will be getting double
"cursor" events tho right? mouse moves / buttons (as now) and touch events
on top? Is there a way then to disable translation of touch events to mouse
events?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768

I think a way to disable mouse events was added in the form of a hint,
I don’t remember exactly the details.

Even then, mouse emulation for touch events is there just for programs
that don’t care about touch (then this way they can get some minimal
functionality with it). If you need proper use of touch you shouldn’t
be relying on it.

2013/9/17, Pallav Nawani :> IIRC, no - there is no way to disable SDL from sending a mouse event for a

Touch event. However, you should be able to differentiate between events
generated by an actual mouse and a touch event translated to a mouse press
by using the ‘which’ member of an SDL_MouseButtonEvent. For a touch event,
‘which’ is set to SDL_TOUCH_MOUSEID.

On Tue, Sep 17, 2013 at 2:55 PM, slimshader <szymon.gatner at gmail.com> wrote:

**

[quote=“Pallav Nawani”]Touch events are useful for recognising gestures,
for example: pinch zoom, where the player uses two fingers in pinch like
motion for zoom in/out.

On Tue, Sep 17, 2013 at 2:04 PM, slimshader <> wrote:

[quote]

Ah, right. I do need zooming functionality that was previously supported
by mouse wheel scroll. This does mean that I will be getting double
"cursor" events tho right? mouse moves / buttons (as now) and touch
events
on top? Is there a way then to disable translation of touch events to
mouse
events?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768

SDL_TOUCH_MOUSEID will be of help thanks!

I admit that mouse emulation is very convenient, I was surprised when it just worked after I first started my application on iPad. I do not want to disable mouse-event based code on that platform so I will just filter out events that have SDL_TOUCH_MOUSEID and add explicit touch event support.

Thanks guys!

[quote=“Sik”]I think a way to disable mouse events was added in the form of a hint,
I don’t remember exactly the details.

Even then, mouse emulation for touch events is there just for programs
that don’t care about touch (then this way they can get some minimal
functionality with it). If you need proper use of touch you shouldn’t
be relying on it.

2013/9/17, Pallav Nawani :> IIRC, no - there is no way to disable SDL from sending a mouse event for a

Touch event. However, you should be able to differentiate between events
generated by an actual mouse and a touch event translated to a mouse press
by using the ‘which’ member of an SDL_MouseButtonEvent. For a touch event,
‘which’ is set to SDL_TOUCH_MOUSEID.

On Tue, Sep 17, 2013 at 2:55 PM, slimshader <@slimshader> wrote:

**

Pallav Nawani wrote:

Touch events are useful for recognising gestures,
for example: pinch zoom, where the player uses two fingers in pinch like
motion for zoom in/out.

On Tue, Sep 17, 2013 at 2:04 PM, slimshader <> wrote:

Ah, right. I do need zooming functionality that was previously supported
by mouse wheel scroll. This does mean that I will be getting double
"cursor" events tho right? mouse moves / buttons (as now) and touch
events
on top? Is there a way then to disable translation of touch events to
mouse
events?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org