本文整理汇总了C++中TMXLayer::setAnchorPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ TMXLayer::setAnchorPoint方法的具体用法?C++ TMXLayer::setAnchorPoint怎么用?C++ TMXLayer::setAnchorPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMXLayer
的用法示例。
在下文中一共展示了TMXLayer::setAnchorPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _dealMap
void BattleLayer::_dealMap(){
Size visibleSize = Director::getInstance()->getVisibleSize();
_battleMapBackground = LayerColor::create(Color4B(0, 0, 0, 255), visibleSize.width, visibleSize.height);
_battleMapBackground->setPosition(0, 0);
this->addChild(_battleMapBackground, 0);
TMXTiledMap *tiledMap = TMXTiledMap::create("res/map/battle_map.tmx");
TMXLayer *backgroundLayer = tiledMap->getLayer("background");
TMXLayer *walkableLayer = tiledMap->getLayer("walkable");
walkableLayer->setAnchorPoint(Vec2(0.5, 0.5));
walkableLayer->setPosition(visibleSize.width / 2, visibleSize.height / 2 + 90);
_battleMapBackground->addChild(walkableLayer, 1);
backgroundLayer->setAnchorPoint(Vec2(0.5, 0.5));
backgroundLayer->setPosition(visibleSize.width / 2, visibleSize.height / 2 + 90);
_battleMapBackground->addChild(backgroundLayer, 1);
Size mapSize = walkableLayer->getLayerSize();
_battleMapTileSize = Size(20, 30);
_battleTileSize = walkableLayer->getMapTileSize();
_battleMapSize = Size(20 * _battleTileSize.width, 30 * _battleTileSize.height);
_battleMap = LayerColor::create(Color4B(255, 255, 255, 150), _battleMapSize.width, _battleMapSize.height);
_battleMap->ignoreAnchorPointForPosition(false);
_battleMap->setAnchorPoint(Vec2(0.5, 0.5));
_battleMap->setPosition(visibleSize.width / 2, visibleSize.height / 2 + 90);
_battleMapBackground->addChild(_battleMap, 5);
}