Posted: 20th Aug 2011 0:59
was looking if there was an api to detect swipes and panning for ios, however looking through the reference commands, i didn't see it. would it be best to just use teir 2? and use the static lib with obj-c? while this is ok, it kind of defeats the whole write it once concept since there really isnt swipes in windows or mac, just ios.
Posted: 20th Aug 2011 1:05
There is technically enough information in the GetRawTouchCurrentX() and others to detect a swipe, although I'll admit there could be an easier, more automated, way. Maybe in the future.
Posted: 20th Aug 2011 9:14
Maybe for now, someone will develop a set of simple functions using GetRawTouch to return human readable swipe movements
Posted: 20th Aug 2011 13:58
You don't even need the raw commands.

The GetPointerClick() And GetPointerReleazsed() commands should be used. Get the position of the cursor when GetPointerClick() is true, then get the position when GetPointerReleazsed() is true. Subtract one set of coord from another to get a distance vector, then put them into ATanFull to get a swipe direction.

THats what I do in the game i'm creating to open/close the pause menu. (Like the notification window on Android) and to close the game. (Like closing apps on WebOS)

I'll post an example when I'm on my other laptop...
Posted: 20th Aug 2011 14:16
+ Code Snippet
   Status = 0
  `Check for mouse click/touch
   If GetPointerPressed() = 1 And Click = 0
      Click = 1 :` There's been a click...
     `Record the x and y positions at the start of the swipe.
      XClickPos = GetPointerX()
      YClickPos = GetPointerY()
   EndIf

  `Check for the mouse/touch being released and only if click = 1
   If GetPointerReleased() = 1 And Click = 1
     `Subtract the current x/y position away from the start positions to get the distance dragged
      MovementX = GetPointerX() - XClickPos
      MovementY = GetPointerY() - YClickPos
     `Get the angle of the drag
      DragAngle = ATanFull( MovementX, MovementY )
      Click = 0

     `We can now use DragAngle and the Movement values to determine how far and in what direction we swiped.
     `THis is my drag right to quit code...
      If Abs( MovementX ) >= 200 And Abs( MovementY ) <= 20 And DragAngle >= 45 And DragAngle <= 135 Then Status = 9
   EndIf


Here you go, my entire swipe code.

Make the variables global!
Posted: 20th Aug 2011 14:32
Mobbius you would also need to get how fast this swipe happened so we know how fast to display a swipped object. you could do this by some kind of timer that resets on the first click. count up until release and then calculate the speed vie the distance and time.

just a thought.
Posted: 20th Aug 2011 18:42
I suppose you could, but I'm not doing that. Cant be bothered! lol

Didn't think of it to be honest! lol