Forum Libraries, Components, and Plugins
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Is it possible to use a swipe function on CCGameView?

Is it possible to use a swipe function on CCGameView?


  • IlledanIlledan NOMember ✭✭
            var touchListener = new CCEventListenerTouchAllAtOnce ();
            touchListener.OnTouchesMoved = OnTouchesMoved;
            AddEventListener (touchListener, this);

    void OnTouchesMoved (List<CCTouch> touches, CCEvent touchEvent)

    Then simply loop through touches finding distance between their PreviousLocation & Location

  • DuITAppsDuITApps USMember ✭✭
    edited August 2016

    Have you tried using touches[0].DELTA ? For example. b2Body.ApplyForceToCenter(new beVec2(touches[0].DELTA.X, touches[0].DELTA.Y)

  • Ruslan0990Ruslan0990 DEMember ✭✭

    I have a simple implementation set up using the stopwatch to detect swipe duration and by calculating the distance of the swipe in a certain direction. Then you just define your thresholds for maximal duration and minimal distance of the swipe. I could share it later if you want.

Sign In or Register to comment.