Beispiel #1
0
bool NzMaterial::SetHeightMap(const NzString& texturePath)
{
	std::unique_ptr<NzTexture> texture(new NzTexture);
	if (!texture->LoadFromFile(texturePath))
	{
		NazaraError("Failed to load texture from \"" + texturePath + '"');
		return false;
	}

	texture->SetPersistent(false);

	SetHeightMap(texture.get());
	texture.release();

	return true;
}
Beispiel #2
0
int main(int argc, char **argv)
{
  /* Create the heightMap */
  SetHeightMap();
  
  /* Test printout for the fractal
    for(int x=0; x<gridSize; x++)
    for(int y=0; y<gridSize; y++)
    printf("heightMap[%d][%d] is %f\n", x, y, heightMap[x][y]);*/
  
  /* Create adjacency list */
  createAdjacencyList();
  printf("Number of dots is %d\n", numDots);

  /* create objects*/
  createPacman();
  createGhosts();

  /* Initialise GLUT - our window, our callbacks, etc */
  InitialiseGLUT(argc, argv);

  /* Do any one-time openGl initialisation that we might require */
  InitialiseOpenGL();

  /* Start up our timer. */
  InitialiseTimer();

  /* Start drawing the scene */
  InitialiseScene();

  /* Enter the main loop */
  glutIdleFunc(UpdateFrame);
  glutMainLoop();

  /* when the window closes, we will end up here. */
  return 0;
}
Beispiel #3
0
void BattleView::SetSimulator(BattleSimulator* simulator)
{
	if (simulator == _simulator)
		return;

	if (_simulator != nullptr)
	{
		for (Unit* unit : _simulator->GetUnits())
			OnRemoveUnit(unit);
		_simulator->RemoveObserver(this);
	}

	_simulator = simulator;
	SetHeightMap(simulator->GetHeightMap());

	delete _casualtyMarker;
	_casualtyMarker = new CasualtyMarker(_simulator);

	GroundMap* groundMap = simulator->GetGroundMap();
	if (groundMap != nullptr)
		OnSetGroundMap(simulator->GetGroundMap());

	_simulator->AddObserver(this);
}