Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
the end of all touches? — Gideros Forum

the end of all touches?

keszeghkeszegh Member
edited April 2014 in General questions
so my problem is that i regularly notice on my tablet that there is touchbegin but there is no touchend triggered (nor touchcancel). is this a rare problem or do you encounter the same? is this a hardware problem or only a problem of gideros? is there any intelligent way to handle this, i.e. 'notice' that this is the case (no touches anymore but still no touchend triggered since the last touchbegin).
or do you think i'm wrong and there is only a problem in my code? it's hard to make a test app just to test this as it happens rarely, but still at every 5 minutes once while playing, so often enough to worry about it. and i already make some effort to rule out other problems that may cause is, so there is a high chance that touchend/cancel is indeed not triggered sometimes when a touch does end in reality.

thanks for any remarks.

Comments

  • ar2rsawseenar2rsawseen Maintainer
    interesting, but I've never seem to encounter such behavior.
    Currently can't tell if it is hardware or Gideros related.

    But to confirm that you have it you can create global touchCount = 0 variable
    and on each touch start add 1 to it and on each touch cancel/end subtract 1 from it

    without any check or any additional code

    The only thing I think that can cause this if you let through one event and stopPropagation of other event on higher sprite hierachy (since touch input events go from children to parents)
  • "The only thing I think that can cause this if you let through one event and stopPropagation of other event on higher sprite hierachy (since touch input events go from children to parents) "
    - i thought about this one as a possible reason, and did not check it thoroughly but most probably this is not the case.
    maybe my tablet is the culprit (thinkpad lenovo tablet), as i have an impression that in other apps similar things might have happened, but again, so far i did not start to investigate it systematically, so i don't have facts.

    thanks, i'll let you know if i manage to get more data about the problem.
  • if i add the touchlistener to the stage while other touchlisteners at other places are added to some sprites, then can i be sure that this listener is always the first to catch the event? (and no other listener catches before it)
  • ar2rsawseenar2rsawseen Maintainer
    @keszegh unfortunately no, the input events are propagated in order of Z-index from children to parents, so the stage will actually be the last one to receive it.
    Check out "Input Events"
    http://docs.giderosmobile.com/events.htm

    And if somewhere on the way stopPropagation is called then stage may never receive the event
  • thanks, stage is bottom, of course you are right, reverse order, my fault.

    about the problem, i did some thorough testing, adding a counter like you suggested. all in all even when i encountered the problem, the counter remained fine, i.e. the neutral (no touches) case was 0 after this. however, the behaviour was the following:

    i touch the screen, there is a touchbegin fired,
    i release, there is NO touchend/touchcancel fired,
    i touch again after a while, and there is NO touchbegin fired,
    i release again and there is touchend fired.

    so whenever it 'forgets' to register a touchend, it also 'forgets' to register the next touchbegin, so the counter after all this goes back to 0 as expected, but inbetween the above detailed strange thing happens. this way a button remains in 'pressed but not released state' until the second touch of the screen, etc. strange things happen, although probably still better than having nonequal touchbegins and touchends.

    further, i'm more and more sure that it is specific to my tablet. the only question is that how often is that a random device produces this kind of behaviour.

    Likes: Yan

    +1 -1 (+1 / -0 )Share on Facebook
  • additional info:
    i haven't tested this, but at some point i had the impression that the id changes in the above behaviour:
    i touch the screen, there is a touchbegin fired with IdA,
    i release, there is NO touchend/touchcancel fired,
    i touch again after a while, and there is NO touchbegin fired,
    i release again and there is touchend fired IdB.

    so it is possible that a touch with id 6 never ends and only a touch with id 1 ends at the next touch, so if i work with separate id's then the end with id 6 is never fired (at least until i touch it again with 6 fingers). which may cause additional problems.

  • @Keszegh, I admit that touch is funny with Gideros, but what you describe is simply appalling. Would you like to share the touch code you are using to check this hypothesis above. Maybe it could be the code, maybe th hardware, maybe Gideros, but then you would have gotten a more clear picture of where the issue is.
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • @ozapps, it's quite hard to distill that part from my messy code.

    for my latest issue about id's i don't have a proof yet, i'm trying to experiment more.

    for the former problem i clearly encounter it regularly, the problem is that i have no way to make it automatic in the code to report that it happens, as the only way to check it is that you visually see that you do not touch the screen at all, but the last touchevent was a 'begintouch', and then when you touch it again, you do not receive a 'begintouch', only an 'endtouch' when you release again the screen.
  • @Keszegh,
    try the prototype before app approach, that is you try a particular code/section and work with it till you are satisfied then put that together and make something better. You can try a new project, add a couple of images or the same image but on each image set up event listeners for each TOUCHES_BEGAN, TOUCHES_MOVED and TOUCHES_ENDED and in each of the handlers, have a print statement like
    print(e.type)
    where 'e' is the event data passed to the handler. That way you will be able to determine the touch issue and debug it better.

    Hope that helps you.
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
Sign In or Register to comment.