本文整理汇总了C++中TMXTiledMap::getChildren方法的典型用法代码示例。如果您正苦于以下问题:C++ TMXTiledMap::getChildren方法的具体用法?C++ TMXTiledMap::getChildren怎么用?C++ TMXTiledMap::getChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMXTiledMap
的用法示例。
在下文中一共展示了TMXTiledMap::getChildren方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addChild
//------------------------------------------------------------------
//
// TMXOrthoTest
//
//------------------------------------------------------------------
TMXOrthoTest::TMXOrthoTest()
{
//
// Test orthogonal with 3d camera and anti-alias textures
//
// it should not flicker. No artifacts should appear
//
//CCLayerColor* color = LayerColor::create( ccc4(64,64,64,255) );
//addChild(color, -1);
TMXTiledMap* map = TMXTiledMap::create("TileMaps/orthogonal-test2.tmx");
addChild(map, 0, kTagTileMap);
Size CC_UNUSED s = map->getContentSize();
CCLOG("ContentSize: %f, %f", s.width,s.height);
Array * pChildrenArray = map->getChildren();
SpriteBatchNode* child = NULL;
Object* pObject = NULL;
CCARRAY_FOREACH(pChildrenArray, pObject)
{
child = (SpriteBatchNode*)pObject;
if(!child)
break;
child->getTexture()->setAntiAliasTexParameters();
}
示例2: init
bool MapLayer::init()
{
bool bRet = false;
do
{
CC_BREAK_IF(!Layer::init());
Size winSize = Director::getInstance()->getWinSize();
// 初始化地图
TMXTiledMap* map = TMXTiledMap::create("iso-test-zorder.tmx");
map->setPosition((winSize.width - map->getContentSize().width)/2, 0);
this->addChild(map, 0, kTagTileMap);
// 初始化任务
_tamara = Sprite::create("grossinis_sister1.png");
map->addChild(_tamara, map->getChildren().size());
_tamara->retain();
int mapWidth = map->getMapSize().width * map->getTileSize().width;
int mapHeight = map->getMapSize().height * map->getTileSize().height;
_tamara->setPosition(mapWidth/2, 112);
_tamara->setAnchorPoint(Point(0.5f, 0));
_vmove = -1;
_hmove = -1;
_stepIndex = -1;
_myAstar = new Astar();
this->scheduleUpdate();
auto listener = EventListenerTouchOneByOne::create();
listener->onTouchBegan = CC_CALLBACK_2(MapLayer::onTouchBegan, this);
this->_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
bRet = true;
} while (0);
return bRet;
}