meds
meds

Reputation: 22916

Using Windows Phone 7 pinching in XNA

I'm trying to figure out how to implement pinch-to-zoom functionality. My problem is I'm not sure how to do it algorithmically.

I have the pinch positions of both fingers and the amount they've moved since the last frame. At first I tried making the pinch amount the delta of the distance between the two fingers however every way I've done it around this concept has been unyieldly.

Even if I manage to get the pinching working semi-decently I still have the problem of the zoom direction and how to make the image zoom in on the center of the pinch area...

Is there a proper way of implementing such functionality?

Upvotes: 2

Views: 1655

Answers (3)

Beringela
Beringela

Reputation: 31

I also recommend reading this, a really well implemented "gold standard" pinch:

http://adtsai.blogspot.com/2010/09/pinch-zooming-using-xna4-on-wp7-getting.html

It also makes reference to a pinch to zoom add-in so you can test pinching on the emulator with just a mouse.

Upvotes: 3

Joel Martinez
Joel Martinez

Reputation: 47749

What you want to do is use the built-in gesture API (specifically Pinch and PinchComplete). That way, you can take advantage of the heuristics that the xna/wp7 team has already built in. Your app will feel "more native" this way because it will react like the rest of the OS in reaction to a pinch gesture.

Nick Gravelyn has a great intro to the gesture API here:
http://blogs.msdn.com/b/nicgrave/archive/2010/07/12/touch-gestures-on-windows-phone-7.aspx

Upvotes: 2

user001
user001

Reputation: 444

I found few links of 3rd-party solution...

1) Dual-Touch SDK for Resistive Screens V1.0 Beta, Rotation Alpha

2) SciLor's HD2 / Leo Multitouch .NET CF DLL

I tried using Dual-Touch SDKs which were working fine for Resistive screen mobiles but not for Capacitive Screen mobiles.

Upvotes: -1

Related Questions