Я делаю приложение wp7, и мой сенсорный экран не работает. Код, который я написал, приведен ниже
protected override void Update(GameTime gameTime)
{
TouchCollection touches = TouchPanel.GetState();
if (touches.Count > 0 && touches[0].State == TouchLocationState.Pressed)
{
SpriteFont font = Content.Load<SpriteFont>("Font");
Point touchPoint = new Point((int)touches[0].Position.X, (int)touches[0].Position.Y);
spriteBatch.Begin();
spriteBatch.DrawString(font, "hello ", new Vector2(touchPoint.X, touchPoint.Y), Color.White);
spriteBatch.End();
while (TouchPanel.IsGestureAvailable)
{
GestureSample gesture = TouchPanel.ReadGesture();
switch (gesture.GestureType)
{
case GestureType.Tap:
case GestureType.DoubleTap:
spriteBatch.Begin();
spriteBatch.DrawString(font, " ", new Vector2(touchPoint.X, touchPoint.Y), Color.White);
spriteBatch.End();
break;
}
}
}
base.Update(gameTime);
}