TouchHit in a Text
Monkey Targets Forums/Android/TouchHit in a Text
| ||
Hi, I'm working in my New App in witch I need to take actions based on TouchHit in some Texts, please can I have some Example for this, I don't know how to do this. Thanks. |
| ||
there is no special TouchHit in Texts in monkey. There is only a TouchHit(0) on the screen with results TouchX(0) and TouchY(0). It is your job to calculate the word, that is under the Hit. |
| ||
Ok, Thanks, Can you give me an example for this calculation? Regards. |
| ||
that's a wide field.. and a too big job. It depends on too many factors. I thinks, that is your job now! |
| ||
Ok, I understand, Thanks for your answers. I'll do my Job. |
| ||
Use a simple bounding box check to see if the TouchX/Y is within a certain area, if the text is moving then you will have to adjust this each frame. Work out the width and height of your text, and its x/y etc and feed them into this function along with the TouchX/Y. Function RectsOverlap:Int(x0:Float, y0:Float, w0:Float, h0:Float, x2:Float, y2:Float, w2:Float, h2:Float) If x0 > (x2 + w2) Or (x0 + w0) < x2 Then Return False If y0 > (y2 + h2) Or (y0 + h0) < y2 Then Return False Return True End |