Skip to main content
 首页 » 编程设计

c#之XNA 中的多点触控事件

2024年02月23日15lvdongjie

我需要在 xna 中一起应用多点触控事件(垂直拖动、水平拖动)。如果有人知道请帮助。

请您参考如下方法:

我将手势用作水平、垂直拖动,这是一个示例:

while (TouchPanel.IsGestureAvailable) 
{ 
  GestureSample gesture =TouchPanel.ReadGesture(); 
  if (gesture.GestureType == GestureType.VerticalDrag) 
  { 
     //insert the code here that execute when the event is detected 
  } 
} 

这是您的更新或线程中的代码,但是,您必须在您的类中声明它

TouchPanel.EnabledGestures = GestureType.VerticalDrag;