1351 auto map = cocos2d::FastTMXTiledMap::create(
"TileMaps/test-object-layer.tmx");
1354 Size CC_UNUSED s = map->getContentSize();
1355 CCLOG(
"Contentsize: %f, %f", s.width, s.height);
1357 CCLOG(
"----> Iterating over all the group objects");
1359 auto drawNode = DrawNode::create();
1360 Color4F color(1.0, 1.0, 1.0, 1.0);
1361 auto group = map->getObjectGroup(
"Object Layer 1");
1362 auto objects = group->getObjects();
1363 for (
auto& obj : objects)
1365 ValueMap& dict = obj.asValueMap();
1367 float x = dict[
"x"].asFloat();
1368 float y = dict[
"y"].asFloat();
1369 float width = dict[
"width"].asFloat();
1370 float height = dict[
"height"].asFloat();
1372 drawNode->drawLine(Vec2(x, y), Vec2(x + width, y), color);
1373 drawNode->drawLine(Vec2(x + width, y), Vec2(x + width, y + height), color);
1374 drawNode->drawLine(Vec2(x + width,y + height), Vec2(x,y + height), color);
1375 drawNode->drawLine(Vec2(x,y + height), Vec2(x,y), color);
1377 map->addChild(drawNode, 10);