zoukankan      html  css  js  c++  java
  • WP7备注(6)(TouchLocation接触点与Gesture手势)(XNA)

    获取屏幕多点触摸的所有Touch:

    TouchCollection touchLocations = TouchPanel.GetState();
    foreach (TouchLocation touchLocation in touchLocations)
    {
    if (touchLocation.State == TouchLocationState.Pressed){}
    if (touchLocation.State == TouchLocationState.Moved){}
    if (touchLocation.State == TouchLocationState.Released){}
    }
     

    获取上一时刻的TouchLocation

    TouchLocation previousTouchLocation;
    bool success = touchLocation.TryGetPreviousLocation(out previousTouchLocation);

    TouchLocation的对象拥有Position属性,提供一个相对于屏幕的Vector2对象

    -------------------------------------------------------------------------------------------------

    设置可用的手势:

    TouchPanel.EnabledGestures = GestureType.Tap;

    获取手势并处理:

    while (TouchPanel.IsGestureAvailable)
    {
    GestureSample gestureSample = TouchPanel.ReadGesture();
    if (gestureSample.GestureType == GestureType.Tap){}
    }

    GestureSample的对象拥有Position属性,提供一个相对于屏幕的Vector2对象

    XNA支持的手势

    Tap:手指单击

    DoubleTap:手指双击

    Hold:手指碰触并固定一段时间

    FreeDrag:自由移动手指

    VerticalDrag:上下移动手指

    HorizontalDrag:左右移动手指

    DragComplete:移动结束

    Flick:滑过(手指抬起时不停止)

    Pinch:缩小和延伸

    PinchComplete:缩小和延伸结束

  • 相关阅读:
    git操作说明书
    python之routes入门
    python inspect库
    Python SMTP发送邮件
    Python深入:setuptools进阶
    Python打包之setuptools
    python graphviz的使用(画图工具)
    pathlib的使用
    python tempfile 创建临时目录
    python flake8 代码扫描
  • 原文地址:https://www.cnblogs.com/otomii/p/2029365.html
Copyright © 2011-2022 走看看