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 / Detecting RawTouch 'Pressed'

Author
Message
Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 23rd Feb 2015 10:26
I'm using the RawTouch commands as my application requires MultiTouch. The problem I am having is that there appears to be no way to detect when the touch is 'Pressed'.

I am using the GetRawTouchType() command, but this only returns the following;

- Returns 1 for a short touch (the length of touch is determined when you release)
- Returns 2 for a hold
- Returns 3 for dragging

I also see a command GetRawTouchReleased(), but no GetRawTouchPressed().

Does anyone have a workaround for this?

Many thanks...

Using AppGameKit V2 Tier 1
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 23rd Feb 2015 10:33
GetRawTouchCount

AGK 108 (B)19 + AppGameKit V2 Alpha .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 23rd Feb 2015 12:03
You have to loop through the tough events. Personally I store a value for each touch using SetRawTouchValue and GetRawTouchValue. If this value does not contain a value it is a new "press".

It's best if you try it and test the results yourself to get your head around how raw touch events work.


Using AppGameKit V2 Tier 1
Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 23rd Feb 2015 14:52
Quote: "It's best if you try it and test the results yourself to get your head around how raw touch events work."


Unfortunately, that's what I've been trying to do for some time now

I am only interested in max 2 touches, all other touches can be disregarded. Take this small code snippet for example;



As I am only interested in 2 touches, the above works fine in detecting both. But the issue I have is that Touch1Type and Touch2Type only returns a value when I release the touch. I use the X/Y of the two 'touches' to see if either is within a particular area. But I wanted to do this in combination with the 'press' state so that the event is triggered immediately and not after the release... Where am I going wrong?

Using AppGameKit V2 Tier 1
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 23rd Feb 2015 21:18
What Baxslash is saying is to use the GetRawTouchValue() when you detect the touch. If it's zero (or blank I forget if it's numeric or string) then it is a brand new touch - i.e this is your pressed event.

Immediately after, SetRawTouchValue() to 1. Any subsequent check will not be empty, thus it is no longer a pressed event.

Quidquid latine dictum sit, altum sonatur
Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 23rd Feb 2015 22:31 Edited at: 24th Feb 2015 00:09
Baxslash, BatVink, I appreciate the help... But there is clearly something I just cannot grasp... I'm going round and round in circles here lol...

I was playing with the Get and SetRawTouch commands, but the problem I still have is that I need to know when it is a press only... Much like how GetPointerPressed() works, as in, when you press, this command sets to 1 for a fraction of a second... All of the commands I have tried with RawTouch either do not change states until after a second, or the value remains...

Again, I appreciate the help, but I've managed to find a workaround which meets my needs. I am using GetRawTouchTime() < 0.000001 then invoking the action. This ensures the action is called only once... Maybe I'm not explaining it very well, so here's the test code I was working with...




EDIT: I think the penny has just dropped and I get what you are both suggesting. I'll give it a try tomorrow, for now though, this work around will have to do Thanks again.

Using AppGameKit V2 Tier 1
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 24th Feb 2015 17:49
you wrote u need Pressed,
that means GetRawTouchCount goto 2 entrys and back to zero.

AGK 108 (B)19 + AppGameKit V2 Alpha .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)

Login to post a reply

Server time is: 2024-11-25 18:04:27
Your offset time is: 2024-11-25 18:04:27