Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Tip: Raw touch indexes can also be negative, especially when using iOS simulators

Author
Message
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 10th Jul 2018 10:02
When testing a recent WIP, I discovered that the iOS simulators running the interpreter (iPad Pro, iPhone X and others) were ignoring my raw touch events around 50% of the time. The standard GetPointerState() and GetPointerX/Y() functions worked fine, but I was using multitouch/raw touch for most operations.

Further analysis reviewed that on some launches/broadcasts of the app, the GetRawFirstTouchEvent(1) and GetRawNextTouchEvent() commands would always return long negative indexes instead of positive ones, such as -1126844592.

All of my touch handling was designed in the same fashion as the included demos and code snippets, and how I imagine almost everyone here does it:



Since the while loop is checking if touchID is greater than zero, any time the app would run on a device where the touch IDs were negative none of that code would be executed.

The solution - simply change it to: while touchID <> 0 Now when no touches are down GetRawFirstTouchEvent(1) will be zero, but in all other instances it will represent an index that can be any non-zero integer. The code still functions correctly once this change is applied.

Looking into the cTouch.h header of the AppGameKit include, I see that m_iUniqueID is of type UINT (unsigned integer). So technically negatives should never be occurring but however AppGameKit is retrieving/converting the touch reference in such instances seems to be overflowing it or otherwise causing it to be signed negatively. I am not sure whether or not this occurs on actual devices but given even the chance that it does (and if you ever wish to test on simulators while using raw touch) I recommend updating to check against negative and positive indexes.
Vladimuffin
7
Years of Service
User Offline
Joined: 27th Nov 2016
Location:
Posted: 6th Aug 2018 01:54
Thank you! I have been making myself crazy trying to figure out why my game wasnt working on my daughter's ipod!
One smart fellow, he felt smart. Two smart fellows, both felt smart. Three smart fellows all felt smart...
Vladimuffin
7
Years of Service
User Offline
Joined: 27th Nov 2016
Location:
Posted: 6th Aug 2018 02:10
I still haven't got it working on my end, but I am glad to see im not the only one. using if getrawtouchtype(1) = 1 to fire bullets. works on all other devices but the one ipod.
One smart fellow, he felt smart. Two smart fellows, both felt smart. Three smart fellows all felt smart...

Login to post a reply

Server time is: 2024-11-23 17:44:36
Your offset time is: 2024-11-23 17:44:36