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 / AGK Cursor Control Project Template

Author
Message
anwserman
12
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 17th Jan 2012 02:43 Edited at: 17th Jan 2012 14:03
I have attached a project that is to be used as a template for cursor controls (I used the word cursor as not to confuse with pointer). Basically, I made a wrapper function around the Pointer and RawTouch controls. It works for both MultiTouch and Single Touch.

To scroll a playfield based upon user input, for both multi or single-touch


To see if a user swiped across the screen, for both multi or single-touch
Swap out 64 for your own values. A higher number means a swipe needs to be longer before it will be recognized


To zoom in and out with two fingers, for multi-touch only
Swap out 300 to modify the speed of zoom. A higher number means a slower zoom


To get the current cursor - the default pointer on single touch machines, or an average of all touch coordinates on multi-touch screens


I'm sure there are improvements that could be made, but for basic multi-touch cross platform functionality in your applications - out of the box! - here you go.

If you use this code, please give me credit!

EDIT: Tweaked a small piece of code. Also, includes a demo for testing purposes. Delete the REMSTART and REMEND in the main.agc file to enable offset and zoom, but comment out the swiping code if you do so.

(I would not recommend using swipe with either offset and zoom)

Hi there. My name is Dug. I have just met you, and I love you.

Attachments

Login to view attachments
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 17th Jan 2012 13:45
Nice work answerman and thanks for sharing!

Have you added it here yet?
http://forum.thegamecreators.com/?m=forum_view&t=193433&b=41

anwserman
12
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 17th Jan 2012 13:54
I'm not sure if it 'qualifies' for the Community Useful Functions Project, just because of the scope of it. I mean yeah - it could certainly be included - but I feel that is slightly of bigger scope than trying to split a string by a delimiter

I'll let the peeps at The Game Creators weigh in on this for me!

Hi there. My name is Dug. I have just met you, and I love you.

Login to post a reply

Server time is: 2024-04-16 08:38:47
Your offset time is: 2024-04-16 08:38:47