开发者

How to detect direction of HorizontalDrag in WP7 XNA?

开发者 https://www.devze.com 2023-03-27 22:21 出处:网络
Like mentioned what is the best way of detecting in w开发者_如何学运维hich direction the user is dragging horizontally. I\'m trying to create a camera class that responds to this gesture but am having

Like mentioned what is the best way of detecting in w开发者_如何学运维hich 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).

0

精彩评论

暂无评论...
验证码 换一张
取 消