Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am creating XNA/Silverlight game in Windows Phone Mango. Testing with the emulator in both the Release and Debug mode.

From the main page, I call a settings page written in Silverlight. Then I back out without making any changes. I enter the XNA page, the touch does not work properly.

If I start the app, then enter the XNA page straight from the main page, the touch does work.

In OnNavigatedTo:

TouchPanel.EnabledGestures = GestureType.Tap

Calling the settings page from main page:

NavigationService.Navigate( new Uri("/Pages/SettingPage.xaml", UriKind.Relative));

Games.cs buttons tap detection (only the detection lines):

while (TouchPanel.IsGestureAvailable && ! actionFound)
{
    GestureSample gestureSample = TouchPanel.ReadGesture();
    if (gestureSample.GestureType == GestureType.Tap)
    {
        // do work
    }
}

I add breakpoints in the 'do work' sections, it only gets hit after 3-4 taps.

I change the settings page to embedded Silverlight on XNA page, the same problem happens.

Just to make sure the timer is working, I change one of the sprites to move up and down in OnDraw. The sprite moves OK in both cases.

I been stuck on this for two days, and I got three more pages to code I need to call for a proper game.

Thanks in advance for any help.

share|improve this question
    
same here. did you find any solution? –  Alex Sorokoletov Jun 11 '13 at 5:58

1 Answer 1

Really hard to tell given the information you've shared, but I would check to make sure that you don't have a Silverlight control sitting on top of your game eating the input events. If you have any controls in the game's XAML try setting IsHitTestVisible to false. Likewise try doing the same for controls in Settings.xaml.

Some other thoughts:

  • How are you "backing out" from Settings.xaml?
  • What happens if you only set Gestures once? i.e. not every time you navigate to the page.
  • Have you tried checking MouseState, does it work? (To enable set Tap gesture enabled then check Mouse.GetState().
  • Is it possible the !actionFound condition in your while loop is causing problems?
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.