1499 auto map = TMXTiledMap::create(
"TileMaps/test-object-layer.tmx");
1502 Size CC_UNUSED s = map->getContentSize();
1503 CCLOG(
"Contentsize: %f, %f", s.width, s.height);
1505 CCLOG(
"----> Iterating over all the group objects");
1507 auto drawNode = DrawNode::create();
1508 Color4F color(1.0, 1.0, 1.0, 1.0);
1509 auto group = map->getObjectGroup(
"Object Layer 1");
1510 auto& objects = group->getObjects();
1511 for (
auto& obj : objects)
1513 ValueMap& dict = obj.asValueMap();
1515 float x = dict[
"x"].asFloat();
1516 float y = dict[
"y"].asFloat();
1517 float width = dict[
"width"].asFloat();
1518 float height = dict[
"height"].asFloat();
1520 drawNode->drawLine(Vec2(x, y), Vec2(x + width, y), color);
1521 drawNode->drawLine(Vec2(x + width, y), Vec2(x + width, y + height), color);
1522 drawNode->drawLine(Vec2(x + width,y + height), Vec2(x,y + height), color);
1523 drawNode->drawLine(Vec2(x,y + height), Vec2(x,y), color);
1525 map->addChild(drawNode);