本文整理汇总了C++中Tilemap::rowCount方法的典型用法代码示例。如果您正苦于以下问题:C++ Tilemap::rowCount方法的具体用法?C++ Tilemap::rowCount怎么用?C++ Tilemap::rowCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tilemap
的用法示例。
在下文中一共展示了Tilemap::rowCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paintTileWallCorners
void Builder::paintTileWallCorners(Tilemap& tileMap, uint32_t tileY, uint32_t tileX,
const TileBrush& brush)
{
uint16_t cornerMask = kTileDirection_N | kTileDirection_W |
kTileDirection_S | kTileDirection_E;
Tile& thisTile = tileMap.at(tileY, tileX);
if (thisTile.wall)
{
// this tile already has a wall - no need to run tests
return;
}
//printf("at (%u,%u) => ", tileX, tileY);
uint16_t wallRoleFlags = 0;
if (tileY > 0)
{
const Tile& north = tileMap.at(tileY-1, tileX);
//printf("north:[%u,%u], ", north.floor, north.wall);
if (!tileWallsEqual(north, kTileDirection_W, brush.tileClassId) &&
!tileWallsEqual(north, kTileDirection_E, brush.tileClassId) &&
!tileWallsEqual(north, kTileDirection_NW, brush.tileClassId) &&
!tileWallsEqual(north, kTileDirection_NE, brush.tileClassId))
{
cornerMask &= ~(kTileDirection_N);
}
}
if (tileX > 0)
{
const Tile& west = tileMap.at(tileY, tileX-1);
//printf("west:[%u,%u], ", west.floor, west.wall);
if (!tileWallsEqual(west, kTileDirection_N, brush.tileClassId) &&
!tileWallsEqual(west, kTileDirection_S, brush.tileClassId) &&
!tileWallsEqual(west, kTileDirection_NW, brush.tileClassId) &&
!tileWallsEqual(west, kTileDirection_SW, brush.tileClassId))
{
cornerMask &= ~(kTileDirection_W);
}
}
if (tileY < tileMap.rowCount()-1)
{
const Tile& south = tileMap.at(tileY+1, tileX);
//printf("south:[%u,%u], ", south.floor, south.wall);
if (!tileWallsEqual(south, kTileDirection_W, brush.tileClassId) &&
!tileWallsEqual(south, kTileDirection_E, brush.tileClassId) &&
!tileWallsEqual(south, kTileDirection_SW, brush.tileClassId) &&
!tileWallsEqual(south, kTileDirection_SE, brush.tileClassId))
{
cornerMask &= ~(kTileDirection_S);
}
}
if (tileX < tileMap.columnCount()-1)
{
const Tile& east = tileMap.at(tileY, tileX+1);
//printf("east:[%u,%u], ", east.floor, east.wall);
if (!tileWallsEqual(east, kTileDirection_S, brush.tileClassId) &&
!tileWallsEqual(east, kTileDirection_N, brush.tileClassId) &&
!tileWallsEqual(east, kTileDirection_NE, brush.tileClassId) &&
!tileWallsEqual(east, kTileDirection_SE, brush.tileClassId))
{
cornerMask &= ~(kTileDirection_E);
}
}
if (cornerMask & kTileDirection_W)
{
if (cornerMask & kTileDirection_N)
wallRoleFlags |= kTileDirection_NW;
else if (cornerMask & kTileDirection_S)
wallRoleFlags |= kTileDirection_SW;
}
if (!wallRoleFlags && (cornerMask & kTileDirection_N))
{
if (cornerMask & kTileDirection_E)
wallRoleFlags |= kTileDirection_NE;
}
if (!wallRoleFlags && (cornerMask & kTileDirection_E))
{
if (cornerMask & kTileDirection_S)
wallRoleFlags |= kTileDirection_SE;
}
//printf("cornerFlags, wallRoleFlags (%04x,%04x)\n",
// cornerMask, wallRoleFlags);
wallRoleFlags |= (kTileRole_Wall+kTileRole_Corner);
TileHandle wallTileHandle =
_tileTemplates.tileHandleFromDescriptor(brush.tileCategoryId,
brush.tileClassId,
wallRoleFlags);
thisTile.wall = wallTileHandle;
}
示例2: paintTileWalls
void Builder::paintTileWalls(Tilemap& tileMap, uint32_t tileY, uint32_t tileX,
const TileBrush& brush)
{
const TileTemplate& thisFloorTemplate =
_tileTemplates.tile(tileMap.at(tileY, tileX).floor);
// calculate wall masks, which are used to determine what wall tiles
// to display.
uint16_t wallMask = kTileDirection_N | kTileDirection_E |
kTileDirection_W | kTileDirection_S;
if (tileY > 0 &&
tileFloorsClassIdEqual(tileMap.at(tileY-1, tileX), thisFloorTemplate.classId))
{
wallMask &= ~(kTileDirection_N);
}
if (tileX > 0 &&
tileFloorsClassIdEqual(tileMap.at(tileY, tileX-1), thisFloorTemplate.classId))
{
wallMask &= ~(kTileDirection_W);
}
if (tileY < tileMap.rowCount()-1 &&
tileFloorsClassIdEqual(tileMap.at(tileY+1, tileX), thisFloorTemplate.classId))
{
wallMask &= ~(kTileDirection_S);
}
if (tileX < tileMap.columnCount()-1 &&
tileFloorsClassIdEqual(tileMap.at(tileY, tileX+1), thisFloorTemplate.classId))
{
wallMask &= ~(kTileDirection_E);
}
uint16_t wallRoleFlags = 0;
if (wallMask)
{
if (wallMask & kTileDirection_W)
{
if (wallMask & kTileDirection_N)
wallRoleFlags |= kTileDirection_NW;
else if (wallMask & kTileDirection_S)
wallRoleFlags |= kTileDirection_SW;
else
wallRoleFlags |= kTileDirection_W;
}
if (!wallRoleFlags && (wallMask & kTileDirection_N))
{
// we've already evaluated for West, so only need to eval East
if (wallMask & kTileDirection_E)
wallRoleFlags |= kTileDirection_NE;
else
wallRoleFlags |= kTileDirection_N;
}
if (!wallRoleFlags && (wallMask & kTileDirection_E))
{
// we've already evaluated North, so only care about South
if (wallMask & kTileDirection_S)
wallRoleFlags |= kTileDirection_SE;
else
wallRoleFlags |= kTileDirection_E;
}
if (!wallRoleFlags && (wallMask & kTileDirection_S))
{
// we've already evaluated East and West, so...
wallRoleFlags |= kTileDirection_S;
}
wallRoleFlags |= kTileRole_Wall;
}
TileHandle wallTileHandle =
_tileTemplates.tileHandleFromDescriptor(brush.tileCategoryId,
brush.tileClassId,
wallRoleFlags);
Tile& thisTile = tileMap.at(tileY, tileX);
thisTile.wall = wallTileHandle;
}