Touch vs Tap

Monkey Forums/Monkey Programming/Touch vs Tap

smilertoo(Posted 2012) [#1]
Is mousehit the equivalent of a tap, and mousedown the equivalent of a touch?


therevills(Posted 2012) [#2]
Yep.


Anatol(Posted 2012) [#3]
Basically yes. Every TouchDown(0) starts with a TouchHit(0)=1 (unless you have superpowers and manage to repeatedly touch the screen a few times between each OnUpdate in which case the TouchHit would be higher).

If by tap you mean a quick touch with a release you'll need to add a timer to check the duration of the tap.


smilertoo(Posted 2012) [#4]
a tap, as in tapping the touchscreen as apposed to keeping the finger pressed on it.


Gerry Quinn(Posted 2012) [#5]
I think as Anatol suggests, durantion may be more important to check on a touch-screen. With a mouse, there are not so many contexts in which you would need to separate a drag from a tap.

Of course tracking everything might bring advantages with a mouse too. MouseHit() is fine for buttons in games, and probably it is even optimal if the buttons control guns etc. But 'real' OS-style buttons change their image but don't fire until the mouse is released, allowing you to change your mind. (E.g. if I click on 'Post' here and then move my mouse away before releasing the button, nothing will happen.)


Anatol(Posted 2012) [#6]
I just posted a related touch monitor class at http://www.monkeycoder.co.nz/Community/posts.php?topic=3936

The sample code has a tap example.

Maybe the class is too big for what you actually need, but if it looks useful, give it a whirl!