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 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.

share|improve this question
    
What have you changed in the code? If the fractional values bother you, you can convert them to some integer type. –  Marton Oct 31 '12 at 8:47
    
The relevant code is pretty much similar. Thanks, but I prefer to fix causes not consequences. –  Den Oct 31 '12 at 9:10
1  
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? –  Marton Oct 31 '12 at 10:23
    
You don't zoom the screen or something (in the emulator) ? –  Valmond Oct 31 '12 at 12:59
    
@Marton: I will have a closer look. –  Den Oct 31 '12 at 13:31
show 1 more comment

1 Answer

up vote 0 down vote accepted

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.

share|improve this answer
add comment

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.