简体   繁体   中英

How to detect direction of HorizontalDrag in WP7 XNA?

Like mentioned what is the best way of detecting in which direction the user is dragging horizontally. I'm trying to create a camera class that responds to this gesture but am having problems determining which direction they are dragging. Any suggestions are appreciated.

Admittedly I haven't tested this, but the documentation suggests that you should check the value of GestureSample.Delta.X , which should be negative for a left movement, and positive for a rightwards one.

Because the delta is only for that particular gesture sample (not the overall gesture), you may need to accumulate it, and only trigger your drag action if the accumulated value is above some threshold (possibly upon receiving a DragComplete ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM