本文整理汇总了C++中TileNode::getY方法的典型用法代码示例。如果您正苦于以下问题:C++ TileNode::getY方法的具体用法?C++ TileNode::getY怎么用?C++ TileNode::getY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TileNode
的用法示例。
在下文中一共展示了TileNode::getY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
std::vector<Point>* PathGenerator::generatePath(Point start, Point end) {
this->resetTileNodes();
_start = start;
_end = end;
vector<Point>* path = new vector<Point>();
TileNode* startNode = _nodes[int(start.x)][int(start.y)];
startNode->setParent(NULL);
_opened_nodes.push_back(startNode);
TileNode* pathNode = NULL;
while (true) {
pathNode = getMinFNode();
addAdjacentOpenNodes(pathNode);
_passed_nodes.push_back(pathNode);
deletePassedNode(pathNode);
if (pathNode->getX() == int(end.x) && pathNode->getY() == int(end.y)) {
break;
}
}
while (pathNode) {
path->push_back(convertCoordinate2Pixel(pathNode->getX(), pathNode->getY(),
_map_height));
pathNode = pathNode->getParent();
}
std::reverse(path->begin(), path->end());
return path;
}
示例2: addToOpenNode
void PathGenerator::addToOpenNode(int x, int y, adjType adjtype,
TileNode* parent) {
if (x < 0 || y < 0) {
return;
}
if (!canPass(x, y)) {
return;
}
TileNode* node = _nodes[x][y];
if (inPassedNodes(node)) {
return;
} else if (!inOpenNodes(node)) {
_opened_nodes.push_back(node);
int incf;
if (adjtype == Straight)
incf = 10;
else
incf = 14;
node->setG(parent->getG() + incf);
node->setH(descarteDistance(Point(node->getX(), node->getY()), _end) * 10);
node->setF(node->getG() + node->getH());
node->setParent(parent);
}
}