656 auto map = cocos2d::FastTMXTiledMap::create(
"TileMaps/ortho-objects.tmx");
659 Size CC_UNUSED s = map->getContentSize();
660 CCLOG(
"ContentSize: %f, %f", s.width,s.height);
662 auto group = map->getObjectGroup(
"Object Group 1");
663 auto& objects = group->getObjects();
665 Value objectsVal = Value(objects);
666 CCLOG(
"%s", objectsVal.getDescription().c_str());
668 auto drawNode = DrawNode::create();
669 Color4F color(1.0, 1.0, 1.0, 1.0);
670 for (
auto& obj : objects)
672 ValueMap& dict = obj.asValueMap();
674 float x = dict[
"x"].asFloat();
675 float y = dict[
"y"].asFloat();
676 float width = dict[
"width"].asFloat();
677 float height = dict[
"height"].asFloat();
679 drawNode->drawLine(Vec2(x, y), Vec2(x + width, y), color);
680 drawNode->drawLine(Vec2(x + width, y), Vec2(x + width, y + height), color);
681 drawNode->drawLine(Vec2(x + width,y + height), Vec2(x,y + height), color);
682 drawNode->drawLine(Vec2(x,y + height), Vec2(x,y), color);
684 map->addChild(drawNode);