0
\$\begingroup\$

I have an issue with objects moving roughly twice as far as expected when dragging them.

I am comparing my application to the standard TouchGestureSample sample from MSDN.

For some reason in my application gesture samples have fractional positions and deltas.

Both are using same Microsoft.Xna.Framework.Input.Touch.dll, v4.0.30319.

I am running both apps using standard Windows Phone Emulator.

I am setting my break point immediately after this line of code in a simple Update method:

GestureSample gesture = TouchPanel.ReadGesture();

Typical values in my app:

Delta = {X:-13.56522 Y:4.166667}
Position = {X:184.6956 Y:417.7083}

Typical values in sample app:

Delta = {X:7 Y:16}
Position = {X:497 Y:244}

Have anyone seen this issue? Does anyone have any suggestions?

Thank you.

\$\endgroup\$
6
  • \$\begingroup\$ What have you changed in the code? If the fractional values bother you, you can convert them to some integer type. \$\endgroup\$
    – Marton
    Commented Oct 31, 2012 at 8:47
  • \$\begingroup\$ The relevant code is pretty much similar. Thanks, but I prefer to fix causes not consequences. \$\endgroup\$
    – Den
    Commented Oct 31, 2012 at 9:10
  • 1
    \$\begingroup\$ Okay, I wouldn't bother with the float / int conversion either. What could be important though, is the difference between "pretty much similar" and "the same". Is it possible, that the emulator has different settings? \$\endgroup\$
    – Marton
    Commented Oct 31, 2012 at 10:23
  • \$\begingroup\$ You don't zoom the screen or something (in the emulator) ? \$\endgroup\$
    – Valmond
    Commented Oct 31, 2012 at 12:59
  • \$\begingroup\$ @Marton: I will have a closer look. \$\endgroup\$
    – Den
    Commented Oct 31, 2012 at 13:31

1 Answer 1

0
\$\begingroup\$

Fractional values were caused by IsFullScreen set to false:

_graphics = new GraphicsDeviceManager(this)
                {
                    IsFullScreen = false, // Setting to true will make gesture deltas integer.
                    PreferredBackBufferWidth = 480,
                    PreferredBackBufferHeight = 800
                };

There is no visual difference between using fractional and integer values.

The bug with multiplied movement was caused by incorrect calculations inside my engine.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .