1
我创建了一个基本的DrawableGameComponent
并实现了Update
和Draw
函数。我更新的方法是这样的:DrawableGameComponent不响应我的水龙头
public override void Update(GameTime gameTime)
{
if (this.state != ComponentState.Hidden)
{
if (this.state == ComponentState.Visible)
{
while (TouchPanel.IsGestureAvailable)
{
GestureSample gesture = TouchPanel.ReadGesture();
if (gesture.GestureType == GestureType.Tap)
{
Point tapLocation = new Point((int)gesture.Position.X, (int)gesture.Position.Y);
// TODO: handle input here!
this.state = ComponentState.Hidden; // test
}
}
}
}
base.Update(gameTime);
}
而且我已经启用了在构造以下手势:
TouchPanel.EnabledGestures = GestureType.Tap | GestureType.VerticalDrag;
这里的问题是,它并没有对如果测试反应过来的时候我检查自来水。有什么我需要做的DrawableGameComponent?
您是否尝试删除组件可见性检查?假设你没有从其他地方读取它们,你的手势相关的代码看起来很好。 –
@Layoric如果我在它命中的while循环上设置断点。 – Jason94
是'TouchPanel.ReadGesture();'你的代码中的任何其他地方?另一个组件也正在处理? –