How to use the zoom gesture in libgdx?
Posted
by
user3452725
on Game Development
See other posts from Game Development
or by user3452725
Published on 2014-04-02T23:35:44Z
Indexed on
2014/08/21
10:31 UTC
Read the original article
Hit count: 346
I found the example code for the GestureListener
class, but I don't understand the zoom method:
private float initialScale = 1;
public boolean zoom (float originalDistance, float currentDistance) {
float ratio = originalDistance / currentDistance; //I get this
camera.zoom = initialScale * ratio; //This doesn't make sense to me because it seems like every time you pinch to zoom, it resets to the original zoom which is 1. So basically it wouldn't 'save' the zoom right?
System.out.println(camera.zoom); //Prints the camera zoom
return false;
}
Am I not interpreting this right?
© Game Development or respective owner