本文整理汇总了C++中Cell::GetY方法的典型用法代码示例。如果您正苦于以下问题:C++ Cell::GetY方法的具体用法?C++ Cell::GetY怎么用?C++ Cell::GetY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cell
的用法示例。
在下文中一共展示了Cell::GetY方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MoveToNextCell
void Mapper::MoveToNextCell(Cell start, Cell goal) {
double dx = goal.GetX() - start.GetX();
double dy = goal.GetY() - start.GetY();
dx *= MAP_SCALE;
dy *= MAP_SCALE;
robot_x += dx;
robot_y += dy;
pc.MoveToPosition(robot_x, robot_y);
}
示例2: HandleEvents
void PlayState::HandleEvents(GameEngine* engine)
{
Cell* goal = maze->GetGoal();
if (nacho->GetX() == goal->GetX() && nacho->GetY() == goal->GetY())
{
Cleanup();
level++;
Init();
engine->ChangeState(WinState::Instance());
::glutPostRedisplay();
}
// posteriormente substituir o vector de batteries por uma estrutura de dados mais adequada
// quem sabe um dicionário com chave sendo uma tupla?
for (Cell* cell : maze->GetBatteries())
{
if (nacho->GetX() == cell->GetX() && nacho->GetY() == cell->GetY())
{
maze->RemoveBattery(cell);
nacho->SetRadius(nacho->GetRadius() * 2);
::glutPostRedisplay();
}
}
}
示例3: Localize
Point Mapper::Localize() {
Point me;
me.SetX(-1);
me.SetY(-1);
if(grid_height != grid.GetGridHeight()
|| grid_width != grid.GetGridWidth()) {
int matches = 0;
//loop over exisitng map
for(int i =0; i < map_height - grid.GetGridHeight(); i++) {
for (int j =0; j < map_width - grid.GetGridWidth(); j++) {
int count = 0;
//at each point, check if our grid matches
for(int k = 0; k < grid.GetGridHeight(); k++) {
for (int l = 0; l < grid.GetGridWidth(); l++) {
double mval = mapData[i+k][j+l];
double gval = grid.GetCell(l,k)->GetValue();
if((gval == 0 && mval == 0) || (gval > 0 && mval > 0)) {
count++;
} else if(gval < 0) {
count++;
}
}
}
//if we match every square
if(count == (grid.GetGridWidth()*grid.GetGridHeight())) {
Cell* loc = grid.GetCurrentCell();
me.SetX(loc->GetX()+j);
me.SetY(loc->GetY()+i);
matches++;
}
}
}
grid_width = grid.GetGridWidth();
grid_height = grid.GetGridHeight();
cout << matches << endl;
if(matches == 1) {
localized = true;
}
}
cout << *grid.GetCurrentCell();
cout << "Point x: " << me.GetX() << " y: " << me.GetY() << endl;
return me;
}