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 Studio Chat / [SOLVED] Flick scrolling

Author
Message
n00bstar
20
Years of Service
User Offline
Joined: 9th Feb 2004
Location: Montreal, Canada.
Posted: 2nd Feb 2021 11:12
I'm stumped. I have an app with long lists of data that i want the user to be able to scroll through. I want the user to be able to drag the list up and down, and that works ok, but I also want the user to "flick scroll" through the list. So I'm setting up some sort of scrolling speed based on pointer events... but.... it works like a charm on Windows but it won't work on my tablet/phone. Any ideas? I'm guessing it has to do with Pointer events being different on windows and android, although I did try with some RawTouch events and it still won't work. I'm sure I'm missing something super obvious here but for the life of me, I just can't see it....

-----------------------------------------------------------------------------
We all got a chicken duck woman thing waiting for us

The author of this post has marked a post as an answer.

Go to answer

blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 2nd Feb 2021 20:43
Floats
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 2nd Feb 2021 21:14 Edited at: 2nd Feb 2021 21:15
This post has been marked by the post author as the answer.
Quote: "I'm sure I'm missing something super obvious here but for the life of me"


GetPointerXXX functions only serve the very basic of needs when it comes to mobile, your going to need to use GetRawTouchXXX functions.... and Floats


blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 2nd Feb 2021 22:22 Edited at: 2nd Feb 2021 22:40
Works fine for me
n00bstar
20
Years of Service
User Offline
Joined: 9th Feb 2004
Location: Montreal, Canada.
Posted: 2nd Feb 2021 22:23
That's what I thought! I knew it had to be something to do with GetPointer commands because they're some kind of all-around generic virtual pointer commands.

I'm finally getting something happening on the tablet with the speed control. It's acting a bit weird but I'll figure that out soon enough as I'm on the right path now.

Thanks guys!
-----------------------------------------------------------------------------
We all got a chicken duck woman thing waiting for us
n00bstar
20
Years of Service
User Offline
Joined: 9th Feb 2004
Location: Montreal, Canada.
Posted: 2nd Feb 2021 22:56
Quote: " Works fine for me "


Aye I had the same thing going. Works fine on the PC, doesn't work on mobile for some reason. At least not on my devices (ZL10 tablet and S6 phone).

I'm getting good results with rawtouch events though...
-----------------------------------------------------------------------------
We all got a chicken duck woman thing waiting for us
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 2nd Feb 2021 23:02
Try the code one more time. I changed it
n00bstar
20
Years of Service
User Offline
Joined: 9th Feb 2004
Location: Montreal, Canada.
Posted: 2nd Feb 2021 23:11
Hmm! The inertia works fine now. If you drag slowly and let go, the inertia is still calculated off the Y distance though. Still, gives me good pointers (hah! pun!) on how to proceed with strictly Pointer commands.
-----------------------------------------------------------------------------
We all got a chicken duck woman thing waiting for us
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 2nd Feb 2021 23:15
It calculates the inertia from the distance between GetPointerPressed() and GetPointerReleased().
I guess you could update that based on a timer value so distance travelled in the last .2 seconds or since GetPointerPressed(). whatever is less.
Either way i don't think it has anything to do with the GetPointer commands
n00bstar
20
Years of Service
User Offline
Joined: 9th Feb 2004
Location: Montreal, Canada.
Posted: 2nd Feb 2021 23:23
Agreed, it apparently doesn't. I'll keep hacking at it, your code gives me hope that I'll get it working the way I want it to on all platforms equally. However, kind of outlines that we could definitely use some GetPointerSpeed() (or whatever) command in a language that's primarily geared towards mobile apps. Such a basic functionality, I'm sure it has stumped other so-so wannabe coders like me before heh
-----------------------------------------------------------------------------
We all got a chicken duck woman thing waiting for us
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 3rd Feb 2021 02:49
AGK may have a cross platform compiler but some of the functions really do not translate well to mobile and Pointers being an example of that, If you are coding for mobile I highly recommend using the Touch functions, you can of course use both and run the right code for the platform in a switch statement, this gives the added benefit of utilizing the touch screen to its full potential, short, long tap, drag etc with 1,2,3 whatever fingers without reinventing the wheel making a desktop setup work on clunkily mobile, if you do 3D on mobile this system is an absolute necessity to pinch zoom, rotate, tilt etc
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 3rd Feb 2021 03:33
Yes. Definitely if you want touch type functionality rather than a "simulated mouse" functionlity
n00bstar
20
Years of Service
User Offline
Joined: 9th Feb 2004
Location: Montreal, Canada.
Posted: 5th Feb 2021 20:00 Edited at: 5th Feb 2021 20:01
A combination of GetTouchLastY() and GetTouchCurrentY() was the solution to get a good inertia.

It's finally working juuuuust right.

-----------------------------------------------------------------------------
We all got a chicken duck woman thing waiting for us

Login to post a reply

Server time is: 2024-03-29 05:18:59
Your offset time is: 2024-03-29 05:18:59