Page 1 of 1

Mouse vs. Touch vs. Pen Input

Posted: Sat Feb 11, 2017 6:13 pm
by mlepage
Hi, I would like to know if it is possible to distinguish between pen and touch input.

By pen, I mean either Surface pen, or Wacom tablet pen, with pressure levels.

What I'd like to do is play around with making simple drawing apps for prototyping some ideas. I'd like to be able to use the pen with pressure levels for drawing, and touch for pinch/zoom/scroll etc. I don't want touch to draw, if I'm holding the Surface tablet and touch it, or if my palm rests against it while I'm holding the pen.

I assume Windows has all the proper events for mouse vs. touch vs. pen. So my question is whether Love exposes those distinctions so I can use them.

If not, would such support be coming soon? Seems like touch and pen are becoming much more prevalent, and that's because they're useful. They can be more useful with better software.

Re: Mouse vs. Touch vs. Pen Input

Posted: Sat Feb 11, 2017 6:27 pm
by raidho36
LÖVE doesn't support pen input so that's that. Try your luck with third party libraries, also obviously you'd then have no problem telling if it's pen or mouse input, because you get pen input from a third party lib. As for touch input, there are special touch-related callbacks and functions so you can't miss them. Touch can also emulate left mouse clicks.

Re: Mouse vs. Touch vs. Pen Input

Posted: Sat Feb 11, 2017 11:46 pm
by Nixola
I do need this as well, so I might do some research on a cross-platform way to do it (or multiple non cross-platform ways). I'll share my results here if I ever find something out.

Re: Mouse vs. Touch vs. Pen Input

Posted: Sun Feb 12, 2017 1:02 am
by alloyed
I'm also interested, but I don't have the hardware to directly test it.
Worth noting, the existing love.touch API supports pressure levels.

Re: Mouse vs. Touch vs. Pen Input

Posted: Sun Feb 12, 2017 1:54 am
by zorg
The pen manufacturers will probably have separate APIs, or use existing OS specific ones in device-specific manners... probably.
On that note, looks like Wacom is thankfully into sharing information about this, at a first glance anyways:

http://www.wacomeng.com/windows/
http://www.wacomeng.com/mac/index.html
http://www.wacomeng.com/linux/index.html
http://www.wacomeng.com/android/index.html

Re: Mouse vs. Touch vs. Pen Input

Posted: Sun Feb 12, 2017 2:46 am
by slime

Re: Mouse vs. Touch vs. Pen Input

Posted: Sun Feb 12, 2017 5:02 am
by raidho36
Yea the core problem with pen input is that unlike mouse or even touch, there is basically no hardware nor software standard for it, so vendors implement their own drivers. You'll have pretty good chances that a Wacom tablet will have drivers for any OS, not so much for anything else. Until that situation changes, you'll not see much support for them. Same reason why force feedback racing wheels are not widely supported in racing games.

Re: Mouse vs. Touch vs. Pen Input

Posted: Sun Feb 12, 2017 6:39 am
by zorg
raidho36 wrote: Sun Feb 12, 2017 5:02 amYea the core problem with pen input is that unlike mouse or even touch, there is basically no hardware nor software standard for it.
Isn't HID a standard?
(Page 134 of http://www.usb.org/developers/hidpage/Hut1_12v2.pdf describes an example for Desktop Tablet input device.)
raidho36 wrote:so vendors implement their own drivers.
This can still be true regardless of HID existing.
raidho36 wrote:You'll have pretty good chances that a Wacom tablet will have drivers for any OS, not so much for anything else. Until that situation changes, you'll not see much support for them.
As slime linked above, for windows, two apis exist for tablets on windows, wacom's wintab and windows' RealTimeStylus. For other OS-es, wacom's sites i linked above may hold more (even non-vendor-specific) answers, honestly i haven't read them thoroughly.
Also, no one needs to care about other vendors; that's how it is with pre-XBOX compatible controllers (see the gamepad api for example).

But all-in-all, i do agree that until SDL implements anything, this could only either be solved with an external library, or maybe FFI, in case it can access the needed APIs.