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


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

本文整理汇总了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);
}
开发者ID:samueljackson92,项目名称:cs264-robotics-prac1,代码行数:12,代码来源:mapper.cpp

示例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();
    }
  }
}
开发者ID:taschetto,项目名称:computerGraphics,代码行数:26,代码来源:PlayState.cpp

示例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;
}
开发者ID:samueljackson92,项目名称:cs264-robotics-prac1,代码行数:53,代码来源:mapper.cpp


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