Skip to content

dariodepaolis/cocos2d-x-panzoomlayer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cocos2d-x-panzoomlayer

You can use panning and zooming with inheriting this class!

Usage Example:

  auto map = Sprite::create("map.jpg");
  auto mapSize = map->getContentSize();
  map->setAnchorPoint(Vec2(0, 0));
  map->setPosition(mapSize * -0.5f);
  PanZoomLayer *pzLayer = PanZoomLayer::create();
  this->addChild(pzLayer);
  pzLayer->SetPanBoundsRect(Rect(mapSize.width * -0.5f, mapSize.height * -0.5f, mapSize.width * 1.0f, mapSize.height * 1.0f));
  pzLayer->setScale(1.0f);
  pzLayer->addChild(map);

For reference: Original post on Cocos2Dx Forum

About

Pan with bounds and Pinch to Zoom Layer!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 75.5%
  • Java 9.7%
  • Shell 8.2%
  • Makefile 5.2%
  • C 1.4%