本文整理汇总了C++中tmx::Map::GetNumGroupLayers方法的典型用法代码示例。如果您正苦于以下问题:C++ Map::GetNumGroupLayers方法的具体用法?C++ Map::GetNumGroupLayers怎么用?C++ Map::GetNumGroupLayers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tmx::Map
的用法示例。
在下文中一共展示了Map::GetNumGroupLayers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
printf(" \n");
printf("====================================\n");
printf("Object group : %02d\n", i);
printf("====================================\n");
// Get an object group.
const Tmx::ObjectGroup *objectGroup = map->GetObjectGroup(i);
// Iterate through all objects in the object group.
for (int j = 0; j < objectGroup->GetNumObjects(); ++j)
{
// Get an object.
const Tmx::Object *object = objectGroup->GetObject(j);
// Print information about the object.
printf("Object Name: %s\n", object->GetName().c_str());
printf("Object Position: (%03d, %03d)\n", object->GetX(),
object->GetY());
printf("Object Size: (%03d, %03d)\n", object->GetWidth(),
object->GetHeight());
if(object->GetGid() != 0) {
printf("Object(tile) gid: %d\n", object->GetGid());
printf("Object(tile) type: %s\n", object->GetType().c_str());
}
// Print Polygon points.
const Tmx::Polygon *polygon = object->GetPolygon();
if (polygon != 0)
{
for (int i = 0; i < polygon->GetNumPoints(); i++)
{
const Tmx::Point &point = polygon->GetPoint(i);
printf("Object Polygon: Point %d: (%f, %f)\n", i, point.x,
point.y);
}
}
// Print Polyline points.
const Tmx::Polyline *polyline = object->GetPolyline();
if (polyline != 0)
{
for (int i = 0; i < polyline->GetNumPoints(); i++)
{
const Tmx::Point &point = polyline->GetPoint(i);
printf("Object Polyline: Point %d: (%f, %f)\n", i, point.x,
point.y);
}
}
// Print Text information
const Tmx::Text *text = object->GetText();
if(text != 0)
{
printf("--Object Text--\n");
printf("Font family: %s\n", text->GetFontFamily().c_str());
printf("Pixel size: %d\n", text->GetPixelSize());
printf("Wraps: %d\n", text->Wraps());
printf("Bold: %d, Italic: %d, Underline: %d, Strikeout: %d\n", text->IsBold(), text->IsItalic(),
text->IsUnderline(), text->IsStrikeout());
printf("Kerning: %d\n", text->UseKerning());
printf("Horizontal ALignment: %d\n", text->GetHorizontalAlignment());
printf("Vertical Alignment: %d\n", text->GetVerticalAlignment());
printf("Color: %d, %d, %d, %d", text->GetColor()->GetRed(), text->GetColor()->GetGreen(),
text->GetColor()->GetBlue(), text->GetColor()->GetAlpha());
}
}
}
// Iterate through all of the group layers.
for(int i = 0; i < map->GetNumGroupLayers(); ++i) {
printf(" \n");
printf("====================================\n");
printf("Group Layer : %02d/%s \n", i, map->GetGroupLayer(i)->GetName().c_str());
printf("====================================\n");
// Get a group layer.
const Tmx::GroupLayer *groupLayer = map->GetGroupLayer(i);
printf("Offset X: %d", groupLayer->GetOffsetX());
printf("Offset Y: %d", groupLayer->GetOffsetY());
printf("Number of Children: %d", groupLayer->GetNumChildren());
for(int j = 0; j < groupLayer->GetNumChildren(); j++) {
const Tmx::Layer *childLayer = groupLayer->GetChild(j);
printf("Child Layer Name: %s\n", childLayer->GetName().c_str());
printf("Child Layer Type: %02d\n", childLayer->GetLayerType());
if(childLayer->GetLayerType() == Tmx::TMX_LAYERTYPE_GROUP_LAYER) {
const Tmx::GroupLayer *childGroupLayer = static_cast<const Tmx::GroupLayer*>(childLayer);
printf(" Child group layer number of children: %d\n", childGroupLayer->GetNumChildren());
printf(" Child group layer first child name: %s\n", childGroupLayer->GetChild(0)->GetName().c_str());
printf(" Child group layer first child type: %d\n", childGroupLayer->GetChild(0)->GetLayerType());
}
}
}
delete map;
return 0;
}