当前位置: 首页>>代码示例>>C++>>正文


C++ Tile::GetY方法代码示例

本文整理汇总了C++中Tile::GetY方法的典型用法代码示例。如果您正苦于以下问题:C++ Tile::GetY方法的具体用法?C++ Tile::GetY怎么用?C++ Tile::GetY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tile的用法示例。


在下文中一共展示了Tile::GetY方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UpdateTile

void Map::UpdateTile(const Tile& tile)
{
	//tile Range Check
	if (tile.GetX() < 0 || tile.GetX() >= MAP_ROW) return;
	if (tile.GetY() < 0 || tile.GetY() >= MAP_COL) return;

	int row = Utility::Instance().RowOfPoint(tile);
	int col = Utility::Instance().ColOfPoint(tile);
	m_Tiles[row][col].SetTileState(tile.GetTileState());
}
开发者ID:stuzeakd,项目名称:NEXT-study-CPP-BattleShip,代码行数:10,代码来源:Map.cpp

示例2: SetTile

void Map::SetTile(const Tile& tile)
{
	//tile Range Check
	if (tile.GetX() < 0 || tile.GetX() >= MAP_ROW) return;
	if (tile.GetY() < 0 || tile.GetY() >= MAP_COL) return;

	int row = Utility::Instance().RowOfPoint(tile);
	int col = Utility::Instance().ColOfPoint(tile);
	m_Tiles[row][col] = tile;
	//printf("(%d,%d)\n", Utility::Instance().RowOfPoint(tile), Utility::Instance().ColOfPoint(tile));
}
开发者ID:stuzeakd,项目名称:NEXT-study-CPP-BattleShip,代码行数:11,代码来源:Map.cpp

示例3: CalculatePath

bool World::CalculatePath(Vector &start, Vector &finish, std::vector<Vector> &path)
{
    Tile *start_tile = GetTile(start);

    if(!start_tile)
    {
        return false;
    }

    Tile *finish_tile = GetTile(finish);

    if(!finish_tile)
    {
        return false;
    }

    bool result = TileMap::CalculatePath(start_tile, finish_tile);

    if(result)
    {
        for(Tile *tile = GetTile(finish); tile; tile = tile->GetParent())
        {
            path.emplace(path.begin(),
                (TileW * tile->GetX()) + (TileW / 2),
                (TileH * tile->GetY()) + (TileH / 2)
            );
        }

    }

    return result;
}
开发者ID:henrikhasell,项目名称:pathfinding,代码行数:32,代码来源:World.cpp

示例4:

Tile::Tile(const Tile & src)
{
	m_ShipType = src.m_ShipType;
	m_ShipId = src.m_ShipId;
	m_TileState = src.m_TileState;
	SetX(src.GetX());
	SetY(src.GetY());
}
开发者ID:stuzeakd,项目名称:NEXT-study-CPP-BattleShip,代码行数:8,代码来源:Tile.cpp

示例5: PostProcessTile

 void Generator::PostProcessTile(Map& map, Tile& tile, std::map<std::pair<unsigned int, unsigned int>, unsigned int>& tiles, unsigned int id)
 {
     unsigned int x = tile.GetX();
     unsigned int y = tile.GetY();
     Tile* tile2 = map.GetTile(x - 1, y);
     if (tile2 && !tile2->IsBlocked())
     {
         std::map<std::pair<unsigned int, unsigned int>, unsigned int>::iterator itr = tiles.find(std::make_pair(tile2->GetX(), tile2->GetY()));
         if (itr == tiles.end())
         {
             tiles.insert(std::make_pair(std::make_pair(tile2->GetX(), tile2->GetY()), id));
             PostProcessTile(map, *tile2, tiles, id);
         }
     }
     tile2 = map.GetTile(x + 1, y);
     if (tile2 && !tile2->IsBlocked())
     {
         std::map<std::pair<unsigned int, unsigned int>, unsigned int>::iterator itr = tiles.find(std::make_pair(tile2->GetX(), tile2->GetY()));
         if (itr == tiles.end())
         {
             tiles.insert(std::make_pair(std::make_pair(tile2->GetX(), tile2->GetY()), id));
             PostProcessTile(map, *tile2, tiles, id);
         }
     }
     tile2 = map.GetTile(x, y - 1);
     if (tile2 && !tile2->IsBlocked())
     {
         std::map<std::pair<unsigned int, unsigned int>, unsigned int>::iterator itr = tiles.find(std::make_pair(tile2->GetX(), tile2->GetY()));
         if (itr == tiles.end())
         {
             tiles.insert(std::make_pair(std::make_pair(tile2->GetX(), tile2->GetY()), id));
             PostProcessTile(map, *tile2, tiles, id);
         }
     }
     tile2 = map.GetTile(x, y + 1);
     if (tile2 && !tile2->IsBlocked())
     {
         std::map<std::pair<unsigned int, unsigned int>, unsigned int>::iterator itr = tiles.find(std::make_pair(tile2->GetX(), tile2->GetY()));
         if (itr == tiles.end())
         {
             tiles.insert(std::make_pair(std::make_pair(tile2->GetX(), tile2->GetY()), id));
             PostProcessTile(map, *tile2, tiles, id);
         }
     }
 }
开发者ID:LastRitesGames,项目名称:Coatl,代码行数:45,代码来源:coatl_gen.cpp


注:本文中的Tile::GetY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。