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 / Drawing with fingers, how to do it right?

Author
Message
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 28th Feb 2019 10:04
I tested the touch
integer GetRawFirstTouchEvent( bIncludeUnknown )

But if I am using sometimes 3 fingers, or wait to long, because it maybe registers a hold event, all my events disapear.
I want to rest my fingers and also my hand on the display.

1 sec. for a hold event is to "fast" or to soon. If you draw slowly, you maybe want your finger for some time on one position, maybe the paint has to dry or you thinking about your next move and so on.

I also don't understand, how the finger-index-system works. If I have one finger on the display, it is everytime Zero 0. But that behavior is also a little bit messy. Why?

I am using the first finger, it gets Zero 0 as an ID, my next finger gets maybe 345 or so, and if I am moving up the first finger with ID = 0, than my second finger with ID 345 gets the ID 0

It makes it very complecated, for example to have one finger with one color and draw. I would have to track the finger positions and can't use the IDs at all, because they could change everytime. I understand, that AppGameKit can't tell me, if I am using the thumb or middlefinger or what ever, but changing the ID from a finger, I didn't pull from the display ...

Is there maybe a drag-n-drop example with maybe more than one finger in action? Also my display supports up to 10 fingers, but I don't get them to trigger in AGK. Is it limited to 5 or so?
puzzler2018
User Banned
Posted: 28th Feb 2019 10:08
Have you tried the F1 example for a zoom

Quote: "
function ZoomTouch()

if GetMultiTouchExists() =1

if GetRawTouchCount(1)=2 //two Fingers

t=GetRawFirstTouchEvent(1)
sx1#=GetRawTouchStartX(t)
sy1#=GetRawTouchStarty(t)
x1#=GetRawTouchCurrentX(t)
y1#=GetRawTouchCurrenty(t)

t=GetRawNextTouchEvent()
sx2#=GetRawTouchStartX(t)
sy2#=GetRawTouchStarty(t)
x2#=GetRawTouchCurrentX(t)
y2#=GetRawTouchCurrenty(t)

//drawline(sx1#,sy1#,sx2#,sy2#,255,255,255)
//drawline(x1#,y1#,x2#,y2#,0,255,0)

dx#=sx2#-sx1#
dy#=sy2#-sy1#
l1#=sqrt(dx#*dx# + dy#*dy#) //distance start 1 - start 2

dx#=x2#-x1#
dy#=y2#-y1#
l2#=sqrt(dx#*dx# + dy#*dy#) //distance current 1 - current 2

if l1#>0
l#=(1.0 / l1#) * l2#
l#=l#-1.0
l#=l#/3.0 //slower
z#=getviewzoom()+l#
if z#<1.0 then z#=1.0 //Limit
if z#>2.5 then z#=2.5 //Limit
setviewzoom(z#)
endif

endif

endif

endfunction ret
"
Tier 1 Developer
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 28th Feb 2019 10:16
Take a look at SetRawTouchMoveSensitivity(). This made a massive different with pinching to zoom code. By default it's 6 seconds, so that's 6 seconds before RawTouch is properly registered. I'd also try changing this GetRawFirstTouchEvent(1) to GetRawFirstTouchEvent(0). Play around with the two settings to see if you spot any improvements.
OryUI - A WIP AGK2 UI Framework
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 28th Feb 2019 14:37
Zoom, Pinch, Rotate of a Sprite would be the greatest

The question also would be, how complecated it would be, to do Pinching and Zooming on more than one place at a time.

my idea would be, if a collision with one sprite and two touchpoints is, they could be used for the events on that sprite.
And if no sprite is involved or the sprite in the background, we could zoom, pinch, rotate "the world"

https://math.stackexchange.com/questions/190111/how-to-check-if-a-point-is-inside-a-rectangle
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 28th Feb 2019 15:09 Edited at: 28th Feb 2019 15:11
You can use GetSpriteHit(x,y) ...no need to do the maths manually to see if the touch is over the sprite


Rotating the world is harder though as you can set the view offset and the scale but you cant rotate the whole 2d view. All the sprites will have to be moved and rotated as if the whole world was rotated about a point. Still doable though.
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 13th Mar 2019 16:25
Does anybody created something with the touch events, not only with the virtual buttons?
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 15th Mar 2019 11:18 Edited at: 15th Mar 2019 11:28
Today I made a very short test, in the main loop only the following Print(GetRawTouchTime( GetRawFirstTouchEvent(1)))

With one finger, I can hold so long, I want, more than one second, I guess, minutes are possible.
If I am using a second finger and hold the first finger, this event shows the holding time of my second finger ... and if I release the second finger, it shows the holding time for the first one, in the background it counts the time for the first one
BUT!! If I am using a third finger (two fingers allready on the surface), suddenly no time is counted anymore, not for the first finger without releasing it anytime, not for the second finger.

Also releasing the third finger, doesnt show anymore the time of the first or second finger.

I donĀ“t really understand, what the difference is, between 1, 2 fingers and the third. I expected, that my first finger, which would hold the touch surface the complete time, counts, no matter, if I put a second finger or two fingers or a second and than a third on the surface.
I expected, that the first holding finger would be everytime the first touch event, no matter, how many fingers till the max of the device is reached. And only than, maybe the first finger, would be overwritten by the last finger put on the device.

Windows 10 says: supported up to 10 touchpoints on your device

What could I do, to get AppGameKit to have more than two touch points at the same time with correct numbers, to work with?

Thanks, for help.
-------------------------------------------------------------
okay, I changed the behaviior of the Wacom Cintiq driver. I change the option to "use Windows gestures ( )" from "use Wacom gestures (x)"
Now, it seems, I am some kind of limited to 5 fingers, but if I am putting the sixth finger on the surface and lift it up again, the behavior is like expected. It counts the other fingers and also the Print(GetRawTouchCount(0)) shows now 5 events at max, not only 2.


Attachments

Login to view attachments
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 15th Mar 2019 15:16
Small Test, all 10 points are working

Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 18th Mar 2019 19:00
Some lines and Angles, also simple Drag'n'Drop, for one test Sprite. No pinching, no rotating

blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 18th Mar 2019 23:55
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 4th Apr 2019 11:52
@blink0k thx, I have to look into it. Have to figure out, how to implement also the rotation correctly and how to be able to manipulate more than one thing at A TIME. In theory, I could have multiple drag-drop and pinch-zoom events.
Amon
10
Years of Service
User Offline
Joined: 30th May 2014
Location: Shropshire, United Kingdom
Posted: 5th Apr 2019 00:03
There some good stuff in here. Thank you Xaby.
Imaginations' greatest gift is the knowledge you supply it.
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 11th Apr 2019 19:30
@Imagination Engineer,

did you tried something with touch input? I am still in a limbo with some of the code

Login to post a reply

Server time is: 2024-11-23 01:40:47
Your offset time is: 2024-11-23 01:40:47