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
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)
- 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.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Fragmenter - animated loop machine and IKONOMIKON - the memory game
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
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
Fragmenter - animated loop machine and IKONOMIKON - the memory game
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.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
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
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.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
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
Hope that helps you.
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