Jump to content

  • Log In with Google      Sign In   
  • Create Account

TouchInput structure


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 fanaticlatic   Members   -  Reputation: 470

Like
0Likes
Like

Posted 17 August 2012 - 09:04 AM

Hello all,

I am trying to implement support for multi-touch in a windows 7 environment.

I am using the following links:
http://msdn.microsof...d562197(v=vs.85).aspx
http://msdn.microsof...d317321(v=vs.85).aspx
http://msdn.microsof...d317334(v=vs.85).aspx

Through all those links I can't seem to find any information on how and when to use the time-stamp (dwTime) member of the TouchIput structure, and more importantly what to do when the time-stamp wraps around.

Currently I check the time-stamp of the event message and compare it too a stored value from the previous frame like so:

[source lang="cpp"]if( ( touchstore[ i ].dwID == message[ mindex ].dwID ) && ( message[ mindex ].dwTime > touchstore[ i ].dwTime ) ){ touchstore[ i ] = message; // do something when touch sequence matches and timestamp of message is newer than stored touch}[/source]

dwTime is a DWORD and represents a timestamp in milliseconds, How do I cater for dwTime wrapping around?


Thanks for any help and advice you can provide.

Mark.

Edited by fanaticlatic, 17 August 2012 - 09:05 AM.

"I have more fingers in more pies than a leper at a bakery!"

Sponsor:

#2 nobodynews   Crossbones+   -  Reputation: 1934

Like
1Likes
Like

Posted 17 August 2012 - 11:46 AM

When a timestamp wraps around the time difference is about 50 days (2^32 milliseconds / 1000 milliseconds per second / 60 seconds per minute / 60 minutes per hour / 24 hours per day = 49.71 days). You could decide that if you receive a message more than an arbitrary time (1 second, 1 hour, 1 day...) before the previous message that it must have occurred *after* the last message even though the times is technically < the last message. Or to integrate it with your code, something like this I believe would work:

if( ( touchstore[ i ].dwID == message[ mindex ].dwID ) && ( ( message[ mindex ].dwTime > touchstore[ i ].dwTime ) || (message [mindex].dwTime < (touchstore[ i ].dwTime - WrapAroundTimeDelta) )) )

Where WrapAroundTimeDelta is something like 86400000 milliseconds (24 hours) in the past.

C++: A Dialog | C++0x Features: Part1 (lambdas, auto, static_assert) , Part 2 (rvalue references) , Part 3 (decltype) | Write Games | Fix Your Timestep!


#3 fanaticlatic   Members   -  Reputation: 470

Like
0Likes
Like

Posted 17 August 2012 - 01:50 PM

Great answer, I was worried about assuming the timestamp used the whole DWORD before a wrap. Thanks. I may put a request into MS to get the wrap around mentioned in the Touch docs.
"I have more fingers in more pies than a leper at a bakery!"




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS