Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocos2d with UIPinchGestureRecognizer

In Cocos2d while using the UIPinchGestureRecognizer, how do you get the pinch coordinates?

like image 316
Rhuntr Avatar asked Apr 26 '26 08:04

Rhuntr


1 Answers

-(void)handlePinchFrom:(UIPinchGestureRecognizer*)recognizer
{
    // How to get the coordinates.
    CGPoint touchLocation = [recognizer locationInView:recognizer.view];
    touchLocation = [[CCDirector sharedDirector] convertToGL:touchLocation];
    touchLocation = [self convertToNodeSpace:touchLocation];

    // How to get the scale.
    float scale = recognizer.scale;
}

... assuming that self is your scene.

like image 87
Danyal Aytekin Avatar answered Apr 28 '26 21:04

Danyal Aytekin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!