766 auto map = TMXTiledMap::create(
"TileMaps/ortho-objects.tmx");
769 Size CC_UNUSED s = map->getContentSize();
770 CCLOG(
"ContentSize: %f, %f", s.width,s.height);
772 auto group = map->getObjectGroup(
"Object Group 1");
773 auto& objects = group->getObjects();
775 Value objectsVal = Value(objects);
776 CCLOG(
"%s", objectsVal.getDescription().c_str());
778 auto drawNode = DrawNode::create();
780 for (
auto& obj : objects)
782 ValueMap& dict = obj.asValueMap();
784 float x = dict[
"x"].asFloat();
785 float y = dict[
"y"].asFloat();
786 float width = dict[
"width"].asFloat();
787 float height = dict[
"height"].asFloat();
789 Color4F color(1.0, 1.0, 1.0, 1.0);
791 drawNode->drawLine( Vec2(x, y), Vec2((x+width), y), color );
792 drawNode->drawLine( Vec2((x+width), y), Vec2((x+width), (y+height)), color );
793 drawNode->drawLine( Vec2((x+width), (y+height)), Vec2(x, (y+height)), color );
794 drawNode->drawLine( Vec2(x, (y+height)), Vec2(x, y), color );
796 map->addChild(drawNode);