本文整理汇总了C++中TileMap::SetTile方法的典型用法代码示例。如果您正苦于以下问题:C++ TileMap::SetTile方法的具体用法?C++ TileMap::SetTile怎么用?C++ TileMap::SetTile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TileMap
的用法示例。
在下文中一共展示了TileMap::SetTile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ImportTileMap
//.........这里部分代码省略.........
//Import the tilemap tiles if wanted
if(importTileMap)
{
//Tilemap size
if(tileMap.GetColumnsCount() != m_map->GetWidth() || tileMap.GetRowsCount() != m_map->GetHeight())
gd::LogMessage(_("Tilemap size is different."));
tileMap.SetSize(0, 0);
tileMap.SetSize(m_map->GetWidth(), m_map->GetHeight());
if(!importTileSetConf && !importTileSetImage)
CheckTilesCount(tileSet);
//Import layers and tiles
if(m_map->GetNumTileLayers() > 3)
{
gd::LogWarning(_("There are more than 3 tiles layers. Only the 3 firsts will be imported."));
}
else if(m_map->GetNumTileLayers() < 3)
{
gd::LogMessage(_("There are less than 3 tiles layers. Upper layer(s) will be empty."));
}
for(std::size_t i = 0; i < std::min(3, m_map->GetNumTileLayers()); i++)
{
const Tmx::TileLayer *layer = m_map->GetTileLayer(i);
for(std::size_t x = 0; x < tileMap.GetColumnsCount(); x++)
{
for(std::size_t y = 0; y < tileMap.GetRowsCount(); y++)
{
//Only tiles provided by the first tileset are imported (and also tests for empty tiles)
if(m_map->FindTilesetIndex(layer->GetTileGid(x, y)) == 0)
{
tileMap.SetTile(i, x, y, layer->GetTileId(x, y));
}
}
}
}
gd::LogStatus(_("Tilemap content importation completed."));
}
//Import the hitboxes
if(importHitboxes)
{
const Tmx::Tileset *importedTileset = m_map->GetTileset(0);
//Set all tiles not collidable in the tileset
tileSet.ResetHitboxes();
for(std::size_t i = 0; i < tileSet.GetTilesCount(); i++)
tileSet.SetTileCollidable(i, false);
if(!importTileSetConf && !importTileSetImage)
CheckTilesCount(tileSet);
bool hasMoreThanOneObjectPerTile = false;
bool hasNotPolygoneObject = false;
bool hasNotConvexPolygon = false;
for(auto it = importedTileset->GetTiles().cbegin();
it != importedTileset->GetTiles().cend();
++it)
{
const Tmx::Tile *importedTile = *it;
if(importedTile->GetId() < tileSet.GetTilesCount()) //Check if the tileset has enough tiles to receive the imported hitboxes
{